diff options
Diffstat (limited to 'Source/WebKit/chromium/src')
-rw-r--r-- | Source/WebKit/chromium/src/AssertMatchingEnums.cpp | 4 | ||||
-rw-r--r-- | Source/WebKit/chromium/src/DragClientImpl.cpp | 8 | ||||
-rw-r--r-- | Source/WebKit/chromium/src/IDBTransactionBackendProxy.cpp | 18 | ||||
-rw-r--r-- | Source/WebKit/chromium/src/IDBTransactionBackendProxy.h | 9 | ||||
-rw-r--r-- | Source/WebKit/chromium/src/PlatformSupport.cpp | 27 | ||||
-rw-r--r-- | Source/WebKit/chromium/src/WebBindings.cpp | 10 | ||||
-rw-r--r-- | Source/WebKit/chromium/src/WebFrameImpl.cpp | 4 | ||||
-rw-r--r-- | Source/WebKit/chromium/src/WebIDBMetadata.cpp | 3 | ||||
-rwxr-xr-x | Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp | 17 | ||||
-rw-r--r-- | Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h | 1 | ||||
-rw-r--r-- | Source/WebKit/chromium/src/WebInputElement.cpp | 2 | ||||
-rw-r--r-- | Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp | 105 | ||||
-rw-r--r-- | Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.h | 66 | ||||
-rw-r--r-- | Source/WebKit/chromium/src/WebViewImpl.cpp | 63 | ||||
-rw-r--r-- | Source/WebKit/chromium/src/WebViewImpl.h | 13 | ||||
-rw-r--r-- | Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm | 14 |
16 files changed, 285 insertions, 79 deletions
diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index 0f8442a76..789d1b623 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -53,6 +53,7 @@ #include "IDBFactoryBackendInterface.h" #include "IDBKey.h" #include "IDBKeyPath.h" +#include "IDBMetadata.h" #include "IceOptions.h" #include "IconURL.h" #include "MediaPlayer.h" @@ -87,6 +88,7 @@ #include "WebIDBFactory.h" #include "WebIDBKey.h" #include "WebIDBKeyPath.h" +#include "WebIDBMetadata.h" #include "WebIconURL.h" #include "WebInputElement.h" #include "WebMediaPlayer.h" @@ -461,6 +463,8 @@ COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::NumberType, IDBKey::NumberType); COMPILE_ASSERT_MATCHING_ENUM(WebIDBKeyPath::NullType, IDBKeyPath::NullType); COMPILE_ASSERT_MATCHING_ENUM(WebIDBKeyPath::StringType, IDBKeyPath::StringType); COMPILE_ASSERT_MATCHING_ENUM(WebIDBKeyPath::ArrayType, IDBKeyPath::ArrayType); + +COMPILE_ASSERT_MATCHING_ENUM(WebIDBMetadata::NoIntVersion, IDBDatabaseMetadata::NoIntVersion); #endif #if ENABLE(FILE_SYSTEM) diff --git a/Source/WebKit/chromium/src/DragClientImpl.cpp b/Source/WebKit/chromium/src/DragClientImpl.cpp index a6fb0bd33..3974e7ad3 100644 --- a/Source/WebKit/chromium/src/DragClientImpl.cpp +++ b/Source/WebKit/chromium/src/DragClientImpl.cpp @@ -87,7 +87,13 @@ void DragClientImpl::startDrag(DragImageRef dragImage, IntSize offsetSize(eventPos - dragImageOrigin); WebPoint offsetPoint(offsetSize.width(), offsetSize.height()); - m_webView->startDragging(frame, dragData, static_cast<WebDragOperationsMask>(dragOperationMask), dragImage ? WebImage(*dragImage) : WebImage(), offsetPoint); + + if (dragImage && dragImage->bitmap && m_webView->deviceScaleFactor() != dragImage->resolutionScale) { + ASSERT(dragImage->resolutionScale > 0); + float scale = m_webView->deviceScaleFactor() / dragImage->resolutionScale; + dragImage = scaleDragImage(dragImage, WebCore::FloatSize(scale, scale)); + } + m_webView->startDragging(frame, dragData, static_cast<WebDragOperationsMask>(dragOperationMask), (dragImage && dragImage->bitmap) ? WebImage(*dragImage->bitmap) : WebImage(), offsetPoint); } void DragClientImpl::dragControllerDestroyed() diff --git a/Source/WebKit/chromium/src/IDBTransactionBackendProxy.cpp b/Source/WebKit/chromium/src/IDBTransactionBackendProxy.cpp index 3a21a781b..88f9852ac 100644 --- a/Source/WebKit/chromium/src/IDBTransactionBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBTransactionBackendProxy.cpp @@ -72,24 +72,6 @@ void IDBTransactionBackendProxy::abort() m_webIDBTransaction->abort(); } -void IDBTransactionBackendProxy::registerOpenCursor(WebCore::IDBCursorBackendImpl*) -{ - ASSERT_NOT_REACHED(); -} - -void IDBTransactionBackendProxy::unregisterOpenCursor(WebCore::IDBCursorBackendImpl*) -{ - ASSERT_NOT_REACHED(); -} - -bool IDBTransactionBackendProxy::scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>, PassOwnPtr<ScriptExecutionContext::Task>) -{ - // This should never be reached as it's the impl objects who get to - // execute tasks in the browser process. - ASSERT_NOT_REACHED(); - return false; -} - void IDBTransactionBackendProxy::didCompleteTaskEvents() { m_webIDBTransaction->didCompleteTaskEvents(); diff --git a/Source/WebKit/chromium/src/IDBTransactionBackendProxy.h b/Source/WebKit/chromium/src/IDBTransactionBackendProxy.h index 58918f68c..7e7486bd7 100644 --- a/Source/WebKit/chromium/src/IDBTransactionBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBTransactionBackendProxy.h @@ -42,19 +42,10 @@ public: virtual ~IDBTransactionBackendProxy(); virtual PassRefPtr<WebCore::IDBObjectStoreBackendInterface> objectStore(const String& name, WebCore::ExceptionCode&); - virtual unsigned short mode() const - { - ASSERT_NOT_REACHED(); - return 0; - } virtual void commit(); virtual void abort(); - virtual bool scheduleTask(PassOwnPtr<WebCore::ScriptExecutionContext::Task>, PassOwnPtr<WebCore::ScriptExecutionContext::Task>); virtual void didCompleteTaskEvents(); virtual void setCallbacks(WebCore::IDBTransactionCallbacks*); - virtual void registerOpenCursor(WebCore::IDBCursorBackendImpl*); - virtual void unregisterOpenCursor(WebCore::IDBCursorBackendImpl*); - virtual void addPendingEvents(int) { ASSERT_NOT_REACHED(); } WebIDBTransaction* getWebIDBTransaction() const { return m_webIDBTransaction.get(); } diff --git a/Source/WebKit/chromium/src/PlatformSupport.cpp b/Source/WebKit/chromium/src/PlatformSupport.cpp index 193b68b3a..0afb807e0 100644 --- a/Source/WebKit/chromium/src/PlatformSupport.cpp +++ b/Source/WebKit/chromium/src/PlatformSupport.cpp @@ -276,33 +276,6 @@ void PlatformSupport::getRenderStyleForStrike(const char* font, int sizeAndStyle } #endif -// Databases ------------------------------------------------------------------ - -PlatformFileHandle PlatformSupport::databaseOpenFile(const String& vfsFileName, int desiredFlags) -{ - return webKitPlatformSupport()->databaseOpenFile(WebString(vfsFileName), desiredFlags); -} - -int PlatformSupport::databaseDeleteFile(const String& vfsFileName, bool syncDir) -{ - return webKitPlatformSupport()->databaseDeleteFile(WebString(vfsFileName), syncDir); -} - -long PlatformSupport::databaseGetFileAttributes(const String& vfsFileName) -{ - return webKitPlatformSupport()->databaseGetFileAttributes(WebString(vfsFileName)); -} - -long long PlatformSupport::databaseGetFileSize(const String& vfsFileName) -{ - return webKitPlatformSupport()->databaseGetFileSize(WebString(vfsFileName)); -} - -long long PlatformSupport::databaseGetSpaceAvailableForOrigin(const String& originIdentifier) -{ - return webKitPlatformSupport()->databaseGetSpaceAvailableForOrigin(originIdentifier); -} - // Indexed Database ----------------------------------------------------------- PassRefPtr<IDBFactoryBackendInterface> PlatformSupport::idbFactory() diff --git a/Source/WebKit/chromium/src/WebBindings.cpp b/Source/WebKit/chromium/src/WebBindings.cpp index b9bbd5d37..926db3b11 100644 --- a/Source/WebKit/chromium/src/WebBindings.cpp +++ b/Source/WebKit/chromium/src/WebBindings.cpp @@ -210,8 +210,6 @@ static bool getRangeImpl(NPObject* object, WebRange* webRange) V8NPObject* v8NPObject = reinterpret_cast<V8NPObject*>(object); v8::Handle<v8::Object> v8Object(v8NPObject->v8Object); - if (v8Object.IsEmpty()) - return false; if (!V8Range::info.equals(V8DOMWrapper::domWrapperType(v8Object))) return false; @@ -245,8 +243,6 @@ static bool getElementImpl(NPObject* object, WebElement* webElement) V8NPObject* v8NPObject = reinterpret_cast<V8NPObject*>(object); v8::Handle<v8::Object> v8Object(v8NPObject->v8Object); - if (v8Object.IsEmpty()) - return false; Element* native = V8Element::HasInstance(v8Object) ? V8Element::toNative(v8Object) : 0; if (!native) return false; @@ -262,8 +258,6 @@ static bool getArrayBufferImpl(NPObject* object, WebArrayBuffer* arrayBuffer) V8NPObject* v8NPObject = reinterpret_cast<V8NPObject*>(object); v8::Handle<v8::Object> v8Object(v8NPObject->v8Object); - if (v8Object.IsEmpty()) - return false; ArrayBuffer* native = V8ArrayBuffer::HasInstance(v8Object) ? V8ArrayBuffer::toNative(v8Object) : 0; if (!native) return false; @@ -279,8 +273,6 @@ static bool getArrayBufferViewImpl(NPObject* object, WebArrayBufferView* arrayBu V8NPObject* v8NPObject = reinterpret_cast<V8NPObject*>(object); v8::Handle<v8::Object> v8Object(v8NPObject->v8Object); - if (v8Object.IsEmpty()) - return false; ArrayBufferView* native = V8ArrayBufferView::HasInstance(v8Object) ? V8ArrayBufferView::toNative(v8Object) : 0; if (!native) return false; @@ -406,8 +398,6 @@ v8::Handle<v8::Value> WebBindings::toV8Value(const NPVariant* variant) if (object->_class != npScriptObjectClass) return v8::Undefined(); V8NPObject* v8Object = reinterpret_cast<V8NPObject*>(object); - if (v8Object->v8Object.IsEmpty()) - return v8::Undefined(); return convertNPVariantToV8Object(variant, v8Object->rootObject->frame()->script()->windowScriptNPObject()); } // Safe to pass 0 since we have checked the script object class to make sure the diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index 89189eea2..0cfbac209 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -1529,6 +1529,7 @@ float WebFrameImpl::getPrintPageShrink(int page) float WebFrameImpl::printPage(int page, WebCanvas* canvas) { +#if ENABLE(PRINTING) // Ensure correct state. if (!m_printContext || page < 0 || !frame() || !frame()->document()) { ASSERT_NOT_REACHED(); @@ -1540,6 +1541,9 @@ float WebFrameImpl::printPage(int page, WebCanvas* canvas) gc.platformContext()->setPrinting(true); return m_printContext->spoolPage(gc, page); +#else + return 0; +#endif } void WebFrameImpl::printEnd() diff --git a/Source/WebKit/chromium/src/WebIDBMetadata.cpp b/Source/WebKit/chromium/src/WebIDBMetadata.cpp index 735063ef0..01d878a0a 100644 --- a/Source/WebKit/chromium/src/WebIDBMetadata.cpp +++ b/Source/WebKit/chromium/src/WebIDBMetadata.cpp @@ -41,6 +41,7 @@ WebIDBMetadata::WebIDBMetadata(const WebCore::IDBDatabaseMetadata& metadata) { name = metadata.name; version = metadata.version; + intVersion = metadata.intVersion; objectStores = WebVector<ObjectStore>(static_cast<size_t>(metadata.objectStores.size())); size_t i = 0; @@ -68,7 +69,7 @@ WebIDBMetadata::WebIDBMetadata(const WebCore::IDBDatabaseMetadata& metadata) WebIDBMetadata::operator IDBDatabaseMetadata() const { - IDBDatabaseMetadata db(name, version); + IDBDatabaseMetadata db(name, version, intVersion); for (size_t i = 0; i < objectStores.size(); ++i) { const ObjectStore webObjectStore = objectStores[i]; IDBObjectStoreMetadata objectStore(webObjectStore.name, webObjectStore.keyPath, webObjectStore.autoIncrement); diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp index 9bac6d3c3..53d140f42 100755 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp @@ -63,6 +63,23 @@ void WebIDBObjectStoreImpl::put(const WebSerializedScriptValue& value, const Web m_objectStore->put(value, key, static_cast<IDBObjectStoreBackendInterface::PutMode>(putMode), IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec); } +void WebIDBObjectStoreImpl::putWithIndexKeys(const WebSerializedScriptValue& value, const WebIDBKey& key, PutMode putMode, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, const WebVector<WebString>& webIndexNames, const WebVector<WebIndexKeys>& webIndexKeys, WebExceptionCode& ec) +{ + ASSERT(webIndexNames.size() == webIndexKeys.size()); + Vector<String> indexNames(webIndexNames.size()); + Vector<IDBObjectStoreBackendInterface::IndexKeys> indexKeys(webIndexKeys.size()); + + for (size_t i = 0; i < webIndexNames.size(); ++i) { + indexNames[i] = webIndexNames[i]; + Vector<RefPtr<IDBKey> > indexKeyList(webIndexKeys[i].size()); + for (size_t j = 0; j < webIndexKeys[i].size(); ++j) + indexKeyList[j] = webIndexKeys[i][j]; + indexKeys[i] = indexKeyList; + } + + m_objectStore->putWithIndexKeys(value, key, static_cast<IDBObjectStoreBackendInterface::PutMode>(putMode), IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), indexNames, indexKeys, ec); +} + void WebIDBObjectStoreImpl::deleteFunction(const WebIDBKeyRange& keyRange, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec) { m_objectStore->deleteFunction(keyRange, IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec); diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h index 5a881b592..e6dc88f54 100644 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h @@ -47,6 +47,7 @@ public: void get(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); void put(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); + void putWithIndexKeys(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, const WebVector<WebString>& indexNames, const WebVector<WebIndexKeys>&, WebExceptionCode&); void deleteFunction(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); void clear(WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); diff --git a/Source/WebKit/chromium/src/WebInputElement.cpp b/Source/WebKit/chromium/src/WebInputElement.cpp index c1453de66..791b2ebff 100644 --- a/Source/WebKit/chromium/src/WebInputElement.cpp +++ b/Source/WebKit/chromium/src/WebInputElement.cpp @@ -175,7 +175,7 @@ bool WebInputElement::isMultiple() const WebNodeCollection WebInputElement::dataListOptions() const { -#if ENABLE(DATALIST) +#if ENABLE(DATALIST_ELEMENT) HTMLDataListElement* dataList = static_cast<HTMLDataListElement*>(constUnwrap<HTMLInputElement>()->list()); if (dataList) return WebNodeCollection(dataList->options()); diff --git a/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp b/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp new file mode 100644 index 000000000..2b11f6eb6 --- /dev/null +++ b/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2012 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. + * + * 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 "WebViewBenchmarkSupportImpl.h" + +#include "FloatSize.h" +#include "FrameView.h" +#include "GraphicsLayer.h" +#include "IntRect.h" +#include "IntSize.h" +#include "WebViewImpl.h" +#include "painting/GraphicsContextBuilder.h" + +#include <public/WebCanvas.h> +#include <wtf/CurrentTime.h> +#include <wtf/OwnPtr.h> +#include <wtf/Vector.h> + +using namespace WebCore; + +namespace WebKit { + +void WebViewBenchmarkSupportImpl::paintLayer(PaintClient* paintClient, GraphicsLayer& layer, const IntRect& clip) +{ + WebSize canvasSize(clip.width(), clip.height()); + OwnPtr<WebCanvas> canvas = adoptPtr(paintClient->createCanvas(canvasSize)); + GraphicsContextBuilder builder(canvas.get()); + + paintClient->willPaint(*canvas.get()); + layer.paintGraphicsLayerContents(builder.context(), clip); + paintClient->didPaint(*canvas.get()); +} + +void WebViewBenchmarkSupportImpl::acceleratedPaintUnclipped(PaintClient* paintClient, GraphicsLayer& layer) +{ + FloatSize layerSize = layer.size(); + IntRect clip(0, 0, layerSize.width(), layerSize.height()); + + paintLayer(paintClient, layer, clip); + + const Vector<GraphicsLayer*>& children = layer.children(); + Vector<GraphicsLayer*>::const_iterator it; + for (it = children.begin(); it != children.end(); ++it) + acceleratedPaintUnclipped(paintClient, **it); +} + +void WebViewBenchmarkSupportImpl::softwarePaint(PaintClient* paintClient, PaintMode paintMode) +{ + WebSize size = m_webViewImpl->size(); + WebRect paintSize; + switch (paintMode) { + case PaintModeEverything: + if (m_webViewImpl->page() && m_webViewImpl->page()->mainFrame()) { + FrameView* view = m_webViewImpl->page()->mainFrame()->view(); + IntSize contentsSize = view->contentsSize(); + paintSize = WebRect(0, 0, contentsSize.width(), contentsSize.height()); + } else + paintSize = WebRect(0, 0, size.width, size.height); + break; + } + + WebSize canvasSize(paintSize.width, paintSize.height); + OwnPtr<WebCanvas> canvas = adoptPtr(paintClient->createCanvas(canvasSize)); + paintClient->willPaint(*canvas.get()); + m_webViewImpl->paint(canvas.get(), paintSize); + paintClient->didPaint(*canvas.get()); +} + +void WebViewBenchmarkSupportImpl::paint(PaintClient* paintClient, PaintMode paintMode) +{ + m_webViewImpl->layout(); + if (!m_webViewImpl->isAcceleratedCompositingActive()) + return softwarePaint(paintClient, paintMode); + GraphicsLayer* layer = m_webViewImpl->rootGraphicsLayer(); + switch (paintMode) { + case PaintModeEverything: + acceleratedPaintUnclipped(paintClient, *layer); + break; + } +} +} diff --git a/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.h b/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.h new file mode 100644 index 000000000..9a612cd64 --- /dev/null +++ b/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2012 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. + */ + +#ifndef WebViewBenchmarkSupportImpl_h +#define WebViewBenchmarkSupportImpl_h + +#include "WebViewBenchmarkSupport.h" + +namespace WebCore { +class IntRect; +class GraphicsLayer; +} + +namespace WebKit { +class WebViewImpl; + +class WebViewBenchmarkSupportImpl : public WebViewBenchmarkSupport { +public: + explicit WebViewBenchmarkSupportImpl(WebViewImpl* webViewImpl) : m_webViewImpl(webViewImpl) { } + virtual ~WebViewBenchmarkSupportImpl() { } + + // Paints the WebViewImpl onto canvases created from the PaintClient. + // If we're in accelerated mode, a new canvas is created for each graphics + // layer. Layout() will be called on the web view prior to painting. + virtual void paint(PaintClient*, PaintMode) OVERRIDE; + +private: + void paintLayer(PaintClient*, WebCore::GraphicsLayer&, const WebCore::IntRect& clip); + + // Paints the given graphics layer hierarchy to canvases created by the + // canvas factory. + void acceleratedPaintUnclipped(PaintClient*, WebCore::GraphicsLayer&); + void softwarePaint(PaintClient*, PaintMode); + + WebViewImpl* m_webViewImpl; +}; +} + +#endif // WebViewBenchmarkSupportImpl_h diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index e349151fa..0d5f25a51 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -195,6 +195,8 @@ static const int touchPointPadding = 32; static const float minScaleDifference = 0.01f; static const float doubleTapZoomContentDefaultMargin = 5; static const float doubleTapZoomContentMinimumMargin = 2; +static const double doubleTabZoomAnimationDurationInSeconds = 0.25; + namespace WebKit { @@ -405,6 +407,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) , m_tabsToLinks(false) , m_dragScrollTimer(adoptPtr(new DragScrollTimer)) , m_isCancelingFullScreen(false) + , m_benchmarkSupport(this) #if USE(ACCELERATED_COMPOSITING) , m_rootGraphicsLayer(0) , m_isAcceleratedCompositingActive(false) @@ -745,13 +748,18 @@ void WebViewImpl::renderingStats(WebRenderingStats& stats) const m_layerTreeView.renderingStats(stats); } -void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor, float newScale, double durationSec) +void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor, float newScale, double durationInSeconds) { if (!m_layerTreeView.isNull()) - m_layerTreeView.startPageScaleAnimation(scroll, useAnchor, newScale, durationSec); + m_layerTreeView.startPageScaleAnimation(scroll, useAnchor, newScale, durationInSeconds); } #endif +WebViewBenchmarkSupport* WebViewImpl::benchmarkSupport() +{ + return &m_benchmarkSupport; +} + bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event) { ASSERT((event.type == WebInputEvent::RawKeyDown) @@ -1073,6 +1081,27 @@ void WebViewImpl::computeScaleAndScrollForHitRect(const WebRect& hitRect, AutoZo } #endif +void WebViewImpl::animateZoomAroundPoint(const IntPoint& point, AutoZoomType zoomType) +{ +#if ENABLE(GESTURE_EVENTS) + if (!mainFrameImpl()) + return; + + float scale; + WebPoint scroll; + computeScaleAndScrollForHitRect(WebRect(point.x(), point.y(), 0, 0), zoomType, scale, scroll); + + bool isDoubleTap = (zoomType == DoubleTap); + double durationInSeconds = isDoubleTap ? doubleTabZoomAnimationDurationInSeconds : 0; + startPageScaleAnimation(scroll, isDoubleTap, scale, durationInSeconds); +#endif +} + +void WebViewImpl::zoomToFindInPageRect(const WebRect& rect) +{ + animateZoomAroundPoint(IntRect(rect).center(), FindInPage); +} + void WebViewImpl::numberOfWheelEventHandlersChanged(unsigned numberOfWheelHandlers) { if (m_client) @@ -2148,6 +2177,25 @@ bool WebViewImpl::setEditableSelectionOffsets(int start, int end) return editor->setSelectionOffsets(start, end); } +bool WebViewImpl::isSelectionEditable() const +{ + const Frame* frame = focusedWebCoreFrame(); + if (!frame) + return false; + return frame->selection()->isContentEditable(); +} + +WebColor WebViewImpl::backgroundColor() const +{ + if (!m_page) + return Color::white; + FrameView* view = m_page->mainFrame()->view(); + Color backgroundColor = view->documentBackgroundColor(); + if (!backgroundColor.isValid()) + return Color::white; + return backgroundColor.rgb(); +} + bool WebViewImpl::caretOrSelectionRange(size_t* location, size_t* length) { const Frame* focused = focusedWebCoreFrame(); @@ -3459,6 +3507,11 @@ void WebViewImpl::setBackgroundColor(const WebCore::Color& color) m_layerTreeView.setBackgroundColor(webDocumentBackgroundColor); } +WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer() +{ + return m_rootGraphicsLayer; +} + #if ENABLE(REQUEST_ANIMATION_FRAME) void WebViewImpl::scheduleAnimation() { @@ -3697,6 +3750,12 @@ WebGraphicsContext3D* WebViewImpl::sharedGraphicsContext3D() return GraphicsContext3DPrivate::extractWebGraphicsContext3D(SharedGraphicsContext3D::get().get()); } +void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex) +{ + if (m_autofillPopupClient && listIndex < m_autofillPopupClient->getSuggestionsCount()) + m_autofillPopupClient->valueChanged(listIndex); +} + void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, bool isInitialState) { if (!page()) diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index 8f6bdf40b..c2f36bf45 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -56,6 +56,7 @@ #include "PageWidgetDelegate.h" #include "PlatformGestureCurveTarget.h" #include "UserMediaClientImpl.h" +#include "WebViewBenchmarkSupportImpl.h" #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> @@ -106,6 +107,7 @@ class WebFrameImpl; class WebGestureEvent; class WebPagePopupImpl; class WebPrerendererClient; +class WebViewBenchmarkSupport; class WebImage; class WebKeyboardEvent; class WebMouseEvent; @@ -159,6 +161,8 @@ public: virtual WebTextInputInfo textInputInfo(); virtual WebTextInputType textInputType(); virtual bool setEditableSelectionOffsets(int start, int end); + virtual bool isSelectionEditable() const; + virtual WebColor backgroundColor() const; virtual bool selectionBounds(WebRect& start, WebRect& end) const; virtual bool selectionTextDirection(WebTextDirection& start, WebTextDirection& end) const; virtual bool caretOrSelectionRange(size_t* location, size_t* length); @@ -203,6 +207,7 @@ public: virtual void clearFocusedNode(); virtual void scrollFocusedNodeIntoView(); virtual void scrollFocusedNodeIntoRect(const WebRect&); + virtual void zoomToFindInPageRect(const WebRect&); virtual void advanceFocus(bool reverse); virtual double zoomLevel(); virtual double setZoomLevel(bool textOnly, double zoomLevel); @@ -276,6 +281,7 @@ public: const WebVector<int>& itemIDs, int separatorIndex); virtual void hidePopups(); + virtual void selectAutofillSuggestionAtIndex(unsigned listIndex); virtual void setScrollbarColors(unsigned inactiveColor, unsigned activeColor, unsigned trackColor); @@ -291,6 +297,7 @@ public: #endif virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&); virtual void renderingStats(WebRenderingStats&) const; + virtual WebViewBenchmarkSupport* benchmarkSupport(); // WebLayerTreeViewClient virtual void willBeginFrame(); @@ -373,7 +380,7 @@ public: // Event related methods: void mouseContextMenu(const WebMouseEvent&); void mouseDoubleClick(const WebMouseEvent&); - void startPageScaleAnimation(const WebCore::IntPoint& targetPosition, bool useAnchor, float newScale, double durationSec); + void startPageScaleAnimation(const WebCore::IntPoint& targetPosition, bool useAnchor, float newScale, double durationInSeconds); void numberOfWheelEventHandlersChanged(unsigned); void numberOfTouchEventHandlersChanged(unsigned); @@ -503,6 +510,7 @@ public: return m_currentInputEvent; } + WebCore::GraphicsLayer* rootGraphicsLayer(); #if USE(ACCELERATED_COMPOSITING) bool allowsAcceleratedCompositing(); void setRootGraphicsLayer(WebCore::GraphicsLayer*); @@ -544,6 +552,7 @@ public: #if ENABLE(GESTURE_EVENTS) void computeScaleAndScrollForHitRect(const WebRect& hitRect, AutoZoomType, float& scale, WebPoint& scroll); #endif + void animateZoomAroundPoint(const WebCore::IntPoint&, AutoZoomType); void loseCompositorContext(int numTimes); @@ -784,6 +793,8 @@ private: RefPtr<WebCore::Frame> m_fullScreenFrame; bool m_isCancelingFullScreen; + WebViewBenchmarkSupportImpl m_benchmarkSupport; + #if USE(ACCELERATED_COMPOSITING) WebCore::IntRect m_rootLayerScrollDamage; OwnPtr<NonCompositedContentHost> m_nonCompositedContentHost; diff --git a/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm b/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm index 88c3b72e5..f246bcf2c 100644 --- a/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm +++ b/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm @@ -91,7 +91,7 @@ static float deviceScaleFactor(NSView* view) WebScreenInfo WebScreenInfoFactory::screenInfo(NSView* view) { - NSString *colorSpace = NSColorSpaceFromDepth([[NSScreen deepestScreen] depth]); + NSScreen* screen = [NSScreen deepestScreen]; WebScreenInfo results; @@ -99,14 +99,10 @@ WebScreenInfo WebScreenInfoFactory::screenInfo(NSView* view) results.horizontalDPI = deviceDPI; results.verticalDPI = deviceDPI; - results.depth = - NSBitsPerPixelFromDepth([[NSScreen deepestScreen] depth]); - results.depthPerComponent = - NSBitsPerSampleFromDepth([[NSScreen deepestScreen] depth]); - results.isMonochrome = colorSpace == NSCalibratedWhiteColorSpace - || colorSpace == NSCalibratedBlackColorSpace - || colorSpace == NSDeviceWhiteColorSpace - || colorSpace == NSDeviceBlackColorSpace; + results.depth = NSBitsPerPixelFromDepth([screen depth]); + results.depthPerComponent = NSBitsPerSampleFromDepth([screen depth]); + results.isMonochrome = + [[screen colorSpace] colorSpaceModel] == NSGrayColorSpaceModel; results.rect = convertRect([screenForWindow([view window]) frame], [view window]); results.availableRect = convertRect([screenForWindow([view window]) visibleFrame], [view window]); |