diff options
Diffstat (limited to 'Source/WebKit')
77 files changed, 2693 insertions, 1283 deletions
diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index c50c39829..7eb7e5904 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -6445,5 +6445,10 @@ void WebPagePrivate::restoreHistoryViewState(Platform::IntSize contentsSize, Pla } } +IntSize WebPagePrivate::screenSize() const +{ + return Platform::Graphics::Screen::primaryScreen()->size(); +} + } } diff --git a/Source/WebKit/blackberry/Api/WebPage_p.h b/Source/WebKit/blackberry/Api/WebPage_p.h index 2ee4d6a04..a005d81b6 100644 --- a/Source/WebKit/blackberry/Api/WebPage_p.h +++ b/Source/WebKit/blackberry/Api/WebPage_p.h @@ -462,6 +462,8 @@ public: void applySizeOverride(int overrideWidth, int overrideHeight); void setTextZoomFactor(float); + WebCore::IntSize screenSize() const; + WebPage* m_webPage; WebPageClient* m_client; WebCore::InspectorClientBlackBerry* m_inspectorClient; diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index 0db79e222..1059181c0 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,30 @@ +2012-08-22 Crystal Zhang <haizhang@rim.com> + + [BlackBerry] Make all pickers non-zoomable + https://bugs.webkit.org/show_bug.cgi?id=94729 + + Reviewed by Antonio Gomes. + + Move HTML header initialization to PagePopupBlackBerry as that part are all the same, and make all pickers non-zoomable. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::screenSize): + (WebKit): + * Api/WebPage_p.h: + (WebPagePrivate): + * WebCoreSupport/DatePickerClient.cpp: + (WebCore::DatePickerClient::generateHTML): + (WebCore::DatePickerClient::writeDocument): + * WebCoreSupport/PagePopupBlackBerry.cpp: + (WebCore::PagePopupBlackBerry::init): + (WebCore::PagePopupBlackBerry::generateHTML): + (WebCore): + * WebCoreSupport/PagePopupBlackBerry.h: + (PagePopupBlackBerry): + * WebCoreSupport/SelectPopupClient.cpp: + (WebCore::SelectPopupClient::generateHTML): + (WebCore::SelectPopupClient::writeDocument): + 2012-08-21 Benjamin C Meyer <bmeyer@rim.com> [BlackBerry] Add option to only add JavaScript object 'qnx' to private webviews diff --git a/Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.cpp b/Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.cpp index d70dc4fbe..93f7fda26 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.cpp @@ -50,7 +50,7 @@ DatePickerClient::~DatePickerClient() void DatePickerClient::generateHTML(BlackBerry::Platform::BlackBerryInputType type, const BlackBerry::WebKit::WebString& value, const BlackBerry::WebKit::WebString& min, const BlackBerry::WebKit::WebString& max, double step) { StringBuilder source; - source.append("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/><style>\n"); + source.append("<style>\n"); // Include CSS file. source.append(popupControlBlackBerryCss, sizeof(popupControlBlackBerryCss)); @@ -134,9 +134,6 @@ void DatePickerClient::didClosePopup() void DatePickerClient::writeDocument(DocumentWriter& writer) { - writer.setMIMEType("text/html"); - writer.begin(KURL()); writer.addData(m_source.utf8().data(), m_source.utf8().length()); - writer.end(); } } diff --git a/Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.cpp index 5141a890b..402b52333 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.cpp @@ -40,6 +40,7 @@ // Fixme: should get the height from runtime. #define URL_BAR_HEIGHT 70 +#define PADDING 80 using namespace BlackBerry::Platform::Graphics; using namespace BlackBerry::WebKit; @@ -63,14 +64,32 @@ bool PagePopupBlackBerry::sendCreatePopupWebViewRequest() bool PagePopupBlackBerry::init(WebPage* webpage) { - DocumentWriter* writer = webpage->d->mainFrame()->loader()->activeDocumentLoader()->writer(); - m_client->writeDocument(*writer); + generateHTML(webpage); installDomFunction(webpage->d->mainFrame()); return true; } +void PagePopupBlackBerry::generateHTML(WebPage* webpage) +{ + DocumentWriter* writer = webpage->d->mainFrame()->loader()->activeDocumentLoader()->writer(); + writer->setMIMEType("text/html"); + writer->begin(KURL()); + + // All the popups have the same html head and the page content should be non-zoomable. + StringBuilder source; + // FIXME: the hardcoding padding will be removed soon. + int screenWidth = webpage->d->screenSize().width() - PADDING; + source.append("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>\n"); + source.append("<meta name=\"viewport\" content=\"width=" + String::number(screenWidth)); + source.append("; user-scalable=no\" />\n"); + writer->addData(source.toString().utf8().data(), source.toString().utf8().length()); + + m_client->writeDocument(*writer); + writer->end(); +} + static JSValueRef setValueAndClosePopupCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t argumentCount, const JSValueRef arguments[], JSValueRef*) diff --git a/Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.h index c82e8c6b6..5d71e4c90 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.h +++ b/Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.h @@ -46,6 +46,7 @@ public: void closePopup(); void installDomFunction(Frame*); void setRect(); + void generateHTML(BlackBerry::WebKit::WebPage*); private: BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate; diff --git a/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp b/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp index 4b69bd6d3..138a6718f 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp @@ -66,7 +66,7 @@ void SelectPopupClient::generateHTML(bool multiple, int size, const ScopeArray<B const int* itemType, bool* selecteds) { StringBuilder source; - source.append("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/><style>\n"); + source.append("<style>\n"); // Include CSS file. source.append(popupControlBlackBerryCss, sizeof(popupControlBlackBerryCss)); @@ -188,10 +188,7 @@ void SelectPopupClient::didClosePopup() void SelectPopupClient::writeDocument(DocumentWriter& writer) { - writer.setMIMEType("text/html"); - writer.begin(KURL()); writer.addData(m_source.utf8().data(), m_source.utf8().length()); - writer.end(); } void SelectPopupClient::notifySelectionChange(WebCore::Timer<SelectPopupClient>*) diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index 7804ecd97..41b2bb936 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,525 @@ +2012-08-22 Alec Flett <alecflett@chromium.org> + + IndexedDB: tests for injection/extraction of idb keys + https://bugs.webkit.org/show_bug.cgi?id=94653 + + Reviewed by Tony Chang. + + Added unit tests for key injection/extraction using + SerializedScriptValue. These were moved from chromium, now + that all uses of the API are through WebKit. + + * tests/IDBKeyPathTest.cpp: + (WebCore): + (WebCore::TEST): + +2012-08-22 James Robinson <jamesr@chromium.org> + + [chromium] Change WebLayer from a concrete type to a pure virtual interface + https://bugs.webkit.org/show_bug.cgi?id=94174 + + Reviewed by Adrienne Walker. + + This updates the implementation of the Web*Layer family to the new design and updates callers in WebViewImpl / + NonCompositedContentHost / LinkHighlight. + + * WebKit.gypi: + * src/LinkHighlight.cpp: + (WebKit::LinkHighlight::LinkHighlight): + (WebKit::LinkHighlight::contentLayer): + (WebKit::LinkHighlight::clipLayer): + (WebKit::LinkHighlight::releaseResources): + (WebKit::LinkHighlight::computeHighlightLayerPathAndPosition): + (WebKit::LinkHighlight::startHighlightAnimation): + (WebKit::LinkHighlight::updateGeometry): + * src/LinkHighlight.h: + (LinkHighlight): + * src/NonCompositedContentHost.cpp: + (WebKit::NonCompositedContentHost::NonCompositedContentHost): + (WebKit::NonCompositedContentHost::setScrollLayer): + (WebKit::NonCompositedContentHost::setViewport): + (WebKit::NonCompositedContentHost::scrollLayer): + * src/NonCompositedContentHost.h: + * src/WebContentLayer.cpp: Removed. + * src/WebContentLayerImpl.cpp: + (WebKit::WebContentLayer::create): + (WebKit::WebContentLayerImpl::WebContentLayerImpl): + (WebKit::WebContentLayerImpl::~WebContentLayerImpl): + (WebKit::WebContentLayerImpl::layer): + (WebKit): + (WebKit::WebContentLayerImpl::setDoubleSided): + (WebKit::WebContentLayerImpl::setContentsScale): + (WebKit::WebContentLayerImpl::setUseLCDText): + (WebKit::WebContentLayerImpl::setDrawCheckerboardForMissingTiles): + (WebKit::WebContentLayerImpl::paintContents): + * src/WebContentLayerImpl.h: + (WebContentLayerImpl): + * src/WebExternalTextureLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebExternalTextureLayer.cpp. + (WebKit): + (WebKit::WebExternalTextureLayer::create): + (WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl): + (WebKit::WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl): + (WebKit::WebExternalTextureLayerImpl::layer): + (WebKit::WebExternalTextureLayerImpl::setTextureId): + (WebKit::WebExternalTextureLayerImpl::setFlipped): + (WebKit::WebExternalTextureLayerImpl::setUVRect): + (WebKit::WebExternalTextureLayerImpl::setOpaque): + (WebKit::WebExternalTextureLayerImpl::setPremultipliedAlpha): + (WebKit::WebExternalTextureLayerImpl::willModifyTexture): + (WebKit::WebExternalTextureLayerImpl::setRateLimitContext): + (WebTextureUpdaterImpl): + (WebKit::WebTextureUpdaterImpl::WebTextureUpdaterImpl): + (WebKit::WebExternalTextureLayerImpl::prepareTexture): + (WebKit::WebExternalTextureLayerImpl::context): + * src/WebExternalTextureLayerImpl.h: Copied from Source/Platform/chromium/public/WebVideoLayer.h. + (WebKit): + (WebExternalTextureLayerImpl): + * src/WebIOSurfaceLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp. + (WebKit): + (WebKit::WebIOSurfaceLayer::create): + (WebKit::WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl): + (WebKit::WebIOSurfaceLayerImpl::~WebIOSurfaceLayerImpl): + (WebKit::WebIOSurfaceLayerImpl::setIOSurfaceProperties): + (WebKit::WebIOSurfaceLayerImpl::layer): + * src/WebIOSurfaceLayerImpl.h: Copied from Source/Platform/chromium/public/WebImageLayer.h. + (WebCore): + (WebKit): + (WebIOSurfaceLayerImpl): + * src/WebImageLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebSolidColorLayer.cpp. + (WebKit): + (WebKit::WebImageLayer::create): + (WebKit::WebImageLayerImpl::WebImageLayerImpl): + (WebKit::WebImageLayerImpl::~WebImageLayerImpl): + (WebKit::WebImageLayerImpl::layer): + (WebKit::WebImageLayerImpl::setBitmap): + * src/WebImageLayerImpl.h: Renamed from Source/WebKit/chromium/src/WebImageLayer.cpp. + (WebCore): + (WebKit): + (WebImageLayerImpl): + * src/WebLayer.cpp: Removed. + * src/WebLayerImpl.cpp: + (WebKit::WebLayer::create): + (WebKit::WebLayerImpl::WebLayerImpl): + (WebKit::WebLayerImpl::~WebLayerImpl): + (WebKit): + (WebKit::WebLayerImpl::id): + (WebKit::WebLayerImpl::invalidateRect): + (WebKit::WebLayerImpl::invalidate): + (WebKit::WebLayerImpl::addChild): + (WebKit::WebLayerImpl::insertChild): + (WebKit::WebLayerImpl::replaceChild): + (WebKit::WebLayerImpl::setChildren): + (WebKit::WebLayerImpl::removeFromParent): + (WebKit::WebLayerImpl::removeAllChildren): + (WebKit::WebLayerImpl::setAnchorPoint): + (WebKit::WebLayerImpl::anchorPoint): + (WebKit::WebLayerImpl::setAnchorPointZ): + (WebKit::WebLayerImpl::anchorPointZ): + (WebKit::WebLayerImpl::setBounds): + (WebKit::WebLayerImpl::bounds): + (WebKit::WebLayerImpl::setMasksToBounds): + (WebKit::WebLayerImpl::masksToBounds): + (WebKit::WebLayerImpl::setMaskLayer): + (WebKit::WebLayerImpl::setReplicaLayer): + (WebKit::WebLayerImpl::setOpacity): + (WebKit::WebLayerImpl::opacity): + (WebKit::WebLayerImpl::setOpaque): + (WebKit::WebLayerImpl::opaque): + (WebKit::WebLayerImpl::setPosition): + (WebKit::WebLayerImpl::position): + (WebKit::WebLayerImpl::setSublayerTransform): + (WebKit::WebLayerImpl::sublayerTransform): + (WebKit::WebLayerImpl::setTransform): + (WebKit::WebLayerImpl::transform): + (WebKit::WebLayerImpl::setDrawsContent): + (WebKit::WebLayerImpl::drawsContent): + (WebKit::WebLayerImpl::setPreserves3D): + (WebKit::WebLayerImpl::setUseParentBackfaceVisibility): + (WebKit::WebLayerImpl::setBackgroundColor): + (WebKit::WebLayerImpl::setFilters): + (WebKit::WebLayerImpl::setBackgroundFilters): + (WebKit::WebLayerImpl::setDebugBorderColor): + (WebKit::WebLayerImpl::setDebugBorderWidth): + (WebKit::WebLayerImpl::setDebugName): + (WebKit::WebLayerImpl::setAnimationDelegate): + (WebKit::WebLayerImpl::addAnimation): + (WebKit::WebLayerImpl::removeAnimation): + (WebKit::WebLayerImpl::pauseAnimation): + (WebKit::WebLayerImpl::suspendAnimations): + (WebKit::WebLayerImpl::resumeAnimations): + (WebKit::WebLayerImpl::hasActiveAnimation): + (WebKit::WebLayerImpl::transferAnimationsTo): + (WebKit::WebLayerImpl::setForceRenderSurface): + (WebKit::WebLayerImpl::setScrollPosition): + (WebKit::WebLayerImpl::setScrollable): + (WebKit::WebLayerImpl::setHaveWheelEventHandlers): + (WebKit::WebLayerImpl::setShouldScrollOnMainThread): + (WebKit::WebLayerImpl::setNonFastScrollableRegion): + (WebKit::WebLayerImpl::setIsContainerForFixedPositionLayers): + (WebKit::WebLayerImpl::setFixedToContainerLayer): + (WebKit::WebLayerImpl::layer): + * src/WebLayerImpl.h: + (WebCore): + (WebLayerImpl): + * src/WebLayerTreeView.cpp: + (WebKit::WebLayerTreeView::setRootLayer): + * src/WebLayerTreeViewImpl.cpp: + (WebKit::WebLayerTreeViewImpl::create): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::readyStateChanged): + (WebKit::WebMediaPlayerClientImpl::repaint): + (WebKit::WebMediaPlayerClientImpl::setOpaque): + (WebKit::WebMediaPlayerClientImpl::platformLayer): + (WebKit::WebMediaPlayerClientImpl::acceleratedRenderingInUse): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::setBackingTextureId): + (WebKit::WebPluginContainerImpl::setBackingIOSurfaceId): + (WebKit::WebPluginContainerImpl::commitBackingTexture): + (WebKit::WebPluginContainerImpl::setOpaque): + (WebKit::WebPluginContainerImpl::platformLayer): + * src/WebPluginContainerImpl.h: + (WebPluginContainerImpl): + * src/WebScrollableLayer.cpp: Removed. + * src/WebScrollbarLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebScrollbarLayer.cpp. + (WebKit): + (WebKit::WebScrollbarLayer::create): + (WebKit::WebScrollbarLayerImpl::WebScrollbarLayerImpl): + (WebKit::WebScrollbarLayerImpl::~WebScrollbarLayerImpl): + (WebKit::WebScrollbarLayerImpl::layer): + (WebKit::WebScrollbarLayerImpl::setScrollLayer): + * src/WebScrollbarLayerImpl.h: Copied from Source/WebKit/chromium/src/WebSolidColorLayerImpl.h. + (WebCore): + (WebKit): + (WebScrollbarLayerImpl): + * src/WebSolidColorLayerImpl.cpp: + (WebKit::WebSolidColorLayer::create): + (WebKit::WebSolidColorLayerImpl::WebSolidColorLayerImpl): + (WebKit::WebSolidColorLayerImpl::layer): + (WebKit): + (WebKit::WebSolidColorLayerImpl::setBackgroundColor): + * src/WebSolidColorLayerImpl.h: + (WebCore): + (WebKit): + (WebSolidColorLayerImpl): + * src/WebVideoLayerImpl.cpp: Copied from Source/WebKit/chromium/src/WebVideoLayer.cpp. + (WebKit): + (WebKit::WebVideoLayer::create): + (WebKit::WebVideoLayerImpl::WebVideoLayerImpl): + (WebKit::WebVideoLayerImpl::~WebVideoLayerImpl): + (WebKit::WebVideoLayerImpl::layer): + (WebKit::WebVideoLayerImpl::active): + * src/WebVideoLayerImpl.h: Renamed from Source/WebKit/chromium/src/WebVideoLayer.cpp. + (WebCore): + (WebKit): + (WebVideoLayerImpl): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::setRootGraphicsLayer): + (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): + (WebKit): + * src/WebViewImpl.h: + * tests/ImageLayerChromiumTest.cpp: + (WebCore::TEST): + * tests/WebLayerTest.cpp: + * tests/WebLayerTreeViewTest.cpp: + +2012-08-22 Alejandro Piñeiro <apinheiro@igalia.com> + + Dojo toggle buttons should expose ROLE_TOGGLE_BUTTON not ROLE_PUSH_BUTTON + https://bugs.webkit.org/show_bug.cgi?id=73819 + + Reviewed by Chris Fleizach. + + Added a new role, Toggle Button, based on whether aria-pressed is present. + http://www.w3.org/TR/wai-aria/states_and_properties#aria-pressed + + * public/WebAccessibilityRole.h: added WebAccessibilityRoleToggleButton that + matchs with WebCore ToggleButtonRole + * src/AssertMatchingEnums.cpp: added the assert matching rule for + WebAccessibilityRoleToggleButton and ToggleButtonRole + +2012-08-17 Jeffrey Pfau <jpfau@apple.com> + + Allow blocking of Web SQL databases in third-party web workers + https://bugs.webkit.org/show_bug.cgi?id=94170 + + Reviewed by Adam Barth. + + Web workers did not previously know anything about the document that + spawned them. This is undefined for shared workers, but for dedicated + workers, we now pipe the information through. + + + * src/WebWorkerClientImpl.cpp: + (WebKit::WebWorkerClientImpl::startWorkerContext): Pass top document's origin + +2012-08-22 Kentaro Hara <haraken@chromium.org> + + [V8] Move context() from V8Proxy to ScriptController + https://bugs.webkit.org/show_bug.cgi?id=94593 + + Reviewed by Adam Barth. + + To kill V8Proxy, we can move context() from V8Proxy to ScriptController. + + No tests. No change in behavior. + + * src/InspectorFrontendClientImpl.cpp: + (WebKit::InspectorFrontendClientImpl::windowObjectCleared): + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::dispatchOnInspectorFrontend): + +2012-08-22 Nikhil Bhargava <nbhargava@google.com> + + Reduce Font.h includes across project -- improves RenderObject.h compile time + https://bugs.webkit.org/show_bug.cgi?id=93629 + + Reviewed by Eric Seidel. + + Adds includes due to change in RenderStyle.h + + * src/WebFrameImpl.cpp: + * src/mac/WebSubstringUtil.mm: + +2012-08-22 Nikhil Bhargava <nbhargava@google.com> + + Speed up compilation of tests involving WebTransformationMatrix + https://bugs.webkit.org/show_bug.cgi?id=94639 + + Reviewed by James Robinson. + + EXPECT_TRANSFORMATION_MATRIX_EQ was changed to become mainly a function. + As a macro that expanded into 16 other macros, it caused an unneeded + slow down of close to 45s in the compile time of CCLayerTreeHostCommonTest + Bugs have been filed to clang and gcc noting the errant behavior: + http://llvm.org/bugs/show_bug.cgi?id=13651 and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54337 + + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/CCLayerTreeTestCommon.h: + (WebKitTests): + (WebKitTests::ExpectTransformationMatrixEq): + * tests/WebTransformOperationsTest.cpp: + (TEST): + (checkProgress): + * tests/WebTransformationMatrixTest.cpp: + (WebKit::TEST): + +2012-08-22 Alexandre Elias <aelias@google.com> + + [chromium] Add software bitmap resources to CCResourceProvider + https://bugs.webkit.org/show_bug.cgi?id=93677 + + Reviewed by Adrienne Walker. + + Second commit after revert. + + This adds the ability to CCResourceProvider to use software bitmaps. + They are allocated as plain-old-memory, and exposed as Skia objects. + + We want the ResourceProvider to be able to handle different resource + types at the same time. In practice, a default resource type is + desired for most uses within a single compositor instance, which is + specified by the default resource type. Default resource types are + expected to be mostly 1-to-1 with CCRenderer types. + + New tests added by parametrizing existing CCResourceProvider tests. + + * tests/CCResourceProviderTest.cpp: + (WebKit::CCResourceProviderTest::getResourcePixels): + +2012-08-22 W. James MacLean <wjmaclean@chromium.org> + + [chromium] Add touch link highlight animation layers. + https://bugs.webkit.org/show_bug.cgi?id=84487 + + Reviewed by James Robinson. + + Adds support for creating composited touch link highlights in renderer thread. Clipping not yet + implemented for non-composited frames/overflow divs, but scrolling and layout changes are supported. + Transform support currently limited to translation. + + Unit tests for LinkHighlight revised. + + * WebKit.gyp: + * src/LinkHighlight.cpp: Added. + (WebKit): + (WebKit::LinkHighlight::create): + (WebKit::LinkHighlight::LinkHighlight): + (WebKit::LinkHighlight::~LinkHighlight): + (WebKit::LinkHighlight::contentLayer): Accessor for layer containing highlight. + (WebKit::LinkHighlight::clipLayer): Accessor for layer that provides clipping for highlight. + (WebKit::LinkHighlight::releaseResources): Releases Node* for highlight target, clears client/delegate pointers. + (WebKit::LinkHighlight::computeEnclosingCompositingLayer): Determines which GraphicsLayerChromium to attach highlight to. + (WebKit::LinkHighlight::computeHighlightLayerPathAndPosition): Determines coordinates of highlight in owning GraphicsLayerChromium's coordinates. + (WebKit::LinkHighlight::paintContents): If highlight active, paints highlight. + (WebKit::LinkHighlight::startHighlightAnimation): Called to start highlight animation. + (WebKit::LinkHighlight::clearGraphicsLayerLinkHighlightPointer): Removes this LinkHighlight's pointer from owning GraphicsLayerChromium. + (WebKit::LinkHighlight::notifyAnimationStarted): Implements WebAnimationDelegate. + (WebKit::LinkHighlight::notifyAnimationFinished): Implements WebAnimationDelegate, releases resources when animation completes. + (WebKit::LinkHighlight::updateGeometry): Invokes computation of which GraphicsLayerChromium to attach to, and highlight shape & position. + Computations proceed only if preceded by call to invalidate(). + (WebKit::LinkHighlight::clearCurrentGraphicsLayer): Handles notification that current GraphicsLayerChromium* is no longer valid. + (WebKit::LinkHighlight::invalidate): Sets flag to allow geometry update on next call from WebViewImpl::layout(). + (WebKit::LinkHighlight::layer): Exports WebLayer* for use in GraphicsLayerChromium. + * src/LinkHighlight.h: Renamed from Source/WebCore/platform/graphics/chromium/LinkHighlight.h. + (WebCore): + (WebKit): + (LinkHighlight): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleGestureEvent): + (WebKit): + (WebKit::highlightConditions): + (WebKit::WebViewImpl::bestTouchLinkNode): Find highlight target node for touch event location. + (WebKit::WebViewImpl::enableTouchHighlight): Invokes highlight for node at current touch event location. + (WebKit::WebViewImpl::layout): Adds call to LinkHighlight::updateGeometry(). + * src/WebViewImpl.h: + (WebKit): + (WebViewImpl): + (WebKit::WebViewImpl::linkHighlight): + * tests/LinkHighlightTest.cpp: + (WebCore): + (WebCore::TEST): + * tests/data/test_touch_link_highlight.html: Added. + +2012-08-22 Adam Barth <abarth@webkit.org> + + WebWidget should be able to paint into a zoomed canvas without aliasing + https://bugs.webkit.org/show_bug.cgi?id=92043 + + Reviewed by James Robinson. + + If accelerated compositing is enabled, WebWidget::paint reads back from + the compositor rather than re-painting the widget. That approach works + well if the canvas we're rendering into is at a similar resolution to + the pixels in the compositor, but if the canvas has been scaled (e.g., + to help the user disambiguate links), then reading back from the + compositor will cause aliasing artifacts. + + This patch adds an option to paint to let the embedder request a + software re-rendering of the widget to avoid these aliasing artifacts. + + * public/WebWidget.h: + (WebKit::WebWidget::paint): + * src/WebPagePopupImpl.cpp: + (WebKit::WebPagePopupImpl::paint): + * src/WebPagePopupImpl.h: + (WebPagePopupImpl): + * src/WebPopupMenuImpl.cpp: + (WebKit::WebPopupMenuImpl::paint): + * src/WebPopupMenuImpl.h: + * src/WebViewImpl.cpp: + (WebKit::canvasBackgroundForTransparencey): + (WebKit): + (WebKit::WebViewImpl::paint): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-08-22 Eric Penner <epenner@google.com> + + [chromium] Simplify updateContentRect, removing rect parameter, refactor unit tests. + https://bugs.webkit.org/show_bug.cgi?id=94165 + + Reviewed by Adrienne Walker. + + Refactored tests to remove lots of boilerplate code. + + * tests/CCTiledLayerTestCommon.cpp: + * tests/CCTiledLayerTestCommon.h: + (FakeTiledLayerChromium): + * tests/TiledLayerChromiumTest.cpp: + +2012-08-22 Iain Merrick <husky@chromium.org> + + [chromium] Remove WebFrame::setSelectionToRange + https://bugs.webkit.org/show_bug.cgi?id=94685 + + Reviewed by Adam Barth. + + It has basically the same functionality as WebFrame::selectRange. + The calling code was removed in Chromium patch 152608. + + * public/WebFrame.h: + (WebFrame): + * src/WebFrameImpl.cpp: + * src/WebFrameImpl.h: + (WebFrameImpl): + +2012-08-22 Kenneth Russell <kbr@google.com> + + Unreviewed, rolling out r126319. + http://trac.webkit.org/changeset/126319 + https://bugs.webkit.org/show_bug.cgi?id=84487 + + Broke Chromium Mac build + + * WebKit.gyp: + * src/LinkHighlight.cpp: Removed. + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleGestureEvent): + (WebKit::WebViewImpl::computeScaleAndScrollForHitRect): + (WebKit::WebViewImpl::layout): + * src/WebViewImpl.h: + (WebKit): + (WebViewImpl): + * tests/LinkHighlightTest.cpp: + * tests/data/test_touch_link_highlight.html: Removed. + +2012-08-22 W. James MacLean <wjmaclean@chromium.org> + + [chromium] Add touch link highlight animation layers. + https://bugs.webkit.org/show_bug.cgi?id=84487 + + Reviewed by James Robinson. + + Adds support for creating composited touch link highlights in renderer thread. Clipping not yet + implemented for non-composited frames/overflow divs, but scrolling and layout changes are supported. + Transform support currently limited to translation. + + Unit tests for LinkHighlight revised. + + * WebKit.gyp: + * src/LinkHighlight.cpp: Added. + (WebKit): + (WebKit::LinkHighlight::create): + (WebKit::LinkHighlight::LinkHighlight): + (WebKit::LinkHighlight::~LinkHighlight): + (WebKit::LinkHighlight::contentLayer): Accessor for layer containing highlight. + (WebKit::LinkHighlight::clipLayer): Accessor for layer that provides clipping for highlight. + (WebKit::LinkHighlight::releaseResources): Releases Node* for highlight target, clears client/delegate pointers. + (WebKit::LinkHighlight::computeEnclosingCompositingLayer): Determines which GraphicsLayerChromium to attach highlight to. + (WebKit::LinkHighlight::computeHighlightLayerPathAndPosition): Determines coordinates of highlight in owning GraphicsLayerChromium's coordinates. + (WebKit::LinkHighlight::paintContents): If highlight active, paints highlight. + (WebKit::LinkHighlight::startHighlightAnimation): Called to start highlight animation. + (WebKit::LinkHighlight::clearGraphicsLayerLinkHighlightPointer): Removes this LinkHighlight's pointer from owning GraphicsLayerChromium. + (WebKit::LinkHighlight::notifyAnimationStarted): Implements WebAnimationDelegate. + (WebKit::LinkHighlight::notifyAnimationFinished): Implements WebAnimationDelegate, releases resources when animation completes. + (WebKit::LinkHighlight::updateGeometry): Invokes computation of which GraphicsLayerChromium to attach to, and highlight shape & position. + Computations proceed only if preceded by call to invalidate(). + (WebKit::LinkHighlight::clearCurrentGraphicsLayer): Handles notification that current GraphicsLayerChromium* is no longer valid. + (WebKit::LinkHighlight::invalidate): Sets flag to allow geometry update on next call from WebViewImpl::layout(). + (WebKit::LinkHighlight::layer): Exports WebLayer* for use in GraphicsLayerChromium. + * src/LinkHighlight.h: Renamed from Source/WebCore/platform/graphics/chromium/LinkHighlight.h. + (WebCore): + (WebKit): + (LinkHighlight): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleGestureEvent): + (WebKit): + (WebKit::highlightConditions): + (WebKit::WebViewImpl::bestTouchLinkNode): Find highlight target node for touch event location. + (WebKit::WebViewImpl::enableTouchHighlight): Invokes highlight for node at current touch event location. + (WebKit::WebViewImpl::layout): Adds call to LinkHighlight::updateGeometry(). + * src/WebViewImpl.h: + (WebKit): + (WebViewImpl): + (WebKit::WebViewImpl::linkHighlight): + * tests/LinkHighlightTest.cpp: + (WebCore): + (WebCore::TEST): + * tests/data/test_touch_link_highlight.html: Added. + 2012-08-22 Sheriff Bot <webkit.review.bot@gmail.com> Unreviewed. Rolled DEPS. diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp index e226db13a..1a46375fa 100644 --- a/Source/WebKit/chromium/WebKit.gyp +++ b/Source/WebKit/chromium/WebKit.gyp @@ -422,6 +422,8 @@ 'src/InspectorClientImpl.h', 'src/InspectorFrontendClientImpl.cpp', 'src/InspectorFrontendClientImpl.h', + 'src/LinkHighlight.cpp', + 'src/LinkHighlight.h', 'src/NonCompositedContentHost.cpp', 'src/NonCompositedContentHost.h', 'src/PrerendererClientImpl.h', @@ -713,6 +715,7 @@ 'tests/FrameTestHelpers.cpp', 'tests/LevelDBTest.cpp', 'tests/ListenerLeakTest.cpp', + 'tests/LinkHighlightTest.cpp', 'tests/PopupMenuTest.cpp', 'tests/RenderTableCellTest.cpp', 'tests/RenderTableRowTest.cpp', diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index 7fb0c0f70..fc86f83b3 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -183,26 +183,27 @@ 'src/WebAnimationImpl.h', 'src/WebCompositorInputHandlerImpl.cpp', 'src/WebCompositorInputHandlerImpl.h', - 'src/WebContentLayer.cpp', 'src/WebContentLayerImpl.cpp', 'src/WebContentLayerImpl.h', - 'src/WebExternalTextureLayer.cpp', + 'src/WebExternalTextureLayerImpl.cpp', + 'src/WebExternalTextureLayerImpl.h', 'src/WebFloatAnimationCurve.cpp', - 'src/WebIOSurfaceLayer.cpp', - 'src/WebImageLayer.cpp', - 'src/WebLayer.cpp', + 'src/WebIOSurfaceLayerImpl.cpp', + 'src/WebIOSurfaceLayerImpl.h', + 'src/WebImageLayerImpl.cpp', + 'src/WebImageLayerImpl.h', 'src/WebLayerImpl.cpp', 'src/WebLayerImpl.h', 'src/WebLayerTreeView.cpp', 'src/WebLayerTreeViewImpl.cpp', 'src/WebLayerTreeViewImpl.h', - 'src/WebScrollableLayer.cpp', - 'src/WebScrollbarLayer.cpp', - 'src/WebSolidColorLayer.cpp', + 'src/WebScrollbarLayerImpl.cpp', + 'src/WebScrollbarLayerImpl.h', 'src/WebSolidColorLayerImpl.cpp', 'src/WebSolidColorLayerImpl.h', 'src/WebTransformAnimationCurve.cpp', - 'src/WebVideoLayer.cpp', + 'src/WebVideoLayerImpl.cpp', + 'src/WebVideoLayerImpl.h', ], 'conditions': [ diff --git a/Source/WebKit/chromium/public/WebAccessibilityRole.h b/Source/WebKit/chromium/public/WebAccessibilityRole.h index 60958f910..f40c1d99b 100644 --- a/Source/WebKit/chromium/public/WebAccessibilityRole.h +++ b/Source/WebKit/chromium/public/WebAccessibilityRole.h @@ -133,6 +133,7 @@ enum WebAccessibilityRole { WebAccessibilityRoleTreeGrid, WebAccessibilityRoleTreeItemRole, WebAccessibilityRoleTextField, + WebAccessibilityRoleToggleButton, WebAccessibilityRoleToolbar, WebAccessibilityRoleUnknown, WebAccessibilityRoleUserInterfaceTooltip, diff --git a/Source/WebKit/chromium/public/WebFrame.h b/Source/WebKit/chromium/public/WebFrame.h index c0b8e2aa7..06531df8f 100644 --- a/Source/WebKit/chromium/public/WebFrame.h +++ b/Source/WebKit/chromium/public/WebFrame.h @@ -433,8 +433,6 @@ public: virtual WebRange markedRange() const = 0; - virtual void setSelectionToRange(const WebRange&) = 0; - // Returns the frame rectangle in window coordinate space of the given text // range. virtual bool firstRectForCharacterRange(unsigned location, unsigned length, WebRect&) const = 0; diff --git a/Source/WebKit/chromium/public/WebWidget.h b/Source/WebKit/chromium/public/WebWidget.h index 8e4fecac7..ac1658140 100644 --- a/Source/WebKit/chromium/public/WebWidget.h +++ b/Source/WebKit/chromium/public/WebWidget.h @@ -41,6 +41,7 @@ #define WEBKIT_HAS_NEW_FULLSCREEN_API 1 #define WEBWIDGET_HAS_SETCOMPOSITORSURFACEREADY 1 +#define WEBWIDGET_HAS_PAINT_OPTIONS 1 namespace WebKit { @@ -90,6 +91,21 @@ public: // and it may result in calls to WebWidgetClient::didInvalidateRect. virtual void layout() { } + enum PaintOptions { + // Attempt to fulfill the painting request by reading back from the + // compositor, assuming we're using a compositor to render. + ReadbackFromCompositorIfAvailable, + + // Force the widget to rerender onto the canvas using software. This + // mode ignores 3d transforms and ignores GPU-resident content, such + // as video, canvas, and WebGL. + // + // Note: This option exists on OS(ANDROID) and will hopefully be + // removed once the link disambiguation feature renders using + // the compositor. + ForceSoftwareRenderingAndIgnoreGPUResidentContent, + }; + // Called to paint the rectangular region within the WebWidget // onto the specified canvas at (viewPort.x,viewPort.y). You MUST call // Layout before calling this method. It is okay to call paint @@ -97,7 +113,7 @@ public: // changes are made to the WebWidget (e.g., once events are // processed, it should be assumed that another call to layout is // warranted before painting again). - virtual void paint(WebCanvas*, const WebRect& viewPort) { } + virtual void paint(WebCanvas*, const WebRect& viewPort, PaintOptions = ReadbackFromCompositorIfAvailable) { } // In non-threaded compositing mode, triggers compositing of the current // layers onto the screen. You MUST call Layout before calling this method, diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index 8f2dc5e86..27239d769 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -257,6 +257,7 @@ COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDocumentMath, DocumentMathRole) COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDocumentNote, DocumentNoteRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDocumentRegion, DocumentRegionRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleUserInterfaceTooltip, UserInterfaceTooltipRole); +COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleToggleButton, ToggleButtonRole); COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::Uncached, ApplicationCacheHost::UNCACHED); COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::Idle, ApplicationCacheHost::IDLE); diff --git a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp index 0338d3f2d..4f257c77c 100644 --- a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp +++ b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp @@ -36,8 +36,8 @@ #include "InspectorFrontendHost.h" #include "Page.h" #include "PlatformString.h" +#include "ScriptController.h" #include "V8InspectorFrontendHost.h" -#include "V8Proxy.h" #include "WebDevToolsFrontendClient.h" #include "WebDevToolsFrontendImpl.h" #include "platform/WebFloatPoint.h" @@ -63,7 +63,7 @@ InspectorFrontendClientImpl::~InspectorFrontendClientImpl() void InspectorFrontendClientImpl::windowObjectCleared() { v8::HandleScope handleScope; - v8::Handle<v8::Context> frameContext = V8Proxy::context(m_frontendPage->mainFrame()); + v8::Handle<v8::Context> frameContext = m_frontendPage->mainFrame() ? m_frontendPage->mainFrame()->script()->currentWorldContext() : v8::Local<v8::Context>(); v8::Context::Scope contextScope(frameContext); ASSERT(!m_frontendHost); diff --git a/Source/WebKit/chromium/src/LinkHighlight.cpp b/Source/WebKit/chromium/src/LinkHighlight.cpp new file mode 100644 index 000000000..fa34d1d0d --- /dev/null +++ b/Source/WebKit/chromium/src/LinkHighlight.cpp @@ -0,0 +1,271 @@ +/* + * 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: + * + * 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. + */ + +#include "config.h" + +#include "LinkHighlight.h" + +#include "Color.h" +#include "Frame.h" +#include "FrameView.h" +#include "LayoutTypes.h" +#include "Node.h" +#include "NonCompositedContentHost.h" +#include "PlatformContextSkia.h" +#include "RenderLayer.h" +#include "RenderLayerBacking.h" +#include "RenderObject.h" +#include "RenderView.h" +#include "WebFrameImpl.h" +#include "WebKit.h" +#include "WebViewImpl.h" +#include <public/WebAnimationCurve.h> +#include <public/WebFloatAnimationCurve.h> +#include <public/WebFloatPoint.h> +#include <public/WebRect.h> +#include <public/WebSize.h> + +using namespace WebCore; + +namespace WebKit { + +class WebViewImpl; + +PassOwnPtr<LinkHighlight> LinkHighlight::create(Node* node, WebViewImpl* owningWebViewImpl) +{ + return adoptPtr(new LinkHighlight(node, owningWebViewImpl)); +} + +LinkHighlight::LinkHighlight(Node* node, WebViewImpl* owningWebViewImpl) + : m_contentLayer(adoptPtr(WebContentLayer::create(this))) + , m_clipLayer(adoptPtr(WebLayer::create())) + , m_node(node) + , m_owningWebViewImpl(owningWebViewImpl) + , m_currentGraphicsLayer(0) + , m_geometryNeedsUpdate(false) +{ + ASSERT(m_node); + ASSERT(owningWebViewImpl); + + m_clipLayer->setAnchorPoint(WebFloatPoint()); + m_clipLayer->addChild(m_contentLayer->layer()); + m_contentLayer->layer()->setDrawsContent(false); + + // We don't want to show the highlight until startAnimation is called, even though the highlight + // layer may be added to the tree immediately. + m_contentLayer->layer()->setOpacity(0); + m_contentLayer->layer()->setAnimationDelegate(this); +} + +LinkHighlight::~LinkHighlight() +{ + clearGraphicsLayerLinkHighlightPointer(); + releaseResources(); +} + +WebContentLayer* LinkHighlight::contentLayer() +{ + return m_contentLayer.get(); +} + +WebLayer* LinkHighlight::clipLayer() +{ + return m_clipLayer.get(); +} + +void LinkHighlight::releaseResources() +{ + m_node.clear(); +} + +RenderLayer* LinkHighlight::computeEnclosingCompositingLayer() +{ + if (!m_node || !m_node->renderer()) + return 0; + + RenderLayer* renderLayer = m_node->renderer()->enclosingLayer(); + + // Find the nearest enclosing composited layer and attach to it. We may need to cross frame boundaries + // to find a suitable layer. + while (renderLayer && !renderLayer->isComposited()) { + if (!renderLayer->parent()) { + // See if we've reached the root in an enclosed frame. + if (renderLayer->renderer()->frame()->ownerRenderer()) + renderLayer = renderLayer->renderer()->frame()->ownerRenderer()->enclosingLayer(); + else + renderLayer = 0; + } else + renderLayer = renderLayer->parent(); + } + + if (!renderLayer || !renderLayer->isComposited()) + return 0; + + m_graphicsLayerOffset = FloatPoint(); + GraphicsLayerChromium* newGraphicsLayer = static_cast<GraphicsLayerChromium*>(renderLayer->backing()->graphicsLayer()); + if (!newGraphicsLayer->drawsContent()) { + m_graphicsLayerOffset = newGraphicsLayer->position(); + newGraphicsLayer = static_cast<GraphicsLayerChromium*>(m_owningWebViewImpl->nonCompositedContentHost()->topLevelRootLayer()); + } + + if (m_currentGraphicsLayer != newGraphicsLayer) { + if (m_currentGraphicsLayer) + clearGraphicsLayerLinkHighlightPointer(); + + m_currentGraphicsLayer = newGraphicsLayer; + m_currentGraphicsLayer->setLinkHighlight(this); + } + + return renderLayer; +} + +bool LinkHighlight::computeHighlightLayerPathAndPosition(RenderLayer* compositingLayer) +{ + if (!m_node || !m_node->renderer()) + return false; + + bool pathHasChanged = false; + FloatRect boundingRect = m_node->getPixelSnappedRect(); + + // FIXME: If we ever use a more sophisticated highlight path, we'll need + // to devise a way of detecting when it changes. + if (boundingRect.size() != m_path.boundingRect().size()) { + FloatSize rectRoundingRadii(3, 3); + m_path.clear(); + m_path.addRoundedRect(boundingRect, rectRoundingRadii); + // Always treat the path as being at the origin of this layer. + m_path.translate(FloatPoint() - boundingRect.location()); + pathHasChanged = true; + } + + FloatRect nodeBounds = boundingRect; + + // This is a simplified, but basically correct, transformation of the target location, converted + // from its containing frame view to window coordinates and then back to the containing frame view + // of the composited layer. + // FIXME: We also need to transform the target's size in case of scaling. This can be done by also transforming + // the full rects in the xToY calls, and transforming both the upper-left and lower right corners + // to local coordinates at the end.. + ASSERT(compositingLayer); + IntPoint targetWindow = m_node->renderer()->frame()->view()->contentsToWindow(enclosingIntRect(nodeBounds).location()); + IntPoint targetCompositorAbsolute = compositingLayer->renderer()->frame()->view()->windowToContents(targetWindow); + FloatPoint targetCompositorLocal = compositingLayer->renderer()->absoluteToLocal(targetCompositorAbsolute, false, true); + + m_contentLayer->layer()->setBounds(WebSize(enclosingIntRect(nodeBounds).size())); + m_contentLayer->layer()->setPosition(WebFloatPoint(targetCompositorLocal)); + + return pathHasChanged; +} + +void LinkHighlight::paintContents(WebCanvas* canvas, const WebRect& webClipRect, WebFloatRect&) +{ + if (!m_node || !m_node->renderer()) + return; + + PlatformContextSkia platformContext(canvas); + GraphicsContext gc(&platformContext); + IntRect clipRect(IntPoint(webClipRect.x, webClipRect.y), IntSize(webClipRect.width, webClipRect.height)); + gc.clip(clipRect); + gc.setFillColor(m_node->renderer()->style()->tapHighlightColor(), ColorSpaceDeviceRGB); + gc.fillPath(m_path); +} + +void LinkHighlight::startHighlightAnimation() +{ + const float startOpacity = 1; + // FIXME: Should duration be configurable? + const float duration = 2; + + m_contentLayer->layer()->setOpacity(startOpacity); + + WebFloatAnimationCurve curve; + curve.add(WebFloatKeyframe(0, startOpacity)); + curve.add(WebFloatKeyframe(duration / 2, startOpacity)); + // For layout tests we don't fade out. + curve.add(WebFloatKeyframe(duration, WebKit::layoutTestMode() ? startOpacity : 0)); + + m_animation = adoptPtr(WebAnimation::create(curve, WebAnimation::TargetPropertyOpacity)); + m_contentLayer->layer()->setDrawsContent(true); + m_contentLayer->layer()->addAnimation(m_animation.get()); + + invalidate(); + m_owningWebViewImpl->scheduleAnimation(); +} + +void LinkHighlight::clearGraphicsLayerLinkHighlightPointer() +{ + if (m_currentGraphicsLayer) { + m_currentGraphicsLayer->setLinkHighlight(0); + m_currentGraphicsLayer = 0; + } +} + +void LinkHighlight::notifyAnimationStarted(double) +{ +} + +void LinkHighlight::notifyAnimationFinished(double) +{ + // Since WebViewImpl may hang on to us for a while, make sure we + // release resources as soon as possible. + clearGraphicsLayerLinkHighlightPointer(); + releaseResources(); +} + +void LinkHighlight::updateGeometry() +{ + // To avoid unnecessary updates (e.g. other entities have requested animations from our WebViewImpl), + // only proceed if we actually requested an update. + if (!m_geometryNeedsUpdate) + return; + + m_geometryNeedsUpdate = false; + + RenderLayer* compositingLayer = computeEnclosingCompositingLayer(); + if (compositingLayer && computeHighlightLayerPathAndPosition(compositingLayer)) { + // We only need to invalidate the layer if the highlight size has changed, otherwise + // we can just re-position the layer without needing to repaint. + m_contentLayer->layer()->invalidate(); + } +} + +void LinkHighlight::clearCurrentGraphicsLayer() +{ + m_currentGraphicsLayer = 0; + m_geometryNeedsUpdate = true; +} + +void LinkHighlight::invalidate() +{ + // Make sure we update geometry on the next callback from WebViewImpl::layout(). + m_geometryNeedsUpdate = true; +} + +WebLayer* LinkHighlight::layer() +{ + return clipLayer(); +} + +} // namespace WeKit diff --git a/Source/WebKit/chromium/src/LinkHighlight.h b/Source/WebKit/chromium/src/LinkHighlight.h new file mode 100644 index 000000000..4eb6f5967 --- /dev/null +++ b/Source/WebKit/chromium/src/LinkHighlight.h @@ -0,0 +1,98 @@ +/* + * 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: + * + * 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 LinkHighlight_h +#define LinkHighlight_h + +#include "FloatPoint.h" +#include "GraphicsLayerChromium.h" +#include "IntPoint.h" +#include "Path.h" +#include <public/WebAnimationDelegate.h> +#include <public/WebContentLayer.h> +#include <public/WebContentLayerClient.h> +#include <public/WebLayer.h> +#include <wtf/OwnPtr.h> + +namespace WebCore { +class RenderLayer; +class Node; +} + +namespace WebKit { + +struct WebFloatRect; +struct WebRect; +class WebViewImpl; + +class LinkHighlight : public WebContentLayerClient, public WebAnimationDelegate, WebCore::LinkHighlightClient { +public: + static PassOwnPtr<LinkHighlight> create(WebCore::Node*, WebViewImpl*); + virtual ~LinkHighlight(); + + WebContentLayer* contentLayer(); + WebLayer* clipLayer(); + void startHighlightAnimation(); + void updateGeometry(); + + // WebContentLayerClient implementation. + virtual void paintContents(WebCanvas*, const WebRect& clipRect, WebFloatRect& opaque) OVERRIDE; + + // WebAnimationDelegate implementation. + virtual void notifyAnimationStarted(double time) OVERRIDE; + virtual void notifyAnimationFinished(double time) OVERRIDE; + + // LinkHighlightClient inplementation. + virtual void invalidate() OVERRIDE; + virtual WebLayer* layer() OVERRIDE; + virtual void clearCurrentGraphicsLayer() OVERRIDE; + +private: + LinkHighlight(WebCore::Node*, WebViewImpl*); + + void releaseResources(); + + WebCore::RenderLayer* computeEnclosingCompositingLayer(); + void clearGraphicsLayerLinkHighlightPointer(); + // This function computes the highlight path, and returns true if it has changed + // size since the last call to this function. + bool computeHighlightLayerPathAndPosition(WebCore::RenderLayer*); + + OwnPtr<WebContentLayer> m_contentLayer; + OwnPtr<WebLayer> m_clipLayer; + WebCore::Path m_path; + + RefPtr<WebCore::Node> m_node; + OwnPtr<WebAnimation> m_animation; + WebViewImpl* m_owningWebViewImpl; + WebCore::GraphicsLayerChromium* m_currentGraphicsLayer; + + bool m_geometryNeedsUpdate; + WebCore::FloatPoint m_graphicsLayerOffset; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp index 65dac62ca..4df4204b3 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp @@ -30,6 +30,7 @@ #include "FloatPoint.h" #include "FloatRect.h" #include "GraphicsLayer.h" +#include "GraphicsLayerChromium.h" #include "PlatformContextSkia.h" #include "WebViewImpl.h" #include <public/WebContentLayer.h> @@ -48,11 +49,11 @@ NonCompositedContentHost::NonCompositedContentHost(WebViewImpl* webView) m_graphicsLayer->setName("non-composited content"); #endif m_graphicsLayer->setDrawsContent(true); - WebContentLayer layer = m_graphicsLayer->platformLayer()->to<WebContentLayer>(); - layer.setUseLCDText(true); - layer.setOpaque(true); + WebContentLayer* layer = static_cast<WebCore::GraphicsLayerChromium*>(m_graphicsLayer.get())->contentLayer(); + layer->setUseLCDText(true); + layer->layer()->setOpaque(true); #if !OS(ANDROID) - layer.setDrawCheckerboardForMissingTiles(true); + layer->setDrawCheckerboardForMissingTiles(true); #endif } @@ -80,7 +81,7 @@ void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer) return; } - if (*layer->platformLayer() == scrollLayer()) + if (layer->platformLayer() == scrollLayer()) return; layer->addChildAtIndex(m_graphicsLayer.get(), 0); @@ -95,12 +96,12 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, bool visibleRectChanged = m_viewportSize != viewportSize; m_viewportSize = viewportSize; - WebScrollableLayer layer = scrollLayer(); - layer.setScrollPosition(scrollPosition + scrollOrigin); - layer.setPosition(WebFloatPoint(-scrollPosition)); + WebLayer* layer = scrollLayer(); + layer->setScrollPosition(scrollPosition + scrollOrigin); + layer->setPosition(WebFloatPoint(-scrollPosition)); // Due to the possibility of pinch zoom, the noncomposited layer is always // assumed to be scrollable. - layer.setScrollable(true); + layer->setScrollable(true); m_deviceScaleFactor = deviceScale; m_graphicsLayer->deviceOrPageScaleFactorChanged(); m_graphicsLayer->setSize(contentsSize); @@ -127,11 +128,11 @@ bool NonCompositedContentHost::haveScrollLayer() return m_graphicsLayer->parent(); } -WebScrollableLayer NonCompositedContentHost::scrollLayer() +WebLayer* NonCompositedContentHost::scrollLayer() { if (!m_graphicsLayer->parent()) - return WebScrollableLayer(); - return m_graphicsLayer->parent()->platformLayer()->to<WebScrollableLayer>(); + return 0; + return m_graphicsLayer->parent()->platformLayer(); } void NonCompositedContentHost::invalidateRect(const WebCore::IntRect& rect) diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.h b/Source/WebKit/chromium/src/NonCompositedContentHost.h index e60e9ef48..08b5f6a41 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.h +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.h @@ -29,7 +29,7 @@ #include "GraphicsLayerClient.h" #include "IntSize.h" -#include <public/WebScrollableLayer.h> +#include <public/WebLayer.h> #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -80,7 +80,7 @@ private: virtual float deviceScaleFactor() const OVERRIDE { return m_deviceScaleFactor; } bool haveScrollLayer(); - WebScrollableLayer scrollLayer(); + WebLayer* scrollLayer(); OwnPtr<WebCore::GraphicsLayer> m_graphicsLayer; WebViewImpl* m_webView; diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp index 69da1ea3f..fa21e8974 100644 --- a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp @@ -26,37 +26,66 @@ #include "config.h" #include "WebContentLayerImpl.h" +#include "SkMatrix44.h" #include <public/WebContentLayerClient.h> +#include <public/WebFloatPoint.h> #include <public/WebFloatRect.h> #include <public/WebRect.h> +#include <public/WebSize.h> using namespace WebCore; namespace WebKit { -PassRefPtr<WebContentLayerImpl> WebContentLayerImpl::create(WebContentLayerClient* contentClient) +WebContentLayer* WebContentLayer::create(WebContentLayerClient* client) { - return adoptRef(new WebContentLayerImpl(contentClient)); + return new WebContentLayerImpl(client); } -WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* contentClient) - : ContentLayerChromium(this) - , m_contentClient(contentClient) +WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* client) + : m_webLayerImpl(adoptPtr(new WebLayerImpl(ContentLayerChromium::create(this)))) + , m_client(client) { - setIsDrawable(true); + m_webLayerImpl->layer()->setIsDrawable(true); } WebContentLayerImpl::~WebContentLayerImpl() { - clearDelegate(); + static_cast<ContentLayerChromium*>(m_webLayerImpl->layer())->clearDelegate(); } +WebLayer* WebContentLayerImpl::layer() +{ + return m_webLayerImpl.get(); +} + +void WebContentLayerImpl::setDoubleSided(bool doubleSided) +{ + m_webLayerImpl->layer()->setDoubleSided(doubleSided); +} + +void WebContentLayerImpl::setContentsScale(float scale) +{ + m_webLayerImpl->layer()->setContentsScale(scale); +} + +void WebContentLayerImpl::setUseLCDText(bool enable) +{ + m_webLayerImpl->layer()->setUseLCDText(enable); +} + +void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) +{ + m_webLayerImpl->layer()->setDrawCheckerboardForMissingTiles(enable); +} + + void WebContentLayerImpl::paintContents(SkCanvas* canvas, const IntRect& clip, FloatRect& opaque) { - if (!m_contentClient) + if (!m_client) return; WebFloatRect webOpaque; - m_contentClient->paintContents(canvas, WebRect(clip), webOpaque); + m_client->paintContents(canvas, WebRect(clip), webOpaque); opaque = webOpaque; } diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.h b/Source/WebKit/chromium/src/WebContentLayerImpl.h index 97729ea1e..511f8e0ba 100644 --- a/Source/WebKit/chromium/src/WebContentLayerImpl.h +++ b/Source/WebKit/chromium/src/WebContentLayerImpl.h @@ -27,23 +27,33 @@ #define WebContentLayerImpl_h #include "ContentLayerChromium.h" +#include "WebLayerImpl.h" +#include <public/WebContentLayer.h> #include <wtf/PassRefPtr.h> namespace WebKit { class WebContentLayerClient; -class WebContentLayerImpl : public WebCore::ContentLayerChromium, public WebCore::ContentLayerDelegate { +class WebContentLayerImpl : public WebContentLayer, + public WebCore::ContentLayerDelegate { public: - static PassRefPtr<WebContentLayerImpl> create(WebContentLayerClient* contentClient); + explicit WebContentLayerImpl(WebContentLayerClient*); + + // WebContentLayer implementation. + virtual WebLayer* layer() OVERRIDE; + virtual void setDoubleSided(bool) OVERRIDE; + virtual void setContentsScale(float) OVERRIDE; + virtual void setUseLCDText(bool) OVERRIDE; + virtual void setDrawCheckerboardForMissingTiles(bool) OVERRIDE; protected: - explicit WebContentLayerImpl(WebContentLayerClient* contentClient); virtual ~WebContentLayerImpl(); // ContentLayerDelegate implementation. virtual void paintContents(SkCanvas*, const WebCore::IntRect& clip, WebCore::FloatRect& opaque) OVERRIDE; - WebContentLayerClient* m_contentClient; + OwnPtr<WebLayerImpl> m_webLayerImpl; + WebContentLayerClient* m_client; bool m_drawsContent; }; diff --git a/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp index 9418c0dc0..800568a61 100644 --- a/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp +++ b/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp @@ -44,6 +44,7 @@ #include "Page.h" #include "Pasteboard.h" #include "PlatformString.h" +#include "ScriptController.h" #include "SecurityOrigin.h" #include "Settings.h" #include "V8Binding.h" @@ -51,7 +52,6 @@ #include "V8InspectorFrontendHost.h" #include "V8MouseEvent.h" #include "V8Node.h" -#include "V8Proxy.h" #include "V8Utilities.h" #include "WebDevToolsFrontendClient.h" #include "WebFrameImpl.h" @@ -107,7 +107,7 @@ void WebDevToolsFrontendImpl::dispatchOnInspectorFrontend(const WebString& messa { WebFrameImpl* frame = m_webViewImpl->mainFrameImpl(); v8::HandleScope scope; - v8::Handle<v8::Context> frameContext = V8Proxy::context(frame->frame()); + v8::Handle<v8::Context> frameContext = frame->frame() ? frame->frame()->script()->currentWorldContext() : v8::Local<v8::Context>(); v8::Context::Scope contextScope(frameContext); v8::Handle<v8::Value> inspectorBackendValue = frameContext->Global()->Get(v8::String::New("InspectorBackend")); if (!inspectorBackendValue->IsObject()) diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp index d4aff5721..d62166f44 100644 --- a/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp +++ b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp @@ -24,10 +24,11 @@ */ #include "config.h" -#include <public/WebExternalTextureLayer.h> +#include "WebExternalTextureLayerImpl.h" #include "CCTextureUpdateQueue.h" #include "TextureLayerChromium.h" +#include "WebLayerImpl.h" #include <public/WebExternalTextureLayerClient.h> #include <public/WebFloatRect.h> #include <public/WebSize.h> @@ -36,96 +37,96 @@ using namespace WebCore; namespace WebKit { -class WebTextureUpdaterImpl : public WebTextureUpdater { -public: - explicit WebTextureUpdaterImpl(CCTextureUpdateQueue& queue) - : m_queue(queue) - { - } - - virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture, WebSize size) OVERRIDE - { - TextureCopier::Parameters copy = { sourceTexture, destinationTexture, size }; - m_queue.appendCopy(copy); - } - -private: - CCTextureUpdateQueue& m_queue; -}; - -class WebExternalTextureLayerImpl : public TextureLayerChromiumClient, public TextureLayerChromium { -public: - explicit WebExternalTextureLayerImpl(WebExternalTextureLayerClient* client) - : TextureLayerChromium(client ? this : 0) - , m_client(client) - { - } - - virtual unsigned prepareTexture(CCTextureUpdateQueue& queue) OVERRIDE - { - WebTextureUpdaterImpl updaterImpl(queue); - return m_client->prepareTexture(updaterImpl); - } +WebExternalTextureLayer* WebExternalTextureLayer::create(WebExternalTextureLayerClient* client) +{ + return new WebExternalTextureLayerImpl(client); +} - virtual WebKit::WebGraphicsContext3D* context() OVERRIDE - { - return m_client->context(); - } +WebExternalTextureLayerImpl::WebExternalTextureLayerImpl(WebExternalTextureLayerClient* client) + : m_client(client) +{ + RefPtr<TextureLayerChromium> layer; + if (m_client) + layer = TextureLayerChromium::create(this); + else + layer = TextureLayerChromium::create(0); + layer->setIsDrawable(true); + m_layer = adoptPtr(new WebLayerImpl(layer.release())); +} -private: - WebExternalTextureLayerClient* m_client; -}; +WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl() +{ + static_cast<TextureLayerChromium*>(m_layer->layer())->clearClient(); +} -WebExternalTextureLayer WebExternalTextureLayer::create(WebExternalTextureLayerClient* client) +WebLayer* WebExternalTextureLayerImpl::layer() { - RefPtr<TextureLayerChromium> layer = adoptRef(new WebExternalTextureLayerImpl(client)); - layer->setIsDrawable(true); - return WebExternalTextureLayer(layer.release()); + return m_layer.get(); } -void WebExternalTextureLayer::clearClient() +void WebExternalTextureLayerImpl::setTextureId(unsigned id) { - unwrap<TextureLayerChromium>()->clearClient(); + static_cast<TextureLayerChromium*>(m_layer->layer())->setTextureId(id); } -void WebExternalTextureLayer::setTextureId(unsigned id) +void WebExternalTextureLayerImpl::setFlipped(bool flipped) { - unwrap<TextureLayerChromium>()->setTextureId(id); + static_cast<TextureLayerChromium*>(m_layer->layer())->setFlipped(flipped); } -void WebExternalTextureLayer::setFlipped(bool flipped) +void WebExternalTextureLayerImpl::setUVRect(const WebFloatRect& rect) { - unwrap<TextureLayerChromium>()->setFlipped(flipped); + static_cast<TextureLayerChromium*>(m_layer->layer())->setUVRect(rect); } -void WebExternalTextureLayer::setUVRect(const WebFloatRect& rect) +void WebExternalTextureLayerImpl::setOpaque(bool opaque) { - unwrap<TextureLayerChromium>()->setUVRect(rect); + static_cast<TextureLayerChromium*>(m_layer->layer())->setOpaque(opaque); } -void WebExternalTextureLayer::setOpaque(bool opaque) +void WebExternalTextureLayerImpl::setPremultipliedAlpha(bool premultipliedAlpha) { - unwrap<TextureLayerChromium>()->setOpaque(opaque); + static_cast<TextureLayerChromium*>(m_layer->layer())->setPremultipliedAlpha(premultipliedAlpha); } -void WebExternalTextureLayer::setPremultipliedAlpha(bool premultipliedAlpha) +void WebExternalTextureLayerImpl::willModifyTexture() { - unwrap<TextureLayerChromium>()->setPremultipliedAlpha(premultipliedAlpha); + static_cast<TextureLayerChromium*>(m_layer->layer())->willModifyTexture(); } -void WebExternalTextureLayer::willModifyTexture() +void WebExternalTextureLayerImpl::setRateLimitContext(bool rateLimit) { - unwrap<TextureLayerChromium>()->willModifyTexture(); + static_cast<TextureLayerChromium*>(m_layer->layer())->setRateLimitContext(rateLimit); } -void WebExternalTextureLayer::setRateLimitContext(bool rateLimit) +class WebTextureUpdaterImpl : public WebTextureUpdater { +public: + explicit WebTextureUpdaterImpl(CCTextureUpdateQueue& queue) + : m_queue(queue) + { + } + + virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture, WebSize size) OVERRIDE + { + TextureCopier::Parameters copy = { sourceTexture, destinationTexture, size }; + m_queue.appendCopy(copy); + } + +private: + CCTextureUpdateQueue& m_queue; +}; + +unsigned WebExternalTextureLayerImpl::prepareTexture(CCTextureUpdateQueue& queue) { - unwrap<TextureLayerChromium>()->setRateLimitContext(rateLimit); + ASSERT(m_client); + WebTextureUpdaterImpl updaterImpl(queue); + return m_client->prepareTexture(updaterImpl); } -WebExternalTextureLayer::WebExternalTextureLayer(PassRefPtr<TextureLayerChromium> layer) - : WebLayer(layer) +WebGraphicsContext3D* WebExternalTextureLayerImpl::context() { + ASSERT(m_client); + return m_client->context(); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebContentLayer.cpp b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h index efa7465b1..5348895bf 100644 --- a/Source/WebKit/chromium/src/WebContentLayer.cpp +++ b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h @@ -23,60 +23,42 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#include <public/WebContentLayer.h> +#ifndef WebExternalTextureLayerImpl_h +#define WebExternalTextureLayerImpl_h -#include "ContentLayerChromium.h" -#include "WebContentLayerImpl.h" - -using namespace WebCore; +#include "TextureLayerChromium.h" +#include <public/WebExternalTextureLayer.h> namespace WebKit { -WebContentLayer WebContentLayer::create(WebContentLayerClient* contentClient) -{ - return WebContentLayer(WebContentLayerImpl::create(contentClient)); -} +class WebLayerImpl; -void WebContentLayer::clearClient() -{ - unwrap<ContentLayerChromium>()->clearDelegate(); -} +class WebExternalTextureLayerImpl : public WebExternalTextureLayer, + public WebCore::TextureLayerChromiumClient { +public: + explicit WebExternalTextureLayerImpl(WebExternalTextureLayerClient*); + virtual ~WebExternalTextureLayerImpl(); -void WebContentLayer::setDoubleSided(bool doubleSided) -{ - m_private->setDoubleSided(doubleSided); -} + // WebExternalTextureLayer implementation. + virtual WebLayer* layer() OVERRIDE; + virtual void setTextureId(unsigned) OVERRIDE; + virtual void setFlipped(bool) OVERRIDE; + virtual void setUVRect(const WebFloatRect&) OVERRIDE; + virtual void setOpaque(bool) OVERRIDE; + virtual void setPremultipliedAlpha(bool) OVERRIDE; + virtual void willModifyTexture() OVERRIDE; + virtual void setRateLimitContext(bool) OVERRIDE; -void WebContentLayer::setContentsScale(float scale) -{ - m_private->setContentsScale(scale); -} + // TextureLayerChromiumClient implementation. + virtual unsigned prepareTexture(WebCore::CCTextureUpdateQueue&) OVERRIDE; + virtual WebGraphicsContext3D* context() OVERRIDE; -void WebContentLayer::setUseLCDText(bool enable) -{ - m_private->setUseLCDText(enable); -} +private: + WebExternalTextureLayerClient* m_client; + OwnPtr<WebLayerImpl> m_layer; +}; -void WebContentLayer::setDrawCheckerboardForMissingTiles(bool enable) -{ - m_private->setDrawCheckerboardForMissingTiles(enable); } -WebContentLayer::WebContentLayer(const PassRefPtr<ContentLayerChromium>& node) - : WebScrollableLayer(node) -{ -} - -WebContentLayer& WebContentLayer::operator=(const PassRefPtr<ContentLayerChromium>& node) -{ - m_private = node; - return *this; -} - -WebContentLayer::operator PassRefPtr<ContentLayerChromium>() const -{ - return static_cast<ContentLayerChromium*>(m_private.get()); -} +#endif // WebExternalTextureLayerImpl_h -} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index 0a9855f15..4279febe0 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -140,6 +140,7 @@ #include "ShadowRoot.h" #include "SkiaUtils.h" #include "SpellChecker.h" +#include "StyleInheritedData.h" #include "SubstituteData.h" #include "TextAffinity.h" #include "TextIterator.h" @@ -1235,14 +1236,6 @@ WebRange WebFrameImpl::markedRange() const return frame()->editor()->compositionRange(); } -void WebFrameImpl::setSelectionToRange(const WebRange& range) -{ - if (frame()->selection()->isContentEditable()) { - RefPtr<Range> replacementRange = PassRefPtr<Range>(range); - frame()->selection()->setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY)); - } -} - bool WebFrameImpl::firstRectForCharacterRange(unsigned location, unsigned length, WebRect& rect) const { if ((location + length < location) && (location + length)) diff --git a/Source/WebKit/chromium/src/WebFrameImpl.h b/Source/WebKit/chromium/src/WebFrameImpl.h index e83b3b0f7..20c5fe9d3 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.h +++ b/Source/WebKit/chromium/src/WebFrameImpl.h @@ -169,7 +169,6 @@ public: virtual void unmarkText(); virtual bool hasMarkedText() const; virtual WebRange markedRange() const; - virtual void setSelectionToRange(const WebRange&) OVERRIDE; virtual bool firstRectForCharacterRange(unsigned location, unsigned length, WebRect&) const; virtual size_t characterIndexForPoint(const WebPoint&) const; virtual bool executeCommand(const WebString&, const WebNode& = WebNode()); diff --git a/Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp b/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp index 77db0c877..bab70c61d 100644 --- a/Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp +++ b/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp @@ -24,30 +24,39 @@ */ #include "config.h" -#include <public/WebIOSurfaceLayer.h> +#include "WebIOSurfaceLayerImpl.h" #include "IOSurfaceLayerChromium.h" -#include <public/WebSize.h> +#include "WebLayerImpl.h" -using namespace WebCore; +using WebCore::IOSurfaceLayerChromium; namespace WebKit { -WebIOSurfaceLayer WebIOSurfaceLayer::create() +WebIOSurfaceLayer* WebIOSurfaceLayer::create() { RefPtr<IOSurfaceLayerChromium> layer = IOSurfaceLayerChromium::create(); layer->setIsDrawable(true); - return WebIOSurfaceLayer(layer.release()); + return new WebIOSurfaceLayerImpl(layer.release()); } -void WebIOSurfaceLayer::setIOSurfaceProperties(unsigned ioSurfaceId, WebSize size) +WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl(PassRefPtr<IOSurfaceLayerChromium> layer) + : m_layer(adoptPtr(new WebLayerImpl(layer))) { - unwrap<IOSurfaceLayerChromium>()->setIOSurfaceProperties(ioSurfaceId, size); } -WebIOSurfaceLayer::WebIOSurfaceLayer(PassRefPtr<IOSurfaceLayerChromium> layer) - : WebLayer(layer) +WebIOSurfaceLayerImpl::~WebIOSurfaceLayerImpl() { } +void WebIOSurfaceLayerImpl::setIOSurfaceProperties(unsigned ioSurfaceId, WebSize size) +{ + static_cast<IOSurfaceLayerChromium*>(m_layer->layer())->setIOSurfaceProperties(ioSurfaceId, size); +} + +WebLayer* WebIOSurfaceLayerImpl::layer() +{ + return m_layer.get(); +} + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h b/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h new file mode 100644 index 000000000..3dbb02759 --- /dev/null +++ b/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h @@ -0,0 +1,54 @@ +/* + * 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: + * + * 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 WebIOSurfaceLayerImpl_h +#define WebIOSurfaceLayerImpl_h + +#include <public/WebIOSurfaceLayer.h> +#include <wtf/OwnPtr.h> + +namespace WebCore { +class IOSurfaceLayerChromium; +} + +namespace WebKit { + +class WebIOSurfaceLayerImpl : public WebIOSurfaceLayer { +public: + explicit WebIOSurfaceLayerImpl(PassRefPtr<WebCore::IOSurfaceLayerChromium>); + virtual ~WebIOSurfaceLayerImpl(); + + // WebIOSurfaceLayer implementation. + virtual WebLayer* layer() OVERRIDE; + virtual void setIOSurfaceProperties(unsigned ioSurfaceId, WebSize) OVERRIDE; + +private: + OwnPtr<WebLayerImpl> m_layer; +}; + +} + +#endif // WebIOSurfaceLayerImpl_h + diff --git a/Source/WebKit/chromium/src/WebSolidColorLayer.cpp b/Source/WebKit/chromium/src/WebImageLayerImpl.cpp index 83914b263..d93af8045 100644 --- a/Source/WebKit/chromium/src/WebSolidColorLayer.cpp +++ b/Source/WebKit/chromium/src/WebImageLayerImpl.cpp @@ -24,26 +24,37 @@ */ #include "config.h" -#include <public/WebSolidColorLayer.h> +#include "WebImageLayerImpl.h" -#include "WebSolidColorLayerImpl.h" -#include <public/WebFloatRect.h> +#include "ImageLayerChromium.h" +#include "WebLayerImpl.h" + +using WebCore::ImageLayerChromium; namespace WebKit { -WebSolidColorLayer WebSolidColorLayer::create() +WebImageLayer* WebImageLayer::create() +{ + return new WebImageLayerImpl(WebCore::ImageLayerChromium::create()); +} + +WebImageLayerImpl::WebImageLayerImpl(PassRefPtr<WebCore::ImageLayerChromium> layer) + : m_layer(adoptPtr(new WebLayerImpl(layer))) +{ +} + +WebImageLayerImpl::~WebImageLayerImpl() { - return WebSolidColorLayer(WebSolidColorLayerImpl::create()); } -WebSolidColorLayer::WebSolidColorLayer(const PassRefPtr<WebSolidColorLayerImpl>& node) - : WebLayer(node) +WebLayer* WebImageLayerImpl::layer() { + return m_layer.get(); } -void WebSolidColorLayer::setBackgroundColor(const WebColor& color) +void WebImageLayerImpl::setBitmap(SkBitmap bitmap) { - m_private->setBackgroundColor(color); + static_cast<ImageLayerChromium*>(m_layer->layer())->setBitmap(bitmap); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebImageLayer.cpp b/Source/WebKit/chromium/src/WebImageLayerImpl.h index f76151530..9a4b8b3eb 100644 --- a/Source/WebKit/chromium/src/WebImageLayer.cpp +++ b/Source/WebKit/chromium/src/WebImageLayerImpl.h @@ -23,26 +23,32 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" +#ifndef WebImageLayerImpl_h +#define WebImageLayerImpl_h + #include <public/WebImageLayer.h> +#include <wtf/OwnPtr.h> -#include "ImageLayerChromium.h" +namespace WebCore { +class ImageLayerChromium; +} namespace WebKit { +class WebLayerImpl; -WebImageLayer WebImageLayer::create() -{ - return WebImageLayer(WebCore::ImageLayerChromium::create()); -} +class WebImageLayerImpl : public WebImageLayer { +public: + explicit WebImageLayerImpl(PassRefPtr<WebCore::ImageLayerChromium>); + virtual ~WebImageLayerImpl(); -WebImageLayer::WebImageLayer(PassRefPtr<WebCore::ImageLayerChromium> layer) - : WebLayer(layer) -{ -} + // WebImageLayer implementation. + WebLayer* layer() OVERRIDE; + virtual void setBitmap(SkBitmap) OVERRIDE; + +private: + OwnPtr<WebLayerImpl> m_layer; +}; -void WebImageLayer::setBitmap(SkBitmap bitmap) -{ - unwrap<WebCore::ImageLayerChromium>()->setBitmap(bitmap); } -} // namespace WebKit +#endif // WebImageLayerImpl_h diff --git a/Source/WebKit/chromium/src/WebLayer.cpp b/Source/WebKit/chromium/src/WebLayer.cpp deleted file mode 100644 index 37897e6f8..000000000 --- a/Source/WebKit/chromium/src/WebLayer.cpp +++ /dev/null @@ -1,379 +0,0 @@ -/* - * Copyright (C) 2011 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. - */ - -#include "config.h" -#include <public/WebLayer.h> - -#include "LayerChromium.h" -#include "SkMatrix44.h" -#include "WebAnimationImpl.h" -#include "WebLayerImpl.h" -#include <public/WebFilterOperations.h> -#include <public/WebFloatPoint.h> -#include <public/WebFloatRect.h> -#include <public/WebSize.h> -#include <public/WebTransformationMatrix.h> - -using namespace WebCore; -using WebKit::WebTransformationMatrix; - -namespace { - -WebTransformationMatrix transformationMatrixFromSkMatrix44(const SkMatrix44& matrix) -{ - double data[16]; - matrix.asColMajord(data); - return WebTransformationMatrix(data[0], data[1], data[2], data[3], - data[4], data[5], data[6], data[7], - data[8], data[9], data[10], data[11], - data[12], data[13], data[14], data[15]); -} - -SkMatrix44 skMatrix44FromTransformationMatrix(const WebTransformationMatrix& matrix) -{ - SkMatrix44 skMatrix; - skMatrix.set(0, 0, SkDoubleToMScalar(matrix.m11())); - skMatrix.set(1, 0, SkDoubleToMScalar(matrix.m12())); - skMatrix.set(2, 0, SkDoubleToMScalar(matrix.m13())); - skMatrix.set(3, 0, SkDoubleToMScalar(matrix.m14())); - skMatrix.set(0, 1, SkDoubleToMScalar(matrix.m21())); - skMatrix.set(1, 1, SkDoubleToMScalar(matrix.m22())); - skMatrix.set(2, 1, SkDoubleToMScalar(matrix.m23())); - skMatrix.set(3, 1, SkDoubleToMScalar(matrix.m24())); - skMatrix.set(0, 2, SkDoubleToMScalar(matrix.m31())); - skMatrix.set(1, 2, SkDoubleToMScalar(matrix.m32())); - skMatrix.set(2, 2, SkDoubleToMScalar(matrix.m33())); - skMatrix.set(3, 2, SkDoubleToMScalar(matrix.m34())); - skMatrix.set(0, 3, SkDoubleToMScalar(matrix.m41())); - skMatrix.set(1, 3, SkDoubleToMScalar(matrix.m42())); - skMatrix.set(2, 3, SkDoubleToMScalar(matrix.m43())); - skMatrix.set(3, 3, SkDoubleToMScalar(matrix.m44())); - return skMatrix; -} - -} // anonymous namespace - -namespace WebKit { - -WebLayer WebLayer::create() -{ - return WebLayer(WebLayerImpl::create()); -} - -void WebLayer::reset() -{ - m_private.reset(); -} - -void WebLayer::assign(const WebLayer& other) -{ - m_private = other.m_private; -} - -bool WebLayer::equals(const WebLayer& n) const -{ - return (m_private.get() == n.m_private.get()); -} - -void WebLayer::invalidateRect(const WebFloatRect& dirtyRect) -{ - m_private->setNeedsDisplayRect(dirtyRect); -} - -void WebLayer::invalidate() -{ - m_private->setNeedsDisplay(); -} - -void WebLayer::addChild(const WebLayer& child) -{ - m_private->addChild(child); -} - -void WebLayer::insertChild(const WebLayer& child, size_t index) -{ - m_private->insertChild(child, index); -} - -void WebLayer::replaceChild(const WebLayer& reference, const WebLayer& newLayer) -{ - WebLayer ref = reference; - m_private->replaceChild(ref.unwrap<LayerChromium>(), newLayer); -} - -void WebLayer::setChildren(const WebVector<WebLayer>& webChildren) -{ - Vector<RefPtr<LayerChromium> > children(webChildren.size()); - for (size_t i = 0; i < webChildren.size(); ++i) - children[i] = webChildren[i].unwrap<LayerChromium>(); - m_private->setChildren(children); -} - -void WebLayer::removeFromParent() -{ - m_private->removeFromParent(); -} - -void WebLayer::removeAllChildren() -{ - m_private->removeAllChildren(); -} - -void WebLayer::setAnchorPoint(const WebFloatPoint& anchorPoint) -{ - m_private->setAnchorPoint(anchorPoint); -} - -WebFloatPoint WebLayer::anchorPoint() const -{ - return WebFloatPoint(m_private->anchorPoint()); -} - -void WebLayer::setAnchorPointZ(float anchorPointZ) -{ - m_private->setAnchorPointZ(anchorPointZ); -} - -float WebLayer::anchorPointZ() const -{ - return m_private->anchorPointZ(); -} - -void WebLayer::setBounds(const WebSize& size) -{ - m_private->setBounds(size); -} - -WebSize WebLayer::bounds() const -{ - return WebSize(m_private->bounds()); -} - -void WebLayer::setMasksToBounds(bool masksToBounds) -{ - m_private->setMasksToBounds(masksToBounds); -} - -bool WebLayer::masksToBounds() const -{ - return m_private->masksToBounds(); -} - -void WebLayer::setMaskLayer(const WebLayer& maskLayer) -{ - WebLayer ref = maskLayer; - m_private->setMaskLayer(ref.unwrap<LayerChromium>()); -} - -void WebLayer::setReplicaLayer(const WebLayer& replicaLayer) -{ - WebLayer ref = replicaLayer; - m_private->setReplicaLayer(ref.unwrap<LayerChromium>()); -} - -void WebLayer::setOpacity(float opacity) -{ - m_private->setOpacity(opacity); -} - -float WebLayer::opacity() const -{ - return m_private->opacity(); -} - -void WebLayer::setOpaque(bool opaque) -{ - m_private->setOpaque(opaque); -} - -bool WebLayer::opaque() const -{ - return m_private->opaque(); -} - -void WebLayer::setPosition(const WebFloatPoint& position) -{ - m_private->setPosition(position); -} - -WebFloatPoint WebLayer::position() const -{ - return WebFloatPoint(m_private->position()); -} - -void WebLayer::setSublayerTransform(const SkMatrix44& matrix) -{ - m_private->setSublayerTransform(transformationMatrixFromSkMatrix44(matrix)); -} - -void WebLayer::setSublayerTransform(const WebTransformationMatrix& matrix) -{ - m_private->setSublayerTransform(matrix); -} - -SkMatrix44 WebLayer::sublayerTransform() const -{ - return skMatrix44FromTransformationMatrix(m_private->sublayerTransform()); -} - -void WebLayer::setTransform(const SkMatrix44& matrix) -{ - m_private->setTransform(transformationMatrixFromSkMatrix44(matrix)); -} - -void WebLayer::setTransform(const WebTransformationMatrix& matrix) -{ - m_private->setTransform(matrix); -} - -SkMatrix44 WebLayer::transform() const -{ - return skMatrix44FromTransformationMatrix(m_private->transform()); -} - -void WebLayer::setDrawsContent(bool drawsContent) -{ - m_private->setIsDrawable(drawsContent); -} - -bool WebLayer::drawsContent() const -{ - return m_private->drawsContent(); -} - -void WebLayer::setPreserves3D(bool preserve3D) -{ - m_private->setPreserves3D(preserve3D); -} - -void WebLayer::setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) -{ - m_private->setUseParentBackfaceVisibility(useParentBackfaceVisibility); -} - -void WebLayer::setBackgroundColor(WebColor color) -{ - m_private->setBackgroundColor(color); -} - -void WebLayer::setFilters(const WebFilterOperations& filters) -{ - m_private->setFilters(filters); -} - -void WebLayer::setBackgroundFilters(const WebFilterOperations& filters) -{ - m_private->setBackgroundFilters(filters); -} - -void WebLayer::setDebugBorderColor(const WebColor& color) -{ - m_private->setDebugBorderColor(color); -} - -void WebLayer::setDebugBorderWidth(float width) -{ - m_private->setDebugBorderWidth(width); -} - -void WebLayer::setDebugName(WebString name) -{ - m_private->setDebugName(name); -} - -void WebLayer::setAnimationDelegate(WebAnimationDelegate* delegate) -{ - m_private->setLayerAnimationDelegate(delegate); -} - -bool WebLayer::addAnimation(WebAnimation* animation) -{ - return m_private->addAnimation(static_cast<WebAnimationImpl*>(animation)->cloneToCCAnimation()); -} - -void WebLayer::removeAnimation(int animationId) -{ - m_private->removeAnimation(animationId); -} - -void WebLayer::removeAnimation(int animationId, WebAnimation::TargetProperty targetProperty) -{ - m_private->layerAnimationController()->removeAnimation(animationId, static_cast<CCActiveAnimation::TargetProperty>(targetProperty)); -} - -void WebLayer::pauseAnimation(int animationId, double timeOffset) -{ - m_private->pauseAnimation(animationId, timeOffset); -} - -void WebLayer::suspendAnimations(double monotonicTime) -{ - m_private->suspendAnimations(monotonicTime); -} - -void WebLayer::resumeAnimations(double monotonicTime) -{ - m_private->resumeAnimations(monotonicTime); -} - -bool WebLayer::hasActiveAnimation() -{ - return m_private->hasActiveAnimation(); -} - -void WebLayer::transferAnimationsTo(WebLayer* other) -{ - ASSERT(other); - if (other) - other->m_private->setLayerAnimationController(m_private->releaseLayerAnimationController()); -} - -void WebLayer::setForceRenderSurface(bool forceRenderSurface) -{ - m_private->setForceRenderSurface(forceRenderSurface); -} - -void WebLayer::clearRenderSurface() -{ - m_private->clearRenderSurface(); -} - -WebLayer::WebLayer(const PassRefPtr<LayerChromium>& node) - : m_private(node) -{ -} - -WebLayer& WebLayer::operator=(const PassRefPtr<LayerChromium>& node) -{ - m_private = node; - return *this; -} - -WebLayer::operator PassRefPtr<LayerChromium>() const -{ - return m_private.get(); -} - -} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebLayerImpl.cpp b/Source/WebKit/chromium/src/WebLayerImpl.cpp index 16e1206ca..40ced485d 100644 --- a/Source/WebKit/chromium/src/WebLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebLayerImpl.cpp @@ -26,25 +26,376 @@ #include "config.h" #include "WebLayerImpl.h" -using namespace WebCore; +#include "CCActiveAnimation.h" +#include "LayerChromium.h" +#include "SkMatrix44.h" +#include "WebAnimationImpl.h" +#include <public/WebFloatPoint.h> +#include <public/WebFloatRect.h> +#include <public/WebSize.h> +#include <public/WebTransformationMatrix.h> + +using WebCore::CCActiveAnimation; +using WebCore::LayerChromium; namespace WebKit { -PassRefPtr<WebLayerImpl> WebLayerImpl::create() +namespace { + +WebTransformationMatrix transformationMatrixFromSkMatrix44(const SkMatrix44& matrix) +{ + double data[16]; + matrix.asColMajord(data); + return WebTransformationMatrix(data[0], data[1], data[2], data[3], + data[4], data[5], data[6], data[7], + data[8], data[9], data[10], data[11], + data[12], data[13], data[14], data[15]); +} + +SkMatrix44 skMatrix44FromTransformationMatrix(const WebTransformationMatrix& matrix) +{ + SkMatrix44 skMatrix; + skMatrix.set(0, 0, SkDoubleToMScalar(matrix.m11())); + skMatrix.set(1, 0, SkDoubleToMScalar(matrix.m12())); + skMatrix.set(2, 0, SkDoubleToMScalar(matrix.m13())); + skMatrix.set(3, 0, SkDoubleToMScalar(matrix.m14())); + skMatrix.set(0, 1, SkDoubleToMScalar(matrix.m21())); + skMatrix.set(1, 1, SkDoubleToMScalar(matrix.m22())); + skMatrix.set(2, 1, SkDoubleToMScalar(matrix.m23())); + skMatrix.set(3, 1, SkDoubleToMScalar(matrix.m24())); + skMatrix.set(0, 2, SkDoubleToMScalar(matrix.m31())); + skMatrix.set(1, 2, SkDoubleToMScalar(matrix.m32())); + skMatrix.set(2, 2, SkDoubleToMScalar(matrix.m33())); + skMatrix.set(3, 2, SkDoubleToMScalar(matrix.m34())); + skMatrix.set(0, 3, SkDoubleToMScalar(matrix.m41())); + skMatrix.set(1, 3, SkDoubleToMScalar(matrix.m42())); + skMatrix.set(2, 3, SkDoubleToMScalar(matrix.m43())); + skMatrix.set(3, 3, SkDoubleToMScalar(matrix.m44())); + return skMatrix; +} + +} // anonymous namespace + + +WebLayer* WebLayer::create() { - return adoptRef(new WebLayerImpl()); + return new WebLayerImpl(LayerChromium::create()); } -WebLayerImpl::WebLayerImpl() - : LayerChromium() +WebLayerImpl::WebLayerImpl(PassRefPtr<LayerChromium> layer) + : m_layer(layer) { - // Make sure that this layer does not draw content. This way we don't have to override - // the base class implementation of drawsContent(). - ASSERT(!drawsContent()); } WebLayerImpl::~WebLayerImpl() { + m_layer->clearRenderSurface(); + m_layer->setLayerAnimationDelegate(0); +} + +int WebLayerImpl::id() const +{ + return m_layer->id(); +} + +void WebLayerImpl::invalidateRect(const WebFloatRect& rect) +{ + m_layer->setNeedsDisplayRect(rect); +} + +void WebLayerImpl::invalidate() +{ + m_layer->setNeedsDisplay(); +} + +void WebLayerImpl::addChild(WebLayer* child) +{ + m_layer->addChild(static_cast<WebLayerImpl*>(child)->layer()); +} + +void WebLayerImpl::insertChild(WebLayer* child, size_t index) +{ + m_layer->insertChild(static_cast<WebLayerImpl*>(child)->layer(), index); +} + +void WebLayerImpl::replaceChild(WebLayer* reference, WebLayer* newLayer) +{ + m_layer->replaceChild(static_cast<WebLayerImpl*>(reference)->layer(), static_cast<WebLayerImpl*>(newLayer)->layer()); +} + +void WebLayerImpl::setChildren(const WebVector<WebLayer*>& webChildren) +{ + Vector<RefPtr<LayerChromium> > children(webChildren.size()); + for (size_t i = 0; i < webChildren.size(); ++i) + children[i] = static_cast<WebLayerImpl*>(webChildren[i])->layer(); + m_layer->setChildren(children); +} + +void WebLayerImpl::removeFromParent() +{ + m_layer->removeFromParent(); +} + +void WebLayerImpl::removeAllChildren() +{ + m_layer->removeAllChildren(); +} + +void WebLayerImpl::setAnchorPoint(const WebFloatPoint& anchorPoint) +{ + m_layer->setAnchorPoint(anchorPoint); +} + +WebFloatPoint WebLayerImpl::anchorPoint() const +{ + return WebFloatPoint(m_layer->anchorPoint()); +} + +void WebLayerImpl::setAnchorPointZ(float anchorPointZ) +{ + m_layer->setAnchorPointZ(anchorPointZ); +} + +float WebLayerImpl::anchorPointZ() const +{ + return m_layer->anchorPointZ(); +} + +void WebLayerImpl::setBounds(const WebSize& size) +{ + m_layer->setBounds(size); +} + +WebSize WebLayerImpl::bounds() const +{ + return WebSize(m_layer->bounds()); +} + +void WebLayerImpl::setMasksToBounds(bool masksToBounds) +{ + m_layer->setMasksToBounds(masksToBounds); +} + +bool WebLayerImpl::masksToBounds() const +{ + return m_layer->masksToBounds(); +} + +void WebLayerImpl::setMaskLayer(WebLayer* maskLayer) +{ + m_layer->setMaskLayer(maskLayer ? static_cast<WebLayerImpl*>(maskLayer)->layer() : 0); +} + +void WebLayerImpl::setReplicaLayer(WebLayer* replicaLayer) +{ + m_layer->setReplicaLayer(replicaLayer ? static_cast<WebLayerImpl*>(replicaLayer)->layer() : 0); +} + +void WebLayerImpl::setOpacity(float opacity) +{ + m_layer->setOpacity(opacity); +} + +float WebLayerImpl::opacity() const +{ + return m_layer->opacity(); +} + +void WebLayerImpl::setOpaque(bool opaque) +{ + m_layer->setOpaque(opaque); +} + +bool WebLayerImpl::opaque() const +{ + return m_layer->opaque(); +} + +void WebLayerImpl::setPosition(const WebFloatPoint& position) +{ + m_layer->setPosition(position); +} + +WebFloatPoint WebLayerImpl::position() const +{ + return WebFloatPoint(m_layer->position()); +} + +void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix) +{ + m_layer->setSublayerTransform(transformationMatrixFromSkMatrix44(matrix)); +} + +void WebLayerImpl::setSublayerTransform(const WebTransformationMatrix& matrix) +{ + m_layer->setSublayerTransform(matrix); +} + +SkMatrix44 WebLayerImpl::sublayerTransform() const +{ + return skMatrix44FromTransformationMatrix(m_layer->sublayerTransform()); +} + +void WebLayerImpl::setTransform(const SkMatrix44& matrix) +{ + m_layer->setTransform(transformationMatrixFromSkMatrix44(matrix)); +} + +void WebLayerImpl::setTransform(const WebTransformationMatrix& matrix) +{ + m_layer->setTransform(matrix); +} + +SkMatrix44 WebLayerImpl::transform() const +{ + return skMatrix44FromTransformationMatrix(m_layer->transform()); +} + +void WebLayerImpl::setDrawsContent(bool drawsContent) +{ + m_layer->setIsDrawable(drawsContent); +} + +bool WebLayerImpl::drawsContent() const +{ + return m_layer->drawsContent(); +} + +void WebLayerImpl::setPreserves3D(bool preserve3D) +{ + m_layer->setPreserves3D(preserve3D); +} + +void WebLayerImpl::setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) +{ + m_layer->setUseParentBackfaceVisibility(useParentBackfaceVisibility); +} + +void WebLayerImpl::setBackgroundColor(WebColor color) +{ + m_layer->setBackgroundColor(color); +} + +void WebLayerImpl::setFilters(const WebFilterOperations& filters) +{ + m_layer->setFilters(filters); +} + +void WebLayerImpl::setBackgroundFilters(const WebFilterOperations& filters) +{ + m_layer->setBackgroundFilters(filters); +} + +void WebLayerImpl::setDebugBorderColor(const WebColor& color) +{ + m_layer->setDebugBorderColor(color); +} + +void WebLayerImpl::setDebugBorderWidth(float width) +{ + m_layer->setDebugBorderWidth(width); +} + +void WebLayerImpl::setDebugName(WebString name) +{ + m_layer->setDebugName(name); +} + +void WebLayerImpl::setAnimationDelegate(WebAnimationDelegate* delegate) +{ + m_layer->setLayerAnimationDelegate(delegate); +} + +bool WebLayerImpl::addAnimation(WebAnimation* animation) +{ + return m_layer->addAnimation(static_cast<WebAnimationImpl*>(animation)->cloneToCCAnimation()); +} + +void WebLayerImpl::removeAnimation(int animationId) +{ + m_layer->removeAnimation(animationId); +} + +void WebLayerImpl::removeAnimation(int animationId, WebAnimation::TargetProperty targetProperty) +{ + m_layer->layerAnimationController()->removeAnimation(animationId, static_cast<CCActiveAnimation::TargetProperty>(targetProperty)); +} + +void WebLayerImpl::pauseAnimation(int animationId, double timeOffset) +{ + m_layer->pauseAnimation(animationId, timeOffset); +} + +void WebLayerImpl::suspendAnimations(double monotonicTime) +{ + m_layer->suspendAnimations(monotonicTime); +} + +void WebLayerImpl::resumeAnimations(double monotonicTime) +{ + m_layer->resumeAnimations(monotonicTime); +} + +bool WebLayerImpl::hasActiveAnimation() +{ + return m_layer->hasActiveAnimation(); +} + +void WebLayerImpl::transferAnimationsTo(WebLayer* other) +{ + ASSERT(other); + static_cast<WebLayerImpl*>(other)->m_layer->setLayerAnimationController(m_layer->releaseLayerAnimationController()); +} + +void WebLayerImpl::setForceRenderSurface(bool forceRenderSurface) +{ + m_layer->setForceRenderSurface(forceRenderSurface); +} + +void WebLayerImpl::setScrollPosition(WebPoint position) +{ + m_layer->setScrollPosition(position); +} + +void WebLayerImpl::setScrollable(bool scrollable) +{ + m_layer->setScrollable(scrollable); +} + +void WebLayerImpl::setHaveWheelEventHandlers(bool haveWheelEventHandlers) +{ + m_layer->setHaveWheelEventHandlers(haveWheelEventHandlers); +} + +void WebLayerImpl::setShouldScrollOnMainThread(bool shouldScrollOnMainThread) +{ + m_layer->setShouldScrollOnMainThread(shouldScrollOnMainThread); +} + +void WebLayerImpl::setNonFastScrollableRegion(const WebVector<WebRect>& rects) +{ + WebCore::Region region; + for (size_t i = 0; i < rects.size(); ++i) { + WebCore::IntRect rect = rects[i]; + region.unite(rect); + } + m_layer->setNonFastScrollableRegion(region); + +} + +void WebLayerImpl::setIsContainerForFixedPositionLayers(bool enable) +{ + m_layer->setIsContainerForFixedPositionLayers(enable); +} + +void WebLayerImpl::setFixedToContainerLayer(bool enable) +{ + m_layer->setFixedToContainerLayer(enable); +} + +LayerChromium* WebLayerImpl::layer() const +{ + return m_layer.get(); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebLayerImpl.h b/Source/WebKit/chromium/src/WebLayerImpl.h index 7e4e75062..7e3b533bc 100644 --- a/Source/WebKit/chromium/src/WebLayerImpl.h +++ b/Source/WebKit/chromium/src/WebLayerImpl.h @@ -26,18 +26,84 @@ #ifndef WebLayerImpl_h #define WebLayerImpl_h -#include "LayerChromium.h" -#include <wtf/PassRefPtr.h> +#include <public/WebLayer.h> +#include <wtf/RefPtr.h> + +namespace WebCore { +class LayerChromium; +} namespace WebKit { -class WebLayerImpl : public WebCore::LayerChromium { +class WebLayerImpl : public WebLayer { public: - static PassRefPtr<WebLayerImpl> create(); + explicit WebLayerImpl(PassRefPtr<WebCore::LayerChromium>); + virtual ~WebLayerImpl(); + + // WebLayer implementation. + virtual int id() const OVERRIDE; + virtual void invalidateRect(const WebFloatRect&) OVERRIDE; + virtual void invalidate() OVERRIDE; + virtual void addChild(WebLayer*) OVERRIDE; + virtual void insertChild(WebLayer*, size_t index) OVERRIDE; + virtual void replaceChild(WebLayer* reference, WebLayer* newLayer) OVERRIDE; + virtual void setChildren(const WebVector<WebLayer*>&) OVERRIDE; + virtual void removeFromParent() OVERRIDE; + virtual void removeAllChildren() OVERRIDE; + virtual void setAnchorPoint(const WebFloatPoint&) OVERRIDE; + virtual WebFloatPoint anchorPoint() const OVERRIDE; + virtual void setAnchorPointZ(float) OVERRIDE; + virtual float anchorPointZ() const OVERRIDE; + virtual void setBounds(const WebSize&) OVERRIDE; + virtual WebSize bounds() const OVERRIDE; + virtual void setMasksToBounds(bool) OVERRIDE; + virtual bool masksToBounds() const OVERRIDE; + virtual void setMaskLayer(WebLayer*) OVERRIDE; + virtual void setReplicaLayer(WebLayer*) OVERRIDE; + virtual void setOpacity(float) OVERRIDE; + virtual float opacity() const OVERRIDE; + virtual void setOpaque(bool) OVERRIDE; + virtual bool opaque() const OVERRIDE; + virtual void setPosition(const WebFloatPoint&) OVERRIDE; + virtual WebFloatPoint position() const OVERRIDE; + virtual void setSublayerTransform(const SkMatrix44&) OVERRIDE; + virtual void setSublayerTransform(const WebTransformationMatrix&) OVERRIDE; + virtual SkMatrix44 sublayerTransform() const OVERRIDE; + virtual void setTransform(const SkMatrix44&) OVERRIDE; + virtual void setTransform(const WebTransformationMatrix&) OVERRIDE; + virtual SkMatrix44 transform() const OVERRIDE; + virtual void setDrawsContent(bool) OVERRIDE; + virtual bool drawsContent() const OVERRIDE; + virtual void setPreserves3D(bool) OVERRIDE; + virtual void setUseParentBackfaceVisibility(bool) OVERRIDE; + virtual void setBackgroundColor(WebColor) OVERRIDE; + virtual void setFilters(const WebFilterOperations&) OVERRIDE; + virtual void setBackgroundFilters(const WebFilterOperations&) OVERRIDE; + virtual void setDebugBorderColor(const WebColor&) OVERRIDE; + virtual void setDebugBorderWidth(float) OVERRIDE; + virtual void setDebugName(WebString) OVERRIDE; + virtual void setAnimationDelegate(WebAnimationDelegate*) OVERRIDE; + virtual bool addAnimation(WebAnimation*) OVERRIDE; + virtual void removeAnimation(int animationId) OVERRIDE; + virtual void removeAnimation(int animationId, WebAnimation::TargetProperty) OVERRIDE; + virtual void pauseAnimation(int animationId, double timeOffset) OVERRIDE; + virtual void suspendAnimations(double monotonicTime) OVERRIDE; + virtual void resumeAnimations(double monotonicTime) OVERRIDE; + virtual bool hasActiveAnimation() OVERRIDE; + virtual void transferAnimationsTo(WebLayer*) OVERRIDE; + virtual void setForceRenderSurface(bool) OVERRIDE; + virtual void setScrollPosition(WebPoint) OVERRIDE; + virtual void setScrollable(bool) OVERRIDE; + virtual void setHaveWheelEventHandlers(bool) OVERRIDE; + virtual void setShouldScrollOnMainThread(bool) OVERRIDE; + virtual void setNonFastScrollableRegion(const WebVector<WebRect>&) OVERRIDE; + virtual void setIsContainerForFixedPositionLayers(bool) OVERRIDE; + virtual void setFixedToContainerLayer(bool) OVERRIDE; + + WebCore::LayerChromium* layer() const; protected: - WebLayerImpl(); - virtual ~WebLayerImpl(); + RefPtr<WebCore::LayerChromium> m_layer; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebLayerTreeView.cpp b/Source/WebKit/chromium/src/WebLayerTreeView.cpp index f397e534a..7dfbcd129 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeView.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeView.cpp @@ -31,6 +31,7 @@ #include "CCLayerTreeHost.h" #include "CCRenderingStats.h" #include "LayerChromium.h" +#include "WebLayerImpl.h" #include "WebLayerTreeViewImpl.h" #include <public/WebLayer.h> #include <public/WebPoint.h> @@ -83,7 +84,7 @@ void WebLayerTreeView::setSurfaceReady() void WebLayerTreeView::setRootLayer(WebLayer *root) { if (root) - m_private->layerTreeHost()->setRootLayer(*root); + m_private->layerTreeHost()->setRootLayer(static_cast<WebLayerImpl*>(root)->layer()); else m_private->layerTreeHost()->setRootLayer(PassRefPtr<LayerChromium>()); } diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp index 1f1933fc9..1fd823976 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp @@ -29,6 +29,7 @@ #include "CCLayerTreeHost.h" #include "CCThreadProxy.h" #include "LayerChromium.h" +#include "WebLayerImpl.h" #include <public/WebGraphicsContext3D.h> #include <public/WebLayer.h> #include <public/WebLayerTreeView.h> @@ -142,7 +143,7 @@ PassOwnPtr<WebLayerTreeViewImpl> WebLayerTreeViewImpl::create(WebLayerTreeViewCl OwnPtr<WebLayerTreeViewImpl> impl = adoptPtr(new WebLayerTreeViewImpl(client, settings)); if (!impl->layerTreeHost()) return nullptr; - impl->layerTreeHost()->setRootLayer(root); + impl->layerTreeHost()->setRootLayer(static_cast<const WebLayerImpl*>(&root)->layer()); return impl.release(); } diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index 4a90a988d..cb756233e 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -109,9 +109,9 @@ void WebMediaPlayerClientImpl::readyStateChanged() ASSERT(m_mediaPlayer); m_mediaPlayer->readyStateChanged(); #if USE(ACCELERATED_COMPOSITING) - if (hasVideo() && supportsAcceleratedRendering() && m_videoLayer.isNull()) { - m_videoLayer = WebVideoLayer::create(this); - m_videoLayer.setOpaque(m_opaque); + if (hasVideo() && supportsAcceleratedRendering() && !m_videoLayer) { + m_videoLayer = adoptPtr(WebVideoLayer::create(this)); + m_videoLayer->layer()->setOpaque(m_opaque); } #endif } @@ -138,8 +138,8 @@ void WebMediaPlayerClientImpl::repaint() { ASSERT(m_mediaPlayer); #if USE(ACCELERATED_COMPOSITING) - if (!m_videoLayer.isNull() && supportsAcceleratedRendering()) - m_videoLayer.invalidate(); + if (m_videoLayer && supportsAcceleratedRendering()) + m_videoLayer->layer()->invalidate(); #endif m_mediaPlayer->repaint(); } @@ -166,8 +166,8 @@ void WebMediaPlayerClientImpl::setOpaque(bool opaque) { #if USE(ACCELERATED_COMPOSITING) m_opaque = opaque; - if (!m_videoLayer.isNull()) - m_videoLayer.setOpaque(m_opaque); + if (m_videoLayer) + m_videoLayer->layer()->setOpaque(m_opaque); #endif } @@ -343,7 +343,7 @@ void WebMediaPlayerClientImpl::cancelLoad() WebLayer* WebMediaPlayerClientImpl::platformLayer() const { ASSERT(m_supportsAcceleratedCompositing); - return const_cast<WebVideoLayer*>(&m_videoLayer); + return m_videoLayer ? m_videoLayer->layer() : 0; } #endif @@ -745,7 +745,7 @@ bool WebMediaPlayerClientImpl::supportsAcceleratedRendering() const bool WebMediaPlayerClientImpl::acceleratedRenderingInUse() { - return !m_videoLayer.isNull() && m_videoLayer.active(); + return m_videoLayer && m_videoLayer->active(); } void WebMediaPlayerClientImpl::setVideoFrameProviderClient(WebVideoFrameProvider::Client* client) diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h index 373015eb7..329fd9ec0 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h @@ -205,7 +205,7 @@ private: WebCore::MediaPlayer::Preload m_preload; RefPtr<WebHelperPluginImpl> m_helperPlugin; #if USE(ACCELERATED_COMPOSITING) - WebVideoLayer m_videoLayer; + OwnPtr<WebVideoLayer> m_videoLayer; bool m_supportsAcceleratedCompositing; bool m_opaque; WebVideoFrameProvider::Client* m_videoFrameProviderClient; diff --git a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp index fe945c063..980f81a8a 100644 --- a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp +++ b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp @@ -225,7 +225,7 @@ void WebPagePopupImpl::layout() PageWidgetDelegate::layout(m_page.get()); } -void WebPagePopupImpl::paint(WebCanvas* canvas, const WebRect& rect) +void WebPagePopupImpl::paint(WebCanvas* canvas, const WebRect& rect, PaintOptions) { PageWidgetDelegate::paint(m_page.get(), 0, canvas, rect, PageWidgetDelegate::Opaque); } diff --git a/Source/WebKit/chromium/src/WebPagePopupImpl.h b/Source/WebKit/chromium/src/WebPagePopupImpl.h index 76936a4cd..e6844bfd0 100644 --- a/Source/WebKit/chromium/src/WebPagePopupImpl.h +++ b/Source/WebKit/chromium/src/WebPagePopupImpl.h @@ -72,7 +72,7 @@ private: virtual void setCompositorSurfaceReady() OVERRIDE; virtual void composite(bool) OVERRIDE; virtual void layout() OVERRIDE; - virtual void paint(WebCanvas*, const WebRect&) OVERRIDE; + virtual void paint(WebCanvas*, const WebRect&, PaintOptions = ReadbackFromCompositorIfAvailable) OVERRIDE; virtual void resize(const WebSize&) OVERRIDE; virtual void close() OVERRIDE; virtual bool handleInputEvent(const WebInputEvent&) OVERRIDE; diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp index a35a0407f..75a97e0f6 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -366,11 +366,11 @@ void WebPluginContainerImpl::setBackingTextureId(unsigned textureId) if (m_textureId == textureId) return; - ASSERT(m_ioSurfaceLayer.isNull()); + ASSERT(!m_ioSurfaceLayer); - if (m_textureLayer.isNull()) - m_textureLayer = WebExternalTextureLayer::create(); - m_textureLayer.setTextureId(textureId); + if (!m_textureLayer) + m_textureLayer = adoptPtr(WebExternalTextureLayer::create()); + m_textureLayer->setTextureId(textureId); // If anyone of the IDs is zero we need to switch between hardware // and software compositing. This is done by triggering a style recalc @@ -390,11 +390,11 @@ void WebPluginContainerImpl::setBackingIOSurfaceId(int width, if (ioSurfaceId == m_ioSurfaceId) return; - ASSERT(m_textureLayer.isNull()); + ASSERT(!m_textureLayer); - if (m_ioSurfaceLayer.isNull()) - m_ioSurfaceLayer = WebIOSurfaceLayer::create(); - m_ioSurfaceLayer.setIOSurfaceProperties(ioSurfaceId, WebSize(width, height)); + if (!m_ioSurfaceLayer) + m_ioSurfaceLayer = adoptPtr(WebIOSurfaceLayer::create()); + m_ioSurfaceLayer->setIOSurfaceProperties(ioSurfaceId, WebSize(width, height)); // If anyone of the IDs is zero we need to switch between hardware // and software compositing. This is done by triggering a style recalc @@ -409,11 +409,11 @@ void WebPluginContainerImpl::setBackingIOSurfaceId(int width, void WebPluginContainerImpl::commitBackingTexture() { #if USE(ACCELERATED_COMPOSITING) - if (!m_textureLayer.isNull()) - m_textureLayer.invalidate(); + if (m_textureLayer) + m_textureLayer->layer()->invalidate(); - if (!m_ioSurfaceLayer.isNull()) - m_ioSurfaceLayer.invalidate(); + if (m_ioSurfaceLayer) + m_ioSurfaceLayer->layer()->invalidate(); #endif } @@ -480,11 +480,11 @@ void WebPluginContainerImpl::zoomLevelChanged(double zoomLevel) void WebPluginContainerImpl::setOpaque(bool opaque) { #if USE(ACCELERATED_COMPOSITING) - if (!m_textureLayer.isNull()) - m_textureLayer.setOpaque(opaque); + if (m_textureLayer) + m_textureLayer->layer()->setOpaque(opaque); - if (!m_ioSurfaceLayer.isNull()) - m_ioSurfaceLayer.setOpaque(opaque); + if (m_ioSurfaceLayer) + m_ioSurfaceLayer->layer()->setOpaque(opaque); #endif } @@ -575,9 +575,9 @@ void WebPluginContainerImpl::willDestroyPluginLoadObserver(WebPluginLoadObserver WebLayer* WebPluginContainerImpl::platformLayer() const { if (m_textureId) - return const_cast<WebExternalTextureLayer*>(&m_textureLayer); + return m_textureLayer->layer(); if (m_ioSurfaceId) - return const_cast<WebIOSurfaceLayer*>(&m_ioSurfaceLayer); + return m_ioSurfaceLayer->layer(); return 0; } #endif diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.h b/Source/WebKit/chromium/src/WebPluginContainerImpl.h index 074a0ccdc..998be6e41 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.h +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.h @@ -186,10 +186,10 @@ private: // A composited plugin will either have no composited layer, a texture layer, or an IOSurface layer. // It will never have both a texture and IOSurface output. unsigned m_textureId; - WebExternalTextureLayer m_textureLayer; + OwnPtr<WebExternalTextureLayer> m_textureLayer; unsigned m_ioSurfaceId; - WebIOSurfaceLayer m_ioSurfaceLayer; + OwnPtr<WebIOSurfaceLayer> m_ioSurfaceLayer; #endif // The associated scrollbar group object, created lazily. Used for Pepper diff --git a/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp b/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp index ec89930fb..194dee550 100644 --- a/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp +++ b/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp @@ -193,7 +193,7 @@ void WebPopupMenuImpl::layout() { } -void WebPopupMenuImpl::paint(WebCanvas* canvas, const WebRect& rect) +void WebPopupMenuImpl::paint(WebCanvas* canvas, const WebRect& rect, PaintOptions) { if (!m_widget) return; diff --git a/Source/WebKit/chromium/src/WebPopupMenuImpl.h b/Source/WebKit/chromium/src/WebPopupMenuImpl.h index c22a0bbec..7f13e4385 100644 --- a/Source/WebKit/chromium/src/WebPopupMenuImpl.h +++ b/Source/WebKit/chromium/src/WebPopupMenuImpl.h @@ -73,7 +73,7 @@ public: virtual void willEndLiveResize() OVERRIDE; virtual void animate(double frameBeginTime) OVERRIDE; virtual void layout() OVERRIDE; - virtual void paint(WebCanvas*, const WebRect&) OVERRIDE; + virtual void paint(WebCanvas*, const WebRect&, PaintOptions = ReadbackFromCompositorIfAvailable) OVERRIDE; virtual void themeChanged() OVERRIDE; virtual void setCompositorSurfaceReady() OVERRIDE; virtual void composite(bool finish) OVERRIDE; diff --git a/Source/WebKit/chromium/src/WebScrollableLayer.cpp b/Source/WebKit/chromium/src/WebScrollableLayer.cpp deleted file mode 100644 index a20e81d81..000000000 --- a/Source/WebKit/chromium/src/WebScrollableLayer.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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: - * - * 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. - */ - -#include "config.h" -#include <public/WebScrollableLayer.h> - -#include "LayerChromium.h" -#include "Region.h" - -namespace WebKit { - -void WebScrollableLayer::setScrollPosition(WebPoint position) -{ - m_private->setScrollPosition(position); -} - -void WebScrollableLayer::setScrollable(bool scrollable) -{ - m_private->setScrollable(scrollable); -} - -void WebScrollableLayer::setHaveWheelEventHandlers(bool haveWheelEventHandlers) -{ - m_private->setHaveWheelEventHandlers(haveWheelEventHandlers); -} - -void WebScrollableLayer::setShouldScrollOnMainThread(bool shouldScrollOnMainThread) -{ - m_private->setShouldScrollOnMainThread(shouldScrollOnMainThread); -} - -void WebScrollableLayer::setNonFastScrollableRegion(const WebVector<WebRect>& rects) -{ - WebCore::Region region; - for (size_t i = 0; i < rects.size(); ++i) { - WebCore::IntRect rect = rects[i]; - region.unite(rect); - } - m_private->setNonFastScrollableRegion(region); - -} - -void WebScrollableLayer::setIsContainerForFixedPositionLayers(bool enable) -{ - m_private->setIsContainerForFixedPositionLayers(enable); -} - -void WebScrollableLayer::setFixedToContainerLayer(bool enable) -{ - m_private->setFixedToContainerLayer(enable); -} - -} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebScrollbarLayer.cpp b/Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp index 2bd1b20fb..ec6e9895d 100644 --- a/Source/WebKit/chromium/src/WebScrollbarLayer.cpp +++ b/Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp @@ -24,39 +24,42 @@ */ #include "config.h" -#include <public/WebScrollbarLayer.h> +#include "WebScrollbarLayerImpl.h" #include "ScrollbarLayerChromium.h" +#include "WebLayerImpl.h" -using namespace WebCore; +using WebCore::Scrollbar; +using WebCore::ScrollbarLayerChromium; namespace WebKit { -void WebScrollbarLayer::setScrollLayer(const WebLayer layer) +WebScrollbarLayer* WebScrollbarLayer::create(WebCore::Scrollbar* scrollbar, WebScrollbarThemePainter painter, PassOwnPtr<WebScrollbarThemeGeometry> geometry) { - int id = layer.isNull() ? 0 : layer.constUnwrap<LayerChromium>()->id(); - unwrap<ScrollbarLayerChromium>()->setScrollLayerId(id); + return new WebScrollbarLayerImpl(ScrollbarLayerChromium::create(WebScrollbar::create(scrollbar), painter, geometry, 0)); } -WebScrollbarLayer WebScrollbarLayer::create(WebCore::Scrollbar* scrollbar, WebScrollbarThemePainter painter, PassOwnPtr<WebScrollbarThemeGeometry> geometry) + +WebScrollbarLayerImpl::WebScrollbarLayerImpl(PassRefPtr<WebCore::ScrollbarLayerChromium> layer) + : m_layer(adoptPtr(new WebLayerImpl(layer))) { - return WebScrollbarLayer(ScrollbarLayerChromium::create(WebScrollbar::create(scrollbar), painter, geometry, 0)); } -WebScrollbarLayer::WebScrollbarLayer(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>& layer) - : WebLayer(layer) +WebScrollbarLayerImpl::~WebScrollbarLayerImpl() { } -WebScrollbarLayer& WebScrollbarLayer::operator=(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>& layer) +WebLayer* WebScrollbarLayerImpl::layer() { - m_private = layer; - return *this; + return m_layer.get(); } -WebScrollbarLayer::operator PassRefPtr<ScrollbarLayerChromium>() const +void WebScrollbarLayerImpl::setScrollLayer(WebLayer* layer) { - return unwrap<ScrollbarLayerChromium>(); + int id = layer ? static_cast<WebLayerImpl*>(layer)->layer()->id() : 0; + static_cast<ScrollbarLayerChromium*>(m_layer->layer())->setScrollLayerId(id); } + + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h b/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h new file mode 100644 index 000000000..720f79c55 --- /dev/null +++ b/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h @@ -0,0 +1,55 @@ +/* + * 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: + * + * 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 WebScrollbarLayerImpl_h +#define WebScrollbarLayerImpl_h + +#include <public/WebScrollbarLayer.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassRefPtr.h> + +namespace WebCore { +class ScrollbarLayerChromium; +} + +namespace WebKit { +class WebLayerImpl; + +class WebScrollbarLayerImpl : public WebScrollbarLayer { +public: + explicit WebScrollbarLayerImpl(PassRefPtr<WebCore::ScrollbarLayerChromium>); + virtual ~WebScrollbarLayerImpl(); + + // WebScrollbarLayer implementation. + virtual WebLayer* layer() OVERRIDE; + virtual void setScrollLayer(WebLayer*) OVERRIDE; + +private: + OwnPtr<WebLayerImpl> m_layer; +}; + +} + +#endif // WebScrollbarLayerImpl_h diff --git a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp index 33b1a30e3..94404262c 100644 --- a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp @@ -26,24 +26,37 @@ #include "config.h" #include "WebSolidColorLayerImpl.h" -using namespace WebCore; +#include "SolidColorLayerChromium.h" +#include "WebLayerImpl.h" + +using WebCore::SolidColorLayerChromium; namespace WebKit { -PassRefPtr<WebSolidColorLayerImpl> WebSolidColorLayerImpl::create() +WebSolidColorLayer* WebSolidColorLayer::create() { - return adoptRef(new WebSolidColorLayerImpl()); + return new WebSolidColorLayerImpl(SolidColorLayerChromium::create()); } -WebSolidColorLayerImpl::WebSolidColorLayerImpl() - : SolidColorLayerChromium() +WebSolidColorLayerImpl::WebSolidColorLayerImpl(PassRefPtr<SolidColorLayerChromium> layer) + : m_layer(adoptPtr(new WebLayerImpl(layer))) { - setIsDrawable(true); + m_layer->layer()->setIsDrawable(true); } WebSolidColorLayerImpl::~WebSolidColorLayerImpl() { } +WebLayer* WebSolidColorLayerImpl::layer() +{ + return m_layer.get(); +} + +void WebSolidColorLayerImpl::setBackgroundColor(WebColor color) +{ + m_layer->setBackgroundColor(color); +} + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h index d2673b42b..7742ba492 100644 --- a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h +++ b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h @@ -26,18 +26,28 @@ #ifndef WebSolidColorLayerImpl_h #define WebSolidColorLayerImpl_h -#include "SolidColorLayerChromium.h" +#include <public/WebSolidColorLayer.h> +#include <wtf/OwnPtr.h> #include <wtf/PassRefPtr.h> +namespace WebCore { +class SolidColorLayerChromium; +} + namespace WebKit { +class WebLayerImpl; -class WebSolidColorLayerImpl : public WebCore::SolidColorLayerChromium { +class WebSolidColorLayerImpl : public WebSolidColorLayer { public: - static PassRefPtr<WebSolidColorLayerImpl> create(); - -protected: - WebSolidColorLayerImpl(); + explicit WebSolidColorLayerImpl(PassRefPtr<WebCore::SolidColorLayerChromium>); virtual ~WebSolidColorLayerImpl(); + + // WebSolidColorLayer implementation. + virtual WebLayer* layer() OVERRIDE; + virtual void setBackgroundColor(WebColor) OVERRIDE; + +private: + OwnPtr<WebLayerImpl> m_layer; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebVideoLayerImpl.cpp b/Source/WebKit/chromium/src/WebVideoLayerImpl.cpp new file mode 100644 index 000000000..5bfed6742 --- /dev/null +++ b/Source/WebKit/chromium/src/WebVideoLayerImpl.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2011 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. + */ + +#include "config.h" +#include "WebVideoLayerImpl.h" + +#include "VideoLayerChromium.h" +#include "WebLayerImpl.h" + +namespace WebKit { + +WebVideoLayer* WebVideoLayer::create(WebVideoFrameProvider* provider) +{ + return new WebVideoLayerImpl(WebCore::VideoLayerChromium::create(provider)); +} + +WebVideoLayerImpl::WebVideoLayerImpl(PassRefPtr<WebCore::VideoLayerChromium> layer) + : m_layer(adoptPtr(new WebLayerImpl(layer))) +{ +} + +WebVideoLayerImpl::~WebVideoLayerImpl() +{ +} + +WebLayer* WebVideoLayerImpl::layer() +{ + return m_layer.get(); +} + +bool WebVideoLayerImpl::active() const +{ + return m_layer->layer()->layerTreeHost(); +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebVideoLayer.cpp b/Source/WebKit/chromium/src/WebVideoLayerImpl.h index 0f342155d..287e4b5e2 100644 --- a/Source/WebKit/chromium/src/WebVideoLayer.cpp +++ b/Source/WebKit/chromium/src/WebVideoLayerImpl.h @@ -23,25 +23,32 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#include "VideoLayerChromium.h" +#ifndef WebVideoLayerImpl_h +#define WebVideoLayerImpl_h + #include <public/WebVideoLayer.h> +namespace WebCore { +class VideoLayerChromium; +} + namespace WebKit { +class WebLayerImpl; -WebVideoLayer WebVideoLayer::create(WebVideoFrameProvider* provider) -{ - return WebVideoLayer(WebCore::VideoLayerChromium::create(provider)); -} +class WebVideoLayerImpl : public WebVideoLayer { +public: + explicit WebVideoLayerImpl(PassRefPtr<WebCore::VideoLayerChromium>); + virtual ~WebVideoLayerImpl(); -WebVideoLayer::WebVideoLayer(PassRefPtr<WebCore::VideoLayerChromium> layer) - : WebLayer(layer) -{ -} + // WebVideoLayer implementation. + virtual WebLayer* layer() OVERRIDE; + virtual bool active() const OVERRIDE; + +private: + OwnPtr<WebLayerImpl> m_layer; +}; -bool WebVideoLayer::active() const -{ - return m_private->layerTreeHost(); } -} // namespace WebKit +#endif // WebVideoLayerImpl_h + diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index b18e20944..c6f9f7e09 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -83,6 +83,7 @@ #include "KeyboardCodes.h" #include "KeyboardEvent.h" #include "LayerPainterChromium.h" +#include "LinkHighlight.h" #include "MIMETypeRegistry.h" #include "NodeRenderStyle.h" #include "NonCompositedContentHost.h" @@ -408,6 +409,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) , m_isCancelingFullScreen(false) , m_benchmarkSupport(this) #if USE(ACCELERATED_COMPOSITING) + , m_rootLayer(0) , m_rootGraphicsLayer(0) , m_isAcceleratedCompositingActive(false) , m_compositorCreationFailed(false) @@ -728,10 +730,17 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) m_contextMenuAllowed = false; return handled; } + case WebInputEvent::GestureTapDown: { + // Queue a highlight animation, then hand off to regular handler. +#if OS(LINUX) + enableTouchHighlight(IntPoint(event.x, event.y)); +#endif + PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); + return mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent); + } case WebInputEvent::GestureScrollBegin: case WebInputEvent::GestureScrollEnd: case WebInputEvent::GestureScrollUpdate: - case WebInputEvent::GestureTapDown: case WebInputEvent::GestureDoubleTap: case WebInputEvent::GesturePinchBegin: case WebInputEvent::GesturePinchEnd: @@ -1116,6 +1125,53 @@ void WebViewImpl::computeScaleAndScrollForHitRect(const WebRect& hitRect, AutoZo scroll.x = rect.x; scroll.y = rect.y; } + +static bool highlightConditions(Node* node) +{ + return node->isLink() + || node->supportsFocus() + || node->hasEventListeners(eventNames().clickEvent) + || node->hasEventListeners(eventNames().mousedownEvent) + || node->hasEventListeners(eventNames().mouseupEvent); +} + +Node* WebViewImpl::bestTouchLinkNode(IntPoint touchEventLocation) +{ + if (!m_page || !m_page->mainFrame()) + return 0; + + Node* bestTouchNode = 0; + + // FIXME: Should accept a search region from the caller instead of hard-coding the size. + IntSize touchEventSearchRegionSize(4, 2); + m_page->mainFrame()->eventHandler()->bestClickableNodeForTouchPoint(touchEventLocation, touchEventSearchRegionSize, touchEventLocation, bestTouchNode); + // bestClickableNodeForTouchPoint() doesn't always return a node that is a link, so let's try and find + // a link to highlight. + while (bestTouchNode && !highlightConditions(bestTouchNode)) + bestTouchNode = bestTouchNode->parentNode(); + + return bestTouchNode; +} + +void WebViewImpl::enableTouchHighlight(IntPoint touchEventLocation) +{ + Node* touchNode = bestTouchLinkNode(touchEventLocation); + + if (!touchNode || !touchNode->renderer() || !touchNode->renderer()->enclosingLayer()) + return; + + Color highlightColor = touchNode->renderer()->style()->tapHighlightColor(); + // Safari documentation for -webkit-tap-highlight-color says if the specified color has 0 alpha, + // then tap highlighting is disabled. + // http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safaricssref/articles/standardcssproperties.html + if (!highlightColor.alpha()) + return; + + // This will clear any highlight currently being displayed. + m_linkHighlight = LinkHighlight::create(touchNode, this); + m_linkHighlight->startHighlightAnimation(); +} + #endif void WebViewImpl::animateZoomAroundPoint(const IntPoint& point, AutoZoomType zoomType) @@ -1653,6 +1709,9 @@ void WebViewImpl::layout() { TRACE_EVENT0("webkit", "WebViewImpl::layout"); PageWidgetDelegate::layout(m_page.get()); + + if (m_linkHighlight) + m_linkHighlight->updateGeometry(); } #if USE(ACCELERATED_COMPOSITING) @@ -1685,9 +1744,15 @@ void WebViewImpl::doPixelReadbackToCanvas(WebCanvas* canvas, const IntRect& rect } #endif -void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) +void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect, PaintOptions option) { - if (isAcceleratedCompositingActive()) { +#if !OS(ANDROID) + // ReadbackFromCompositorIfAvailable is the only option available on non-Android. + // Ideally, Android would always use ReadbackFromCompositorIfAvailable as well. + ASSERT(option == ReadbackFromCompositorIfAvailable); +#endif + + if (option == ReadbackFromCompositorIfAvailable && isAcceleratedCompositingActive()) { #if USE(ACCELERATED_COMPOSITING) // If a canvas was passed in, we use it to grab a copy of the // freshly-rendered pixels. @@ -1699,12 +1764,24 @@ void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) } #endif } else { + FrameView* view = page()->mainFrame()->view(); + PaintBehavior oldPaintBehavior = view->paintBehavior(); + if (isAcceleratedCompositingActive()) { + ASSERT(option == ForceSoftwareRenderingAndIgnoreGPUResidentContent); + view->setPaintBehavior(oldPaintBehavior | PaintBehaviorFlattenCompositingLayers); + } + double paintStart = currentTime(); PageWidgetDelegate::paint(m_page.get(), pageOverlays(), canvas, rect, isTransparent() ? PageWidgetDelegate::Translucent : PageWidgetDelegate::Opaque); double paintEnd = currentTime(); double pixelsPerSec = (rect.width * rect.height) / (paintEnd - paintStart); WebKit::Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintDurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30); WebKit::Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30); + + if (isAcceleratedCompositingActive()) { + ASSERT(option == ForceSoftwareRenderingAndIgnoreGPUResidentContent); + view->setPaintBehavior(oldPaintBehavior); + } } } @@ -3564,6 +3641,7 @@ bool WebViewImpl::allowsAcceleratedCompositing() void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) { m_rootGraphicsLayer = layer; + m_rootLayer = layer ? layer->platformLayer() : 0; setIsAcceleratedCompositingActive(layer); if (m_nonCompositedContentHost) { @@ -3577,11 +3655,8 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) m_nonCompositedContentHost->setScrollLayer(scrollLayer); } - if (layer) - m_rootLayer = *layer->platformLayer(); - if (!m_layerTreeView.isNull()) - m_layerTreeView.setRootLayer(layer ? &m_rootLayer : 0); + m_layerTreeView.setRootLayer(m_rootLayer); IntRect damagedRect(0, 0, m_size.width, m_size.height); if (!m_isAcceleratedCompositingActive) @@ -3694,7 +3769,7 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->showDebugBorders()); m_nonCompositedContentHost->setOpaque(!isTransparent()); - m_layerTreeView.initialize(this, m_rootLayer, layerTreeViewSettings); + m_layerTreeView.initialize(this, *m_rootLayer, layerTreeViewSettings); if (!m_layerTreeView.isNull()) { if (m_webSettings->applyDefaultDeviceScaleFactorInCompositor() && page()->deviceScaleFactor() != 1) { ASSERT(page()->deviceScaleFactor()); diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index b8dcad717..206cf4572 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -94,6 +94,7 @@ class ContextMenuClientImpl; class DeviceOrientationClientProxy; class DragScrollTimer; class GeolocationClientProxy; +class LinkHighlight; class WebHelperPluginImpl; class NonCompositedContentHost; class PrerendererClientImpl; @@ -143,7 +144,7 @@ public: virtual void setCompositorSurfaceReady(); virtual void animate(double); virtual void layout(); // Also implements WebLayerTreeViewClient::layout() - virtual void paint(WebCanvas*, const WebRect&); + virtual void paint(WebCanvas*, const WebRect&, PaintOptions = ReadbackFromCompositorIfAvailable); virtual void themeChanged(); virtual void composite(bool finish); virtual void setNeedsRedraw(); @@ -563,6 +564,8 @@ public: #if ENABLE(GESTURE_EVENTS) void computeScaleAndScrollForHitRect(const WebRect& hitRect, AutoZoomType, float& scale, WebPoint& scroll); + WebCore::Node* bestTouchLinkNode(WebCore::IntPoint touchEventLocation); + void enableTouchHighlight(WebCore::IntPoint touchEventLocation); #endif void animateZoomAroundPoint(const WebCore::IntPoint&, AutoZoomType); @@ -586,6 +589,12 @@ public: virtual bool isPointerLocked(); #endif +#if ENABLE(GESTURE_EVENTS) + // Exposed for tests. + LinkHighlight* linkHighlight() { return m_linkHighlight.get(); } +#endif + + private: bool computePageScaleFactorLimits(); float clampPageScaleFactorToLimits(float scale); @@ -816,7 +825,7 @@ private: WebCore::IntRect m_rootLayerScrollDamage; OwnPtr<NonCompositedContentHost> m_nonCompositedContentHost; WebLayerTreeView m_layerTreeView; - WebLayer m_rootLayer; + WebLayer* m_rootLayer; WebCore::GraphicsLayer* m_rootGraphicsLayer; bool m_isAcceleratedCompositingActive; bool m_compositorCreationFailed; @@ -852,6 +861,9 @@ private: WebPoint m_lastWheelPosition; WebPoint m_lastWheelGlobalPosition; int m_flingModifier; +#if ENABLE(GESTURE_EVENTS) + OwnPtr<LinkHighlight> m_linkHighlight; +#endif }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp index c6fd50589..ccf90ca40 100644 --- a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp @@ -93,8 +93,9 @@ void WebWorkerClientImpl::startWorkerContext(const KURL& scriptURL, const String if (document->page()) settings = document->page()->group().groupSettings(); RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, userAgent, settings, sourceCode, *this, *this, startMode, - m_scriptExecutionContext->contentSecurityPolicy()->deprecatedHeader(), - m_scriptExecutionContext->contentSecurityPolicy()->deprecatedHeaderType()); + document->contentSecurityPolicy()->deprecatedHeader(), + document->contentSecurityPolicy()->deprecatedHeaderType(), + document->topDocument()->securityOrigin()); m_proxy->workerThreadCreated(thread); thread->start(); InspectorInstrumentation::didStartWorkerContext(m_scriptExecutionContext.get(), m_proxy, scriptURL); diff --git a/Source/WebKit/chromium/src/mac/WebSubstringUtil.mm b/Source/WebKit/chromium/src/mac/WebSubstringUtil.mm index 7fd19f536..dd9951f83 100644 --- a/Source/WebKit/chromium/src/mac/WebSubstringUtil.mm +++ b/Source/WebKit/chromium/src/mac/WebSubstringUtil.mm @@ -36,6 +36,7 @@ #include "ColorMac.h" #include "Document.h" #include "Element.h" +#include "Font.h" #include "Frame.h" #include "FrameView.h" #include "HTMLElement.h" diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp index ac04b505e..0b5aa6be6 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp @@ -46,6 +46,27 @@ using namespace WebCore; using namespace WebKitTests; using WebKit::WebTransformationMatrix; +void WebKitTests::ExpectTransformationMatrixEq(WebTransformationMatrix expected, + WebTransformationMatrix actual) +{ + EXPECT_FLOAT_EQ((expected).m11(), (actual).m11()); + EXPECT_FLOAT_EQ((expected).m12(), (actual).m12()); + EXPECT_FLOAT_EQ((expected).m13(), (actual).m13()); + EXPECT_FLOAT_EQ((expected).m14(), (actual).m14()); + EXPECT_FLOAT_EQ((expected).m21(), (actual).m21()); + EXPECT_FLOAT_EQ((expected).m22(), (actual).m22()); + EXPECT_FLOAT_EQ((expected).m23(), (actual).m23()); + EXPECT_FLOAT_EQ((expected).m24(), (actual).m24()); + EXPECT_FLOAT_EQ((expected).m31(), (actual).m31()); + EXPECT_FLOAT_EQ((expected).m32(), (actual).m32()); + EXPECT_FLOAT_EQ((expected).m33(), (actual).m33()); + EXPECT_FLOAT_EQ((expected).m34(), (actual).m34()); + EXPECT_FLOAT_EQ((expected).m41(), (actual).m41()); + EXPECT_FLOAT_EQ((expected).m42(), (actual).m42()); + EXPECT_FLOAT_EQ((expected).m43(), (actual).m43()); + EXPECT_FLOAT_EQ((expected).m44(), (actual).m44()); +} + namespace { template<typename LayerType> diff --git a/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h b/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h index 5c01c8049..7f7e20279 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h +++ b/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h @@ -25,6 +25,8 @@ #ifndef CCLayerTreeTestCommon_h #define CCLayerTreeTestCommon_h +#include <public/WebTransformationMatrix.h> + namespace WebKitTests { // These are macros instead of functions so that we get useful line numbers where a test failed. @@ -40,26 +42,18 @@ namespace WebKitTests { EXPECT_EQ((expected).size().width(), (actual).size().width()); \ EXPECT_EQ((expected).size().height(), (actual).size().height()) -// This is a macro instead of a function so that we get useful line numbers where a test failed. -// Even though WebTransformationMatrix values are double precision, there are many other floating-point values used that affect -// the transforms, and so we only expect them to be accurate up to floating-point precision. -#define EXPECT_TRANSFORMATION_MATRIX_EQ(expected, actual) \ - EXPECT_FLOAT_EQ((expected).m11(), (actual).m11()); \ - EXPECT_FLOAT_EQ((expected).m12(), (actual).m12()); \ - EXPECT_FLOAT_EQ((expected).m13(), (actual).m13()); \ - EXPECT_FLOAT_EQ((expected).m14(), (actual).m14()); \ - EXPECT_FLOAT_EQ((expected).m21(), (actual).m21()); \ - EXPECT_FLOAT_EQ((expected).m22(), (actual).m22()); \ - EXPECT_FLOAT_EQ((expected).m23(), (actual).m23()); \ - EXPECT_FLOAT_EQ((expected).m24(), (actual).m24()); \ - EXPECT_FLOAT_EQ((expected).m31(), (actual).m31()); \ - EXPECT_FLOAT_EQ((expected).m32(), (actual).m32()); \ - EXPECT_FLOAT_EQ((expected).m33(), (actual).m33()); \ - EXPECT_FLOAT_EQ((expected).m34(), (actual).m34()); \ - EXPECT_FLOAT_EQ((expected).m41(), (actual).m41()); \ - EXPECT_FLOAT_EQ((expected).m42(), (actual).m42()); \ - EXPECT_FLOAT_EQ((expected).m43(), (actual).m43()); \ - EXPECT_FLOAT_EQ((expected).m44(), (actual).m44()) +// This is a function rather than a macro because when this is included as a macro +// in bulk, it causes a significant slow-down in compilation time. This problem +// exists with both gcc and clang, and bugs have been filed at +// http://llvm.org/bugs/show_bug.cgi?id=13651 and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54337 +void ExpectTransformationMatrixEq(WebKit::WebTransformationMatrix expected, + WebKit::WebTransformationMatrix actual); + +#define EXPECT_TRANSFORMATION_MATRIX_EQ(expected, actual) \ + { \ + SCOPED_TRACE(""); \ + WebKitTests::ExpectTransformationMatrixEq(expected, actual); \ + } } // namespace diff --git a/Source/WebKit/chromium/tests/CCResourceProviderTest.cpp b/Source/WebKit/chromium/tests/CCResourceProviderTest.cpp index 9e8599c0f..e55c3c5d7 100644 --- a/Source/WebKit/chromium/tests/CCResourceProviderTest.cpp +++ b/Source/WebKit/chromium/tests/CCResourceProviderTest.cpp @@ -287,23 +287,36 @@ private: PendingProduceTextureList m_pendingProduceTextures; }; -class CCResourceProviderTest : public testing::Test { +class CCResourceProviderTest : public testing::TestWithParam<CCResourceProvider::ResourceType> { public: CCResourceProviderTest() : m_sharedData(ContextSharedData::create()) , m_context(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()))) , m_resourceProvider(CCResourceProvider::create(m_context.get())) { + m_resourceProvider->setDefaultResourceType(GetParam()); } ResourceProviderContext* context() { return static_cast<ResourceProviderContext*>(m_context->context3D()); } void getResourcePixels(CCResourceProvider::ResourceId id, const IntSize& size, WGC3Denum format, uint8_t* pixels) { - CCScopedLockResourceForRead lock(m_resourceProvider.get(), id); - ASSERT_NE(0U, lock.textureId()); - context()->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.textureId()); - context()->getPixels(size, format, pixels); + if (GetParam() == CCResourceProvider::GLTexture) { + CCResourceProvider::ScopedReadLockGL lockGL(m_resourceProvider.get(), id); + ASSERT_NE(0U, lockGL.textureId()); + context()->bindTexture(GraphicsContext3D::TEXTURE_2D, lockGL.textureId()); + context()->getPixels(size, format, pixels); + } else if (GetParam() == CCResourceProvider::Bitmap) { + CCResourceProvider::ScopedReadLockSoftware lockSoftware(m_resourceProvider.get(), id); + memcpy(pixels, lockSoftware.skBitmap()->getPixels(), lockSoftware.skBitmap()->getSize()); + } + } + + void expectNumResources(int count) + { + EXPECT_EQ(count, static_cast<int>(m_resourceProvider->numResources())); + if (GetParam() == CCResourceProvider::GLTexture) + EXPECT_EQ(count, context()->textureCount()); } protected: @@ -313,7 +326,7 @@ protected: OwnPtr<CCResourceProvider> m_resourceProvider; }; -TEST_F(CCResourceProviderTest, Basic) +TEST_P(CCResourceProviderTest, Basic) { IntSize size(1, 1); WGC3Denum format = GraphicsContext3D::RGBA; @@ -322,7 +335,7 @@ TEST_F(CCResourceProviderTest, Basic) ASSERT_EQ(4U, pixelSize); CCResourceProvider::ResourceId id = m_resourceProvider->createResource(pool, size, format, CCResourceProvider::TextureUsageAny); - EXPECT_EQ(1, context()->textureCount()); + expectNumResources(1); uint8_t data[4] = {1, 2, 3, 4}; IntRect rect(IntPoint(), size); @@ -333,10 +346,10 @@ TEST_F(CCResourceProviderTest, Basic) EXPECT_EQ(0, memcmp(data, result, pixelSize)); m_resourceProvider->deleteResource(id); - EXPECT_EQ(0, context()->textureCount()); + expectNumResources(0); } -TEST_F(CCResourceProviderTest, DeleteOwnedResources) +TEST_P(CCResourceProviderTest, DeleteOwnedResources) { IntSize size(1, 1); WGC3Denum format = GraphicsContext3D::RGBA; @@ -345,16 +358,16 @@ TEST_F(CCResourceProviderTest, DeleteOwnedResources) const int count = 3; for (int i = 0; i < count; ++i) m_resourceProvider->createResource(pool, size, format, CCResourceProvider::TextureUsageAny); - EXPECT_EQ(3, context()->textureCount()); + expectNumResources(3); m_resourceProvider->deleteOwnedResources(pool+1); - EXPECT_EQ(3, context()->textureCount()); + expectNumResources(3); m_resourceProvider->deleteOwnedResources(pool); - EXPECT_EQ(0, context()->textureCount()); + expectNumResources(0); } -TEST_F(CCResourceProviderTest, Upload) +TEST_P(CCResourceProviderTest, Upload) { IntSize size(2, 2); WGC3Denum format = GraphicsContext3D::RGBA; @@ -402,12 +415,28 @@ TEST_F(CCResourceProviderTest, Upload) getResourcePixels(id, size, format, result); EXPECT_EQ(0, memcmp(expected, result, pixelSize)); } + { + IntRect offsetImageRect(IntPoint(100, 100), size); + IntRect sourceRect(100, 100, 1, 1); + IntSize destOffset(1, 0); + m_resourceProvider->upload(id, image, offsetImageRect, sourceRect, destOffset); + + uint8_t expected[16] = {0, 1, 2, 3, 0, 1, 2, 3, + 4, 5, 6, 7, 0, 1, 2, 3}; + getResourcePixels(id, size, format, result); + EXPECT_EQ(0, memcmp(expected, result, pixelSize)); + } + m_resourceProvider->deleteResource(id); } -TEST_F(CCResourceProviderTest, TransferResources) +TEST_P(CCResourceProviderTest, TransferResources) { + // Resource transfer is only supported with GL textures for now. + if (GetParam() != CCResourceProvider::GLTexture) + return; + OwnPtr<CCGraphicsContext> childContext(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()))); OwnPtr<CCResourceProvider> childResourceProvider(CCResourceProvider::create(childContext.get())); @@ -486,14 +515,14 @@ TEST_F(CCResourceProviderTest, TransferResources) ResourceProviderContext* childContext3D = static_cast<ResourceProviderContext*>(childContext->context3D()); { - CCScopedLockResourceForRead lock(childResourceProvider.get(), id1); + CCResourceProvider::ScopedReadLockGL lock(childResourceProvider.get(), id1); ASSERT_NE(0U, lock.textureId()); childContext3D->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.textureId()); childContext3D->getPixels(size, format, result); EXPECT_EQ(0, memcmp(data1, result, pixelSize)); } { - CCScopedLockResourceForRead lock(childResourceProvider.get(), id2); + CCResourceProvider::ScopedReadLockGL lock(childResourceProvider.get(), id2); ASSERT_NE(0U, lock.textureId()); childContext3D->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.textureId()); childContext3D->getPixels(size, format, result); @@ -519,4 +548,9 @@ TEST_F(CCResourceProviderTest, TransferResources) EXPECT_EQ(0u, m_resourceProvider->mailboxCount()); } +INSTANTIATE_TEST_CASE_P(CCResourceProviderTests, + CCResourceProviderTest, + ::testing::Values(CCResourceProvider::GLTexture, + CCResourceProvider::Bitmap)); + } // namespace diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp index 58f37c694..dcaae59ce 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp @@ -115,11 +115,6 @@ void FakeTiledLayerChromium::setNeedsDisplayRect(const FloatRect& rect) TiledLayerChromium::setNeedsDisplayRect(rect); } -void FakeTiledLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusionTracker* occlusion, CCRenderingStats& stats) -{ - updateContentRect(queue, visibleContentRect(), occlusion, stats); -} - void FakeTiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& calculator) { // Ensure there is always a target render surface available. If none has been diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h index 5de1c5fb3..3adb4bf17 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h @@ -112,7 +112,6 @@ public: static WebCore::IntSize tileSize() { return WebCore::IntSize(100, 100); } using WebCore::TiledLayerChromium::invalidateContentRect; - using WebCore::TiledLayerChromium::updateContentRect; using WebCore::TiledLayerChromium::needsIdlePaint; using WebCore::TiledLayerChromium::skipsDraw; using WebCore::TiledLayerChromium::numPaintedTiles; @@ -121,9 +120,6 @@ public: virtual void setNeedsDisplayRect(const WebCore::FloatRect&) OVERRIDE; const WebCore::FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; } - // Updates the visibleContentRect(). - virtual void update(WebCore::CCTextureUpdateQueue&, const WebCore::CCOcclusionTracker*, WebCore::CCRenderingStats&) OVERRIDE; - virtual void setTexturePriorities(const WebCore::CCPriorityCalculator&) OVERRIDE; virtual WebCore::CCPrioritizedTextureManager* textureManager() const OVERRIDE { return m_textureManager; } diff --git a/Source/WebKit/chromium/tests/IDBKeyPathTest.cpp b/Source/WebKit/chromium/tests/IDBKeyPathTest.cpp index 7d662c009..c3d47d788 100644 --- a/Source/WebKit/chromium/tests/IDBKeyPathTest.cpp +++ b/Source/WebKit/chromium/tests/IDBKeyPathTest.cpp @@ -26,6 +26,10 @@ #include "config.h" #include "IDBKeyPath.h" +#include "IDBBindingUtilities.h" +#include "IDBKey.h" +#include "SerializedScriptValue.h" + #include <gtest/gtest.h> #include <wtf/Vector.h> @@ -123,6 +127,92 @@ TEST(IDBKeyPathTest, InvalidKeyPath5) checkKeyPath(keyPath, expected, 3); } +TEST(IDBKeyPathTest, Extract) +{ + IDBKeyPath keyPath("foo"); + RefPtr<IDBKey> stringZooKey(IDBKey::createString("zoo")); + RefPtr<IDBKey> invalidKey(IDBKey::createInvalid()); + RefPtr<SerializedScriptValue> ssv; + RefPtr<IDBKey> result; + + // keypath: "foo", value: {foo: "zoo"}, expected: "zoo" + UChar dataFooZoo[] = {0x0353, 0x6f66, 0x536f, 0x7a03, 0x6f6f, 0x017b}; + ssv = SerializedScriptValue::createFromWire(String(dataFooZoo, WTF_ARRAY_LENGTH(dataFooZoo))); + result = createIDBKeyFromSerializedValueAndKeyPath(ssv, keyPath); + EXPECT_TRUE(stringZooKey->isEqual(result.get())); + + // keypath: "foo", value: {foo: null}, expected: invalid + UChar dataFooNull[] = {0x0353, 0x6f66, 0x306f, 0x017b}; + ssv = SerializedScriptValue::createFromWire(String(dataFooNull, WTF_ARRAY_LENGTH(dataFooNull))); + result = createIDBKeyFromSerializedValueAndKeyPath(ssv, keyPath); + EXPECT_FALSE(result->isValid()); + + // keypath: "foo", value: {}, expected: null + UChar dataObject[] = {0x017b}; + ssv = SerializedScriptValue::createFromWire(String(dataObject, WTF_ARRAY_LENGTH(dataObject))); + result = createIDBKeyFromSerializedValueAndKeyPath(ssv, keyPath); + EXPECT_EQ(0, result.get()); + + // keypath: "foo", value: null, expected: null + ssv = SerializedScriptValue::nullValue(); + result = createIDBKeyFromSerializedValueAndKeyPath(ssv, keyPath); + EXPECT_EQ(0, result.get()); +} + +TEST(IDBKeyPathTest, IDBKeyPathPropertyNotAvailable) +{ + IDBKeyPath keyPath("PropertyNotAvailable"); + RefPtr<SerializedScriptValue> ssv; + // {foo: "zoo", bar: null} + UChar data[] = {0x0353, 0x6f66, 0x536f, 0x7a03, 0x6f6f, 0x0353, 0x6162, + 0x3072, 0x027b}; + ssv = SerializedScriptValue::createFromWire(String(data, WTF_ARRAY_LENGTH(data))); + RefPtr<IDBKey> result = createIDBKeyFromSerializedValueAndKeyPath(ssv, keyPath); + EXPECT_EQ(0, result.get()); + + // null + ssv = SerializedScriptValue::nullValue(); + result = createIDBKeyFromSerializedValueAndKeyPath(ssv, keyPath); + EXPECT_EQ(0, result.get()); +} + +TEST(IDBKeyPathTest, InjectIDBKey) +{ + // {foo: 'zoo'} + const UChar initialData[] = {0x0353, 0x6f66, 0x536f, 0x7a03, 0x6f6f, 0x017b}; + RefPtr<SerializedScriptValue> value = SerializedScriptValue::createFromWire(String(initialData, WTF_ARRAY_LENGTH(initialData))); + + RefPtr<IDBKey> key = IDBKey::createString("myNewKey"); + IDBKeyPath keyPath("bar"); + + // {foo: 'zoo', bar: 'myNewKey'} + const UChar expectedData[] = {0x01ff, 0x003f, 0x3f6f, 0x5301, 0x6603, + 0x6f6f, 0x013f, 0x0353, 0x6f7a, 0x3f6f, + 0x5301, 0x6203, 0x7261, 0x013f, 0x0853, + 0x796d, 0x654e, 0x4b77, 0x7965, 0x027b}; + RefPtr<SerializedScriptValue> expectedValue = + SerializedScriptValue::createFromWire(String(expectedData, WTF_ARRAY_LENGTH(expectedData))); + RefPtr<SerializedScriptValue> result = injectIDBKeyIntoSerializedValue(key, value, keyPath); + EXPECT_EQ(expectedValue->toWireString(), result->toWireString()); + + // Should fail - can't apply properties to string value of key foo + keyPath = IDBKeyPath("foo.bad.path"); + result = injectIDBKeyIntoSerializedValue(key, value, keyPath); + EXPECT_EQ(0, result.get()); + + // {foo: 'zoo', bar: {baz: 'myNewKey'}} + const UChar expectedData2[] = {0x01ff, 0x003f, 0x3f6f, 0x5301, 0x6603, + 0x6f6f, 0x013f, 0x0353, 0x6f7a, 0x3f6f, + 0x5301, 0x6203, 0x7261, 0x013f, 0x3f6f, + 0x5302, 0x6203, 0x7a61, 0x023f, 0x0853, + 0x796d, 0x654e, 0x4b77, 0x7965, 0x017b, + 0x027b}; + RefPtr<SerializedScriptValue> expectedValue2 = SerializedScriptValue::createFromWire(String(expectedData2, WTF_ARRAY_LENGTH(expectedData2))); + keyPath = IDBKeyPath("bar.baz"); + result = injectIDBKeyIntoSerializedValue(key, value, keyPath); + EXPECT_EQ(expectedValue2->toWireString(), result->toWireString()); +} + } // namespace #endif // ENABLE(INDEXED_DATABASE) diff --git a/Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp index a5ca55124..4948f97cc 100644 --- a/Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp @@ -122,13 +122,13 @@ TEST(ImageLayerChromiumTest, opaqueImages) RefPtr<Image> nonOpaqueImage = TestImage::create(IntSize(100, 100), false); ASSERT_TRUE(nonOpaqueImage.get()); - ASSERT_TRUE(graphicsLayer->contentsLayer().isNull()); + ASSERT_FALSE(graphicsLayer->contentsLayer()); graphicsLayer->setContentsToImage(opaqueImage.get()); - ASSERT_TRUE(graphicsLayer->contentsLayer().opaque()); + ASSERT_TRUE(graphicsLayer->contentsLayer()->opaque()); graphicsLayer->setContentsToImage(nonOpaqueImage.get()); - ASSERT_FALSE(graphicsLayer->contentsLayer().opaque()); + ASSERT_FALSE(graphicsLayer->contentsLayer()->opaque()); } } // namespace diff --git a/Source/WebKit/chromium/tests/LinkHighlightTest.cpp b/Source/WebKit/chromium/tests/LinkHighlightTest.cpp index be467a0d5..64830ef22 100644 --- a/Source/WebKit/chromium/tests/LinkHighlightTest.cpp +++ b/Source/WebKit/chromium/tests/LinkHighlightTest.cpp @@ -26,62 +26,64 @@ #include "LinkHighlight.h" -#include "AnimationIdVendor.h" -#include "GraphicsLayerChromium.h" -#include "GraphicsLayerClient.h" +#include "FrameTestHelpers.h" #include "IntRect.h" -#include "Path.h" +#include "Node.h" +#include "URLTestHelpers.h" +#include "WebFrame.h" +#include "WebViewImpl.h" #include <gtest/gtest.h> -#include <public/WebTransformationMatrix.h> +#include <public/WebCompositor.h> +#include <public/WebContentLayer.h> +#include <public/WebFloatPoint.h> +#include <public/WebSize.h> #include <wtf/PassOwnPtr.h> +using namespace WebKit; using namespace WebCore; -using WebKit::WebTransformationMatrix; namespace { -class MockGraphicsLayerClient : public GraphicsLayerClient { -public: - virtual void notifyAnimationStarted(const GraphicsLayer*, double time) OVERRIDE { } - virtual void notifySyncRequired(const GraphicsLayer*) OVERRIDE { } - virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip) OVERRIDE { } - virtual bool showDebugBorders(const GraphicsLayer*) const OVERRIDE { return false; } - virtual bool showRepaintCounter(const GraphicsLayer*) const OVERRIDE { return false; } -}; - -TEST(LinkHighlightTest, verifyLinkHighlightLayer) +#if ENABLE(GESTURE_EVENTS) +TEST(LinkHighlightTest, verifyWebViewImplIntegration) { - Path highlightPath; - highlightPath.addRect(FloatRect(5, 6, 12, 8)); - IntRect pathBoundingRect = enclosingIntRect(highlightPath.boundingRect()); - - RefPtr<LinkHighlight> highlight = LinkHighlight::create(0, highlightPath, AnimationIdVendor::LinkHighlightAnimationId, AnimationIdVendor::getNextGroupId()); - ASSERT_TRUE(highlight.get()); - ContentLayerChromium* contentLayer = highlight->contentLayer(); - ASSERT_TRUE(contentLayer); - - EXPECT_EQ(pathBoundingRect.size(), contentLayer->bounds()); - EXPECT_TRUE(contentLayer->transform().isIdentityOrTranslation()); - EXPECT_TRUE(contentLayer->transform().isIntegerTranslation()); - - float expectedXTranslation = pathBoundingRect.x() + pathBoundingRect.width() / 2; - float expectedYTranslation = pathBoundingRect.y() + pathBoundingRect.height() / 2; - EXPECT_FLOAT_EQ(expectedXTranslation, contentLayer->transform().m41()); - EXPECT_FLOAT_EQ(expectedYTranslation, contentLayer->transform().m42()); -} + WebCompositor::initialize(0); -TEST(LinkHighlightTest, verifyGraphicsLayerChromiumEmbedding) -{ - MockGraphicsLayerClient client; - OwnPtr<GraphicsLayerChromium> graphicsLayer = static_pointer_cast<GraphicsLayerChromium>(GraphicsLayer::create(&client)); - ASSERT_TRUE(graphicsLayer.get()); + const std::string baseURL("http://www.test.com/"); + const std::string fileName("test_touch_link_highlight.html"); + + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8("test_touch_link_highlight.html")); + WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(baseURL + fileName, true)); + int pageWidth = 640; + int pageHeight = 480; + webViewImpl->resize(WebSize(pageWidth, pageHeight)); + webViewImpl->layout(); + + // The coordinates below are linked to absolute positions in the referenced .html file. + IntPoint touchEventLocation(20, 20); + Node* touchNode = webViewImpl->bestTouchLinkNode(touchEventLocation); + ASSERT_TRUE(touchNode); + + touchEventLocation = IntPoint(20, 40); + EXPECT_FALSE(webViewImpl->bestTouchLinkNode(touchEventLocation)); + + touchEventLocation = IntPoint(20, 20); + // Shouldn't crash. + + webViewImpl->enableTouchHighlight(touchEventLocation); + EXPECT_TRUE(webViewImpl->linkHighlight()); + EXPECT_TRUE(webViewImpl->linkHighlight()->contentLayer()); + EXPECT_TRUE(webViewImpl->linkHighlight()->clipLayer()); + + // Find a target inside a scrollable div - Path highlightPath; - highlightPath.addRect(FloatRect(5, 5, 10, 8)); + touchEventLocation = IntPoint(20, 100); + webViewImpl->enableTouchHighlight(touchEventLocation); + ASSERT_TRUE(webViewImpl->linkHighlight()); - // Neither of the following operations should crash. - graphicsLayer->addLinkHighlight(highlightPath); - graphicsLayer->didFinishLinkHighlight(); + webViewImpl->close(); + WebCompositor::shutdown(); } +#endif } // namespace diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index 689b817af..2efb8e5dc 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -77,6 +77,8 @@ class TiledLayerChromiumTest : public testing::Test { public: TiledLayerChromiumTest() : m_context(WebKit::createFakeCCGraphicsContext()) + , m_textureManager(CCPrioritizedTextureManager::create(60*1024*1024, 1024, CCRenderer::ContentPool)) + , m_occlusion(0) { DebugScopedSetImplThread implThread; m_resourceProvider = CCResourceProvider::create(m_context.get()); @@ -92,6 +94,42 @@ public: { CCTextureUpdateController::updateTextures(m_resourceProvider.get(), &m_copier, &m_uploader, &m_queue, count); } + + bool updateAndPush(FakeTiledLayerChromium* layer1, + CCLayerImpl* layerImpl1, + FakeTiledLayerChromium* layer2 = 0, + CCLayerImpl* layerImpl2 = 0) + { + // Get textures + m_textureManager->clearPriorities(); + if (layer1) + layer1->setTexturePriorities(m_priorityCalculator); + if (layer2) + layer2->setTexturePriorities(m_priorityCalculator); + m_textureManager->prioritizeTextures(); + + // Update content + if (layer1) + layer1->update(m_queue, m_occlusion, m_stats); + if (layer2) + layer2->update(m_queue, m_occlusion, m_stats); + + bool needsUpdate = false; + if (layer1) + needsUpdate |= layer1->needsIdlePaint(); + if (layer2) + needsUpdate |= layer2->needsIdlePaint(); + + // Update textures and push. + updateTextures(); + if (layer1) + layer1->pushPropertiesTo(layerImpl1); + if (layer2) + layer2->pushPropertiesTo(layerImpl2); + + return needsUpdate; + } + public: OwnPtr<CCGraphicsContext> m_context; OwnPtr<CCResourceProvider> m_resourceProvider; @@ -100,14 +138,13 @@ public: FakeTextureCopier m_copier; FakeTextureUploader m_uploader; CCPriorityCalculator m_priorityCalculator; + OwnPtr<CCPrioritizedTextureManager> m_textureManager; + TestCCOcclusionTracker* m_occlusion; }; - - TEST_F(TiledLayerChromiumTest, pushDirtyTiles) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -115,25 +152,17 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles) layer->setBounds(IntSize(100, 200)); layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer->invalidateContentRect(IntRect(0, 0, 100, 200)); - - layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - - layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats); - updateTextures(); - layer->pushPropertiesTo(layerImpl.get()); + updateAndPush(layer.get(), layerImpl.get()); // We should have both tiles on the impl side. EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); - // Invalidates both tiles... + // Invalidates both tiles, but then only update one of them. + layer->setBounds(IntSize(100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 100)); layer->invalidateContentRect(IntRect(0, 0, 100, 200)); - // ....but then only update one of them. - layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 100, 100), 0, m_stats); - layer->pushPropertiesTo(layerImpl.get()); + updateAndPush(layer.get(), layerImpl.get()); // We should only have the first tile since the other tile was invalidated but not painted. EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); @@ -142,24 +171,17 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles) TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); TestCCOcclusionTracker occluded; + m_occlusion = &occluded; // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); - layer->setDrawableContentRect(IntRect(0, 0, 100, 200)); layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer->invalidateContentRect(IntRect(0, 0, 100, 200)); - - layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - - layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), &occluded, m_stats); - updateTextures(); - layer->pushPropertiesTo(layerImpl.get()); + updateAndPush(layer.get(), layerImpl.get()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 20000, 1); @@ -173,9 +195,7 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) layer->invalidateContentRect(IntRect(0, 0, 50, 50)); // ....but the area is occluded. occluded.setOcclusion(IntRect(0, 0, 50, 50)); - layer->updateContentRect(m_queue, IntRect(0, 0, 100, 100), &occluded, m_stats); - updateTextures(); - layer->pushPropertiesTo(layerImpl.get()); + updateAndPush(layer.get(), layerImpl.get()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 20000 + 2500, 1); @@ -188,8 +208,7 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) TEST_F(TiledLayerChromiumTest, pushDeletedTiles) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -197,21 +216,15 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) layer->setBounds(IntSize(100, 200)); layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer->invalidateContentRect(IntRect(0, 0, 100, 200)); - - layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - - layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats); - updateTextures(); - layer->pushPropertiesTo(layerImpl.get()); + updateAndPush(layer.get(), layerImpl.get()); // We should have both tiles on the impl side. EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); - textureManager->clearPriorities(); - textureManager->clearAllMemory(m_resourceProvider.get()); - textureManager->setMaxMemoryLimitBytes(4*1024*1024); + m_textureManager->clearPriorities(); + m_textureManager->clearAllMemory(m_resourceProvider.get()); + m_textureManager->setMaxMemoryLimitBytes(4*1024*1024); // This should drop the tiles on the impl thread. layer->pushPropertiesTo(layerImpl.get()); @@ -220,203 +233,140 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); EXPECT_FALSE(layerImpl->hasTileAt(0, 1)); - // This should recreate and update the deleted textures. - layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 100, 100), 0, m_stats); - updateTextures(); - layer->pushPropertiesTo(layerImpl.get()); + // This should recreate and update one of the deleted textures. + layer->setVisibleContentRect(IntRect(0, 0, 100, 100)); + updateAndPush(layer.get(), layerImpl.get()); - // We should only have the first tile since the other tile was invalidated but not painted. + // We should have one tiles on the impl side. EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); EXPECT_FALSE(layerImpl->hasTileAt(0, 1)); } TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); // The tile size is 100x100. Setup 5x5 tiles with one visible tile in the center. - IntSize contentBounds(500, 500); - IntRect contentRect(IntPoint::zero(), contentBounds); - IntRect visibleRect(200, 200, 100, 100); - - // This invalidates 25 tiles and then paints one visible tile. - layer->setBounds(contentBounds); - layer->setVisibleContentRect(visibleRect); - layer->invalidateContentRect(contentRect); - - layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - - layer->updateContentRect(m_queue, visibleRect, 0, m_stats); - updateTextures(); - - // We should need idle-painting for 3x3 tiles in the center. - EXPECT_TRUE(layer->needsIdlePaint(visibleRect)); - - layer->pushPropertiesTo(layerImpl.get()); + // This paints 1 visible of the 25 invalid tiles. + layer->setBounds(IntSize(500, 500)); + layer->setVisibleContentRect(IntRect(200, 200, 100, 100)); + layer->invalidateContentRect(IntRect(0, 0, 500, 500)); + bool needsUpdate = updateAndPush(layer.get(), layerImpl.get()); + // We should need idle-painting for surrounding tiles. + EXPECT_TRUE(needsUpdate); // We should have one tile on the impl side. EXPECT_TRUE(layerImpl->hasTileAt(2, 2)); // For the next four updates, we should detect we still need idle painting. for (int i = 0; i < 4; i++) { - layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - - layer->updateContentRect(m_queue, visibleRect, 0, m_stats); - EXPECT_TRUE(layer->needsIdlePaint(visibleRect)); - updateTextures(); - layer->pushPropertiesTo(layerImpl.get()); + needsUpdate = updateAndPush(layer.get(), layerImpl.get()); + EXPECT_TRUE(needsUpdate); } - // After four passes of idle painting, we should be finished painting - // EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); - // We should have one tile surrounding the visible tile on all sides, but no other tiles. IntRect idlePaintTiles(1, 1, 3, 3); for (int i = 0; i < 5; i++) { - for (int j = 0; j < 5; j++) { - if (idlePaintTiles.contains(i, j)) - EXPECT_TRUE(layerImpl->hasTileAt(i, j)); - else - EXPECT_FALSE(layerImpl->hasTileAt(i, j)); - } + for (int j = 0; j < 5; j++) + EXPECT_EQ(layerImpl->hasTileAt(i, j), idlePaintTiles.contains(i, j)); } + + // We should always finish painting eventually. + for (int i = 0; i < 20; i++) + needsUpdate = updateAndPush(layer.get(), layerImpl.get()); + EXPECT_FALSE(needsUpdate); } TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) { // Start with 2mb of memory, but the test is going to try to use just more than 1mb, so we reduce to 1mb later. - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(2*1024*1024, 1024, CCRenderer::ContentPool); + m_textureManager->setMaxMemoryLimitBytes(2 * 1024 * 1024); DebugScopedSetImplThread implThread; - RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); OwnPtr<FakeCCTiledLayerImpl> layerImpl1(adoptPtr(new FakeCCTiledLayerImpl(1))); - RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); OwnPtr<FakeCCTiledLayerImpl> layerImpl2(adoptPtr(new FakeCCTiledLayerImpl(2))); // For this test we have two layers. layer1 exhausts most texture memory, leaving room for 2 more tiles from // layer2, but not all three tiles. First we paint layer1, and one tile from layer2. Then when we idle paint // layer2, we will fail on the third tile of layer2, and this should not leave the second tile in a bad state. + // This uses 960000 bytes, leaving 88576 bytes of memory left, which is enough for 2 tiles only in the other layer. + IntRect layer1Rect(0, 0, 100, 2400); + // This requires 4*30000 bytes of memory. IntRect layer2Rect(0, 0, 100, 300); - layer2->setBounds(layer2Rect.size()); - layer2->setVisibleContentRect(layer2Rect); - layer2->invalidateContentRect(layer2Rect); - - // This uses 960000 bytes, leaving 88576 bytes of memory left, which is enough for 2 tiles only in the other layer. - IntRect layerRect(IntPoint::zero(), IntSize(100, 2400)); - layer1->setBounds(layerRect.size()); - layer1->setVisibleContentRect(layerRect); - layer1->invalidateContentRect(layerRect); // Paint a single tile in layer2 so that it will idle paint. - layer2->setTexturePriorities(m_priorityCalculator); - layer1->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer1->updateContentRect(m_queue, layerRect, 0, m_stats); - layer2->updateContentRect(m_queue, IntRect(0, 0, 100, 100), 0, m_stats); - + layer1->setBounds(layer1Rect.size()); + layer1->setVisibleContentRect(layer1Rect); + layer2->setBounds(layer2Rect.size()); + layer2->setVisibleContentRect(IntRect(0, 0, 100, 100)); + bool needsUpdate = updateAndPush(layer1.get(), layerImpl1.get(), + layer2.get(), layerImpl2.get()); // We should need idle-painting for both remaining tiles in layer2. - EXPECT_TRUE(layer2->needsIdlePaint(layer2Rect)); - - // Commit the frame over to impl. - updateTextures(); - layer1->pushPropertiesTo(layerImpl1.get()); - layer2->pushPropertiesTo(layerImpl2.get()); + EXPECT_TRUE(needsUpdate); // Reduce our memory limits to 1mb. - textureManager->setMaxMemoryLimitBytes(1024 * 1024); + m_textureManager->setMaxMemoryLimitBytes(1024 * 1024); // Now idle paint layer2. We are going to run out of memory though! - layer2->setTexturePriorities(m_priorityCalculator); - layer1->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer2->updateContentRect(m_queue, IntRect(0, 0, 100, 100), 0, m_stats); - // Oh well, commit the frame and push. - updateTextures(); - layer1->pushPropertiesTo(layerImpl1.get()); - layer2->pushPropertiesTo(layerImpl2.get()); + for (int i = 0; i < 4; i++) { + needsUpdate = updateAndPush(layer1.get(), layerImpl1.get(), + layer2.get(), layerImpl2.get()); + } // Sanity check, we should have textures for the big layer. EXPECT_TRUE(layerImpl1->hasTextureIdForTileAt(0, 0)); + EXPECT_TRUE(layerImpl1->hasTextureIdForTileAt(0, 23)); - // We should only have the first tile from layer2 since it failed to idle update. + // We should only have the first two tiles from layer2 since + // it failed to idle update the last tile. EXPECT_TRUE(layerImpl2->hasTileAt(0, 0)); EXPECT_TRUE(layerImpl2->hasTextureIdForTileAt(0, 0)); - EXPECT_FALSE(layerImpl2->hasTileAt(0, 1)); - EXPECT_FALSE(layerImpl2->hasTileAt(0, 2)); - - // Now if layer2 becomes fully visible, we should be able to paint it and push valid textures. - layer2->setTexturePriorities(m_priorityCalculator); - layer1->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer2->updateContentRect(m_queue, layer2Rect, 0, m_stats); - layer1->updateContentRect(m_queue, layerRect, 0, m_stats); - - updateTextures(); - layer1->pushPropertiesTo(layerImpl1.get()); - layer2->pushPropertiesTo(layerImpl2.get()); - - EXPECT_TRUE(layerImpl2->hasTileAt(0, 0)); EXPECT_TRUE(layerImpl2->hasTileAt(0, 1)); - EXPECT_TRUE(layerImpl2->hasTileAt(0, 2)); - EXPECT_TRUE(layerImpl2->hasTextureIdForTileAt(0, 0)); EXPECT_TRUE(layerImpl2->hasTextureIdForTileAt(0, 1)); - EXPECT_TRUE(layerImpl2->hasTextureIdForTileAt(0, 2)); + + EXPECT_FALSE(needsUpdate); + EXPECT_FALSE(layerImpl2->hasTileAt(0, 2)); } TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); TestCCOcclusionTracker occluded; - + m_occlusion = &occluded; + // The tile size is 100x100, so this invalidates one occluded tile, culls it during paint, but prepaints it. occluded.setOcclusion(IntRect(0, 0, 100, 100)); layer->setBounds(IntSize(100, 100)); layer->setVisibleContentRect(IntRect(0, 0, 100, 100)); - layer->invalidateContentRect(IntRect(0, 0, 100, 100)); + updateAndPush(layer.get(), layerImpl.get()); - layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 100, 100), &occluded, m_stats); - updateTextures(); - layer->pushPropertiesTo(layerImpl.get()); - - // We should have the prepainted tile on the impl side. + // We should have the prepainted tile on the impl side, but culled it during paint. EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); + EXPECT_EQ(1, occluded.overdrawMetrics().tilesCulledForUpload()); } TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); // The tile size is 100x100, so this invalidates and then paints two tiles. // However, during the paint, we invalidate one of the tiles. This should // not prevent the tile from being pushed. - layer->setBounds(IntSize(100, 200)); - layer->invalidateContentRect(IntRect(0, 0, 100, 200)); - layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer.get()); - - layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats); - updateTextures(); - layer->pushPropertiesTo(layerImpl.get()); + layer->setBounds(IntSize(100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); + updateAndPush(layer.get(), layerImpl.get()); // We should have both tiles on the impl side. EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); @@ -425,34 +375,20 @@ TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint) TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(textureManager.get())); - RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layer1Impl(adoptPtr(new FakeCCTiledLayerImpl(1))); OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2))); + // Invalidate a tile on layer1, during update of layer 2. + layer2->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get()); layer1->setBounds(IntSize(100, 200)); - layer1->setVisibleContentRect(IntRect(0, 0, 100, 200)); - layer1->invalidateContentRect(IntRect(0, 0, 100, 200)); - + layer1->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer2->setBounds(IntSize(100, 200)); - layer2->setVisibleContentRect(IntRect(0, 0, 100, 200)); - layer2->invalidateContentRect(IntRect(0, 0, 100, 200)); - - layer1->setTexturePriorities(m_priorityCalculator); - layer2->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - - layer1->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats); - - // Invalidate a tile on layer1 - layer2->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get()); - layer2->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats); - - updateTextures(); - layer1->pushPropertiesTo(layer1Impl.get()); - layer2->pushPropertiesTo(layer2Impl.get()); + layer2->setVisibleContentRect(IntRect(0, 0, 100, 200)); + updateAndPush(layer1.get(), layer1Impl.get(), + layer2.get(), layer2Impl.get()); // We should have both tiles on the impl side for all layers. EXPECT_TRUE(layer1Impl->hasTileAt(0, 0)); @@ -463,32 +399,19 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(textureManager.get())); - RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layer1Impl(adoptPtr(new FakeCCTiledLayerImpl(1))); OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2))); + layer1->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get()); layer1->setBounds(IntSize(100, 200)); - layer1->setVisibleContentRect(IntRect(0, 0, 100, 200)); - layer1->invalidateContentRect(IntRect(0, 0, 100, 200)); - + layer1->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer2->setBounds(IntSize(100, 200)); - layer2->setVisibleContentRect(IntRect(0, 0, 100, 200)); - layer2->invalidateContentRect(IntRect(0, 0, 100, 200)); - - layer1->setTexturePriorities(m_priorityCalculator); - layer2->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - - // Invalidate a tile on layer2 - layer1->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get()); - layer1->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats); - layer2->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats); - updateTextures(); - layer1->pushPropertiesTo(layer1Impl.get()); - layer2->pushPropertiesTo(layer2Impl.get()); + layer2->setVisibleContentRect(IntRect(0, 0, 100, 200)); + updateAndPush(layer1.get(), layer1Impl.get(), + layer2.get(), layer2Impl.get()); // We should have both tiles on the impl side for all layers. EXPECT_TRUE(layer1Impl->hasTileAt(0, 0)); @@ -518,10 +441,10 @@ TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately) if (runOutOfMemory[i]) layerWidth *= 2; - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(memoryForLayer, 1024, CCRenderer::ContentPool); + m_textureManager->setMaxMemoryLimitBytes(memoryForLayer); DebugScopedSetImplThread implThread; - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); // Full size layer with half being visible. @@ -539,8 +462,8 @@ TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately) // The layer should paint it's entire contents on the first paint // if it is close to the viewport size and has the available memory. layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, visibleRect, 0, m_stats); + m_textureManager->prioritizeTextures(); + layer->update(m_queue, 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -565,49 +488,31 @@ TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately) TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) { - // The tile size is 100x100. Setup 3x3 tiles with one 1x1 visible tile in the center. - IntSize contentBounds(300, 300); - IntRect contentRect(IntPoint::zero(), contentBounds); - IntRect visibleRect(100, 100, 100, 100); - - // We have enough memory for only the visible rect, so we will run out of memory in first idle paint. - int memoryLimit = 4 * 100 * 100; // 1 tiles, 4 bytes per pixel. - - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(memoryLimit, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); - // Invalidates 9 tiles and then paints one visible tile. - layer->setBounds(contentBounds); - layer->setVisibleContentRect(visibleRect); - layer->invalidateContentRect(contentRect); + // We have enough memory for only the visible rect, so we will run out of memory in first idle paint. + int memoryLimit = 4 * 100 * 100; // 1 tiles, 4 bytes per pixel. + m_textureManager->setMaxMemoryLimitBytes(memoryLimit); - layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, visibleRect, 0, m_stats); + // The tile size is 100x100, so this invalidates and then paints two tiles. + bool needsUpdate = false; + layer->setBounds(IntSize(300, 300)); + layer->setVisibleContentRect(IntRect(100, 100, 100, 100)); + for (int i = 0; i < 2; i++) + needsUpdate = updateAndPush(layer.get(), layerImpl.get()); // Idle-painting should see no more priority tiles for painting. - EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); - - updateTextures(); - layer->pushPropertiesTo(layerImpl.get()); + EXPECT_FALSE(needsUpdate); // We should have one tile on the impl side. EXPECT_TRUE(layerImpl->hasTileAt(1, 1)); - - layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, visibleRect, 0, m_stats); - - // We shouldn't signal we need another idle paint. - EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); } TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(20000, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -617,25 +522,16 @@ TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer) layer->setDrawTransformIsAnimating(animating[i]); // The layer's bounds are empty. - IntRect contentRect; - - layer->setBounds(contentRect.size()); - layer->setVisibleContentRect(contentRect); - layer->invalidateContentRect(contentRect); - - layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - // Empty layers don't paint or idle-paint. - layer->updateContentRect(m_queue, contentRect, 0, m_stats); - + layer->setBounds(IntSize()); + layer->setVisibleContentRect(IntRect()); + bool needsUpdate = updateAndPush(layer.get(), layerImpl.get()); + // Empty layers don't have tiles. EXPECT_EQ(0u, layer->numPaintedTiles()); // Empty layers don't need prepaint. - EXPECT_FALSE(layer->needsIdlePaint(contentRect)); - - layer->pushPropertiesTo(layerImpl.get()); + EXPECT_FALSE(needsUpdate); // Empty layers don't have tiles. EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); @@ -644,14 +540,9 @@ TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer) TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers) { - IntSize contentBounds(100, 100); - IntRect contentRect(IntPoint::zero(), contentBounds); - - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); - layer->setBounds(contentBounds); // Alternate between not visible and visible. IntRect v(0, 0, 100, 100); @@ -662,71 +553,53 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers) // We should not have any tiles except for when the layer was visible // or after the layer was visible and we didn't invalidate. bool haveTile[10] = { false, false, true, true, false, false, true, true, true, true }; - + for (int i = 0; i < 10; i++) { + layer->setBounds(IntSize(100, 100)); layer->setVisibleContentRect(visibleRect[i]); - // Skip invalidation once to insure the tile stays in memory while not visible. if (invalidate[i]) - layer->invalidateContentRect(contentRect); - - // Paint / idle-paint. - textureManager->clearPriorities(); - layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, visibleRect[i], 0, m_stats); - - updateTextures(); - + layer->invalidateContentRect(IntRect(0, 0, 100, 100)); + bool needsUpdate = updateAndPush(layer.get(), layerImpl.get()); + // We should never signal idle paint, as we painted the entire layer // or the layer was not visible. - EXPECT_FALSE(layer->needsIdlePaint(visibleRect[i])); - - layer->pushPropertiesTo(layerImpl.get()); + EXPECT_FALSE(needsUpdate); EXPECT_EQ(layerImpl->hasTileAt(0, 0), haveTile[i]); } } - TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); - layer->invalidateContentRect(IntRect(0, 0, 100, 200)); - layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats); - updateTextures(1000); - layer->pushPropertiesTo(layerImpl.get()); + updateAndPush(layer.get(), layerImpl.get()); // We should have both tiles on the impl side. EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); layer->fakeLayerTextureUpdater()->clearPrepareCount(); - // Invoke updateContentRect again. As the layer is valid updateContentRect shouldn't be invoked on + // Invoke update again. As the layer is valid update shouldn't be invoked on // the LayerTextureUpdater. - layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats); - updateTextures(1000); + updateAndPush(layer.get(), layerImpl.get()); EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareCount()); - layer->invalidateContentRect(IntRect(0, 0, 50, 50)); - // setRectToInvalidate triggers invalidateContentRect() being invoked from updateContentRect. + // setRectToInvalidate triggers invalidateContentRect() being invoked from update. layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(25, 25, 50, 50), layer.get()); layer->fakeLayerTextureUpdater()->clearPrepareCount(); - layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats); - updateTextures(1000); + layer->invalidateContentRect(IntRect(0, 0, 50, 50)); + updateAndPush(layer.get(), layerImpl.get()); EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); layer->fakeLayerTextureUpdater()->clearPrepareCount(); - // The layer should still be invalid as updateContentRect invoked invalidate. - layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats); - updateTextures(1000); + + // The layer should still be invalid as update invoked invalidate. + updateAndPush(layer.get(), layerImpl.get()); // visible EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); } @@ -734,9 +607,7 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) { // The updateRect (that indicates what was actually painted) should be in // layer space, not the content space. - - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerWithScaledBounds> layer = adoptRef(new FakeTiledLayerWithScaledBounds(textureManager.get())); + RefPtr<FakeTiledLayerWithScaledBounds> layer = adoptRef(new FakeTiledLayerWithScaledBounds(m_textureManager.get())); DebugScopedSetImplThread implThread; IntRect layerBounds(0, 0, 300, 200); @@ -751,16 +622,16 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) layer->invalidateContentRect(contentBounds); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, contentBounds, 0, m_stats); + m_textureManager->prioritizeTextures(); + layer->update(m_queue, 0, m_stats); EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 300, 300 * 0.8), layer->updateRect()); updateTextures(); // After the tiles are updated once, another invalidate only needs to update the bounds of the layer. layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); + m_textureManager->prioritizeTextures(); layer->invalidateContentRect(contentBounds); - layer->updateContentRect(m_queue, contentBounds, 0, m_stats); + layer->update(m_queue, 0, m_stats); EXPECT_FLOAT_RECT_EQ(FloatRect(layerBounds), layer->updateRect()); updateTextures(); @@ -768,15 +639,14 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) IntRect partialDamage(30, 100, 10, 10); layer->invalidateContentRect(partialDamage); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, contentBounds, 0, m_stats); + m_textureManager->prioritizeTextures(); + layer->update(m_queue, 0, m_stats); EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect()); } TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -790,8 +660,8 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // Push the tiles to the impl side and check that there is exactly one. layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 100, 100), 0, m_stats); + m_textureManager->prioritizeTextures(); + layer->update(m_queue, 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); @@ -807,8 +677,8 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // The impl side should get 2x2 tiles now. layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 200, 200), 0, m_stats); + m_textureManager->prioritizeTextures(); + layer->update(m_queue, 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); @@ -820,8 +690,7 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // impl side. layer->setNeedsDisplay(); layer->setTexturePriorities(m_priorityCalculator); - layer->updateContentRect(m_queue, IntRect(1, 0, 0, 1), 0, m_stats); - textureManager->prioritizeTextures(); + m_textureManager->prioritizeTextures(); layer->pushPropertiesTo(layerImpl.get()); EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); @@ -883,16 +752,15 @@ TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset) TEST_F(TiledLayerChromiumTest, resizeToSmaller) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(60*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); layer->setBounds(IntSize(700, 700)); layer->setVisibleContentRect(IntRect(0, 0, 700, 700)); layer->invalidateContentRect(IntRect(0, 0, 700, 700)); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 700, 700), 0, m_stats); + m_textureManager->prioritizeTextures(); + layer->update(m_queue, 0, m_stats); layer->setBounds(IntSize(200, 200)); layer->invalidateContentRect(IntRect(0, 0, 200, 200)); @@ -900,8 +768,7 @@ TEST_F(TiledLayerChromiumTest, resizeToSmaller) TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(60*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); int size = 1 << 30; layer->setBounds(IntSize(size, size)); @@ -910,8 +777,8 @@ TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash) // Ensure no crash for bounds where size * size would overflow an int. layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 700, 700), 0, m_stats); + m_textureManager->prioritizeTextures(); + layer->update(m_queue, 0, m_stats); } TEST_F(TiledLayerChromiumTest, partialUpdates) @@ -1044,8 +911,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); @@ -1054,15 +920,14 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion) layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats); + m_textureManager->prioritizeTextures(); + layer->update(m_queue, 0, m_stats); EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->prepareRectCount()); } TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); TestCCOcclusionTracker occluded; // The tile size is 100x100. @@ -1075,8 +940,8 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats); + m_textureManager->prioritizeTextures(); + layer->update(m_queue, &occluded, m_stats); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1085,11 +950,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); + m_textureManager->prioritizeTextures(); occluded.setOcclusion(IntRect(250, 200, 300, 100)); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); - layer->updateContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats); + layer->update(m_queue, &occluded, m_stats); EXPECT_EQ(36-2, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1098,11 +963,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); + m_textureManager->prioritizeTextures(); occluded.setOcclusion(IntRect(250, 250, 300, 100)); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); - layer->updateContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats); + layer->update(m_queue, &occluded, m_stats); EXPECT_EQ(36, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1112,8 +977,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); TestCCOcclusionTracker occluded; // The tile size is 100x100. @@ -1127,8 +991,8 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 600, 360), &occluded, m_stats); + m_textureManager->prioritizeTextures(); + layer->update(m_queue, &occluded, m_stats); EXPECT_EQ(24-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1143,8 +1007,8 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) layer->setVisibleContentRect(IntRect(0, 0, 600, 350)); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 600, 350), &occluded, m_stats); + m_textureManager->prioritizeTextures(); + layer->update(m_queue, &occluded, m_stats); EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1159,8 +1023,8 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) layer->setVisibleContentRect(IntRect(0, 0, 600, 340)); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 600, 340), &occluded, m_stats); + m_textureManager->prioritizeTextures(); + layer->update(m_queue, &occluded, m_stats); EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1171,8 +1035,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); TestCCOcclusionTracker occluded; // The tile size is 100x100. @@ -1184,8 +1047,8 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) layer->setVisibleContentRect(IntRect(0, 0, 600, 600)); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats); + m_textureManager->prioritizeTextures(); + layer->update(m_queue, &occluded, m_stats); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); { DebugScopedSetImplThread implThread; @@ -1198,10 +1061,10 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); + m_textureManager->prioritizeTextures(); // Repaint without marking it dirty. The 3 culled tiles will be pre-painted now. - layer->updateContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats); + layer->update(m_queue, &occluded, m_stats); EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1211,8 +1074,7 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); TestCCOcclusionTracker occluded; // The tile size is 100x100. @@ -1230,8 +1092,8 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats); + m_textureManager->prioritizeTextures(); + layer->update(m_queue, &occluded, m_stats); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1241,8 +1103,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); TestCCOcclusionTracker occluded; // The tile size is 100x100. @@ -1262,8 +1123,8 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats); + m_textureManager->prioritizeTextures(); + layer->update(m_queue, &occluded, m_stats); // The content is half the size of the layer (so the number of tiles is fewer). // In this case, the content is 300x300, and since the tile size is 100, the // number of tiles 3x3. @@ -1283,8 +1144,8 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats); + m_textureManager->prioritizeTextures(); + layer->update(m_queue, &occluded, m_stats); EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1304,8 +1165,8 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats); + m_textureManager->prioritizeTextures(); + layer->update(m_queue, &occluded, m_stats); EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1315,8 +1176,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); TestCCOcclusionTracker occluded; DebugScopedSetImplThread implThread; @@ -1334,12 +1194,12 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) layer->setDrawOpacity(1); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); + m_textureManager->prioritizeTextures(); // If the layer doesn't paint opaque content, then the visibleContentOpaqueRegion should be empty. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(contentBounds); - layer->updateContentRect(m_queue, contentBounds, &occluded, m_stats); + layer->update(m_queue, &occluded, m_stats); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1352,7 +1212,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) opaquePaintRect = IntRect(10, 10, 90, 190); layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect); layer->invalidateContentRect(contentBounds); - layer->updateContentRect(m_queue, contentBounds, &occluded, m_stats); + layer->update(m_queue, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1365,7 +1225,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // If we paint again without invalidating, the same stuff should be opaque. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->updateContentRect(m_queue, contentBounds, &occluded, m_stats); + layer->update(m_queue, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1380,7 +1240,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // not be affected. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(IntRect(0, 0, 1, 1)); - layer->updateContentRect(m_queue, contentBounds, &occluded, m_stats); + layer->update(m_queue, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1395,7 +1255,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // not be affected. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(IntRect(10, 10, 1, 1)); - layer->updateContentRect(m_queue, contentBounds, &occluded, m_stats); + layer->update(m_queue, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds()); @@ -1409,8 +1269,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) { - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); TestCCOcclusionTracker occluded; DebugScopedSetImplThread implThread; @@ -1428,12 +1287,12 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) layer->setDrawOpacity(1); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); + m_textureManager->prioritizeTextures(); // Invalidates and paints the whole layer. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(contentBounds); - layer->updateContentRect(m_queue, contentBounds, &occluded, m_stats); + layer->update(m_queue, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1448,7 +1307,7 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(IntRect(0, 0, 1, 1)); layer->invalidateContentRect(IntRect(50, 200, 10, 10)); - layer->updateContentRect(m_queue, contentBounds, &occluded, m_stats); + layer->update(m_queue, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1662,9 +1521,7 @@ private: TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) { - OwnPtr<CCPrioritizedTextureManager> textureManager(CCPrioritizedTextureManager::create(4000000, 4000000, CCRenderer::ContentPool)); - - RefPtr<UpdateTrackingTiledLayerChromium> layer = adoptRef(new UpdateTrackingTiledLayerChromium(textureManager.get())); + RefPtr<UpdateTrackingTiledLayerChromium> layer = adoptRef(new UpdateTrackingTiledLayerChromium(m_textureManager.get())); IntRect layerRect(0, 0, 30, 31); layer->setPosition(layerRect.location()); @@ -1677,10 +1534,10 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) layer->setDrawableContentRect(contentRect); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); + m_textureManager->prioritizeTextures(); // Update the whole tile. - layer->updateContentRect(m_queue, contentRect, 0, m_stats); + layer->update(m_queue, 0, m_stats); layer->trackingLayerPainter()->resetPaintedRect(); EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); @@ -1692,16 +1549,14 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) // Invalidate the entire layer in content space. When painting, the rect given to webkit should match the layer's bounds. layer->invalidateContentRect(contentRect); - layer->updateContentRect(m_queue, contentRect, 0, m_stats); + layer->update(m_queue, 0, m_stats); EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation) { - OwnPtr<CCPrioritizedTextureManager> textureManager(CCPrioritizedTextureManager::create(4000000, 4000000, CCRenderer::ContentPool)); - - RefPtr<UpdateTrackingTiledLayerChromium> layer = adoptRef(new UpdateTrackingTiledLayerChromium(textureManager.get())); + RefPtr<UpdateTrackingTiledLayerChromium> layer = adoptRef(new UpdateTrackingTiledLayerChromium(m_textureManager.get())); IntRect layerRect(0, 0, 30, 31); layer->setPosition(layerRect.location()); @@ -1713,10 +1568,10 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvali layer->setDrawableContentRect(contentRect); layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); + m_textureManager->prioritizeTextures(); // Update the whole tile. - layer->updateContentRect(m_queue, contentRect, 0, m_stats); + layer->update(m_queue, 0, m_stats); layer->trackingLayerPainter()->resetPaintedRect(); EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); @@ -1728,7 +1583,7 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvali // Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds. layer->setNeedsDisplayRect(layerRect); - layer->updateContentRect(m_queue, contentRect, 0, m_stats); + layer->update(m_queue, 0, m_stats); EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } diff --git a/Source/WebKit/chromium/tests/WebLayerTest.cpp b/Source/WebKit/chromium/tests/WebLayerTest.cpp index 667200410..9b8e58ca1 100644 --- a/Source/WebKit/chromium/tests/WebLayerTest.cpp +++ b/Source/WebKit/chromium/tests/WebLayerTest.cpp @@ -26,6 +26,7 @@ #include <public/WebLayer.h> #include "CompositorFakeWebGraphicsContext3D.h" +#include "WebLayerImpl.h" #include <public/WebCompositor.h> #include <public/WebContentLayer.h> #include <public/WebContentLayerClient.h> @@ -76,9 +77,9 @@ public: { // Initialize without threading support. WebKit::WebCompositor::initialize(0); - m_rootLayer = WebLayer::create(); + m_rootLayer = adoptPtr(WebLayer::create()); EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); - EXPECT_TRUE(m_view.initialize(&m_client, m_rootLayer, WebLayerTreeView::Settings())); + EXPECT_TRUE(m_view.initialize(&m_client, *m_rootLayer, WebLayerTreeView::Settings())); Mock::VerifyAndClearExpectations(&m_client); } @@ -87,14 +88,14 @@ public: // We may get any number of scheduleComposite calls during shutdown. EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); m_view.setRootLayer(0); - m_rootLayer.reset(); + m_rootLayer.clear(); m_view.reset(); WebKit::WebCompositor::shutdown(); } protected: MockWebLayerTreeViewClient m_client; - WebLayer m_rootLayer; + OwnPtr<WebLayer> m_rootLayer; WebLayerTreeView m_view; }; @@ -104,73 +105,73 @@ TEST_F(WebLayerTest, Client) { // Base layer. EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); - WebLayer layer = WebLayer::create(); - m_rootLayer.addChild(layer); + OwnPtr<WebLayer> layer = adoptPtr(WebLayer::create()); + m_rootLayer->addChild(layer.get()); Mock::VerifyAndClearExpectations(&m_client); WebFloatPoint point(3, 4); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); - layer.setAnchorPoint(point); + layer->setAnchorPoint(point); Mock::VerifyAndClearExpectations(&m_client); - EXPECT_EQ(point, layer.anchorPoint()); + EXPECT_EQ(point, layer->anchorPoint()); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); float anchorZ = 5; - layer.setAnchorPointZ(anchorZ); + layer->setAnchorPointZ(anchorZ); Mock::VerifyAndClearExpectations(&m_client); - EXPECT_EQ(anchorZ, layer.anchorPointZ()); + EXPECT_EQ(anchorZ, layer->anchorPointZ()); WebSize size(7, 8); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); - layer.setBounds(size); + layer->setBounds(size); Mock::VerifyAndClearExpectations(&m_client); - EXPECT_EQ(size, layer.bounds()); + EXPECT_EQ(size, layer->bounds()); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); - layer.setMasksToBounds(true); + layer->setMasksToBounds(true); Mock::VerifyAndClearExpectations(&m_client); - EXPECT_TRUE(layer.masksToBounds()); + EXPECT_TRUE(layer->masksToBounds()); EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); - WebLayer otherLayer = WebLayer::create(); - m_rootLayer.addChild(otherLayer); + OwnPtr<WebLayer> otherLayer = adoptPtr(WebLayer::create()); + m_rootLayer->addChild(otherLayer.get()); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); - layer.setMaskLayer(otherLayer); + layer->setMaskLayer(otherLayer.get()); Mock::VerifyAndClearExpectations(&m_client); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); float opacity = 0.123f; - layer.setOpacity(opacity); + layer->setOpacity(opacity); Mock::VerifyAndClearExpectations(&m_client); - EXPECT_EQ(opacity, layer.opacity()); + EXPECT_EQ(opacity, layer->opacity()); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); - layer.setOpaque(true); + layer->setOpaque(true); Mock::VerifyAndClearExpectations(&m_client); - EXPECT_TRUE(layer.opaque()); + EXPECT_TRUE(layer->opaque()); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); - layer.setPosition(point); + layer->setPosition(point); Mock::VerifyAndClearExpectations(&m_client); - EXPECT_EQ(point, layer.position()); + EXPECT_EQ(point, layer->position()); // Texture layer. EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); - WebExternalTextureLayer textureLayer = WebExternalTextureLayer::create(); - m_rootLayer.addChild(textureLayer); + OwnPtr<WebExternalTextureLayer> textureLayer = adoptPtr(WebExternalTextureLayer::create()); + m_rootLayer->addChild(textureLayer->layer()); Mock::VerifyAndClearExpectations(&m_client); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); - textureLayer.setTextureId(3); + textureLayer->setTextureId(3); Mock::VerifyAndClearExpectations(&m_client); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); - textureLayer.setFlipped(true); + textureLayer->setFlipped(true); Mock::VerifyAndClearExpectations(&m_client); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); WebFloatRect uvRect(0.1f, 0.1f, 0.9f, 0.9f); - textureLayer.setUVRect(uvRect); + textureLayer->setUVRect(uvRect); Mock::VerifyAndClearExpectations(&m_client); @@ -178,14 +179,14 @@ TEST_F(WebLayerTest, Client) MockWebContentLayerClient contentClient; EXPECT_CALL(contentClient, paintContents(_, _, _)).Times(AnyNumber()); EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); - WebContentLayer contentLayer = WebContentLayer::create(&contentClient); - m_rootLayer.addChild(contentLayer); + OwnPtr<WebContentLayer> contentLayer = adoptPtr(WebContentLayer::create(&contentClient)); + m_rootLayer->addChild(contentLayer->layer()); Mock::VerifyAndClearExpectations(&m_client); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); - contentLayer.setDrawsContent(false); + contentLayer->layer()->setDrawsContent(false); Mock::VerifyAndClearExpectations(&m_client); - EXPECT_FALSE(contentLayer.drawsContent()); + EXPECT_FALSE(contentLayer->layer()->drawsContent()); } } diff --git a/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp b/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp index bec2c6035..1c1602c23 100644 --- a/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp +++ b/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp @@ -60,8 +60,8 @@ public: virtual void SetUp() { initializeCompositor(); - m_rootLayer = WebLayer::create(); - EXPECT_TRUE(m_view.initialize(client(), m_rootLayer, WebLayerTreeView::Settings())); + m_rootLayer = adoptPtr(WebLayer::create()); + EXPECT_TRUE(m_view.initialize(client(), *m_rootLayer, WebLayerTreeView::Settings())); m_view.setSurfaceReady(); } @@ -70,13 +70,13 @@ public: Mock::VerifyAndClearExpectations(client()); m_view.setRootLayer(0); - m_rootLayer.reset(); + m_rootLayer.clear(); m_view.reset(); WebKit::WebCompositor::shutdown(); } protected: - WebLayer m_rootLayer; + OwnPtr<WebLayer> m_rootLayer; WebLayerTreeView m_view; }; diff --git a/Source/WebKit/chromium/tests/data/test_touch_link_highlight.html b/Source/WebKit/chromium/tests/data/test_touch_link_highlight.html new file mode 100644 index 000000000..89bd15fb0 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/test_touch_link_highlight.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> + <body> + <a href="http://www.test.com" style="position: absolute; left: 20px; top: 20px; width: 200px; -webkit-transform:translateZ(0)">A link to highlight</a> + <div style="background-color: white; position: absolute; left: 20px; top: 40px; width: 200px; height: 30px"> + <p id="innerDiv">Not a link to click.</p> + </div> + <div style="background-color: white; position: absolute; left: 20px; top: 100px; width: 200px; height: 100px; overflow-y: scroll; overflow-x : scroll;"> + <a href="http://www.test.com">Another link to click</a><br> + Some stuff.<br> + Some stuff.<br> + Some stuff.<br> + Some stuff.<br> + Some stuff.<br> + Some stuff.<br> + Some stuff.<br> + Some stuff.<br> + Some stuff.<br> + Some stuff.<br> + Some stuff.<br> + Some stuff.<br> + Some stuff.<br> + Some stuff.<br> + Some stuff.<br> + Some stuff.<br> + Some stuff.<br> + </div> +<!-- The following is the text for the iframe tag below: +<html> +<body> +<a href="http://www.test.com" position: absolute; left: 50px; top: 30px> +This is going to be a very long link to force the scrollbars to activate on the iFrame that will contain this page. +</a> +</body> +</html> +--> +<!-- + <iframe style="scrolling: yes; width : 400px; height : 100px; position: absolute; left: 20px; top: 210px;" + src="data:text/html,%3Chtml%3E%0A%3Cbody%3E%0A%3Ca%20href%3D%22http%3A%2F%2Fwww.test.com%22%20position%3A%20absolute%3B%20left%3A%2050px%3B%20top%3A%2030px%3E%0AThis%20is%20going%20to%20be%20a%20very%20long%20link%20to%20force%20the%20scrollbars%20to%20activate%20on%20the%20iFrame%20that%20will%20contain%20this%20page.%0A%3C%2Fa%3E%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E"></iframe> +--> + </body> +</html> diff --git a/Source/WebKit/gtk/ChangeLog b/Source/WebKit/gtk/ChangeLog index 2ef791908..b27c45863 100644 --- a/Source/WebKit/gtk/ChangeLog +++ b/Source/WebKit/gtk/ChangeLog @@ -1,3 +1,43 @@ +2012-08-22 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Crash when finalizing WebKitWebView + https://bugs.webkit.org/show_bug.cgi?id=94699 + + Reviewed by Martin Robinson. + + Create the offscreen window the first time accelerated compositing + is enabled, so that if it's never enabled the window won't be + created. + + * WebCoreSupport/AcceleratedCompositingContextGL.cpp: + (WebKit::AcceleratedCompositingContext::AcceleratedCompositingContext): + (WebKit::AcceleratedCompositingContext::initialize): + (WebKit::AcceleratedCompositingContext::setRootCompositingLayer): + +2012-08-22 Gustavo Noronha Silva <gns@gnome.org> + + [GTK] Split WebCore/platform into a separate library + https://bugs.webkit.org/show_bug.cgi?id=94435 + + Reviewed by Martin Robinson. + + More people have been reporting problems when linking WebCore because + the command line limit is being exceeded. Splitting WebCore a bit more + is in order. + + * GNUmakefile.am: link libWebCorePlatform into libwebkitgtk + +2012-08-22 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Preferred languages and spellchecker APIs are not consistent in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=94683 + + Reviewed by Alejandro G. Castro. + + * webkit/webkitspellcheckerenchant.cpp: + (updateSpellCheckingLanguages): Split the languages string to pass a + Vector to updateSpellCheckingLanguages(). + 2012-08-21 Joanmarie Diggs <jdiggs@igalia.com> [Gtk] No accessible caret-moved events found in certain content https://bugs.webkit.org/show_bug.cgi?id=72811 diff --git a/Source/WebKit/gtk/GNUmakefile.am b/Source/WebKit/gtk/GNUmakefile.am index 00473f9d5..859508e38 100644 --- a/Source/WebKit/gtk/GNUmakefile.am +++ b/Source/WebKit/gtk/GNUmakefile.am @@ -77,6 +77,7 @@ libwebkitgtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LDFL libwebkitgtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBADD = \ -lpthread \ libWebCore.la \ + libWebCorePlatform.la \ libWebCoreModules.la \ libWebCoreGtk.la \ libjavascriptcoregtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la \ diff --git a/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp b/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp index 29ba349d8..9a2cae0ad 100644 --- a/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp @@ -50,7 +50,6 @@ namespace WebKit { AcceleratedCompositingContext::AcceleratedCompositingContext(WebKitWebView* webView) : m_webView(webView) , m_layerFlushTimerCallbackId(0) - , m_redirectedWindow(RedirectedXCompositeWindow::create(IntSize(1, 1))) , m_lastFlushTime(0) , m_redrawPendingTime(0) , m_needsExtraFlush(false) @@ -69,10 +68,14 @@ void AcceleratedCompositingContext::initialize() if (m_rootLayer) return; + IntSize pageSize = getWebViewSize(m_webView); + if (!m_redirectedWindow) + m_redirectedWindow = RedirectedXCompositeWindow::create(pageSize); + else + m_redirectedWindow->resize(pageSize); + m_rootLayer = GraphicsLayer::create(this); m_rootLayer->setDrawsContent(false); - - IntSize pageSize = getWebViewSize(m_webView); m_rootLayer->setSize(pageSize); // The non-composited contents are a child of the root layer. @@ -239,9 +242,6 @@ void AcceleratedCompositingContext::setRootCompositingLayer(GraphicsLayer* graph return; } - if (graphicsLayer && !enabled()) - m_redirectedWindow->resize(getWebViewSize(m_webView)); - // Add the accelerated layer tree hierarchy. initialize(); m_nonCompositedContentLayer->removeAllChildren(); diff --git a/Source/WebKit/gtk/webkit/webkitspellcheckerenchant.cpp b/Source/WebKit/gtk/webkit/webkitspellcheckerenchant.cpp index 07d34d156..83be3a3d2 100644 --- a/Source/WebKit/gtk/webkit/webkitspellcheckerenchant.cpp +++ b/Source/WebKit/gtk/webkit/webkitspellcheckerenchant.cpp @@ -99,7 +99,10 @@ static char** getGuessesForWord(WebKitSpellChecker* checker, const char* word, c static void updateSpellCheckingLanguages(WebKitSpellChecker* checker, const char* languages) { WebKitSpellCheckerEnchantPrivate* priv = WEBKIT_SPELL_CHECKER_ENCHANT(checker)->priv; - priv->textCheckerEnchant->updateSpellCheckingLanguages(String::fromUTF8(languages)); + + Vector<String> languagesVector; + String::fromUTF8(languages).split(static_cast<UChar>(','), languagesVector); + priv->textCheckerEnchant->updateSpellCheckingLanguages(languagesVector); } static char* getAutocorrectSuggestionsForMisspelledWord(WebKitSpellChecker* checker, const char* word) diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index 0f2e3d42d..53112e658 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,21 @@ +2012-08-22 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=94401 + Add support for making a web site become paginated using overflow: + paged-x | paged-y + -and corresponding- + <rdar://problem/11831783> + + Reviewed by Dave Hyatt. + + WebCore::Page::Pagination is now just WebCore::Pagination. + * WebView/WebView.mm: + (-[WebView _setPaginationMode:]): + (-[WebView _paginationMode]): + (-[WebView _setPaginationBehavesLikeColumns:]): + (-[WebView _setPageLength:]): + (-[WebView _setGapBetweenPages:]): + 2012-08-15 Bruno de Oliveira Abinader <bruno.abinader@basyskom.com> [css3-text] Add CSS3 Text decoration compile flag diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm index 3391ab967..2bfaf2481 100644 --- a/Source/WebKit/mac/WebView/WebView.mm +++ b/Source/WebKit/mac/WebView/WebView.mm @@ -2806,22 +2806,22 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) if (!page) return; - Page::Pagination pagination = page->pagination(); + Pagination pagination = page->pagination(); switch (paginationMode) { case WebPaginationModeUnpaginated: - pagination.mode = Page::Pagination::Unpaginated; + pagination.mode = Pagination::Unpaginated; break; case WebPaginationModeLeftToRight: - pagination.mode = Page::Pagination::LeftToRightPaginated; + pagination.mode = Pagination::LeftToRightPaginated; break; case WebPaginationModeRightToLeft: - pagination.mode = Page::Pagination::RightToLeftPaginated; + pagination.mode = Pagination::RightToLeftPaginated; break; case WebPaginationModeTopToBottom: - pagination.mode = Page::Pagination::TopToBottomPaginated; + pagination.mode = Pagination::TopToBottomPaginated; break; case WebPaginationModeBottomToTop: - pagination.mode = Page::Pagination::BottomToTopPaginated; + pagination.mode = Pagination::BottomToTopPaginated; break; default: return; @@ -2837,15 +2837,15 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) return WebPaginationModeUnpaginated; switch (page->pagination().mode) { - case Page::Pagination::Unpaginated: + case Pagination::Unpaginated: return WebPaginationModeUnpaginated; - case Page::Pagination::LeftToRightPaginated: + case Pagination::LeftToRightPaginated: return WebPaginationModeLeftToRight; - case Page::Pagination::RightToLeftPaginated: + case Pagination::RightToLeftPaginated: return WebPaginationModeRightToLeft; - case Page::Pagination::TopToBottomPaginated: + case Pagination::TopToBottomPaginated: return WebPaginationModeTopToBottom; - case Page::Pagination::BottomToTopPaginated: + case Pagination::BottomToTopPaginated: return WebPaginationModeBottomToTop; } @@ -2859,7 +2859,7 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) if (!page) return; - Page::Pagination pagination = page->pagination(); + Pagination pagination = page->pagination(); pagination.behavesLikeColumns = behavesLikeColumns; } @@ -2878,7 +2878,7 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) if (!page) return; - Page::Pagination pagination = page->pagination(); + Pagination pagination = page->pagination(); pagination.pageLength = pageLength; page->setPagination(pagination); @@ -2899,7 +2899,7 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) if (!page) return; - Page::Pagination pagination = page->pagination(); + Pagination pagination = page->pagination(); pagination.gap = pageGap; page->setPagination(pagination); } diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp index 774da5d31..741457f47 100644 --- a/Source/WebKit/qt/Api/qwebsettings.cpp +++ b/Source/WebKit/qt/Api/qwebsettings.cpp @@ -261,6 +261,12 @@ void QWebSettingsPrivate::apply() settings->setTiledBackingStoreEnabled(value); #endif +#if ENABLE(SMOOTH_SCROLLING) + value = attributes.value(QWebSettings::ScrollAnimatorEnabled, + global->attributes.value(QWebSettings::ScrollAnimatorEnabled)); + settings->setEnableScrollAnimator(value); +#endif + value = attributes.value(QWebSettings::SiteSpecificQuirksEnabled, global->attributes.value(QWebSettings::SiteSpecificQuirksEnabled)); settings->setNeedsSiteSpecificQuirks(value); @@ -473,6 +479,7 @@ QWebSettings* QWebSettings::globalSettings() This is disabled by default. \value SiteSpecificQuirksEnabled This setting enables WebKit's workaround for broken sites. It is enabled by default. + \value ScrollAnimatorEnabled This setting enables animated scrolling. It is disabled by default. */ /*! @@ -524,6 +531,7 @@ QWebSettings::QWebSettings() d->attributes.insert(QWebSettings::TiledBackingStoreEnabled, false); d->attributes.insert(QWebSettings::FrameFlatteningEnabled, false); d->attributes.insert(QWebSettings::SiteSpecificQuirksEnabled, true); + d->attributes.insert(QWebSettings::ScrollAnimatorEnabled, false); d->offlineStorageDefaultQuota = 5 * 1024 * 1024; d->defaultTextEncoding = QLatin1String("iso-8859-1"); d->thirdPartyCookiePolicy = AlwaysAllowThirdPartyCookies; diff --git a/Source/WebKit/qt/Api/qwebsettings.h b/Source/WebKit/qt/Api/qwebsettings.h index 835a72e24..5b6497afb 100644 --- a/Source/WebKit/qt/Api/qwebsettings.h +++ b/Source/WebKit/qt/Api/qwebsettings.h @@ -79,7 +79,8 @@ public: WebGLEnabled, CSSRegionsEnabled, HyperlinkAuditingEnabled, - CSSGridLayoutEnabled + CSSGridLayoutEnabled, + ScrollAnimatorEnabled }; enum WebGraphic { MissingImageGraphic, diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index 2b5ceb307..8c13066b1 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,47 @@ +2012-08-22 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r126287. + http://trac.webkit.org/changeset/126287 + https://bugs.webkit.org/show_bug.cgi?id=94708 + + It made WK1 layout testing 3.7x slower (>1hours) (Requested by + ossy on #webkit). + + * tests/qobjectbridge/tst_qobjectbridge.cpp: + (tst_QObjectBridge::objectDeleted): + (tst_QObjectBridge::introspectQtMethods_data): + (tst_QObjectBridge::introspectQtMethods): + +2012-08-22 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + [Qt] Optionally support smooth-scrolling on all platforms + https://bugs.webkit.org/show_bug.cgi?id=74926 + + Reviewed by Simon Hausmann. + + Expose the enable scroll animator setting. + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + (QWebSettings::QWebSettings): + * Api/qwebsettings.h: + +2012-08-22 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] REGRESSION(r125428): fast/profiler/nested-start-and-stop-profiler.html fails + https://bugs.webkit.org/show_bug.cgi?id=93897 + + Reviewed by Kenneth Rohde Christiansen. + + Fixed some test expectations. + + * tests/qobjectbridge/tst_qobjectbridge.cpp: + (tst_QObjectBridge::objectDeleted): Since runtime methods are real function objects again, we + can go back to testing Function.prototype.call, as it was done before r125428. + (tst_QObjectBridge::introspectQtMethods_data): Removed tests for the length property. + (tst_QObjectBridge::introspectQtMethods): Changed test expectation of the properties of + run-time methods back to being non-configurable, as before r125428. + 2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com> Unreviewed, rolling out r126146. diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog index ed76faf90..96ce099ee 100644 --- a/Source/WebKit/win/ChangeLog +++ b/Source/WebKit/win/ChangeLog @@ -1,3 +1,14 @@ +2012-08-22 Nikhil Bhargava <nbhargava@google.com> + + Reduce Font.h includes across project -- improves RenderObject.h compile time + https://bugs.webkit.org/show_bug.cgi?id=93629 + + Reviewed by Eric Seidel. + + Adds includes due to change in RenderStyle.h + + * DOMCoreClasses.cpp: + 2012-08-15 Ryosuke Niwa <rniwa@webkit.org> Update manual tests and comments to refer to TestRunner instead of LayoutTestController diff --git a/Source/WebKit/win/DOMCoreClasses.cpp b/Source/WebKit/win/DOMCoreClasses.cpp index 26d6ea52d..42fb2e051 100644 --- a/Source/WebKit/win/DOMCoreClasses.cpp +++ b/Source/WebKit/win/DOMCoreClasses.cpp @@ -37,6 +37,7 @@ #include <WebCore/DOMWindow.h> #include <WebCore/Document.h> #include <WebCore/Element.h> +#include <WebCore/Font.h> #include <WebCore/Frame.h> #include <WebCore/SimpleFontData.h> #include <WebCore/HTMLFormElement.h> |