summaryrefslogtreecommitdiffstats
path: root/WebKit/chromium/src
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/chromium/src')
-rw-r--r--WebKit/chromium/src/AsyncFileWriterChromium.cpp92
-rw-r--r--WebKit/chromium/src/AsyncFileWriterChromium.h (renamed from WebKit/chromium/src/js/DevToolsHostStub.js)48
-rw-r--r--WebKit/chromium/src/ChromeClientImpl.cpp85
-rw-r--r--WebKit/chromium/src/ChromeClientImpl.h1
-rw-r--r--WebKit/chromium/src/DOMUtilitiesPrivate.cpp2
-rw-r--r--WebKit/chromium/src/FrameLoaderClientImpl.cpp17
-rw-r--r--WebKit/chromium/src/FrameLoaderClientImpl.h1
-rw-r--r--WebKit/chromium/src/GraphicsContext3D.cpp287
-rw-r--r--WebKit/chromium/src/GraphicsContext3DInternal.h301
-rw-r--r--WebKit/chromium/src/IDBCursorBackendProxy.cpp14
-rw-r--r--WebKit/chromium/src/IDBCursorBackendProxy.h2
-rwxr-xr-xWebKit/chromium/src/IDBFactoryBackendProxy.cpp4
-rwxr-xr-xWebKit/chromium/src/IDBFactoryBackendProxy.h2
-rw-r--r--WebKit/chromium/src/IDBIndexBackendProxy.cpp34
-rw-r--r--WebKit/chromium/src/IDBIndexBackendProxy.h6
-rw-r--r--WebKit/chromium/src/InspectorClientImpl.cpp22
-rw-r--r--WebKit/chromium/src/InspectorClientImpl.h5
-rw-r--r--WebKit/chromium/src/ResourceHandle.cpp20
-rw-r--r--WebKit/chromium/src/WebAccessibilityCacheImpl.cpp3
-rw-r--r--WebKit/chromium/src/WebAccessibilityObject.cpp9
-rw-r--r--WebKit/chromium/src/WebDataSourceImpl.cpp8
-rw-r--r--WebKit/chromium/src/WebDataSourceImpl.h1
-rw-r--r--WebKit/chromium/src/WebDevToolsAgentImpl.cpp61
-rw-r--r--WebKit/chromium/src/WebDevToolsAgentImpl.h6
-rw-r--r--WebKit/chromium/src/WebDeviceOrientationClientMock.cpp5
-rw-r--r--WebKit/chromium/src/WebFormElement.cpp2
-rw-r--r--WebKit/chromium/src/WebFrameImpl.cpp28
-rw-r--r--WebKit/chromium/src/WebFrameImpl.h2
-rw-r--r--WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp86
-rw-r--r--WebKit/chromium/src/WebGeolocationServiceMock.cpp70
-rw-r--r--WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp48
-rw-r--r--WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h9
-rw-r--r--WebKit/chromium/src/WebHTTPBody.cpp14
-rw-r--r--WebKit/chromium/src/WebIDBCursorImpl.cpp14
-rw-r--r--WebKit/chromium/src/WebIDBCursorImpl.h2
-rwxr-xr-xWebKit/chromium/src/WebIDBFactoryImpl.cpp4
-rwxr-xr-xWebKit/chromium/src/WebIDBFactoryImpl.h2
-rw-r--r--WebKit/chromium/src/WebIDBIndexImpl.cpp30
-rw-r--r--WebKit/chromium/src/WebIDBIndexImpl.h6
-rw-r--r--WebKit/chromium/src/WebInputElement.cpp22
-rw-r--r--WebKit/chromium/src/WebKit.cpp5
-rw-r--r--WebKit/chromium/src/WebPasswordFormUtils.cpp8
-rw-r--r--WebKit/chromium/src/WebPopupMenuImpl.cpp10
-rw-r--r--WebKit/chromium/src/WebPopupMenuImpl.h2
-rw-r--r--WebKit/chromium/src/WebSearchableFormData.cpp23
-rw-r--r--WebKit/chromium/src/WebViewImpl.cpp361
-rw-r--r--WebKit/chromium/src/WebViewImpl.h44
-rw-r--r--WebKit/chromium/src/js/DebuggerScript.js271
-rw-r--r--WebKit/chromium/src/js/DevTools.js4
-rw-r--r--WebKit/chromium/src/js/Tests.js224
50 files changed, 1288 insertions, 1039 deletions
diff --git a/WebKit/chromium/src/AsyncFileWriterChromium.cpp b/WebKit/chromium/src/AsyncFileWriterChromium.cpp
new file mode 100644
index 0000000..4bfc988
--- /dev/null
+++ b/WebKit/chromium/src/AsyncFileWriterChromium.cpp
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "AsyncFileWriterChromium.h"
+
+#if ENABLE(FILE_SYSTEM)
+
+#include "Blob.h"
+#include "FileWriterClient.h"
+#include "WebFileWriter.h"
+#include "WebURL.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+AsyncFileWriterChromium::AsyncFileWriterChromium(FileWriterClient* client)
+ : m_client(client)
+{
+}
+
+void AsyncFileWriterChromium::setWebFileWriter(WebFileWriter* writer)
+{
+ ASSERT(!m_writer);
+ m_writer = writer;
+}
+
+void AsyncFileWriterChromium::write(long long position, Blob* data)
+{
+ ASSERT(m_writer);
+ m_writer->write(position, WebURL(data->url()));
+}
+
+void AsyncFileWriterChromium::truncate(long long length)
+{
+ ASSERT(m_writer);
+ m_writer->truncate(length);
+}
+
+void AsyncFileWriterChromium::abort()
+{
+ ASSERT(m_writer);
+ m_writer->cancel();
+}
+
+void AsyncFileWriterChromium::didWrite(long long bytes, bool complete)
+{
+ ASSERT(m_writer);
+ m_client->didWrite(bytes, complete);
+}
+
+void AsyncFileWriterChromium::didTruncate(long long length)
+{
+ m_client->didTruncate(length);
+}
+
+void AsyncFileWriterChromium::didFail(WebFileError error)
+{
+ m_client->didFail(error);
+}
+
+} // namespace
+
+#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebKit/chromium/src/js/DevToolsHostStub.js b/WebKit/chromium/src/AsyncFileWriterChromium.h
index d3333e2..92743ca 100644
--- a/WebKit/chromium/src/js/DevToolsHostStub.js
+++ b/WebKit/chromium/src/AsyncFileWriterChromium.h
@@ -28,11 +28,47 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/**
- * @fileoverview These stubs emulate backend functionality and allows
- * DevTools frontend to function as a standalone web app.
- */
+#ifndef AsyncFileWriterChromium_h
+#define AsyncFileWriterChromium_h
+
+#if ENABLE(FILE_SYSTEM)
-if (!window["RemoteDebuggerCommandExecutor"]) {
- window["RemoteDebuggerCommandExecutor"] = {};
+#include "AsyncFileWriter.h"
+#include "WebFileError.h"
+#include "WebFileWriterClient.h"
+
+namespace WebCore {
+class Blob;
+class FileWriterClient;
}
+
+namespace WebKit {
+
+class WebFileWriter;
+
+class AsyncFileWriterChromium : public WebCore::AsyncFileWriter, public WebFileWriterClient {
+public:
+ AsyncFileWriterChromium(WebCore::FileWriterClient* client);
+
+ void setWebFileWriter(WebFileWriter* writer);
+
+ // FileWriter
+ virtual void write(long long position, WebCore::Blob* data);
+ virtual void truncate(long long length);
+ virtual void abort();
+
+ // WebFileWriterClient
+ virtual void didWrite(long long bytes, bool complete);
+ virtual void didTruncate(long long length);
+ virtual void didFail(WebFileError);
+
+private:
+ OwnPtr<WebFileWriter> m_writer;
+ WebCore::FileWriterClient* m_client;
+};
+
+} // namespace
+
+#endif // ENABLE(FILE_SYSTEM)
+
+#endif // AsyncFileWriterChromium_h
diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp
index 8a3eda6..8c13cbb 100644
--- a/WebKit/chromium/src/ChromeClientImpl.cpp
+++ b/WebKit/chromium/src/ChromeClientImpl.cpp
@@ -56,11 +56,10 @@
#include "NotificationPresenterImpl.h"
#include "Page.h"
#include "PopupMenuChromium.h"
-#include "SearchPopupMenuChromium.h"
#include "ScriptController.h"
+#include "SearchPopupMenuChromium.h"
#include "SecurityOrigin.h"
#include "SharedGraphicsContext3D.h"
-#include "WebGeolocationService.h"
#if USE(V8)
#include "V8Proxy.h"
#endif
@@ -70,6 +69,7 @@
#include "WebFileChooserCompletionImpl.h"
#include "WebFrameClient.h"
#include "WebFrameImpl.h"
+#include "WebGeolocationService.h"
#include "WebInputEvent.h"
#include "WebKit.h"
#include "WebNode.h"
@@ -103,6 +103,46 @@ static WebPopupType convertPopupType(PopupContainer::PopupType type)
}
}
+// Converts a WebCore::AXObjectCache::AXNotification to a WebKit::WebAccessibilityNotification
+static WebAccessibilityNotification toWebAccessibilityNotification(AXObjectCache::AXNotification notification)
+{
+ switch (notification) {
+ case AXObjectCache::AXActiveDescendantChanged:
+ return WebAccessibilityNotificationActiveDescendantChanged;
+ case AXObjectCache::AXCheckedStateChanged:
+ return WebAccessibilityNotificationCheckedStateChanged;
+ case AXObjectCache::AXChildrenChanged:
+ return WebAccessibilityNotificationChildrenChanged;
+ case AXObjectCache::AXFocusedUIElementChanged:
+ return WebAccessibilityNotificationFocusedUIElementChanged;
+ case AXObjectCache::AXLayoutComplete:
+ return WebAccessibilityNotificationLayoutComplete;
+ case AXObjectCache::AXLoadComplete:
+ return WebAccessibilityNotificationLoadComplete;
+ case AXObjectCache::AXSelectedChildrenChanged:
+ return WebAccessibilityNotificationSelectedChildrenChanged;
+ case AXObjectCache::AXSelectedTextChanged:
+ return WebAccessibilityNotificationSelectedTextChanged;
+ case AXObjectCache::AXValueChanged:
+ return WebAccessibilityNotificationValueChanged;
+ case AXObjectCache::AXScrolledToAnchor:
+ return WebAccessibilityNotificationScrolledToAnchor;
+ case AXObjectCache::AXLiveRegionChanged:
+ return WebAccessibilityNotificationLiveRegionChanged;
+ case AXObjectCache::AXMenuListValueChanged:
+ return WebAccessibilityNotificationMenuListValueChanged;
+ case AXObjectCache::AXRowCountChanged:
+ return WebAccessibilityNotificationRowCountChanged;
+ case AXObjectCache::AXRowCollapsed:
+ return WebAccessibilityNotificationRowCollapsed;
+ case AXObjectCache::AXRowExpanded:
+ return WebAccessibilityNotificationRowExpanded;
+ default:
+ ASSERT_NOT_REACHED();
+ return WebAccessibilityNotificationInvalid;
+ }
+}
+
ChromeClientImpl::ChromeClientImpl(WebViewImpl* webView)
: m_webView(webView)
, m_toolbarsVisible(true)
@@ -343,9 +383,9 @@ bool ChromeClientImpl::statusbarVisible()
void ChromeClientImpl::setScrollbarsVisible(bool value)
{
m_scrollbarsVisible = value;
- WebFrameImpl* web_frame = static_cast<WebFrameImpl*>(m_webView->mainFrame());
- if (web_frame)
- web_frame->setCanHaveScrollbars(value);
+ WebFrameImpl* webFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame());
+ if (webFrame)
+ webFrame->setCanHaveScrollbars(value);
}
bool ChromeClientImpl::scrollbarsVisible()
@@ -493,8 +533,15 @@ void ChromeClientImpl::invalidateContentsAndWindow(const IntRect& updateRect, bo
{
if (updateRect.isEmpty())
return;
- if (m_webView->client())
- m_webView->client()->didInvalidateRect(updateRect);
+#if USE(ACCELERATED_COMPOSITING)
+ if (!m_webView->isAcceleratedCompositingActive()) {
+#endif
+ if (m_webView->client())
+ m_webView->client()->didInvalidateRect(updateRect);
+#if USE(ACCELERATED_COMPOSITING)
+ } else
+ m_webView->invalidateRootLayerRect(updateRect);
+#endif
}
void ChromeClientImpl::invalidateContentsForSlowScroll(const IntRect& updateRect, bool immediate)
@@ -508,11 +555,18 @@ void ChromeClientImpl::scroll(
const IntRect& clipRect)
{
m_webView->hidePopups();
- if (m_webView->client()) {
- int dx = scrollDelta.width();
- int dy = scrollDelta.height();
- m_webView->client()->didScrollRect(dx, dy, clipRect);
- }
+#if USE(ACCELERATED_COMPOSITING)
+ if (!m_webView->isAcceleratedCompositingActive()) {
+#endif
+ if (m_webView->client()) {
+ int dx = scrollDelta.width();
+ int dy = scrollDelta.height();
+ m_webView->client()->didScrollRect(dx, dy, clipRect);
+ }
+#if USE(ACCELERATED_COMPOSITING)
+ } else
+ m_webView->scrollRootLayerRect(scrollDelta, clipRect);
+#endif
}
IntPoint ChromeClientImpl::screenToWindow(const IntPoint&) const
@@ -720,6 +774,13 @@ void ChromeClientImpl::didChangeAccessibilityObjectChildren(WebCore::Accessibili
m_webView->client()->didChangeAccessibilityObjectChildren(WebAccessibilityObject(obj));
}
+void ChromeClientImpl::postAccessibilityNotification(AccessibilityObject* obj, AXObjectCache::AXNotification notification)
+{
+ // Alert assistive technology about the accessibility object notification.
+ if (obj)
+ m_webView->client()->postAccessibilityNotification(WebAccessibilityObject(obj), toWebAccessibilityNotification(notification));
+}
+
#if ENABLE(NOTIFICATIONS)
NotificationPresenter* ChromeClientImpl::notificationPresenter() const
{
diff --git a/WebKit/chromium/src/ChromeClientImpl.h b/WebKit/chromium/src/ChromeClientImpl.h
index d16d8f6..fbaac87 100644
--- a/WebKit/chromium/src/ChromeClientImpl.h
+++ b/WebKit/chromium/src/ChromeClientImpl.h
@@ -168,6 +168,7 @@ public:
virtual void popupClosed(WebCore::PopupContainer* popupContainer);
virtual void didChangeAccessibilityObjectState(WebCore::AccessibilityObject*);
virtual void didChangeAccessibilityObjectChildren(WebCore::AccessibilityObject*);
+ virtual void postAccessibilityNotification(WebCore::AccessibilityObject*, WebCore::AXObjectCache::AXNotification);
// ChromeClientImpl:
void setCursor(const WebCursorInfo& cursor);
diff --git a/WebKit/chromium/src/DOMUtilitiesPrivate.cpp b/WebKit/chromium/src/DOMUtilitiesPrivate.cpp
index 4081db6..6f952f7 100644
--- a/WebKit/chromium/src/DOMUtilitiesPrivate.cpp
+++ b/WebKit/chromium/src/DOMUtilitiesPrivate.cpp
@@ -97,7 +97,7 @@ bool elementHasLegalLinkAttribute(const Element* element,
if (element->hasTagName(HTMLNames::inputTag)) {
const HTMLInputElement* input =
static_cast<const HTMLInputElement*>(element);
- if (input->inputType() == HTMLInputElement::IMAGE)
+ if (input->isImageButton())
return true;
}
} else if (attrName == HTMLNames::hrefAttr) {
diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp
index ea668c7..61d43df 100644
--- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp
+++ b/WebKit/chromium/src/FrameLoaderClientImpl.cpp
@@ -1053,8 +1053,7 @@ void FrameLoaderClientImpl::committedLoad(DocumentLoader* loader, const char* da
// If we are sending data to MediaDocument, we should stop here
// and cancel the request.
- if (m_webFrame->frame()->document()
- && m_webFrame->frame()->document()->isMediaDocument())
+ if (m_webFrame->frame()->document()->isMediaDocument())
loader->cancelMainResourceLoad(pluginWillHandleLoadError(loader->response()));
// The plugin widget could have been created in the m_webFrame->DidReceiveData
@@ -1207,6 +1206,12 @@ bool FrameLoaderClientImpl::canHandleRequest(const ResourceRequest& request) con
m_webFrame, WrappedResourceRequest(request));
}
+bool FrameLoaderClientImpl::canShowMIMETypeAsHTML(const String& MIMEType) const
+{
+ notImplemented();
+ return false;
+}
+
bool FrameLoaderClientImpl::canShowMIMEType(const String& mimeType) const
{
// This method is called to determine if the media type can be shown
@@ -1398,12 +1403,12 @@ PassRefPtr<Widget> FrameLoaderClientImpl::createPlugin(
if (!webPlugin->initialize(container.get()))
return 0;
- if (m_webFrame->frame()->view()->zoomFactor() != 1) {
+ bool zoomTextOnly = m_webFrame->viewImpl()->zoomTextOnly();
+ float zoomFactor = zoomTextOnly ? m_webFrame->frame()->textZoomFactor() : m_webFrame->frame()->pageZoomFactor();
+ if (zoomFactor != 1) {
// There's a saved zoom level, so tell the plugin about it since
// WebViewImpl::setZoomLevel was called before the plugin was created.
- webPlugin->setZoomFactor(
- m_webFrame->frame()->view()->zoomFactor(),
- m_webFrame->frame()->page()->settings()->zoomMode() == ZoomTextOnly);
+ webPlugin->setZoomFactor(zoomFactor, zoomTextOnly);
}
// The element might have been removed during plugin initialization!
diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.h b/WebKit/chromium/src/FrameLoaderClientImpl.h
index 361bae4..57105de 100644
--- a/WebKit/chromium/src/FrameLoaderClientImpl.h
+++ b/WebKit/chromium/src/FrameLoaderClientImpl.h
@@ -149,6 +149,7 @@ public:
virtual bool shouldFallBack(const WebCore::ResourceError&);
virtual bool canHandleRequest(const WebCore::ResourceRequest&) const;
virtual bool canShowMIMEType(const WTF::String& MIMEType) const;
+ virtual bool canShowMIMETypeAsHTML(const String& MIMEType) const;
virtual bool representationExistsForURLScheme(const WTF::String& URLScheme) const;
virtual WTF::String generatedMIMETypeForURLScheme(const WTF::String& URLScheme) const;
virtual void frameLoadCompleted();
diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp
index 3051b9b..c78d334 100644
--- a/WebKit/chromium/src/GraphicsContext3D.cpp
+++ b/WebKit/chromium/src/GraphicsContext3D.cpp
@@ -39,6 +39,7 @@
#include "CanvasRenderingContext.h"
#include "Chrome.h"
#include "ChromeClientImpl.h"
+#include "GraphicsContext3DInternal.h"
#include "HTMLCanvasElement.h"
#include "HTMLImageElement.h"
#include "ImageBuffer.h"
@@ -60,8 +61,6 @@
#include <CoreGraphics/CGImage.h>
#endif
-// using namespace std;
-
// There are two levels of delegation in this file:
//
// 1. GraphicsContext3D delegates to GraphicsContext3DInternal. This is done
@@ -82,239 +81,6 @@ namespace WebCore {
//----------------------------------------------------------------------
// GraphicsContext3DInternal
-class GraphicsContext3DInternal {
-public:
- GraphicsContext3DInternal();
- ~GraphicsContext3DInternal();
-
- bool initialize(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow);
-
- PlatformGraphicsContext3D platformGraphicsContext3D() const;
- Platform3DObject platformTexture() const;
-
- bool makeContextCurrent();
-
- int sizeInBytes(int type);
-
- void reshape(int width, int height);
-
- void paintRenderingResultsToCanvas(CanvasRenderingContext* context);
- bool paintsIntoCanvasBuffer() const;
-
- void prepareTexture();
-
-#if USE(ACCELERATED_COMPOSITING)
- WebGLLayerChromium* platformLayer() const;
-#endif
- bool isGLES2Compliant() const;
- bool isGLES2NPOTStrict() const;
- bool isErrorGeneratedOnOutOfBoundsAccesses() const;
-
- //----------------------------------------------------------------------
- // Entry points for WebGL.
- //
- void activeTexture(unsigned long texture);
- void attachShader(Platform3DObject program, Platform3DObject shader);
- void bindAttribLocation(Platform3DObject, unsigned long index, const String& name);
- void bindBuffer(unsigned long target, Platform3DObject);
- void bindFramebuffer(unsigned long target, Platform3DObject);
- void bindRenderbuffer(unsigned long target, Platform3DObject);
- void bindTexture(unsigned long target, Platform3DObject texture);
- void blendColor(double red, double green, double blue, double alpha);
- void blendEquation(unsigned long mode);
- void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha);
- void blendFunc(unsigned long sfactor, unsigned long dfactor);
- void blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha);
-
- void bufferData(unsigned long target, int size, unsigned long usage);
- void bufferData(unsigned long target, int size, const void* data, unsigned long usage);
- void bufferSubData(unsigned long target, long offset, int size, const void* data);
-
- unsigned long checkFramebufferStatus(unsigned long target);
- void clear(unsigned long mask);
- void clearColor(double red, double green, double blue, double alpha);
- void clearDepth(double depth);
- void clearStencil(long s);
- void colorMask(bool red, bool green, bool blue, bool alpha);
- void compileShader(Platform3DObject);
-
- void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border);
- void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height);
- void cullFace(unsigned long mode);
- void depthFunc(unsigned long func);
- void depthMask(bool flag);
- void depthRange(double zNear, double zFar);
- void detachShader(Platform3DObject, Platform3DObject);
- void disable(unsigned long cap);
- void disableVertexAttribArray(unsigned long index);
- void drawArrays(unsigned long mode, long first, long count);
- void drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset);
-
- void enable(unsigned long cap);
- void enableVertexAttribArray(unsigned long index);
- void finish();
- void flush();
- void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, Platform3DObject);
- void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, Platform3DObject, long level);
- void frontFace(unsigned long mode);
- void generateMipmap(unsigned long target);
-
- bool getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo&);
- bool getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo&);
-
- void getAttachedShaders(Platform3DObject program, int maxCount, int* count, unsigned int* shaders);
-
- int getAttribLocation(Platform3DObject, const String& name);
-
- void getBooleanv(unsigned long pname, unsigned char* value);
-
- void getBufferParameteriv(unsigned long target, unsigned long pname, int* value);
-
- GraphicsContext3D::Attributes getContextAttributes();
-
- unsigned long getError();
-
- void getFloatv(unsigned long pname, float* value);
-
- void getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname, int* value);
-
- void getIntegerv(unsigned long pname, int* value);
-
- void getProgramiv(Platform3DObject program, unsigned long pname, int* value);
-
- String getProgramInfoLog(Platform3DObject);
-
- void getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value);
-
- void getShaderiv(Platform3DObject, unsigned long pname, int* value);
-
- String getShaderInfoLog(Platform3DObject);
-
- String getShaderSource(Platform3DObject);
- String getString(unsigned long name);
-
- void getTexParameterfv(unsigned long target, unsigned long pname, float* value);
- void getTexParameteriv(unsigned long target, unsigned long pname, int* value);
-
- void getUniformfv(Platform3DObject program, long location, float* value);
- void getUniformiv(Platform3DObject program, long location, int* value);
-
- long getUniformLocation(Platform3DObject, const String& name);
-
- void getVertexAttribfv(unsigned long index, unsigned long pname, float* value);
- void getVertexAttribiv(unsigned long index, unsigned long pname, int* value);
-
- long getVertexAttribOffset(unsigned long index, unsigned long pname);
-
- void hint(unsigned long target, unsigned long mode);
- bool isBuffer(Platform3DObject);
- bool isEnabled(unsigned long cap);
- bool isFramebuffer(Platform3DObject);
- bool isProgram(Platform3DObject);
- bool isRenderbuffer(Platform3DObject);
- bool isShader(Platform3DObject);
- bool isTexture(Platform3DObject);
- void lineWidth(double);
- void linkProgram(Platform3DObject);
- void pixelStorei(unsigned long pname, long param);
- void polygonOffset(double factor, double units);
-
- void readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type, void* data);
-
- void releaseShaderCompiler();
- void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height);
- void sampleCoverage(double value, bool invert);
- void scissor(long x, long y, unsigned long width, unsigned long height);
- void shaderSource(Platform3DObject, const String& string);
- void stencilFunc(unsigned long func, long ref, unsigned long mask);
- void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask);
- void stencilMask(unsigned long mask);
- void stencilMaskSeparate(unsigned long face, unsigned long mask);
- void stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass);
- void stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass);
-
- // These next several functions return an error code (0 if no errors) rather than using an ExceptionCode.
- // Currently they return -1 on any error.
- int texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, void* pixels);
-
- void texParameterf(unsigned target, unsigned pname, float param);
- void texParameteri(unsigned target, unsigned pname, int param);
-
- int texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned width, unsigned height, unsigned format, unsigned type, void* pixels);
-
- void uniform1f(long location, float x);
- void uniform1fv(long location, float* v, int size);
- void uniform1i(long location, int x);
- void uniform1iv(long location, int* v, int size);
- void uniform2f(long location, float x, float y);
- void uniform2fv(long location, float* v, int size);
- void uniform2i(long location, int x, int y);
- void uniform2iv(long location, int* v, int size);
- void uniform3f(long location, float x, float y, float z);
- void uniform3fv(long location, float* v, int size);
- void uniform3i(long location, int x, int y, int z);
- void uniform3iv(long location, int* v, int size);
- void uniform4f(long location, float x, float y, float z, float w);
- void uniform4fv(long location, float* v, int size);
- void uniform4i(long location, int x, int y, int z, int w);
- void uniform4iv(long location, int* v, int size);
- void uniformMatrix2fv(long location, bool transpose, float* value, int size);
- void uniformMatrix3fv(long location, bool transpose, float* value, int size);
- void uniformMatrix4fv(long location, bool transpose, float* value, int size);
-
- void useProgram(Platform3DObject);
- void validateProgram(Platform3DObject);
-
- void vertexAttrib1f(unsigned long indx, float x);
- void vertexAttrib1fv(unsigned long indx, float* values);
- void vertexAttrib2f(unsigned long indx, float x, float y);
- void vertexAttrib2fv(unsigned long indx, float* values);
- void vertexAttrib3f(unsigned long indx, float x, float y, float z);
- void vertexAttrib3fv(unsigned long indx, float* values);
- void vertexAttrib4f(unsigned long indx, float x, float y, float z, float w);
- void vertexAttrib4fv(unsigned long indx, float* values);
- void vertexAttribPointer(unsigned long indx, int size, int type, bool normalized,
- unsigned long stride, unsigned long offset);
-
- void viewport(long x, long y, unsigned long width, unsigned long height);
-
- unsigned createBuffer();
- unsigned createFramebuffer();
- unsigned createProgram();
- unsigned createRenderbuffer();
- unsigned createShader(unsigned long);
- unsigned createTexture();
-
- void deleteBuffer(unsigned);
- void deleteFramebuffer(unsigned);
- void deleteProgram(unsigned);
- void deleteRenderbuffer(unsigned);
- void deleteShader(unsigned);
- void deleteTexture(unsigned);
-
- void synthesizeGLError(unsigned long error);
- bool supportsBGRA();
-
-private:
- OwnPtr<WebKit::WebGraphicsContext3D> m_impl;
- WebKit::WebViewImpl* m_webViewImpl;
-#if USE(ACCELERATED_COMPOSITING)
- RefPtr<WebGLLayerChromium> m_compositingLayer;
-#endif
-#if PLATFORM(SKIA)
- // If the width and height of the Canvas's backing store don't
- // match those that we were given in the most recent call to
- // reshape(), then we need an intermediate bitmap to read back the
- // frame buffer into. This seems to happen when CSS styles are
- // used to resize the Canvas.
- SkBitmap m_resizingBitmap;
-#endif
-
-#if PLATFORM(CG)
- unsigned char* m_renderOutput;
-#endif
-};
-
GraphicsContext3DInternal::GraphicsContext3DInternal()
: m_webViewImpl(0)
#if PLATFORM(SKIA)
@@ -334,8 +100,7 @@ GraphicsContext3DInternal::~GraphicsContext3DInternal()
#endif
}
-bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs,
- HostWindow* hostWindow)
+bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, bool renderDirectlyToHostWindow)
{
WebKit::WebGraphicsContext3D::Attributes webAttributes;
webAttributes.alpha = attrs.alpha;
@@ -354,7 +119,7 @@ bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs,
if (!m_webViewImpl)
return false;
- if (!webContext->initialize(webAttributes, m_webViewImpl)) {
+ if (!webContext->initialize(webAttributes, m_webViewImpl, renderDirectlyToHostWindow)) {
delete webContext;
return false;
}
@@ -366,6 +131,13 @@ bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs,
return true;
}
+WebKit::WebGraphicsContext3D* GraphicsContext3DInternal::extractWebGraphicsContext3D(GraphicsContext3D* context)
+{
+ if (!context)
+ return 0;
+ return context->m_internal->m_impl.get();
+}
+
PlatformGraphicsContext3D GraphicsContext3DInternal::platformGraphicsContext3D() const
{
return m_impl.get();
@@ -528,6 +300,12 @@ void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4) \
m_impl->name(a1, a2, a3, a4); \
}
+#define DELEGATE_TO_IMPL_4R(name, t1, t2, t3, t4, rt) \
+rt GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4) \
+{ \
+ return m_impl->name(a1, a2, a3, a4); \
+}
+
#define DELEGATE_TO_IMPL_5(name, t1, t2, t3, t4, t5) \
void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \
{ \
@@ -898,6 +676,13 @@ DELEGATE_TO_IMPL_1(deleteTexture, unsigned)
DELEGATE_TO_IMPL_1(synthesizeGLError, unsigned long)
DELEGATE_TO_IMPL_R(supportsBGRA, bool)
+DELEGATE_TO_IMPL_R(supportsMapSubCHROMIUM, bool)
+DELEGATE_TO_IMPL_4R(mapBufferSubDataCHROMIUM, unsigned, int, int, unsigned, void*)
+DELEGATE_TO_IMPL_1(unmapBufferSubDataCHROMIUM, const void*)
+DELEGATE_TO_IMPL_9R(mapTexSubImage2DCHROMIUM, unsigned, int, int, int, int, int, unsigned, unsigned, unsigned, void*)
+DELEGATE_TO_IMPL_1(unmapTexSubImage2DCHROMIUM, const void*)
+DELEGATE_TO_IMPL_R(supportsCopyTextureToParentTextureCHROMIUM, bool)
+DELEGATE_TO_IMPL_2(copyTextureToParentTextureCHROMIUM, unsigned, unsigned)
//----------------------------------------------------------------------
// GraphicsContext3D
@@ -960,6 +745,12 @@ void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4) \
m_internal->name(a1, a2, a3, a4); \
}
+#define DELEGATE_TO_INTERNAL_4R(name, t1, t2, t3, t4, rt) \
+rt GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4) \
+{ \
+ return m_internal->name(a1, a2, a3, a4); \
+}
+
#define DELEGATE_TO_INTERNAL_5(name, t1, t2, t3, t4, t5) \
void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \
{ \
@@ -1002,7 +793,7 @@ rt GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a
return m_internal->name(a1, a2, a3, a4, a5, a6, a7, a8, a9); \
}
-GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes, HostWindow*)
+GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes, HostWindow*, bool)
{
}
@@ -1010,15 +801,14 @@ GraphicsContext3D::~GraphicsContext3D()
{
}
-PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow)
+PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
{
- GraphicsContext3DInternal* internal = new GraphicsContext3DInternal();
- if (!internal->initialize(attrs, hostWindow)) {
- delete internal;
+ OwnPtr<GraphicsContext3DInternal> internal = adoptPtr(new GraphicsContext3DInternal());
+ if (!internal->initialize(attrs, hostWindow, renderStyle == RenderDirectlyToHostWindow)) {
return 0;
}
- PassOwnPtr<GraphicsContext3D> result = new GraphicsContext3D(attrs, hostWindow);
- result->m_internal.set(internal);
+ PassOwnPtr<GraphicsContext3D> result = new GraphicsContext3D(attrs, hostWindow, renderStyle == RenderDirectlyToHostWindow);
+ result->m_internal = internal.release();
return result;
}
@@ -1234,6 +1024,13 @@ DELEGATE_TO_INTERNAL_1(deleteTexture, unsigned)
DELEGATE_TO_INTERNAL_1(synthesizeGLError, unsigned long)
DELEGATE_TO_INTERNAL_R(supportsBGRA, bool)
+DELEGATE_TO_INTERNAL_R(supportsMapSubCHROMIUM, bool)
+DELEGATE_TO_INTERNAL_4R(mapBufferSubDataCHROMIUM, unsigned, int, int, unsigned, void*)
+DELEGATE_TO_INTERNAL_1(unmapBufferSubDataCHROMIUM, const void*)
+DELEGATE_TO_INTERNAL_9R(mapTexSubImage2DCHROMIUM, unsigned, int, int, int, int, int, unsigned, unsigned, unsigned, void*)
+DELEGATE_TO_INTERNAL_1(unmapTexSubImage2DCHROMIUM, const void*)
+DELEGATE_TO_INTERNAL_R(supportsCopyTextureToParentTextureCHROMIUM, bool)
+DELEGATE_TO_INTERNAL_2(copyTextureToParentTextureCHROMIUM, unsigned, unsigned)
bool GraphicsContext3D::isGLES2Compliant() const
{
diff --git a/WebKit/chromium/src/GraphicsContext3DInternal.h b/WebKit/chromium/src/GraphicsContext3DInternal.h
new file mode 100644
index 0000000..f12fff0
--- /dev/null
+++ b/WebKit/chromium/src/GraphicsContext3DInternal.h
@@ -0,0 +1,301 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GraphicsContext3DInternal_h
+#define GraphicsContext3DInternal_h
+
+#include "GraphicsContext3D.h"
+#include <wtf/OwnPtr.h>
+#if PLATFORM(SKIA)
+#include "SkBitmap.h"
+#endif
+
+namespace WebKit {
+class WebGraphicsContext3D;
+class WebViewImpl;
+} // namespace WebKit
+
+namespace WebCore {
+
+#if USE(ACCELERATED_COMPOSITING)
+class WebGLLayerChromium;
+#endif
+
+class GraphicsContext3DInternal {
+public:
+ GraphicsContext3DInternal();
+ ~GraphicsContext3DInternal();
+
+ bool initialize(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, bool renderDirectlyToHostWindow);
+
+ // Helper function to provide access to the lower-level WebGraphicsContext3D,
+ // which is needed for subordinate contexts like WebGL's to share resources
+ // with the compositor's context.
+ static WebKit::WebGraphicsContext3D* extractWebGraphicsContext3D(GraphicsContext3D* context);
+
+ PlatformGraphicsContext3D platformGraphicsContext3D() const;
+ Platform3DObject platformTexture() const;
+
+ bool makeContextCurrent();
+
+ int sizeInBytes(int type);
+
+ void reshape(int width, int height);
+
+ void paintRenderingResultsToCanvas(CanvasRenderingContext*);
+ bool paintsIntoCanvasBuffer() const;
+
+ void prepareTexture();
+
+#if USE(ACCELERATED_COMPOSITING)
+ WebGLLayerChromium* platformLayer() const;
+#endif
+ bool isGLES2Compliant() const;
+ bool isGLES2NPOTStrict() const;
+ bool isErrorGeneratedOnOutOfBoundsAccesses() const;
+
+ //----------------------------------------------------------------------
+ // Entry points for WebGL.
+ //
+ void activeTexture(unsigned long texture);
+ void attachShader(Platform3DObject program, Platform3DObject shader);
+ void bindAttribLocation(Platform3DObject, unsigned long index, const String& name);
+ void bindBuffer(unsigned long target, Platform3DObject);
+ void bindFramebuffer(unsigned long target, Platform3DObject);
+ void bindRenderbuffer(unsigned long target, Platform3DObject);
+ void bindTexture(unsigned long target, Platform3DObject texture);
+ void blendColor(double red, double green, double blue, double alpha);
+ void blendEquation(unsigned long mode);
+ void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha);
+ void blendFunc(unsigned long sfactor, unsigned long dfactor);
+ void blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha);
+
+ void bufferData(unsigned long target, int size, unsigned long usage);
+ void bufferData(unsigned long target, int size, const void* data, unsigned long usage);
+ void bufferSubData(unsigned long target, long offset, int size, const void* data);
+
+ unsigned long checkFramebufferStatus(unsigned long target);
+ void clear(unsigned long mask);
+ void clearColor(double red, double green, double blue, double alpha);
+ void clearDepth(double depth);
+ void clearStencil(long s);
+ void colorMask(bool red, bool green, bool blue, bool alpha);
+ void compileShader(Platform3DObject);
+
+ void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border);
+ void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height);
+ void cullFace(unsigned long mode);
+ void depthFunc(unsigned long func);
+ void depthMask(bool flag);
+ void depthRange(double zNear, double zFar);
+ void detachShader(Platform3DObject, Platform3DObject);
+ void disable(unsigned long cap);
+ void disableVertexAttribArray(unsigned long index);
+ void drawArrays(unsigned long mode, long first, long count);
+ void drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset);
+
+ void enable(unsigned long cap);
+ void enableVertexAttribArray(unsigned long index);
+ void finish();
+ void flush();
+ void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, Platform3DObject);
+ void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, Platform3DObject, long level);
+ void frontFace(unsigned long mode);
+ void generateMipmap(unsigned long target);
+
+ bool getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo&);
+ bool getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo&);
+
+ void getAttachedShaders(Platform3DObject program, int maxCount, int* count, unsigned int* shaders);
+
+ int getAttribLocation(Platform3DObject, const String& name);
+
+ void getBooleanv(unsigned long pname, unsigned char* value);
+
+ void getBufferParameteriv(unsigned long target, unsigned long pname, int* value);
+
+ GraphicsContext3D::Attributes getContextAttributes();
+
+ unsigned long getError();
+
+ void getFloatv(unsigned long pname, float* value);
+
+ void getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname, int* value);
+
+ void getIntegerv(unsigned long pname, int* value);
+
+ void getProgramiv(Platform3DObject program, unsigned long pname, int* value);
+
+ String getProgramInfoLog(Platform3DObject);
+
+ void getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value);
+
+ void getShaderiv(Platform3DObject, unsigned long pname, int* value);
+
+ String getShaderInfoLog(Platform3DObject);
+
+ String getShaderSource(Platform3DObject);
+ String getString(unsigned long name);
+
+ void getTexParameterfv(unsigned long target, unsigned long pname, float* value);
+ void getTexParameteriv(unsigned long target, unsigned long pname, int* value);
+
+ void getUniformfv(Platform3DObject program, long location, float* value);
+ void getUniformiv(Platform3DObject program, long location, int* value);
+
+ long getUniformLocation(Platform3DObject, const String& name);
+
+ void getVertexAttribfv(unsigned long index, unsigned long pname, float* value);
+ void getVertexAttribiv(unsigned long index, unsigned long pname, int* value);
+
+ long getVertexAttribOffset(unsigned long index, unsigned long pname);
+
+ void hint(unsigned long target, unsigned long mode);
+ bool isBuffer(Platform3DObject);
+ bool isEnabled(unsigned long cap);
+ bool isFramebuffer(Platform3DObject);
+ bool isProgram(Platform3DObject);
+ bool isRenderbuffer(Platform3DObject);
+ bool isShader(Platform3DObject);
+ bool isTexture(Platform3DObject);
+ void lineWidth(double);
+ void linkProgram(Platform3DObject);
+ void pixelStorei(unsigned long pname, long param);
+ void polygonOffset(double factor, double units);
+
+ void readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type, void* data);
+
+ void releaseShaderCompiler();
+ void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height);
+ void sampleCoverage(double value, bool invert);
+ void scissor(long x, long y, unsigned long width, unsigned long height);
+ void shaderSource(Platform3DObject, const String& string);
+ void stencilFunc(unsigned long func, long ref, unsigned long mask);
+ void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask);
+ void stencilMask(unsigned long mask);
+ void stencilMaskSeparate(unsigned long face, unsigned long mask);
+ void stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass);
+ void stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass);
+
+ // These next several functions return an error code (0 if no errors) rather than using an ExceptionCode.
+ // Currently they return -1 on any error.
+ int texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, void* pixels);
+
+ void texParameterf(unsigned target, unsigned pname, float param);
+ void texParameteri(unsigned target, unsigned pname, int param);
+
+ int texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned width, unsigned height, unsigned format, unsigned type, void* pixels);
+
+ void uniform1f(long location, float x);
+ void uniform1fv(long location, float* v, int size);
+ void uniform1i(long location, int x);
+ void uniform1iv(long location, int* v, int size);
+ void uniform2f(long location, float x, float y);
+ void uniform2fv(long location, float* v, int size);
+ void uniform2i(long location, int x, int y);
+ void uniform2iv(long location, int* v, int size);
+ void uniform3f(long location, float x, float y, float z);
+ void uniform3fv(long location, float* v, int size);
+ void uniform3i(long location, int x, int y, int z);
+ void uniform3iv(long location, int* v, int size);
+ void uniform4f(long location, float x, float y, float z, float w);
+ void uniform4fv(long location, float* v, int size);
+ void uniform4i(long location, int x, int y, int z, int w);
+ void uniform4iv(long location, int* v, int size);
+ void uniformMatrix2fv(long location, bool transpose, float* value, int size);
+ void uniformMatrix3fv(long location, bool transpose, float* value, int size);
+ void uniformMatrix4fv(long location, bool transpose, float* value, int size);
+
+ void useProgram(Platform3DObject);
+ void validateProgram(Platform3DObject);
+
+ void vertexAttrib1f(unsigned long indx, float x);
+ void vertexAttrib1fv(unsigned long indx, float* values);
+ void vertexAttrib2f(unsigned long indx, float x, float y);
+ void vertexAttrib2fv(unsigned long indx, float* values);
+ void vertexAttrib3f(unsigned long indx, float x, float y, float z);
+ void vertexAttrib3fv(unsigned long indx, float* values);
+ void vertexAttrib4f(unsigned long indx, float x, float y, float z, float w);
+ void vertexAttrib4fv(unsigned long indx, float* values);
+ void vertexAttribPointer(unsigned long indx, int size, int type, bool normalized,
+ unsigned long stride, unsigned long offset);
+
+ void viewport(long x, long y, unsigned long width, unsigned long height);
+
+ unsigned createBuffer();
+ unsigned createFramebuffer();
+ unsigned createProgram();
+ unsigned createRenderbuffer();
+ unsigned createShader(unsigned long);
+ unsigned createTexture();
+
+ void deleteBuffer(unsigned);
+ void deleteFramebuffer(unsigned);
+ void deleteProgram(unsigned);
+ void deleteRenderbuffer(unsigned);
+ void deleteShader(unsigned);
+ void deleteTexture(unsigned);
+
+ void synthesizeGLError(unsigned long error);
+
+ void swapBuffers();
+
+ // EXT_texture_format_BGRA8888
+ bool supportsBGRA();
+
+ // GL_CHROMIUM_map_sub
+ bool supportsMapSubCHROMIUM();
+ void* mapBufferSubDataCHROMIUM(unsigned target, int offset, int size, unsigned access);
+ void unmapBufferSubDataCHROMIUM(const void*);
+ void* mapTexSubImage2DCHROMIUM(unsigned target, int level, int xoffset, int yoffset, int width, int height, unsigned format, unsigned type, unsigned access);
+ void unmapTexSubImage2DCHROMIUM(const void*);
+
+ // GL_CHROMIUM_copy_texture_to_parent_texture
+ bool supportsCopyTextureToParentTextureCHROMIUM();
+ void copyTextureToParentTextureCHROMIUM(unsigned texture, unsigned parentTexture);
+
+private:
+ OwnPtr<WebKit::WebGraphicsContext3D> m_impl;
+ WebKit::WebViewImpl* m_webViewImpl;
+#if USE(ACCELERATED_COMPOSITING)
+ RefPtr<WebGLLayerChromium> m_compositingLayer;
+#endif
+#if PLATFORM(SKIA)
+ // If the width and height of the Canvas's backing store don't
+ // match those that we were given in the most recent call to
+ // reshape(), then we need an intermediate bitmap to read back the
+ // frame buffer into. This seems to happen when CSS styles are
+ // used to resize the Canvas.
+ SkBitmap m_resizingBitmap;
+#endif
+
+#if PLATFORM(CG)
+ unsigned char* m_renderOutput;
+#endif
+};
+
+} // namespace WebCore
+
+#endif // GraphicsContext3D_h
diff --git a/WebKit/chromium/src/IDBCursorBackendProxy.cpp b/WebKit/chromium/src/IDBCursorBackendProxy.cpp
index b4711eb..cf18917 100644
--- a/WebKit/chromium/src/IDBCursorBackendProxy.cpp
+++ b/WebKit/chromium/src/IDBCursorBackendProxy.cpp
@@ -30,9 +30,11 @@
#include "IDBAny.h"
#include "IDBCallbacks.h"
+#include "IDBKey.h"
#include "SerializedScriptValue.h"
#include "WebIDBCallbacksImpl.h"
#include "WebIDBKey.h"
+#include "WebSerializedScriptValue.h"
namespace WebCore {
@@ -60,9 +62,17 @@ PassRefPtr<IDBKey> IDBCursorBackendProxy::key() const
return m_idbCursor->key();
}
-PassRefPtr<SerializedScriptValue> IDBCursorBackendProxy::value() const
+PassRefPtr<IDBAny> IDBCursorBackendProxy::value() const
{
- return m_idbCursor->value();
+ WebKit::WebSerializedScriptValue webScriptValue;
+ WebKit::WebIDBKey webKey;
+ m_idbCursor->value(webScriptValue, webKey);
+ if (!webScriptValue.isNull()) {
+ ASSERT(webKey.type() == WebKit::WebIDBKey::InvalidType);
+ return IDBAny::create<SerializedScriptValue>(webScriptValue);
+ }
+ ASSERT(webKey.type() != WebKit::WebIDBKey::InvalidType);
+ return IDBAny::create<IDBKey>(webKey);
}
void IDBCursorBackendProxy::update(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBCallbacks> callbacks)
diff --git a/WebKit/chromium/src/IDBCursorBackendProxy.h b/WebKit/chromium/src/IDBCursorBackendProxy.h
index 8af27cf..d8b621a 100644
--- a/WebKit/chromium/src/IDBCursorBackendProxy.h
+++ b/WebKit/chromium/src/IDBCursorBackendProxy.h
@@ -44,7 +44,7 @@ public:
virtual unsigned short direction() const;
virtual PassRefPtr<IDBKey> key() const;
- virtual PassRefPtr<SerializedScriptValue> value() const;
+ virtual PassRefPtr<IDBAny> value() const;
virtual void update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>);
virtual void continueFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>);
virtual void remove(PassRefPtr<IDBCallbacks>);
diff --git a/WebKit/chromium/src/IDBFactoryBackendProxy.cpp b/WebKit/chromium/src/IDBFactoryBackendProxy.cpp
index 114e7e1..18101e4 100755
--- a/WebKit/chromium/src/IDBFactoryBackendProxy.cpp
+++ b/WebKit/chromium/src/IDBFactoryBackendProxy.cpp
@@ -59,10 +59,10 @@ IDBFactoryBackendProxy::~IDBFactoryBackendProxy()
{
}
-void IDBFactoryBackendProxy::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> origin, Frame* frame)
+void IDBFactoryBackendProxy::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> origin, Frame* frame, const String& dataDir)
{
WebKit::WebFrame* webFrame = WebKit::WebFrameImpl::fromFrame(frame);
- m_webIDBFactory->open(name, description, new WebIDBCallbacksImpl(callbacks), origin, webFrame);
+ m_webIDBFactory->open(name, description, new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir);
}
void IDBFactoryBackendProxy::abortPendingTransactions(const Vector<int>& pendingIDs)
diff --git a/WebKit/chromium/src/IDBFactoryBackendProxy.h b/WebKit/chromium/src/IDBFactoryBackendProxy.h
index 9efc7af..ac30cf2 100755
--- a/WebKit/chromium/src/IDBFactoryBackendProxy.h
+++ b/WebKit/chromium/src/IDBFactoryBackendProxy.h
@@ -45,7 +45,7 @@ public:
virtual ~IDBFactoryBackendProxy();
PassRefPtr<DOMStringList> databases(void) const;
- virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*);
+ virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir);
virtual void abortPendingTransactions(const Vector<int>& pendingIDs);
private:
diff --git a/WebKit/chromium/src/IDBIndexBackendProxy.cpp b/WebKit/chromium/src/IDBIndexBackendProxy.cpp
index 5f1b9d9..f92f4f2 100644
--- a/WebKit/chromium/src/IDBIndexBackendProxy.cpp
+++ b/WebKit/chromium/src/IDBIndexBackendProxy.cpp
@@ -26,10 +26,15 @@
#include "config.h"
#include "IDBIndexBackendProxy.h"
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBCallbacks.h"
+#include "IDBKeyRange.h"
+#include "WebIDBCallbacksImpl.h"
#include "WebIDBDatabaseError.h"
#include "WebIDBIndex.h"
-
-#if ENABLE(INDEXED_DATABASE)
+#include "WebIDBKey.h"
+#include "WebIDBKeyRange.h"
namespace WebCore {
@@ -52,6 +57,11 @@ String IDBIndexBackendProxy::name()
return m_webIDBIndex->name();
}
+String IDBIndexBackendProxy::storeName()
+{
+ return m_webIDBIndex->storeName();
+}
+
String IDBIndexBackendProxy::keyPath()
{
return m_webIDBIndex->keyPath();
@@ -62,6 +72,26 @@ bool IDBIndexBackendProxy::unique()
return m_webIDBIndex->unique();
}
+void IDBIndexBackendProxy::openObjectCursor(PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, PassRefPtr<IDBCallbacks> callbacks)
+{
+ m_webIDBIndex->openObjectCursor(keyRange, direction, new WebIDBCallbacksImpl(callbacks));
+}
+
+void IDBIndexBackendProxy::openCursor(PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, PassRefPtr<IDBCallbacks> callbacks)
+{
+ m_webIDBIndex->openCursor(keyRange, direction, new WebIDBCallbacksImpl(callbacks));
+}
+
+void IDBIndexBackendProxy::getObject(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
+{
+ m_webIDBIndex->getObject(key, new WebIDBCallbacksImpl(callbacks));
+}
+
+void IDBIndexBackendProxy::get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
+{
+ m_webIDBIndex->get(key, new WebIDBCallbacksImpl(callbacks));
+}
+
} // namespace WebCore
#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebKit/chromium/src/IDBIndexBackendProxy.h b/WebKit/chromium/src/IDBIndexBackendProxy.h
index 1b378dd..6aafdfa 100644
--- a/WebKit/chromium/src/IDBIndexBackendProxy.h
+++ b/WebKit/chromium/src/IDBIndexBackendProxy.h
@@ -42,10 +42,14 @@ public:
virtual ~IDBIndexBackendProxy();
virtual String name();
+ virtual String storeName();
virtual String keyPath();
virtual bool unique();
- // FIXME: Add other methods.
+ virtual void openObjectCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>);
+ virtual void openCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>);
+ virtual void getObject(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>);
+ virtual void get(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>);
private:
IDBIndexBackendProxy(PassOwnPtr<WebKit::WebIDBIndex>);
diff --git a/WebKit/chromium/src/InspectorClientImpl.cpp b/WebKit/chromium/src/InspectorClientImpl.cpp
index 76acbb2..77150bb 100644
--- a/WebKit/chromium/src/InspectorClientImpl.cpp
+++ b/WebKit/chromium/src/InspectorClientImpl.cpp
@@ -100,28 +100,10 @@ bool InspectorClientImpl::sendMessageToFrontend(const WTF::String& message)
return false;
}
-void InspectorClientImpl::resourceTrackingWasEnabled()
+void InspectorClientImpl::updateInspectorStateCookie(const WTF::String& inspectorState)
{
if (WebDevToolsAgentImpl* agent = devToolsAgent())
- agent->resourceTrackingWasEnabled();
-}
-
-void InspectorClientImpl::resourceTrackingWasDisabled()
-{
- if (WebDevToolsAgentImpl* agent = devToolsAgent())
- agent->resourceTrackingWasDisabled();
-}
-
-void InspectorClientImpl::timelineProfilerWasStarted()
-{
- if (WebDevToolsAgentImpl* agent = devToolsAgent())
- agent->timelineProfilerWasStarted();
-}
-
-void InspectorClientImpl::timelineProfilerWasStopped()
-{
- if (WebDevToolsAgentImpl* agent = devToolsAgent())
- agent->timelineProfilerWasStopped();
+ agent->updateInspectorStateCookie(inspectorState);
}
WebDevToolsAgentImpl* InspectorClientImpl::devToolsAgent()
diff --git a/WebKit/chromium/src/InspectorClientImpl.h b/WebKit/chromium/src/InspectorClientImpl.h
index 34fcdc3..78d34e3 100644
--- a/WebKit/chromium/src/InspectorClientImpl.h
+++ b/WebKit/chromium/src/InspectorClientImpl.h
@@ -58,10 +58,7 @@ public:
virtual bool sendMessageToFrontend(const WTF::String&);
- virtual void resourceTrackingWasEnabled();
- virtual void resourceTrackingWasDisabled();
- virtual void timelineProfilerWasStarted();
- virtual void timelineProfilerWasStopped();
+ virtual void updateInspectorStateCookie(const WTF::String&);
private:
WebDevToolsAgentImpl* devToolsAgent();
diff --git a/WebKit/chromium/src/ResourceHandle.cpp b/WebKit/chromium/src/ResourceHandle.cpp
index 88f7f39..83e0017 100644
--- a/WebKit/chromium/src/ResourceHandle.cpp
+++ b/WebKit/chromium/src/ResourceHandle.cpp
@@ -74,7 +74,7 @@ public:
virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&);
virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength);
virtual void didReceiveCachedMetadata(WebURLLoader*, const char* data, int dataLength);
- virtual void didFinishLoading(WebURLLoader*);
+ virtual void didFinishLoading(WebURLLoader*, double finishTime);
virtual void didFail(WebURLLoader*, const WebURLError&);
enum ConnectionState {
@@ -182,13 +182,13 @@ void ResourceHandleInternal::didReceiveCachedMetadata(WebURLLoader*, const char*
m_client->didReceiveCachedMetadata(m_owner, data, dataLength);
}
-void ResourceHandleInternal::didFinishLoading(WebURLLoader*)
+void ResourceHandleInternal::didFinishLoading(WebURLLoader*, double finishTime)
{
ASSERT(m_client);
if (m_state != ConnectionStateReceivedResponse && m_state != ConnectionStateReceivingData)
CRASH();
m_state = ConnectionStateFinishedLoading;
- m_client->didFinishLoading(m_owner);
+ m_client->didFinishLoading(m_owner, finishTime);
}
void ResourceHandleInternal::didFail(WebURLLoader*, const WebURLError& error)
@@ -211,16 +211,16 @@ ResourceHandle::ResourceHandle(const ResourceRequest& request,
// FIXME: Figure out what to do with the bool params.
}
-PassRefPtr<ResourceHandle> ResourceHandle::create(const ResourceRequest& request,
+PassRefPtr<ResourceHandle> ResourceHandle::create(NetworkingContext* context,
+ const ResourceRequest& request,
ResourceHandleClient* client,
- Frame* deprecated,
bool defersLoading,
bool shouldContentSniff)
{
RefPtr<ResourceHandle> newHandle = adoptRef(new ResourceHandle(
request, client, defersLoading, shouldContentSniff));
- if (newHandle->start(deprecated))
+ if (newHandle->start(context))
return newHandle.release();
return 0;
@@ -246,7 +246,7 @@ void ResourceHandle::setDefersLoading(bool value)
d->setDefersLoading(value);
}
-bool ResourceHandle::start(Frame* deprecated)
+bool ResourceHandle::start(NetworkingContext* context)
{
d->start();
return true;
@@ -288,12 +288,12 @@ bool ResourceHandle::supportsBufferedData()
}
// static
-void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request,
+void ResourceHandle::loadResourceSynchronously(NetworkingContext* context,
+ const ResourceRequest& request,
StoredCredentials storedCredentials,
ResourceError& error,
ResourceResponse& response,
- Vector<char>& data,
- Frame* deprecated)
+ Vector<char>& data)
{
OwnPtr<WebURLLoader> loader(webKitClient()->createURLLoader());
ASSERT(loader.get());
diff --git a/WebKit/chromium/src/WebAccessibilityCacheImpl.cpp b/WebKit/chromium/src/WebAccessibilityCacheImpl.cpp
index abb63cc..8304878 100644
--- a/WebKit/chromium/src/WebAccessibilityCacheImpl.cpp
+++ b/WebKit/chromium/src/WebAccessibilityCacheImpl.cpp
@@ -63,7 +63,6 @@ WebAccessibilityCache* WebAccessibilityCache::create()
PassRefPtr<WebAccessibilityCacheImpl::WeakHandle> WebAccessibilityCacheImpl::WeakHandle::create(AccessibilityObject* object)
{
- // FIXME: Remove resetting ref-count from AccessibilityObjectWrapper
RefPtr<WebAccessibilityCacheImpl::WeakHandle> weakHandle = adoptRef(new WebAccessibilityCacheImpl::WeakHandle(object));
weakHandle->m_object->setWrapper(weakHandle.get());
@@ -149,7 +148,7 @@ void WebAccessibilityCacheImpl::clear()
int WebAccessibilityCacheImpl::addOrGetId(const WebAccessibilityObject& object)
{
- if (object.isNull())
+ if (!object.isValid())
return invalidObjectId;
RefPtr<AccessibilityObject> o = toAccessibilityObject(object);
diff --git a/WebKit/chromium/src/WebAccessibilityObject.cpp b/WebKit/chromium/src/WebAccessibilityObject.cpp
index 3a3e94b..96a3173 100644
--- a/WebKit/chromium/src/WebAccessibilityObject.cpp
+++ b/WebKit/chromium/src/WebAccessibilityObject.cpp
@@ -101,6 +101,15 @@ bool WebAccessibilityObject::canSetValueAttribute() const
return m_private->canSetValueAttribute();
}
+bool WebAccessibilityObject::isValid() const
+{
+ if (!m_private)
+ return false;
+
+ m_private->updateBackingStore();
+ return m_private->axObjectID();
+}
+
unsigned WebAccessibilityObject::childCount() const
{
if (!m_private)
diff --git a/WebKit/chromium/src/WebDataSourceImpl.cpp b/WebKit/chromium/src/WebDataSourceImpl.cpp
index ac2a02d..d5b1d79 100644
--- a/WebKit/chromium/src/WebDataSourceImpl.cpp
+++ b/WebKit/chromium/src/WebDataSourceImpl.cpp
@@ -109,7 +109,8 @@ void WebDataSourceImpl::setExtraData(ExtraData* extraData)
m_extraData.set(extraData);
}
-WebApplicationCacheHost* WebDataSourceImpl::applicationCacheHost() {
+WebApplicationCacheHost* WebDataSourceImpl::applicationCacheHost()
+{
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
return ApplicationCacheHostInternal::toWebApplicationCacheHost(DocumentLoader::applicationCacheHost());
#else
@@ -117,6 +118,11 @@ WebApplicationCacheHost* WebDataSourceImpl::applicationCacheHost() {
#endif
}
+void WebDataSourceImpl::setDeferMainResourceDataLoad(bool defer)
+{
+ DocumentLoader::setDeferMainResourceDataLoad(defer);
+}
+
WebNavigationType WebDataSourceImpl::toWebNavigationType(NavigationType type)
{
switch (type) {
diff --git a/WebKit/chromium/src/WebDataSourceImpl.h b/WebKit/chromium/src/WebDataSourceImpl.h
index be32217..05329ff 100644
--- a/WebKit/chromium/src/WebDataSourceImpl.h
+++ b/WebKit/chromium/src/WebDataSourceImpl.h
@@ -68,6 +68,7 @@ public:
virtual ExtraData* extraData() const;
virtual void setExtraData(ExtraData*);
virtual WebApplicationCacheHost* applicationCacheHost();
+ virtual void setDeferMainResourceDataLoad(bool);
static WebNavigationType toWebNavigationType(WebCore::NavigationType type);
diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
index 971c290..c7bb050 100644
--- a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
+++ b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
@@ -36,7 +36,6 @@
#include "InjectedScriptHost.h"
#include "InspectorBackendDispatcher.h"
#include "InspectorController.h"
-#include "InspectorValues.h"
#include "Page.h"
#include "PageGroup.h"
#include "PlatformString.h"
@@ -58,6 +57,7 @@
#include "WebURLResponse.h"
#include "WebViewClient.h"
#include "WebViewImpl.h"
+#include <wtf/CurrentTime.h>
#include <wtf/Noncopyable.h>
#include <wtf/OwnPtr.h>
@@ -67,8 +67,6 @@ using WebCore::InjectedScriptHost;
using WebCore::InspectorArray;
using WebCore::InspectorBackendDispatcher;
using WebCore::InspectorController;
-using WebCore::InspectorObject;
-using WebCore::InspectorValue;
using WebCore::Node;
using WebCore::Page;
using WebCore::ResourceError;
@@ -82,10 +80,9 @@ namespace WebKit {
namespace {
-static const char kFrontendConnectedFeatureName[] = "frontend-connected";
-static const char kResourceTrackingFeatureName[] = "resource-tracking";
-static const char kTimelineFeatureName[] = "timeline-profiler";
static const char kApuAgentFeatureName[] = "apu-agent";
+static const char kFrontendConnectedFeatureName[] = "frontend-connected";
+static const char kInspectorStateFeatureName[] = "inspector-state";
class ClientMessageLoopAdapter : public WebCore::ScriptDebugServer::ClientMessageLoop {
public:
@@ -223,9 +220,7 @@ void WebDevToolsAgentImpl::detach()
void WebDevToolsAgentImpl::frontendLoaded()
{
- inspectorController()->connectFrontend();
- // We know that by this time injected script has already been pushed to the backend.
- m_client->runtimePropertyChanged(kFrontendConnectedFeatureName, inspectorController()->injectedScriptHost()->injectedScriptSource());
+ connectFrontend(false);
}
void WebDevToolsAgentImpl::didNavigate()
@@ -253,17 +248,12 @@ void WebDevToolsAgentImpl::setRuntimeProperty(const WebString& name, const WebSt
{
if (name == kApuAgentFeatureName)
setApuAgentEnabled(value == "true");
- else if (name == kTimelineFeatureName)
- setTimelineProfilingEnabled(value == "true");
- else if (name == kResourceTrackingFeatureName) {
+ else if (name == kInspectorStateFeatureName) {
InspectorController* ic = inspectorController();
- if (value == "true")
- ic->enableResourceTracking(false /* not sticky */, false /* no reload */);
- else
- ic->disableResourceTracking(false /* not sticky */);
+ ic->restoreInspectorStateFromCookie(value);
} else if (name == kFrontendConnectedFeatureName && !inspectorController()->hasFrontend()) {
inspectorController()->injectedScriptHost()->setInjectedScriptSource(value);
- frontendLoaded();
+ connectFrontend(true);
}
}
@@ -273,19 +263,19 @@ void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled)
InspectorController* ic = inspectorController();
if (enabled) {
if (!ic->hasFrontend())
- frontendLoaded();
+ connectFrontend(true);
m_resourceTrackingWasEnabled = ic->resourceTrackingEnabled();
ic->startTimelineProfiler();
if (!m_resourceTrackingWasEnabled) {
// TODO(knorton): Introduce some kind of agents dependency here so that
// user could turn off resource tracking while apu agent is on.
- ic->enableResourceTracking(false, false);
+ ic->setResourceTrackingEnabled(true);
}
m_debuggerAgentImpl->setAutoContinueOnException(true);
} else {
ic->stopTimelineProfiler();
if (!m_resourceTrackingWasEnabled)
- ic->disableResourceTracking(false);
+ ic->setResourceTrackingEnabled(false);
m_resourceTrackingWasEnabled = false;
}
m_client->runtimePropertyChanged(
@@ -293,6 +283,16 @@ void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled)
enabled ? String("true") : String("false"));
}
+void WebDevToolsAgentImpl::connectFrontend(bool afterNavigation)
+{
+ if (afterNavigation)
+ inspectorController()->reuseFrontend();
+ else
+ inspectorController()->connectFrontend();
+ // We know that by this time injected script has already been pushed to the backend.
+ m_client->runtimePropertyChanged(kFrontendConnectedFeatureName, inspectorController()->injectedScriptHost()->injectedScriptSource());
+}
+
WebCore::InspectorController* WebDevToolsAgentImpl::inspectorController()
{
if (Page* page = m_webViewImpl->page())
@@ -336,7 +336,7 @@ void WebDevToolsAgentImpl::didReceiveResponse(unsigned long resourceId, const We
void WebDevToolsAgentImpl::didFinishLoading(unsigned long resourceId)
{
if (InspectorController* ic = inspectorController())
- ic->didFinishLoading(resourceId);
+ ic->didFinishLoading(resourceId, 0);
}
void WebDevToolsAgentImpl::didFailLoading(unsigned long resourceId, const WebURLError& error)
@@ -402,24 +402,9 @@ bool WebDevToolsAgentImpl::sendMessageToFrontend(const WTF::String& message)
return true;
}
-void WebDevToolsAgentImpl::resourceTrackingWasEnabled()
-{
- m_client->runtimePropertyChanged(kResourceTrackingFeatureName, "true");
-}
-
-void WebDevToolsAgentImpl::resourceTrackingWasDisabled()
-{
- m_client->runtimePropertyChanged(kResourceTrackingFeatureName, "false");
-}
-
-void WebDevToolsAgentImpl::timelineProfilerWasStarted()
-{
- m_client->runtimePropertyChanged(kTimelineFeatureName, "true");
-}
-
-void WebDevToolsAgentImpl::timelineProfilerWasStopped()
+void WebDevToolsAgentImpl::updateInspectorStateCookie(const WTF::String& state)
{
- m_client->runtimePropertyChanged(kTimelineFeatureName, "false");
+ m_client->runtimePropertyChanged(kInspectorStateFeatureName, state);
}
void WebDevToolsAgentImpl::evaluateInWebInspector(long callId, const WebString& script)
diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.h b/WebKit/chromium/src/WebDevToolsAgentImpl.h
index 36cafcf..47c4ccf 100644
--- a/WebKit/chromium/src/WebDevToolsAgentImpl.h
+++ b/WebKit/chromium/src/WebDevToolsAgentImpl.h
@@ -93,16 +93,14 @@ public:
virtual void hideHighlight();
virtual void populateSetting(const WTF::String& key, WTF::String* value);
virtual void storeSetting(const WTF::String& key, const WTF::String& value);
- virtual void resourceTrackingWasEnabled();
- virtual void resourceTrackingWasDisabled();
- virtual void timelineProfilerWasStarted();
- virtual void timelineProfilerWasStopped();
+ virtual void updateInspectorStateCookie(const WTF::String&);
virtual bool sendMessageToFrontend(const WTF::String&);
int hostId() { return m_hostId; }
private:
void setApuAgentEnabled(bool enabled);
+ void connectFrontend(bool afterNavigation);
WebCore::InspectorController* inspectorController();
diff --git a/WebKit/chromium/src/WebDeviceOrientationClientMock.cpp b/WebKit/chromium/src/WebDeviceOrientationClientMock.cpp
index 820c970..8a75ca1 100644
--- a/WebKit/chromium/src/WebDeviceOrientationClientMock.cpp
+++ b/WebKit/chromium/src/WebDeviceOrientationClientMock.cpp
@@ -32,6 +32,11 @@
namespace WebKit {
+WebDeviceOrientationClientMock* WebDeviceOrientationClientMock::create()
+{
+ return new WebDeviceOrientationClientMock();
+}
+
void WebDeviceOrientationClientMock::setController(WebDeviceOrientationController* controller)
{
m_clientMock->setController(controller->controller());
diff --git a/WebKit/chromium/src/WebFormElement.cpp b/WebKit/chromium/src/WebFormElement.cpp
index 9c77732..7a01053 100644
--- a/WebKit/chromium/src/WebFormElement.cpp
+++ b/WebKit/chromium/src/WebFormElement.cpp
@@ -68,7 +68,7 @@ WebString WebFormElement::method() const
bool WebFormElement::wasUserSubmitted() const
{
- return constUnwrap<HTMLFormElement>()->submissionTrigger() == NotSubmittedByJavaScript;
+ return constUnwrap<HTMLFormElement>()->wasUserSubmitted();
}
void WebFormElement::submit()
diff --git a/WebKit/chromium/src/WebFrameImpl.cpp b/WebKit/chromium/src/WebFrameImpl.cpp
index a2d6a46..2d42f4b 100644
--- a/WebKit/chromium/src/WebFrameImpl.cpp
+++ b/WebKit/chromium/src/WebFrameImpl.cpp
@@ -1012,22 +1012,9 @@ void WebFrameImpl::dispatchWillSendRequest(WebURLRequest& request)
0, 0, request.toMutableResourceRequest(), response);
}
-void WebFrameImpl::commitDocumentData(const char* data, size_t dataLen)
+void WebFrameImpl::commitDocumentData(const char* data, size_t length)
{
- DocumentLoader* documentLoader = m_frame->loader()->documentLoader();
-
- // Set the text encoding. This calls begin() for us. It is safe to call
- // this multiple times (Mac does: page/mac/WebCoreFrameBridge.mm).
- bool userChosen = true;
- String encoding = documentLoader->overrideEncoding();
- if (encoding.isNull()) {
- userChosen = false;
- encoding = documentLoader->response().textEncodingName();
- }
- m_frame->loader()->writer()->setEncoding(encoding, userChosen);
-
- // NOTE: mac only does this if there is a document
- m_frame->loader()->addData(data, dataLen);
+ m_frame->loader()->documentLoader()->commitData(data, length);
}
unsigned WebFrameImpl::unloadListenerCount() const
@@ -1229,7 +1216,7 @@ void WebFrameImpl::selectWordAroundPosition(Frame* frame, VisiblePosition pos)
VisibleSelection selection(pos);
selection.expandUsingGranularity(WordGranularity);
- if (frame->shouldChangeSelection(selection)) {
+ if (frame->selection()->shouldChangeSelection(selection)) {
TextGranularity granularity = selection.isRange() ? WordGranularity : CharacterGranularity;
frame->selection()->setSelection(selection, granularity);
}
@@ -1713,11 +1700,18 @@ int WebFrameImpl::pageNumberForElementById(const WebString& id,
WebRect WebFrameImpl::selectionBoundsRect() const
{
if (hasSelection())
- return IntRect(frame()->selectionBounds(false));
+ return IntRect(frame()->selection()->bounds(false));
return WebRect();
}
+bool WebFrameImpl::selectionStartHasSpellingMarkerFor(int from, int length) const
+{
+ if (!m_frame)
+ return false;
+ return m_frame->editor()->selectionStartHasSpellingMarkerFor(from, length);
+}
+
// WebFrameImpl public ---------------------------------------------------------
PassRefPtr<WebFrameImpl> WebFrameImpl::create(WebFrameClient* client)
diff --git a/WebKit/chromium/src/WebFrameImpl.h b/WebKit/chromium/src/WebFrameImpl.h
index 14217fa..25e7004 100644
--- a/WebKit/chromium/src/WebFrameImpl.h
+++ b/WebKit/chromium/src/WebFrameImpl.h
@@ -182,6 +182,8 @@ public:
float pageHeightInPixels) const;
virtual WebRect selectionBoundsRect() const;
+ virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const;
+
static PassRefPtr<WebFrameImpl> create(WebFrameClient* client);
~WebFrameImpl();
diff --git a/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp b/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp
index bbb7162..bbc852f 100644
--- a/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp
+++ b/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp
@@ -79,13 +79,15 @@ public:
virtual void setIsAllowed(bool allowed);
virtual void setLastPosition(double latitude, double longitude, bool providesAltitude, double altitude, double accuracy, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, long long timestamp);
virtual void setLastError(int errorCode, const WebString& message);
- virtual void onWebGeolocationServiceDestroyed();
+ virtual void didDestroyGeolocationService();
private:
- WebViewClient* getWebViewClient();
-
+ bool isAttached() const;
+ // Pointer back to the WebKit geolocation client. We obtain this via the frame's page, but need to cache it
+ // as it may still be alive after the page has detached from the frame.
+ WebGeolocationService* m_webGeolocationService;
// GeolocationServiceChromium owns us, we only have a pointer back to it.
- GeolocationServiceChromium* m_GeolocationServiceChromium;
+ GeolocationServiceChromium* m_geolocationServiceChromium;
int m_bridgeId;
};
@@ -95,49 +97,47 @@ GeolocationServiceBridge* createGeolocationServiceBridgeImpl(GeolocationServiceC
}
WebGeolocationServiceBridgeImpl::WebGeolocationServiceBridgeImpl(GeolocationServiceChromium* geolocationServiceChromium)
- : m_GeolocationServiceChromium(geolocationServiceChromium)
+ : m_webGeolocationService(0)
+ , m_geolocationServiceChromium(geolocationServiceChromium)
, m_bridgeId(0)
{
}
WebGeolocationServiceBridgeImpl::~WebGeolocationServiceBridgeImpl()
{
- WebKit::WebViewClient* webViewClient = getWebViewClient();
- // Geolocation has an OwnPtr to us, and it's destroyed after the frame has
- // been potentially disconnected. In this case, it calls stopUpdating()
- // has been called and we have already detached ourselves.
- if (!webViewClient)
- ASSERT(!m_bridgeId);
- else if (m_bridgeId)
- webViewClient->geolocationService()->detachBridge(m_bridgeId);
+ if (isAttached())
+ m_webGeolocationService->detachBridge(m_bridgeId);
}
bool WebGeolocationServiceBridgeImpl::startUpdating(PositionOptions* positionOptions)
{
attachBridgeIfNeeded();
- getWebViewClient()->geolocationService()->startUpdating(m_bridgeId, m_GeolocationServiceChromium->frame()->document()->url(), positionOptions->enableHighAccuracy());
+ if (!isAttached())
+ return false;
+ m_webGeolocationService->startUpdating(m_bridgeId, m_geolocationServiceChromium->frame()->document()->url(), positionOptions->enableHighAccuracy());
return true;
}
void WebGeolocationServiceBridgeImpl::stopUpdating()
{
- WebViewClient* webViewClient = getWebViewClient();
- if (m_bridgeId && webViewClient) {
- WebGeolocationService* geolocationService = webViewClient->geolocationService();
- geolocationService->stopUpdating(m_bridgeId);
- geolocationService->detachBridge(m_bridgeId);
+ if (isAttached()) {
+ m_webGeolocationService->stopUpdating(m_bridgeId);
+ m_webGeolocationService->detachBridge(m_bridgeId);
+ m_bridgeId = 0;
+ m_webGeolocationService = 0;
}
- m_bridgeId = 0;
}
void WebGeolocationServiceBridgeImpl::suspend()
{
- getWebViewClient()->geolocationService()->suspend(m_bridgeId);
+ if (isAttached())
+ m_webGeolocationService->suspend(m_bridgeId);
}
void WebGeolocationServiceBridgeImpl::resume()
{
- getWebViewClient()->geolocationService()->resume(m_bridgeId);
+ if (isAttached())
+ m_webGeolocationService->resume(m_bridgeId);
}
int WebGeolocationServiceBridgeImpl::getBridgeId() const
@@ -147,38 +147,54 @@ int WebGeolocationServiceBridgeImpl::getBridgeId() const
void WebGeolocationServiceBridgeImpl::attachBridgeIfNeeded()
{
- if (!m_bridgeId)
- m_bridgeId = getWebViewClient()->geolocationService()->attachBridge(this);
+ if (isAttached())
+ return;
+ // Lazy attach to the geolocation service of the associated page if there is one.
+ Frame* frame = m_geolocationServiceChromium->frame();
+ if (!frame || !frame->page())
+ return;
+ WebKit::ChromeClientImpl* chromeClientImpl = static_cast<WebKit::ChromeClientImpl*>(frame->page()->chrome()->client());
+ WebKit::WebViewClient* webViewClient = chromeClientImpl->webView()->client();
+ m_webGeolocationService = webViewClient->geolocationService();
+ ASSERT(m_webGeolocationService);
+ m_bridgeId = m_webGeolocationService->attachBridge(this);
+ if (!m_bridgeId) {
+ // Attach failed. Release association with this service.
+ m_webGeolocationService = 0;
+ }
}
void WebGeolocationServiceBridgeImpl::setIsAllowed(bool allowed)
{
- m_GeolocationServiceChromium->setIsAllowed(allowed);
+ m_geolocationServiceChromium->setIsAllowed(allowed);
}
void WebGeolocationServiceBridgeImpl::setLastPosition(double latitude, double longitude, bool providesAltitude, double altitude, double accuracy, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, long long timestamp)
{
RefPtr<Geoposition> geoposition = Geoposition::create(Coordinates::create(latitude, longitude, providesAltitude, altitude, accuracy, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed), timestamp);
- m_GeolocationServiceChromium->setLastPosition(geoposition);
+ m_geolocationServiceChromium->setLastPosition(geoposition);
}
void WebGeolocationServiceBridgeImpl::setLastError(int errorCode, const WebString& message)
{
- m_GeolocationServiceChromium->setLastError(errorCode, message);
+ m_geolocationServiceChromium->setLastError(errorCode, message);
}
-WebViewClient* WebGeolocationServiceBridgeImpl::getWebViewClient()
+void WebGeolocationServiceBridgeImpl::didDestroyGeolocationService()
{
- Frame* frame = m_GeolocationServiceChromium->frame();
- if (!frame || !frame->page())
- return 0;
- WebKit::ChromeClientImpl* chromeClientImpl = static_cast<WebKit::ChromeClientImpl*>(frame->page()->chrome()->client());
- WebKit::WebViewClient* webViewClient = chromeClientImpl->webView()->client();
- return webViewClient;
+ m_bridgeId = 0;
+ m_webGeolocationService = 0;
}
-void WebGeolocationServiceBridgeImpl::onWebGeolocationServiceDestroyed()
+bool WebGeolocationServiceBridgeImpl::isAttached() const
{
+ // Test the class invariant.
+ if (m_webGeolocationService)
+ ASSERT(m_bridgeId);
+ else
+ ASSERT(!m_bridgeId);
+
+ return m_webGeolocationService;
}
} // namespace WebKit
diff --git a/WebKit/chromium/src/WebGeolocationServiceMock.cpp b/WebKit/chromium/src/WebGeolocationServiceMock.cpp
index 2a10c96..e149cf1 100644
--- a/WebKit/chromium/src/WebGeolocationServiceMock.cpp
+++ b/WebKit/chromium/src/WebGeolocationServiceMock.cpp
@@ -34,9 +34,11 @@
#include "GeolocationService.h"
#include "GeolocationServiceChromium.h"
#include "GeolocationServiceMock.h"
+#include "WebGeolocationServiceBridge.h"
#include "WebString.h"
#include <wtf/CurrentTime.h>
#include <wtf/HashMap.h>
+#include <wtf/Vector.h>
#if ENABLE(GEOLOCATION)
@@ -51,6 +53,7 @@ using WebCore::Geoposition;
using WebCore::PositionError;
using WebCore::PositionOptions;
using WTF::String;
+using WTF::Vector;
namespace WebCore {
class GeolocationServiceChromiumMock : public GeolocationServiceChromium, public GeolocationServiceClient {
@@ -124,17 +127,34 @@ namespace WebKit {
class WebGeolocationServiceMockImpl : public WebGeolocationServiceMock {
public:
- virtual ~WebGeolocationServiceMockImpl() { }
+ WebGeolocationServiceMockImpl();
+ virtual ~WebGeolocationServiceMockImpl();
+ static void setMockGeolocationPermission(bool allowed);
+
+ // WebGeolocationService
virtual void requestPermissionForFrame(int bridgeId, const WebURL& url);
virtual int attachBridge(WebGeolocationServiceBridge*);
virtual void detachBridge(int bridgeId);
private:
+ void notifyPendingPermissions();
+
typedef HashMap<int, WebGeolocationServiceBridge*> IdToBridgeMap;
IdToBridgeMap m_idToBridgeMap;
+ Vector<int> m_pendingPermissionRequests;
+
+ // In addition to the singleton instance pointer, we need to keep the setMockGeolocationPermission() state
+ // as a static (not object members) as this call may come in before the service has been created.
+ static enum PermissionState {
+ PermissionStateUnset,
+ PermissionStateAllowed,
+ PermissionStateDenied,
+ } s_permissionState;
+ static WebGeolocationServiceMockImpl* s_instance;
};
-bool WebGeolocationServiceMock::s_mockGeolocationPermission = false;
+WebGeolocationServiceMockImpl::PermissionState WebGeolocationServiceMockImpl::s_permissionState = WebGeolocationServiceMockImpl::PermissionStateUnset;
+WebGeolocationServiceMockImpl* WebGeolocationServiceMockImpl::s_instance = 0;
WebGeolocationServiceMock* WebGeolocationServiceMock::createWebGeolocationServiceMock()
{
@@ -143,7 +163,7 @@ WebGeolocationServiceMock* WebGeolocationServiceMock::createWebGeolocationServic
void WebGeolocationServiceMock::setMockGeolocationPermission(bool allowed)
{
- s_mockGeolocationPermission = allowed;
+ WebGeolocationServiceMockImpl::setMockGeolocationPermission(allowed);
}
void WebGeolocationServiceMock::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
@@ -160,12 +180,35 @@ void WebGeolocationServiceMock::setMockGeolocationError(int errorCode, const Web
GeolocationServiceMock::setError(positionError);
}
+WebGeolocationServiceMockImpl::WebGeolocationServiceMockImpl()
+{
+ ASSERT(!s_instance);
+ s_instance = this;
+}
+
+WebGeolocationServiceMockImpl::~WebGeolocationServiceMockImpl()
+{
+ ASSERT(this == s_instance);
+ s_instance = 0;
+ // Reset the permission state, so any future service instance (e.g. running
+ // multiple tests in a single DRT run) will see a clean call sequence.
+ s_permissionState = PermissionStateUnset;
+ for (IdToBridgeMap::iterator it = m_idToBridgeMap.begin(); it != m_idToBridgeMap.end(); ++it)
+ it->second->didDestroyGeolocationService();
+}
+
+void WebGeolocationServiceMockImpl::setMockGeolocationPermission(bool allowed)
+{
+ s_permissionState = allowed ? PermissionStateAllowed : PermissionStateDenied;
+ if (s_instance)
+ s_instance->notifyPendingPermissions();
+}
+
void WebGeolocationServiceMockImpl::requestPermissionForFrame(int bridgeId, const WebURL& url)
{
- IdToBridgeMap::iterator iter = m_idToBridgeMap.find(bridgeId);
- if (iter == m_idToBridgeMap.end())
- return;
- iter->second->setIsAllowed(s_mockGeolocationPermission);
+ m_pendingPermissionRequests.append(bridgeId);
+ if (s_permissionState != PermissionStateUnset)
+ notifyPendingPermissions();
}
int WebGeolocationServiceMockImpl::attachBridge(WebGeolocationServiceBridge* bridge)
@@ -183,6 +226,19 @@ void WebGeolocationServiceMockImpl::detachBridge(int bridgeId)
m_idToBridgeMap.remove(bridgeId);
}
+void WebGeolocationServiceMockImpl::notifyPendingPermissions()
+{
+ ASSERT(s_permissionState == PermissionStateAllowed || s_permissionState == PermissionStateDenied);
+ Vector<int> pendingPermissionRequests;
+ pendingPermissionRequests.swap(m_pendingPermissionRequests);
+ for (Vector<int>::const_iterator it = pendingPermissionRequests.begin(); it != pendingPermissionRequests.end(); ++it) {
+ ASSERT(*it > 0);
+ IdToBridgeMap::iterator iter = m_idToBridgeMap.find(*it);
+ if (iter != m_idToBridgeMap.end())
+ iter->second->setIsAllowed(s_permissionState == PermissionStateAllowed);
+ }
+}
+
} // namespace WebKit
#endif // ENABLE(GEOLOCATION)
diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
index 6e1adca..24dcf9a 100644
--- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
+++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
@@ -97,11 +97,16 @@ WebGraphicsContext3DDefaultImpl::~WebGraphicsContext3DDefaultImpl()
}
}
-bool WebGraphicsContext3DDefaultImpl::initialize(WebGraphicsContext3D::Attributes attributes, WebView* webView)
+bool WebGraphicsContext3DDefaultImpl::initialize(WebGraphicsContext3D::Attributes attributes, WebView* webView, bool renderDirectlyToWebView)
{
+ if (renderDirectlyToWebView) {
+ // This mode isn't supported with the in-process implementation yet. (FIXME)
+ return false;
+ }
+
if (!gfx::GLContext::InitializeOneOff())
return false;
-
+
m_glContext = WTF::adoptPtr(gfx::GLContext::CreateOffscreenGLContext(0));
if (!m_glContext)
return false;
@@ -114,6 +119,11 @@ bool WebGraphicsContext3DDefaultImpl::initialize(WebGraphicsContext3D::Attribute
return true;
}
+bool WebGraphicsContext3DDefaultImpl::initialize(WebGraphicsContext3D::Attributes attributes, WebView* webView)
+{
+ return initialize(attributes, webView, false);
+}
+
void WebGraphicsContext3DDefaultImpl::validateAttributes()
{
const char* extensions = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
@@ -463,6 +473,40 @@ bool WebGraphicsContext3DDefaultImpl::supportsBGRA()
return false;
}
+bool WebGraphicsContext3DDefaultImpl::supportsMapSubCHROMIUM()
+{
+ // We don't claim support for this extension at this time
+ return false;
+}
+
+void* WebGraphicsContext3DDefaultImpl::mapBufferSubDataCHROMIUM(unsigned target, int offset, int size, unsigned access)
+{
+ return 0;
+}
+
+void WebGraphicsContext3DDefaultImpl::unmapBufferSubDataCHROMIUM(const void* mem)
+{
+}
+
+void* WebGraphicsContext3DDefaultImpl::mapTexSubImage2DCHROMIUM(unsigned target, int level, int xoffset, int yoffset, int width, int height, unsigned format, unsigned type, unsigned access)
+{
+ return 0;
+}
+
+void WebGraphicsContext3DDefaultImpl::unmapTexSubImage2DCHROMIUM(const void* mem)
+{
+}
+
+bool WebGraphicsContext3DDefaultImpl::supportsCopyTextureToParentTextureCHROMIUM()
+{
+ // We don't claim support for this extension at this time
+ return false;
+}
+
+void WebGraphicsContext3DDefaultImpl::copyTextureToParentTextureCHROMIUM(unsigned id, unsigned id2)
+{
+}
+
// Helper macros to reduce the amount of code.
#define DELEGATE_TO_GL(name, glname) \
diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h
index a4c5b4b..5bf439a 100644
--- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h
+++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h
@@ -59,6 +59,8 @@ public:
//----------------------------------------------------------------------
// WebGraphicsContext3D methods
+ virtual bool initialize(WebGraphicsContext3D::Attributes attributes, WebView*, bool);
+ // FIXME: remove once compositor is switched over to GraphicsContext3D.
virtual bool initialize(WebGraphicsContext3D::Attributes attributes, WebView*);
virtual bool makeContextCurrent();
@@ -80,6 +82,13 @@ public:
virtual void synthesizeGLError(unsigned long error);
virtual bool supportsBGRA();
+ virtual bool supportsMapSubCHROMIUM();
+ virtual void* mapBufferSubDataCHROMIUM(unsigned target, int offset, int size, unsigned access);
+ virtual void unmapBufferSubDataCHROMIUM(const void*);
+ virtual void* mapTexSubImage2DCHROMIUM(unsigned target, int level, int xoffset, int yoffset, int width, int height, unsigned format, unsigned type, unsigned access);
+ virtual void unmapTexSubImage2DCHROMIUM(const void*);
+ virtual bool supportsCopyTextureToParentTextureCHROMIUM();
+ virtual void copyTextureToParentTextureCHROMIUM(unsigned texture, unsigned parentTexture);
virtual void activeTexture(unsigned long texture);
virtual void attachShader(WebGLId program, WebGLId shader);
diff --git a/WebKit/chromium/src/WebHTTPBody.cpp b/WebKit/chromium/src/WebHTTPBody.cpp
index e54b4e5..93b94c2 100644
--- a/WebKit/chromium/src/WebHTTPBody.cpp
+++ b/WebKit/chromium/src/WebHTTPBody.cpp
@@ -78,7 +78,9 @@ bool WebHTTPBody::elementAt(size_t index, Element& result) const
result.filePath.reset();
result.fileStart = 0;
result.fileLength = 0;
+ // FIXME: remove this line once all users of Element have been switched to use 'modificationTime'.
result.fileInfo.modificationTime = 0.0;
+ result.modificationTime = 0.0;
result.blobURL = KURL();
switch (element.m_type) {
@@ -92,7 +94,9 @@ bool WebHTTPBody::elementAt(size_t index, Element& result) const
#if ENABLE(BLOB)
result.fileStart = element.m_fileStart;
result.fileLength = element.m_fileLength;
+ // FIXME: remove this line once all users of Element have been switched to use 'modificationTime'.
result.fileInfo.modificationTime = element.m_expectedFileModificationTime;
+ result.modificationTime = element.m_expectedFileModificationTime;
#endif
break;
#if ENABLE(BLOB)
@@ -123,14 +127,20 @@ void WebHTTPBody::appendFile(const WebString& filePath)
m_private->appendFile(filePath);
}
-void WebHTTPBody::appendFileRange(const WebString& filePath, long long fileStart, long long fileLength, const WebFileInfo& fileInfo)
+void WebHTTPBody::appendFileRange(const WebString& filePath, long long fileStart, long long fileLength, double modificationTime)
{
#if ENABLE(BLOB)
ensureMutable();
- m_private->appendFileRange(filePath, fileStart, fileLength, fileInfo.modificationTime);
+ m_private->appendFileRange(filePath, fileStart, fileLength, modificationTime);
#endif
}
+// FIXME: Remove this method once all callers have been switched to use the method above.
+void WebHTTPBody::appendFileRange(const WebString& filePath, long long fileStart, long long fileLength, const WebFileInfo& fileInfo)
+{
+ return appendFileRange(filePath, fileStart, fileLength, fileInfo.modificationTime);
+}
+
void WebHTTPBody::appendBlob(const WebURL& blobURL)
{
#if ENABLE(BLOB)
diff --git a/WebKit/chromium/src/WebIDBCursorImpl.cpp b/WebKit/chromium/src/WebIDBCursorImpl.cpp
index b74d680..6a1053e 100644
--- a/WebKit/chromium/src/WebIDBCursorImpl.cpp
+++ b/WebKit/chromium/src/WebIDBCursorImpl.cpp
@@ -55,9 +55,19 @@ WebIDBKey WebIDBCursorImpl::key() const
return WebIDBKey(m_idbCursorBackend->key());
}
-WebSerializedScriptValue WebIDBCursorImpl::value() const
+void WebIDBCursorImpl::value(WebSerializedScriptValue& serializedScriptValue, WebIDBKey& idbKey) const
{
- return m_idbCursorBackend->value();
+ // Verify we're starting off with blank slates.
+ ASSERT(serializedScriptValue.isNull());
+ ASSERT(idbKey.type() == WebIDBKey::InvalidType);
+
+ RefPtr<IDBAny> any = m_idbCursorBackend->value();
+ if (any->type() == IDBAny::SerializedScriptValueType)
+ serializedScriptValue.assign(any->serializedScriptValue());
+ else if (any->type() == IDBAny::IDBKeyType)
+ idbKey.assign(any->idbKey());
+ else
+ ASSERT_NOT_REACHED();
}
void WebIDBCursorImpl::update(const WebSerializedScriptValue& value, WebIDBCallbacks* callbacks)
diff --git a/WebKit/chromium/src/WebIDBCursorImpl.h b/WebKit/chromium/src/WebIDBCursorImpl.h
index 565e86a..5fb9e1c 100644
--- a/WebKit/chromium/src/WebIDBCursorImpl.h
+++ b/WebKit/chromium/src/WebIDBCursorImpl.h
@@ -43,7 +43,7 @@ public:
virtual unsigned short direction() const;
virtual WebIDBKey key() const;
- virtual WebSerializedScriptValue value() const;
+ virtual void value(WebSerializedScriptValue&, WebIDBKey&) const;
virtual void update(const WebSerializedScriptValue&, WebIDBCallbacks*);
virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*);
virtual void remove(WebIDBCallbacks*);
diff --git a/WebKit/chromium/src/WebIDBFactoryImpl.cpp b/WebKit/chromium/src/WebIDBFactoryImpl.cpp
index 564be36..3c8d459 100755
--- a/WebKit/chromium/src/WebIDBFactoryImpl.cpp
+++ b/WebKit/chromium/src/WebIDBFactoryImpl.cpp
@@ -58,9 +58,9 @@ WebIDBFactoryImpl::~WebIDBFactoryImpl()
{
}
-void WebIDBFactoryImpl::open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*)
+void WebIDBFactoryImpl::open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*, const WebString& dataDir)
{
- m_idbFactoryBackend->open(name, description, IDBCallbacksProxy::create(callbacks), origin, 0);
+ m_idbFactoryBackend->open(name, description, IDBCallbacksProxy::create(callbacks), origin, 0, dataDir);
}
void WebIDBFactoryImpl::abortPendingTransactions(const WebVector<int>& pendingIDs)
diff --git a/WebKit/chromium/src/WebIDBFactoryImpl.h b/WebKit/chromium/src/WebIDBFactoryImpl.h
index aeab478..4dc0a10 100755
--- a/WebKit/chromium/src/WebIDBFactoryImpl.h
+++ b/WebKit/chromium/src/WebIDBFactoryImpl.h
@@ -42,7 +42,7 @@ public:
WebIDBFactoryImpl();
virtual ~WebIDBFactoryImpl();
- virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*);
+ virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir);
virtual void abortPendingTransactions(const WebVector<int>& pendingIDs);
private:
diff --git a/WebKit/chromium/src/WebIDBIndexImpl.cpp b/WebKit/chromium/src/WebIDBIndexImpl.cpp
index 777ec32..c049aac 100644
--- a/WebKit/chromium/src/WebIDBIndexImpl.cpp
+++ b/WebKit/chromium/src/WebIDBIndexImpl.cpp
@@ -26,7 +26,12 @@
#include "config.h"
#include "WebIDBIndexImpl.h"
+#include "IDBCallbacksProxy.h"
#include "IDBIndex.h"
+#include "IDBKeyRange.h"
+#include "WebIDBCallbacks.h"
+#include "WebIDBKey.h"
+#include "WebIDBKeyRange.h"
#if ENABLE(INDEXED_DATABASE)
@@ -48,6 +53,11 @@ WebString WebIDBIndexImpl::name() const
return m_backend->name();
}
+WebString WebIDBIndexImpl::storeName() const
+{
+ return m_backend->storeName();
+}
+
WebString WebIDBIndexImpl::keyPath() const
{
return m_backend->keyPath();
@@ -58,6 +68,26 @@ bool WebIDBIndexImpl::unique() const
return m_backend->unique();
}
+void WebIDBIndexImpl::openCursor(const WebIDBKeyRange& keyRange, unsigned short direction, WebIDBCallbacks* callbacks)
+{
+ m_backend->openCursor(keyRange, direction, IDBCallbacksProxy::create(callbacks));
+}
+
+void WebIDBIndexImpl::openObjectCursor(const WebIDBKeyRange& keyRange, unsigned short direction, WebIDBCallbacks* callbacks)
+{
+ m_backend->openObjectCursor(keyRange, direction, IDBCallbacksProxy::create(callbacks));
+}
+
+void WebIDBIndexImpl::getObject(const WebIDBKey& keyRange, WebIDBCallbacks* callbacks)
+{
+ m_backend->getObject(keyRange, IDBCallbacksProxy::create(callbacks));
+}
+
+void WebIDBIndexImpl::get(const WebIDBKey& keyRange, WebIDBCallbacks* callbacks)
+{
+ m_backend->get(keyRange, IDBCallbacksProxy::create(callbacks));
+}
+
} // namespace WebCore
#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebKit/chromium/src/WebIDBIndexImpl.h b/WebKit/chromium/src/WebIDBIndexImpl.h
index 73f3819..2108001 100644
--- a/WebKit/chromium/src/WebIDBIndexImpl.h
+++ b/WebKit/chromium/src/WebIDBIndexImpl.h
@@ -42,9 +42,15 @@ public:
virtual ~WebIDBIndexImpl();
virtual WebString name() const;
+ virtual WebString storeName() const;
virtual WebString keyPath() const;
virtual bool unique() const;
+ virtual void openObjectCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*);
+ virtual void openCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*);
+ virtual void getObject(const WebIDBKey&, WebIDBCallbacks*);
+ virtual void get(const WebIDBKey&, WebIDBCallbacks*);
+
private:
WTF::RefPtr<WebCore::IDBIndexBackendInterface> m_backend;
};
diff --git a/WebKit/chromium/src/WebInputElement.cpp b/WebKit/chromium/src/WebInputElement.cpp
index 7bf6407..25d484c 100644
--- a/WebKit/chromium/src/WebInputElement.cpp
+++ b/WebKit/chromium/src/WebInputElement.cpp
@@ -40,6 +40,26 @@ using namespace WebCore;
namespace WebKit {
+bool WebInputElement::isTextField() const
+{
+ return constUnwrap<HTMLInputElement>()->isTextField();
+}
+
+bool WebInputElement::isText() const
+{
+ return constUnwrap<HTMLInputElement>()->isText();
+}
+
+bool WebInputElement::isPasswordField() const
+{
+ return constUnwrap<HTMLInputElement>()->isPasswordField();
+}
+
+bool WebInputElement::isImageButton() const
+{
+ return constUnwrap<HTMLInputElement>()->isImageButton();
+}
+
bool WebInputElement::autoComplete() const
{
return constUnwrap<HTMLInputElement>()->autoComplete();
@@ -57,7 +77,7 @@ bool WebInputElement::isEnabledFormControl() const
WebInputElement::InputType WebInputElement::inputType() const
{
- return static_cast<InputType>(constUnwrap<HTMLInputElement>()->inputType());
+ return static_cast<InputType>(constUnwrap<HTMLInputElement>()->deprecatedInputType());
}
int WebInputElement::maxLength() const
diff --git a/WebKit/chromium/src/WebKit.cpp b/WebKit/chromium/src/WebKit.cpp
index f3336ea..cadcb6c 100644
--- a/WebKit/chromium/src/WebKit.cpp
+++ b/WebKit/chromium/src/WebKit.cpp
@@ -103,11 +103,6 @@ bool layoutTestMode()
return s_layoutTestMode;
}
-bool areLayoutTestImagesOpaque()
-{
- return true;
-}
-
void enableLogChannel(const char* name)
{
WTFLogChannel* channel = WebCore::getChannelFromName(name);
diff --git a/WebKit/chromium/src/WebPasswordFormUtils.cpp b/WebKit/chromium/src/WebPasswordFormUtils.cpp
index e5d5411..6968e1a 100644
--- a/WebKit/chromium/src/WebPasswordFormUtils.cpp
+++ b/WebKit/chromium/src/WebPasswordFormUtils.cpp
@@ -79,8 +79,8 @@ void findPasswordFormFields(HTMLFormElement* form, PasswordFormFields* fields)
continue;
if ((fields->passwords.size() < maxPasswords)
- && (inputElement->inputType() == HTMLInputElement::PASSWORD)
- && (inputElement->autoComplete())) {
+ && inputElement->isPasswordField()
+ && inputElement->autoComplete()) {
if (fields->passwords.isEmpty())
firstPasswordIndex = i;
fields->passwords.append(inputElement);
@@ -98,7 +98,9 @@ void findPasswordFormFields(HTMLFormElement* form, PasswordFormFields* fields)
if (!inputElement->isEnabledFormControl())
continue;
- if ((inputElement->inputType() == HTMLInputElement::TEXT)
+ // FIXME: This needs to use a function other than deprecatedInputType.
+ // Does this really want to special-case TEXT, and not other text-field-like input elements?
+ if ((inputElement->deprecatedInputType() == HTMLInputElement::TEXT)
&& (inputElement->autoComplete())) {
fields->userName = inputElement;
break;
diff --git a/WebKit/chromium/src/WebPopupMenuImpl.cpp b/WebKit/chromium/src/WebPopupMenuImpl.cpp
index 75d6cc1..085a157 100644
--- a/WebKit/chromium/src/WebPopupMenuImpl.cpp
+++ b/WebKit/chromium/src/WebPopupMenuImpl.cpp
@@ -174,6 +174,16 @@ void WebPopupMenuImpl::paint(WebCanvas* canvas, const WebRect& rect)
}
}
+void WebPopupMenuImpl::themeChanged()
+{
+ notImplemented();
+}
+
+void WebPopupMenuImpl::composite(bool finish)
+{
+ notImplemented();
+}
+
bool WebPopupMenuImpl::handleInputEvent(const WebInputEvent& inputEvent)
{
if (!m_widget)
diff --git a/WebKit/chromium/src/WebPopupMenuImpl.h b/WebKit/chromium/src/WebPopupMenuImpl.h
index edbb4ab..221ba03 100644
--- a/WebKit/chromium/src/WebPopupMenuImpl.h
+++ b/WebKit/chromium/src/WebPopupMenuImpl.h
@@ -63,6 +63,8 @@ public:
virtual void resize(const WebSize&);
virtual void layout();
virtual void paint(WebCanvas* canvas, const WebRect& rect);
+ virtual void themeChanged();
+ virtual void composite(bool finish);
virtual bool handleInputEvent(const WebInputEvent&);
virtual void mouseCaptureLost();
virtual void setFocus(bool enable);
diff --git a/WebKit/chromium/src/WebSearchableFormData.cpp b/WebKit/chromium/src/WebSearchableFormData.cpp
index 1864514..5fc51ca 100644
--- a/WebKit/chromium/src/WebSearchableFormData.cpp
+++ b/WebKit/chromium/src/WebSearchableFormData.cpp
@@ -131,7 +131,7 @@ bool IsInDefaultState(const HTMLFormControlElement* formElement)
{
if (formElement->hasTagName(HTMLNames::inputTag)) {
const HTMLInputElement* inputElement = static_cast<const HTMLInputElement*>(formElement);
- if (inputElement->inputType() == HTMLInputElement::CHECKBOX || inputElement->inputType() == HTMLInputElement::RADIO)
+ if (inputElement->isCheckbox() || inputElement->isRadioButton())
return inputElement->checked() == inputElement->defaultChecked();
} else if (formElement->hasTagName(HTMLNames::selectTag))
return IsSelectInDefaultState(static_cast<const HTMLSelectElement*>(formElement));
@@ -166,19 +166,24 @@ bool HasSuitableTextElement(const HTMLFormElement* form, Vector<char>* encodedSt
bool isTextElement = false;
if (formElement->hasTagName(HTMLNames::inputTag)) {
- switch (static_cast<const HTMLInputElement*>(formElement)->inputType()) {
+ if (static_cast<const HTMLInputElement*>(formElement)->isFileUpload()) {
+ // Too big, don't try to index this.
+ return 0;
+ }
+
+ if (static_cast<const HTMLInputElement*>(formElement)->isPasswordField()) {
+ // Don't store passwords! This is most likely an https anyway.
+ return 0;
+ }
+
+ // FIXME: This needs to use a function on HTMLInputElement other than deprecatedInputType.
+ // Also, it's not clear why TEXT should be handled differently than, say, SEARCH.
+ switch (static_cast<const HTMLInputElement*>(formElement)->deprecatedInputType()) {
case HTMLInputElement::TEXT:
case HTMLInputElement::ISINDEX:
isTextElement = true;
break;
- case HTMLInputElement::PASSWORD:
- // Don't store passwords! This is most likely an https anyway.
- // Fall through.
- case HTMLInputElement::FILE:
- // Too big, don't try to index this.
- return 0;
default:
- // All other input types are indexable.
break;
}
}
diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp
index 137bf06..a1c6578 100644
--- a/WebKit/chromium/src/WebViewImpl.cpp
+++ b/WebKit/chromium/src/WebViewImpl.cpp
@@ -34,6 +34,7 @@
#include "AutoFillPopupMenuClient.h"
#include "AXObjectCache.h"
#include "Chrome.h"
+#include "ColorSpace.h"
#include "CompositionUnderlineVectorBuilder.h"
#include "ContextMenu.h"
#include "ContextMenuController.h"
@@ -55,17 +56,17 @@
#include "FrameLoader.h"
#include "FrameTree.h"
#include "FrameView.h"
-#include "GLES2Context.h"
-#include "GLES2ContextInternal.h"
#include "GraphicsContext.h"
#include "GraphicsContext3D.h"
+#include "GraphicsContext3DInternal.h"
#include "HTMLInputElement.h"
#include "HTMLMediaElement.h"
#include "HitTestResult.h"
#include "HTMLNames.h"
#include "Image.h"
+#include "ImageBuffer.h"
+#include "ImageData.h"
#include "InspectorController.h"
-#include "IntRect.h"
#include "KeyboardCodes.h"
#include "KeyboardEvent.h"
#include "MIMETypeRegistry.h"
@@ -115,7 +116,11 @@
#include "WebString.h"
#include "WebVector.h"
#include "WebViewClient.h"
-#include "wtf/OwnPtr.h"
+#include <wtf/RefPtr.h>
+
+#if PLATFORM(CG)
+#include <CoreGraphics/CGContext.h>
+#endif
#if OS(WINDOWS)
#include "RenderThemeChromiumWin.h"
@@ -245,6 +250,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools
, m_newNavigationLoader(0)
#endif
, m_zoomLevel(0)
+ , m_zoomTextOnly(false)
, m_contextMenuAllowed(false)
, m_doingDragAndDrop(false)
, m_ignoreInputEvents(false)
@@ -270,7 +276,6 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools
#if ENABLE(INPUT_SPEECH)
, m_speechInputClient(client)
#endif
- , m_gles2Context(0)
, m_deviceOrientationClientProxy(new DeviceOrientationClientProxy(client ? client->deviceOrientationClient() : 0))
{
// WebKit/win/WebView.cpp does the same thing, except they call the
@@ -912,13 +917,18 @@ void WebViewImpl::resize(const WebSize& newSize)
if (m_client) {
WebRect damagedRect(0, 0, m_size.width, m_size.height);
- m_client->didInvalidateRect(damagedRect);
+ if (isAcceleratedCompositingActive()) {
+#if USE(ACCELERATED_COMPOSITING)
+ invalidateRootLayerRect(damagedRect);
+#endif
+ } else
+ m_client->didInvalidateRect(damagedRect);
}
#if OS(DARWIN)
- if (m_gles2Context) {
- m_gles2Context->resizeOnscreenContent(WebSize(std::max(1, m_size.width),
- std::max(1, m_size.height)));
+ if (m_layerRenderer) {
+ m_layerRenderer->resizeOnscreenContent(WebCore::IntSize(std::max(1, m_size.width),
+ std::max(1, m_size.height)));
}
#endif
}
@@ -944,35 +954,90 @@ void WebViewImpl::layout()
}
}
-void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect)
+#if USE(ACCELERATED_COMPOSITING)
+void WebViewImpl::doPixelReadbackToCanvas(WebCanvas* canvas, const IntRect& rect)
{
+ ASSERT(rect.right() <= m_layerRenderer->rootLayerTextureSize().width()
+ && rect.bottom() <= m_layerRenderer->rootLayerTextureSize().height());
+
+#if PLATFORM(SKIA)
+ PlatformContextSkia context(canvas);
+
+ // PlatformGraphicsContext is actually a pointer to PlatformContextSkia
+ GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context));
+ int bitmapHeight = canvas->getDevice()->accessBitmap(false).height();
+#elif PLATFORM(CG)
+ GraphicsContext gc(canvas);
+ int bitmapHeight = CGBitmapContextGetHeight(reinterpret_cast<CGContextRef>(canvas));
+#else
+ notImplemented();
+#endif
+ // Compute rect to sample from inverted GPU buffer.
+ IntRect invertRect(rect.x(), bitmapHeight - rect.bottom(), rect.width(), rect.height());
+
+ OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(rect.size()));
+ RefPtr<ImageData> imageData(ImageData::create(rect.width(), rect.height()));
+ if (imageBuffer.get() && imageData.get()) {
+ m_layerRenderer->getFramebufferPixels(imageData->data()->data()->data(), invertRect);
+ imageBuffer->putPremultipliedImageData(imageData.get(), IntRect(IntPoint(), rect.size()), IntPoint());
+ gc.save();
+ gc.translate(FloatSize(0.0f, bitmapHeight));
+ gc.scale(FloatSize(1.0f, -1.0f));
+ // Use invertRect in next line, so that transform above inverts it back to
+ // desired destination rect.
+ gc.drawImageBuffer(imageBuffer.get(), DeviceColorSpace, invertRect.location());
+ gc.restore();
+ }
+}
+#endif
+void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect)
+{
+ if (isAcceleratedCompositingActive()) {
#if USE(ACCELERATED_COMPOSITING)
- if (!isAcceleratedCompositingActive()) {
+ doComposite();
+
+ // If a canvas was passed in, we use it to grab a copy of the
+ // freshly-rendered pixels.
+ if (canvas) {
+ // Clip rect to the confines of the rootLayerTexture.
+ IntRect resizeRect(rect);
+ resizeRect.intersect(IntRect(IntPoint(), m_layerRenderer->rootLayerTextureSize()));
+ doPixelReadbackToCanvas(canvas, resizeRect);
+ }
+
+ // Temporarily present so the downstream Chromium renderwidget still renders.
+ // FIXME: remove this call once the changes to Chromium's renderwidget have landed.
+ m_layerRenderer->present();
#endif
+ } else {
WebFrameImpl* webframe = mainFrameImpl();
if (webframe)
webframe->paint(canvas, rect);
-#if USE(ACCELERATED_COMPOSITING)
- } else {
- // Draw the contents of the root layer.
- updateRootLayerContents(rect);
+ }
+}
- WebFrameImpl* webframe = mainFrameImpl();
- if (!webframe)
- return;
- FrameView* view = webframe->frameView();
- if (!view)
- return;
+void WebViewImpl::themeChanged()
+{
+ if (!page())
+ return;
+ FrameView* view = page()->mainFrame()->view();
- // The visibleRect includes scrollbars whereas the contentRect doesn't.
- IntRect visibleRect = view->visibleContentRect(true);
- IntRect contentRect = view->visibleContentRect(false);
+ WebRect damagedRect(0, 0, m_size.width, m_size.height);
+ view->invalidateRect(damagedRect);
+}
- // Ask the layer compositor to redraw all the layers.
- ASSERT(m_layerRenderer->hardwareCompositing());
- m_layerRenderer->drawLayers(rect, visibleRect, contentRect, IntPoint(view->scrollX(), view->scrollY()));
- }
+void WebViewImpl::composite(bool finish)
+{
+#if USE(ACCELERATED_COMPOSITING)
+ doComposite();
+
+ // Finish if requested.
+ if (finish)
+ m_layerRenderer->finish();
+
+ // Put result onscreen.
+ m_layerRenderer->present();
#endif
}
@@ -1474,16 +1539,23 @@ int WebViewImpl::setZoomLevel(bool textOnly, int zoomLevel)
maxTextSizeMultiplier),
minTextSizeMultiplier));
Frame* frame = mainFrameImpl()->frame();
- FrameView* view = frame->view();
- if (!view)
- return m_zoomLevel;
- if (zoomFactor != view->zoomFactor()) {
- view->setZoomFactor(zoomFactor, textOnly ? ZoomTextOnly : ZoomPage);
+
+ float oldZoomFactor = m_zoomTextOnly ? frame->textZoomFactor() : frame->pageZoomFactor();
+
+ if (textOnly)
+ frame->setPageAndTextZoomFactors(1, zoomFactor);
+ else
+ frame->setPageAndTextZoomFactors(zoomFactor, 1);
+
+ if (oldZoomFactor != zoomFactor || textOnly != m_zoomTextOnly) {
WebPluginContainerImpl* pluginContainer = WebFrameImpl::pluginContainerFromFrame(frame);
if (pluginContainer)
pluginContainer->plugin()->setZoomFactor(zoomFactor, textOnly);
- m_zoomLevel = zoomLevel;
}
+
+ m_zoomLevel = zoomLevel;
+ m_zoomTextOnly = textOnly;
+
return m_zoomLevel;
}
@@ -1904,6 +1976,11 @@ bool WebViewImpl::isActive() const
return (page() && page()->focusController()) ? page()->focusController()->isActive() : false;
}
+void WebViewImpl::setDomainRelaxationForbidden(bool forbidden, const WebString& scheme)
+{
+ SecurityOrigin::setDomainRelaxationForbiddenForURLScheme(forbidden, String(scheme));
+}
+
void WebViewImpl::setScrollbarColors(unsigned inactiveColor,
unsigned activeColor,
unsigned trackColor) {
@@ -2114,24 +2191,126 @@ bool WebViewImpl::allowsAcceleratedCompositing()
void WebViewImpl::setRootGraphicsLayer(WebCore::PlatformLayer* layer)
{
+ bool wasActive = m_isAcceleratedCompositingActive;
setIsAcceleratedCompositingActive(layer ? true : false);
if (m_layerRenderer)
m_layerRenderer->setRootLayer(layer);
+ if (wasActive != m_isAcceleratedCompositingActive) {
+ IntRect damagedRect(0, 0, m_size.width, m_size.height);
+ if (m_isAcceleratedCompositingActive)
+ invalidateRootLayerRect(damagedRect);
+ else
+ m_client->didInvalidateRect(damagedRect);
+ }
+}
+
+void WebViewImpl::setRootLayerNeedsDisplay()
+{
+ if (m_layerRenderer)
+ m_layerRenderer->setNeedsDisplay();
+ m_client->scheduleComposite();
+ // FIXME: To avoid breaking the downstream Chrome render_widget while downstream
+ // changes land, we also have to pass a 1x1 invalidate up to the client
+ {
+ WebRect damageRect(0, 0, 1, 1);
+ m_client->didInvalidateRect(damageRect);
+ }
}
+
+void WebViewImpl::scrollRootLayerRect(const IntSize& scrollDelta, const IntRect& clipRect)
+{
+ // FIXME: To avoid breaking the Chrome render_widget when the new compositor render
+ // path is not checked in, we must still pass scroll damage up to the client. This
+ // code will be backed out in a followup CL once the Chromium changes have landed.
+ m_client->didScrollRect(scrollDelta.width(), scrollDelta.height(), clipRect);
+
+ ASSERT(m_layerRenderer);
+ // Compute the damage rect in viewport space.
+ WebFrameImpl* webframe = mainFrameImpl();
+ if (!webframe)
+ return;
+ FrameView* view = webframe->frameView();
+ if (!view)
+ return;
+
+ IntRect contentRect = view->visibleContentRect(false);
+
+ // We support fast scrolling in one direction at a time.
+ if (scrollDelta.width() && scrollDelta.height()) {
+ invalidateRootLayerRect(WebRect(contentRect));
+ return;
+ }
+
+ // Compute the region we will expose by scrolling. We use the
+ // content rect for invalidation. Using this space for damage
+ // rects allows us to intermix invalidates with scrolls.
+ IntRect damagedContentsRect;
+ if (scrollDelta.width()) {
+ float dx = static_cast<float>(scrollDelta.width());
+ damagedContentsRect.setY(contentRect.y());
+ damagedContentsRect.setHeight(contentRect.height());
+ if (dx > 0) {
+ damagedContentsRect.setX(contentRect.x());
+ damagedContentsRect.setWidth(dx);
+ } else {
+ damagedContentsRect.setX(contentRect.right() + dx);
+ damagedContentsRect.setWidth(-dx);
+ }
+ } else {
+ float dy = static_cast<float>(scrollDelta.height());
+ damagedContentsRect.setX(contentRect.x());
+ damagedContentsRect.setWidth(contentRect.width());
+ if (dy > 0) {
+ damagedContentsRect.setY(contentRect.y());
+ damagedContentsRect.setHeight(dy);
+ } else {
+ damagedContentsRect.setY(contentRect.bottom() + dy);
+ damagedContentsRect.setHeight(-dy);
+ }
+ }
+
+ m_scrollDamage.unite(damagedContentsRect);
+ setRootLayerNeedsDisplay();
+}
+
+void WebViewImpl::invalidateRootLayerRect(const IntRect& rect)
+{
+ // FIXME: To avoid breaking the Chrome render_widget when the new compositor render
+ // path is not checked in, we must still pass damage up to the client. This
+ // code will be backed out in a followup CL once the Chromium changes have landed.
+ m_client->didInvalidateRect(rect);
+
+ ASSERT(m_layerRenderer);
+
+ if (!page())
+ return;
+ FrameView* view = page()->mainFrame()->view();
+
+ // rect is in viewport space. Convert to content space
+ // so that invalidations and scroll invalidations play well with one-another.
+ FloatRect contentRect = view->windowToContents(rect);
+
+ // FIXME: add a smarter damage aggregation logic? Right now, LayerChromium does simple union-ing.
+ m_layerRenderer->rootLayer()->setNeedsDisplay(contentRect);
+}
+
+
void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
{
if (m_isAcceleratedCompositingActive == active)
return;
if (active) {
- m_layerRenderer = LayerRendererChromium::create(getOnscreenGLES2Context());
+ OwnPtr<GraphicsContext3D> context = m_temporaryOnscreenGraphicsContext3D.release();
+ if (!context) {
+ context = GraphicsContext3D::create(GraphicsContext3D::Attributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
+ if (context)
+ context->reshape(std::max(1, m_size.width), std::max(1, m_size.height));
+ }
+ m_layerRenderer = LayerRendererChromium::create(context.release());
if (m_layerRenderer) {
m_isAcceleratedCompositingActive = true;
-
- // Force a redraw the entire view so that the compositor gets the entire view,
- // rather than just the currently-dirty subset.
- m_client->didInvalidateRect(IntRect(0, 0, m_size.width, m_size.height));
} else {
m_isAcceleratedCompositingActive = false;
m_compositorCreationFailed = true;
@@ -2142,17 +2321,11 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
}
}
-void WebViewImpl::updateRootLayerContents(const WebRect& rect)
+void WebViewImpl::updateRootLayerContents(const IntRect& rect)
{
if (!isAcceleratedCompositingActive())
return;
- // FIXME: The accelerated compositing path invalidates a 1x1 rect at (0, 0)
- // in order to get the renderer to ask the compositor to redraw. This is only
- // temporary until we get the compositor to render directly from its own thread.
- if (!rect.x && !rect.y && rect.width == 1 && rect.height == 1)
- return;
-
WebFrameImpl* webframe = mainFrameImpl();
if (!webframe)
return;
@@ -2164,7 +2337,7 @@ void WebViewImpl::updateRootLayerContents(const WebRect& rect)
if (rootLayer) {
IntRect visibleRect = view->visibleContentRect(true);
- m_layerRenderer->setRootLayerCanvasSize(IntSize(rect.width, rect.height));
+ m_layerRenderer->setRootLayerCanvasSize(IntSize(rect.width(), rect.height()));
GraphicsContext* rootLayerContext = m_layerRenderer->rootLayerGraphicsContext();
#if PLATFORM(SKIA)
@@ -2174,7 +2347,7 @@ void WebViewImpl::updateRootLayerContents(const WebRect& rect)
platformCanvas->save();
// Bring the canvas into the coordinate system of the paint rect.
- platformCanvas->translate(static_cast<SkScalar>(-rect.x), static_cast<SkScalar>(-rect.y));
+ platformCanvas->translate(static_cast<SkScalar>(-rect.x()), static_cast<SkScalar>(-rect.y()));
rootLayerContext->save();
@@ -2188,7 +2361,7 @@ void WebViewImpl::updateRootLayerContents(const WebRect& rect)
CGContextSaveGState(cgContext);
// Bring the CoreGraphics context into the coordinate system of the paint rect.
- CGContextTranslateCTM(cgContext, -rect.x, -rect.y);
+ CGContextTranslateCTM(cgContext, -rect.x(), -rect.y());
rootLayerContext->save();
@@ -2202,62 +2375,88 @@ void WebViewImpl::updateRootLayerContents(const WebRect& rect)
}
}
-void WebViewImpl::setRootLayerNeedsDisplay()
+void WebViewImpl::doComposite()
{
- // FIXME: For now we're posting a repaint event for the entire page which is an overkill.
- if (WebFrameImpl* webframe = mainFrameImpl()) {
- if (FrameView* view = webframe->frameView()) {
- // FIXME: Temporary hack to invalidate part of the page so that we get called to render
- // again.
- IntRect visibleRect = view->visibleContentRect(true);
- m_client->didInvalidateRect(IntRect(0, 0, 1, 1));
+ ASSERT(isAcceleratedCompositingActive());
+ if (!page())
+ return;
+ FrameView* view = page()->mainFrame()->view();
+
+ // The visibleRect includes scrollbars whereas the contentRect doesn't.
+ IntRect visibleRect = view->visibleContentRect(true);
+ IntRect contentRect = view->visibleContentRect(false);
+ IntRect viewPort = IntRect(0, 0, m_size.width, m_size.height);
+
+ // Give the compositor a chance to setup/resize the root texture handle and perform scrolling.
+ m_layerRenderer->prepareToDrawLayers(visibleRect, contentRect, IntPoint(view->scrollX(), view->scrollY()));
+
+ // Draw the contents of the root layer.
+ Vector<FloatRect> damageRects;
+ damageRects.append(m_scrollDamage);
+ damageRects.append(m_layerRenderer->rootLayer()->dirtyRect());
+ for (size_t i = 0; i < damageRects.size(); ++i) {
+ // The damage rect for the root layer is in content space [e.g. unscrolled].
+ // Convert from content space to viewPort space.
+ const FloatRect damagedContentRect = damageRects[i];
+ IntRect damagedRect = view->contentsToWindow(IntRect(damagedContentRect));
+
+ // Intersect this rectangle with the viewPort.
+ damagedRect.intersect(viewPort);
+
+ // Now render it.
+ if (damagedRect.width() && damagedRect.height()) {
+ updateRootLayerContents(damagedRect);
+ m_layerRenderer->updateRootLayerTextureRect(damagedRect);
}
}
+ m_layerRenderer->rootLayer()->resetNeedsDisplay();
+ m_scrollDamage = WebRect();
- if (m_layerRenderer)
- m_layerRenderer->setNeedsDisplay();
+ // Draw the actual layers...
+ m_layerRenderer->drawLayers(visibleRect, contentRect);
}
-#endif // USE(ACCELERATED_COMPOSITING)
+#endif
-PassOwnPtr<GLES2Context> WebViewImpl::getOnscreenGLES2Context()
-{
- WebGLES2Context* context = gles2Context();
- if (!context)
- return 0;
- return GLES2Context::create(GLES2ContextInternal::create(context, false));
-}
SharedGraphicsContext3D* WebViewImpl::getSharedGraphicsContext3D()
{
if (!m_sharedContext3D) {
GraphicsContext3D::Attributes attr;
OwnPtr<GraphicsContext3D> context = GraphicsContext3D::create(attr, m_page->chrome());
+ if (!context)
+ return 0;
m_sharedContext3D = SharedGraphicsContext3D::create(context.release());
}
return m_sharedContext3D.get();
}
-// Returns the GLES2 context associated with this View. If one doesn't exist
-// it will get created first.
WebGLES2Context* WebViewImpl::gles2Context()
{
- if (!m_gles2Context) {
- m_gles2Context = webKitClient()->createGLES2Context();
- if (!m_gles2Context)
- return 0;
-
- if (!m_gles2Context->initialize(this, 0)) {
- m_gles2Context.clear();
- return 0;
- }
+ return 0;
+}
+WebGraphicsContext3D* WebViewImpl::graphicsContext3D()
+{
+#if USE(ACCELERATED_COMPOSITING)
+ GraphicsContext3D* context = 0;
+ if (m_layerRenderer)
+ context = m_layerRenderer->context();
+ else if (m_temporaryOnscreenGraphicsContext3D)
+ context = m_temporaryOnscreenGraphicsContext3D.get();
+ else {
+ GraphicsContext3D::Attributes attributes;
+ m_temporaryOnscreenGraphicsContext3D = GraphicsContext3D::create(GraphicsContext3D::Attributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
#if OS(DARWIN)
- m_gles2Context->resizeOnscreenContent(WebSize(std::max(1, m_size.width),
- std::max(1, m_size.height)));
+ if (m_temporaryOnscreenGraphicsContext3D)
+ m_temporaryOnscreenGraphicsContext3D->reshape(std::max(1, m_size.width), std::max(1, m_size.height));
#endif
+ context = m_temporaryOnscreenGraphicsContext3D.get();
}
- return m_gles2Context.get();
+ return GraphicsContext3DInternal::extractWebGraphicsContext3D(context);
+#else
+ return 0;
+#endif
}
} // namespace WebKit
diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h
index a42099c..bbd25a2 100644
--- a/WebKit/chromium/src/WebViewImpl.h
+++ b/WebKit/chromium/src/WebViewImpl.h
@@ -31,9 +31,9 @@
#ifndef WebViewImpl_h
#define WebViewImpl_h
-#include "WebGLES2Context.h"
#include "WebNavigationPolicy.h"
#include "WebPoint.h"
+#include "WebRect.h"
#include "WebSize.h"
#include "WebString.h"
#include "WebView.h"
@@ -43,8 +43,10 @@
#include "ContextMenuClientImpl.h"
#include "DragClientImpl.h"
#include "EditorClientImpl.h"
+#include "GraphicsContext3D.h"
#include "GraphicsLayer.h"
#include "InspectorClientImpl.h"
+#include "IntRect.h"
#include "LayerRendererChromium.h"
#include "NotificationPresenterImpl.h"
#include "SpeechInputClientImpl.h"
@@ -54,7 +56,6 @@
namespace WebCore {
class ChromiumDataObject;
class Frame;
-class GLES2Context;
class HistoryItem;
class HitTestResult;
class KeyboardEvent;
@@ -92,6 +93,8 @@ public:
virtual void resize(const WebSize&);
virtual void layout();
virtual void paint(WebCanvas*, const WebRect&);
+ virtual void themeChanged();
+ virtual void composite(bool finish);
virtual bool handleInputEvent(const WebInputEvent&);
virtual void mouseCaptureLost();
virtual void setFocus(bool enable);
@@ -119,6 +122,7 @@ public:
virtual void setTabKeyCyclesThroughElements(bool value);
virtual bool isActive() const;
virtual void setIsActive(bool value);
+ virtual void setDomainRelaxationForbidden(bool, const WebString& scheme);
virtual bool dispatchBeforeUnloadEvent();
virtual void dispatchUnloadEvent();
virtual WebFrame* mainFrame();
@@ -322,21 +326,28 @@ public:
}
#if USE(ACCELERATED_COMPOSITING)
- void setRootLayerNeedsDisplay();
- void setRootGraphicsLayer(WebCore::PlatformLayer*);
bool allowsAcceleratedCompositing();
+ void setRootGraphicsLayer(WebCore::PlatformLayer*);
+ void setRootLayerNeedsDisplay();
+ void scrollRootLayerRect(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& clipRect);
+ void invalidateRootLayerRect(const WebCore::IntRect&);
#endif
- // Onscreen contexts display to the screen associated with this view.
- // Offscreen contexts render offscreen but can share resources with the
- // onscreen context and thus can be composited.
- PassOwnPtr<WebCore::GLES2Context> getOnscreenGLES2Context();
-
- // Returns an onscreen context
+ // FIXME: remove this method once the compositor is fully switched
+ // over to GraphicsContext3D.
virtual WebGLES2Context* gles2Context();
+
+ // Returns the onscreen 3D context used by the compositor. This is
+ // used by the renderer's code to set up resource sharing between
+ // the compositor's context and subordinate contexts for APIs like
+ // WebGL. Returns 0 if compositing support is not compiled in.
+ virtual WebGraphicsContext3D* graphicsContext3D();
+
virtual WebCore::SharedGraphicsContext3D* getSharedGraphicsContext3D();
WebCore::PopupContainer* selectPopup() const { return m_selectPopup.get(); }
+ bool zoomTextOnly() const { return m_zoomTextOnly; }
+
// Returns true if the event leads to scrolling.
static bool mapKeyCodeForScroll(int keyCode,
WebCore::ScrollDirection* scrollDirection,
@@ -386,7 +397,9 @@ private:
#if USE(ACCELERATED_COMPOSITING)
void setIsAcceleratedCompositingActive(bool);
- void updateRootLayerContents(const WebRect&);
+ void updateRootLayerContents(const WebCore::IntRect&);
+ void doComposite();
+ void doPixelReadbackToCanvas(WebCanvas*, const WebCore::IntRect&);
#endif
WebViewClient* m_client;
@@ -433,6 +446,8 @@ private:
// mean zoom in, negative numbers mean zoom out.
int m_zoomLevel;
+ bool m_zoomTextOnly;
+
bool m_contextMenuAllowed;
bool m_doingDragAndDrop;
@@ -511,6 +526,7 @@ private:
RefPtr<WebCore::Node> m_mouseCaptureNode;
#if USE(ACCELERATED_COMPOSITING)
+ WebCore::IntRect m_scrollDamage;
OwnPtr<WebCore::LayerRendererChromium> m_layerRenderer;
bool m_isAcceleratedCompositingActive;
bool m_compositorCreationFailed;
@@ -520,8 +536,10 @@ private:
#if ENABLE(INPUT_SPEECH)
SpeechInputClientImpl m_speechInputClient;
#endif
-
- OwnPtr<WebGLES2Context> m_gles2Context;
+ // If we attempt to fetch the on-screen GraphicsContext3D before
+ // the compositor has been turned on, we need to instantiate it
+ // early. This member holds on to the GC3D in this case.
+ OwnPtr<WebCore::GraphicsContext3D> m_temporaryOnscreenGraphicsContext3D;
RefPtr<WebCore::SharedGraphicsContext3D> m_sharedContext3D;
diff --git a/WebKit/chromium/src/js/DebuggerScript.js b/WebKit/chromium/src/js/DebuggerScript.js
deleted file mode 100644
index 5a8a7bf..0000000
--- a/WebKit/chromium/src/js/DebuggerScript.js
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-(function () {
-
-var DebuggerScript = {};
-DebuggerScript._breakpoints = {};
-
-DebuggerScript.PauseOnExceptionsState = {
- DontPauseOnExceptions : 0,
- PauseOnAllExceptions : 1,
- PauseOnUncaughtExceptions: 2
-};
-
-DebuggerScript.ScriptWorldType = {
- MainWorld : 0,
- ExtensionsWorld : 1
-};
-
-DebuggerScript._pauseOnExceptionsState = DebuggerScript.PauseOnExceptionsState.DontPauseOnExceptions;
-Debug.clearBreakOnException();
-Debug.clearBreakOnUncaughtException();
-
-DebuggerScript.getAfterCompileScript = function(eventData)
-{
- return DebuggerScript._formatScript(eventData.script_.script_);
-}
-
-DebuggerScript.getScripts = function(contextData)
-{
- var result = [];
-
- if (!contextData)
- return result;
- var comma = contextData.indexOf(",");
- if (comma === -1)
- return result;
- // Context data is a string in the following format:
- // ("page"|"injected")","<page id>
- var idSuffix = contextData.substring(comma); // including the comma
-
- var scripts = Debug.scripts();
- for (var i = 0; i < scripts.length; ++i) {
- var script = scripts[i];
- if (script.context_data && script.context_data.lastIndexOf(idSuffix) != -1)
- result.push(DebuggerScript._formatScript(script));
- }
- return result;
-}
-
-DebuggerScript._formatScript = function(script)
-{
- var scriptWorldType = DebuggerScript.ScriptWorldType.MainWorld;
- if (script.context_data && script.context_data.indexOf("injected") == 0)
- scriptWorldType = DebuggerScript.ScriptWorldType.ExtensionsWorld;
- return {
- id: script.id,
- name: script.nameOrSourceURL(),
- source: script.source,
- lineOffset: DebuggerScript._v8ToWebkitLineNumber(script.line_offset),
- lineCount: script.lineCount(),
- scriptWorldType: scriptWorldType
- };
-}
-
-DebuggerScript.setBreakpoint = function(execState, args)
-{
- args.lineNumber = DebuggerScript._webkitToV8LineNumber(args.lineNumber);
- var breakId = Debug.setScriptBreakPointById(args.scriptId, args.lineNumber, 0 /* column */, args.condition);
- if (!args.enabled)
- Debug.disableScriptBreakPoint(breakId);
-
- var locations = Debug.findBreakPointActualLocations(breakId);
- var actualLineNumber = locations.length ? locations[0].line : args.lineNumber;
-
- var key = args.scriptId + ":" + actualLineNumber;
- if (key in DebuggerScript._breakpoints) {
- // Remove old breakpoint.
- Debug.findBreakPoint(DebuggerScript._breakpoints[key], true);
- }
- DebuggerScript._breakpoints[key] = breakId;
- return DebuggerScript._v8ToWebkitLineNumber(actualLineNumber);
-}
-
-DebuggerScript.removeBreakpoint = function(execState, args)
-{
- args.lineNumber = DebuggerScript._webkitToV8LineNumber(args.lineNumber);
- var key = args.scriptId + ":" + args.lineNumber;
- var breakId = DebuggerScript._breakpoints[key];
- if (breakId)
- Debug.findBreakPoint(breakId, true);
- delete DebuggerScript._breakpoints[key];
-}
-
-DebuggerScript.pauseOnExceptionsState = function()
-{
- return DebuggerScript._pauseOnExceptionsState;
-}
-
-DebuggerScript.setPauseOnExceptionsState = function(newState)
-{
- DebuggerScript._pauseOnExceptionsState = newState;
-
- if (DebuggerScript.PauseOnExceptionsState.PauseOnAllExceptions === newState)
- Debug.setBreakOnException();
- else
- Debug.clearBreakOnException();
-
- if (DebuggerScript.PauseOnExceptionsState.PauseOnUncaughtExceptions === newState)
- Debug.setBreakOnUncaughtException();
- else
- Debug.clearBreakOnUncaughtException();
-}
-
-DebuggerScript.currentCallFrame = function(execState, args)
-{
- var frameCount = execState.frameCount();
- if (frameCount === 0)
- return undefined;
-
- var topFrame;
- for (var i = frameCount - 1; i >= 0; i--) {
- var frameMirror = execState.frame(i);
- topFrame = DebuggerScript._frameMirrorToJSCallFrame(frameMirror, topFrame);
- }
- return topFrame;
-}
-
-DebuggerScript.stepIntoStatement = function(execState)
-{
- execState.prepareStep(Debug.StepAction.StepIn, 1);
-}
-
-DebuggerScript.stepOverStatement = function(execState)
-{
- execState.prepareStep(Debug.StepAction.StepNext, 1);
-}
-
-DebuggerScript.stepOutOfFunction = function(execState)
-{
- execState.prepareStep(Debug.StepAction.StepOut, 1);
-}
-
-DebuggerScript.editScriptSource = function(scriptId, newSource)
-{
- var scripts = Debug.scripts();
- var scriptToEdit = null;
- for (var i = 0; i < scripts.length; i++) {
- if (scripts[i].id == scriptId) {
- scriptToEdit = scripts[i];
- break;
- }
- }
- if (!scriptToEdit)
- throw("Script not found");
-
- var changeLog = [];
- Debug.LiveEdit.SetScriptSource(scriptToEdit, newSource, false, changeLog);
- return scriptToEdit.source;
-}
-
-DebuggerScript.clearBreakpoints = function(execState, args)
-{
- for (var key in DebuggerScript._breakpoints) {
- var breakId = DebuggerScript._breakpoints[key];
- Debug.findBreakPoint(breakId, true);
- }
- DebuggerScript._breakpoints = {};
-}
-
-DebuggerScript.setBreakpointsActivated = function(execState, args)
-{
- Debug.debuggerFlags().breakPointsActive.setValue(args.enabled);
-}
-
-DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame)
-{
- // Get function name.
- var func;
- try {
- func = frameMirror.func();
- } catch(e) {
- }
- var functionName;
- if (func)
- functionName = func.name() || func.inferredName();
-
- // Get script ID.
- var script = func.script();
- var sourceID = script && script.id();
-
- // Get line number.
- var line = DebuggerScript._v8ToWebkitLineNumber(frameMirror.sourceLine());
-
- // Get this object.
- var thisObject = frameMirror.details_.receiver();
-
- // Get scope chain array in format: [<scope type>, <scope object>, <scope type>, <scope object>,...]
- var scopeChain = [];
- var scopeType = [];
- for (var i = 0; i < frameMirror.scopeCount(); i++) {
- var scopeMirror = frameMirror.scope(i);
- var scopeObjectMirror = scopeMirror.scopeObject();
- var properties = scopeObjectMirror.properties();
- var scopeObject = {};
- for (var j = 0; j < properties.length; j++)
- scopeObject[properties[j].name()] = properties[j].value_;
- // Reset scope object prototype to null so that the proto properties
- // don't appear in th local scope section.
- scopeObject.__proto__ = null;
- scopeType.push(scopeMirror.scopeType());
- scopeChain.push(scopeObject);
- }
-
- function evaluate(expression) {
- return frameMirror.evaluate(expression, false).value();
- }
-
- return {
- "sourceID": sourceID,
- "line": line,
- "functionName": functionName,
- "type": "function",
- "thisObject": thisObject,
- "scopeChain": scopeChain,
- "scopeType": scopeType,
- "evaluate": evaluate,
- "caller": callerFrame
- };
-}
-
-DebuggerScript._webkitToV8LineNumber = function(line)
-{
- return line - 1;
-};
-
-DebuggerScript._v8ToWebkitLineNumber = function(line)
-{
- return line + 1;
-};
-
-return DebuggerScript;
-
-})();
diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js
index f55be4e..0c7241d 100644
--- a/WebKit/chromium/src/js/DevTools.js
+++ b/WebKit/chromium/src/js/DevTools.js
@@ -162,7 +162,3 @@ WebInspector.resetToolbarColors = function()
}
-// TODO(yurys): should be removed when eclipse debugger stops using it.
-if (window.RemoteDebuggerAgent) {
- RemoteDebuggerAgent.setContextId = function() {};
-}
diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js
index 2233463..5cebb52 100644
--- a/WebKit/chromium/src/js/Tests.js
+++ b/WebKit/chromium/src/js/Tests.js
@@ -953,230 +953,6 @@ TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callb
/**
- * Gets a XPathResult matching given xpath.
- * @param {string} xpath
- * @param {number} resultType
- * @param {Node} opt_ancestor Context node. If not specified documentElement
- * will be used
- * @return {XPathResult} Type of returned value is determined by "resultType" parameter
- */
-
-TestSuite.prototype._evaluateXpath = function(xpath, resultType, opt_ancestor)
-{
- if (!opt_ancestor)
- opt_ancestor = document.documentElement;
- try {
- return document.evaluate(xpath, opt_ancestor, null, resultType, null);
- } catch(e) {
- this.fail('Error in expression: "' + xpath + '".' + e);
- }
-};
-
-
-/**
- * Gets first Node matching given xpath.
- * @param {string} xpath
- * @param {Node} opt_ancestor Context node. If not specified documentElement
- * will be used
- * @return {?Node}
- */
-TestSuite.prototype._findNode = function(xpath, opt_ancestor)
-{
- var result = this._evaluateXpath(xpath, XPathResult.FIRST_ORDERED_NODE_TYPE, opt_ancestor).singleNodeValue;
- this.assertTrue(!!result, "Cannot find node on path: " + xpath);
- return result;
-};
-
-
-/**
- * Gets a text matching given xpath.
- * @param {string} xpath
- * @param {Node} opt_ancestor Context node. If not specified documentElement
- * will be used
- * @return {?string}
- */
-TestSuite.prototype._findText = function(xpath, opt_ancestor)
-{
- var result = this._evaluateXpath(xpath, XPathResult.STRING_TYPE, opt_ancestor).stringValue;
- this.assertTrue(!!result, "Cannot find text on path: " + xpath);
- return result;
-};
-
-
-/**
- * Gets an iterator over nodes matching given xpath.
- * @param {string} xpath
- * @param {Node} opt_ancestor Context node. If not specified, documentElement
- * will be used
- * @return {XPathResult} Iterator over the nodes
- */
-TestSuite.prototype._nodeIterator = function(xpath, opt_ancestor)
-{
- return this._evaluateXpath(xpath, XPathResult.ORDERED_NODE_ITERATOR_TYPE, opt_ancestor);
-};
-
-
-/**
- * Checks the scopeSectionDiv against the expectations.
- * @param {Node} scopeSectionDiv The section div
- * @param {Object} expectations Expectations dictionary
- */
-TestSuite.prototype._checkScopeSectionDiv = function(scopeSectionDiv, expectations)
-{
- var scopeTitle = this._findText('./div[@class="header"]/div[@class="title"]/text()', scopeSectionDiv);
- this.assertEquals(expectations.title, scopeTitle, "Unexpected scope section title.");
- if (!expectations.properties)
- return;
- this.assertTrue(scopeSectionDiv.hasStyleClass("expanded"), 'Section "' + scopeTitle + '" is collapsed.');
-
- var propertyIt = this._nodeIterator("./ol/li", scopeSectionDiv);
- var propertyLi;
- var foundProps = [];
- while (propertyLi = propertyIt.iterateNext()) {
- var name = this._findText('./span[@class="name"]/text()', propertyLi);
- var value = this._findText('./span[@class="value"]/text()', propertyLi);
- this.assertTrue(!!name, 'Invalid variable name: "' + name + '"');
- this.assertTrue(name in expectations.properties, "Unexpected property: " + name);
- this.assertEquals(expectations.properties[name], value, 'Unexpected "' + name + '" property value.');
- delete expectations.properties[name];
- foundProps.push(name + " = " + value);
- }
-
- // Check that all expected properties were found.
- for (var p in expectations.properties)
- this.fail('Property "' + p + '" was not found in scope "' + scopeTitle + '". Found properties: "' + foundProps.join(",") + '"');
-};
-
-
-/**
- * Expands scope sections matching the filter and invokes the callback on
- * success.
- * @param {function(WebInspector.ObjectPropertiesSection, number):boolean}
- * filter
- * @param {Function} callback
- */
-TestSuite.prototype._expandScopeSections = function(filter, callback)
-{
- var sections = WebInspector.currentPanel.sidebarPanes.scopechain.sections;
-
- var toBeUpdatedCount = 0;
- function updateListener() {
- --toBeUpdatedCount;
- if (toBeUpdatedCount === 0) {
- // Report when all scopes are expanded and populated.
- callback();
- }
- }
-
- // Global scope is always the last one.
- for (var i = 0; i < sections.length - 1; i++) {
- var section = sections[i];
- if (!filter(sections, i))
- continue;
- ++toBeUpdatedCount;
- var populated = section.populated;
-
- this._hookGetPropertiesCallback(updateListener,
- function() {
- section.expand();
- if (populated) {
- // Make sure "updateProperties" callback will be called at least once
- // after it was overridden.
- section.update();
- }
- });
- }
-};
-
-
-/**
- * Tests that scopes can be expanded and contain expected data.
- */
-TestSuite.prototype.testExpandScope = function()
-{
- this.showPanel("scripts");
- var test = this;
-
- this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_closure.html"]);
-
- this._waitForScriptPause(
- {
- functionsOnStack: ["innerFunction", "handleClick", ""],
- lineNumber: 8,
- lineText: " debugger;"
- },
- expandAllSectionsExceptGlobal);
-
- // Expanding Global scope takes for too long so we skeep it.
- function expandAllSectionsExceptGlobal() {
- test._expandScopeSections(function(sections, i) {
- return i < sections.length - 1;
- },
- examineScopes /* When all scopes are expanded and populated check them. */);
- }
-
- // Check scope sections contents.
- function examineScopes() {
- var scopeVariablesSection = test._findNode('//div[@id="scripts-sidebar"]/div[div[@class="title"]/text()="Scope Variables"]');
- var expectedScopes = [
- {
- title: "Local",
- properties: {
- x:"2009",
- innerFunctionLocalVar:"2011",
- "this": "DOMWindow",
- }
- },
- {
- title: "Closure",
- properties: {
- n: '"TextParam"',
- makeClosureLocalVar: '"local.TextParam"',
- }
- },
- {
- title: "Global",
- },
- ];
- var it = test._nodeIterator('./div[@class="body"]/div', scopeVariablesSection);
- var scopeIndex = 0;
- var scopeDiv;
- while (scopeDiv = it.iterateNext()) {
- test.assertTrue(scopeIndex < expectedScopes.length, "Too many scopes.");
- test._checkScopeSectionDiv(scopeDiv, expectedScopes[scopeIndex]);
- ++scopeIndex;
- }
- test.assertEquals(expectedScopes.length, scopeIndex, "Unexpected number of scopes.");
-
- test.releaseControl();
- }
-
- test.takeControl();
-};
-
-
-/**
- * Returns child tree element for a property with given name.
- * @param {TreeElement} parent Parent tree element.
- * @param {string} childName
- * @param {string} objectPath Path to the object. Will be printed in the case
- * of failure.
- * @return {TreeElement}
- */
-TestSuite.prototype._findChildProperty = function(parent, childName, objectPath)
-{
- var children = parent.children;
- for (var i = 0; i < children.length; i++) {
- var treeElement = children[i];
- var property = treeElement.property;
- if (property.name === childName)
- return treeElement;
- }
- this.fail('Cannot find property "' + childName + '" in ' + objectPath);
-};
-
-
-/**
* Executes the 'code' with InjectedScriptAccess.getProperties overriden
* so that all callbacks passed to InjectedScriptAccess.getProperties are
* extended with the "hook".