diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-21 10:57:44 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-21 10:57:44 +0200 |
commit | 5ef7c8a6a70875d4430752d146bdcb069605d71d (patch) | |
tree | f6256640b6c46d7da221435803cae65326817ba2 /Source/WebKit/chromium | |
parent | decad929f578d8db641febc8740649ca6c574638 (diff) | |
download | qtwebkit-5ef7c8a6a70875d4430752d146bdcb069605d71d.tar.gz |
Imported WebKit commit 356d83016b090995d08ad568f2d2c243aa55e831 (http://svn.webkit.org/repository/webkit/trunk@126147)
New snapshot including various build fixes for newer Qt 5
Diffstat (limited to 'Source/WebKit/chromium')
175 files changed, 5991 insertions, 1953 deletions
diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index 3d9ea37fa..3d42baa97 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,1717 @@ +2012-08-20 Kent Tamura <tkent@chromium.org> + + [Chromium-win] Use native digits in parsing/formatting dates in the textfield part of input[type=date] + https://bugs.webkit.org/show_bug.cgi?id=94281 + + Reviewed by Hajime Morita. + + * tests/LocaleWinTest.cpp: + (TEST_F): Added formatting and parsing tests for Persian locale to check + native digit behavior. + +2012-08-20 Kent Tamura <tkent@chromium.org> + + [Chromium] Make the popup positioning code testable + https://bugs.webkit.org/show_bug.cgi?id=94086 + + Reviewed by Hajime Morita. + + * WebKit.gypi: Add PopupContainerTest.cpp. + * tests/PopupContainerTest.cpp: Added. + (MockPopupContent): + (calculatePosition): + (TEST): + +2012-08-20 Scott Graham <scottmg@chromium.org> + + [Chromium] Fix warnings on Windows builds + https://bugs.webkit.org/show_bug.cgi?id=94543 + + Reviewed by Adrienne Walker. + + * tests/CCMathUtilTest.cpp: + +2012-08-20 Adam Klein <adamk@chromium.org> + + Allow MutationEvents to be enabled/disabled per context + https://bugs.webkit.org/show_bug.cgi?id=94016 + + Reviewed by Ojan Vafai. + + Add Chromium/WebKit API for enabling/disabling MutationEvents via + WebPermissionClient. + + * public/WebPermissionClient.h: + (WebPermissionClient): + (WebKit::WebPermissionClient::allowMutationEvents): + * src/ContextFeaturesClientImpl.cpp: + (WebKit::ContextFeaturesClientImpl::askIfIsEnabled): + +2012-08-20 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r126095. + http://trac.webkit.org/changeset/126095 + https://bugs.webkit.org/show_bug.cgi?id=94555 + + Breaks compilation of downstream WebWidget::paint + implementations (Requested by jamesr on #webkit). + + * 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::WebViewImpl::paint): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-08-20 Kentaro Hara <haraken@chromium.org> + + [V8] Move instrumentedCallFunction() from V8Proxy to ScriptController + https://bugs.webkit.org/show_bug.cgi?id=94456 + + Reviewed by Adam Barth. + + To kill V8Proxy, this patch moves instrumentedCallFunction() from V8Proxy + to ScriptController. Also this patch renames instrumentedCallFunction() + to callFunctionWithInstrumentation(), for consistency with callFunction(). + + No tests. No change in behavior. + + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::dispatchOnInspectorFrontend): + +2012-08-20 Kentaro Hara <haraken@chromium.org> + + [V8] Move retrieve{Window,Frame,PerContextData}() from V8Proxy to V8Binding + https://bugs.webkit.org/show_bug.cgi?id=94460 + + Reviewed by Adam Barth. + + To kill V8Proxy, we move retrieve{Window,Frame,PerContextData}() + from V8Proxy to V8Binding. Also, this patch renames these methods as follows: + + - retrieveWindow() -> toDOMWindow() + - retrieveFrame() -> toFrameIfNotDetached() + - retrievePerContextData() -> perContextDataForCurrentWorld() + + No tests. No change in behavior. + + * src/WebBindings.cpp: + (WebKit::makeIntArrayImpl): + (WebKit::makeStringArrayImpl): + * src/WebFrameImpl.cpp: + (WebKit::WebFrame::frameForContext): + +2012-08-20 James Robinson <jamesr@chromium.org> + + [chromium] REGRESSION(126076) Should not touch old GraphicsLayerChromium::m_contentsLayer when setting up a new contents layer + https://bugs.webkit.org/show_bug.cgi?id=94544 + + Reviewed by Adrienne Walker. + + * src/WebLayerImpl.cpp: + (WebKit::WebLayerImpl::id): + (WebKit): + * src/WebLayerImpl.h: + (WebLayerImpl): + +2012-08-20 Kentaro Hara <haraken@chromium.org> + + [V8] Move collectGarbage() from ScriptController to V8GCController + https://bugs.webkit.org/show_bug.cgi?id=94455 + + Reviewed by Adam Barth. + + - This patch moves collectGarbage() from ScriptController to V8GCController. + - This patch makes collectGarbage() a static method. + - This patch removes ScriptController::lowMemoryNotification() + since it is not used at all. + + No tests. No change in behavior. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::collectGarbage): + +2012-08-20 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-20 James Robinson <jamesr@chromium.org> + + Unreviewed. Roll WebKit chromium DEPS forward. + + * DEPS: + +2012-08-20 Kentaro Hara <haraken@chromium.org> + + [V8] Move clearForClose() and clearForNavigation() from V8Proxy to ScriptController + https://bugs.webkit.org/show_bug.cgi?id=94459 + + Reviewed by Adam Barth. + + To kill V8Proxy, we can move clearForClose() and + clearForNavigation() from V8Proxy to ScriptController. + + No tests. No change in behavior. + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::detachedFromParent3): + +2012-08-20 Kentaro Hara <haraken@chromium.org> + + [V8] Move mainWorldContext() from V8Proxy to ScriptController + https://bugs.webkit.org/show_bug.cgi?id=94453 + + Reviewed by Adam Barth. + + This patch moves mainWorldContext() from V8Proxy to ScriptController. + In addition, this patch removes dependency on V8Proxy from WorldContextHandle. + + No tests. No change in behavior. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::mainWorldScriptContext): + +2012-08-20 Adam Klein <adamk@chromium.org> + + Remove redundant TOUCH_LISTENER event type + https://bugs.webkit.org/show_bug.cgi?id=94524 + + Reviewed by Ryosuke Niwa. + + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::setIsAcceptingTouchEvents): Remove + bookkeeping for TOUCH_LISTENER. + +2012-08-16 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. + + * WebKit.gyp: + * src/NonCompositedContentHost.cpp: + (WebKit::NonCompositedContentHost::NonCompositedContentHost): + (WebKit::NonCompositedContentHost::setScrollLayer): + (WebKit::NonCompositedContentHost::setViewport): + (WebKit::NonCompositedContentHost::scrollLayer): + * src/NonCompositedContentHost.h: + * src/WebContentLayerImpl.cpp: + (WebKit::WebContentLayer::create): + (WebKit::WebContentLayerImpl::WebContentLayerImpl): + (WebKit::WebContentLayerImpl::~WebContentLayerImpl): + (WebKit::WebContentLayerImpl::layer): + (WebKit): + (WebKit::WebContentLayerImpl::clearClient): + (WebKit::WebContentLayerImpl::setDoubleSided): + (WebKit::WebContentLayerImpl::setContentsScale): + (WebKit::WebContentLayerImpl::setUseLCDText): + (WebKit::WebContentLayerImpl::setDrawCheckerboardForMissingTiles): + (WebKit::WebContentLayerImpl::paintContents): + * src/WebContentLayerImpl.h: + (WebContentLayerImpl): + * src/WebExternalTextureLayer.cpp: Removed. + * src/WebExternalTextureLayerImpl.cpp: Added. + (WebKit): + (WebKit::WebExternalTextureLayer::create): + (WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl): + (WebKit::WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl): + (WebKit::WebExternalTextureLayerImpl::layer): + (WebKit::WebExternalTextureLayerImpl::clearClient): + (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: Renamed from Source/WebKit/chromium/src/WebContentLayer.cpp. + (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::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::clearRenderSurface): + (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/WebScrollableLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebScrollableLayer.cpp. + (WebKit): + (WebKit::WebScrollableLayer::setScrollPosition): + (WebKit::WebScrollableLayer::setScrollable): + (WebKit::WebScrollableLayer::setHaveWheelEventHandlers): + (WebKit::WebScrollableLayer::setShouldScrollOnMainThread): + (WebKit::WebScrollableLayer::setNonFastScrollableRegion): + (WebKit::WebScrollableLayer::setIsContainerForFixedPositionLayers): + (WebKit::WebScrollableLayer::setFixedToContainerLayer): + * 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-20 Shawn Singh <shawnsingh@chromium.org> + + [chromium] CCMathUtilTest.smallestAngleBetweenVectors unit test failing + https://bugs.webkit.org/show_bug.cgi?id=94502 + + Reviewed by Kenneth Russell. + + The test needed to use EXPECT_FLOAT_EQ instead of EXPECT_EQ. In + this patch, the test is also re-enabled. + + * tests/CCMathUtilTest.cpp: + +2012-08-20 Leandro Gracia Gil <leandrogracia@chromium.org> + + Move transformFriendlyBoundingBox out of Range + https://bugs.webkit.org/show_bug.cgi?id=94366 + + Reviewed by Ryosuke Niwa. + + Update the WebKit code that makes use of transformFriendlyBoundingBox. + + * src/FindInPageCoordinates.cpp: + (WebKit::findInPageRectFromRange): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::find): + (WebKit::WebFrameImpl::selectFindMatch): + +2012-08-20 Leandro Gracia Gil <leandrogracia@chromium.org> + + [Chromium] detectContentIntentAround has a misleading name + https://bugs.webkit.org/show_bug.cgi?id=94349 + + Reviewed by Adam Barth. + + The current WebViewClient API exposes a method named detectContentIntentAround. + However, this is not designed to detect any "content intent", but to allow the embedder + to detect content around a position and fire Android intents if appropriate. + + This patch also disables content detection if the touched node listens to events + that consume the tap action like clicks, touch events or mouse events. + + * public/WebViewClient.h: + (WebViewClient): + (WebKit::WebViewClient::detectContentAround): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::detectContentOnTouch): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-08-20 Hans Wennborg <hans@chromium.org> + + Respect runtime flags for Device Orientation and Device Motion + https://bugs.webkit.org/show_bug.cgi?id=94479 + + Reviewed by Adam Barth. + + WebRuntimeFeatures::enableDeviceMotion should not be hard-coded to + false. + + * src/WebViewImpl.cpp: + (WebKit::WebView::create): + +2012-08-20 David Reveman <reveman@chromium.org> + + [Chromium] Schedule texture uploads based on hard-coded timer and vsync. + https://bugs.webkit.org/show_bug.cgi?id=84281 + + Reviewed by James Robinson. + + * tests/CCSchedulerTest.cpp: + (WebKitTests::TEST): + * tests/CCSchedulerTestCommon.h: + (WebKitTests::FakeCCTimeSource::FakeCCTimeSource): + (WebKitTests::FakeCCTimeSource::setNextTickTime): + (FakeCCTimeSource): + * tests/CCTextureUpdateControllerTest.cpp: + +2012-08-20 Kenneth Russell <kbr@google.com> + + Unreviewed Chromium rebaselining and test failure suppressions. + + https://bugs.webkit.org/show_bug.cgi?id=94502 + + * tests/CCMathUtilTest.cpp: + +2012-08-20 Ian Vollick <vollick@chromium.org> + + [chromium] Add tracing for active composited animations + https://bugs.webkit.org/show_bug.cgi?id=84210 + + Reviewed by James Robinson. + + This patch issues the trace events from the animations. Animations will + report when they start and finish on the main and impl threads (via + TRACE_EVENT_ASYNC*), and also issues instant trace events whenever they + change state. + + * src/WebAnimationImpl.cpp: + (WebKit::WebAnimationImpl::cloneToCCAnimation): + * tests/CCAnimationTestCommon.h: + +2012-08-20 Sami Kyostila <skyostil@chromium.org> + + [chromium] Convert screen space scroll gestures to layer space + https://bugs.webkit.org/show_bug.cgi?id=92499 + + Reviewed by James Robinson. + + Added new tests for verifying transformed layer scrolling: + + CCLayerTreeHostImplTest.scrollAxisAlignedRotatedLayer + CCLayerTreeHostImplTest.scrollNonAxisAlignedRotatedLayer + CCLayerTreeHostImplTest.scrollScaledLayer + + Also some tests for the introduced math utilities: + + CCMathUtilTest.smallestAngleBetweenVectors + CCMathUtilTest.vectorProjection + + * src/WebCompositorInputHandlerImpl.cpp: + (WebKit::WebCompositorInputHandlerImpl::handleInputEventInternal): + (WebKit::WebCompositorInputHandlerImpl::handleGestureFling): + * tests/CCLayerTreeHostImplTest.cpp: Adjusted scroll delta in scrollChildBeyondLimit to avoid triggering the 45 degree rule. + * tests/CCLayerTreeHostTest.cpp: + * tests/CCMathUtilTest.cpp: + * tests/WebCompositorInputHandlerImplTest.cpp: + (MockCCInputHandlerClient): + (WebKit::TEST_F): + +2012-08-20 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: load scripts panel lazily + https://bugs.webkit.org/show_bug.cgi?id=94416 + + Reviewed by Vsevolod Vlasov. + + * WebKit.gyp: + +2012-08-19 Kentaro Hara <haraken@chromium.org> + + [V8] Move contextDebugId() and setContextDebugId() from V8Proxy to ScriptController + https://bugs.webkit.org/show_bug.cgi?id=94446 + + Reviewed by Adam Barth. + + To kill V8Proxy, we can move contextDebugId() and setContextDebugId() + from V8Proxy to ScriptController. + + No tests. No change in behavior. + + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::didCreateScriptContext): + +2012-08-20 Kentaro Hara <haraken@chromium.org> + + [V8] Move V8Proxy::m_extensions to ScriptController + https://bugs.webkit.org/show_bug.cgi?id=94444 + + Reviewed by Adam Barth. + + To kill V8Proxy, this patch moves V8Proxy::m_extensions to ScriptController. + + No tests. No change in behavior. + + * src/WebScriptController.cpp: + (WebKit::WebScriptController::registerExtension): + +2012-08-19 James Robinson <jamesr@chromium.org> + + [chromium] Put webkit compositor binding files in separate conditionally included gyp section + https://bugs.webkit.org/show_bug.cgi?id=94392 + + Reviewed by Dirk Pranke. + + This allows the use_libcc_for_compositor gyp variable to control whether the webkit bindings are pulled from the + WebKit repository or an external target. + + * WebKit.gyp: + * WebKit.gypi: + +2012-08-19 Rick Byers <rbyers@chromium.org> + + [chromium] Add additional fields to WebGestureEvent + https://bugs.webkit.org/show_bug.cgi?id=94238 + + Reviewed by James Robinson. + + Add a union to WebGestureEvent with per-event-type data, as a first + step to eliminating the overloaded delta fields. + + * public/WebInputEvent.h: + (WebGestureEvent): + (WebKit::WebGestureEvent::WebGestureEvent): + * src/WebInputEvent.cpp: + (SameSizeAsWebGestureEvent): + +2012-08-19 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: load network panel lazily + https://bugs.webkit.org/show_bug.cgi?id=94414 + + Reviewed by Vsevolod Vlasov. + + * WebKit.gyp: + +2012-08-18 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: make profiles panel a lazily loaded module. + https://bugs.webkit.org/show_bug.cgi?id=94351 + + Reviewed by Yury Semikhatsky. + + * WebKit.gyp: + +2012-08-18 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: load panels code on demand + https://bugs.webkit.org/show_bug.cgi?id=94326 + + Reviewed by Vsevolod Vlasov. + + * WebKit.gyp: + * scripts/concatenate_js_files.py: + (OrderedJSFilesExtractor.handle_starttag): + * scripts/inline_js_imports.py: + (main): + +2012-08-17 Dirk Pranke <dpranke@chromium.org> + + Unreviewed, rolling out r125897. + http://trac.webkit.org/changeset/125897 + https://bugs.webkit.org/show_bug.cgi?id=94326 + + this patch seems to have broken the inspector on the apple mac bots. + + * WebKit.gyp: + * scripts/concatenate_js_files.py: + (OrderedJSFilesExtractor.handle_starttag): + * scripts/inline_js_imports.py: + (main): + +2012-08-17 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r125922. + http://trac.webkit.org/changeset/125922 + https://bugs.webkit.org/show_bug.cgi?id=94389 + + "Causing failing/crashing tests on Mac bots" (Requested by + bradee-oh on #webkit). + + * WebKit.gyp: + +2012-08-16 James Robinson <jamesr@chromium.org> + + [chromium] Add Source/WebCore/platform/graphics/chromium/cc/ to include path and remove cc/ prefix from includes + https://bugs.webkit.org/show_bug.cgi?id=94279 + + Reviewed by Adam Barth. + + * src/WebAnimationCurveCommon.cpp: + * src/WebAnimationImpl.cpp: + * src/WebCompositorInputHandlerImpl.cpp: + * src/WebCompositorInputHandlerImpl.h: + * src/WebExternalTextureLayer.cpp: + * src/WebFloatAnimationCurve.cpp: + * src/WebLayerTreeView.cpp: + * src/WebLayerTreeViewImpl.cpp: + * src/WebTransformAnimationCurve.cpp: + * tests/CCActiveAnimationTest.cpp: + * tests/CCAnimationTestCommon.cpp: + * tests/CCAnimationTestCommon.h: + * tests/CCDamageTrackerTest.cpp: + * tests/CCDelayBasedTimeSourceTest.cpp: + * tests/CCFrameRateControllerTest.cpp: + * tests/CCKeyframedAnimationCurveTest.cpp: + * tests/CCLayerAnimationControllerTest.cpp: + * tests/CCLayerImplTest.cpp: + * tests/CCLayerIteratorTest.cpp: + * tests/CCLayerQuadTest.cpp: + * tests/CCLayerSorterTest.cpp: + * tests/CCLayerTestCommon.cpp: + * tests/CCLayerTestCommon.h: + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCLayerTreeHostTest.cpp: + * tests/CCMathUtilTest.cpp: + * tests/CCOcclusionTrackerTest.cpp: + * tests/CCOcclusionTrackerTestCommon.h: + * tests/CCPrioritizedTextureTest.cpp: + * tests/CCQuadCullerTest.cpp: + * tests/CCRenderSurfaceFiltersTest.cpp: + * tests/CCRenderSurfaceTest.cpp: + * tests/CCResourceProviderTest.cpp: + * tests/CCSchedulerStateMachineTest.cpp: + * tests/CCSchedulerTest.cpp: + * tests/CCSchedulerTestCommon.h: + * tests/CCScopedTextureTest.cpp: + * tests/CCScrollbarAnimationControllerLinearFadeTest.cpp: + * tests/CCSolidColorLayerImplTest.cpp: + * tests/CCTestCommon.h: + * tests/CCTextureUpdateControllerTest.cpp: + * tests/CCThreadTaskTest.cpp: + * tests/CCThreadedTest.cpp: + * tests/CCThreadedTest.h: + * tests/CCTiledLayerImplTest.cpp: + * tests/CCTiledLayerTestCommon.h: + * tests/CCTimerTest.cpp: + * tests/ContentLayerChromiumTest.cpp: + * tests/FakeCCGraphicsContext.h: + * tests/FakeCCLayerTreeHostClient.h: + * tests/FloatQuadTest.cpp: + * tests/GraphicsLayerChromiumTest.cpp: + * tests/LayerChromiumTest.cpp: + * tests/LayerRendererChromiumTest.cpp: + * tests/MockCCQuadCuller.h: + * tests/PlatformGestureCurveTest.cpp: + * tests/ScrollbarLayerChromiumTest.cpp: + * tests/TextureLayerChromiumTest.cpp: + * tests/TiledLayerChromiumTest.cpp: + * tests/TreeSynchronizerTest.cpp: + * tests/WebCompositorInputHandlerImplTest.cpp: + * tests/WebFloatAnimationCurveTest.cpp: + * tests/WebTransformAnimationCurveTest.cpp: + +2012-08-17 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: make profiles panel a lazily loaded module. + https://bugs.webkit.org/show_bug.cgi?id=94351 + + Reviewed by Yury Semikhatsky. + + * WebKit.gyp: + +2012-08-17 Keishi Hattori <keishi@webkit.org> + + [Chromium] Turn off ENABLE_DATALIST_ELEMENT for Android + https://bugs.webkit.org/show_bug.cgi?id=94337 + + Reviewed by Kent Tamura. + + We shouldn't have turned ENABLE_DATALIST_ELEMENT on for Android. + + * features.gypi: + +2012-08-17 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r125892. + http://trac.webkit.org/changeset/125892 + https://bugs.webkit.org/show_bug.cgi?id=94350 + + Broke windows build (Requested by vollick on #webkit). + + * src/WebAnimationImpl.cpp: + (WebKit::WebAnimationImpl::cloneToCCAnimation): + +2012-08-17 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-08-17 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: load panels code on demand + https://bugs.webkit.org/show_bug.cgi?id=94326 + + Reviewed by Vsevolod Vlasov. + + * WebKit.gyp: + * scripts/concatenate_js_files.py: + (OrderedJSFilesExtractor.handle_starttag): + * scripts/inline_js_imports.py: + (main): + +2012-08-17 Ian Vollick <vollick@chromium.org> + + [chromium] Add tracing for active composited animations + https://bugs.webkit.org/show_bug.cgi?id=84210 + + Reviewed by James Robinson. + + This patch issues the trace events from the animations. Animations will + report when they start and finish on the main and impl threads (via + TRACE_EVENT_ASYNC*), and also issues instant trace events whenever they + change state. + + * src/WebAnimationImpl.cpp: + (WebKit::WebAnimationImpl::cloneToCCAnimation): + +2012-08-16 Antoine Labour <piman@chromium.org> + + [chromium] Add resource transfer functions to CCResourceProvider + https://bugs.webkit.org/show_bug.cgi?id=93524 + + Reviewed by James Robinson. + + This adds methods to CCResourceProvider to be able to transport + resources from a child to a parent. + + Added test to CCResourceProviderTest. + + * tests/CCResourceProviderTest.cpp: + (WebKit::textureSize): + (WebKit): + (WebKit::Texture::Texture): + (Texture): + (ContextSharedData): + (WebKit::ContextSharedData::create): + (WebKit::ContextSharedData::insertSyncPoint): + (WebKit::ContextSharedData::genMailbox): + (WebKit::ContextSharedData::produceTexture): + (WebKit::ContextSharedData::consumeTexture): + (WebKit::ContextSharedData::ContextSharedData): + (WebKit::ResourceProviderContext::create): + (ResourceProviderContext): + (WebKit::ResourceProviderContext::insertSyncPoint): + (WebKit::ResourceProviderContext::waitSyncPoint): + (WebKit::ResourceProviderContext::genMailboxCHROMIUM): + (WebKit::ResourceProviderContext::produceTextureCHROMIUM): + (WebKit::ResourceProviderContext::consumeTextureCHROMIUM): + (WebKit::ResourceProviderContext::ResourceProviderContext): + (PendingProduceTexture): + (WebKit::CCResourceProviderTest::CCResourceProviderTest): + (CCResourceProviderTest): + (WebKit::TEST_F): + +2012-08-16 David Grogan <dgrogan@chromium.org> + + IndexedDB: Frontend and plumbing for integer versions + https://bugs.webkit.org/show_bug.cgi?id=92897 + + Reviewed by Tony Chang. + + * src/IDBCallbacksProxy.cpp: + (WebKit::IDBCallbacksProxy::onBlocked): + (WebKit): + (WebKit::IDBCallbacksProxy::onUpgradeNeeded): + * src/IDBCallbacksProxy.h: + (IDBCallbacksProxy): + * src/IDBDatabaseBackendProxy.cpp: + (WebKit::IDBDatabaseBackendProxy::setVersion): + * src/IDBDatabaseCallbacksProxy.cpp: + (WebKit::IDBDatabaseCallbacksProxy::onVersionChange): + (WebKit): + * src/IDBDatabaseCallbacksProxy.h: + (IDBDatabaseCallbacksProxy): + * src/IDBFactoryBackendProxy.cpp: + (WebKit::IDBFactoryBackendProxy::open): + * src/IDBFactoryBackendProxy.h: + (IDBFactoryBackendProxy): + * src/IDBTransactionCallbacksProxy.cpp: + (WebKit::IDBTransactionCallbacksProxy::onComplete): + * src/WebIDBCallbacksImpl.cpp: + (WebKit::WebIDBCallbacksImpl::WebIDBCallbacksImpl): + (WebKit::WebIDBCallbacksImpl::onSuccess): + We don't want to create IDBDatabaseBackendProxy again if we've already + created it during upgradeNeeded. This makes + IDBRequest::onSuccess(IDBDatabaseBackend) reuse its previous + IDBDatabaseBackendInterface if it has one. + + (WebKit::WebIDBCallbacksImpl::onBlocked): + (WebKit): + (WebKit::WebIDBCallbacksImpl::onUpgradeNeeded): + * src/WebIDBCallbacksImpl.h: + (WebIDBCallbacksImpl): + * src/WebIDBDatabaseCallbacksImpl.cpp: + (WebKit::WebIDBDatabaseCallbacksImpl::onVersionChange): + (WebKit): + * src/WebIDBDatabaseCallbacksImpl.h: + (WebIDBDatabaseCallbacksImpl): + * src/WebIDBDatabaseImpl.cpp: + (WebKit::WebIDBDatabaseImpl::WebIDBDatabaseImpl): + (WebKit::WebIDBDatabaseImpl::close): + (WebKit::WebIDBDatabaseImpl::open): + * src/WebIDBDatabaseImpl.h: + (WebIDBDatabaseImpl): + * src/WebIDBFactoryImpl.cpp: + (WebKit::WebIDBFactoryImpl::open): + * src/WebIDBFactoryImpl.h: + (WebIDBFactoryImpl): + * src/WebIDBTransactionCallbacksImpl.cpp: + (WebKit::WebIDBTransactionCallbacksImpl::onComplete): + * tests/IDBAbortOnCorruptTest.cpp: + (WebCore::TEST): + * tests/IDBDatabaseBackendTest.cpp: + +2012-08-16 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r125838. + http://trac.webkit.org/changeset/125838 + https://bugs.webkit.org/show_bug.cgi?id=94283 + + Breaks Mac compile due to bug 74625 (Requested by enne on + #webkit). + + * tests/CCResourceProviderTest.cpp: + (WebKit::ResourceProviderContext::create): + (WebKit::ResourceProviderContext::textureSize): + (ResourceProviderContext): + (WebKit::ResourceProviderContext::ResourceProviderContext): + (WebKit::ResourceProviderContext::Texture::Texture): + (Texture): + (WebKit::CCResourceProviderTest::CCResourceProviderTest): + (CCResourceProviderTest): + (WebKit::TEST_F): + +2012-08-16 Kenneth Russell <kbr@google.com> + + Unreviewed, rolling out r125800. + http://trac.webkit.org/changeset/125800 + https://bugs.webkit.org/show_bug.cgi?id=84281 + + Hypothesis that this change caused gpu_throughput_tests to + start timing out on all platforms on the Chromium GPU + canaries. + + * tests/CCSchedulerTest.cpp: + (WebKitTests::TEST): + * tests/CCSchedulerTestCommon.h: + (WebKitTests::FakeCCTimeSource::FakeCCTimeSource): + (FakeCCTimeSource): + * tests/CCTextureUpdateControllerTest.cpp: + +2012-08-16 Antoine Labour <piman@chromium.org> + + [chromium] Add resource transfer functions to CCResourceProvider + https://bugs.webkit.org/show_bug.cgi?id=93524 + + Reviewed by James Robinson. + + This adds methods to CCResourceProvider to be able to transport + resources from a child to a parent. + + Added test to CCResourceProviderTest. + + * tests/CCResourceProviderTest.cpp: + (WebKit::textureSize): + (WebKit): + (WebKit::Texture::Texture): + (Texture): + (ContextSharedData): + (WebKit::ContextSharedData::create): + (WebKit::ContextSharedData::insertSyncPoint): + (WebKit::ContextSharedData::genMailbox): + (WebKit::ContextSharedData::produceTexture): + (WebKit::ContextSharedData::consumeTexture): + (WebKit::ContextSharedData::ContextSharedData): + (WebKit::ResourceProviderContext::create): + (ResourceProviderContext): + (WebKit::ResourceProviderContext::insertSyncPoint): + (WebKit::ResourceProviderContext::waitSyncPoint): + (WebKit::ResourceProviderContext::genMailboxCHROMIUM): + (WebKit::ResourceProviderContext::produceTextureCHROMIUM): + (WebKit::ResourceProviderContext::consumeTextureCHROMIUM): + (WebKit::ResourceProviderContext::ResourceProviderContext): + (PendingProduceTexture): + (WebKit::CCResourceProviderTest::CCResourceProviderTest): + (CCResourceProviderTest): + (WebKit::TEST_F): + +2012-08-16 Alexandre Elias <aelias@google.com> + + [chromium] Replace destRect with destOffset in texture upload + https://bugs.webkit.org/show_bug.cgi?id=94154 + + Reviewed by James Robinson. + + Previously, texture upload code implicitly assumed that sourceRect and + destRect have the same size. The behavior is undefined if they are + different, since they are used interchangeably and there's no support + for scaling from one rect to the other. This patch enforces that + constraint at the interface level by replacing all instances of + "IntRect destRect" by "IntSize destOffset". + + * tests/CCResourceProviderTest.cpp: + (WebKit::TEST_F): + * tests/CCTextureUpdateControllerTest.cpp: + * tests/CCTiledLayerTestCommon.cpp: + (WebKitTests::FakeLayerTextureUpdater::Texture::updateRect): + * tests/CCTiledLayerTestCommon.h: + (Texture): + (WebKitTests::FakeTextureUploader::uploadTexture): + +2012-08-16 James Robinson <jamesr@chromium.org> + + [chromium] Remove unnecessary tree hierarchy inspection APIs from WebLayer + https://bugs.webkit.org/show_bug.cgi?id=94229 + + Reviewed by Adrienne Walker. + + Remove dead WebLayer function implementations and tests of same. + + * src/WebLayer.cpp: + * tests/WebLayerTest.cpp: + +2012-08-16 David Reveman <reveman@chromium.org> + + [Chromium] Avoid aliasing global symbol monotonicallyIncreasingTime(). + https://bugs.webkit.org/show_bug.cgi?id=94233 + + Reviewed by James Robinson. + + * tests/CCDelayBasedTimeSourceTest.cpp: + (WebKitTests::TEST): + * tests/CCFrameRateControllerTest.cpp: + (WebKitTests::TEST): + * tests/CCSchedulerTestCommon.h: + (WebKitTests::FakeCCDelayBasedTimeSource::setMonotonicTimeNow): + (WebKitTests::FakeCCDelayBasedTimeSource::FakeCCDelayBasedTimeSource): + (FakeCCDelayBasedTimeSource): + +2012-08-16 David Reveman <reveman@chromium.org> + + [Chromium] Schedule texture uploads based on hard-coded timer and vsync. + https://bugs.webkit.org/show_bug.cgi?id=84281 + + Reviewed by James Robinson. + + * tests/CCSchedulerTest.cpp: + (WebKitTests::TEST): + * tests/CCSchedulerTestCommon.h: + (WebKitTests::FakeCCTimeSource::FakeCCTimeSource): + (WebKitTests::FakeCCTimeSource::setNextTickTime): + (FakeCCTimeSource): + * tests/CCTextureUpdateControllerTest.cpp: + +2012-08-16 Dana Jansens <danakj@chromium.org> + + [chromium] Impl scrolling crashes when the renderer's initialization failed + https://bugs.webkit.org/show_bug.cgi?id=94232 + + Reviewed by James Robinson. + + Also updated the finishAllRenderingAfterContextLost to properly fail + renderer initialization. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-08-16 Peter Beverloo <peter@chromium.org> + + [Chromium] Pass the --strip-binary argument to the apk test generator + https://bugs.webkit.org/show_bug.cgi?id=94224 + + Reviewed by Adam Barth. + + The native test generator currently relies on the $STRIP environment + variable to be available, which it shouldn't do. Instead, pass it as an + argument to the script. The $STRIP variable is being deprecated. + + * WebKitUnitTests.gyp: + +2012-08-16 James Robinson <jamesr@chromium.org> + + [chromium] Remove alwaysReserveTextures code - it doesn't do anything + https://bugs.webkit.org/show_bug.cgi?id=94183 + + Reviewed by Dimitri Glazkov. + + Stops attempting to find the scrollbar layers and call setAlwaysReserveTextures() on them since the call doesn't + do anything. + + * src/NonCompositedContentHost.cpp: + (WebKit::NonCompositedContentHost::setViewport): + * src/WebLayer.cpp: + +2012-08-16 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-08-16 Keishi Hattori <keishi@webkit.org> + + DOMWindowPagePopup needs to be installed before loading the html inside the page popup + https://bugs.webkit.org/show_bug.cgi?id=94193 + + Reviewed by Kent Tamura. + + We are using window.pagePopupController.localizeNumberString while loading so we need to install DOMWindowPagePopup before loading the html. + + * src/WebPagePopupImpl.cpp: + (WebKit::WebPagePopupImpl::initPage): + +2012-08-16 Marja Hölttä <marja@chromium.org> + + WebHistoryItem: Enable reading selected file names from document state + https://bugs.webkit.org/show_bug.cgi?id=91231 + + Reviewed by Jochen Eisinger. + + This change enables Chromium to set up file permissions properly when + the session restore feature restores a page with selected files. + + * public/WebHistoryItem.h: + (WebHistoryItem): Added getReferencedFilePaths. + * src/WebHistoryItem.cpp: + (WebKit::WebHistoryItem::getReferencedFilePaths): Extracts selected and posted file paths from a document state. + (WebKit): + +2012-08-15 Shawn Singh <shawnsingh@chromium.org> + + [chromium] set scissorRect per quad so that quads are correctly clipped + https://bugs.webkit.org/show_bug.cgi?id=94050 + + Reviewed by Adrienne Walker. + + Updated two unit tests to reflect that we need to always scissor, + until we refactor so that quads do not depend on scissoring. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-08-16 Hironori Bono <hbono@chromium.org> + + Prevent showing suggestions when right-clicking a selection range. + https://bugs.webkit.org/show_bug.cgi?id=94189 + + Reviewed by Hajime Morita. + + To emulate Safari, my r120810 changes selection when right-clicking a misspelled + word. Unfortunately, this change somehow uses VisibleSelection::isCaretOrRange + and it changes the existing selection when right-clicking a selection which + includes a misspelled word. This change uses VisibleSelection::isCaret to + prevent showing suggestions when right-clicking a selection range. (Neither does + Safari show suggestions when there is a selection range.) + + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): + +2012-08-15 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-08-15 Ryosuke Niwa <rniwa@webkit.org> + + Update manual tests and comments to refer to TestRunner instead of LayoutTestController + https://bugs.webkit.org/show_bug.cgi?id=94168 + + Reviewed by Kent Tamura. + + * public/WebDevToolsAgent.h: + (WebDevToolsAgent): + * public/WebView.h: + (WebView): + +2012-08-15 Alec Flett <alecflett@chromium.org> + + IndexedDB: generate index keys for existing data in createIndex in front end + https://bugs.webkit.org/show_bug.cgi?id=91125 + + Reviewed by Tony Chang. + + Add Chromium API methods to let the renderer process tell the + browser process about indexing progress. + + * public/WebIDBObjectStore.h: + (WebKit::WebIDBObjectStore::openCursor): + * src/IDBObjectStoreBackendProxy.cpp: + (WebKit::IDBObjectStoreBackendProxy::setIndexKeys): + (WebKit): + (WebKit::IDBObjectStoreBackendProxy::setIndexesReady): + (WebKit::IDBObjectStoreBackendProxy::openCursor): + * src/IDBObjectStoreBackendProxy.h: + (IDBObjectStoreBackendProxy): + * src/WebIDBObjectStoreImpl.cpp: + (WebKit::WebIDBObjectStoreImpl::setIndexKeys): + (WebKit): + (WebKit::WebIDBObjectStoreImpl::setIndexesReady): + (WebKit::WebIDBObjectStoreImpl::openCursor): + * src/WebIDBObjectStoreImpl.h: + (WebIDBObjectStoreImpl): + +2012-08-15 Bruno de Oliveira Abinader <bruno.abinader@basyskom.com> + + [css3-text] Add CSS3 Text decoration compile flag + https://bugs.webkit.org/show_bug.cgi?id=93863 + + Reviewed by Julien Chaffraix. + + This patch handles the compile flag implementation, which will come disabled by + default, thus not exposing the CSS3 text decoration features to the web, unless + when explicitly enabling it with "--css3-text-decoration" build parameter. + + * features.gypi: + +2012-08-15 Iain Merrick <husky@chromium.org> + + Refactoring: move EventHandler::targetNode into HitTestResult + https://bugs.webkit.org/show_bug.cgi?id=94107 + + Reviewed by Dimitri Glazkov. + + This static helper method in EventHandler was made public so that + WebFrameImpl can call it. That's untidy because EventHandler isn't + really involved. This patch turns it into an instance method of + HitTestResult (with a wrapper in MouseEventWithHitTestResult for + convenience). + + Pure refactoring, no behavior change, no new test needed. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::visiblePositionForWindowPoint): + +2012-08-15 David Grogan <dgrogan@chromium.org> + + IndexedDB: Add some ASSERTs + https://bugs.webkit.org/show_bug.cgi?id=94055 + + Reviewed by Ojan Vafai. + + * src/IDBDatabaseBackendProxy.cpp: + (WebKit::IDBDatabaseBackendProxy::setVersion): + +2012-08-15 Ian Vollick <vollick@chromium.org> + + [chromium] Must account for empty transformation lists when checking for big rotations. + https://bugs.webkit.org/show_bug.cgi?id=93975 + + Reviewed by James Robinson. + + Adds a test to check that creating an animation with a big (> 180 + degree) rotation, where the transform operations list in the 1st + keyframe is empty fails as expected. + + * tests/AnimationTranslationUtilTest.cpp: + (WebKit::TEST): + (WebKit): + +2012-08-15 Joshua Bell <jsbell@chromium.org> + + [chromium] IndexedDB: Delete unused WebKit API cursor accessors + https://bugs.webkit.org/show_bug.cgi?id=94134 + + Reviewed by Adam Barth. + + Last bit of refactor work from http://webkit.org/b/92278 that ships the + cursor key/primaryKey/value to the front end via success messages, eliminating + the need for these accessors and the old success messages. + + * public/WebIDBCallbacks.h: + * public/WebIDBCursor.h: + +2012-08-15 Anna Cavender <annacc@chromium.org> + + Add the timestampOffset attribute to SourceBuffer. + https://bugs.webkit.org/show_bug.cgi?id=93303 + + Reviewed by Dimitri Glazkov. + + On the 30 July 2012 version of the Media Source Extensions spec, a timestampOffset + attribute was added to the SourceBuffer object: + http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#dom-timestampoffset + + * public/WebMediaPlayer.h: + (WebKit::WebMediaPlayer::sourceSetTimestampOffset): Add the new method. + * src/WebMediaPlayerClientImpl.cpp: + (WebKit): + (WebKit::WebMediaPlayerClientImpl::sourceSetTimestampOffset): Forward the call. + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + +2012-08-15 Peter Beverloo <peter@chromium.org> + + [Chromium] Roll WebKit Chromium DEPS to r151672 + https://bugs.webkit.org/show_bug.cgi?id=94091 + + Unreviewed DEPS roll. + + This also adds the new dependency on third_party/skia/gyp/, as was + introduced in Chromium's revision 151463. + + * DEPS: + +2012-08-14 Keishi Hattori <keishi@webkit.org> + + Share common code between calendar picker and color suggestion picker + https://bugs.webkit.org/show_bug.cgi?id=93802 + + Reviewed by Kent Tamura. + + * src/ColorChooserUIController.cpp: + (WebKit::ColorChooserUIController::writeDocument): + +2012-08-14 Scott Graham <scottmg@chromium.org> + + [Chromium] Fix warnings on Windows build + https://bugs.webkit.org/show_bug.cgi?id=93997 + + Reviewed by Kentaro Hara. + + Fixes truncation from 'double' to 'float' warnings on Chromium Windows + build. + + * tests/CCRenderSurfaceFiltersTest.cpp: + (WebKit::TEST): + * tests/CCScrollbarAnimationControllerLinearFadeTest.cpp: + (WebCore::TEST_F): + +2012-08-14 Chris Rogers <crogers@google.com> + + Implement new synchronized audio I/O render method in chromium + https://bugs.webkit.org/show_bug.cgi?id=93510 + + Reviewed by Kenneth Russell. + + The chromium implementation of AudioDestination is being upgraded to + support synchronized audio I/O. Other changes on the chromium-side + can then be tested against something that works in WebKit. + + * src/AudioDestinationChromium.cpp: + (WebCore::AudioDestinationChromium::AudioDestinationChromium): + (WebCore::AudioDestinationChromium::render): + (WebCore): + (WebCore::AudioDestinationChromium::provideInput): + * src/AudioDestinationChromium.h: + (WebCore): + (AudioDestinationChromium): + +2012-08-14 Adam Barth <abarth@webkit.org> + + Delete Frame::domWindow() and Frame::existingDOMWindow() + https://bugs.webkit.org/show_bug.cgi?id=93990 + + Reviewed by Eric Seidel. + + * src/StorageAreaProxy.cpp: + (WebCore::StorageAreaProxy::dispatchLocalStorageEvent): + (WebCore::StorageAreaProxy::dispatchSessionStorageEvent): + * src/WebDOMMessageEvent.cpp: + (WebKit::WebDOMMessageEvent::initMessageEvent): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::performance): + (WebKit::WebFrameImpl::addMessageToConsole): + (WebKit::WebFrameImpl::unloadListenerCount): + (WebKit::WebFrameImpl::addEventListener): + (WebKit::WebFrameImpl::removeEventListener): + (WebKit::WebFrameImpl::dispatchEvent): + (WebKit::WebFrameImpl::dispatchMessageEventWithOriginCheck): + (WebKit::WebFrameImpl::deliverIntent): + * src/WebPagePopupImpl.cpp: + (WebKit::WebPagePopupImpl::initPage): + +2012-08-14 Iain Merrick <husky@chromium.org> + + [chromium] Add a test to WebFrameTest for selectRange and visiblePositionForWindowPoint. + https://bugs.webkit.org/show_bug.cgi?id=93108 + + Reviewed by Adam Barth. + + Adds a new test WebFrameTest.SelectRange. This tests WebFrameImpl::selectRange, + and also serves to test WebFrameImpl::visiblePositionForWindowPoint as it is + used by selectRange. + + The test uses sample files that contain selected text on load. The test uses + WebViewImpl::selectionBounds to get the coordinates, deselects all, then + calls WebFrameImpl::selectRange to attempt to reselect the same text. + + Four cases are tested: + - the basic case + - the case where the selected text is offscreen due to a scroll + - the case where the selected text is in an iframe + - the case where the selected text is in an editable element + + * tests/WebFrameTest.cpp: + * tests/data/select_range_basic.html: Added. + * tests/data/select_range_editable.html: Added. + * tests/data/select_range_iframe.html: Added. + * tests/data/select_range_scroll.html: Added. + +2012-08-14 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Pass cursor continue results back in callback + https://bugs.webkit.org/show_bug.cgi?id=92278 + + Reviewed by Tony Chang. + + Supply the updated cursor key/primaryKey/value in the success callback, + rather than forcing the callee to make three calls into the back end to + fetch them. Callbacks onSuccess(cursor) and onSuccessWithContinuation() + are given the three new payload parameters (and the latter is renamed.) + + * public/WebIDBCallbacks.h: + (WebIDBCallbacks): + (WebKit::WebIDBCallbacks::onSuccess): Replace with no-op stub. + (WebKit::WebIDBCallbacks::onSuccessWithContinuation): Ditto. + * public/WebIDBCursor.h: + (WebIDBCursor): Methods can be removed once Chromium is cleaned up. + * src/IDBCallbacksProxy.cpp: Updated callbacks. + (WebKit::IDBCallbacksProxy::onSuccess): + (WebKit): + * src/IDBCallbacksProxy.h: Updated callbacks. + (IDBCallbacksProxy): + * src/IDBCursorBackendProxy.cpp: Remove back end accessors. + * src/IDBCursorBackendProxy.h: + (IDBCursorBackendProxy): + * src/WebIDBCallbacksImpl.cpp: Updated callbacks. + (WebKit::WebIDBCallbacksImpl::onSuccess): + * src/WebIDBCallbacksImpl.h: Updated callbacks. + (WebIDBCallbacksImpl): + * src/WebIDBCursorImpl.cpp: Remove back end accessors. + * src/WebIDBCursorImpl.h: Remove back end accessors. + (WebIDBCursorImpl): + * tests/IDBAbortOnCorruptTest.cpp: Update test stubs. + (WebCore::MockIDBCallbacks::onSuccess): + * tests/IDBDatabaseBackendTest.cpp: Ditto. + * tests/IDBRequestTest.cpp: Ditto. + +2012-08-14 Peter Beverloo <peter@chromium.org> + + [Chromium] Remove unneeded build logic for Android + https://bugs.webkit.org/show_bug.cgi?id=93962 + + Reviewed by Dimitri Glazkov. + + The Android SDK and NDK have been checked in to the Chromium tree, which + allows WebKit to leverage those as well. They will already be pulled in + through a DEPS change made last week, and by not setting the ANDROID_NDK_ROOT + environment variable, the envsetup.sh will set the project files up + appropriately for us. + + * DEPS: + +2012-08-14 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-08-14 Peter Beverloo <peter@chromium.org> + + [Chromium] Fix apk generation for the Android platform + https://bugs.webkit.org/show_bug.cgi?id=93841 + + Unreviewed build fix (step 2). + + The path from webkit_unit_tests isn't robust enough. Use the same + convention as the Chromium side, i.e. walk up from the ant_build_out path. + One-line Android-only gyp change. + + * WebKitUnitTests.gyp: + +2012-08-14 Peter Beverloo <peter@chromium.org> + + [Chromium] Fix apk generation for the Android platform + https://bugs.webkit.org/show_bug.cgi?id=93841 + + Unreviewed build fix. + + APK generation was broken as the configuration file assumed compilation + would only occur in the Chromium tree. Pass the path to Chromium's source + base directory as a property to ant. + + * WebKitUnitTests.gyp: + +2012-08-13 Tom Sepez <tsepez@chromium.org> + + [chromium] release FrameLoaderClientImpl::m_pluginWidget refptr upon Plugin Document detach. + https://bugs.webkit.org/show_bug.cgi?id=93283 + + Reviewed by Eric Seidel. + + Change the client redirectDataToPlugin method(s) to expect the possibility of + a NULL argument, NULLing Chromium's refptr that needs to be NULLed. + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::redirectDataToPlugin): + +2012-08-13 Eric Penner <epenner@google.com> + + [chromium] Paint animated layers immediately to avoid animation hiccups. + https://bugs.webkit.org/show_bug.cgi?id=93028 + + Reviewed by Adrienne Walker. + + Replaced one test. Test painting full animated layer. + + * tests/TiledLayerChromiumTest.cpp: + +2012-08-12 Shawn Singh <shawnsingh@chromium.org> + + [chromium] renderSurface in incorrect space if owning layer has empty but non-zero bounds + https://bugs.webkit.org/show_bug.cgi?id=93795 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostCommonTest.cpp: + +2012-08-13 James Robinson <jamesr@chromium.org> + + [chromium] Make WebAnimation a pure virtual interface to hide implementation and avoid unresolved symbols + https://bugs.webkit.org/show_bug.cgi?id=93907 + + Reviewed by Darin Fisher. + + Adds a WebAnimationImpl implementation of the WebAnimation interface. + + * WebKit.gyp: + * src/WebAnimationImpl.cpp: Renamed from Source/WebKit/chromium/src/WebAnimation.cpp. + (WebKit): + (WebKit::WebAnimation::create): + (WebKit::WebAnimationImpl::targetProperty): + (WebKit::WebAnimationImpl::iterations): + (WebKit::WebAnimationImpl::setIterations): + (WebKit::WebAnimationImpl::startTime): + (WebKit::WebAnimationImpl::setStartTime): + (WebKit::WebAnimationImpl::timeOffset): + (WebKit::WebAnimationImpl::setTimeOffset): + (WebKit::WebAnimationImpl::alternatesDirection): + (WebKit::WebAnimationImpl::setAlternatesDirection): + (WebKit::WebAnimationImpl::cloneToCCAnimation): + * src/WebAnimationImpl.h: Added. + (WebCore): + (WebKit): + (WebAnimationImpl): + (WebKit::WebAnimationImpl::WebAnimationImpl): + (WebKit::WebAnimationImpl::~WebAnimationImpl): + * src/WebLayer.cpp: + (WebKit::WebLayer::addAnimation): + * tests/WebAnimationTest.cpp: + (WebKit::TEST): + +2012-08-10 James Robinson <jamesr@chromium.org> + + [chromium] Clean up dependencies for Canvas2DLayerBridgeTest and GraphicsLayerChromiumTest unit tests + https://bugs.webkit.org/show_bug.cgi?id=93757 + + Reviewed by Adrienne Walker. + + Breaks up some unit tests and removes unused code to avoid unit tests depending on both non-compositor WebCore + logic and compositor internals. Canvas2DLayerBridgeTest had some vestigal includes and local variables that + weren't being used, those are removed. GraphicsLayerChromiumTest was reaching into CC types, but could mostly + use Platform API types for testing. + + GraphicsLayerChromiumTest had some tests that were verifying that we could correctly translate WebCore + animation lists into CCAnimation types - these have been moved into AnimationTranslationUtilTest.cpp, since the + logic under test is in AnimationTranslationUtil. Currently these only test that we accept / reject animations as + expected. They could be expanded to verify that the animation was translated faithfully, but that would require + expanding the information exposed on WebAnimation. + + * WebKit.gypi: + * src/WebLayer.cpp: + (WebKit::WebLayer::hasActiveAnimation): + (WebKit): + * tests/Canvas2DLayerBridgeTest.cpp: + (Canvas2DLayerBridgeTest::fullLifecycleTest): + * tests/GraphicsLayerChromiumTest.cpp: + (WebKit::GraphicsLayerChromiumTest::GraphicsLayerChromiumTest): + (WebKit::GraphicsLayerChromiumTest::~GraphicsLayerChromiumTest): + (GraphicsLayerChromiumTest): + (WebKit::TEST_F): + * tests/WebLayerTreeViewTest.cpp: + * tests/WebLayerTreeViewTestCommon.h: Added. + (WebKit): + (MockWebLayerTreeViewClient): + +2012-08-13 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r125422. + http://trac.webkit.org/changeset/125422 + https://bugs.webkit.org/show_bug.cgi?id=93902 + + Broke the Android canary build (Requested by fmalita on + #webkit). + + * WebKitUnitTests.gyp: + +2012-08-13 Leandro Gracia Gil <leandrogracia@chromium.org> + + [Chromium] Fix nits in the find-in-page match rects API + https://bugs.webkit.org/show_bug.cgi?id=93817 + + Reviewed by Adam Barth. + + This patch fixes a few pending nits from 93111. + + * src/FindInPageCoordinates.cpp: replace a pointer by a reference in an output argument. + (WebKit::toNormalizedRect): + (WebKit::findInPageRectFromAbsoluteRect): + +2012-08-13 Peter Beverloo <peter@chromium.org> + + [Chromium] Fix apk generation for the Android platform + https://bugs.webkit.org/show_bug.cgi?id=93841 + + Reviewed by Dimitri Glazkov. + + APK generation was broken as the configuration file assumed compilation + would only occur in the Chromium tree. Pass the path to Chromium's source + base directory as a property to ant. + + * WebKitUnitTests.gyp: + +2012-08-13 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-08-13 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-08-13 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-08-10 Kinuko Yasuda <kinuko@chromium.org> + + Support creating File object from FileSystem URL for files in FileSystem API + https://bugs.webkit.org/show_bug.cgi?id=93706 + + Reviewed by Darin Fisher. + + * src/WebBlobData.cpp: + (WebKit::WebBlobData::itemAt): + +2012-08-12 Yuta Kitamura <yutak@google.com> + + Unreviewed. Fix Chromium's Android build. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::find): Needs parentheses for a function call. + +2012-08-12 Leandro Gracia Gil <leandrogracia@chromium.org> + + [Chromium] Implement the find-in-page match rects API + https://bugs.webkit.org/show_bug.cgi?id=93111 + + Reviewed by Adam Barth. + + Implement the funcionality of the find-in-page match rects API in WebFrame. + These methods keep a cache of the match rects in a special coordinate system + (find-in-page coordinates) and update them on size changes. They also allow + to recover the match closest to a given point, therefore enabling to move + to find matches when tapping on their corresponding tickmarks. + + * WebKit.gyp: add FindInPageCoordinates.h / cpp. + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::contentsSizeChanged): propagate didChangeContentsSize to WebFrameImpl. + * src/FindInPageCoordinates.cpp: Added. + (WebKit): + (WebKit::toNormalizedRect): auxiliary internal function. + (WebKit::findInPageRectFromAbsoluteRect): main coordinate conversion function. + (WebKit::findInPageRectFromRange): convenience conversion function for Ranges. + * src/FindInPageCoordinates.h: Added. + (WebCore): + (WebKit): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::FindMatch::FindMatch): find matches cache constructor. + (WebKit): + (WebKit::WebFrameImpl::find): clear match cache when appropriate and zoom into results on the Android port. + (WebKit::WebFrameImpl::stopFinding): clear matches cache. + (WebKit::WebFrameImpl::scopeStringMatches): add new results to the matches cache. + (WebKit::WebFrameImpl::increaseMatchCount): update the matches cache version. + (WebKit::WebFrameImpl::resetMatchCount): update the matches cache version. + (WebKit::WebFrameImpl::findMatchMarkersVersion): new API providing the matches cache version. + (WebKit::WebFrameImpl::clearFindMatchesCache): internal utility method to reset the matches cache. + (WebKit::WebFrameImpl::isActiveMatchFrameValid): internal utility method to check if the local frame is still in the frame tree. + (WebKit::WebFrameImpl::updateFindMatchRects): internal utility method to update the match result rects if required. + (WebKit::WebFrameImpl::activeFindMatchRect): new API providing the active find match rect in find-in-page coordinates. + (WebKit::WebFrameImpl::findMatchRects): new API returning the valid match rects in find-in-page coordinates. + (WebKit::WebFrameImpl::appendFindMatchRects): internal utility method to concatenate the match results of multiple frames. + (WebKit::WebFrameImpl::selectNearestFindMatch): new API selecting the find match closer to a point in find-in-page coordinates. + (WebKit::WebFrameImpl::nearestFindMatch): internal utility method to find the nearest find match to a point in a frame. + (WebKit::WebFrameImpl::selectFindMatch): internal utility method to select a match in the cache. + (WebKit::WebFrameImpl::WebFrameImpl): initialization of new variables. + (WebKit::WebFrameImpl::didChangeContentsSize): invalidate the cached match rect coordinates on frame content size changes. + * src/WebFrameImpl.h: + (WebCore): + (WebFrameImpl): + (WebKit::WebFrameImpl::activeMatchFrame): remove unrequired const. + (WebKit::WebFrameImpl::activeMatch): expose the range of the active match to allow testing. + (FindMatch): cache structure for find matches. + * tests/WebFrameTest.cpp: new test case for find-in-page match rects. + * tests/data/find_in_page.html: Added. Test case layout. + * tests/data/find_in_page_frame.html: Added. Test case layout. + 2012-08-09 James Robinson <jamesr@chromium.org> [chromium] Remove forwarding headers for compositor-related WebKit API and update includes diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index 3f938525d..eb01ba514 100644 --- a/Source/WebKit/chromium/DEPS +++ b/Source/WebKit/chromium/DEPS @@ -32,7 +32,7 @@ vars = { 'chromium_svn': 'http://src.chromium.org/svn/trunk/src', - 'chromium_rev': '151128' + 'chromium_rev': '152373' } deps = { @@ -58,6 +58,8 @@ deps = { From('chromium_deps', 'src/third_party/skia/src'), 'third_party/skia/include': From('chromium_deps', 'src/third_party/skia/include'), + 'third_party/skia/gyp': + From('chromium_deps', 'src/third_party/skia/gyp'), # testing 'testing': @@ -181,8 +183,6 @@ deps_os = { 'android': { 'third_party/android_tools': From('chromium_deps', 'src/third_party/android_tools'), - 'third_party/aosp': - From('chromium_deps', 'src/third_party/aosp'), 'third_party/freetype': From('chromium_deps', 'src/third_party/freetype'), 'tools/android': diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp index 36ecf80f5..e226db13a 100644 --- a/Source/WebKit/chromium/WebKit.gyp +++ b/Source/WebKit/chromium/WebKit.gyp @@ -54,6 +54,10 @@ # stored as is. Otherwise, a concatenated file is stored. 'debug_devtools%': 0, + # If set to 1, links against the compositor bindings from the chromium repository + # instead of the compositor-implementation binding files in WebKit/chromium/src. + 'use_libcc_for_compositor%': 0, + # List of DevTools source files, ordered by dependencies. It is used both # for copying them to resource dir, and for generating 'devtools.html' file. 'devtools_files': [ @@ -386,6 +390,8 @@ 'src/EventListenerWrapper.h', 'src/ExternalPopupMenu.cpp', 'src/ExternalPopupMenu.h', + 'src/FindInPageCoordinates.cpp', + 'src/FindInPageCoordinates.h', 'src/FrameLoaderClientImpl.cpp', 'src/FrameLoaderClientImpl.h', 'src/FrameNetworkingContextImpl.h', @@ -468,11 +474,8 @@ 'src/WebTextCheckingCompletionImpl.cpp', 'src/WebTextCheckingResult.cpp', 'src/WebAccessibilityObject.cpp', - 'src/WebAnimation.cpp', 'src/WebAnimationControllerImpl.cpp', 'src/WebAnimationControllerImpl.h', - 'src/WebAnimationCurveCommon.cpp', - 'src/WebAnimationCurveCommon.h', 'src/WebArrayBuffer.cpp', 'src/WebArrayBufferView.cpp', 'src/WebBindings.cpp', @@ -481,11 +484,6 @@ 'src/WebCache.cpp', 'src/WebColorName.cpp', 'src/WebCommon.cpp', - 'src/WebCompositorInputHandlerImpl.cpp', - 'src/WebCompositorInputHandlerImpl.h', - 'src/WebContentLayer.cpp', - 'src/WebContentLayerImpl.cpp', - 'src/WebContentLayerImpl.h', 'src/WebCrossOriginPreflightResultCache.cpp', 'src/WebCursorInfo.cpp', 'src/WebDOMEvent.cpp', @@ -512,12 +510,10 @@ 'src/WebElement.cpp', 'src/WebEntities.cpp', 'src/WebEntities.h', - 'src/WebExternalTextureLayer.cpp', 'src/WebFileChooserCompletionImpl.cpp', 'src/WebFileChooserCompletionImpl.h', 'src/WebFileSystemCallbacksImpl.cpp', 'src/WebFileSystemCallbacksImpl.h', - 'src/WebFloatAnimationCurve.cpp', 'src/WebFontCache.cpp', 'src/WebFontDescription.cpp', 'src/WebFontImpl.cpp', @@ -561,9 +557,7 @@ 'src/WebIDBTransactionImpl.h', 'src/WebIDBTransactionCallbacksImpl.cpp', 'src/WebIDBTransactionCallbacksImpl.h', - 'src/WebIOSurfaceLayer.cpp', 'src/WebImageDecoder.cpp', - 'src/WebImageLayer.cpp', 'src/WebImageSkia.cpp', 'src/WebInputElement.cpp', 'src/WebInputEvent.cpp', @@ -574,12 +568,6 @@ 'src/WebIntentServiceInfo.cpp', 'src/WebKit.cpp', 'src/WebLabelElement.cpp', - 'src/WebLayer.cpp', - 'src/WebLayerImpl.cpp', - 'src/WebLayerImpl.h', - 'src/WebLayerTreeView.cpp', - 'src/WebLayerTreeViewImpl.cpp', - 'src/WebLayerTreeViewImpl.h', 'src/WebMediaPlayerClientImpl.cpp', 'src/WebMediaPlayerClientImpl.h', 'src/WebMediaStreamRegistry.cpp', @@ -615,8 +603,6 @@ 'src/WebScopedMicrotaskSuppression.cpp', 'src/WebScopedUserGesture.cpp', 'src/WebScriptController.cpp', - 'src/WebScrollbarLayer.cpp', - 'src/WebScrollableLayer.cpp', 'src/WebScrollbarImpl.cpp', 'src/WebScrollbarImpl.h', 'src/WebScrollbarThemeClientImpl.cpp', @@ -635,8 +621,6 @@ 'src/WebSocket.cpp', 'src/WebSocketImpl.cpp', 'src/WebSocketImpl.h', - 'src/WebSolidColorLayer.cpp', - 'src/WebSolidColorLayerImpl.cpp', 'src/WebSpeechGrammar.cpp', 'src/WebSpeechInputResult.cpp', 'src/WebSpeechRecognitionHandle.cpp', @@ -647,12 +631,10 @@ 'src/WebSurroundingText.cpp', 'src/WebTextInputInfo.cpp', 'src/WebTextRun.cpp', - 'src/WebTransformAnimationCurve.cpp', 'src/WebURLLoadTiming.cpp', 'src/WebScopedUserGesture.cpp', 'src/WebTextFieldDecoratorClient.cpp', 'src/WebUserMediaRequest.cpp', - 'src/WebVideoLayer.cpp', 'src/WebViewBenchmarkSupportImpl.cpp', 'src/WebViewBenchmarkSupportImpl.h', 'src/WebViewImpl.cpp', @@ -850,6 +832,15 @@ 'WARNING_CFLAGS': ['-Wglobal-constructors'], }, }], + ['use_libcc_for_compositor==1', { + 'dependencies': [ + '<(chromium_src_dir)/webkit/compositor/compositor.gyp:webkit_compositor', + ], + }, { # else: use_libcc_for_compositor==0 + 'sources': [ + '<@(webkit_compositor_bindings_files)', + ] + }], ], 'target_conditions': [ ['OS=="android"', { @@ -870,6 +861,14 @@ 'conditions': [ ['debug_devtools==0', { 'dependencies': ['concatenated_devtools_js', + 'concatenated_devtools_elements_js', + 'concatenated_devtools_resources_js', + 'concatenated_devtools_network_js', + 'concatenated_devtools_scripts_js', + 'concatenated_devtools_timeline_js', + 'concatenated_devtools_profiles_js', + 'concatenated_devtools_audits_js', + 'concatenated_devtools_codemirror_js', 'concatenated_heap_snapshot_worker_js', 'concatenated_script_formatter_worker_js', 'concatenated_devtools_css'], @@ -950,6 +949,14 @@ 'conditions': [ ['debug_devtools==0', { 'dependencies': ['concatenated_devtools_js', + 'concatenated_devtools_elements_js', + 'concatenated_devtools_resources_js', + 'concatenated_devtools_network_js', + 'concatenated_devtools_scripts_js', + 'concatenated_devtools_timeline_js', + 'concatenated_devtools_profiles_js', + 'concatenated_devtools_audits_js', + 'concatenated_devtools_codemirror_js', 'concatenated_heap_snapshot_worker_js', 'concatenated_script_formatter_worker_js', 'concatenated_devtools_css'], @@ -966,11 +973,18 @@ 'input_pages': [ '<(PRODUCT_DIR)/resources/inspector/devtools.html', '<(PRODUCT_DIR)/resources/inspector/DevTools.js', + '<(PRODUCT_DIR)/resources/inspector/ElementsPanel.js', + '<(PRODUCT_DIR)/resources/inspector/ResourcesPanel.js', + '<(PRODUCT_DIR)/resources/inspector/NetworkPanel.js', + '<(PRODUCT_DIR)/resources/inspector/ScriptsPanel.js', + '<(PRODUCT_DIR)/resources/inspector/TimelinePanel.js', + '<(PRODUCT_DIR)/resources/inspector/ProfilesPanel.js', + '<(PRODUCT_DIR)/resources/inspector/AuditsPanel.js', + '<(PRODUCT_DIR)/resources/inspector/CodeMirrorTextEditor.js', '<(PRODUCT_DIR)/resources/inspector/HeapSnapshotWorker.js', '<(PRODUCT_DIR)/resources/inspector/ScriptFormatterWorker.js', '<(PRODUCT_DIR)/resources/inspector/devTools.css', '<(PRODUCT_DIR)/resources/inspector/devtools_extension_api.js', - '<@(webinspector_standalone_js_files)', '<@(webinspector_standalone_css_files)', ], 'images': [ @@ -1086,11 +1100,133 @@ 'outputs': ['<(PRODUCT_DIR)/resources/inspector/DevTools.js'], 'action': ['python', '<@(_script_name)', '<@(_input_page)', '<@(_search_path)', '<@(_outputs)'], }], - 'copies': [{ - 'destination': '<(PRODUCT_DIR)/resources/inspector', - 'files': [ - '<@(webinspector_standalone_js_files)', + }, + { + 'target_name': 'concatenated_devtools_elements_js', + 'type': 'none', + 'actions': [{ + 'action_name': 'concatenate_devtools_elements_js', + 'script_name': 'scripts/inline_js_imports.py', + 'input_file': '../../WebCore/inspector/front-end/ElementsPanel.js', + 'inputs': [ + '<@(_script_name)', + '<@(webinspector_elements_js_files)', + ], + 'search_path': '../../WebCore/inspector/front-end', + 'outputs': ['<(PRODUCT_DIR)/resources/inspector/ElementsPanel.js'], + 'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_search_path)', '<@(_outputs)'], + }], + }, + { + 'target_name': 'concatenated_devtools_resources_js', + 'type': 'none', + 'actions': [{ + 'action_name': 'concatenate_devtools_resources_js', + 'script_name': 'scripts/inline_js_imports.py', + 'input_file': '../../WebCore/inspector/front-end/ResourcesPanel.js', + 'inputs': [ + '<@(_script_name)', + '<@(webinspector_resources_js_files)', + ], + 'search_path': '../../WebCore/inspector/front-end', + 'outputs': ['<(PRODUCT_DIR)/resources/inspector/ResourcesPanel.js'], + 'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_search_path)', '<@(_outputs)'], + }], + }, + { + 'target_name': 'concatenated_devtools_network_js', + 'type': 'none', + 'actions': [{ + 'action_name': 'concatenate_devtools_network_js', + 'script_name': 'scripts/inline_js_imports.py', + 'input_file': '../../WebCore/inspector/front-end/NetworkPanel.js', + 'inputs': [ + '<@(_script_name)', + '<@(webinspector_network_js_files)', + ], + 'search_path': '../../WebCore/inspector/front-end', + 'outputs': ['<(PRODUCT_DIR)/resources/inspector/NetworkPanel.js'], + 'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_search_path)', '<@(_outputs)'], + }], + }, + { + 'target_name': 'concatenated_devtools_scripts_js', + 'type': 'none', + 'actions': [{ + 'action_name': 'concatenate_devtools_scripts_js', + 'script_name': 'scripts/inline_js_imports.py', + 'input_file': '../../WebCore/inspector/front-end/ScriptsPanel.js', + 'inputs': [ + '<@(_script_name)', + '<@(webinspector_scripts_js_files)', + ], + 'search_path': '../../WebCore/inspector/front-end', + 'outputs': ['<(PRODUCT_DIR)/resources/inspector/ScriptsPanel.js'], + 'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_search_path)', '<@(_outputs)'], + }], + }, + { + 'target_name': 'concatenated_devtools_timeline_js', + 'type': 'none', + 'actions': [{ + 'action_name': 'concatenate_devtools_timeline_js', + 'script_name': 'scripts/inline_js_imports.py', + 'input_file': '../../WebCore/inspector/front-end/TimelinePanel.js', + 'inputs': [ + '<@(_script_name)', + '<@(webinspector_resources_js_files)', + ], + 'search_path': '../../WebCore/inspector/front-end', + 'outputs': ['<(PRODUCT_DIR)/resources/inspector/TimelinePanel.js'], + 'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_search_path)', '<@(_outputs)'], + }], + }, + { + 'target_name': 'concatenated_devtools_profiles_js', + 'type': 'none', + 'actions': [{ + 'action_name': 'concatenate_devtools_profiles_js', + 'script_name': 'scripts/inline_js_imports.py', + 'input_file': '../../WebCore/inspector/front-end/ProfilesPanel.js', + 'inputs': [ + '<@(_script_name)', + '<@(webinspector_profiles_js_files)', ], + 'search_path': '../../WebCore/inspector/front-end', + 'outputs': ['<(PRODUCT_DIR)/resources/inspector/ProfilesPanel.js'], + 'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_search_path)', '<@(_outputs)'], + }], + }, + { + 'target_name': 'concatenated_devtools_audits_js', + 'type': 'none', + 'actions': [{ + 'action_name': 'concatenate_devtools_audits_js', + 'script_name': 'scripts/inline_js_imports.py', + 'input_file': '../../WebCore/inspector/front-end/AuditsPanel.js', + 'inputs': [ + '<@(_script_name)', + '<@(webinspector_audits_js_files)', + ], + 'search_path': '../../WebCore/inspector/front-end', + 'outputs': ['<(PRODUCT_DIR)/resources/inspector/AuditsPanel.js'], + 'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_search_path)', '<@(_outputs)'], + }], + }, + { + 'target_name': 'concatenated_devtools_codemirror_js', + 'type': 'none', + 'actions': [{ + 'action_name': 'concatenate_devtools_codemirror_js', + 'script_name': 'scripts/inline_js_imports.py', + 'input_file': '../../WebCore/inspector/front-end/CodeMirrorTextEditor.js', + 'inputs': [ + '<@(_script_name)', + '<@(webinspector_codemirror_js_files)', + ], + 'search_path': '../../WebCore/inspector/front-end', + 'outputs': ['<(PRODUCT_DIR)/resources/inspector/CodeMirrorTextEditor.js'], + 'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_search_path)', '<@(_outputs)', 'true'], }], }, { diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index 9d041a18d..fc86f83b3 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -52,6 +52,7 @@ 'src/js/Images/segmentSelectedEndChromium.png', ], 'webkit_unittest_files': [ + 'tests/AnimationTranslationUtilTest.cpp', 'tests/ArenaTestHelpers.h', 'tests/AssociatedURLLoaderTest.cpp', 'tests/Canvas2DLayerBridgeTest.cpp', @@ -139,6 +140,7 @@ 'tests/PODArenaTest.cpp', 'tests/PODIntervalTreeTest.cpp', 'tests/PODRedBlackTreeTest.cpp', + 'tests/PopupContainerTest.cpp', 'tests/CCPrioritizedTextureTest.cpp', 'tests/RegionTest.cpp', 'tests/RenderTableCellTest.cpp', @@ -160,6 +162,7 @@ 'tests/WebFrameTest.cpp', 'tests/WebLayerTest.cpp', 'tests/WebLayerTreeViewTest.cpp', + 'tests/WebLayerTreeViewTestCommon.h', 'tests/WebMediaPlayerClientImplTest.cpp', 'tests/WebPageNewSerializerTest.cpp', 'tests/WebPageSerializerTest.cpp', @@ -173,6 +176,36 @@ 'tests/WebViewTest.cpp', ], + 'webkit_compositor_bindings_files': [ + 'src/WebAnimationCurveCommon.cpp', + 'src/WebAnimationCurveCommon.h', + 'src/WebAnimationImpl.cpp', + 'src/WebAnimationImpl.h', + 'src/WebCompositorInputHandlerImpl.cpp', + 'src/WebCompositorInputHandlerImpl.h', + 'src/WebContentLayerImpl.cpp', + 'src/WebContentLayerImpl.h', + 'src/WebExternalTextureLayerImpl.cpp', + 'src/WebExternalTextureLayerImpl.h', + 'src/WebFloatAnimationCurve.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/WebScrollbarLayerImpl.cpp', + 'src/WebScrollbarLayerImpl.h', + 'src/WebSolidColorLayerImpl.cpp', + 'src/WebSolidColorLayerImpl.h', + 'src/WebTransformAnimationCurve.cpp', + 'src/WebVideoLayerImpl.cpp', + 'src/WebVideoLayerImpl.h', + ], + 'conditions': [ ['OS=="win"', { 'webkit_unittest_files': [ diff --git a/Source/WebKit/chromium/WebKitUnitTests.gyp b/Source/WebKit/chromium/WebKitUnitTests.gyp index b05a55271..a77392ef4 100644 --- a/Source/WebKit/chromium/WebKitUnitTests.gyp +++ b/Source/WebKit/chromium/WebKitUnitTests.gyp @@ -147,6 +147,13 @@ 'input_jars_paths': [ '<(PRODUCT_DIR)/lib.java/chromium_base.jar', ], + 'conditions': [ + ['inside_chromium_build==1', { + 'ant_build_to_chromium_src': '<(ant_build_out)/../../', + }, { + 'ant_build_to_chromium_src': '<(ant_build_out)/../../Source/WebKit/chromium', + }], + ], }, # Part of the following was copied from <(chromium_src_dir)/build/apk_test.gpyi. # Not including it because gyp include doesn't support variable in path or under @@ -171,6 +178,7 @@ '"<@(input_jars_paths)"', '--output', '<(PRODUCT_DIR)/webkit_unit_tests_apk', + '--strip-binary=<(android_strip)', '--ant-args', '-DANDROID_SDK=<(android_sdk)', '--ant-args', @@ -183,6 +191,8 @@ '-DANDROID_TOOLCHAIN=<(android_toolchain)', '--ant-args', '-DPRODUCT_DIR=<(ant_build_out)', + '--ant-args', + '-DCHROMIUM_SRC=<(ant_build_to_chromium_src)', '--sdk-build=<(sdk_build)', '--app_abi', '<(android_app_abi)', diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index 8dc7e2f6f..6b165fd8e 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -39,6 +39,7 @@ 'ENABLE_CHANNEL_MESSAGING=1', 'ENABLE_CSP_NEXT=1', 'ENABLE_CSS3_FLEXBOX=1', + 'ENABLE_CSS3_TEXT_DECORATION=0', 'ENABLE_CSS_BOX_DECORATION_BREAK=1', 'ENABLE_CSS_COMPOSITING=0', 'ENABLE_CSS_EXCLUSIONS=1', @@ -51,7 +52,6 @@ 'ENABLE_CSS_VARIABLES=1', 'ENABLE_CSS_STICKY_POSITION=1', 'ENABLE_CUSTOM_SCHEME_HANDLER=0', - 'ENABLE_DATALIST_ELEMENT=1', 'ENABLE_DASHBOARD_SUPPORT=0', 'ENABLE_DATA_TRANSFER_ITEMS=1', 'ENABLE_DETAILS_ELEMENT=1', @@ -149,6 +149,7 @@ ['OS=="android"', { 'feature_defines': [ 'ENABLE_CALENDAR_PICKER=0', + 'ENABLE_DATALIST_ELEMENT=0', 'ENABLE_INPUT_SPEECH=0', 'ENABLE_INPUT_TYPE_COLOR=0', 'ENABLE_JAVASCRIPT_I18N_API=0', @@ -170,6 +171,7 @@ }, { # OS!="android" 'feature_defines': [ 'ENABLE_CALENDAR_PICKER=1', + 'ENABLE_DATALIST_ELEMENT=1', 'ENABLE_INPUT_SPEECH=1', 'ENABLE_INPUT_TYPE_COLOR=1', 'ENABLE_INPUT_TYPE_TIME_MULTIPLE_FIELDS=1', diff --git a/Source/WebKit/chromium/gyp_webkit b/Source/WebKit/chromium/gyp_webkit index fb720d97a..36f0f431b 100755 --- a/Source/WebKit/chromium/gyp_webkit +++ b/Source/WebKit/chromium/gyp_webkit @@ -87,9 +87,6 @@ if __name__ == '__main__': envsetup_location = os.path.join(chrome_src, 'build', 'android', 'envsetup.sh') exit(subprocess.call(['bash', '-c', 'source %s && python gyp_webkit --no-envsetup-recursion %s' % (envsetup_location, ' '.join(args))])) else: - # FIXME: v8 requires the CXX_target variable to determine whether -m32 should be - # set. The current Android build set-up is not sustainable and breaks too often. - os.environ['CXX_target'] = glob.glob('%s/*-g++' % os.environ.get('ANDROID_TOOLCHAIN'))[0] args.remove('--no-envsetup-recursion') # Add includes. diff --git a/Source/WebKit/chromium/public/WebDevToolsAgent.h b/Source/WebKit/chromium/public/WebDevToolsAgent.h index 9f1d53f1b..4f90302c8 100644 --- a/Source/WebKit/chromium/public/WebDevToolsAgent.h +++ b/Source/WebKit/chromium/public/WebDevToolsAgent.h @@ -66,7 +66,7 @@ public: virtual void inspectElementAt(const WebPoint&) = 0; virtual void setProcessId(long) = 0; - // Exposed for LayoutTestController. + // Exposed for TestRunner. virtual void evaluateInWebInspector(long callId, const WebString& script) = 0; class MessageDescriptor { diff --git a/Source/WebKit/chromium/public/WebHistoryItem.h b/Source/WebKit/chromium/public/WebHistoryItem.h index 015a79beb..2c416f827 100644 --- a/Source/WebKit/chromium/public/WebHistoryItem.h +++ b/Source/WebKit/chromium/public/WebHistoryItem.h @@ -124,6 +124,8 @@ public: WEBKIT_EXPORT void setChildren(const WebVector<WebHistoryItem>&); WEBKIT_EXPORT void appendToChildren(const WebHistoryItem&); + WEBKIT_EXPORT WebVector<WebString> getReferencedFilePaths() const; + #if WEBKIT_IMPLEMENTATION WebHistoryItem(const WTF::PassRefPtr<WebCore::HistoryItem>&); WebHistoryItem& operator=(const WTF::PassRefPtr<WebCore::HistoryItem>&); diff --git a/Source/WebKit/chromium/public/WebIDBCallbacks.h b/Source/WebKit/chromium/public/WebIDBCallbacks.h index 655b009e0..358b73b17 100644 --- a/Source/WebKit/chromium/public/WebIDBCallbacks.h +++ b/Source/WebKit/chromium/public/WebIDBCallbacks.h @@ -50,17 +50,13 @@ public: // For the rest, pass ownership to the callee via a pointer. virtual void onError(const WebIDBDatabaseError&) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onSuccess(const WebDOMStringList&) { WEBKIT_ASSERT_NOT_REACHED(); } - virtual void onSuccess(WebIDBCursor*) { WEBKIT_ASSERT_NOT_REACHED(); } - // FIXME: Temporary no-op method to allow callers to update before WK92278 lands. - virtual void onSuccess(WebIDBCursor*, const WebIDBKey& key, const WebIDBKey& primaryKey, const WebSerializedScriptValue&) { } + virtual void onSuccess(WebIDBCursor*, const WebIDBKey& key, const WebIDBKey& primaryKey, const WebSerializedScriptValue&) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onSuccess(WebIDBDatabase*) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onSuccess(const WebIDBKey&) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onSuccess(WebIDBTransaction*) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onSuccess(const WebSerializedScriptValue&) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onSuccess(const WebSerializedScriptValue&, const WebIDBKey&, const WebIDBKeyPath&) { WEBKIT_ASSERT_NOT_REACHED(); } - virtual void onSuccessWithContinuation() { WEBKIT_ASSERT_NOT_REACHED(); } - // FIXME: Temporary no-op method to allow callers to update before WK92278 lands. - virtual void onSuccess(const WebIDBKey& key, const WebIDBKey& primaryKey, const WebSerializedScriptValue&) { } + virtual void onSuccess(const WebIDBKey& key, const WebIDBKey& primaryKey, const WebSerializedScriptValue&) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onBlocked() { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onBlocked(long long oldVersion) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onSuccessWithPrefetch(const WebVector<WebIDBKey>& keys, const WebVector<WebIDBKey>& primaryKeys, const WebVector<WebSerializedScriptValue>& values) { WEBKIT_ASSERT_NOT_REACHED(); } diff --git a/Source/WebKit/chromium/public/WebIDBCursor.h b/Source/WebKit/chromium/public/WebIDBCursor.h index ac89d7955..e5846a972 100644 --- a/Source/WebKit/chromium/public/WebIDBCursor.h +++ b/Source/WebKit/chromium/public/WebIDBCursor.h @@ -47,22 +47,6 @@ public: PrevNoDuplicate = 3, }; - virtual WebIDBKey key() const - { - WEBKIT_ASSERT_NOT_REACHED(); - return WebIDBKey::createInvalid(); - } - virtual WebIDBKey primaryKey() const - { - WEBKIT_ASSERT_NOT_REACHED(); - return WebIDBKey::createInvalid(); - } - virtual WebSerializedScriptValue value() const - { - WEBKIT_ASSERT_NOT_REACHED(); - return WebSerializedScriptValue(); - } - virtual void advance(unsigned long, WebIDBCallbacks*, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void deleteFunction(WebIDBCallbacks*, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } diff --git a/Source/WebKit/chromium/public/WebIDBObjectStore.h b/Source/WebKit/chromium/public/WebIDBObjectStore.h index ba59c15ee..826965c0d 100644 --- a/Source/WebKit/chromium/public/WebIDBObjectStore.h +++ b/Source/WebKit/chromium/public/WebIDBObjectStore.h @@ -73,7 +73,10 @@ public: } virtual void deleteIndex(const WebString& name, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } // FIXME: Remove this version of openCursor when TaskType is plumbed through chromium. - virtual void openCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void openCursor(const WebIDBKeyRange& range, unsigned short direction, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec) + { + openCursor(range, static_cast<WebIDBCursor::Direction>(direction), callbacks, WebIDBTransaction::NormalTask, transaction, ec); + } virtual void openCursor(const WebIDBKeyRange&, WebIDBCursor::Direction direction, WebIDBCallbacks*, WebIDBTransaction::TaskType, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void count(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } diff --git a/Source/WebKit/chromium/public/WebInputEvent.h b/Source/WebKit/chromium/public/WebInputEvent.h index 09048cded..d1f5173e9 100644 --- a/Source/WebKit/chromium/public/WebInputEvent.h +++ b/Source/WebKit/chromium/public/WebInputEvent.h @@ -370,15 +370,41 @@ public: int globalX; int globalY; - // NOTE: |deltaX| and |deltaY| represents the amount to scroll for Scroll gesture events. - // For Pinch gesture events, |deltaX| represents the scaling/magnification factor. - // For a GestureTap event, |deltaX| represents the tap count. - // For a FlingStart event, |deltaX| and |deltaY| represent the velocity. - // FIXME: Avoid overloading 'delta' in this way. http://wkb.ug/93123 + // FIXME: These are currently overloaded. We're in the process of moving + // to the union below. http://wkb.ug/93123 float deltaX; float deltaY; WebRect boundingBox; + union { + struct { + int tapCount; + int width; + int height; + } tap; + + struct { + int width; + int height; + } longPress; + + struct { + float deltaX; + float deltaY; + float velocityX; + float velocityY; + } scrollUpdate; + + struct { + float velocityX; + float velocityY; + } flingStart; + + struct { + float scale; + } pinchUpdate; + } data; + WebGestureEvent(unsigned sizeParam = sizeof(WebGestureEvent)) : WebInputEvent(sizeParam) , x(0) @@ -388,6 +414,7 @@ public: , deltaX(0.0f) , deltaY(0.0f) { + memset(&data, 0, sizeof(data)); } }; diff --git a/Source/WebKit/chromium/public/WebMediaPlayer.h b/Source/WebKit/chromium/public/WebMediaPlayer.h index 3b8ef6451..ed62754d3 100644 --- a/Source/WebKit/chromium/public/WebMediaPlayer.h +++ b/Source/WebKit/chromium/public/WebMediaPlayer.h @@ -187,6 +187,7 @@ public: virtual bool sourceAppend(const WebString& id, const unsigned char* data, unsigned length) { return false; } virtual bool sourceAbort(const WebString& id) { return false; } virtual void sourceEndOfStream(EndOfStreamStatus) { } + virtual bool sourceSetTimestampOffset(const WebString& id, double offset) { return false; } // Returns whether keySystem is supported. If true, the result will be // reported by an event. diff --git a/Source/WebKit/chromium/public/WebPermissionClient.h b/Source/WebKit/chromium/public/WebPermissionClient.h index 5adcde2e0..5d059ef5d 100644 --- a/Source/WebKit/chromium/public/WebPermissionClient.h +++ b/Source/WebKit/chromium/public/WebPermissionClient.h @@ -96,6 +96,11 @@ public: // Controls whether enabling HTML notifications for this frame. virtual bool allowHTMLNotifications(const WebDocument&) { return true; } + // Controls whether to enable MutationEvents for this document. + // The common use case of this method is actually to selectively disable MutationEvents, + // but it's been named for consistency with the rest of the interface. + virtual bool allowMutationEvents(const WebDocument&, bool defaultValue) { return defaultValue; } + // Notifies the client that the frame would have instantiated a plug-in if plug-ins were enabled. virtual void didNotAllowPlugins(WebFrame*) { } diff --git a/Source/WebKit/chromium/public/WebSpeechInputController.h b/Source/WebKit/chromium/public/WebSpeechInputController.h index ed930dc2b..386b8ac1a 100644 --- a/Source/WebKit/chromium/public/WebSpeechInputController.h +++ b/Source/WebKit/chromium/public/WebSpeechInputController.h @@ -44,7 +44,8 @@ class WebSpeechInputController { public: // Starts speech recognition. Speech will get recorded until the endpointer detects silence, // runs to the limit or stopRecording is called. Progress indications and the recognized - // text are returned via the listener interface. + // text are returned via the listener interface. elementRect is the position + // of the element where the user clicked in the RootView coordinate system. virtual bool startRecognition(int requestId, const WebRect& elementRect, const WebString& language, const WebString& grammar, const WebSecurityOrigin& origin) { WEBKIT_ASSERT_NOT_REACHED(); diff --git a/Source/WebKit/chromium/public/WebView.h b/Source/WebKit/chromium/public/WebView.h index e8f791fa6..45d3dd3c3 100644 --- a/Source/WebKit/chromium/public/WebView.h +++ b/Source/WebKit/chromium/public/WebView.h @@ -507,7 +507,7 @@ public: // level is changed in this update from the previous update). virtual void updateBatteryStatus(const WebBatteryStatus&) { } - // Testing functionality for LayoutTestController ----------------------- + // Testing functionality for TestRunner --------------------------------- // Simulates a compositor lost context. virtual void loseCompositorContext(int numTimes) = 0; diff --git a/Source/WebKit/chromium/public/WebViewClient.h b/Source/WebKit/chromium/public/WebViewClient.h index 726cc6482..904d4a2d2 100644 --- a/Source/WebKit/chromium/public/WebViewClient.h +++ b/Source/WebKit/chromium/public/WebViewClient.h @@ -37,7 +37,6 @@ #include "WebEditingAction.h" #include "WebFileChooserCompletion.h" #include "WebFileChooserParams.h" -#include "WebHitTestResult.h" #include "WebPageVisibilityState.h" #include "WebPopupType.h" #include "WebTextAffinity.h" @@ -64,6 +63,7 @@ class WebFrame; class WebGeolocationClient; class WebGeolocationService; class WebHelperPlugin; +class WebHitTestResult; class WebIconLoadingCompletion; class WebImage; class WebInputElement; @@ -374,9 +374,8 @@ public: // Retrieves detectable content (e.g., email addresses, phone numbers) // around a hit test result. The embedder should use platform-specific - // content detectors (e.g., from the Android intent system) to analyze the - // region around the hit test result. - virtual WebContentDetectionResult detectContentIntentAround(const WebHitTestResult&) { return WebContentDetectionResult(); } + // content detectors to analyze the region around the hit test result. + virtual WebContentDetectionResult detectContentAround(const WebHitTestResult&) { return WebContentDetectionResult(); } // Schedules a new content intent with the provided url. virtual void scheduleContentIntent(const WebURL&) { } diff --git a/Source/WebKit/chromium/scripts/concatenate_js_files.py b/Source/WebKit/chromium/scripts/concatenate_js_files.py index 82cbe86c4..91c599462 100644 --- a/Source/WebKit/chromium/scripts/concatenate_js_files.py +++ b/Source/WebKit/chromium/scripts/concatenate_js_files.py @@ -55,7 +55,6 @@ class OrderedJSFilesExtractor(HTMLParser): if ('type' in attrs_dict and attrs_dict['type'] == 'text/javascript' and 'src' in attrs_dict): self.ordered_js_files.append(attrs_dict['src']) - class PathExpander: def __init__(self, paths): diff --git a/Source/WebKit/chromium/scripts/inline_js_imports.py b/Source/WebKit/chromium/scripts/inline_js_imports.py index 265501612..776a3fcde 100644 --- a/Source/WebKit/chromium/scripts/inline_js_imports.py +++ b/Source/WebKit/chromium/scripts/inline_js_imports.py @@ -43,12 +43,13 @@ import sys def main(argv): if len(argv) < 3: - print('usage: %s input_file imports_dir output_file' % argv[0]) + print('usage: %s input_file imports_dir output_file no_minify' % argv[0]) return 1 input_file_name = argv[1] imports_dir = argv[2] output_file_name = argv[3] + no_minify = len(argv) > 4 and argv[4] input_file = open(input_file_name, 'r') input_script = input_file.read() @@ -66,10 +67,12 @@ def main(argv): import_file.close() return import_script - output_script = re.sub(r'importScripts\([\'"]([^\'"]+)[\'"]\)', replace, input_script) + output_script = re.sub(r'importScripts?\([\'"]([^\'"]+)[\'"]\)', replace, input_script) output_file = open(output_file_name, 'w') - output_file.write(jsmin.jsmin(output_script)) + if not no_minify: + output_script = jsmin.jsmin(output_script) + output_file.write(output_script) output_file.close() # Touch output file directory to make sure that Xcode will copy diff --git a/Source/WebKit/chromium/src/AudioDestinationChromium.cpp b/Source/WebKit/chromium/src/AudioDestinationChromium.cpp index 646e9ef0d..380c74b85 100644 --- a/Source/WebKit/chromium/src/AudioDestinationChromium.cpp +++ b/Source/WebKit/chromium/src/AudioDestinationChromium.cpp @@ -32,6 +32,7 @@ #include "AudioDestinationChromium.h" +#include "AudioFIFO.h" #include "AudioPullFIFO.h" #include "WebKit.h" #include "platform/WebKitPlatformSupport.h" @@ -59,6 +60,7 @@ PassOwnPtr<AudioDestination> AudioDestination::create(AudioIOCallback& callback, AudioDestinationChromium::AudioDestinationChromium(AudioIOCallback& callback, float sampleRate) : m_callback(callback) + , m_inputBus(numberOfChannels, renderBufferSize) , m_renderBus(numberOfChannels, renderBufferSize, false) , m_sampleRate(sampleRate) , m_isPlaying(false) @@ -70,7 +72,7 @@ AudioDestinationChromium::AudioDestinationChromium(AudioIOCallback& callback, fl ASSERT(m_callbackBufferSize + renderBufferSize <= fifoSize); if (m_callbackBufferSize + renderBufferSize > fifoSize) return; - + m_audioDevice = adoptPtr(WebKit::Platform::current()->createAudioDevice(m_callbackBufferSize, numberOfChannels, sampleRate, this)); ASSERT(m_audioDevice); @@ -80,6 +82,17 @@ AudioDestinationChromium::AudioDestinationChromium(AudioIOCallback& callback, fl // Otherwise, the FIFO will call the provider enough times to // satisfy the request for data. m_fifo = adoptPtr(new AudioPullFIFO(*this, numberOfChannels, fifoSize, renderBufferSize)); + + // Input buffering. + m_inputFifo = adoptPtr(new AudioFIFO(numberOfChannels, fifoSize)); + + // If the callback size does not match the render size, then we need to buffer some + // extra silence for the input. Otherwise, we can over-consume the input FIFO. + if (m_callbackBufferSize != renderBufferSize) { + // FIXME: handle multi-channel input and don't hard-code to stereo. + AudioBus silence(2, renderBufferSize); + m_inputFifo->push(&silence); + } } AudioDestinationChromium::~AudioDestinationChromium() @@ -108,7 +121,37 @@ float AudioDestination::hardwareSampleRate() return static_cast<float>(WebKit::Platform::current()->audioHardwareSampleRate()); } +void AudioDestinationChromium::render(const WebVector<float*>& sourceData, const WebVector<float*>& audioData, size_t numberOfFrames) +{ + bool isNumberOfChannelsGood = audioData.size() == numberOfChannels; + if (!isNumberOfChannelsGood) { + ASSERT_NOT_REACHED(); + return; + } + + bool isBufferSizeGood = numberOfFrames == m_callbackBufferSize; + if (!isBufferSizeGood) { + ASSERT_NOT_REACHED(); + return; + } + + // Buffer optional live input. + if (sourceData.size() >= 2) { + // FIXME: handle multi-channel input and don't hard-code to stereo. + AudioBus wrapperBus(2, numberOfFrames, false); + wrapperBus.setChannelMemory(0, sourceData[0], numberOfFrames); + wrapperBus.setChannelMemory(1, sourceData[1], numberOfFrames); + m_inputFifo->push(&wrapperBus); + } + + m_renderBus.setChannelMemory(0, audioData[0], numberOfFrames); + m_renderBus.setChannelMemory(1, audioData[1], numberOfFrames); + + m_fifo->consume(&m_renderBus, numberOfFrames); +} + // Pulls on our provider to get the rendered audio stream. +// FIXME: remove this method when the chromium-side switches over to the synchronized I/O render() method (above). void AudioDestinationChromium::render(const WebVector<float*>& audioData, size_t numberOfFrames) { bool isNumberOfChannelsGood = audioData.size() == numberOfChannels; @@ -116,7 +159,7 @@ void AudioDestinationChromium::render(const WebVector<float*>& audioData, size_t ASSERT_NOT_REACHED(); return; } - + bool isBufferSizeGood = numberOfFrames == m_callbackBufferSize; if (!isBufferSizeGood) { ASSERT_NOT_REACHED(); @@ -130,8 +173,13 @@ void AudioDestinationChromium::render(const WebVector<float*>& audioData, size_t void AudioDestinationChromium::provideInput(AudioBus* bus, size_t framesToProcess) { - // FIXME: Add support for local/live audio input. - m_callback.render(0, bus, framesToProcess); + AudioBus* sourceBus = 0; + if (m_inputFifo->framesInFifo() >= framesToProcess) { + m_inputFifo->consume(&m_inputBus, framesToProcess); + sourceBus = &m_inputBus; + } + + m_callback.render(sourceBus, bus, framesToProcess); } } // namespace WebCore diff --git a/Source/WebKit/chromium/src/AudioDestinationChromium.h b/Source/WebKit/chromium/src/AudioDestinationChromium.h index fd676d102..7d261a7fa 100644 --- a/Source/WebKit/chromium/src/AudioDestinationChromium.h +++ b/Source/WebKit/chromium/src/AudioDestinationChromium.h @@ -40,6 +40,7 @@ namespace WebKit { class WebAudioDevice; } namespace WebCore { +class AudioFIFO; class AudioPullFIFO; // An AudioDestination using Chromium's audio system @@ -56,6 +57,7 @@ public: float sampleRate() const { return m_sampleRate; } // WebKit::WebAudioDevice::RenderCallback + virtual void render(const WebKit::WebVector<float*>& sourceData, const WebKit::WebVector<float*>& audioData, size_t numberOfFrames); virtual void render(const WebKit::WebVector<float*>& audioData, size_t numberOfFrames); // WebCore::AudioSourceProvider @@ -63,11 +65,14 @@ public: private: AudioIOCallback& m_callback; + AudioBus m_inputBus; AudioBus m_renderBus; float m_sampleRate; bool m_isPlaying; OwnPtr<WebKit::WebAudioDevice> m_audioDevice; size_t m_callbackBufferSize; + + OwnPtr<AudioFIFO> m_inputFifo; OwnPtr<AudioPullFIFO> m_fifo; }; diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index ad1000e63..329a99f19 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -575,6 +575,7 @@ void ChromeClientImpl::contentsSizeChanged(Frame* frame, const IntSize& size) co m_webView->didChangeContentsSize(); WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame); + webframe->didChangeContentsSize(size); if (webframe->client()) webframe->client()->didChangeContentsSize(webframe, size); } diff --git a/Source/WebKit/chromium/src/ColorChooserUIController.cpp b/Source/WebKit/chromium/src/ColorChooserUIController.cpp index 28cdc3840..c77634cff 100644 --- a/Source/WebKit/chromium/src/ColorChooserUIController.cpp +++ b/Source/WebKit/chromium/src/ColorChooserUIController.cpp @@ -34,6 +34,7 @@ #include "ColorSuggestionPicker.h" #include "IntRect.h" #include "LocalizedStrings.h" +#include "PickerCommon.h" #include "WebColorChooser.h" #include "platform/WebColor.h" #include "platform/WebKitPlatformSupport.h" @@ -103,12 +104,14 @@ void ColorChooserUIController::writeDocument(WebCore::DocumentWriter& writer) suggestionValues.append(suggestions[i].serialized()); WebCore::PagePopupClient::addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", writer); + writer.addData(WebCore::pickerCommonCss, sizeof(WebCore::pickerCommonCss)); writer.addData(WebCore::colorSuggestionPickerCss, sizeof(WebCore::colorSuggestionPickerCss)); WebCore::PagePopupClient::addString("</style></head><body><div id=main>Loading...</div><script>\n" "window.dialogArguments = {\n", writer); WebCore::PagePopupClient::addProperty("values", suggestionValues, writer); WebCore::PagePopupClient::addProperty("otherColorLabel", Platform::current()->queryLocalizedString(WebLocalizedString::OtherColorLabel), writer); WebCore::PagePopupClient::addString("};\n", writer); + writer.addData(WebCore::pickerCommonJs, sizeof(WebCore::pickerCommonJs)); writer.addData(WebCore::colorSuggestionPickerJs, sizeof(WebCore::colorSuggestionPickerJs)); WebCore::PagePopupClient::addString("</script></body>\n", writer); } diff --git a/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp b/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp index bc4cfb834..833a5016d 100644 --- a/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp @@ -145,6 +145,8 @@ bool ContextFeaturesClientImpl::askIfIsEnabled(Document* document, ContextFeatur return m_client->allowWebComponents(WebDocument(document), defaultValue); case ContextFeatures::HTMLNotifications: return m_client->allowHTMLNotifications(WebDocument(document)); + case ContextFeatures::MutationEvents: + return m_client->allowMutationEvents(WebDocument(document), defaultValue); default: return defaultValue; } diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp index a32a182a4..adaa41392 100644 --- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -279,9 +279,8 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( // a mouse on a word, Chrome just needs to find a spelling marker on the word instread of spellchecking it. if (selectedFrame->settings() && selectedFrame->settings()->asynchronousSpellCheckingEnabled()) { VisibleSelection selection = selectedFrame->selection()->selection(); - if (selection.isCaretOrRange()) { - if (selection.isCaret()) - selection.expandUsingGranularity(WordGranularity); + if (selection.isCaret()) { + selection.expandUsingGranularity(WordGranularity); RefPtr<Range> range = selection.toNormalizedRange(); Vector<DocumentMarker*> markers = selectedFrame->document()->markers()->markersInRange(range.get(), DocumentMarker::Spelling | DocumentMarker::Grammar); if (markers.size() == 1) { diff --git a/Source/WebKit/chromium/src/FindInPageCoordinates.cpp b/Source/WebKit/chromium/src/FindInPageCoordinates.cpp new file mode 100644 index 000000000..b00a30c23 --- /dev/null +++ b/Source/WebKit/chromium/src/FindInPageCoordinates.cpp @@ -0,0 +1,142 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "FindInPageCoordinates.h" + +#include "FloatPoint.h" +#include "FloatQuad.h" +#include "FloatRect.h" +#include "Frame.h" +#include "IntPoint.h" +#include "Node.h" +#include "Range.h" +#include "RenderBox.h" +#include "RenderObject.h" +#include "RenderPart.h" +#include "RenderStyle.h" +#include "RenderView.h" + +using namespace WebCore; + +namespace WebKit { + +static FloatRect toNormalizedRect(const FloatRect& absoluteRect, const RenderObject* renderer, FloatRect& containerBoundingBox) +{ + ASSERT(renderer); + + const RenderObject* container = renderer->container(); + if (!container) { + containerBoundingBox = FloatRect(); + return FloatRect(); + } + + FloatRect normalizedRect = absoluteRect; + FloatRect containerRect = container->absoluteBoundingBoxRect(); + containerBoundingBox = containerRect; + + // For RenderBoxes we want to normalize by the max layout overflow size instead of only the visible bounding box. + // Quads and their enclosing bounding boxes need to be used in order to keep results transform-friendly. + if (container->isBox()) { + const RenderBox* containerBox = toRenderBox(container); + FloatPoint scrolledOrigin; + + // For overflow:scroll we need to get where the actual origin is independently of the scroll. + if (container->hasOverflowClip()) + scrolledOrigin = -IntPoint(containerBox->scrolledContentOffset()); + + FloatRect overflowRect(scrolledOrigin, containerBox->maxLayoutOverflow()); + containerRect = containerBox->localToAbsoluteQuad(FloatQuad(overflowRect), false).enclosingBoundingBox(); + } + + if (containerRect.isEmpty()) + return FloatRect(); + + // Make the coordinates relative to the container enclosing bounding box. + // Since we work with rects enclosing quad unions this is still transform-friendly. + normalizedRect.moveBy(-containerRect.location()); + + // Fixed positions do not make sense in this coordinate system, but need to leave consistent tickmarks. + // So, use their position when the view is not scrolled, like an absolute position. + if (renderer->style()->position() == FixedPosition && container->isRenderView()) + normalizedRect.move(-toRenderView(container)->frameView()->scrollOffsetForFixedPosition()); + + normalizedRect.scale(1 / containerRect.width(), 1 / containerRect.height()); + + return normalizedRect; +} + +FloatRect findInPageRectFromAbsoluteRect(const FloatRect& inputRect, const RenderObject* renderer) +{ + if (!renderer || inputRect.isEmpty()) + return FloatRect(); + + // Normalize the input rect to its container, saving the container bounding box for the incoming loop. + FloatRect rendererBoundingBox; + FloatRect normalizedRect = toNormalizedRect(inputRect, renderer, rendererBoundingBox); + renderer = renderer->container(); + + // Go up across frames. + while (renderer) { + + // Go up the render tree until we reach the root of the current frame (the RenderView). + for (const RenderObject* container = renderer->container(); container; renderer = container, container = container->container()) { + + // Compose the normalized rects. The absolute bounding box of the container is calculated in toNormalizedRect + // and can be reused for the next iteration of the loop. + FloatRect normalizedBoxRect = toNormalizedRect(rendererBoundingBox, renderer, rendererBoundingBox); + normalizedRect.scale(normalizedBoxRect.width(), normalizedBoxRect.height()); + normalizedRect.moveBy(normalizedBoxRect.location()); + + if (normalizedRect.isEmpty()) + return normalizedRect; + } + + // Jump to the renderer owning the frame, if any. + ASSERT(renderer->isRenderView()); + renderer = renderer->frame() ? renderer->frame()->ownerRenderer() : 0; + + // Update the absolute coordinates to the new frame. + if (renderer) + rendererBoundingBox = renderer->absoluteBoundingBoxRect(); + } + + return normalizedRect; +} + +FloatRect findInPageRectFromRange(Range* range) +{ + if (!range || !range->firstNode()) + return FloatRect(); + + return findInPageRectFromAbsoluteRect(RenderObject::absoluteBoundingBoxRectForRange(range), range->firstNode()->renderer()); +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/FindInPageCoordinates.h b/Source/WebKit/chromium/src/FindInPageCoordinates.h new file mode 100644 index 000000000..35465eb02 --- /dev/null +++ b/Source/WebKit/chromium/src/FindInPageCoordinates.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FindInPageCoordinates_h +#define FindInPageCoordinates_h + +#include "FloatRect.h" + +namespace WebCore { +class Range; +class RenderObject; +} + +namespace WebKit { + +// Find-in-page coordinate conversion methods. +// +// This coordinate system is designed to give consistent tickmarks in cases where find matches +// are in scrollable areas but might not be visible (e.g. child frames, scroll:overflow). +// In these cases, using absolute positions might lead to tickmarks pointing outside the visible +// area of its container, which is counter-intuitive for users. +// +// Find-in-page coordinates are represented as normalized fractions of the main frame document with +// the property that they are built by composing the relative position of each renderer to the maximum +// effective layout size of its container all the way up the render tree. The resulting coordinates +// are scroll-independent, representing any contents scaled to the visible area of their container. +// The provided methods support scroll:overflow and are CSS position and transform-friendly. + +WebCore::FloatRect findInPageRectFromAbsoluteRect(const WebCore::FloatRect&, const WebCore::RenderObject*); +WebCore::FloatRect findInPageRectFromRange(WebCore::Range*); + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp index 1e315660a..5dd02b563 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -304,7 +304,7 @@ void FrameLoaderClientImpl::detachedFromParent3() // will cause a crash. If you remove/modify this, just ensure that you can // go to a page and then navigate to a new page without getting any asserts // or crashes. - m_webFrame->frame()->script()->proxy()->clearForClose(); + m_webFrame->frame()->script()->clearForClose(); // Alert the client that the frame is being detached. This is the last // chance we have to communicate with the client. @@ -1490,9 +1490,8 @@ PassRefPtr<Widget> FrameLoaderClientImpl::createPlugin( // (e.g., acrobat reader). void FrameLoaderClientImpl::redirectDataToPlugin(Widget* pluginWidget) { - if (pluginWidget->isPluginContainer()) - m_pluginWidget = static_cast<WebPluginContainerImpl*>(pluginWidget); - ASSERT(m_pluginWidget); + ASSERT(!pluginWidget || pluginWidget->isPluginContainer()); + m_pluginWidget = static_cast<WebPluginContainerImpl*>(pluginWidget); } PassRefPtr<Widget> FrameLoaderClientImpl::createJavaAppletWidget( diff --git a/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp b/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp index 7df84d2ff..193bf2b5f 100644 --- a/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp +++ b/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp @@ -68,9 +68,9 @@ void IDBCallbacksProxy::onError(PassRefPtr<IDBDatabaseError> idbDatabaseError) m_callbacks->onError(WebIDBDatabaseError(idbDatabaseError)); } -void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBCursorBackendInterface> idbCursorBackend) +void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBCursorBackendInterface> idbCursorBackend, PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue> value) { - m_callbacks->onSuccess(new WebIDBCursorImpl(idbCursorBackend)); + m_callbacks->onSuccess(new WebIDBCursorImpl(idbCursorBackend), key, primaryKey, value); } void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend) @@ -102,9 +102,10 @@ void IDBCallbacksProxy::onSuccess(PassRefPtr<SerializedScriptValue> serializedSc { m_callbacks->onSuccess(serializedScriptValue, key, keyPath); } -void IDBCallbacksProxy::onSuccessWithContinuation() + +void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue> value) { - m_callbacks->onSuccessWithContinuation(); + m_callbacks->onSuccess(key, primaryKey, value); } void IDBCallbacksProxy::onSuccessWithPrefetch(const Vector<RefPtr<IDBKey> >& keys, const Vector<RefPtr<IDBKey> >& primaryKeys, const Vector<RefPtr<SerializedScriptValue> >& values) @@ -129,6 +130,16 @@ void IDBCallbacksProxy::onBlocked() m_callbacks->onBlocked(); } +void IDBCallbacksProxy::onBlocked(int64_t existingVersion) +{ + m_callbacks->onBlocked(existingVersion); +} + +void IDBCallbacksProxy::onUpgradeNeeded(int64_t oldVersion, PassRefPtr<IDBTransactionBackendInterface> transaction, PassRefPtr<IDBDatabaseBackendInterface> database) +{ + m_callbacks->onUpgradeNeeded(oldVersion, new WebIDBTransactionImpl(transaction), new WebIDBDatabaseImpl(database)); +} + } // namespace WebKit #endif // ENABLE(INDEXED_DATABASE) diff --git a/Source/WebKit/chromium/src/IDBCallbacksProxy.h b/Source/WebKit/chromium/src/IDBCallbacksProxy.h index db3056550..825758aad 100644 --- a/Source/WebKit/chromium/src/IDBCallbacksProxy.h +++ b/Source/WebKit/chromium/src/IDBCallbacksProxy.h @@ -47,15 +47,17 @@ public: virtual void onError(PassRefPtr<WebCore::IDBDatabaseError>); virtual void onSuccess(PassRefPtr<WebCore::DOMStringList>); - virtual void onSuccess(PassRefPtr<WebCore::IDBCursorBackendInterface>); + virtual void onSuccess(PassRefPtr<WebCore::IDBCursorBackendInterface>, PassRefPtr<WebCore::IDBKey>, PassRefPtr<WebCore::IDBKey> primaryKey, PassRefPtr<WebCore::SerializedScriptValue>); virtual void onSuccess(PassRefPtr<WebCore::IDBDatabaseBackendInterface>); virtual void onSuccess(PassRefPtr<WebCore::IDBKey>); virtual void onSuccess(PassRefPtr<WebCore::IDBTransactionBackendInterface>); virtual void onSuccess(PassRefPtr<WebCore::SerializedScriptValue>); virtual void onSuccess(PassRefPtr<WebCore::SerializedScriptValue>, PassRefPtr<WebCore::IDBKey>, const WebCore::IDBKeyPath&); - virtual void onSuccessWithContinuation(); + virtual void onSuccess(PassRefPtr<WebCore::IDBKey>, PassRefPtr<WebCore::IDBKey> primaryKey, PassRefPtr<WebCore::SerializedScriptValue>); virtual void onSuccessWithPrefetch(const Vector<RefPtr<WebCore::IDBKey> >& keys, const Vector<RefPtr<WebCore::IDBKey> >& primaryKeys, const Vector<RefPtr<WebCore::SerializedScriptValue> >& values); virtual void onBlocked(); + virtual void onBlocked(int64_t existingVersion); + virtual void onUpgradeNeeded(int64_t oldVersion, PassRefPtr<WebCore::IDBTransactionBackendInterface>, PassRefPtr<WebCore::IDBDatabaseBackendInterface>); private: IDBCallbacksProxy(PassOwnPtr<WebIDBCallbacks>); diff --git a/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp b/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp index 277a665cf..9243d2ba2 100644 --- a/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp @@ -54,21 +54,6 @@ IDBCursorBackendProxy::~IDBCursorBackendProxy() { } -PassRefPtr<IDBKey> IDBCursorBackendProxy::key() const -{ - return m_idbCursor->key(); -} - -PassRefPtr<IDBKey> IDBCursorBackendProxy::primaryKey() const -{ - return m_idbCursor->primaryKey(); -} - -PassRefPtr<SerializedScriptValue> IDBCursorBackendProxy::value() const -{ - return m_idbCursor->value(); -} - void IDBCursorBackendProxy::advance(unsigned long count, PassRefPtr<IDBCallbacks> callbacks, ExceptionCode& ec) { m_idbCursor->advance(count, new WebIDBCallbacksImpl(callbacks), ec); diff --git a/Source/WebKit/chromium/src/IDBCursorBackendProxy.h b/Source/WebKit/chromium/src/IDBCursorBackendProxy.h index d742f68e5..08afeba8f 100644 --- a/Source/WebKit/chromium/src/IDBCursorBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBCursorBackendProxy.h @@ -42,9 +42,6 @@ public: static PassRefPtr<WebCore::IDBCursorBackendInterface> create(PassOwnPtr<WebIDBCursor>); virtual ~IDBCursorBackendProxy(); - virtual PassRefPtr<WebCore::IDBKey> key() const; - virtual PassRefPtr<WebCore::IDBKey> primaryKey() const; - virtual PassRefPtr<WebCore::SerializedScriptValue> value() const; virtual void advance(unsigned long, PassRefPtr<WebCore::IDBCallbacks>, WebCore::ExceptionCode&); virtual void continueFunction(PassRefPtr<WebCore::IDBKey>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::ExceptionCode&); virtual void deleteFunction(PassRefPtr<WebCore::IDBCallbacks>, WebCore::ExceptionCode&); diff --git a/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp b/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp index 901b55e54..56afe5fb5 100644 --- a/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp @@ -87,6 +87,7 @@ void IDBDatabaseBackendProxy::deleteObjectStore(const String& name, IDBTransacti void IDBDatabaseBackendProxy::setVersion(const String& version, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks, ExceptionCode& ec) { + ASSERT(m_webIDBDatabase); m_webIDBDatabase->setVersion(version, new WebIDBCallbacksImpl(callbacks), ec); } diff --git a/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.cpp b/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.cpp index 816faf6c4..019e59ba0 100644 --- a/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.cpp +++ b/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.cpp @@ -48,6 +48,11 @@ IDBDatabaseCallbacksProxy::~IDBDatabaseCallbacksProxy() { } +void IDBDatabaseCallbacksProxy::onVersionChange(int64_t oldVersion, int64_t newVersion) +{ + m_callbacks->onVersionChange(oldVersion, newVersion); +} + void IDBDatabaseCallbacksProxy::onVersionChange(const String& requestedVersion) { m_callbacks->onVersionChange(requestedVersion); diff --git a/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.h b/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.h index affdce77d..9995abd2b 100644 --- a/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.h +++ b/Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.h @@ -41,6 +41,7 @@ public: virtual ~IDBDatabaseCallbacksProxy(); virtual void onVersionChange(const String& requestedVersion); + virtual void onVersionChange(int64_t oldVersion, int64_t newVersion); private: IDBDatabaseCallbacksProxy(PassOwnPtr<WebIDBDatabaseCallbacks>); diff --git a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp index c1bec1077..babcbae18 100755 --- a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp @@ -203,7 +203,7 @@ void IDBFactoryBackendProxy::getDatabaseNames(PassRefPtr<IDBCallbacks> prpCallba } -void IDBFactoryBackendProxy::open(const String& name, PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext* context, const String& dataDir) +void IDBFactoryBackendProxy::open(const String& name, int64_t version, PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext* context, const String& dataDir) { RefPtr<IDBCallbacks> callbacks(prpCallbacks); WebSecurityOrigin origin(securityOrigin); @@ -211,7 +211,7 @@ void IDBFactoryBackendProxy::open(const String& name, PassRefPtr<IDBCallbacks> p return; WebFrameImpl* webFrame = getWebFrame(context); - m_webIDBFactory->open(name, new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); + m_webIDBFactory->open(name, version, new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); } void IDBFactoryBackendProxy::deleteDatabase(const String& name, PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext* context, const String& dataDir) diff --git a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.h b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.h index 22a6f52a8..c0de910a9 100644 --- a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.h @@ -49,7 +49,7 @@ public: virtual ~IDBFactoryBackendProxy(); virtual void getDatabaseNames(PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir); - virtual void open(const String& name, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir); + virtual void open(const String& name, int64_t version, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir); virtual void deleteDatabase(const String& name, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir); private: diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp index 4d1c91d07..b8fb074ea 100755 --- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp @@ -77,6 +77,16 @@ void IDBObjectStoreBackendProxy::putWithIndexKeys(PassRefPtr<SerializedScriptVal m_webIDBObjectStore->putWithIndexKeys(value, key, static_cast<WebIDBObjectStore::PutMode>(putMode), new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), webIndexNames, webIndexKeys, ec); } +void IDBObjectStoreBackendProxy::setIndexKeys(PassRefPtr<IDBKey> prpPrimaryKey, const Vector<String>& indexNames, const Vector<IndexKeys>& indexKeys, IDBTransactionBackendInterface* transaction) +{ + // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, + // all implementations of IDB interfaces are proxy objects. + IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction); + WebVector<WebString> webIndexNames(indexNames); + WebVector<IndexKeys> webIndexKeys(indexKeys); + m_webIDBObjectStore->setIndexKeys(prpPrimaryKey, webIndexNames, webIndexKeys, *transactionProxy->getWebIDBTransaction()); +} + void IDBObjectStoreBackendProxy::deleteFunction(PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) { // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, @@ -104,6 +114,14 @@ PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendProxy::createIndex(con return IDBIndexBackendProxy::create(index.release()); } +void IDBObjectStoreBackendProxy::setIndexesReady(const Vector<String>& indexNames, IDBTransactionBackendInterface* transaction) +{ + // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, + // all implementations of IDB interfaces are proxy objects. + IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction); + m_webIDBObjectStore->setIndexesReady(indexNames, *transactionProxy->getWebIDBTransaction()); +} + PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendProxy::index(const String& name, ExceptionCode& ec) { OwnPtr<WebIDBIndex> index = adoptPtr(m_webIDBObjectStore->index(name, ec)); @@ -125,7 +143,15 @@ void IDBObjectStoreBackendProxy::openCursor(PassRefPtr<IDBKeyRange> range, unsig // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, // all implementations of IDB interfaces are proxy objects. IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction); - m_webIDBObjectStore->openCursor(range, direction, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec); + m_webIDBObjectStore->openCursor(range, static_cast<WebIDBCursor::Direction>(direction), new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec); +} + +void IDBObjectStoreBackendProxy::openCursor(PassRefPtr<IDBKeyRange> range, IDBCursor::Direction direction, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface::TaskType taskType, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) +{ + // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, + // all implementations of IDB interfaces are proxy objects. + IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction); + m_webIDBObjectStore->openCursor(range, static_cast<WebIDBCursor::Direction>(direction), new WebIDBCallbacksImpl(callbacks), static_cast<WebIDBTransaction::TaskType>(taskType), *transactionProxy->getWebIDBTransaction(), ec); } void IDBObjectStoreBackendProxy::count(PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h index 0235077fa..fb0f2af37 100644 --- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h @@ -49,10 +49,15 @@ public: virtual void clear(PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); PassRefPtr<WebCore::IDBIndexBackendInterface> createIndex(const String& name, const WebCore::IDBKeyPath&, bool unique, bool multiEntry, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); + virtual void setIndexKeys(PassRefPtr<WebCore::IDBKey> prpPrimaryKey, const WTF::Vector<WTF::String>&, const WTF::Vector<IndexKeys>&, WebCore::IDBTransactionBackendInterface*); + virtual void setIndexesReady(const Vector<String>&, WebCore::IDBTransactionBackendInterface*); + PassRefPtr<WebCore::IDBIndexBackendInterface> index(const String& name, WebCore::ExceptionCode&); void deleteIndex(const String& name, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); + // FIXME: Remove this version of openCursor when TaskType is plumbed through chromium. virtual void openCursor(PassRefPtr<WebCore::IDBKeyRange>, unsigned short direction, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); + virtual void openCursor(PassRefPtr<WebCore::IDBKeyRange>, WebCore::IDBCursor::Direction, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface::TaskType, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); virtual void count(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); private: diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp index fb9c12de6..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,27 +81,13 @@ void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer) return; } - if (*layer->platformLayer() == scrollLayer()) + if (layer->platformLayer() == scrollLayer()) return; layer->addChildAtIndex(m_graphicsLayer.get(), 0); ASSERT(haveScrollLayer()); } -static void reserveScrollbarLayers(WebLayer layer, WebLayer clipLayer) -{ - // Scrollbars and corners are known to be attached outside the root clip - // rect, so skip the clipLayer subtree. - if (layer == clipLayer) - return; - - for (size_t i = 0; i < layer.numberOfChildren(); ++i) - reserveScrollbarLayers(layer.childAt(i), clipLayer); - - if (layer.drawsContent()) - layer.setAlwaysReserveTextures(true); -} - void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, float deviceScale) { if (!haveScrollLayer()) @@ -109,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); @@ -134,12 +121,6 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, m_graphicsLayer->setNeedsDisplay(); } else if (visibleRectChanged) m_graphicsLayer->setNeedsDisplay(); - - WebLayer clipLayer = layer.parent(); - WebLayer rootLayer = clipLayer; - while (!rootLayer.parent().isNull()) - rootLayer = rootLayer.parent(); - reserveScrollbarLayers(rootLayer, clipLayer); } bool NonCompositedContentHost::haveScrollLayer() @@ -147,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/StorageAreaProxy.cpp b/Source/WebKit/chromium/src/StorageAreaProxy.cpp index 722e80f53..efa0c9098 100644 --- a/Source/WebKit/chromium/src/StorageAreaProxy.cpp +++ b/Source/WebKit/chromium/src/StorageAreaProxy.cpp @@ -131,7 +131,7 @@ void StorageAreaProxy::dispatchLocalStorageEvent(PageGroup* pageGroup, const Str const HashSet<Page*>& pages = pageGroup->pages(); for (HashSet<Page*>::const_iterator it = pages.begin(); it != pages.end(); ++it) { for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - Storage* storage = frame->domWindow()->optionalLocalStorage(); + Storage* storage = frame->document()->domWindow()->optionalLocalStorage(); if (storage && frame->document()->securityOrigin()->equal(securityOrigin) && !isEventSource(storage, sourceAreaInstance)) frame->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, pageURL, storage)); } @@ -160,7 +160,7 @@ void StorageAreaProxy::dispatchSessionStorageEvent(PageGroup* pageGroup, const S return; for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - Storage* storage = frame->domWindow()->optionalSessionStorage(); + Storage* storage = frame->document()->domWindow()->optionalSessionStorage(); if (storage && frame->document()->securityOrigin()->equal(securityOrigin) && !isEventSource(storage, sourceAreaInstance)) frame->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, pageURL, storage)); } diff --git a/Source/WebKit/chromium/src/WebAnimationCurveCommon.cpp b/Source/WebKit/chromium/src/WebAnimationCurveCommon.cpp index b5b98b0a3..2b7be0361 100644 --- a/Source/WebKit/chromium/src/WebAnimationCurveCommon.cpp +++ b/Source/WebKit/chromium/src/WebAnimationCurveCommon.cpp @@ -26,7 +26,7 @@ #include "WebAnimationCurveCommon.h" -#include "cc/CCTimingFunction.h" +#include "CCTimingFunction.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> diff --git a/Source/WebKit/chromium/src/WebAnimation.cpp b/Source/WebKit/chromium/src/WebAnimationImpl.cpp index 610201512..187272ef2 100644 --- a/Source/WebKit/chromium/src/WebAnimation.cpp +++ b/Source/WebKit/chromium/src/WebAnimationImpl.cpp @@ -24,11 +24,12 @@ #include "config.h" -#include <public/WebAnimation.h> +#include "WebAnimationImpl.h" #include "AnimationIdVendor.h" -#include "cc/CCActiveAnimation.h" -#include "cc/CCAnimationCurve.h" +#include "CCActiveAnimation.h" +#include "CCAnimationCurve.h" +#include <public/WebAnimation.h> #include <public/WebAnimationCurve.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -38,71 +39,66 @@ using WebCore::CCActiveAnimation; namespace WebKit { -WebAnimation::TargetProperty WebAnimation::targetProperty() const +WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, TargetProperty targetProperty) { - return static_cast<WebAnimation::TargetProperty>(m_private->targetProperty()); + return WebAnimation::create(curve, AnimationIdVendor::getNextAnimationId(), AnimationIdVendor::getNextGroupId(), targetProperty); } -int WebAnimation::iterations() const +WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, int animationId, int groupId, TargetProperty targetProperty) { - return m_private->iterations(); + return new WebAnimationImpl(CCActiveAnimation::create(curve, animationId, groupId, static_cast<WebCore::CCActiveAnimation::TargetProperty>(targetProperty))); } -void WebAnimation::setIterations(int n) +WebAnimation::TargetProperty WebAnimationImpl::targetProperty() const { - m_private->setIterations(n); + return static_cast<WebAnimationImpl::TargetProperty>(m_animation->targetProperty()); } -double WebAnimation::startTime() const +int WebAnimationImpl::iterations() const { - return m_private->startTime(); + return m_animation->iterations(); } -void WebAnimation::setStartTime(double monotonicTime) +void WebAnimationImpl::setIterations(int n) { - m_private->setStartTime(monotonicTime); + m_animation->setIterations(n); } -double WebAnimation::timeOffset() const +double WebAnimationImpl::startTime() const { - return m_private->timeOffset(); + return m_animation->startTime(); } -void WebAnimation::setTimeOffset(double monotonicTime) +void WebAnimationImpl::setStartTime(double monotonicTime) { - m_private->setTimeOffset(monotonicTime); + m_animation->setStartTime(monotonicTime); } -bool WebAnimation::alternatesDirection() const +double WebAnimationImpl::timeOffset() const { - return m_private->alternatesDirection(); + return m_animation->timeOffset(); } -void WebAnimation::setAlternatesDirection(bool alternates) +void WebAnimationImpl::setTimeOffset(double monotonicTime) { - m_private->setAlternatesDirection(alternates); + m_animation->setTimeOffset(monotonicTime); } -WebAnimation::operator PassOwnPtr<WebCore::CCActiveAnimation>() const +bool WebAnimationImpl::alternatesDirection() const { - OwnPtr<WebCore::CCActiveAnimation> toReturn(m_private->cloneForImplThread()); - toReturn->setNeedsSynchronizedStartTime(true); - return toReturn.release(); + return m_animation->alternatesDirection(); } -void WebAnimation::initialize(const WebAnimationCurve& curve, TargetProperty targetProperty) +void WebAnimationImpl::setAlternatesDirection(bool alternates) { - initialize(curve, AnimationIdVendor::getNextAnimationId(), AnimationIdVendor::getNextGroupId(), targetProperty); + m_animation->setAlternatesDirection(alternates); } -void WebAnimation::initialize(const WebAnimationCurve& curve, int animationId, int groupId, TargetProperty targetProperty) +PassOwnPtr<WebCore::CCActiveAnimation> WebAnimationImpl::cloneToCCAnimation() { - m_private.reset(CCActiveAnimation::create(curve, animationId, groupId, static_cast<WebCore::CCActiveAnimation::TargetProperty>(targetProperty)).leakPtr()); -} - -void WebAnimation::destroy() -{ - m_private.reset(0); + OwnPtr<WebCore::CCActiveAnimation> toReturn(m_animation->clone(WebCore::CCActiveAnimation::NonControllingInstance)); + toReturn->setNeedsSynchronizedStartTime(true); + return toReturn.release(); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebAnimationImpl.h b/Source/WebKit/chromium/src/WebAnimationImpl.h new file mode 100644 index 000000000..8677b9c60 --- /dev/null +++ b/Source/WebKit/chromium/src/WebAnimationImpl.h @@ -0,0 +1,65 @@ +/* + * 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 INC. 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 INC. 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 WebAnimationImpl_h +#define WebAnimationImpl_h + +#include <public/WebAnimation.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> + +namespace WebCore { +class CCActiveAnimation; +} + +namespace WebKit { + +class WebAnimationImpl : public WebAnimation { +public: + explicit WebAnimationImpl(PassOwnPtr<WebCore::CCActiveAnimation> animation) + : m_animation(animation) + { + } + virtual ~WebAnimationImpl() { } + + // WebAnimation implementation + virtual TargetProperty targetProperty() const OVERRIDE; + virtual int iterations() const OVERRIDE; + virtual void setIterations(int) OVERRIDE; + virtual double startTime() const OVERRIDE; + virtual void setStartTime(double monotonicTime) OVERRIDE; + virtual double timeOffset() const OVERRIDE; + virtual void setTimeOffset(double monotonicTime) OVERRIDE; + virtual bool alternatesDirection() const OVERRIDE; + virtual void setAlternatesDirection(bool) OVERRIDE; + + PassOwnPtr<WebCore::CCActiveAnimation> cloneToCCAnimation(); +private: + OwnPtr<WebCore::CCActiveAnimation> m_animation; +}; + +} + +#endif // WebAnimationImpl_h + diff --git a/Source/WebKit/chromium/src/WebBindings.cpp b/Source/WebKit/chromium/src/WebBindings.cpp index 786a4175b..71a74db1b 100644 --- a/Source/WebKit/chromium/src/WebBindings.cpp +++ b/Source/WebKit/chromium/src/WebBindings.cpp @@ -290,7 +290,7 @@ static NPObject* makeIntArrayImpl(const WebVector<int>& data) for (size_t i = 0; i < data.size(); ++i) result->Set(i, v8::Number::New(data[i])); - DOMWindow* window = V8Proxy::retrieveWindow(v8::Context::GetCurrent()); + DOMWindow* window = toDOMWindow(v8::Context::GetCurrent()); return npCreateV8ScriptObject(0, result, window); } @@ -301,7 +301,7 @@ static NPObject* makeStringArrayImpl(const WebVector<WebString>& data) for (size_t i = 0; i < data.size(); ++i) result->Set(i, data[i].data() ? v8::String::New(reinterpret_cast<const uint16_t*>((data[i].data())), data[i].length()) : v8::String::New("")); - DOMWindow* window = V8Proxy::retrieveWindow(v8::Context::GetCurrent()); + DOMWindow* window = toDOMWindow(v8::Context::GetCurrent()); return npCreateV8ScriptObject(0, result, window); } diff --git a/Source/WebKit/chromium/src/WebBlobData.cpp b/Source/WebKit/chromium/src/WebBlobData.cpp index c767d1bdd..094ff8013 100644 --- a/Source/WebKit/chromium/src/WebBlobData.cpp +++ b/Source/WebKit/chromium/src/WebBlobData.cpp @@ -83,7 +83,12 @@ bool WebBlobData::itemAt(size_t index, Item& result) const return true; case BlobDataItem::Blob: result.type = Item::TypeBlob; - result.blobURL = item.url; + result.blobURL = item.url; // FIXME: deprecate this. + result.url = item.url; + return true; + case BlobDataItem::URL: + result.type = Item::TypeURL; + result.url = item.url; return true; } ASSERT_NOT_REACHED(); diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp index 25b31d5e9..8084d715c 100644 --- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp +++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp @@ -27,14 +27,14 @@ #include "WebCompositorInputHandlerImpl.h" +#include "CCActiveGestureAnimation.h" +#include "CCProxy.h" #include "PlatformGestureCurveTarget.h" #include "TouchpadFlingPlatformGestureCurve.h" #include "TraceEvent.h" #include "WebCompositorImpl.h" #include "WebCompositorInputHandlerClient.h" #include "WebInputEvent.h" -#include "cc/CCActiveGestureAnimation.h" -#include "cc/CCProxy.h" #include <wtf/ThreadingPrimitives.h> using namespace WebCore; @@ -181,7 +181,7 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h switch (scrollStatus) { case CCInputHandlerClient::ScrollStarted: { TRACE_EVENT_INSTANT2("cc", "WebCompositorInputHandlerImpl::handleInput wheel scroll", "deltaX", -wheelEvent.deltaX, "deltaY", -wheelEvent.deltaY); - m_inputHandlerClient->scrollBy(IntSize(-wheelEvent.deltaX, -wheelEvent.deltaY)); + m_inputHandlerClient->scrollBy(IntPoint(wheelEvent.x, wheelEvent.y), IntSize(-wheelEvent.deltaX, -wheelEvent.deltaY)); m_inputHandlerClient->scrollEnd(); return DidHandle; } @@ -216,7 +216,7 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h return DidNotHandle; const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event); - m_inputHandlerClient->scrollBy(IntSize(-gestureEvent.deltaX, -gestureEvent.deltaY)); + m_inputHandlerClient->scrollBy(IntPoint(gestureEvent.x, gestureEvent.y), IntSize(-gestureEvent.deltaX, -gestureEvent.deltaY)); return DidHandle; } else if (event.type == WebInputEvent::GestureScrollEnd) { ASSERT(m_expectScrollUpdateEnd); @@ -263,7 +263,7 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::handleGestureFling(const WebGestureEvent& gestureEvent) { - CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(gestureEvent.x, gestureEvent.y), CCInputHandlerClient::Wheel); + CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(gestureEvent.x, gestureEvent.y), CCInputHandlerClient::Gesture); switch (scrollStatus) { case CCInputHandlerClient::ScrollStarted: { TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::handleGestureFling::started"); diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h index 6bb09ab5c..9474b2193 100644 --- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h +++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h @@ -26,11 +26,11 @@ #ifndef WebCompositorInputHandlerImpl_h #define WebCompositorInputHandlerImpl_h +#include "CCGestureCurve.h" +#include "CCInputHandler.h" #include "WebActiveWheelFlingParameters.h" #include "WebCompositorInputHandler.h" #include "WebInputEvent.h" -#include "cc/CCGestureCurve.h" -#include "cc/CCInputHandler.h" #include <public/WebCompositor.h> #include <wtf/HashSet.h> #include <wtf/Noncopyable.h> 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/WebDOMMessageEvent.cpp b/Source/WebKit/chromium/src/WebDOMMessageEvent.cpp index 53ea43ce1..06cf66fc5 100644 --- a/Source/WebKit/chromium/src/WebDOMMessageEvent.cpp +++ b/Source/WebKit/chromium/src/WebDOMMessageEvent.cpp @@ -32,6 +32,7 @@ #include "WebDOMMessageEvent.h" #include "DOMWindow.h" +#include "Document.h" #include "MessageEvent.h" #include "MessagePort.h" #include "PlatformMessagePortChannel.h" @@ -55,7 +56,7 @@ void WebDOMMessageEvent::initMessageEvent(const WebString& type, bool canBubble, ASSERT(isMessageEvent()); DOMWindow* window = 0; if (sourceFrame) - window = static_cast<const WebFrameImpl*>(sourceFrame)->frame()->domWindow(); + window = static_cast<const WebFrameImpl*>(sourceFrame)->frame()->document()->domWindow(); OwnPtr<MessagePortArray> ports; unwrap<MessageEvent>()->initMessageEvent(type, canBubble, cancelable, messageData, origin, lastEventId, window, ports.release()); } diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index d4366f99a..e3a80e0d4 100644 --- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -424,7 +424,7 @@ void WebDevToolsAgentImpl::didCreateScriptContext(WebFrameImpl* webframe, int wo if (worldId) return; if (WebCore::Frame* frame = webframe->frame()) - frame->script()->proxy()->setContextDebugId(m_hostId); + frame->script()->setContextDebugId(m_hostId); } void WebDevToolsAgentImpl::mainFrameViewCreated(WebFrameImpl* webFrame) diff --git a/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp index 054e5b245..9418c0dc0 100644 --- a/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp +++ b/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp @@ -122,7 +122,7 @@ void WebDevToolsFrontendImpl::dispatchOnInspectorFrontend(const WebString& messa args.append(ToV8String(message)); v8::TryCatch tryCatch; tryCatch.SetVerbose(true); - V8Proxy::instrumentedCallFunction(frame->frame(), function, inspectorBackend, args.size(), args.data()); + ScriptController::callFunctionWithInstrumentation(frame->frame() ? frame->frame()->document() : 0, function, inspectorBackend, args.size(), args.data()); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp b/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp deleted file mode 100644 index bbd1f8ddb..000000000 --- a/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp +++ /dev/null @@ -1,131 +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/WebExternalTextureLayer.h> - -#include "TextureLayerChromium.h" -#include "cc/CCTextureUpdateQueue.h" -#include <public/WebExternalTextureLayerClient.h> -#include <public/WebFloatRect.h> -#include <public/WebSize.h> - -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); - } - - virtual WebKit::WebGraphicsContext3D* context() OVERRIDE - { - return m_client->context(); - } - -private: - WebExternalTextureLayerClient* m_client; -}; - -WebExternalTextureLayer WebExternalTextureLayer::create(WebExternalTextureLayerClient* client) -{ - RefPtr<TextureLayerChromium> layer = adoptRef(new WebExternalTextureLayerImpl(client)); - layer->setIsDrawable(true); - return WebExternalTextureLayer(layer.release()); -} - -void WebExternalTextureLayer::clearClient() -{ - unwrap<TextureLayerChromium>()->clearClient(); -} - -void WebExternalTextureLayer::setTextureId(unsigned id) -{ - unwrap<TextureLayerChromium>()->setTextureId(id); -} - -void WebExternalTextureLayer::setFlipped(bool flipped) -{ - unwrap<TextureLayerChromium>()->setFlipped(flipped); -} - -void WebExternalTextureLayer::setUVRect(const WebFloatRect& rect) -{ - unwrap<TextureLayerChromium>()->setUVRect(rect); -} - -void WebExternalTextureLayer::setOpaque(bool opaque) -{ - unwrap<TextureLayerChromium>()->setOpaque(opaque); -} - -void WebExternalTextureLayer::setPremultipliedAlpha(bool premultipliedAlpha) -{ - unwrap<TextureLayerChromium>()->setPremultipliedAlpha(premultipliedAlpha); -} - -void WebExternalTextureLayer::willModifyTexture() -{ - unwrap<TextureLayerChromium>()->willModifyTexture(); -} - -void WebExternalTextureLayer::setRateLimitContext(bool rateLimit) -{ - unwrap<TextureLayerChromium>()->setRateLimitContext(rateLimit); -} - -WebExternalTextureLayer::WebExternalTextureLayer(PassRefPtr<TextureLayerChromium> layer) - : WebLayer(layer) -{ -} - -} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp new file mode 100644 index 000000000..d62166f44 --- /dev/null +++ b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp @@ -0,0 +1,132 @@ +/* + * 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 "WebExternalTextureLayerImpl.h" + +#include "CCTextureUpdateQueue.h" +#include "TextureLayerChromium.h" +#include "WebLayerImpl.h" +#include <public/WebExternalTextureLayerClient.h> +#include <public/WebFloatRect.h> +#include <public/WebSize.h> + +using namespace WebCore; + +namespace WebKit { + +WebExternalTextureLayer* WebExternalTextureLayer::create(WebExternalTextureLayerClient* client) +{ + return new WebExternalTextureLayerImpl(client); +} + +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())); +} + +WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl() +{ + static_cast<TextureLayerChromium*>(m_layer->layer())->clearClient(); +} + +WebLayer* WebExternalTextureLayerImpl::layer() +{ + return m_layer.get(); +} + +void WebExternalTextureLayerImpl::setTextureId(unsigned id) +{ + static_cast<TextureLayerChromium*>(m_layer->layer())->setTextureId(id); +} + +void WebExternalTextureLayerImpl::setFlipped(bool flipped) +{ + static_cast<TextureLayerChromium*>(m_layer->layer())->setFlipped(flipped); +} + +void WebExternalTextureLayerImpl::setUVRect(const WebFloatRect& rect) +{ + static_cast<TextureLayerChromium*>(m_layer->layer())->setUVRect(rect); +} + +void WebExternalTextureLayerImpl::setOpaque(bool opaque) +{ + static_cast<TextureLayerChromium*>(m_layer->layer())->setOpaque(opaque); +} + +void WebExternalTextureLayerImpl::setPremultipliedAlpha(bool premultipliedAlpha) +{ + static_cast<TextureLayerChromium*>(m_layer->layer())->setPremultipliedAlpha(premultipliedAlpha); +} + +void WebExternalTextureLayerImpl::willModifyTexture() +{ + static_cast<TextureLayerChromium*>(m_layer->layer())->willModifyTexture(); +} + +void WebExternalTextureLayerImpl::setRateLimitContext(bool rateLimit) +{ + static_cast<TextureLayerChromium*>(m_layer->layer())->setRateLimitContext(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) +{ + ASSERT(m_client); + WebTextureUpdaterImpl updaterImpl(queue); + return m_client->prepareTexture(updaterImpl); +} + +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/WebFloatAnimationCurve.cpp b/Source/WebKit/chromium/src/WebFloatAnimationCurve.cpp index d8cc9bb98..e8cf7c2d2 100644 --- a/Source/WebKit/chromium/src/WebFloatAnimationCurve.cpp +++ b/Source/WebKit/chromium/src/WebFloatAnimationCurve.cpp @@ -26,9 +26,9 @@ #include <public/WebFloatAnimationCurve.h> +#include "CCKeyframedAnimationCurve.h" +#include "CCTimingFunction.h" #include "WebAnimationCurveCommon.h" -#include "cc/CCKeyframedAnimationCurve.h" -#include "cc/CCTimingFunction.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index fb2a29540..0a9855f15 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -89,6 +89,7 @@ #include "EventHandler.h" #include "EventListenerWrapper.h" #include "FileSystemType.h" +#include "FindInPageCoordinates.h" #include "FocusController.h" #include "FontCache.h" #include "FormState.h" @@ -118,6 +119,7 @@ #include "PlatformSupport.h" #include "PluginDocument.h" #include "PrintContext.h" +#include "RenderBox.h" #include "RenderFrame.h" #include "RenderLayer.h" #include "RenderObject.h" @@ -192,6 +194,7 @@ #include "V8DirectoryEntry.h" #include "V8DOMFileSystem.h" #include "V8FileEntry.h" +#include "V8GCController.h" #include <public/WebFileSystem.h> #endif @@ -516,6 +519,12 @@ static WebDataSource* DataSourceForDocLoader(DocumentLoader* loader) return loader ? WebDataSourceImpl::fromDocumentLoader(loader) : 0; } +WebFrameImpl::FindMatch::FindMatch(PassRefPtr<Range> range, int ordinal) + : m_range(range) + , m_ordinal(ordinal) +{ +} + // WebFrame ------------------------------------------------------------------- class WebFrameImpl::DeferredScopeStringMatches { @@ -574,8 +583,8 @@ WebFrame* WebFrame::frameForCurrentContext() #if WEBKIT_USING_V8 WebFrame* WebFrame::frameForContext(v8::Handle<v8::Context> context) -{ - return WebFrameImpl::fromFrame(V8Proxy::retrieveFrame(context)); +{ + return WebFrameImpl::fromFrame(toFrameIfNotDetached(context)); } #endif @@ -801,10 +810,10 @@ WebAnimationController* WebFrameImpl::animationController() WebPerformance WebFrameImpl::performance() const { - if (!m_frame || !m_frame->domWindow()) + if (!m_frame) return WebPerformance(); - return WebPerformance(m_frame->domWindow()->performance()); + return WebPerformance(m_frame->document()->domWindow()->performance()); } NPObject* WebFrameImpl::windowObject() const @@ -879,7 +888,7 @@ void WebFrameImpl::addMessageToConsole(const WebConsoleMessage& message) return; } - frame()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, webCoreMessageLevel, message.text); + frame()->document()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, webCoreMessageLevel, message.text); } void WebFrameImpl::collectGarbage() @@ -890,7 +899,7 @@ void WebFrameImpl::collectGarbage() return; // FIXME: Move this to the ScriptController and make it JS neutral. #if USE(V8) - m_frame->script()->collectGarbage(); + V8GCController::collectGarbage(); #else notImplemented(); #endif @@ -952,7 +961,7 @@ v8::Local<v8::Context> WebFrameImpl::mainWorldScriptContext() const if (!m_frame) return v8::Local<v8::Context>(); - return V8Proxy::mainWorldContext(m_frame); + return ScriptController::mainWorldContext(m_frame); } v8::Handle<v8::Value> WebFrameImpl::createFileSystem(WebFileSystem::Type type, @@ -1172,7 +1181,7 @@ void WebFrameImpl::commitDocumentData(const char* data, size_t length) unsigned WebFrameImpl::unloadListenerCount() const { - return frame()->domWindow()->pendingUnloadEventListeners(); + return frame()->document()->domWindow()->pendingUnloadEventListeners(); } bool WebFrameImpl::isProcessingUserGesture() const @@ -1495,7 +1504,7 @@ VisiblePosition WebFrameImpl::visiblePositionForWindowPoint(const WebPoint& poin frame()->document()->renderView()->layer()->hitTest(request, result); - Node* node = EventHandler::targetNode(result); + Node* node = result.targetNode(); if (!node) return VisiblePosition(); @@ -1654,10 +1663,18 @@ bool WebFrameImpl::find(int identifier, m_activeMatch = frame()->editor()->findStringAndScrollToVisible(searchText, m_activeMatch.get(), findOptions); if (!m_activeMatch) { + // If we're finding next the next active match might not be in the current frame. + // In this case we don't want to clear the matches cache. + if (!options.findNext) + clearFindMatchesCache(); invalidateArea(InvalidateAll); return false; } +#if OS(ANDROID) + viewImpl()->zoomToFindInPageRect(frameView()->contentsToWindow(enclosingIntRect(RenderObject::absoluteBoundingBoxRectForRange(m_activeMatch.get())))); +#endif + setMarkerActive(m_activeMatch.get(), true); WebFrameImpl* oldActiveFrame = mainFrameImpl->m_currentActiveMatchFrame; mainFrameImpl->m_currentActiveMatchFrame = this; @@ -1705,6 +1722,7 @@ void WebFrameImpl::stopFinding(bool clearSelection) // Remove all markers for matches found and turn off the highlighting. frame()->document()->markers()->removeMarkers(DocumentMarker::TextMatch); frame()->editor()->setMarkedTextMatchesAreHighlighted(false); + clearFindMatchesCache(); // Let the frame know that we don't want tickmarks or highlighting anymore. invalidateArea(InvalidateAll); @@ -1727,6 +1745,10 @@ void WebFrameImpl::scopeStringMatches(int identifier, // Clear highlighting for this frame. if (frame()->editor()->markedTextMatchesAreHighlighted()) frame()->page()->unmarkAllTextMatches(); + + // Clear the tickmarks and results cache. + clearFindMatchesCache(); + // Clear the counters from last operation. m_lastMatchCount = 0; m_nextInvalidateAfter = 0; @@ -1825,6 +1847,8 @@ void WebFrameImpl::scopeStringMatches(int identifier, addMarker(resultRange.get(), foundActiveMatch); + m_findMatchesCache.append(FindMatch(resultRange.get(), m_lastMatchCount + matchCount)); + // Set the new start for the search range to be the end of the previous // result range. There is no need to use a VisiblePosition here, // since findPlainText will use a TextIterator to go over the visible @@ -1895,6 +1919,9 @@ void WebFrameImpl::increaseMatchCount(int count, int identifier) // This function should only be called on the mainframe. ASSERT(!parent()); + if (count) + ++m_findMatchMarkersVersion; + m_totalMatchCount += count; // Update the UI with the latest findings. @@ -1913,6 +1940,9 @@ void WebFrameImpl::reportFindInPageSelection(const WebRect& selectionRect, void WebFrameImpl::resetMatchCount() { + if (m_totalMatchCount > 0) + ++m_findMatchMarkersVersion; + m_totalMatchCount = 0; m_framesScopingCount = 0; } @@ -1927,57 +1957,215 @@ void WebFrameImpl::sendOrientationChangeEvent(int orientation) void WebFrameImpl::addEventListener(const WebString& eventType, WebDOMEventListener* listener, bool useCapture) { - DOMWindow* window = m_frame->domWindow(); - - EventListenerWrapper* listenerWrapper = - listener->createEventListenerWrapper(eventType, useCapture, window); - - m_frame->domWindow()->addEventListener(eventType, adoptRef(listenerWrapper), useCapture); + DOMWindow* window = m_frame->document()->domWindow(); + EventListenerWrapper* listenerWrapper = listener->createEventListenerWrapper(eventType, useCapture, window); + window->addEventListener(eventType, adoptRef(listenerWrapper), useCapture); } void WebFrameImpl::removeEventListener(const WebString& eventType, WebDOMEventListener* listener, bool useCapture) { - DOMWindow* window = m_frame->domWindow(); - - EventListenerWrapper* listenerWrapper = - listener->getEventListenerWrapper(eventType, useCapture, window); + DOMWindow* window = m_frame->document()->domWindow(); + EventListenerWrapper* listenerWrapper = listener->getEventListenerWrapper(eventType, useCapture, window); window->removeEventListener(eventType, listenerWrapper, useCapture); } bool WebFrameImpl::dispatchEvent(const WebDOMEvent& event) { ASSERT(!event.isNull()); - return m_frame->domWindow()->dispatchEvent(event); + return m_frame->document()->domWindow()->dispatchEvent(event); } void WebFrameImpl::dispatchMessageEventWithOriginCheck(const WebSecurityOrigin& intendedTargetOrigin, const WebDOMEvent& event) { ASSERT(!event.isNull()); // Pass an empty call stack, since we don't have the one from the other process. - m_frame->domWindow()->dispatchMessageEventWithOriginCheck(intendedTargetOrigin.get(), event, 0); + m_frame->document()->domWindow()->dispatchMessageEventWithOriginCheck(intendedTargetOrigin.get(), event, 0); } int WebFrameImpl::findMatchMarkersVersion() const { - // FIXME: Implement this as part of https://bugs.webkit.org/show_bug.cgi?id=93111. - return 0; + ASSERT(!parent()); + return m_findMatchMarkersVersion; +} + +void WebFrameImpl::clearFindMatchesCache() +{ + if (!m_findMatchesCache.isEmpty()) + viewImpl()->mainFrameImpl()->m_findMatchMarkersVersion++; + + m_findMatchesCache.clear(); + m_findMatchRectsAreValid = false; +} + +bool WebFrameImpl::isActiveMatchFrameValid() const +{ + WebFrameImpl* mainFrameImpl = viewImpl()->mainFrameImpl(); + WebFrameImpl* activeMatchFrame = mainFrameImpl->activeMatchFrame(); + return activeMatchFrame && activeMatchFrame->m_activeMatch + && activeMatchFrame->frame()->tree()->isDescendantOf(mainFrameImpl->frame()); +} + +void WebFrameImpl::updateFindMatchRects() +{ + IntSize currentContentsSize = contentsSize(); + if (m_contentsSizeForCurrentFindMatchRects != currentContentsSize) { + m_contentsSizeForCurrentFindMatchRects = currentContentsSize; + m_findMatchRectsAreValid = false; + } + + size_t deadMatches = 0; + for (Vector<FindMatch>::iterator it = m_findMatchesCache.begin(); it != m_findMatchesCache.end(); ++it) { + if (!it->m_range->boundaryPointsValid() || !it->m_range->startContainer()->inDocument()) + it->m_rect = FloatRect(); + else if (!m_findMatchRectsAreValid) + it->m_rect = findInPageRectFromRange(it->m_range.get()); + + if (it->m_rect.isEmpty()) + ++deadMatches; + } + + // Remove any invalid matches from the cache. + if (deadMatches) { + Vector<FindMatch> filteredMatches; + filteredMatches.reserveCapacity(m_findMatchesCache.size() - deadMatches); + + for (Vector<FindMatch>::const_iterator it = m_findMatchesCache.begin(); it != m_findMatchesCache.end(); ++it) + if (!it->m_rect.isEmpty()) + filteredMatches.append(*it); + + m_findMatchesCache.swap(filteredMatches); + } + + // Invalidate the rects in child frames. Will be updated later during traversal. + if (!m_findMatchRectsAreValid) + for (WebFrame* child = firstChild(); child; child = child->nextSibling()) + static_cast<WebFrameImpl*>(child)->m_findMatchRectsAreValid = false; + + m_findMatchRectsAreValid = true; } WebFloatRect WebFrameImpl::activeFindMatchRect() { - // FIXME: Implement this as part of https://bugs.webkit.org/show_bug.cgi?id=93111. - return WebFloatRect(); + ASSERT(!parent()); + + if (!isActiveMatchFrameValid()) + return WebFloatRect(); + + return WebFloatRect(findInPageRectFromRange(m_currentActiveMatchFrame->m_activeMatch.get())); } void WebFrameImpl::findMatchRects(WebVector<WebFloatRect>& outputRects) { - // FIXME: Implement this as part of https://bugs.webkit.org/show_bug.cgi?id=93111. + ASSERT(!parent()); + + Vector<WebFloatRect> matchRects; + for (WebFrameImpl* frame = this; frame; frame = static_cast<WebFrameImpl*>(frame->traverseNext(false))) + frame->appendFindMatchRects(matchRects); + + outputRects = matchRects; +} + +void WebFrameImpl::appendFindMatchRects(Vector<WebFloatRect>& frameRects) +{ + updateFindMatchRects(); + frameRects.reserveCapacity(frameRects.size() + m_findMatchesCache.size()); + for (Vector<FindMatch>::const_iterator it = m_findMatchesCache.begin(); it != m_findMatchesCache.end(); ++it) { + ASSERT(!it->m_rect.isEmpty()); + frameRects.append(it->m_rect); + } } int WebFrameImpl::selectNearestFindMatch(const WebFloatPoint& point, WebRect* selectionRect) { - // FIXME: Implement this as part of https://bugs.webkit.org/show_bug.cgi?id=93111. - return 0; + ASSERT(!parent()); + + WebFrameImpl* bestFrame = 0; + int indexInBestFrame = -1; + float distanceInBestFrame = FLT_MAX; + + for (WebFrameImpl* frame = this; frame; frame = static_cast<WebFrameImpl*>(frame->traverseNext(false))) { + float distanceInFrame; + int indexInFrame = frame->nearestFindMatch(point, distanceInFrame); + if (distanceInFrame < distanceInBestFrame) { + bestFrame = frame; + indexInBestFrame = indexInFrame; + distanceInBestFrame = distanceInFrame; + } + } + + if (indexInBestFrame != -1) + return bestFrame->selectFindMatch(static_cast<unsigned>(indexInBestFrame), selectionRect); + + return -1; +} + +int WebFrameImpl::nearestFindMatch(const FloatPoint& point, float& distanceSquared) +{ + updateFindMatchRects(); + + int nearest = -1; + distanceSquared = FLT_MAX; + for (size_t i = 0; i < m_findMatchesCache.size(); ++i) { + ASSERT(!m_findMatchesCache[i].m_rect.isEmpty()); + FloatSize offset = point - m_findMatchesCache[i].m_rect.center(); + float width = offset.width(); + float height = offset.height(); + float currentDistanceSquared = width * width + height * height; + if (currentDistanceSquared < distanceSquared) { + nearest = i; + distanceSquared = currentDistanceSquared; + } + } + return nearest; +} + +int WebFrameImpl::selectFindMatch(unsigned index, WebRect* selectionRect) +{ + ASSERT(index < m_findMatchesCache.size()); + + RefPtr<Range> range = m_findMatchesCache[index].m_range; + if (!range->boundaryPointsValid() || !range->startContainer()->inDocument()) + return -1; + + // Check if the match is already selected. + WebFrameImpl* activeMatchFrame = viewImpl()->mainFrameImpl()->m_currentActiveMatchFrame; + if (this != activeMatchFrame || !m_activeMatch || !areRangesEqual(m_activeMatch.get(), range.get())) { + if (isActiveMatchFrameValid()) + activeMatchFrame->setMarkerActive(activeMatchFrame->m_activeMatch.get(), false); + + m_activeMatchIndexInCurrentFrame = m_findMatchesCache[index].m_ordinal - 1; + + // Set this frame as the active frame (the one with the active highlight). + viewImpl()->mainFrameImpl()->m_currentActiveMatchFrame = this; + viewImpl()->setFocusedFrame(this); + + m_activeMatch = range.release(); + setMarkerActive(m_activeMatch.get(), true); + + // Clear any user selection, to make sure Find Next continues on from the match we just activated. + frame()->selection()->clear(); + + // Make sure no node is focused. See http://crbug.com/38700. + frame()->document()->setFocusedNode(0); + } + + IntRect activeMatchRect; + IntRect activeMatchBoundingBox = enclosingIntRect(RenderObject::absoluteBoundingBoxRectForRange(m_activeMatch.get())); + + if (!activeMatchBoundingBox.isEmpty()) { + if (m_activeMatch->firstNode() && m_activeMatch->firstNode()->renderer()) + m_activeMatch->firstNode()->renderer()->scrollRectToVisible(activeMatchBoundingBox, + ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded); + + // Zoom to the active match. + activeMatchRect = frameView()->contentsToWindow(activeMatchBoundingBox); + viewImpl()->zoomToFindInPageRect(activeMatchRect); + } + + if (selectionRect) + *selectionRect = activeMatchRect; + + return ordinalOfFirstMatchForFrame(this) + m_activeMatchIndexInCurrentFrame + 1; } void WebFrameImpl::deliverIntent(const WebIntent& intent, WebMessagePortChannelArray* ports, WebDeliveredIntentClient* intentClient) @@ -1998,11 +2186,11 @@ void WebFrameImpl::deliverIntent(const WebIntent& intent, WebMessagePortChannelA (*channels)[i] = MessagePortChannel::create(platformChannel); } } - OwnPtr<MessagePortArray> portArray = WebCore::MessagePort::entanglePorts(*(m_frame->domWindow()->scriptExecutionContext()), channels.release()); + OwnPtr<MessagePortArray> portArray = WebCore::MessagePort::entanglePorts(*(m_frame->document()), channels.release()); RefPtr<DeliveredIntent> deliveredIntent = DeliveredIntent::create(m_frame, client.release(), intent.action(), intent.type(), intentData, portArray.release(), webcoreIntent->extras()); - DOMWindowIntents::from(m_frame->domWindow())->deliver(deliveredIntent.release()); + DOMWindowIntents::from(m_frame->document()->domWindow())->deliver(deliveredIntent.release()); #endif } @@ -2097,6 +2285,8 @@ WebFrameImpl::WebFrameImpl(WebFrameClient* client) , m_framesScopingCount(-1) , m_scopingComplete(false) , m_nextInvalidateAfter(0) + , m_findMatchMarkersVersion(0) + , m_findMatchRectsAreValid(false) , m_animationController(this) , m_identifier(generateFrameIdentifier()) , m_inSameDocumentHistoryLoad(false) @@ -2175,6 +2365,15 @@ PassRefPtr<Frame> WebFrameImpl::createChildFrame( return childFrame.release(); } +void WebFrameImpl::didChangeContentsSize(const IntSize& size) +{ + // This is only possible on the main frame. + if (m_totalMatchCount > 0) { + ASSERT(!parent()); + ++m_findMatchMarkersVersion; + } +} + void WebFrameImpl::createFrameView() { ASSERT(m_frame); // If m_frame doesn't exist, we probably didn't init properly. diff --git a/Source/WebKit/chromium/src/WebFrameImpl.h b/Source/WebKit/chromium/src/WebFrameImpl.h index 0aba56f4c..e83b3b0f7 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.h +++ b/Source/WebKit/chromium/src/WebFrameImpl.h @@ -45,6 +45,7 @@ namespace WebCore { class GraphicsContext; class HTMLInputElement; class HistoryItem; +class IntSize; class KURL; class Node; class Range; @@ -248,6 +249,8 @@ public: PassRefPtr<WebCore::Frame> createChildFrame( const WebCore::FrameLoadRequest&, WebCore::HTMLFrameOwnerElement*); + void didChangeContentsSize(const WebCore::IntSize&); + void createFrameView(); static WebFrameImpl* fromFrame(WebCore::Frame* frame); @@ -270,7 +273,11 @@ public: // Returns which frame has an active match. This function should only be // called on the main frame, as it is the only frame keeping track. Returned // value can be 0 if no frame has an active match. - const WebFrameImpl* activeMatchFrame() const { return m_currentActiveMatchFrame; } + WebFrameImpl* activeMatchFrame() const { return m_currentActiveMatchFrame; } + + // Returns the active match in the current frame. Could be a null range if + // the local frame has no active match. + WebCore::Range* activeMatch() const { return m_activeMatch.get(); } // When a Find operation ends, we want to set the selection to what was active // and set focus to the first focusable node we find (starting with the first @@ -297,6 +304,19 @@ private: friend class DeferredScopeStringMatches; friend class FrameLoaderClientImpl; + struct FindMatch { + RefPtr<WebCore::Range> m_range; + + // 1-based index within this frame. + int m_ordinal; + + // In find-in-page coordinates. + // Lazily calculated by updateFindMatchRects. + WebCore::FloatRect m_rect; + + FindMatch(PassRefPtr<WebCore::Range>, int ordinal); + }; + // A bit mask specifying area of the frame to invalidate. enum AreaToInvalidate { InvalidateNothing, @@ -315,6 +335,32 @@ private: void reportFindInPageSelection( const WebRect& selectionRect, int activeMatchOrdinal, int identifier); + // Clear the find-in-page matches cache forcing rects to be fully + // calculated again next time updateFindMatchRects is called. + void clearFindMatchesCache(); + + // Check if the activeMatchFrame still exists in the frame tree. + bool isActiveMatchFrameValid() const; + + // Return the index in the find-in-page cache of the match closest to the + // provided point in find-in-page coordinates, or -1 in case of error. + // The squared distance to the closest match is returned in the distanceSquared parameter. + int nearestFindMatch(const WebCore::FloatPoint&, float& distanceSquared); + + // Select a find-in-page match marker in the current frame using a cache + // match index returned by nearestFindMatch. Returns the ordinal of the new + // selected match or -1 in case of error. Also provides the bounding box of + // the marker in window coordinates if selectionRect is not null. + int selectFindMatch(unsigned index, WebRect* selectionRect); + + // Compute and cache the rects for FindMatches if required. + // Rects are automatically invalidated in case of content size changes, + // propagating the invalidation to child frames. + void updateFindMatchRects(); + + // Append the find-in-page match rects of the current frame to the provided vector. + void appendFindMatchRects(Vector<WebFloatRect>& frameRects); + // Invalidates a certain area within the frame. void invalidateArea(AreaToInvalidate); @@ -414,6 +460,21 @@ private: // A list of all of the pending calls to scopeStringMatches. Vector<DeferredScopeStringMatches*> m_deferredScopingWork; + // Version number incremented on the main frame only whenever the document + // find-in-page match markers change. It should be 0 for all other frames. + int m_findMatchMarkersVersion; + + // Local cache of the find match markers currently displayed for this frame. + Vector<FindMatch> m_findMatchesCache; + + // Determines if the rects in the find-in-page matches cache of this frame + // are invalid and should be recomputed. + bool m_findMatchRectsAreValid; + + // Contents size when find-in-page match rects were last computed for this + // frame's cache. + WebCore::IntSize m_contentsSizeForCurrentFindMatchRects; + // Valid between calls to BeginPrint() and EndPrint(). Containts the print // information. Is used by PrintPage(). OwnPtr<ChromePrintContext> m_printContext; diff --git a/Source/WebKit/chromium/src/WebHistoryItem.cpp b/Source/WebKit/chromium/src/WebHistoryItem.cpp index db35317ad..31d2bd564 100644 --- a/Source/WebKit/chromium/src/WebHistoryItem.cpp +++ b/Source/WebKit/chromium/src/WebHistoryItem.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "WebHistoryItem.h" +#include "FormController.h" #include "FormData.h" #include "HistoryItem.h" #include "KURL.h" @@ -287,6 +288,23 @@ void WebHistoryItem::appendToChildren(const WebHistoryItem& item) m_private->addChildItem(item); } +WebVector<WebString> WebHistoryItem::getReferencedFilePaths() const +{ + Vector<WebString> filePaths; + const FormData* formData = m_private->formData(); + if (formData) { + for (size_t i = 0; i < formData->elements().size(); ++i) { + const FormDataElement& element = formData->elements()[i]; + if (element.m_type == FormDataElement::encodedFile) + filePaths.append(element.m_filename); + } + } + const Vector<String>& selectedFilePaths = WebCore::FormController::getReferencedFilePaths(m_private->documentState()); + for (size_t i = 0; i < selectedFilePaths.size(); ++i) + filePaths.append(selectedFilePaths[i]); + return filePaths; +} + WebHistoryItem::WebHistoryItem(const PassRefPtr<HistoryItem>& item) : m_private(item) { diff --git a/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp b/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp index 5b5aedf7c..2cb90ea46 100644 --- a/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp @@ -48,6 +48,7 @@ namespace WebKit { WebIDBCallbacksImpl::WebIDBCallbacksImpl(PassRefPtr<IDBCallbacks> callbacks) : m_callbacks(callbacks) + , m_didCreateDatabaseProxy(false) { } @@ -65,13 +66,17 @@ void WebIDBCallbacksImpl::onSuccess(const WebDOMStringList& domStringList) m_callbacks->onSuccess(domStringList); } -void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor) +void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key, const WebIDBKey& primaryKey, const WebSerializedScriptValue& value) { - m_callbacks->onSuccess(IDBCursorBackendProxy::create(adoptPtr(cursor))); + m_callbacks->onSuccess(IDBCursorBackendProxy::create(adoptPtr(cursor)), key, primaryKey, value); } void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* webKitInstance) { + if (m_didCreateDatabaseProxy) { + m_callbacks->onSuccess(IDBDatabaseBackendProxy::create(adoptPtr(static_cast<WebIDBDatabase*>(0)))); + return; + } m_callbacks->onSuccess(IDBDatabaseBackendProxy::create(adoptPtr(webKitInstance))); } @@ -95,9 +100,9 @@ void WebIDBCallbacksImpl::onSuccess(const WebSerializedScriptValue& serializedSc m_callbacks->onSuccess(serializedScriptValue, key, keyPath); } -void WebIDBCallbacksImpl::onSuccessWithContinuation() +void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key, const WebIDBKey& primaryKey, const WebSerializedScriptValue& value) { - m_callbacks->onSuccessWithContinuation(); + m_callbacks->onSuccess(key, primaryKey, value); } void WebIDBCallbacksImpl::onBlocked() @@ -105,6 +110,17 @@ void WebIDBCallbacksImpl::onBlocked() m_callbacks->onBlocked(); } +void WebIDBCallbacksImpl::onBlocked(long long oldVersion) +{ + m_callbacks->onBlocked(oldVersion); +} + +void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBTransaction* transaction, WebIDBDatabase* database) +{ + m_didCreateDatabaseProxy = true; + m_callbacks->onUpgradeNeeded(oldVersion, IDBTransactionBackendProxy::create(adoptPtr(transaction)), IDBDatabaseBackendProxy::create(adoptPtr(database))); +} + } // namespace WebKit #endif // ENABLE(INDEXED_DATABASE) diff --git a/Source/WebKit/chromium/src/WebIDBCallbacksImpl.h b/Source/WebKit/chromium/src/WebIDBCallbacksImpl.h index 7b0216359..33cd2029f 100644 --- a/Source/WebKit/chromium/src/WebIDBCallbacksImpl.h +++ b/Source/WebKit/chromium/src/WebIDBCallbacksImpl.h @@ -43,17 +43,20 @@ public: virtual void onError(const WebIDBDatabaseError&); virtual void onSuccess(const WebDOMStringList&); - virtual void onSuccess(WebIDBCursor*); + virtual void onSuccess(WebIDBCursor*, const WebIDBKey&, const WebIDBKey& primaryKey, const WebSerializedScriptValue&); virtual void onSuccess(WebIDBDatabase*); virtual void onSuccess(const WebIDBKey&); virtual void onSuccess(WebIDBTransaction*); virtual void onSuccess(const WebSerializedScriptValue&); virtual void onSuccess(const WebSerializedScriptValue&, const WebIDBKey&, const WebIDBKeyPath&); - virtual void onSuccessWithContinuation(); + virtual void onSuccess(const WebIDBKey&, const WebIDBKey& primaryKey, const WebSerializedScriptValue&); virtual void onBlocked(); + virtual void onBlocked(long long oldVersion); + virtual void onUpgradeNeeded(long long oldVersion, WebIDBTransaction*, WebIDBDatabase*); private: RefPtr<WebCore::IDBCallbacks> m_callbacks; + bool m_didCreateDatabaseProxy; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp b/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp index 0d65a87be..252cfdd11 100644 --- a/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp @@ -47,21 +47,6 @@ WebIDBCursorImpl::~WebIDBCursorImpl() { } -WebIDBKey WebIDBCursorImpl::key() const -{ - return m_idbCursorBackend->key(); -} - -WebIDBKey WebIDBCursorImpl::primaryKey() const -{ - return m_idbCursorBackend->primaryKey(); -} - -WebSerializedScriptValue WebIDBCursorImpl::value() const -{ - return m_idbCursorBackend->value(); -} - void WebIDBCursorImpl::advance(unsigned long count, WebIDBCallbacks* callbacks, WebExceptionCode& ec) { m_idbCursorBackend->advance(count, IDBCallbacksProxy::create(adoptPtr(callbacks)), ec); diff --git a/Source/WebKit/chromium/src/WebIDBCursorImpl.h b/Source/WebKit/chromium/src/WebIDBCursorImpl.h index 45a229b38..eccc65dd0 100644 --- a/Source/WebKit/chromium/src/WebIDBCursorImpl.h +++ b/Source/WebKit/chromium/src/WebIDBCursorImpl.h @@ -44,9 +44,6 @@ public: WebIDBCursorImpl(WTF::PassRefPtr<WebCore::IDBCursorBackendInterface>); virtual ~WebIDBCursorImpl(); - virtual WebIDBKey key() const; - virtual WebIDBKey primaryKey() const; - virtual WebSerializedScriptValue value() const; virtual void advance(unsigned long, WebIDBCallbacks*, WebExceptionCode&); virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*, WebExceptionCode&); virtual void deleteFunction(WebIDBCallbacks*, WebExceptionCode&); diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.cpp b/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.cpp index ff0e89864..14757bac6 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.cpp @@ -44,6 +44,11 @@ WebIDBDatabaseCallbacksImpl::~WebIDBDatabaseCallbacksImpl() { } +void WebIDBDatabaseCallbacksImpl::onVersionChange(long long oldVersion, long long newVersion) +{ + m_callbacks->onVersionChange(oldVersion, newVersion); +} + void WebIDBDatabaseCallbacksImpl::onVersionChange(const WebString& version) { m_callbacks->onVersionChange(version); diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.h b/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.h index 21c3dc7c5..1857ca658 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.h +++ b/Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.h @@ -43,6 +43,7 @@ public: WebIDBDatabaseCallbacksImpl(PassRefPtr<WebCore::IDBDatabaseCallbacks>); virtual ~WebIDBDatabaseCallbacksImpl(); + virtual void onVersionChange(long long oldVersion, long long newVersion); virtual void onVersionChange(const WebString& version); private: diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp index bc6d09fa1..9343281cf 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp @@ -47,6 +47,7 @@ namespace WebKit { WebIDBDatabaseImpl::WebIDBDatabaseImpl(PassRefPtr<IDBDatabaseBackendInterface> databaseBackend) : m_databaseBackend(databaseBackend) + , m_closePending(false) { } @@ -94,8 +95,10 @@ void WebIDBDatabaseImpl::close() { // Use the callbacks that ::open gave us so that the backend in // multi-process chromium knows which database connection is closing. - if (!m_databaseCallbacks) + if (!m_databaseCallbacks) { + m_closePending = true; return; + } m_databaseBackend->close(m_databaseCallbacks); m_databaseCallbacks = 0; } @@ -105,6 +108,8 @@ void WebIDBDatabaseImpl::open(WebIDBDatabaseCallbacks* callbacks) ASSERT(!m_databaseCallbacks); m_databaseCallbacks = IDBDatabaseCallbacksProxy::create(adoptPtr(callbacks)); m_databaseBackend->registerFrontendCallbacks(m_databaseCallbacks); + if (m_closePending) + close(); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h index 4f8251820..1409cb65f 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h +++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h @@ -64,6 +64,9 @@ public: private: WTF::RefPtr<WebCore::IDBDatabaseBackendInterface> m_databaseBackend; WTF::RefPtr<IDBDatabaseCallbacksProxy> m_databaseCallbacks; + // FIXME: Remove this flag when we consolidate two-phase open. + // http://wkb.ug/90411 + bool m_closePending; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebIDBFactoryImpl.cpp b/Source/WebKit/chromium/src/WebIDBFactoryImpl.cpp index d14ac71e1..ad71476b7 100755 --- a/Source/WebKit/chromium/src/WebIDBFactoryImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBFactoryImpl.cpp @@ -63,17 +63,9 @@ void WebIDBFactoryImpl::getDatabaseNames(WebIDBCallbacks* callbacks, const WebSe m_idbFactoryBackend->getDatabaseNames(IDBCallbacksProxy::create(adoptPtr(callbacks)), origin, 0, dataDir); } - -void WebIDBFactoryImpl::open(const WebString& name, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*, const WebString& dataDir) -{ - m_idbFactoryBackend->open(name, IDBCallbacksProxy::create(adoptPtr(callbacks)).get(), origin, 0, dataDir); -} - void WebIDBFactoryImpl::open(const WebString& name, long long version, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*, const WebString& dataDir) { - // FIXME: Pass version along when WebCore::IDBFactoryBackendInterface - // has an open method that accepts it. - m_idbFactoryBackend->open(name, IDBCallbacksProxy::create(adoptPtr(callbacks)).get(), origin, 0, dataDir); + m_idbFactoryBackend->open(name, version, IDBCallbacksProxy::create(adoptPtr(callbacks)).get(), origin, 0, dataDir); } void WebIDBFactoryImpl::deleteDatabase(const WebString& name, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*, const WebString& dataDir) diff --git a/Source/WebKit/chromium/src/WebIDBFactoryImpl.h b/Source/WebKit/chromium/src/WebIDBFactoryImpl.h index fa438d764..833eeb591 100644 --- a/Source/WebKit/chromium/src/WebIDBFactoryImpl.h +++ b/Source/WebKit/chromium/src/WebIDBFactoryImpl.h @@ -45,7 +45,6 @@ public: virtual ~WebIDBFactoryImpl(); virtual void getDatabaseNames(WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir); - virtual void open(const WebString& name, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir); virtual void open(const WebString& name, long long version, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir); virtual void deleteDatabase(const WebString& name, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir); diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp index c327eba84..f5dd913c9 100755 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp @@ -75,6 +75,30 @@ void WebIDBObjectStoreImpl::putWithIndexKeys(const WebSerializedScriptValue& val m_objectStore->putWithIndexKeys(value, key, static_cast<IDBObjectStoreBackendInterface::PutMode>(putMode), IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), indexNames, indexKeys, ec); } +void WebIDBObjectStoreImpl::setIndexKeys(const WebIDBKey& primaryKey, const WebVector<WebString>& webIndexNames, const WebVector<WebIndexKeys>& webIndexKeys, const WebIDBTransaction& transaction) +{ + ASSERT(webIndexNames.size() == webIndexKeys.size()); + Vector<String> indexNames(webIndexNames.size()); + Vector<IDBObjectStoreBackendInterface::IndexKeys> indexKeys(webIndexKeys.size()); + + for (size_t i = 0; i < webIndexNames.size(); ++i) { + indexNames[i] = webIndexNames[i]; + Vector<RefPtr<IDBKey> > indexKeyList(webIndexKeys[i].size()); + for (size_t j = 0; j < webIndexKeys[i].size(); ++j) + indexKeyList[j] = webIndexKeys[i][j]; + indexKeys[i] = indexKeyList; + } + m_objectStore->setIndexKeys(primaryKey, indexNames, indexKeys, transaction.getIDBTransactionBackendInterface()); +} + +void WebIDBObjectStoreImpl::setIndexesReady(const WebVector<WebString>& webIndexNames, const WebIDBTransaction& transaction) +{ + Vector<String> indexNames(webIndexNames.size()); + for (size_t i = 0; i < webIndexNames.size(); ++i) + indexNames[i] = webIndexNames[i]; + m_objectStore->setIndexesReady(indexNames, transaction.getIDBTransactionBackendInterface()); +} + void WebIDBObjectStoreImpl::deleteFunction(const WebIDBKeyRange& keyRange, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec) { m_objectStore->deleteFunction(keyRange, IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec); @@ -106,10 +130,9 @@ void WebIDBObjectStoreImpl::deleteIndex(const WebString& name, const WebIDBTrans m_objectStore->deleteIndex(name, transaction.getIDBTransactionBackendInterface(), ec); } -void WebIDBObjectStoreImpl::openCursor(const WebIDBKeyRange& keyRange, WebIDBCursor::Direction direction, WebIDBCallbacks* callbacks, WebIDBTransaction::TaskType, const WebIDBTransaction& transaction, WebExceptionCode& ec) +void WebIDBObjectStoreImpl::openCursor(const WebIDBKeyRange& keyRange, WebIDBCursor::Direction direction, WebIDBCallbacks* callbacks, WebIDBTransaction::TaskType taskType, const WebIDBTransaction& transaction, WebExceptionCode& ec) { - // FIXME: Pass along TaskType when the API becomes available. - m_objectStore->openCursor(keyRange, direction, IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec); + m_objectStore->openCursor(keyRange, static_cast<IDBCursor::Direction>(direction), IDBCallbacksProxy::create(adoptPtr(callbacks)), static_cast<IDBTransactionBackendInterface::TaskType>(taskType), transaction.getIDBTransactionBackendInterface(), ec); } void WebIDBObjectStoreImpl::count(const WebIDBKeyRange& keyRange, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec) diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h index 482b22380..95879b5d0 100644 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h @@ -46,7 +46,9 @@ public: ~WebIDBObjectStoreImpl(); void get(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); - void putWithIndexKeys(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, const WebVector<WebString>& indexNames, const WebVector<WebIndexKeys>&, WebExceptionCode&); + void putWithIndexKeys(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, const WebVector<WebString>&, const WebVector<WebIndexKeys>&, WebExceptionCode&); + void setIndexKeys(const WebIDBKey&, const WebVector<WebString>& indexNames, const WebVector<WebIndexKeys>&, const WebIDBTransaction&); + void setIndexesReady(const WebVector<WebString>&, const WebIDBTransaction&); void deleteFunction(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); void clear(WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); 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/WebInputEvent.cpp b/Source/WebKit/chromium/src/WebInputEvent.cpp index 66a0480b4..d61eb2d31 100644 --- a/Source/WebKit/chromium/src/WebInputEvent.cpp +++ b/Source/WebKit/chromium/src/WebInputEvent.cpp @@ -60,7 +60,7 @@ struct SameSizeAsWebMouseWheelEvent : public SameSizeAsWebMouseEvent { }; struct SameSizeAsWebGestureEvent : public SameSizeAsWebInputEvent { - int gestureData[10]; + int gestureData[14]; }; struct SameSizeAsWebTouchEvent : public SameSizeAsWebInputEvent { diff --git a/Source/WebKit/chromium/src/WebLayer.cpp b/Source/WebKit/chromium/src/WebLayer.cpp deleted file mode 100644 index d77c25eb9..000000000 --- a/Source/WebKit/chromium/src/WebLayer.cpp +++ /dev/null @@ -1,403 +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 "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(); -} - -WebLayer WebLayer::rootLayer() const -{ - return WebLayer(const_cast<LayerChromium*>(m_private->rootLayer())); -} - -WebLayer WebLayer::parent() const -{ - return WebLayer(const_cast<LayerChromium*>(m_private->parent())); -} - -size_t WebLayer::numberOfChildren() const -{ - return m_private->children().size(); -} - -WebLayer WebLayer::childAt(size_t index) const -{ - return WebLayer(m_private->children()[index]); -} - -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>()); -} - -WebLayer WebLayer::maskLayer() const -{ - return WebLayer(m_private->maskLayer()); -} - -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(const WebAnimation& animation) -{ - return m_private->addAnimation(animation); -} - -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); -} - -void WebLayer::transferAnimationsTo(WebLayer* other) -{ - ASSERT(other); - if (other) - other->m_private->setLayerAnimationController(m_private->releaseLayerAnimationController()); -} - -void WebLayer::setAlwaysReserveTextures(bool reserve) -{ - m_private->setAlwaysReserveTextures(reserve); -} - -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 edd43df20..7dfbcd129 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeView.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeView.cpp @@ -26,12 +26,13 @@ #include "config.h" #include <public/WebLayerTreeView.h> +#include "CCFontAtlas.h" +#include "CCGraphicsContext.h" +#include "CCLayerTreeHost.h" +#include "CCRenderingStats.h" #include "LayerChromium.h" +#include "WebLayerImpl.h" #include "WebLayerTreeViewImpl.h" -#include "cc/CCFontAtlas.h" -#include "cc/CCGraphicsContext.h" -#include "cc/CCLayerTreeHost.h" -#include "cc/CCRenderingStats.h" #include <public/WebLayer.h> #include <public/WebPoint.h> #include <public/WebRect.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 a7bf64d36..1fd823976 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp @@ -26,9 +26,10 @@ #include "config.h" #include "WebLayerTreeViewImpl.h" +#include "CCLayerTreeHost.h" +#include "CCThreadProxy.h" #include "LayerChromium.h" -#include "cc/CCLayerTreeHost.h" -#include "cc/CCThreadProxy.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 c48aa8967..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 @@ -435,6 +435,13 @@ void WebMediaPlayerClientImpl::sourceEndOfStream(WebCore::MediaPlayer::EndOfStre if (m_webMediaPlayer) m_webMediaPlayer->sourceEndOfStream(static_cast<WebMediaPlayer::EndOfStreamStatus>(status)); } + +bool WebMediaPlayerClientImpl::sourceSetTimestampOffset(const String& id, double offset) +{ + if (!m_webMediaPlayer) + return false; + return m_webMediaPlayer->sourceSetTimestampOffset(id, offset); +} #endif #if ENABLE(ENCRYPTED_MEDIA) @@ -738,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 2df54cd20..329fd9ec0 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h @@ -164,6 +164,7 @@ public: virtual bool sourceAppend(const String&, const unsigned char* data, unsigned length); virtual bool sourceAbort(const String&); virtual void sourceEndOfStream(WebCore::MediaPlayer::EndOfStreamStatus); + virtual bool sourceSetTimestampOffset(const String&, double offset); #endif #if ENABLE(ENCRYPTED_MEDIA) @@ -204,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 18f5de20a..fe945c063 100644 --- a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp +++ b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp @@ -191,15 +191,14 @@ bool WebPagePopupImpl::initPage() frame->view()->resize(m_popupClient->contentSize()); frame->view()->setTransparent(false); + DOMWindowPagePopup::install(frame->document()->domWindow(), m_popupClient); + DocumentWriter* writer = frame->loader()->activeDocumentLoader()->writer(); writer->setMIMEType("text/html"); writer->setEncoding("UTF-8", false); writer->begin(); m_popupClient->writeDocument(*writer); writer->end(); - - ASSERT(frame->existingDOMWindow()); - DOMWindowPagePopup::install(frame->existingDOMWindow(), m_popupClient); return true; } diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp index 71361780b..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 } @@ -512,10 +512,9 @@ void WebPluginContainerImpl::setIsAcceptingTouchEvents(bool acceptingTouchEvents if (m_isAcceptingTouchEvents == acceptingTouchEvents) return; m_isAcceptingTouchEvents = acceptingTouchEvents; - if (m_isAcceptingTouchEvents) { + if (m_isAcceptingTouchEvents) m_element->document()->didAddTouchEventHandler(); - m_element->document()->addListenerType(Document::TOUCH_LISTENER); - } else + else m_element->document()->didRemoveTouchEventHandler(); } @@ -576,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/WebScriptController.cpp b/Source/WebKit/chromium/src/WebScriptController.cpp index 804e27821..fbf73f689 100644 --- a/Source/WebKit/chromium/src/WebScriptController.cpp +++ b/Source/WebKit/chromium/src/WebScriptController.cpp @@ -31,9 +31,9 @@ #include "config.h" #include "WebScriptController.h" +#include "ScriptController.h" #include "V8Binding.h" #include "V8DOMMap.h" -#include "V8Proxy.h" #include "platform/WebString.h" @@ -43,7 +43,7 @@ namespace WebKit { void WebScriptController::registerExtension(v8::Extension* extension) { - V8Proxy::registerExtensionIfNeeded(extension); + ScriptController::registerExtensionIfNeeded(extension); } void WebScriptController::enableV8SingleThreadMode() 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/WebTransformAnimationCurve.cpp b/Source/WebKit/chromium/src/WebTransformAnimationCurve.cpp index ca95fa39e..dad084987 100644 --- a/Source/WebKit/chromium/src/WebTransformAnimationCurve.cpp +++ b/Source/WebKit/chromium/src/WebTransformAnimationCurve.cpp @@ -26,9 +26,9 @@ #include <public/WebTransformAnimationCurve.h> +#include "CCKeyframedAnimationCurve.h" +#include "CCTimingFunction.h" #include "WebAnimationCurveCommon.h" -#include "cc/CCKeyframedAnimationCurve.h" -#include "cc/CCTimingFunction.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> 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 0bd3ea116..97339b342 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -129,6 +129,7 @@ #include "WebDevToolsAgentPrivate.h" #include "WebFrameImpl.h" #include "WebHelperPluginImpl.h" +#include "WebHitTestResult.h" #include "WebInputElement.h" #include "WebInputEvent.h" #include "WebInputEventConversion.h" @@ -266,9 +267,6 @@ static int webInputEventKeyStateToPlatformEventKeyState(int webInputEventKeyStat WebView* WebView::create(WebViewClient* client) { - // Keep runtime flag for device motion turned off until it's implemented. - WebRuntimeFeatures::enableDeviceMotion(false); - // Pass the WebViewImpl's self-reference to the caller. return adoptRef(new WebViewImpl(client)).leakRef(); } @@ -410,6 +408,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) @@ -3514,6 +3513,7 @@ bool WebViewImpl::allowsAcceleratedCompositing() void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) { m_rootGraphicsLayer = layer; + m_rootLayer = layer ? layer->platformLayer() : 0; setIsAcceleratedCompositingActive(layer); if (m_nonCompositedContentHost) { @@ -3527,11 +3527,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) @@ -3644,7 +3641,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()); @@ -3855,7 +3852,7 @@ void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex) m_autofillPopupClient->valueChanged(listIndex); } -bool WebViewImpl::detectContentIntentOnTouch(const WebPoint& position, WebInputEvent::Type touchType) +bool WebViewImpl::detectContentOnTouch(const WebPoint& position, WebInputEvent::Type touchType) { ASSERT(touchType == WebInputEvent::GestureTap || touchType == WebInputEvent::GestureLongPress); HitTestResult touchHit = hitTestResultForWindowPos(position); @@ -3869,7 +3866,7 @@ bool WebViewImpl::detectContentIntentOnTouch(const WebPoint& position, WebInputE // FIXME: Should we not detect content intents in nodes that have event listeners? - WebContentDetectionResult content = m_client->detectContentIntentAround(touchHit); + WebContentDetectionResult content = m_client->detectContentAround(touchHit); if (!content.isValid()) return false; diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index 39783680f..431dad490 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -391,7 +391,7 @@ public: void mouseContextMenu(const WebMouseEvent&); void mouseDoubleClick(const WebMouseEvent&); - bool detectContentIntentOnTouch(const WebPoint&, WebInputEvent::Type); + bool detectContentOnTouch(const WebPoint&, WebInputEvent::Type); void startPageScaleAnimation(const WebCore::IntPoint& targetPosition, bool useAnchor, float newScale, double durationInSeconds); void numberOfWheelEventHandlersChanged(unsigned); @@ -814,7 +814,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; diff --git a/Source/WebKit/chromium/tests/AnimationTranslationUtilTest.cpp b/Source/WebKit/chromium/tests/AnimationTranslationUtilTest.cpp new file mode 100644 index 000000000..70da65ef6 --- /dev/null +++ b/Source/WebKit/chromium/tests/AnimationTranslationUtilTest.cpp @@ -0,0 +1,243 @@ +/* + * 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 INC. 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 INC. 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 "AnimationTranslationUtil.h" + +#include "Animation.h" +#include "GraphicsLayer.h" // For KeyframeValueList +#include "IntSize.h" +#include "Matrix3DTransformOperation.h" +#include "RotateTransformOperation.h" +#include "TransformOperations.h" +#include "TranslateTransformOperation.h" +#include <gtest/gtest.h> +#include <public/WebAnimation.h> +#include <wtf/RefPtr.h> + +using namespace WebCore; +using namespace WebKit; + +namespace { + +bool animationCanBeTranslated(const KeyframeValueList& values, Animation* animation) +{ + IntSize boxSize; + return createWebAnimation(values, animation, 0, 0, 0, boxSize); +} + +TEST(AnimationTranslationUtilTest, createOpacityAnimation) +{ + const double duration = 1; + WebCore::KeyframeValueList values(AnimatedPropertyOpacity); + values.insert(new FloatAnimationValue(0, 0)); + values.insert(new FloatAnimationValue(duration, 1)); + + RefPtr<Animation> animation = Animation::create(); + animation->setDuration(duration); + + EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); +} + +TEST(AnimationTranslationUtilTest, createTransformAnimation) +{ + const double duration = 1; + WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); + + TransformOperations operations1; + operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(0, &operations1)); + + TransformOperations operations2; + operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(duration, &operations2)); + + RefPtr<Animation> animation = Animation::create(); + animation->setDuration(duration); + + EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); +} + +TEST(AnimationTranslationUtilTest, createTransformAnimationWithBigRotation) +{ + const double duration = 1; + WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); + + TransformOperations operations1; + operations1.operations().append(RotateTransformOperation::create(0, TransformOperation::ROTATE)); + values.insert(new TransformAnimationValue(0, &operations1)); + + TransformOperations operations2; + operations2.operations().append(RotateTransformOperation::create(270, TransformOperation::ROTATE)); + values.insert(new TransformAnimationValue(duration, &operations2)); + + RefPtr<Animation> animation = Animation::create(); + animation->setDuration(duration); + + EXPECT_FALSE(animationCanBeTranslated(values, animation.get())); +} + +TEST(AnimationTranslationUtilTest, createTransformAnimationWithBigRotationAndEmptyTransformOperationList) +{ + const double duration = 1; + WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); + + TransformOperations operations1; + values.insert(new TransformAnimationValue(0, &operations1)); + + TransformOperations operations2; + operations2.operations().append(RotateTransformOperation::create(270, TransformOperation::ROTATE)); + values.insert(new TransformAnimationValue(duration, &operations2)); + + RefPtr<Animation> animation = Animation::create(); + animation->setDuration(duration); + + EXPECT_FALSE(animationCanBeTranslated(values, animation.get())); +} + +TEST(AnimationTranslationUtilTest, createTransformAnimationWithRotationInvolvingNegativeAngles) +{ + const double duration = 1; + WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); + + TransformOperations operations1; + operations1.operations().append(RotateTransformOperation::create(-330, TransformOperation::ROTATE)); + values.insert(new TransformAnimationValue(0, &operations1)); + + TransformOperations operations2; + operations2.operations().append(RotateTransformOperation::create(-320, TransformOperation::ROTATE)); + values.insert(new TransformAnimationValue(duration, &operations2)); + + RefPtr<Animation> animation = Animation::create(); + animation->setDuration(duration); + + EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); +} + +TEST(AnimationTranslationUtilTest, createTransformAnimationWithSmallRotationInvolvingLargeAngles) +{ + const double duration = 1; + WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); + + TransformOperations operations1; + operations1.operations().append(RotateTransformOperation::create(270, TransformOperation::ROTATE)); + values.insert(new TransformAnimationValue(0, &operations1)); + + TransformOperations operations2; + operations2.operations().append(RotateTransformOperation::create(360, TransformOperation::ROTATE)); + values.insert(new TransformAnimationValue(duration, &operations2)); + + RefPtr<Animation> animation = Animation::create(); + animation->setDuration(duration); + + EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); +} + +TEST(AnimationTranslationUtilTest, createTransformAnimationWithSingularMatrix) +{ + const double duration = 1; + WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); + + TransformationMatrix matrix1; + TransformOperations operations1; + operations1.operations().append(Matrix3DTransformOperation::create(matrix1)); + values.insert(new TransformAnimationValue(0, &operations1)); + + TransformationMatrix matrix2; + matrix2.setM11(0); + TransformOperations operations2; + operations2.operations().append(Matrix3DTransformOperation::create(matrix2)); + values.insert(new TransformAnimationValue(duration, &operations2)); + + RefPtr<Animation> animation = Animation::create(); + animation->setDuration(duration); + + EXPECT_FALSE(animationCanBeTranslated(values, animation.get())); +} + +TEST(AnimationTranslationUtilTest, createReversedAnimation) +{ + const double duration = 1; + WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); + + TransformOperations operations1; + operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(0, &operations1)); + + TransformOperations operations2; + operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(duration, &operations2)); + + RefPtr<Animation> animation = Animation::create(); + animation->setDuration(duration); + animation->setDirection(Animation::AnimationDirectionReverse); + + EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); +} + +TEST(AnimationTranslationUtilTest, createAlternatingAnimation) +{ + const double duration = 1; + WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); + + TransformOperations operations1; + operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(0, &operations1)); + + TransformOperations operations2; + operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(duration, &operations2)); + + RefPtr<Animation> animation = Animation::create(); + animation->setDuration(duration); + animation->setDirection(Animation::AnimationDirectionAlternate); + animation->setIterationCount(2); + + EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); +} + +TEST(AnimationTranslationUtilTest, createReversedAlternatingAnimation) +{ + const double duration = 1; + WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); + + TransformOperations operations1; + operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(0, &operations1)); + + TransformOperations operations2; + operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(duration, &operations2)); + + RefPtr<Animation> animation = Animation::create(); + animation->setDuration(duration); + animation->setDirection(Animation::AnimationDirectionAlternateReverse); + animation->setIterationCount(2); + + EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); +} + +} + diff --git a/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp b/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp index af9fde1d5..899dd3731 100644 --- a/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp +++ b/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp @@ -24,9 +24,9 @@ #include "config.h" -#include "cc/CCActiveAnimation.h" -#include "CCAnimationTestCommon.h" +#include "CCActiveAnimation.h" +#include "CCAnimationTestCommon.h" #include <gmock/gmock.h> #include <gtest/gtest.h> #include <wtf/Vector.h> diff --git a/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp b/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp index f210c1bb7..76d1c0a3e 100644 --- a/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp @@ -26,11 +26,10 @@ #include "CCAnimationTestCommon.h" +#include "CCKeyframedAnimationCurve.h" +#include "CCLayerAnimationController.h" +#include "CCLayerImpl.h" #include "LayerChromium.h" -#include "cc/CCKeyframedAnimationCurve.h" -#include "cc/CCLayerAnimationController.h" -#include "cc/CCLayerImpl.h" - #include <public/WebTransformOperations.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/tests/CCAnimationTestCommon.h b/Source/WebKit/chromium/tests/CCAnimationTestCommon.h index 4bbd60112..71b0add26 100644 --- a/Source/WebKit/chromium/tests/CCAnimationTestCommon.h +++ b/Source/WebKit/chromium/tests/CCAnimationTestCommon.h @@ -25,9 +25,10 @@ #ifndef CCAnimationTestCommon_h #define CCAnimationTestCommon_h +#include "CCActiveAnimation.h" +#include "CCAnimationCurve.h" +#include "CCLayerAnimationController.h" #include "IntSize.h" -#include "cc/CCAnimationCurve.h" -#include "cc/CCLayerAnimationController.h" #include <wtf/OwnPtr.h> diff --git a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp index 8f813b9ba..f9eecdb75 100644 --- a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp @@ -24,14 +24,14 @@ #include "config.h" -#include "cc/CCDamageTracker.h" +#include "CCDamageTracker.h" +#include "CCLayerImpl.h" +#include "CCLayerSorter.h" +#include "CCLayerTreeHostCommon.h" #include "CCLayerTreeTestCommon.h" -#include "cc/CCLayerImpl.h" -#include "cc/CCLayerSorter.h" -#include "cc/CCLayerTreeHostCommon.h" -#include "cc/CCMathUtil.h" -#include "cc/CCSingleThreadProxy.h" +#include "CCMathUtil.h" +#include "CCSingleThreadProxy.h" #include <gtest/gtest.h> #include <public/WebFilterOperation.h> #include <public/WebFilterOperations.h> diff --git a/Source/WebKit/chromium/tests/CCDelayBasedTimeSourceTest.cpp b/Source/WebKit/chromium/tests/CCDelayBasedTimeSourceTest.cpp index 08b5d8202..1197a3118 100644 --- a/Source/WebKit/chromium/tests/CCDelayBasedTimeSourceTest.cpp +++ b/Source/WebKit/chromium/tests/CCDelayBasedTimeSourceTest.cpp @@ -24,10 +24,10 @@ #include "config.h" -#include "cc/CCDelayBasedTimeSource.h" +#include "CCDelayBasedTimeSource.h" #include "CCSchedulerTestCommon.h" -#include "cc/CCThread.h" +#include "CCThread.h" #include <gtest/gtest.h> #include <wtf/RefPtr.h> @@ -44,12 +44,12 @@ TEST(CCDelayBasedTimeSourceTest, TaskPostedAndTickCalled) RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(1.0 / 60.0, &thread); timer->setClient(&client); - timer->setMonotonicallyIncreasingTime(0); + timer->setMonotonicTimeNow(0); timer->setActive(true); EXPECT_TRUE(timer->active()); EXPECT_TRUE(thread.hasPendingTask()); - timer->setMonotonicallyIncreasingTime(0.016); + timer->setMonotonicTimeNow(0.016); thread.runPendingTask(); EXPECT_TRUE(timer->active()); EXPECT_TRUE(client.tickCalled()); @@ -109,7 +109,7 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenExactlyOnRequestedTime) EXPECT_EQ(16, thread.pendingDelayMs()); - timer->setMonotonicallyIncreasingTime(interval); + timer->setMonotonicTimeNow(interval); thread.runPendingTask(); EXPECT_EQ(16, thread.pendingDelayMs()); @@ -130,7 +130,7 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenSlightlyAfterRequestedTime) EXPECT_EQ(16, thread.pendingDelayMs()); - timer->setMonotonicallyIncreasingTime(interval + 0.0000001); + timer->setMonotonicTimeNow(interval + 0.0000001); thread.runPendingTask(); EXPECT_EQ(16, thread.pendingDelayMs()); @@ -151,7 +151,7 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenExactlyTwiceAfterRequestedTime) EXPECT_EQ(16, thread.pendingDelayMs()); - timer->setMonotonicallyIncreasingTime(2*interval); + timer->setMonotonicTimeNow(2*interval); thread.runPendingTask(); EXPECT_EQ(16, thread.pendingDelayMs()); @@ -172,7 +172,7 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenSlightlyAfterTwiceRequestedTime) EXPECT_EQ(16, thread.pendingDelayMs()); - timer->setMonotonicallyIncreasingTime(2*interval + 0.0000001); + timer->setMonotonicTimeNow(2*interval + 0.0000001); thread.runPendingTask(); EXPECT_EQ(16, thread.pendingDelayMs()); @@ -193,7 +193,7 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenHalfAfterRequestedTime) EXPECT_EQ(16, thread.pendingDelayMs()); - timer->setMonotonicallyIncreasingTime(interval + interval * 0.5); + timer->setMonotonicTimeNow(interval + interval * 0.5); thread.runPendingTask(); EXPECT_EQ(8, thread.pendingDelayMs()); @@ -216,7 +216,7 @@ TEST(CCDelayBasedTimeSource, SaneHandlingOfJitteryTimebase) // Jitter timebase ~1ms late timer->setTimebaseAndInterval(interval + 0.001, interval); - timer->setMonotonicallyIncreasingTime(interval); + timer->setMonotonicTimeNow(interval); thread.runPendingTask(); // Without double tick prevention, pendingDelayMs would be 1. @@ -224,7 +224,7 @@ TEST(CCDelayBasedTimeSource, SaneHandlingOfJitteryTimebase) // Jitter timebase ~1ms early timer->setTimebaseAndInterval(interval * 2 - 0.001, interval); - timer->setMonotonicallyIncreasingTime(interval * 2); + timer->setMonotonicTimeNow(interval * 2); thread.runPendingTask(); EXPECT_EQ(15, thread.pendingDelayMs()); @@ -244,7 +244,7 @@ TEST(CCDelayBasedTimeSource, HanldlesSignificantTimebaseChangesImmediately) EXPECT_EQ(16, thread.pendingDelayMs()); // Tick, then shift timebase by +7ms. - timer->setMonotonicallyIncreasingTime(interval); + timer->setMonotonicTimeNow(interval); thread.runPendingTask(); EXPECT_EQ(16, thread.pendingDelayMs()); @@ -258,7 +258,7 @@ TEST(CCDelayBasedTimeSource, HanldlesSignificantTimebaseChangesImmediately) EXPECT_EQ(7, thread.pendingDelayMs()); // Tick, then shift timebase by -7ms. - timer->setMonotonicallyIncreasingTime(interval + 0.0070001); + timer->setMonotonicTimeNow(interval + 0.0070001); thread.runPendingTask(); EXPECT_EQ(16, thread.pendingDelayMs()); @@ -286,7 +286,7 @@ TEST(CCDelayBasedTimeSource, HanldlesSignificantIntervalChangesImmediately) EXPECT_EQ(16, thread.pendingDelayMs()); // Tick, then double the interval. - timer->setMonotonicallyIncreasingTime(interval); + timer->setMonotonicTimeNow(interval); thread.runPendingTask(); EXPECT_EQ(16, thread.pendingDelayMs()); @@ -300,7 +300,7 @@ TEST(CCDelayBasedTimeSource, HanldlesSignificantIntervalChangesImmediately) EXPECT_EQ(33, thread.pendingDelayMs()); // Tick, then halve the interval. - timer->setMonotonicallyIncreasingTime(interval * 3); + timer->setMonotonicTimeNow(interval * 3); thread.runPendingTask(); EXPECT_EQ(33, thread.pendingDelayMs()); @@ -332,8 +332,8 @@ TEST(CCDelayBasedTimeSourceTest, AchievesTargetRateWithNoNoise) totalFrameTime += delayMs / 1000.0; // Run the callback exactly when asked - double now = timer->monotonicallyIncreasingTime() + delayMs / 1000.0; - timer->setMonotonicallyIncreasingTime(now); + double now = timer->monotonicTimeNow() + delayMs / 1000.0; + timer->setMonotonicTimeNow(now); thread.runPendingTask(); } double averageInterval = totalFrameTime / static_cast<double>(numIterations); @@ -361,7 +361,7 @@ TEST(CCDelayBasedTimeSource, TestDeactivateAndReactivateBeforeNextTickTime) // Should run the activate task, and pick up a new timebase. timer->setActive(true); - timer->setMonotonicallyIncreasingTime(0); + timer->setMonotonicTimeNow(0); thread.runPendingTask(); // Stop the timer @@ -372,7 +372,7 @@ TEST(CCDelayBasedTimeSource, TestDeactivateAndReactivateBeforeNextTickTime) // Start the timer again, but before the next tick time the timer previously // planned on using. That same tick time should still be targeted. - timer->setMonotonicallyIncreasingTime(0.004); + timer->setMonotonicTimeNow(0.004); timer->setActive(true); EXPECT_EQ(12, thread.pendingDelayMs()); } @@ -386,7 +386,7 @@ TEST(CCDelayBasedTimeSource, TestDeactivateAndReactivateAfterNextTickTime) // Should run the activate task, and pick up a new timebase. timer->setActive(true); - timer->setMonotonicallyIncreasingTime(0); + timer->setMonotonicTimeNow(0); thread.runPendingTask(); // Stop the timer @@ -397,7 +397,7 @@ TEST(CCDelayBasedTimeSource, TestDeactivateAndReactivateAfterNextTickTime) // Start the timer again, but before the next tick time the timer previously // planned on using. That same tick time should still be targeted. - timer->setMonotonicallyIncreasingTime(0.02); + timer->setMonotonicTimeNow(0.02); timer->setActive(true); EXPECT_EQ(13, thread.pendingDelayMs()); } diff --git a/Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp b/Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp index 20f2374a3..3cf646a74 100644 --- a/Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp +++ b/Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp @@ -24,7 +24,7 @@ #include "config.h" -#include "cc/CCFrameRateController.h" +#include "CCFrameRateController.h" #include "CCSchedulerTestCommon.h" #include <gtest/gtest.h> @@ -63,7 +63,7 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_ImmediateAck) // Trigger one frame, make sure the vsync callback is called elapsed += thread.pendingDelayMs() / 1000.0; - timeSource->setMonotonicallyIncreasingTime(elapsed); + timeSource->setMonotonicTimeNow(elapsed); thread.runPendingTask(); EXPECT_TRUE(client.vsyncTicked()); client.reset(); @@ -72,13 +72,13 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_ImmediateAck) controller.didBeginFrame(); // Tell the controller the frame ended 5ms later - timeSource->setMonotonicallyIncreasingTime(timeSource->monotonicallyIncreasingTime() + 0.005); + timeSource->setMonotonicTimeNow(timeSource->monotonicTimeNow() + 0.005); controller.didFinishFrame(); // Trigger another frame, make sure vsync runs again elapsed += thread.pendingDelayMs() / 1000.0; - EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTime()); // Sanity check that previous code didn't move time backward. - timeSource->setMonotonicallyIncreasingTime(elapsed); + EXPECT_TRUE(elapsed >= timeSource->monotonicTimeNow()); // Sanity check that previous code didn't move time backward. + timeSource->setMonotonicTimeNow(elapsed); thread.runPendingTask(); EXPECT_TRUE(client.vsyncTicked()); } @@ -98,7 +98,7 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight) // Trigger one frame, make sure the vsync callback is called elapsed += thread.pendingDelayMs() / 1000.0; - timeSource->setMonotonicallyIncreasingTime(elapsed); + timeSource->setMonotonicTimeNow(elapsed); thread.runPendingTask(); EXPECT_TRUE(client.vsyncTicked()); client.reset(); @@ -108,8 +108,8 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight) // Trigger another frame, make sure vsync callback runs again elapsed += thread.pendingDelayMs() / 1000.0; - EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTime()); // Sanity check that previous code didn't move time backward. - timeSource->setMonotonicallyIncreasingTime(elapsed); + EXPECT_TRUE(elapsed >= timeSource->monotonicTimeNow()); // Sanity check that previous code didn't move time backward. + timeSource->setMonotonicTimeNow(elapsed); thread.runPendingTask(); EXPECT_TRUE(client.vsyncTicked()); client.reset(); @@ -119,13 +119,13 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight) // Trigger another frame. Since two frames are pending, we should not draw. elapsed += thread.pendingDelayMs() / 1000.0; - EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTime()); // Sanity check that previous code didn't move time backward. - timeSource->setMonotonicallyIncreasingTime(elapsed); + EXPECT_TRUE(elapsed >= timeSource->monotonicTimeNow()); // Sanity check that previous code didn't move time backward. + timeSource->setMonotonicTimeNow(elapsed); thread.runPendingTask(); EXPECT_FALSE(client.vsyncTicked()); // Tell the controller the first frame ended 5ms later - timeSource->setMonotonicallyIncreasingTime(timeSource->monotonicallyIncreasingTime() + 0.005); + timeSource->setMonotonicTimeNow(timeSource->monotonicTimeNow() + 0.005); controller.didFinishFrame(); // Tick should not have been called @@ -133,8 +133,8 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight) // Trigger yet another frame. Since one frames is pending, another vsync callback should run. elapsed += thread.pendingDelayMs() / 1000.0; - EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTime()); // Sanity check that previous code didn't move time backward. - timeSource->setMonotonicallyIncreasingTime(elapsed); + EXPECT_TRUE(elapsed >= timeSource->monotonicTimeNow()); // Sanity check that previous code didn't move time backward. + timeSource->setMonotonicTimeNow(elapsed); thread.runPendingTask(); EXPECT_TRUE(client.vsyncTicked()); } @@ -154,6 +154,17 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_Unthrottled) EXPECT_TRUE(client.vsyncTicked()); client.reset(); + // Even if we don't call didBeginFrame, CCFrameRateController should + // still attempt to vsync tick multiple times until it does result in + // a didBeginFrame. + thread.runPendingTask(); + EXPECT_TRUE(client.vsyncTicked()); + client.reset(); + + thread.runPendingTask(); + EXPECT_TRUE(client.vsyncTicked()); + client.reset(); + // didBeginFrame triggers 2nd frame, make sure the vsync callback is called controller.didBeginFrame(); thread.runPendingTask(); @@ -166,6 +177,9 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_Unthrottled) EXPECT_FALSE(client.vsyncTicked()); client.reset(); + // Make sure there is no pending task since we can't do anything until we receive a didFinishFrame anyway. + EXPECT_FALSE(thread.hasPendingTask()); + // didFinishFrame triggers a frame, make sure the vsync callback is called controller.didFinishFrame(); thread.runPendingTask(); diff --git a/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp b/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp index 4d2c4ddaf..571eee141 100644 --- a/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp +++ b/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp @@ -24,7 +24,7 @@ #include "config.h" -#include "cc/CCKeyframedAnimationCurve.h" +#include "CCKeyframedAnimationCurve.h" #include <gmock/gmock.h> #include <gtest/gtest.h> diff --git a/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp b/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp index 2ce33a561..80e120f84 100644 --- a/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp @@ -24,12 +24,11 @@ #include "config.h" -#include "cc/CCLayerAnimationController.h" +#include "CCLayerAnimationController.h" +#include "CCActiveAnimation.h" +#include "CCAnimationCurve.h" #include "CCAnimationTestCommon.h" -#include "cc/CCActiveAnimation.h" -#include "cc/CCAnimationCurve.h" - #include <gmock/gmock.h> #include <gtest/gtest.h> #include <public/WebTransformationMatrix.h> diff --git a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp index 27c4a918a..965a21111 100644 --- a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp @@ -24,9 +24,9 @@ #include "config.h" -#include "cc/CCLayerImpl.h" +#include "CCLayerImpl.h" -#include "cc/CCSingleThreadProxy.h" +#include "CCSingleThreadProxy.h" #include <gmock/gmock.h> #include <gtest/gtest.h> #include <public/WebFilterOperation.h> diff --git a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp index b5e226916..a8db3678f 100644 --- a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp @@ -24,10 +24,10 @@ #include "config.h" -#include "cc/CCLayerIterator.h" +#include "CCLayerIterator.h" +#include "CCLayerTreeHostCommon.h" #include "LayerChromium.h" -#include "cc/CCLayerTreeHostCommon.h" #include <gmock/gmock.h> #include <gtest/gtest.h> #include <public/WebTransformationMatrix.h> diff --git a/Source/WebKit/chromium/tests/CCLayerQuadTest.cpp b/Source/WebKit/chromium/tests/CCLayerQuadTest.cpp index ece2420e4..59bf8eec2 100644 --- a/Source/WebKit/chromium/tests/CCLayerQuadTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerQuadTest.cpp @@ -24,7 +24,7 @@ #include "config.h" -#include "cc/CCLayerQuad.h" +#include "CCLayerQuad.h" #include <gtest/gtest.h> diff --git a/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp b/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp index 8ffcea24f..b2cb479a8 100644 --- a/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp @@ -24,11 +24,11 @@ #include "config.h" -#include "cc/CCLayerSorter.h" +#include "CCLayerSorter.h" -#include "cc/CCLayerImpl.h" -#include "cc/CCMathUtil.h" -#include "cc/CCSingleThreadProxy.h" +#include "CCLayerImpl.h" +#include "CCMathUtil.h" +#include "CCSingleThreadProxy.h" #include <gtest/gtest.h> #include <public/WebTransformationMatrix.h> diff --git a/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp b/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp index 6cc4d2c39..b2b6df568 100644 --- a/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp @@ -25,7 +25,7 @@ #include "config.h" #include "CCLayerTestCommon.h" -#include "cc/CCDrawQuad.h" +#include "CCDrawQuad.h" #include <gtest/gtest.h> #include <wtf/Vector.h> diff --git a/Source/WebKit/chromium/tests/CCLayerTestCommon.h b/Source/WebKit/chromium/tests/CCLayerTestCommon.h index 052d44bc9..8b048b7d5 100644 --- a/Source/WebKit/chromium/tests/CCLayerTestCommon.h +++ b/Source/WebKit/chromium/tests/CCLayerTestCommon.h @@ -25,9 +25,9 @@ #ifndef CCLayerTestCommon_h #define CCLayerTestCommon_h +#include "CCRenderPass.h" #include "IntRect.h" #include "Region.h" -#include "cc/CCRenderPass.h" namespace CCLayerTestCommon { diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp index 9fd226858..ac04b505e 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp @@ -24,19 +24,19 @@ #include "config.h" -#include "cc/CCLayerTreeHostCommon.h" +#include "CCLayerTreeHostCommon.h" #include "CCAnimationTestCommon.h" +#include "CCLayerAnimationController.h" +#include "CCLayerImpl.h" +#include "CCLayerSorter.h" #include "CCLayerTreeTestCommon.h" +#include "CCMathUtil.h" +#include "CCProxy.h" +#include "CCSingleThreadProxy.h" +#include "CCThread.h" #include "ContentLayerChromium.h" #include "LayerChromium.h" -#include "cc/CCLayerAnimationController.h" -#include "cc/CCLayerImpl.h" -#include "cc/CCLayerSorter.h" -#include "cc/CCMathUtil.h" -#include "cc/CCProxy.h" -#include "cc/CCSingleThreadProxy.h" -#include "cc/CCThread.h" #include <gmock/gmock.h> #include <gtest/gtest.h> @@ -609,6 +609,36 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForFlatteningLayer) EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildScreenSpaceTransform, grandChild->screenSpaceTransform()); } +TEST(CCLayerTreeHostCommonTest, verifyTransformsForDegenerateIntermediateLayer) +{ + // A layer that is empty in one axis, but not the other, was accidentally skipping a necessary translation. + // Without that translation, the coordinate space of the layer's drawTransform is incorrect. + // + // Normally this isn't a problem, because the layer wouldn't be drawn anyway, but if that layer becomes a renderSurface, then + // its drawTransform is implicitly inherited by the rest of the subtree, which then is positioned incorrectly as a result. + + RefPtr<LayerChromium> root = LayerChromium::create(); + RefPtr<LayerChromium> child = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> grandChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); + + // The child height is zero, but has non-zero width that should be accounted for while computing drawTransforms. + const WebTransformationMatrix identityMatrix; + setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(100, 100), false); + setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 0), false); + setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); + + root->addChild(child); + child->addChild(grandChild); + child->setForceRenderSurface(true); + + executeCalculateDrawTransformsAndVisibility(root.get()); + + ASSERT_TRUE(child->renderSurface()); + EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->renderSurface()->drawTransform()); // This is the real test, the rest are sanity checks. + EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->drawTransform()); +} + TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClippedLayer) { RefPtr<LayerChromium> parent = LayerChromium::create(); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp index 2c14a1cc3..6ec0ce5d7 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp @@ -24,30 +24,30 @@ #include "config.h" -#include "cc/CCLayerTreeHostImpl.h" +#include "CCLayerTreeHostImpl.h" #include "CCAnimationTestCommon.h" +#include "CCHeadsUpDisplayLayerImpl.h" +#include "CCIOSurfaceLayerImpl.h" +#include "CCLayerImpl.h" #include "CCLayerTestCommon.h" +#include "CCLayerTilingData.h" #include "CCLayerTreeTestCommon.h" +#include "CCQuadCuller.h" +#include "CCRenderPassDrawQuad.h" +#include "CCScrollbarLayerImpl.h" +#include "CCSettings.h" +#include "CCSingleThreadProxy.h" +#include "CCSolidColorDrawQuad.h" #include "CCTestCommon.h" +#include "CCTextureLayerImpl.h" +#include "CCTileDrawQuad.h" +#include "CCTiledLayerImpl.h" +#include "CCVideoLayerImpl.h" #include "FakeWebCompositorOutputSurface.h" #include "FakeWebGraphicsContext3D.h" #include "FakeWebScrollbarThemeGeometry.h" #include "LayerRendererChromium.h" -#include "cc/CCHeadsUpDisplayLayerImpl.h" -#include "cc/CCIOSurfaceLayerImpl.h" -#include "cc/CCLayerImpl.h" -#include "cc/CCLayerTilingData.h" -#include "cc/CCQuadCuller.h" -#include "cc/CCRenderPassDrawQuad.h" -#include "cc/CCScrollbarLayerImpl.h" -#include "cc/CCSettings.h" -#include "cc/CCSingleThreadProxy.h" -#include "cc/CCSolidColorDrawQuad.h" -#include "cc/CCTextureLayerImpl.h" -#include "cc/CCTileDrawQuad.h" -#include "cc/CCTiledLayerImpl.h" -#include "cc/CCVideoLayerImpl.h" #include <gmock/gmock.h> #include <gtest/gtest.h> #include <public/WebVideoFrame.h> @@ -154,12 +154,11 @@ public: m_hostImpl->setRootLayer(root.release()); } - static PassOwnPtr<CCLayerImpl> createScrollableLayer(int id, const FloatPoint& position, const IntSize& size) + static PassOwnPtr<CCLayerImpl> createScrollableLayer(int id, const IntSize& size) { OwnPtr<CCLayerImpl> layer = CCLayerImpl::create(id); layer->setScrollable(true); layer->setDrawsContent(true); - layer->setPosition(position); layer->setBounds(size); layer->setContentBounds(size); layer->setMaxScrollPosition(IntSize(size.width() * 2, size.height() * 2)); @@ -190,6 +189,11 @@ protected: CCScopedSettings m_scopedSettings; }; +class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D { +public: + virtual bool makeContextCurrent() { return false; } +}; + TEST_F(CCLayerTreeHostImplTest, scrollDeltaNoLayers) { ASSERT_FALSE(m_hostImpl->rootLayer()); @@ -264,7 +268,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollRootCallsCommitAndRedraw) initializeLayerRendererAndDrawFrame(); EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntSize(0, 10)); + m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); m_hostImpl->scrollEnd(); EXPECT_TRUE(m_didRequestRedraw); EXPECT_TRUE(m_didRequestCommit); @@ -276,6 +280,21 @@ TEST_F(CCLayerTreeHostImplTest, scrollWithoutRootLayer) EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollIgnored); } +TEST_F(CCLayerTreeHostImplTest, scrollWithoutRenderer) +{ + CCLayerTreeSettings settings; + m_hostImpl = CCLayerTreeHostImpl::create(settings, this); + + // Initialization will fail here. + m_hostImpl->initializeLayerRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails)), UnthrottledUploader); + m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); + + setupScrollAndContentsLayers(IntSize(100, 100)); + + // We should not crash when trying to scroll after the renderer initialization fails. + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollIgnored); +} + TEST_F(CCLayerTreeHostImplTest, replaceTreeWhileScrolling) { const int scrollLayerId = 1; @@ -292,7 +311,7 @@ TEST_F(CCLayerTreeHostImplTest, replaceTreeWhileScrolling) // We should still be scrolling, because the scrolled layer also exists in the new tree. IntSize scrollDelta(0, 10); - m_hostImpl->scrollBy(scrollDelta); + m_hostImpl->scrollBy(IntPoint(), scrollDelta); m_hostImpl->scrollEnd(); OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); expectContains(*scrollInfo, scrollLayerId, scrollDelta); @@ -354,10 +373,10 @@ TEST_F(CCLayerTreeHostImplTest, nonFastScrollableRegionBasic) // All scroll types outside this region should succeed. EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(75, 75), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntSize(0, 10)); + m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); m_hostImpl->scrollEnd(); EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(75, 75), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntSize(0, 10)); + m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); m_hostImpl->scrollEnd(); } @@ -373,7 +392,7 @@ TEST_F(CCLayerTreeHostImplTest, nonFastScrollableRegionWithOffset) // This point would fall into the non-fast scrollable region except that we've moved the layer down by 25 pixels. EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(40, 10), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntSize(0, 1)); + m_hostImpl->scrollBy(IntPoint(), IntSize(0, 1)); m_hostImpl->scrollEnd(); // This point is still inside the non-fast region. @@ -595,7 +614,7 @@ TEST_F(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPa // Scrolling during the animation is ignored. const IntSize scrollDelta(0, 10); EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(scrollDelta); + m_hostImpl->scrollBy(IntPoint(), scrollDelta); m_hostImpl->scrollEnd(); // The final page scale and scroll deltas should match what we got @@ -866,7 +885,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollNonCompositedRoot) initializeLayerRendererAndDrawFrame(); EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntSize(0, 10)); + m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); m_hostImpl->scrollEnd(); EXPECT_TRUE(m_didRequestRedraw); EXPECT_TRUE(m_didRequestCommit); @@ -878,13 +897,13 @@ TEST_F(CCLayerTreeHostImplTest, scrollChildCallsCommitAndRedraw) OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); root->setBounds(surfaceSize); root->setContentBounds(surfaceSize); - root->addChild(createScrollableLayer(2, FloatPoint(0, 0), surfaceSize)); + root->addChild(createScrollableLayer(2, surfaceSize)); m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeLayerRendererAndDrawFrame(); EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(IntSize(0, 10)); + m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); m_hostImpl->scrollEnd(); EXPECT_TRUE(m_didRequestRedraw); EXPECT_TRUE(m_didRequestCommit); @@ -894,7 +913,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollMissesChild) { IntSize surfaceSize(10, 10); OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); - root->addChild(createScrollableLayer(2, FloatPoint(0, 0), surfaceSize)); + root->addChild(createScrollableLayer(2, surfaceSize)); m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeLayerRendererAndDrawFrame(); @@ -909,7 +928,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollMissesBackfacingChild) { IntSize surfaceSize(10, 10); OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); - OwnPtr<CCLayerImpl> child = createScrollableLayer(2, FloatPoint(0, 0), surfaceSize); + OwnPtr<CCLayerImpl> child = createScrollableLayer(2, surfaceSize); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); WebTransformationMatrix matrix; @@ -931,11 +950,11 @@ TEST_F(CCLayerTreeHostImplTest, scrollMissesBackfacingChild) TEST_F(CCLayerTreeHostImplTest, scrollBlockedByContentLayer) { IntSize surfaceSize(10, 10); - OwnPtr<CCLayerImpl> contentLayer = createScrollableLayer(1, FloatPoint(0, 0), surfaceSize); + OwnPtr<CCLayerImpl> contentLayer = createScrollableLayer(1, surfaceSize); contentLayer->setShouldScrollOnMainThread(true); contentLayer->setScrollable(false); - OwnPtr<CCLayerImpl> scrollLayer = createScrollableLayer(2, FloatPoint(0, 0), surfaceSize); + OwnPtr<CCLayerImpl> scrollLayer = createScrollableLayer(2, surfaceSize); scrollLayer->addChild(contentLayer.release()); m_hostImpl->setRootLayer(scrollLayer.release()); @@ -950,7 +969,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread) { IntSize surfaceSize(10, 10); float pageScale = 2; - OwnPtr<CCLayerImpl> root = createScrollableLayer(1, FloatPoint(0, 0), surfaceSize); + OwnPtr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeLayerRendererAndDrawFrame(); @@ -959,7 +978,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread) IntSize expectedScrollDelta(scrollDelta); IntSize expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollPosition()); EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(scrollDelta); + m_hostImpl->scrollBy(IntPoint(), scrollDelta); m_hostImpl->scrollEnd(); // Set new page scale from main thread. @@ -981,7 +1000,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread) { IntSize surfaceSize(10, 10); float pageScale = 2; - OwnPtr<CCLayerImpl> root = createScrollableLayer(1, FloatPoint(0, 0), surfaceSize); + OwnPtr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale); @@ -991,7 +1010,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread) IntSize expectedScrollDelta(scrollDelta); IntSize expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollPosition()); EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(scrollDelta); + m_hostImpl->scrollBy(IntPoint(), scrollDelta); m_hostImpl->scrollEnd(); // Set new page scale on impl thread by pinching. @@ -1021,7 +1040,7 @@ TEST_F(CCLayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly) CCLayerImpl* root = m_hostImpl->rootLayer(); CCLayerImpl* child = root->children()[0].get(); - OwnPtr<CCLayerImpl> scrollableChild = createScrollableLayer(3, FloatPoint(0, 0), surfaceSize); + OwnPtr<CCLayerImpl> scrollableChild = createScrollableLayer(3, surfaceSize); child->addChild(scrollableChild.release()); CCLayerImpl* grandChild = child->children()[0].get(); @@ -1059,7 +1078,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread) // Also mark the root scrollable so it becomes the root scroll layer. root->setScrollable(true); int scrollLayerId = 2; - root->addChild(createScrollableLayer(scrollLayerId, FloatPoint(0, 0), surfaceSize)); + root->addChild(createScrollableLayer(scrollLayerId, surfaceSize)); m_hostImpl->setRootLayer(root.release()); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeLayerRendererAndDrawFrame(); @@ -1070,7 +1089,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread) IntSize expectedScrollDelta(scrollDelta); IntSize expectedMaxScroll(child->maxScrollPosition()); EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(scrollDelta); + m_hostImpl->scrollBy(IntPoint(), scrollDelta); m_hostImpl->scrollEnd(); float pageScale = 2; @@ -1094,12 +1113,12 @@ TEST_F(CCLayerTreeHostImplTest, scrollChildBeyondLimit) // parent layer is scrolled on the axis on which the child was unable to // scroll. IntSize surfaceSize(10, 10); - OwnPtr<CCLayerImpl> root = createScrollableLayer(1, FloatPoint(0, 0), surfaceSize); + OwnPtr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); - OwnPtr<CCLayerImpl> grandChild = createScrollableLayer(3, FloatPoint(0, 0), surfaceSize); + OwnPtr<CCLayerImpl> grandChild = createScrollableLayer(3, surfaceSize); grandChild->setScrollPosition(IntPoint(0, 5)); - OwnPtr<CCLayerImpl> child = createScrollableLayer(2, FloatPoint(0, 0), surfaceSize); + OwnPtr<CCLayerImpl> child = createScrollableLayer(2, surfaceSize); child->setScrollPosition(IntPoint(3, 0)); child->addChild(grandChild.release()); @@ -1108,9 +1127,9 @@ TEST_F(CCLayerTreeHostImplTest, scrollChildBeyondLimit) m_hostImpl->setViewportSize(surfaceSize, surfaceSize); initializeLayerRendererAndDrawFrame(); { - IntSize scrollDelta(-3, -7); + IntSize scrollDelta(-8, -7); EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(scrollDelta); + m_hostImpl->scrollBy(IntPoint(), scrollDelta); m_hostImpl->scrollEnd(); OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); @@ -1130,8 +1149,8 @@ TEST_F(CCLayerTreeHostImplTest, scrollEventBubbling) // When we try to scroll a non-scrollable child layer, the scroll delta // should be applied to one of its ancestors if possible. IntSize surfaceSize(10, 10); - OwnPtr<CCLayerImpl> root = createScrollableLayer(1, FloatPoint(0, 0), surfaceSize); - OwnPtr<CCLayerImpl> child = createScrollableLayer(2, FloatPoint(0, 0), surfaceSize); + OwnPtr<CCLayerImpl> root = createScrollableLayer(1, surfaceSize); + OwnPtr<CCLayerImpl> child = createScrollableLayer(2, surfaceSize); child->setScrollable(false); root->addChild(child.release()); @@ -1142,7 +1161,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollEventBubbling) { IntSize scrollDelta(0, 4); EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); - m_hostImpl->scrollBy(scrollDelta); + m_hostImpl->scrollBy(IntPoint(), scrollDelta); m_hostImpl->scrollEnd(); OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); @@ -1156,18 +1175,150 @@ TEST_F(CCLayerTreeHostImplTest, scrollEventBubbling) TEST_F(CCLayerTreeHostImplTest, scrollBeforeRedraw) { IntSize surfaceSize(10, 10); - m_hostImpl->setRootLayer(createScrollableLayer(1, FloatPoint(0, 0), surfaceSize)); + m_hostImpl->setRootLayer(createScrollableLayer(1, surfaceSize)); m_hostImpl->setViewportSize(surfaceSize, surfaceSize); // Draw one frame and then immediately rebuild the layer tree to mimic a tree synchronization. initializeLayerRendererAndDrawFrame(); m_hostImpl->detachLayerTree(); - m_hostImpl->setRootLayer(createScrollableLayer(2, FloatPoint(0, 0), surfaceSize)); + m_hostImpl->setRootLayer(createScrollableLayer(2, surfaceSize)); // Scrolling should still work even though we did not draw yet. EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); } +TEST_F(CCLayerTreeHostImplTest, scrollAxisAlignedRotatedLayer) +{ + setupScrollAndContentsLayers(IntSize(100, 100)); + + // Rotate the root layer 90 degrees counter-clockwise about its center. + WebTransformationMatrix rotateTransform; + rotateTransform.rotate(-90); + m_hostImpl->rootLayer()->setTransform(rotateTransform); + + IntSize surfaceSize(50, 50); + m_hostImpl->setViewportSize(surfaceSize, surfaceSize); + initializeLayerRendererAndDrawFrame(); + + // Scroll to the right in screen coordinates with a gesture. + IntSize gestureScrollDelta(10, 0); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(IntPoint(), gestureScrollDelta); + m_hostImpl->scrollEnd(); + + // The layer should have scrolled down in its local coordinates. + OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), IntSize(0, gestureScrollDelta.width())); + + // Reset and scroll down with the wheel. + m_hostImpl->rootLayer()->setScrollDelta(FloatSize()); + IntSize wheelScrollDelta(0, 10); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(IntPoint(), wheelScrollDelta); + m_hostImpl->scrollEnd(); + + // The layer should have scrolled down in its local coordinates. + scrollInfo = m_hostImpl->processScrollDeltas(); + expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), wheelScrollDelta); +} + +TEST_F(CCLayerTreeHostImplTest, scrollNonAxisAlignedRotatedLayer) +{ + setupScrollAndContentsLayers(IntSize(100, 100)); + int childLayerId = 3; + float childLayerAngle = -20; + + // Create a child layer that is rotated to a non-axis-aligned angle. + OwnPtr<CCLayerImpl> child = createScrollableLayer(childLayerId, m_hostImpl->rootLayer()->contentBounds()); + WebTransformationMatrix rotateTransform; + rotateTransform.translate(-50, -50); + rotateTransform.rotate(childLayerAngle); + rotateTransform.translate(50, 50); + child->setTransform(rotateTransform); + + // Only allow vertical scrolling. + child->setMaxScrollPosition(IntSize(0, child->contentBounds().height())); + m_hostImpl->rootLayer()->addChild(child.release()); + + IntSize surfaceSize(50, 50); + m_hostImpl->setViewportSize(surfaceSize, surfaceSize); + initializeLayerRendererAndDrawFrame(); + + { + // Scroll down in screen coordinates with a gesture. + IntSize gestureScrollDelta(0, 10); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(IntPoint(), gestureScrollDelta); + m_hostImpl->scrollEnd(); + + // The child layer should have scrolled down in its local coordinates an amount proportional to + // the angle between it and the input scroll delta. + IntSize expectedScrollDelta(0, gestureScrollDelta.height() * cosf(deg2rad(childLayerAngle))); + OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + expectContains(*scrollInfo.get(), childLayerId, expectedScrollDelta); + + // The root layer should not have scrolled, because the input delta was close to the layer's + // axis of movement. + EXPECT_EQ(scrollInfo->scrolls.size(), 1u); + } + + { + // Now reset and scroll the same amount horizontally. + m_hostImpl->rootLayer()->children()[1]->setScrollDelta(FloatSize()); + IntSize gestureScrollDelta(10, 0); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(IntPoint(), gestureScrollDelta); + m_hostImpl->scrollEnd(); + + // The child layer should have scrolled down in its local coordinates an amount proportional to + // the angle between it and the input scroll delta. + IntSize expectedScrollDelta(0, -gestureScrollDelta.width() * sinf(deg2rad(childLayerAngle))); + OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + expectContains(*scrollInfo.get(), childLayerId, expectedScrollDelta); + + // The root layer should have scrolled more, since the input scroll delta was mostly + // orthogonal to the child layer's vertical scroll axis. + IntSize expectedRootScrollDelta(gestureScrollDelta.width() * pow(cosf(deg2rad(childLayerAngle)), 2), 0); + expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), expectedRootScrollDelta); + } +} + +TEST_F(CCLayerTreeHostImplTest, scrollScaledLayer) +{ + setupScrollAndContentsLayers(IntSize(100, 100)); + + // Scale the layer to twice its normal size. + int scale = 2; + WebTransformationMatrix scaleTransform; + scaleTransform.scale(scale); + m_hostImpl->rootLayer()->setTransform(scaleTransform); + + IntSize surfaceSize(50, 50); + m_hostImpl->setViewportSize(surfaceSize, surfaceSize); + initializeLayerRendererAndDrawFrame(); + + // Scroll down in screen coordinates with a gesture. + IntSize scrollDelta(0, 10); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(IntPoint(), scrollDelta); + m_hostImpl->scrollEnd(); + + // The layer should have scrolled down in its local coordinates, but half he amount. + OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), IntSize(0, scrollDelta.height() / scale)); + + // Reset and scroll down with the wheel. + m_hostImpl->rootLayer()->setScrollDelta(FloatSize()); + IntSize wheelScrollDelta(0, 10); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(IntPoint(), wheelScrollDelta); + m_hostImpl->scrollEnd(); + + // The scale should not have been applied to the scroll delta. + scrollInfo = m_hostImpl->processScrollDeltas(); + expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), wheelScrollDelta); +} + class BlendStateTrackerContext: public FakeWebGraphicsContext3D { public: BlendStateTrackerContext() : m_blend(false) { } @@ -1840,7 +1991,7 @@ TEST_F(CCLayerTreeHostImplTest, noPartialSwap) MockContextHarness harness(mockContext); harness.mustDrawSolidQuad(); - harness.mustSetNoScissor(); + harness.mustSetScissor(0, 0, 10, 10); // Run test case OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context.release(), FakeLayerWithQuads::create(1)); @@ -1861,7 +2012,7 @@ TEST_F(CCLayerTreeHostImplTest, partialSwap) OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, context.release(), FakeLayerWithQuads::create(1)); // The first frame is not a partially-swapped one. - harness.mustSetNoScissor(); + harness.mustSetScissor(0, 0, 10, 10); harness.mustDrawSolidQuad(); { CCLayerTreeHostImpl::FrameData frame; @@ -2062,13 +2213,11 @@ TEST_F(CCLayerTreeHostImplTest, contextLostAndRestoredNotificationSentToAllLayer EXPECT_TRUE(layer2->didLoseContextCalled()); } -class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D { -public: - virtual bool makeContextCurrent() { return false; } -}; - TEST_F(CCLayerTreeHostImplTest, finishAllRenderingAfterContextLost) { + CCLayerTreeSettings settings; + m_hostImpl = CCLayerTreeHostImpl::create(settings, this); + // The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects. m_hostImpl->initializeLayerRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails)), UnthrottledUploader); m_hostImpl->finishAllRendering(); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp index 137e6249a..5202208b9 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp @@ -24,16 +24,16 @@ #include "config.h" -#include "cc/CCLayerTreeHost.h" +#include "CCLayerTreeHost.h" +#include "CCGraphicsContext.h" +#include "CCLayerTreeHostImpl.h" #include "CCOcclusionTrackerTestCommon.h" +#include "CCSettings.h" +#include "CCTextureUpdateQueue.h" #include "CCThreadedTest.h" +#include "CCTimingFunction.h" #include "ContentLayerChromium.h" -#include "cc/CCGraphicsContext.h" -#include "cc/CCLayerTreeHostImpl.h" -#include "cc/CCSettings.h" -#include "cc/CCTextureUpdateQueue.h" -#include "cc/CCTimingFunction.h" #include <gmock/gmock.h> #include <gtest/gtest.h> #include <public/Platform.h> @@ -2221,7 +2221,7 @@ public: { if (impl->sourceAnimationFrameNumber() == 1) { EXPECT_EQ(impl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); - impl->scrollBy(m_scrollAmount); + impl->scrollBy(IntPoint(), m_scrollAmount); impl->scrollEnd(); } else if (impl->sourceAnimationFrameNumber() == 2) endTest(); @@ -2347,4 +2347,251 @@ private: SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit) + +class EvictionTrackingTexture : public LayerTextureUpdater::Texture { +public: + static PassOwnPtr<EvictionTrackingTexture> create(PassOwnPtr<CCPrioritizedTexture> texture) { return adoptPtr(new EvictionTrackingTexture(texture)); } + virtual ~EvictionTrackingTexture() { } + + virtual void updateRect(CCResourceProvider* resourceProvider, const IntRect&, const IntSize&) OVERRIDE + { + ASSERT_TRUE(!texture()->haveBackingTexture() || resourceProvider->numResources() > 0); + texture()->acquireBackingTexture(resourceProvider); + m_updated = true; + } + void resetUpdated() { m_updated = false; } + bool updated() const { return m_updated; } + +private: + explicit EvictionTrackingTexture(PassOwnPtr<CCPrioritizedTexture> texture) + : LayerTextureUpdater::Texture(texture) + , m_updated(false) + { } + bool m_updated; +}; + +class EvictionTestLayer : public LayerChromium { +public: + static PassRefPtr<EvictionTestLayer> create() { return adoptRef(new EvictionTestLayer()); } + + virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE; + virtual bool drawsContent() const OVERRIDE { return true; } + + virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE; + virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE; + virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE; + + void resetUpdated() + { + if (m_texture.get()) + m_texture->resetUpdated(); + } + bool updated() const { return m_texture.get() ? m_texture->updated() : false; } + +private: + EvictionTestLayer() : LayerChromium() { } + + void createTextureIfNeeded() + { + if (m_texture.get()) + return; + m_texture = EvictionTrackingTexture::create(CCPrioritizedTexture::create(layerTreeHost()->contentsTextureManager())); + m_texture->texture()->setDimensions(WebCore::IntSize(10, 10), WebCore::GraphicsContext3D::RGBA); + } + + OwnPtr<EvictionTrackingTexture> m_texture; +}; + +class EvictionTestLayerImpl : public CCLayerImpl { +public: + static PassOwnPtr<EvictionTestLayerImpl> create(int id) + { + return adoptPtr(new EvictionTestLayerImpl(id)); + } + virtual ~EvictionTestLayerImpl() { } + virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) + { + ASSERT_TRUE(m_hasTexture); + ASSERT_NE(0u, layerTreeHostImpl()->resourceProvider()->numResources()); + } + void setHasTexture(bool hasTexture) { m_hasTexture = hasTexture; } + +private: + explicit EvictionTestLayerImpl(int id) + : CCLayerImpl(id) + , m_hasTexture(false) { } + + bool m_hasTexture; +}; + +void EvictionTestLayer::setTexturePriorities(const CCPriorityCalculator&) +{ + createTextureIfNeeded(); + if (!m_texture.get()) + return; + m_texture->texture()->setRequestPriority(CCPriorityCalculator::uiPriority(true)); +} + +void EvictionTestLayer::update(CCTextureUpdateQueue& queue, const CCOcclusionTracker*, CCRenderingStats&) +{ + createTextureIfNeeded(); + if (!m_texture.get()) + return; + IntRect fullRect(0, 0, 10, 10); + TextureUploader::Parameters parameters = { m_texture.get(), fullRect, IntSize() }; + queue.appendFullUpload(parameters); +} + +PassOwnPtr<CCLayerImpl> EvictionTestLayer::createCCLayerImpl() +{ + return EvictionTestLayerImpl::create(m_layerId); +} + +void EvictionTestLayer::pushPropertiesTo(CCLayerImpl* layerImpl) +{ + LayerChromium::pushPropertiesTo(layerImpl); + + EvictionTestLayerImpl* testLayerImpl = static_cast<EvictionTestLayerImpl*>(layerImpl); + testLayerImpl->setHasTexture(m_texture->texture()->haveBackingTexture()); +} + +class CCLayerTreeHostTestEvictTextures : public CCLayerTreeHostTest { +public: + CCLayerTreeHostTestEvictTextures() + : m_layer(EvictionTestLayer::create()) + , m_implForEvictTextures(0) + , m_numCommits(0) + { + } + + virtual void beginTest() + { + m_layerTreeHost->setRootLayer(m_layer); + m_layerTreeHost->setViewportSize(IntSize(10, 20), IntSize(10, 20)); + + WebTransformationMatrix identityMatrix; + setLayerPropertiesForTesting(m_layer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 20), true); + } + + class EvictTexturesTask : public WebKit::WebThread::Task { + public: + EvictTexturesTask(CCLayerTreeHostTestEvictTextures* test) : m_test(test) { } + virtual ~EvictTexturesTask() { } + virtual void run() + { + ASSERT(m_test->m_implForEvictTextures); + m_test->m_implForEvictTextures->releaseContentsTextures(); + } + + private: + CCLayerTreeHostTestEvictTextures* m_test; + }; + + void postEvictTextures() + { + ASSERT(webThread()); + webThread()->postTask(new EvictTexturesTask(this)); + } + + // Commit 1: Just commit and draw normally, then post an eviction at the end + // that will trigger a commit. + // Commit 2: Triggered by the eviction, let it go through and then set + // needsCommit. + // Commit 3: Triggered by the setNeedsCommit. In layout(), post an eviction + // task, which will be handled before the commit. Don't set needsCommit, it + // should have been posted. A frame should not be drawn (note, + // didCommitAndDrawFrame may be called anyway). + // Commit 4: Triggered by the eviction, let it go through and then set + // needsCommit. + // Commit 5: Triggered by the setNeedsCommit, post an eviction task in + // layout(), a frame should not be drawn but a commit will be posted. + // Commit 6: Triggered by the eviction, post an eviction task in + // layout(), which will be a noop, letting the commit (which recreates the + // textures) go through and draw a frame, then end the test. + // + // Commits 1+2 test the eviction recovery path where eviction happens outside + // of the beginFrame/commit pair. + // Commits 3+4 test the eviction recovery path where eviction happens inside + // the beginFrame/commit pair. + // Commits 5+6 test the path where an eviction happens during the eviction + // recovery path. + virtual void didCommitAndDrawFrame() + { + switch (m_numCommits) { + case 1: + EXPECT_TRUE(m_layer->updated()); + postEvictTextures(); + break; + case 2: + EXPECT_TRUE(m_layer->updated()); + m_layerTreeHost->setNeedsCommit(); + break; + case 3: + break; + case 4: + EXPECT_TRUE(m_layer->updated()); + m_layerTreeHost->setNeedsCommit(); + break; + case 5: + break; + case 6: + EXPECT_TRUE(m_layer->updated()); + endTest(); + break; + default: + ASSERT_NOT_REACHED(); + break; + } + } + + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) + { + m_implForEvictTextures = impl; + } + + virtual void layout() + { + ++m_numCommits; + switch (m_numCommits) { + case 1: + case 2: + break; + case 3: + postEvictTextures(); + break; + case 4: + // We couldn't check in didCommitAndDrawFrame on commit 3, so check here. + EXPECT_FALSE(m_layer->updated()); + break; + case 5: + postEvictTextures(); + break; + case 6: + // We couldn't check in didCommitAndDrawFrame on commit 5, so check here. + EXPECT_FALSE(m_layer->updated()); + postEvictTextures(); + break; + default: + ASSERT_NOT_REACHED(); + break; + } + m_layer->resetUpdated(); + } + + virtual void afterTest() + { + } + +private: + MockContentLayerDelegate m_delegate; + RefPtr<EvictionTestLayer> m_layer; + CCLayerTreeHostImpl* m_implForEvictTextures; + int m_numCommits; +}; + +TEST_F(CCLayerTreeHostTestEvictTextures, runMultiThread) +{ + runTest(true); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/CCMathUtilTest.cpp b/Source/WebKit/chromium/tests/CCMathUtilTest.cpp index 44a68b9eb..416e1b56d 100644 --- a/Source/WebKit/chromium/tests/CCMathUtilTest.cpp +++ b/Source/WebKit/chromium/tests/CCMathUtilTest.cpp @@ -24,7 +24,7 @@ #include "config.h" -#include "cc/CCMathUtil.h" +#include "CCMathUtil.h" #include "CCLayerTreeTestCommon.h" #include "FloatRect.h" @@ -152,4 +152,51 @@ TEST(CCMathUtilTest, verifyEnclosingRectOfVerticesUsesCorrectInitialBounds) EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(-100, -100), FloatSize(90, 90)), result); } +TEST(CCMathUtilTest, smallestAngleBetweenVectors) +{ + FloatSize x(1, 0); + FloatSize y(0, 1); + FloatSize testVector(0.5, 0.5); + + // Orthogonal vectors are at an angle of 90 degress. + EXPECT_EQ(90, CCMathUtil::smallestAngleBetweenVectors(x, y)); + + // A vector makes a zero angle with itself. + EXPECT_EQ(0, CCMathUtil::smallestAngleBetweenVectors(x, x)); + EXPECT_EQ(0, CCMathUtil::smallestAngleBetweenVectors(y, y)); + EXPECT_EQ(0, CCMathUtil::smallestAngleBetweenVectors(testVector, testVector)); + + // Parallel but reversed vectors are at 180 degrees. + EXPECT_FLOAT_EQ(180, CCMathUtil::smallestAngleBetweenVectors(x, -x)); + EXPECT_FLOAT_EQ(180, CCMathUtil::smallestAngleBetweenVectors(y, -y)); + EXPECT_FLOAT_EQ(180, CCMathUtil::smallestAngleBetweenVectors(testVector, -testVector)); + + // The test vector is at a known angle. + EXPECT_FLOAT_EQ(45, floor(CCMathUtil::smallestAngleBetweenVectors(testVector, x))); + EXPECT_FLOAT_EQ(45, floor(CCMathUtil::smallestAngleBetweenVectors(testVector, y))); +} + +TEST(CCMathUtilTest, vectorProjection) +{ + FloatSize x(1, 0); + FloatSize y(0, 1); + FloatSize testVector(0.3f, 0.7f); + + // Orthogonal vectors project to a zero vector. + EXPECT_EQ(FloatSize(0, 0), CCMathUtil::projectVector(x, y)); + EXPECT_EQ(FloatSize(0, 0), CCMathUtil::projectVector(y, x)); + + // Projecting a vector onto the orthonormal basis gives the corresponding component of the + // vector. + EXPECT_EQ(FloatSize(testVector.width(), 0), CCMathUtil::projectVector(testVector, x)); + EXPECT_EQ(FloatSize(0, testVector.height()), CCMathUtil::projectVector(testVector, y)); + + // Finally check than an arbitrary vector projected to another one gives a vector parallel to + // the second vector. + FloatSize targetVector(0.5, 0.2f); + FloatSize projectedVector = CCMathUtil::projectVector(testVector, targetVector); + EXPECT_EQ(projectedVector.width() / targetVector.width(), + projectedVector.height() / targetVector.height()); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp index 9d51c9970..4e5f9dc88 100644 --- a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp @@ -24,19 +24,19 @@ #include "config.h" -#include "cc/CCOcclusionTracker.h" +#include "CCOcclusionTracker.h" #include "CCAnimationTestCommon.h" +#include "CCLayerAnimationController.h" +#include "CCLayerImpl.h" +#include "CCLayerTreeHostCommon.h" #include "CCLayerTreeTestCommon.h" +#include "CCMathUtil.h" #include "CCOcclusionTrackerTestCommon.h" +#include "CCOverdrawMetrics.h" +#include "CCSingleThreadProxy.h" #include "LayerChromium.h" #include "Region.h" -#include "cc/CCLayerAnimationController.h" -#include "cc/CCLayerImpl.h" -#include "cc/CCLayerTreeHostCommon.h" -#include "cc/CCMathUtil.h" -#include "cc/CCOverdrawMetrics.h" -#include "cc/CCSingleThreadProxy.h" #include <gmock/gmock.h> #include <gtest/gtest.h> #include <public/WebFilterOperation.h> diff --git a/Source/WebKit/chromium/tests/CCOcclusionTrackerTestCommon.h b/Source/WebKit/chromium/tests/CCOcclusionTrackerTestCommon.h index fcdc3ed6c..cf38c5a33 100644 --- a/Source/WebKit/chromium/tests/CCOcclusionTrackerTestCommon.h +++ b/Source/WebKit/chromium/tests/CCOcclusionTrackerTestCommon.h @@ -25,11 +25,11 @@ #ifndef CCOcclusionTrackerTestCommon_h #define CCOcclusionTrackerTestCommon_h +#include "CCOcclusionTracker.h" +#include "CCRenderSurface.h" #include "IntRect.h" #include "Region.h" #include "RenderSurfaceChromium.h" -#include "cc/CCOcclusionTracker.h" -#include "cc/CCRenderSurface.h" namespace WebKitTests { diff --git a/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp b/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp index 97027095e..4bcaccdc3 100644 --- a/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp +++ b/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp @@ -24,13 +24,13 @@ #include "config.h" -#include "cc/CCPrioritizedTexture.h" +#include "CCPrioritizedTexture.h" +#include "CCPrioritizedTextureManager.h" +#include "CCSingleThreadProxy.h" // For DebugScopedSetImplThread +#include "CCTexture.h" #include "CCTiledLayerTestCommon.h" #include "FakeCCGraphicsContext.h" -#include "cc/CCPrioritizedTextureManager.h" -#include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread -#include "cc/CCTexture.h" #include <gtest/gtest.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp index 8279a3a6b..f732cdc68 100644 --- a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp +++ b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp @@ -24,15 +24,15 @@ #include "config.h" -#include "cc/CCQuadCuller.h" - -#include "cc/CCLayerTilingData.h" -#include "cc/CCMathUtil.h" -#include "cc/CCOcclusionTracker.h" -#include "cc/CCOverdrawMetrics.h" -#include "cc/CCSingleThreadProxy.h" -#include "cc/CCTiledLayerImpl.h" -#include "cc/CCTileDrawQuad.h" +#include "CCQuadCuller.h" + +#include "CCLayerTilingData.h" +#include "CCMathUtil.h" +#include "CCOcclusionTracker.h" +#include "CCOverdrawMetrics.h" +#include "CCSingleThreadProxy.h" +#include "CCTileDrawQuad.h" +#include "CCTiledLayerImpl.h" #include <gmock/gmock.h> #include <gtest/gtest.h> #include <public/WebTransformationMatrix.h> diff --git a/Source/WebKit/chromium/tests/CCRenderSurfaceFiltersTest.cpp b/Source/WebKit/chromium/tests/CCRenderSurfaceFiltersTest.cpp index b56a7fb42..1b56c20ec 100644 --- a/Source/WebKit/chromium/tests/CCRenderSurfaceFiltersTest.cpp +++ b/Source/WebKit/chromium/tests/CCRenderSurfaceFiltersTest.cpp @@ -24,7 +24,7 @@ #include "config.h" -#include "cc/CCRenderSurfaceFilters.h" +#include "CCRenderSurfaceFilters.h" #include "CompositorFakeWebGraphicsContext3D.h" #include <gtest/gtest.h> @@ -52,27 +52,30 @@ TEST(CCRenderSurfaceFiltersTest, testColorMatrixFiltersCombined) // Several filters should always combine for any amount between 0 and 1: // grayscale, saturate, invert, contrast, opacity. EXPECT_TRUE(isCombined(WebFilterOperation::createGrayscaleFilter(0))); - EXPECT_TRUE(isCombined(WebFilterOperation::createGrayscaleFilter(0.3))); + // Note that we use 0.3f to avoid "argument is truncated from 'double' to + // 'float'" warnings on Windows. 0.5 is exactly representable as a float, so + // there is no warning. + EXPECT_TRUE(isCombined(WebFilterOperation::createGrayscaleFilter(0.3f))); EXPECT_TRUE(isCombined(WebFilterOperation::createGrayscaleFilter(0.5))); EXPECT_TRUE(isCombined(WebFilterOperation::createGrayscaleFilter(1))); EXPECT_TRUE(isCombined(WebFilterOperation::createSaturateFilter(0))); - EXPECT_TRUE(isCombined(WebFilterOperation::createSaturateFilter(0.3))); + EXPECT_TRUE(isCombined(WebFilterOperation::createSaturateFilter(0.3f))); EXPECT_TRUE(isCombined(WebFilterOperation::createSaturateFilter(0.5))); EXPECT_TRUE(isCombined(WebFilterOperation::createSaturateFilter(1))); EXPECT_TRUE(isCombined(WebFilterOperation::createInvertFilter(0))); - EXPECT_TRUE(isCombined(WebFilterOperation::createInvertFilter(0.3))); + EXPECT_TRUE(isCombined(WebFilterOperation::createInvertFilter(0.3f))); EXPECT_TRUE(isCombined(WebFilterOperation::createInvertFilter(0.5))); EXPECT_TRUE(isCombined(WebFilterOperation::createInvertFilter(1))); EXPECT_TRUE(isCombined(WebFilterOperation::createContrastFilter(0))); - EXPECT_TRUE(isCombined(WebFilterOperation::createContrastFilter(0.3))); + EXPECT_TRUE(isCombined(WebFilterOperation::createContrastFilter(0.3f))); EXPECT_TRUE(isCombined(WebFilterOperation::createContrastFilter(0.5))); EXPECT_TRUE(isCombined(WebFilterOperation::createContrastFilter(1))); EXPECT_TRUE(isCombined(WebFilterOperation::createOpacityFilter(0))); - EXPECT_TRUE(isCombined(WebFilterOperation::createOpacityFilter(0.3))); + EXPECT_TRUE(isCombined(WebFilterOperation::createOpacityFilter(0.3f))); EXPECT_TRUE(isCombined(WebFilterOperation::createOpacityFilter(0.5))); EXPECT_TRUE(isCombined(WebFilterOperation::createOpacityFilter(1))); diff --git a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp index ad8df2595..a6a422e32 100644 --- a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp +++ b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp @@ -24,11 +24,11 @@ #include "config.h" -#include "cc/CCRenderSurface.h" +#include "CCRenderSurface.h" -#include "cc/CCLayerImpl.h" -#include "cc/CCSharedQuadState.h" -#include "cc/CCSingleThreadProxy.h" +#include "CCLayerImpl.h" +#include "CCSharedQuadState.h" +#include "CCSingleThreadProxy.h" #include <gmock/gmock.h> #include <gtest/gtest.h> #include <public/WebTransformationMatrix.h> diff --git a/Source/WebKit/chromium/tests/CCResourceProviderTest.cpp b/Source/WebKit/chromium/tests/CCResourceProviderTest.cpp index 42277459a..9e8599c0f 100644 --- a/Source/WebKit/chromium/tests/CCResourceProviderTest.cpp +++ b/Source/WebKit/chromium/tests/CCResourceProviderTest.cpp @@ -24,13 +24,13 @@ #include "config.h" -#include "cc/CCResourceProvider.h" +#include "CCResourceProvider.h" +#include "CCGraphicsContext.h" +#include "CCSingleThreadProxy.h" // For DebugScopedSetImplThread #include "CompositorFakeWebGraphicsContext3D.h" #include "Extensions3DChromium.h" #include "FakeWebCompositorOutputSurface.h" -#include "cc/CCGraphicsContext.h" -#include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread #include <gtest/gtest.h> #include <public/WebGraphicsContext3D.h> #include <wtf/HashMap.h> @@ -42,9 +42,98 @@ using namespace WebKit; namespace { +size_t textureSize(const IntSize& size, WGC3Denum format) +{ + unsigned int componentsPerPixel = 4; + unsigned int bytesPerComponent = 1; + GraphicsContext3D::computeFormatAndTypeParameters(format, GraphicsContext3D::UNSIGNED_BYTE, &componentsPerPixel, &bytesPerComponent); + return size.width() * size.height() * componentsPerPixel * bytesPerComponent; +} + +struct Texture { + Texture(const IntSize& size, WGC3Denum format) + : size(size) + , format(format) + , data(adoptArrayPtr(new uint8_t[textureSize(size, format)])) + { + } + + IntSize size; + WGC3Denum format; + OwnArrayPtr<uint8_t> data; +}; + +// Shared data between multiple ResourceProviderContext. This contains mailbox +// contents as well as information about sync points. +class ContextSharedData { +public: + static PassOwnPtr<ContextSharedData> create() { return adoptPtr(new ContextSharedData()); } + + unsigned insertSyncPoint() { return m_nextSyncPoint++; } + + void genMailbox(WGC3Dbyte* mailbox) + { + memset(mailbox, 0, sizeof(WGC3Dbyte[64])); + memcpy(mailbox, &m_nextMailBox, sizeof(m_nextMailBox)); + ++m_nextMailBox; + } + + void produceTexture(const WGC3Dbyte* mailboxName, unsigned syncPoint, PassOwnPtr<Texture> texture) + { + unsigned mailbox = 0; + memcpy(&mailbox, mailboxName, sizeof(mailbox)); + ASSERT(mailbox && mailbox < m_nextMailBox); + m_textures.set(mailbox, texture); + ASSERT(m_syncPointForMailbox.get(mailbox) < syncPoint); + m_syncPointForMailbox.set(mailbox, syncPoint); + } + + PassOwnPtr<Texture> consumeTexture(const WGC3Dbyte* mailboxName, unsigned syncPoint) + { + unsigned mailbox = 0; + memcpy(&mailbox, mailboxName, sizeof(mailbox)); + ASSERT(mailbox && mailbox < m_nextMailBox); + + // If the latest sync point the context has waited on is before the sync + // point for when the mailbox was set, pretend we never saw that + // produceTexture. + if (m_syncPointForMailbox.get(mailbox) < syncPoint) + return nullptr; + return m_textures.take(mailbox); + } + +private: + ContextSharedData() + : m_nextSyncPoint(1) + , m_nextMailBox(1) + { } + + unsigned m_nextSyncPoint; + unsigned m_nextMailBox; + typedef HashMap<unsigned, OwnPtr<Texture> > TextureMap; + TextureMap m_textures; + HashMap<unsigned, unsigned> m_syncPointForMailbox; +}; + class ResourceProviderContext : public CompositorFakeWebGraphicsContext3D { public: - static PassOwnPtr<ResourceProviderContext> create() { return adoptPtr(new ResourceProviderContext(Attributes())); } + static PassOwnPtr<ResourceProviderContext> create(ContextSharedData* sharedData) { return adoptPtr(new ResourceProviderContext(Attributes(), sharedData)); } + + virtual unsigned insertSyncPoint() + { + unsigned syncPoint = m_sharedData->insertSyncPoint(); + // Commit the produceTextureCHROMIUM calls at this point, so that + // they're associated with the sync point. + for (PendingProduceTextureList::iterator it = m_pendingProduceTextures.begin(); it != m_pendingProduceTextures.end(); ++it) + m_sharedData->produceTexture((*it)->mailbox, syncPoint, (*it)->texture.release()); + m_pendingProduceTextures.clear(); + return syncPoint; + } + + virtual void waitSyncPoint(unsigned syncPoint) + { + m_lastWaitedSyncPoint = std::max(syncPoint, m_lastWaitedSyncPoint); + } virtual void bindTexture(WGC3Denum target, WebGLId texture) { @@ -113,6 +202,29 @@ public: setPixels(xoffset, yoffset, width, height, pixels); } + virtual void genMailboxCHROMIUM(WGC3Dbyte* mailbox) { return m_sharedData->genMailbox(mailbox); } + virtual void produceTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) + { + ASSERT(m_currentTexture); + ASSERT(target == GraphicsContext3D::TEXTURE_2D); + + // Delay movind the texture into the mailbox until the next + // insertSyncPoint, so that it is not visible to other contexts that + // haven't waited on that sync point. + OwnPtr<PendingProduceTexture> pending(adoptPtr(new PendingProduceTexture)); + memcpy(pending->mailbox, mailbox, sizeof(pending->mailbox)); + pending->texture = m_textures.take(m_currentTexture); + m_textures.set(m_currentTexture, nullptr); + m_pendingProduceTextures.append(pending.release()); + } + + virtual void consumeTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) + { + ASSERT(m_currentTexture); + ASSERT(target == GraphicsContext3D::TEXTURE_2D); + m_textures.set(m_currentTexture, m_sharedData->consumeTexture(mailbox, m_lastWaitedSyncPoint)); + } + void getPixels(const IntSize& size, WGC3Denum format, uint8_t* pixels) { ASSERT(m_currentTexture); @@ -128,34 +240,15 @@ public: return m_textures.size(); } - static size_t textureSize(const IntSize& size, WGC3Denum format) - { - unsigned int componentsPerPixel = 4; - unsigned int bytesPerComponent = 1; - GraphicsContext3D::computeFormatAndTypeParameters(format, GraphicsContext3D::UNSIGNED_BYTE, &componentsPerPixel, &bytesPerComponent); - return size.width() * size.height() * componentsPerPixel * bytesPerComponent; - } - protected: - explicit ResourceProviderContext(const Attributes& attrs) + ResourceProviderContext(const Attributes& attrs, ContextSharedData* sharedData) : CompositorFakeWebGraphicsContext3D(attrs) + , m_sharedData(sharedData) , m_currentTexture(0) + , m_lastWaitedSyncPoint(0) { } private: - struct Texture { - Texture(const IntSize& size_, WGC3Denum format_) - : size(size_) - , format(format_) - , data(adoptArrayPtr(new uint8_t[textureSize(size, format)])) - { - } - - IntSize size; - WGC3Denum format; - OwnArrayPtr<uint8_t> data; - }; - void allocateTexture(const IntSize& size, WGC3Denum format) { ASSERT(m_currentTexture); @@ -182,14 +275,23 @@ private: } typedef HashMap<WebGLId, OwnPtr<Texture> > TextureMap; + struct PendingProduceTexture { + WGC3Dbyte mailbox[64]; + OwnPtr<Texture> texture; + }; + typedef Deque<OwnPtr<PendingProduceTexture> > PendingProduceTextureList; + ContextSharedData* m_sharedData; WebGLId m_currentTexture; TextureMap m_textures; + unsigned m_lastWaitedSyncPoint; + PendingProduceTextureList m_pendingProduceTextures; }; class CCResourceProviderTest : public testing::Test { public: CCResourceProviderTest() - : m_context(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create())) + : m_sharedData(ContextSharedData::create()) + , m_context(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()))) , m_resourceProvider(CCResourceProvider::create(m_context.get())) { } @@ -206,6 +308,7 @@ public: protected: DebugScopedSetImplThread implThread; + OwnPtr<ContextSharedData> m_sharedData; OwnPtr<CCGraphicsContext> m_context; OwnPtr<CCResourceProvider> m_resourceProvider; }; @@ -215,7 +318,7 @@ TEST_F(CCResourceProviderTest, Basic) IntSize size(1, 1); WGC3Denum format = GraphicsContext3D::RGBA; int pool = 1; - size_t pixelSize = ResourceProviderContext::textureSize(size, format); + size_t pixelSize = textureSize(size, format); ASSERT_EQ(4U, pixelSize); CCResourceProvider::ResourceId id = m_resourceProvider->createResource(pool, size, format, CCResourceProvider::TextureUsageAny); @@ -223,7 +326,7 @@ TEST_F(CCResourceProviderTest, Basic) uint8_t data[4] = {1, 2, 3, 4}; IntRect rect(IntPoint(), size); - m_resourceProvider->upload(id, data, rect, rect, rect); + m_resourceProvider->upload(id, data, rect, rect, IntSize()); uint8_t result[4] = {0}; getResourcePixels(id, size, format, result); @@ -256,14 +359,14 @@ TEST_F(CCResourceProviderTest, Upload) IntSize size(2, 2); WGC3Denum format = GraphicsContext3D::RGBA; int pool = 1; - size_t pixelSize = ResourceProviderContext::textureSize(size, format); + size_t pixelSize = textureSize(size, format); ASSERT_EQ(16U, pixelSize); CCResourceProvider::ResourceId id = m_resourceProvider->createResource(pool, size, format, CCResourceProvider::TextureUsageAny); uint8_t image[16] = {0}; IntRect imageRect(IntPoint(), size); - m_resourceProvider->upload(id, image, imageRect, imageRect, imageRect); + m_resourceProvider->upload(id, image, imageRect, imageRect, IntSize()); for (uint8_t i = 0 ; i < pixelSize; ++i) image[i] = i; @@ -271,8 +374,8 @@ TEST_F(CCResourceProviderTest, Upload) uint8_t result[16] = {0}; { IntRect sourceRect(0, 0, 1, 1); - IntRect destRect(0, 0, 1, 1); - m_resourceProvider->upload(id, image, imageRect, sourceRect, destRect); + IntSize destOffset(0, 0); + m_resourceProvider->upload(id, image, imageRect, sourceRect, destOffset); uint8_t expected[16] = {0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -281,8 +384,8 @@ TEST_F(CCResourceProviderTest, Upload) } { IntRect sourceRect(0, 0, 1, 1); - IntRect destRect(1, 1, 1, 1); - m_resourceProvider->upload(id, image, imageRect, sourceRect, destRect); + IntSize destOffset(1, 1); + m_resourceProvider->upload(id, image, imageRect, sourceRect, destOffset); uint8_t expected[16] = {0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3}; @@ -291,8 +394,8 @@ TEST_F(CCResourceProviderTest, Upload) } { IntRect sourceRect(1, 0, 1, 1); - IntRect destRect(0, 1, 1, 1); - m_resourceProvider->upload(id, image, imageRect, sourceRect, destRect); + IntSize destOffset(0, 1); + m_resourceProvider->upload(id, image, imageRect, sourceRect, destOffset); uint8_t expected[16] = {0, 1, 2, 3, 0, 0, 0, 0, 4, 5, 6, 7, 0, 1, 2, 3}; @@ -303,4 +406,117 @@ TEST_F(CCResourceProviderTest, Upload) m_resourceProvider->deleteResource(id); } +TEST_F(CCResourceProviderTest, TransferResources) +{ + OwnPtr<CCGraphicsContext> childContext(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get()))); + OwnPtr<CCResourceProvider> childResourceProvider(CCResourceProvider::create(childContext.get())); + + IntSize size(1, 1); + WGC3Denum format = GraphicsContext3D::RGBA; + int pool = 1; + size_t pixelSize = textureSize(size, format); + ASSERT_EQ(4U, pixelSize); + + CCResourceProvider::ResourceId id1 = childResourceProvider->createResource(pool, size, format, CCResourceProvider::TextureUsageAny); + uint8_t data1[4] = {1, 2, 3, 4}; + IntRect rect(IntPoint(), size); + childResourceProvider->upload(id1, data1, rect, rect, IntSize()); + + CCResourceProvider::ResourceId id2 = childResourceProvider->createResource(pool, size, format, CCResourceProvider::TextureUsageAny); + uint8_t data2[4] = {5, 5, 5, 5}; + childResourceProvider->upload(id2, data2, rect, rect, IntSize()); + + int childPool = 2; + int childId = m_resourceProvider->createChild(childPool); + + { + // Transfer some resources to the parent. + CCResourceProvider::ResourceIdArray resourceIdsToTransfer; + resourceIdsToTransfer.append(id1); + resourceIdsToTransfer.append(id2); + CCResourceProvider::TransferableResourceList list = childResourceProvider->prepareSendToParent(resourceIdsToTransfer); + EXPECT_NE(0u, list.syncPoint); + EXPECT_EQ(2u, list.resources.size()); + EXPECT_TRUE(childResourceProvider->inUseByConsumer(id1)); + EXPECT_TRUE(childResourceProvider->inUseByConsumer(id2)); + m_resourceProvider->receiveFromChild(childId, list); + } + + EXPECT_EQ(2u, m_resourceProvider->numResources()); + EXPECT_EQ(2u, m_resourceProvider->mailboxCount()); + CCResourceProvider::ResourceIdMap resourceMap = m_resourceProvider->getChildToParentMap(childId); + CCResourceProvider::ResourceId mappedId1 = resourceMap.get(id1); + CCResourceProvider::ResourceId mappedId2 = resourceMap.get(id2); + EXPECT_NE(0u, mappedId1); + EXPECT_NE(0u, mappedId2); + EXPECT_FALSE(m_resourceProvider->inUseByConsumer(id1)); + EXPECT_FALSE(m_resourceProvider->inUseByConsumer(id2)); + + uint8_t result[4] = {0}; + getResourcePixels(mappedId1, size, format, result); + EXPECT_EQ(0, memcmp(data1, result, pixelSize)); + + getResourcePixels(mappedId2, size, format, result); + EXPECT_EQ(0, memcmp(data2, result, pixelSize)); + + { + // Check that transfering again the same resource from the child to the + // parent is a noop. + CCResourceProvider::ResourceIdArray resourceIdsToTransfer; + resourceIdsToTransfer.append(id1); + CCResourceProvider::TransferableResourceList list = childResourceProvider->prepareSendToParent(resourceIdsToTransfer); + EXPECT_EQ(0u, list.syncPoint); + EXPECT_EQ(0u, list.resources.size()); + } + + { + // Transfer resources back from the parent to the child. + CCResourceProvider::ResourceIdArray resourceIdsToTransfer; + resourceIdsToTransfer.append(mappedId1); + resourceIdsToTransfer.append(mappedId2); + CCResourceProvider::TransferableResourceList list = m_resourceProvider->prepareSendToChild(childId, resourceIdsToTransfer); + EXPECT_NE(0u, list.syncPoint); + EXPECT_EQ(2u, list.resources.size()); + childResourceProvider->receiveFromParent(list); + } + EXPECT_EQ(0u, m_resourceProvider->mailboxCount()); + EXPECT_EQ(2u, childResourceProvider->mailboxCount()); + EXPECT_FALSE(childResourceProvider->inUseByConsumer(id1)); + EXPECT_FALSE(childResourceProvider->inUseByConsumer(id2)); + + ResourceProviderContext* childContext3D = static_cast<ResourceProviderContext*>(childContext->context3D()); + { + CCScopedLockResourceForRead 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); + ASSERT_NE(0U, lock.textureId()); + childContext3D->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.textureId()); + childContext3D->getPixels(size, format, result); + EXPECT_EQ(0, memcmp(data2, result, pixelSize)); + } + + { + // Transfer resources to the parent again. + CCResourceProvider::ResourceIdArray resourceIdsToTransfer; + resourceIdsToTransfer.append(id1); + resourceIdsToTransfer.append(id2); + CCResourceProvider::TransferableResourceList list = childResourceProvider->prepareSendToParent(resourceIdsToTransfer); + EXPECT_NE(0u, list.syncPoint); + EXPECT_EQ(2u, list.resources.size()); + EXPECT_TRUE(childResourceProvider->inUseByConsumer(id1)); + EXPECT_TRUE(childResourceProvider->inUseByConsumer(id2)); + m_resourceProvider->receiveFromChild(childId, list); + } + + EXPECT_EQ(2u, m_resourceProvider->numResources()); + m_resourceProvider->destroyChild(childId); + EXPECT_EQ(0u, m_resourceProvider->numResources()); + EXPECT_EQ(0u, m_resourceProvider->mailboxCount()); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp b/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp index 2e31d44d0..563c2c04c 100644 --- a/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp +++ b/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp @@ -24,7 +24,7 @@ #include "config.h" -#include "cc/CCSchedulerStateMachine.h" +#include "CCSchedulerStateMachine.h" #include <gtest/gtest.h> #include <wtf/text/CString.h> diff --git a/Source/WebKit/chromium/tests/CCSchedulerTest.cpp b/Source/WebKit/chromium/tests/CCSchedulerTest.cpp index 41250884b..93ff66ea2 100644 --- a/Source/WebKit/chromium/tests/CCSchedulerTest.cpp +++ b/Source/WebKit/chromium/tests/CCSchedulerTest.cpp @@ -24,7 +24,7 @@ #include "config.h" -#include "cc/CCScheduler.h" +#include "CCScheduler.h" #include "CCSchedulerTestCommon.h" #include <gmock/gmock.h> @@ -81,7 +81,7 @@ public: return CCScheduledActionDrawAndSwapResult(true, m_swapWillHappenIfDrawHappens); } - virtual void scheduledActionUpdateMoreResources() OVERRIDE { m_actions.push_back("scheduledActionUpdateMoreResources"); } + virtual void scheduledActionUpdateMoreResources(double) OVERRIDE { m_actions.push_back("scheduledActionUpdateMoreResources"); } virtual void scheduledActionCommit() OVERRIDE { m_actions.push_back("scheduledActionCommit"); } virtual void scheduledActionBeginContextRecreation() OVERRIDE { m_actions.push_back("scheduledActionBeginContextRecreation"); } virtual void scheduledActionAcquireLayerTexturesForMainThread() OVERRIDE { m_actions.push_back("scheduledActionAcquireLayerTexturesForMainThread"); } @@ -114,12 +114,10 @@ TEST(CCSchedulerTest, RequestCommit) client.reset(); // Since, hasMoreResourceUpdates is set to false, - // beginFrameComplete should updateMoreResources, then - // commit + // beginFrameComplete should commit scheduler->beginFrameComplete(); - EXPECT_EQ(2, client.numActions()); - EXPECT_STREQ("scheduledActionUpdateMoreResources", client.action(0)); - EXPECT_STREQ("scheduledActionCommit", client.action(1)); + EXPECT_EQ(1, client.numActions()); + EXPECT_STREQ("scheduledActionCommit", client.action(0)); EXPECT_TRUE(timeSource->active()); client.reset(); @@ -152,12 +150,10 @@ TEST(CCSchedulerTest, RequestCommitAfterBeginFrame) scheduler->setNeedsCommit(); // Since, hasMoreResourceUpdates is set to false, and another commit is - // needed, beginFrameComplete should updateMoreResources, then commit, then - // begin another frame. + // needed, beginFrameComplete should commit, then begin another frame. scheduler->beginFrameComplete(); - EXPECT_EQ(2, client.numActions()); - EXPECT_STREQ("scheduledActionUpdateMoreResources", client.action(0)); - EXPECT_STREQ("scheduledActionCommit", client.action(1)); + EXPECT_EQ(1, client.numActions()); + EXPECT_STREQ("scheduledActionCommit", client.action(0)); client.reset(); // Tick should draw but then begin another frame. @@ -257,7 +253,7 @@ public: return CCScheduledActionDrawAndSwapResult(true, true); } - virtual void scheduledActionUpdateMoreResources() OVERRIDE { } + virtual void scheduledActionUpdateMoreResources(double) OVERRIDE { } virtual void scheduledActionCommit() OVERRIDE { } virtual void scheduledActionBeginContextRecreation() OVERRIDE { } @@ -357,7 +353,7 @@ public: return CCScheduledActionDrawAndSwapResult(true, true); } - virtual void scheduledActionUpdateMoreResources() OVERRIDE { } + virtual void scheduledActionUpdateMoreResources(double) OVERRIDE { } virtual void scheduledActionCommit() OVERRIDE { } virtual void scheduledActionBeginContextRecreation() OVERRIDE { } diff --git a/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h b/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h index beb16554d..824af26c7 100644 --- a/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h +++ b/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h @@ -25,9 +25,9 @@ #ifndef CCSchedulerTestCommon_h #define CCSchedulerTestCommon_h -#include "cc/CCDelayBasedTimeSource.h" -#include "cc/CCFrameRateController.h" -#include "cc/CCThread.h" +#include "CCDelayBasedTimeSource.h" +#include "CCFrameRateController.h" +#include "CCThread.h" #include <gtest/gtest.h> #include <wtf/OwnPtr.h> @@ -96,6 +96,7 @@ class FakeCCTimeSource : public WebCore::CCTimeSource { public: FakeCCTimeSource() : m_active(false) + , m_nextTickTime(0) , m_client(0) { } virtual ~FakeCCTimeSource() { } @@ -114,8 +115,11 @@ public: m_client->onTimerTick(); } + void setNextTickTime(double nextTickTime) { m_nextTickTime = nextTickTime; } + protected: bool m_active; + double m_nextTickTime; WebCore::CCTimeSourceClient* m_client; }; @@ -126,15 +130,15 @@ public: return adoptRef(new FakeCCDelayBasedTimeSource(interval, thread)); } - void setMonotonicallyIncreasingTime(double time) { m_monotonicallyIncreasingTime = time; } - virtual double monotonicallyIncreasingTime() const { return m_monotonicallyIncreasingTime; } + void setMonotonicTimeNow(double time) { m_monotonicTimeNow = time; } + virtual double monotonicTimeNow() const OVERRIDE { return m_monotonicTimeNow; } protected: FakeCCDelayBasedTimeSource(double interval, WebCore::CCThread* thread) : CCDelayBasedTimeSource(interval, thread) - , m_monotonicallyIncreasingTime(0) { } + , m_monotonicTimeNow(0) { } - double m_monotonicallyIncreasingTime; + double m_monotonicTimeNow; }; class FakeCCFrameRateController : public WebCore::CCFrameRateController { diff --git a/Source/WebKit/chromium/tests/CCScopedTextureTest.cpp b/Source/WebKit/chromium/tests/CCScopedTextureTest.cpp index 505ae9625..56568f8f8 100644 --- a/Source/WebKit/chromium/tests/CCScopedTextureTest.cpp +++ b/Source/WebKit/chromium/tests/CCScopedTextureTest.cpp @@ -24,14 +24,13 @@ #include "config.h" -#include "cc/CCScopedTexture.h" +#include "CCScopedTexture.h" +#include "CCRenderer.h" +#include "CCSingleThreadProxy.h" // For DebugScopedSetImplThread #include "CCTiledLayerTestCommon.h" #include "FakeCCGraphicsContext.h" #include "GraphicsContext3D.h" -#include "cc/CCRenderer.h" -#include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread - #include <gtest/gtest.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/tests/CCScrollbarAnimationControllerLinearFadeTest.cpp b/Source/WebKit/chromium/tests/CCScrollbarAnimationControllerLinearFadeTest.cpp index e6cdc24c1..61e5f4400 100644 --- a/Source/WebKit/chromium/tests/CCScrollbarAnimationControllerLinearFadeTest.cpp +++ b/Source/WebKit/chromium/tests/CCScrollbarAnimationControllerLinearFadeTest.cpp @@ -24,10 +24,10 @@ #include "config.h" -#include "cc/CCScrollbarAnimationControllerLinearFade.h" +#include "CCScrollbarAnimationControllerLinearFade.h" -#include "cc/CCScrollbarLayerImpl.h" -#include "cc/CCSingleThreadProxy.h" +#include "CCScrollbarLayerImpl.h" +#include "CCSingleThreadProxy.h" #include <gtest/gtest.h> #include <wtf/OwnPtr.h> @@ -84,9 +84,11 @@ TEST_F(CCScrollbarAnimationControllerLinearFadeTest, verifyAwakenByScroll) m_scrollbarController->animate(3); EXPECT_FLOAT_EQ(1, m_scrollbarLayer->opacity()); m_scrollbarController->animate(4); - EXPECT_FLOAT_EQ(2 / 3.0, m_scrollbarLayer->opacity()); + // Note that we use 3.0f to avoid "argument is truncated from 'double' to + // 'float'" warnings on Windows. + EXPECT_FLOAT_EQ(2 / 3.0f, m_scrollbarLayer->opacity()); m_scrollbarController->animate(5); - EXPECT_FLOAT_EQ(1 / 3.0, m_scrollbarLayer->opacity()); + EXPECT_FLOAT_EQ(1 / 3.0f, m_scrollbarLayer->opacity()); m_scrollLayer->setScrollDelta(IntSize(3, 3)); m_scrollbarController->updateScrollOffsetAtTime(m_scrollLayer.get(), 5); m_scrollbarController->animate(6); @@ -94,9 +96,9 @@ TEST_F(CCScrollbarAnimationControllerLinearFadeTest, verifyAwakenByScroll) m_scrollbarController->animate(7); EXPECT_FLOAT_EQ(1, m_scrollbarLayer->opacity()); m_scrollbarController->animate(8); - EXPECT_FLOAT_EQ(2 / 3.0, m_scrollbarLayer->opacity()); + EXPECT_FLOAT_EQ(2 / 3.0f, m_scrollbarLayer->opacity()); m_scrollbarController->animate(9); - EXPECT_FLOAT_EQ(1 / 3.0, m_scrollbarLayer->opacity()); + EXPECT_FLOAT_EQ(1 / 3.0f, m_scrollbarLayer->opacity()); m_scrollbarController->animate(10); EXPECT_FLOAT_EQ(0, m_scrollbarLayer->opacity()); } @@ -127,9 +129,9 @@ TEST_F(CCScrollbarAnimationControllerLinearFadeTest, verifyForceAwakenByPinch) m_scrollbarController->animate(8); EXPECT_FLOAT_EQ(1, m_scrollbarLayer->opacity()); m_scrollbarController->animate(9); - EXPECT_FLOAT_EQ(2 / 3.0, m_scrollbarLayer->opacity()); + EXPECT_FLOAT_EQ(2 / 3.0f, m_scrollbarLayer->opacity()); m_scrollbarController->animate(10); - EXPECT_FLOAT_EQ(1 / 3.0, m_scrollbarLayer->opacity()); + EXPECT_FLOAT_EQ(1 / 3.0f, m_scrollbarLayer->opacity()); m_scrollbarController->animate(11); EXPECT_FLOAT_EQ(0, m_scrollbarLayer->opacity()); diff --git a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp index 141a96328..1eba991c3 100644 --- a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp @@ -24,13 +24,12 @@ #include "config.h" -#include "cc/CCSolidColorLayerImpl.h" +#include "CCSolidColorLayerImpl.h" #include "CCLayerTestCommon.h" +#include "CCSingleThreadProxy.h" +#include "CCSolidColorDrawQuad.h" #include "MockCCQuadCuller.h" -#include "cc/CCSingleThreadProxy.h" -#include "cc/CCSolidColorDrawQuad.h" - #include <gmock/gmock.h> #include <gtest/gtest.h> diff --git a/Source/WebKit/chromium/tests/CCTestCommon.h b/Source/WebKit/chromium/tests/CCTestCommon.h index 89fce9818..d2c830c98 100644 --- a/Source/WebKit/chromium/tests/CCTestCommon.h +++ b/Source/WebKit/chromium/tests/CCTestCommon.h @@ -25,7 +25,7 @@ #ifndef CCTestCommon_h #define CCTestCommon_h -#include "cc/CCSettings.h" +#include "CCSettings.h" namespace WebKitTests { diff --git a/Source/WebKit/chromium/tests/CCTextureUpdateControllerTest.cpp b/Source/WebKit/chromium/tests/CCTextureUpdateControllerTest.cpp index a0dc2ec1f..11659f6f5 100644 --- a/Source/WebKit/chromium/tests/CCTextureUpdateControllerTest.cpp +++ b/Source/WebKit/chromium/tests/CCTextureUpdateControllerTest.cpp @@ -24,17 +24,16 @@ #include "config.h" -#include "cc/CCTextureUpdateController.h" +#include "CCTextureUpdateController.h" #include "CCSchedulerTestCommon.h" +#include "CCSingleThreadProxy.h" // For DebugScopedSetImplThread #include "CCTiledLayerTestCommon.h" #include "FakeWebCompositorOutputSurface.h" #include "FakeWebGraphicsContext3D.h" -#include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread +#include <gtest/gtest.h> #include <public/WebCompositor.h> #include <public/WebThread.h> - -#include <gtest/gtest.h> #include <wtf/RefPtr.h> using namespace WebCore; @@ -89,7 +88,7 @@ private: class TextureForUploadTest : public LayerTextureUpdater::Texture { public: TextureForUploadTest() : LayerTextureUpdater::Texture(adoptPtr<CCPrioritizedTexture>(0)) { } - virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntRect& destRect) { } + virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntSize& destOffset) { } }; @@ -190,7 +189,7 @@ protected: m_totalUploadCountExpected += count; const IntRect rect(0, 0, 300, 150); - const TextureUploader::Parameters upload = { &m_texture, rect, rect }; + const TextureUploader::Parameters upload = { &m_texture, rect, IntSize() }; for (int i = 0; i < count; i++) m_queue->appendFullUpload(upload); } @@ -201,7 +200,7 @@ protected: m_totalUploadCountExpected += count; const IntRect rect(0, 0, 100, 100); - const TextureUploader::Parameters upload = { &m_texture, rect, rect }; + const TextureUploader::Parameters upload = { &m_texture, rect, IntSize() }; for (int i = 0; i < count; i++) m_queue->appendPartialUpload(upload); } @@ -542,4 +541,148 @@ TEST_F(CCTextureUpdateControllerTest, TripleUpdateFinalUpdateAllPartial) EXPECT_EQ(kFullUploads + kPartialUploads, m_numTotalUploads); } +class FakeCCTextureUpdateController : public WebCore::CCTextureUpdateController { +public: + static PassOwnPtr<FakeCCTextureUpdateController> create(WebCore::CCThread* thread, PassOwnPtr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider, TextureCopier* copier, TextureUploader* uploader) + { + return adoptPtr(new FakeCCTextureUpdateController(thread, queue, resourceProvider, copier, uploader)); + } + + void setMonotonicTimeNow(double time) { m_monotonicTimeNow = time; } + virtual double monotonicTimeNow() const OVERRIDE { return m_monotonicTimeNow; } + void setUpdateMoreTexturesTime(double time) { m_updateMoreTexturesTime = time; } + virtual double updateMoreTexturesTime() const OVERRIDE { return m_updateMoreTexturesTime; } + void setUpdateMoreTexturesSize(size_t size) { m_updateMoreTexturesSize = size; } + virtual size_t updateMoreTexturesSize() const OVERRIDE { return m_updateMoreTexturesSize; } + +protected: + FakeCCTextureUpdateController(WebCore::CCThread* thread, PassOwnPtr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider, TextureCopier* copier, TextureUploader* uploader) + : WebCore::CCTextureUpdateController(thread, queue, resourceProvider, copier, uploader) + , m_monotonicTimeNow(0) + , m_updateMoreTexturesTime(0) + , m_updateMoreTexturesSize(0) { } + + double m_monotonicTimeNow; + double m_updateMoreTexturesTime; + size_t m_updateMoreTexturesSize; +}; + +TEST_F(CCTextureUpdateControllerTest, UpdateMoreTextures) +{ + FakeCCThread thread; + + setMaxUploadCountPerUpdate(1); + appendFullUploadsToUpdateQueue(3); + appendPartialUploadsToUpdateQueue(0); + + DebugScopedSetImplThread implThread; + OwnPtr<FakeCCTextureUpdateController> controller(FakeCCTextureUpdateController::create(&thread, m_queue.release(), m_resourceProvider.get(), &m_copier, &m_uploader)); + + controller->setMonotonicTimeNow(0); + controller->setUpdateMoreTexturesTime(0.1); + controller->setUpdateMoreTexturesSize(1); + // Not enough time for any updates. + controller->updateMoreTextures(0.09); + EXPECT_FALSE(thread.hasPendingTask()); + EXPECT_EQ(0, m_numBeginUploads); + EXPECT_EQ(0, m_numEndUploads); + + thread.reset(); + controller->setMonotonicTimeNow(0); + controller->setUpdateMoreTexturesTime(0.1); + controller->setUpdateMoreTexturesSize(1); + // Only enough time for 1 update. + controller->updateMoreTextures(0.12); + EXPECT_TRUE(thread.hasPendingTask()); + controller->setMonotonicTimeNow(thread.pendingDelayMs() / 1000.0); + thread.runPendingTask(); + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(1, m_numTotalUploads); + + thread.reset(); + controller->setMonotonicTimeNow(0); + controller->setUpdateMoreTexturesTime(0.1); + controller->setUpdateMoreTexturesSize(1); + // Enough time for 2 updates. + controller->updateMoreTextures(0.22); + EXPECT_TRUE(thread.hasPendingTask()); + controller->setMonotonicTimeNow(controller->monotonicTimeNow() + thread.pendingDelayMs() / 1000.0); + thread.runPendingTask(); + EXPECT_EQ(3, m_numBeginUploads); + EXPECT_EQ(3, m_numEndUploads); + EXPECT_EQ(3, m_numTotalUploads); +} + +TEST_F(CCTextureUpdateControllerTest, NoMoreUpdates) +{ + FakeCCThread thread; + + setMaxUploadCountPerUpdate(1); + appendFullUploadsToUpdateQueue(2); + appendPartialUploadsToUpdateQueue(0); + + DebugScopedSetImplThread implThread; + OwnPtr<FakeCCTextureUpdateController> controller(FakeCCTextureUpdateController::create(&thread, m_queue.release(), m_resourceProvider.get(), &m_copier, &m_uploader)); + + controller->setMonotonicTimeNow(0); + controller->setUpdateMoreTexturesTime(0.1); + controller->setUpdateMoreTexturesSize(1); + // Enough time for 3 updates but only 2 necessary. + controller->updateMoreTextures(0.31); + EXPECT_TRUE(thread.hasPendingTask()); + controller->setMonotonicTimeNow(controller->monotonicTimeNow() + thread.pendingDelayMs() / 1000.0); + thread.runPendingTask(); + EXPECT_TRUE(thread.hasPendingTask()); + controller->setMonotonicTimeNow(controller->monotonicTimeNow() + thread.pendingDelayMs() / 1000.0); + thread.runPendingTask(); + EXPECT_EQ(2, m_numBeginUploads); + EXPECT_EQ(2, m_numEndUploads); + EXPECT_EQ(2, m_numTotalUploads); + + thread.reset(); + controller->setMonotonicTimeNow(0); + controller->setUpdateMoreTexturesTime(0.1); + controller->setUpdateMoreTexturesSize(1); + // Enough time for updates but no more updates left. + controller->updateMoreTextures(0.31); + EXPECT_FALSE(thread.hasPendingTask()); + EXPECT_EQ(2, m_numBeginUploads); + EXPECT_EQ(2, m_numEndUploads); + EXPECT_EQ(2, m_numTotalUploads); +} + +TEST_F(CCTextureUpdateControllerTest, UpdatesCompleteInFiniteTime) +{ + FakeCCThread thread; + + setMaxUploadCountPerUpdate(1); + appendFullUploadsToUpdateQueue(2); + appendPartialUploadsToUpdateQueue(0); + + DebugScopedSetImplThread implThread; + OwnPtr<FakeCCTextureUpdateController> controller(FakeCCTextureUpdateController::create(&thread, m_queue.release(), m_resourceProvider.get(), &m_copier, &m_uploader)); + + controller->setMonotonicTimeNow(0); + controller->setUpdateMoreTexturesTime(0.5); + controller->setUpdateMoreTexturesSize(1); + + for (int i = 0; i < 100; i++) { + if (!controller->hasMoreUpdates()) + break; + + // Not enough time for any updates. + controller->updateMoreTextures(0.4); + + if (thread.hasPendingTask()) { + controller->setMonotonicTimeNow(controller->monotonicTimeNow() + thread.pendingDelayMs() / 1000.0); + thread.runPendingTask(); + } + } + + EXPECT_EQ(2, m_numBeginUploads); + EXPECT_EQ(2, m_numEndUploads); + EXPECT_EQ(2, m_numTotalUploads); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/CCThreadTaskTest.cpp b/Source/WebKit/chromium/tests/CCThreadTaskTest.cpp index d9943e713..820a7b710 100644 --- a/Source/WebKit/chromium/tests/CCThreadTaskTest.cpp +++ b/Source/WebKit/chromium/tests/CCThreadTaskTest.cpp @@ -24,7 +24,7 @@ #include "config.h" -#include "cc/CCThreadTask.h" +#include "CCThreadTask.h" #include <gmock/gmock.h> #include <gtest/gtest.h> diff --git a/Source/WebKit/chromium/tests/CCThreadedTest.cpp b/Source/WebKit/chromium/tests/CCThreadedTest.cpp index 89ff9cba3..cde88f8e6 100644 --- a/Source/WebKit/chromium/tests/CCThreadedTest.cpp +++ b/Source/WebKit/chromium/tests/CCThreadedTest.cpp @@ -26,22 +26,22 @@ #include "CCThreadedTest.h" +#include "CCActiveAnimation.h" #include "CCAnimationTestCommon.h" +#include "CCLayerAnimationController.h" +#include "CCLayerImpl.h" +#include "CCLayerTreeHostImpl.h" #include "CCOcclusionTrackerTestCommon.h" +#include "CCScopedThreadProxy.h" +#include "CCSingleThreadProxy.h" +#include "CCTextureUpdateQueue.h" +#include "CCThreadTask.h" #include "CCTiledLayerTestCommon.h" +#include "CCTimingFunction.h" #include "ContentLayerChromium.h" #include "FakeWebCompositorOutputSurface.h" #include "FakeWebGraphicsContext3D.h" #include "LayerChromium.h" -#include "cc/CCActiveAnimation.h" -#include "cc/CCLayerAnimationController.h" -#include "cc/CCLayerImpl.h" -#include "cc/CCLayerTreeHostImpl.h" -#include "cc/CCScopedThreadProxy.h" -#include "cc/CCSingleThreadProxy.h" -#include "cc/CCTextureUpdateQueue.h" -#include "cc/CCThreadTask.h" -#include "cc/CCTimingFunction.h" #include <gmock/gmock.h> #include <public/Platform.h> #include <public/WebCompositor.h> diff --git a/Source/WebKit/chromium/tests/CCThreadedTest.h b/Source/WebKit/chromium/tests/CCThreadedTest.h index 946b65fd1..0f87de1f5 100644 --- a/Source/WebKit/chromium/tests/CCThreadedTest.h +++ b/Source/WebKit/chromium/tests/CCThreadedTest.h @@ -25,10 +25,10 @@ #ifndef CCThreadedTest_h #define CCThreadedTest_h +#include "CCLayerTreeHost.h" +#include "CCLayerTreeHostImpl.h" +#include "CCScopedThreadProxy.h" #include "CompositorFakeWebGraphicsContext3D.h" -#include "cc/CCLayerTreeHost.h" -#include "cc/CCLayerTreeHostImpl.h" -#include "cc/CCScopedThreadProxy.h" #include <gtest/gtest.h> #include <public/WebAnimationDelegate.h> @@ -134,6 +134,7 @@ protected: static void dispatchDidAddAnimation(void* self); virtual void runTest(bool threaded); + WebKit::WebThread* webThread() const { return m_webThread.get(); } WebCore::CCLayerTreeSettings m_settings; OwnPtr<MockCCLayerTreeHostClient> m_client; diff --git a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp index 8d3ca4219..62336bb50 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp @@ -24,13 +24,13 @@ #include "config.h" -#include "cc/CCTiledLayerImpl.h" +#include "CCTiledLayerImpl.h" #include "CCLayerTestCommon.h" +#include "CCLayerTilingData.h" +#include "CCSingleThreadProxy.h" +#include "CCTileDrawQuad.h" #include "MockCCQuadCuller.h" -#include "cc/CCLayerTilingData.h" -#include "cc/CCSingleThreadProxy.h" -#include "cc/CCTileDrawQuad.h" #include <gmock/gmock.h> #include <gtest/gtest.h> diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp index 54f29bbef..58f37c694 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp @@ -40,7 +40,7 @@ FakeLayerTextureUpdater::Texture::~Texture() { } -void FakeLayerTextureUpdater::Texture::updateRect(CCResourceProvider* resourceProvider, const IntRect&, const IntRect&) +void FakeLayerTextureUpdater::Texture::updateRect(CCResourceProvider* resourceProvider, const IntRect&, const IntSize&) { texture()->acquireBackingTexture(resourceProvider); m_layer->updateRect(); diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h index c75932acf..5de1c5fb3 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h @@ -25,6 +25,11 @@ #ifndef CCTiledLayerTestCommon_h #define CCTiledLayerTestCommon_h +#include "CCGraphicsContext.h" +#include "CCPrioritizedTexture.h" +#include "CCResourceProvider.h" +#include "CCTextureUpdateQueue.h" +#include "CCTiledLayerImpl.h" #include "IntRect.h" #include "IntSize.h" #include "LayerTextureUpdater.h" @@ -32,11 +37,6 @@ #include "TextureCopier.h" #include "TextureUploader.h" #include "TiledLayerChromium.h" -#include "cc/CCGraphicsContext.h" -#include "cc/CCPrioritizedTexture.h" -#include "cc/CCResourceProvider.h" -#include "cc/CCTextureUpdateQueue.h" -#include "cc/CCTiledLayerImpl.h" namespace WebKitTests { @@ -49,7 +49,7 @@ public: Texture(FakeLayerTextureUpdater*, PassOwnPtr<WebCore::CCPrioritizedTexture>); virtual ~Texture(); - virtual void updateRect(WebCore::CCResourceProvider* , const WebCore::IntRect&, const WebCore::IntRect&) OVERRIDE; + virtual void updateRect(WebCore::CCResourceProvider* , const WebCore::IntRect&, const WebCore::IntSize&) OVERRIDE; virtual void prepareRect(const WebCore::IntRect&, WebCore::CCRenderingStats&) OVERRIDE; private: @@ -162,7 +162,7 @@ public: virtual bool isBusy() { return false; } virtual void beginUploads() { } virtual void endUploads() { } - virtual void uploadTexture(WebCore::CCResourceProvider* resourceProvider, Parameters upload) { upload.texture->updateRect(resourceProvider, upload.sourceRect, upload.destRect); } + virtual void uploadTexture(WebCore::CCResourceProvider* resourceProvider, Parameters upload) { upload.texture->updateRect(resourceProvider, upload.sourceRect, upload.destOffset); } }; } diff --git a/Source/WebKit/chromium/tests/CCTimerTest.cpp b/Source/WebKit/chromium/tests/CCTimerTest.cpp index c1b2efb77..852558885 100644 --- a/Source/WebKit/chromium/tests/CCTimerTest.cpp +++ b/Source/WebKit/chromium/tests/CCTimerTest.cpp @@ -30,7 +30,7 @@ #include "config.h" -#include "cc/CCTimer.h" +#include "CCTimer.h" #include "CCSchedulerTestCommon.h" #include <gtest/gtest.h> diff --git a/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp b/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp index fd72e96ed..6972424b0 100644 --- a/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp +++ b/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp @@ -30,10 +30,6 @@ #include "FakeWebGraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" #include "ImageBuffer.h" -#include "LayerChromium.h" -#include "cc/CCGraphicsContext.h" -#include "cc/CCRenderingStats.h" -#include "cc/CCTextureUpdateQueue.h" #include <public/Platform.h> #include <public/WebCompositor.h> #include <public/WebThread.h> @@ -75,10 +71,8 @@ protected: void fullLifecycleTest(ThreadMode threadMode, DeferralMode deferralMode) { RefPtr<GraphicsContext3D> mainContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext)); - OwnPtr<CCGraphicsContext> ccImplContext = FakeWebCompositorOutputSurface::create(adoptPtr(new MockCanvasContext)); MockCanvasContext& mainMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(mainContext.get())); - MockCanvasContext& implMock = *static_cast<MockCanvasContext*>(ccImplContext->context3D()); MockWebTextureUpdater updater; @@ -115,7 +109,6 @@ protected: EXPECT_CALL(mainMock, flush()); } bridge.clear(); - ::testing::Mock::VerifyAndClearExpectations(&implMock); WebCompositor::shutdown(); } diff --git a/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp index 007bea446..fd35e2224 100644 --- a/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp @@ -28,11 +28,10 @@ #include "BitmapCanvasLayerTextureUpdater.h" #include "CCLayerTreeTestCommon.h" +#include "CCRenderingStats.h" #include "GraphicsContext.h" #include "OpaqueRectTrackingContentLayerDelegate.h" -#include "cc/CCRenderingStats.h" #include "skia/ext/platform_canvas.h" - #include <gtest/gtest.h> #include <public/WebFloatRect.h> #include <public/WebRect.h> diff --git a/Source/WebKit/chromium/tests/FakeCCGraphicsContext.h b/Source/WebKit/chromium/tests/FakeCCGraphicsContext.h index 33c4b3046..e849ec2ed 100644 --- a/Source/WebKit/chromium/tests/FakeCCGraphicsContext.h +++ b/Source/WebKit/chromium/tests/FakeCCGraphicsContext.h @@ -26,9 +26,9 @@ #ifndef FakeCCGraphicsContext_h #define FakeCCGraphicsContext_h +#include "CCGraphicsContext.h" #include "CompositorFakeWebGraphicsContext3D.h" #include "FakeWebCompositorOutputSurface.h" -#include "cc/CCGraphicsContext.h" #include <public/WebCompositorOutputSurface.h> namespace WebKit { diff --git a/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h b/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h index 84804da96..b87305afe 100755 --- a/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h +++ b/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h @@ -27,11 +27,10 @@ #include "config.h" +#include "CCLayerTreeHost.h" #include "CompositorFakeWebGraphicsContext3D.h" #include "FakeWebCompositorOutputSurface.h" -#include "cc/CCLayerTreeHost.h" - namespace WebCore { class FakeCCLayerTreeHostClient : public CCLayerTreeHostClient { diff --git a/Source/WebKit/chromium/tests/FloatQuadTest.cpp b/Source/WebKit/chromium/tests/FloatQuadTest.cpp index 3e2f9bce6..671894a4c 100644 --- a/Source/WebKit/chromium/tests/FloatQuadTest.cpp +++ b/Source/WebKit/chromium/tests/FloatQuadTest.cpp @@ -25,7 +25,7 @@ #include "config.h" -#include "cc/CCMathUtil.h" +#include "CCMathUtil.h" #include "FloatQuad.h" #include <gtest/gtest.h> #include <public/WebTransformationMatrix.h> diff --git a/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp index 21d0705b8..26627ec8d 100644 --- a/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp @@ -26,28 +26,24 @@ #include "GraphicsLayerChromium.h" -#include "CCAnimationTestCommon.h" +#include "CCLayerTreeHost.h" +#include "CCLayerTreeHostImpl.h" +#include "CCSingleThreadProxy.h" #include "CompositorFakeWebGraphicsContext3D.h" -#include "FakeCCLayerTreeHostClient.h" -#include "GraphicsContext3D.h" -#include "GraphicsContext3DPrivate.h" #include "GraphicsLayer.h" -#include "LayerChromium.h" #include "Matrix3DTransformOperation.h" #include "RotateTransformOperation.h" #include "TranslateTransformOperation.h" -#include "cc/CCLayerTreeHost.h" -#include "cc/CCLayerTreeHostImpl.h" -#include "cc/CCSingleThreadProxy.h" -#include <public/WebCompositor.h> - +#include "WebLayerTreeViewTestCommon.h" #include <gtest/gtest.h> +#include <public/WebCompositor.h> +#include <public/WebFloatAnimationCurve.h> #include <public/WebGraphicsContext3D.h> +#include <public/WebLayerTreeView.h> #include <wtf/PassOwnPtr.h> using namespace WebCore; using namespace WebKit; -using namespace WebKitTests; namespace { @@ -61,31 +57,6 @@ class MockGraphicsLayerClient : public GraphicsLayerClient { virtual float deviceScaleFactor() const OVERRIDE { return 2; } }; -class MockLayerTreeHost : public CCLayerTreeHost { -public: - static PassOwnPtr<MockLayerTreeHost> create() - { - CCLayerTreeSettings settings; - OwnPtr<MockLayerTreeHost> layerTreeHost(adoptPtr(new MockLayerTreeHost(new FakeCCLayerTreeHostClient(), settings))); - bool success = layerTreeHost->initialize(); - EXPECT_TRUE(success); - layerTreeHost->setRootLayer(LayerChromium::create()); - layerTreeHost->setViewportSize(IntSize(1, 1), IntSize(1, 1)); - return layerTreeHost.release(); - } - - virtual PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHostImpl(CCLayerTreeHostImplClient* client) - { - return CCLayerTreeHostImpl::create(settings(), client); - } - -private: - MockLayerTreeHost(CCLayerTreeHostClient* client, const CCLayerTreeSettings& settings) - : CCLayerTreeHost(client, settings) - { - } -}; - class GraphicsLayerChromiumTest : public testing::Test { public: GraphicsLayerChromiumTest() @@ -94,15 +65,15 @@ public: WebCompositor::setAcceleratedAnimationEnabled(true); WebCompositor::initialize(0); m_graphicsLayer = static_pointer_cast<GraphicsLayerChromium>(GraphicsLayer::create(&m_client)); - m_platformLayer = m_graphicsLayer->platformLayer()->unwrap<LayerChromium>(); - m_layerTreeHost = MockLayerTreeHost::create(); - m_platformLayer->setLayerTreeHost(m_layerTreeHost.get()); + m_platformLayer = m_graphicsLayer->platformLayer(); + m_layerTreeView.initialize(&m_layerTreeViewClient, *m_platformLayer, WebLayerTreeView::Settings()); + m_layerTreeView.setViewportSize(WebSize(1, 1), WebSize(1, 1)); } virtual ~GraphicsLayerChromiumTest() { m_graphicsLayer.clear(); - m_layerTreeHost.clear(); + m_layerTreeView.reset(); WebCompositor::shutdown(); } @@ -112,318 +83,46 @@ protected: EXPECT_FLOAT_EQ(translateX, matrix.m41()); } - LayerChromium* m_platformLayer; + WebLayer* m_platformLayer; OwnPtr<GraphicsLayerChromium> m_graphicsLayer; - OwnPtr<CCLayerTreeHost> m_layerTreeHost; private: + MockWebLayerTreeViewClient m_layerTreeViewClient; + WebLayerTreeView m_layerTreeView; MockGraphicsLayerClient m_client; - DebugScopedSetMainThread m_main; }; TEST_F(GraphicsLayerChromiumTest, updateLayerPreserves3DWithAnimations) { ASSERT_FALSE(m_platformLayer->hasActiveAnimation()); - OwnPtr<CCActiveAnimation> floatAnimation(CCActiveAnimation::create(adoptPtr(new FakeFloatAnimationCurve), 0, 1, CCActiveAnimation::Opacity)); - m_platformLayer->layerAnimationController()->addAnimation(floatAnimation.release()); + WebFloatAnimationCurve curve; + curve.add(WebFloatKeyframe(0.0, 0.0)); + OwnPtr<WebAnimation> floatAnimation(adoptPtr(WebAnimation::create(curve, 1, 1, WebAnimation::TargetPropertyOpacity))); + ASSERT_TRUE(m_platformLayer->addAnimation(floatAnimation.get())); ASSERT_TRUE(m_platformLayer->hasActiveAnimation()); m_graphicsLayer->setPreserves3D(true); - m_platformLayer = m_graphicsLayer->platformLayer()->unwrap<LayerChromium>(); + m_platformLayer = m_graphicsLayer->platformLayer(); ASSERT_TRUE(m_platformLayer); ASSERT_TRUE(m_platformLayer->hasActiveAnimation()); - m_platformLayer->removeAnimation(0); + m_platformLayer->removeAnimation(1); ASSERT_FALSE(m_platformLayer->hasActiveAnimation()); m_graphicsLayer->setPreserves3D(false); - m_platformLayer = m_graphicsLayer->platformLayer()->unwrap<LayerChromium>(); + m_platformLayer = m_graphicsLayer->platformLayer(); ASSERT_TRUE(m_platformLayer); ASSERT_FALSE(m_platformLayer->hasActiveAnimation()); } -TEST_F(GraphicsLayerChromiumTest, createOpacityAnimation) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyOpacity); - values.insert(new FloatAnimationValue(0, 0)); - values.insert(new FloatAnimationValue(duration, 1)); - - RefPtr<Animation> animation = Animation::create(); - animation->setDuration(duration); - - IntSize boxSize; - bool addedAnimation = m_graphicsLayer->addAnimation(values, boxSize, animation.get(), "", 0); - - EXPECT_TRUE(addedAnimation); - - EXPECT_TRUE(m_platformLayer->layerAnimationController()->hasActiveAnimation()); - - CCActiveAnimation* activeAnimation = m_platformLayer->layerAnimationController()->getActiveAnimation(CCActiveAnimation::Opacity); - EXPECT_TRUE(activeAnimation); - - EXPECT_EQ(1, activeAnimation->iterations()); - EXPECT_EQ(CCActiveAnimation::Opacity, activeAnimation->targetProperty()); - - EXPECT_EQ(CCAnimationCurve::Float, activeAnimation->curve()->type()); - - const CCFloatAnimationCurve* curve = activeAnimation->curve()->toFloatAnimationCurve(); - EXPECT_TRUE(curve); - - EXPECT_EQ(0, curve->getValue(0)); - EXPECT_EQ(1, curve->getValue(duration)); -} - -TEST_F(GraphicsLayerChromiumTest, createTransformAnimation) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); - - TransformOperations operations1; - operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); - values.insert(new TransformAnimationValue(0, &operations1)); - - TransformOperations operations2; - operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); - values.insert(new TransformAnimationValue(duration, &operations2)); - - RefPtr<Animation> animation = Animation::create(); - animation->setDuration(duration); - - IntSize boxSize; - m_graphicsLayer->addAnimation(values, boxSize, animation.get(), "", 0); - - EXPECT_TRUE(m_platformLayer->layerAnimationController()->hasActiveAnimation()); - - CCActiveAnimation* activeAnimation = m_platformLayer->layerAnimationController()->getActiveAnimation(CCActiveAnimation::Transform); - EXPECT_TRUE(activeAnimation); - - EXPECT_EQ(1, activeAnimation->iterations()); - EXPECT_EQ(CCActiveAnimation::Transform, activeAnimation->targetProperty()); - - EXPECT_EQ(CCAnimationCurve::Transform, activeAnimation->curve()->type()); - - const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve(); - EXPECT_TRUE(curve); - - expectTranslateX(2, curve->getValue(0)); - expectTranslateX(4, curve->getValue(duration)); -} - -TEST_F(GraphicsLayerChromiumTest, createTransformAnimationWithBigRotation) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); - - TransformOperations operations1; - operations1.operations().append(RotateTransformOperation::create(0, TransformOperation::ROTATE)); - values.insert(new TransformAnimationValue(0, &operations1)); - - TransformOperations operations2; - operations2.operations().append(RotateTransformOperation::create(270, TransformOperation::ROTATE)); - values.insert(new TransformAnimationValue(duration, &operations2)); - - RefPtr<Animation> animation = Animation::create(); - animation->setDuration(duration); - - IntSize boxSize; - m_graphicsLayer->addAnimation(values, boxSize, animation.get(), "", 0); - - EXPECT_FALSE(m_platformLayer->layerAnimationController()->hasActiveAnimation()); -} - -TEST_F(GraphicsLayerChromiumTest, createTransformAnimationWithRotationInvolvingNegativeAngles) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); - - TransformOperations operations1; - operations1.operations().append(RotateTransformOperation::create(-330, TransformOperation::ROTATE)); - values.insert(new TransformAnimationValue(0, &operations1)); - - TransformOperations operations2; - operations2.operations().append(RotateTransformOperation::create(-320, TransformOperation::ROTATE)); - values.insert(new TransformAnimationValue(duration, &operations2)); - - RefPtr<Animation> animation = Animation::create(); - animation->setDuration(duration); - - IntSize boxSize; - m_graphicsLayer->addAnimation(values, boxSize, animation.get(), "", 0); - - EXPECT_TRUE(m_platformLayer->layerAnimationController()->hasActiveAnimation()); -} - -TEST_F(GraphicsLayerChromiumTest, createTransformAnimationWithSmallRotationInvolvingLargeAngles) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); - - TransformOperations operations1; - operations1.operations().append(RotateTransformOperation::create(270, TransformOperation::ROTATE)); - values.insert(new TransformAnimationValue(0, &operations1)); - - TransformOperations operations2; - operations2.operations().append(RotateTransformOperation::create(360, TransformOperation::ROTATE)); - values.insert(new TransformAnimationValue(duration, &operations2)); - - RefPtr<Animation> animation = Animation::create(); - animation->setDuration(duration); - - IntSize boxSize; - m_graphicsLayer->addAnimation(values, boxSize, animation.get(), "", 0); - - EXPECT_TRUE(m_platformLayer->layerAnimationController()->hasActiveAnimation()); -} - -TEST_F(GraphicsLayerChromiumTest, createTransformAnimationWithSingularMatrix) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); - - TransformationMatrix matrix1; - TransformOperations operations1; - operations1.operations().append(Matrix3DTransformOperation::create(matrix1)); - values.insert(new TransformAnimationValue(0, &operations1)); - - TransformationMatrix matrix2; - matrix2.setM11(0); - TransformOperations operations2; - operations2.operations().append(Matrix3DTransformOperation::create(matrix2)); - values.insert(new TransformAnimationValue(duration, &operations2)); - - RefPtr<Animation> animation = Animation::create(); - animation->setDuration(duration); - - IntSize boxSize; - m_graphicsLayer->addAnimation(values, boxSize, animation.get(), "", 0); - - EXPECT_FALSE(m_platformLayer->layerAnimationController()->hasActiveAnimation()); -} - -TEST_F(GraphicsLayerChromiumTest, createReversedAnimation) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); - - TransformOperations operations1; - operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); - values.insert(new TransformAnimationValue(0, &operations1)); - - TransformOperations operations2; - operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); - values.insert(new TransformAnimationValue(duration, &operations2)); - - RefPtr<Animation> animation = Animation::create(); - animation->setDuration(duration); - animation->setDirection(Animation::AnimationDirectionReverse); - - IntSize boxSize; - m_graphicsLayer->addAnimation(values, boxSize, animation.get(), "", 0); - - EXPECT_TRUE(m_platformLayer->layerAnimationController()->hasActiveAnimation()); - - CCActiveAnimation* activeAnimation = m_platformLayer->layerAnimationController()->getActiveAnimation(CCActiveAnimation::Transform); - EXPECT_TRUE(activeAnimation); - - EXPECT_EQ(1, activeAnimation->iterations()); - EXPECT_EQ(CCActiveAnimation::Transform, activeAnimation->targetProperty()); - - EXPECT_EQ(CCAnimationCurve::Transform, activeAnimation->curve()->type()); - - const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve(); - EXPECT_TRUE(curve); - - expectTranslateX(4, curve->getValue(0)); - expectTranslateX(2, curve->getValue(duration)); -} - -TEST_F(GraphicsLayerChromiumTest, createAlternatingAnimation) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); - - TransformOperations operations1; - operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); - values.insert(new TransformAnimationValue(0, &operations1)); - - TransformOperations operations2; - operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); - values.insert(new TransformAnimationValue(duration, &operations2)); - - RefPtr<Animation> animation = Animation::create(); - animation->setDuration(duration); - animation->setDirection(Animation::AnimationDirectionAlternate); - animation->setIterationCount(2); - - IntSize boxSize; - m_graphicsLayer->addAnimation(values, boxSize, animation.get(), "", 0); - - EXPECT_TRUE(m_platformLayer->layerAnimationController()->hasActiveAnimation()); - - CCActiveAnimation* activeAnimation = m_platformLayer->layerAnimationController()->getActiveAnimation(CCActiveAnimation::Transform); - EXPECT_TRUE(activeAnimation); - EXPECT_TRUE(activeAnimation->alternatesDirection()); - - EXPECT_EQ(2, activeAnimation->iterations()); - EXPECT_EQ(CCActiveAnimation::Transform, activeAnimation->targetProperty()); - - EXPECT_EQ(CCAnimationCurve::Transform, activeAnimation->curve()->type()); - - const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve(); - EXPECT_TRUE(curve); - - expectTranslateX(2, curve->getValue(0)); - expectTranslateX(4, curve->getValue(duration)); -} - -TEST_F(GraphicsLayerChromiumTest, createReversedAlternatingAnimation) -{ - const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); - - TransformOperations operations1; - operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); - values.insert(new TransformAnimationValue(0, &operations1)); - - TransformOperations operations2; - operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X)); - values.insert(new TransformAnimationValue(duration, &operations2)); - - RefPtr<Animation> animation = Animation::create(); - animation->setDuration(duration); - animation->setDirection(Animation::AnimationDirectionAlternateReverse); - animation->setIterationCount(2); - - IntSize boxSize; - m_graphicsLayer->addAnimation(values, boxSize, animation.get(), "", 0); - - EXPECT_TRUE(m_platformLayer->layerAnimationController()->hasActiveAnimation()); - - CCActiveAnimation* activeAnimation = m_platformLayer->layerAnimationController()->getActiveAnimation(CCActiveAnimation::Transform); - EXPECT_TRUE(activeAnimation); - EXPECT_TRUE(activeAnimation->alternatesDirection()); - - EXPECT_EQ(2, activeAnimation->iterations()); - EXPECT_EQ(CCActiveAnimation::Transform, activeAnimation->targetProperty()); - - EXPECT_EQ(CCAnimationCurve::Transform, activeAnimation->curve()->type()); - - const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve(); - EXPECT_TRUE(curve); - - expectTranslateX(4, curve->getValue(0)); - expectTranslateX(2, curve->getValue(duration)); -} - TEST_F(GraphicsLayerChromiumTest, shouldStartWithCorrectContentsScale) { - EXPECT_EQ(2, m_platformLayer->contentsScale()); + EXPECT_EQ(2, m_graphicsLayer->contentsScale()); } } // namespace diff --git a/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp b/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp index 91df126a5..1d395096a 100644 --- a/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp +++ b/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp @@ -51,7 +51,7 @@ public: m_wasErrorCalled = true; } virtual void onSuccess(PassRefPtr<DOMStringList>) { } - virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>) { } + virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>, PassRefPtr<IDBKey>, PassRefPtr<IDBKey>, PassRefPtr<SerializedScriptValue>) { } virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>) { EXPECT_TRUE(false); @@ -60,7 +60,7 @@ public: virtual void onSuccess(PassRefPtr<IDBTransactionBackendInterface>) { } virtual void onSuccess(PassRefPtr<SerializedScriptValue>) { } virtual void onSuccess(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, const IDBKeyPath&) { } - virtual void onSuccessWithContinuation() { } + virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey>, PassRefPtr<SerializedScriptValue>) { }; virtual void onSuccessWithPrefetch(const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<SerializedScriptValue> >&) { } virtual void onBlocked() { } private: @@ -102,7 +102,8 @@ TEST(IDBAbortTest, TheTest) const String& name = "db name"; MockIDBCallbacks callbacks; RefPtr<SecurityOrigin> origin = SecurityOrigin::create("http", "localhost", 81); - factory->open(name, &callbacks, origin, 0 /*Frame*/, String() /*path*/); + const int64_t DummyVersion = 2; + factory->open(name, DummyVersion, &callbacks, origin, 0 /*Frame*/, String() /*path*/); } } // namespace diff --git a/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp b/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp index 5c01e9ecc..8605c0f1a 100644 --- a/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp +++ b/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp @@ -77,7 +77,7 @@ public: } virtual void onError(PassRefPtr<IDBDatabaseError>) OVERRIDE { } virtual void onSuccess(PassRefPtr<DOMStringList>) OVERRIDE { } - virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>) OVERRIDE { } + virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>, PassRefPtr<IDBKey>, PassRefPtr<IDBKey>, PassRefPtr<SerializedScriptValue>) OVERRIDE { } virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>) OVERRIDE { m_wasSuccessDBCalled = true; @@ -86,7 +86,7 @@ public: virtual void onSuccess(PassRefPtr<IDBTransactionBackendInterface>) OVERRIDE { } virtual void onSuccess(PassRefPtr<SerializedScriptValue>) OVERRIDE { } virtual void onSuccess(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, const IDBKeyPath&) OVERRIDE { }; - virtual void onSuccessWithContinuation() OVERRIDE { } + virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey>, PassRefPtr<SerializedScriptValue>) OVERRIDE { }; virtual void onSuccessWithPrefetch(const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<SerializedScriptValue> >&) OVERRIDE { } virtual void onBlocked() OVERRIDE { } private: @@ -100,6 +100,7 @@ public: static PassRefPtr<FakeIDBDatabaseCallbacks> create() { return adoptRef(new FakeIDBDatabaseCallbacks()); } virtual ~FakeIDBDatabaseCallbacks() { } virtual void onVersionChange(const String& version) OVERRIDE { } + virtual void onVersionChange(int64_t oldVersion, int64_t newVersion) OVERRIDE { } private: FakeIDBDatabaseCallbacks() { } }; diff --git a/Source/WebKit/chromium/tests/IDBRequestTest.cpp b/Source/WebKit/chromium/tests/IDBRequestTest.cpp index 0f3b77527..77757193b 100644 --- a/Source/WebKit/chromium/tests/IDBRequestTest.cpp +++ b/Source/WebKit/chromium/tests/IDBRequestTest.cpp @@ -51,12 +51,12 @@ TEST(IDBRequestTest, EventsAfterStopping) request->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR, "Description goes here.")); request->onSuccess(DOMStringList::create()); request->onSuccess(PassRefPtr<IDBDatabaseBackendInterface>()); - request->onSuccess(PassRefPtr<IDBCursorBackendInterface>()); + request->onSuccess(PassRefPtr<IDBCursorBackendInterface>(), IDBKey::createInvalid(), IDBKey::createInvalid(), SerializedScriptValue::nullValue()); request->onSuccess(IDBKey::createInvalid()); request->onSuccess(PassRefPtr<IDBTransactionBackendInterface>()); request->onSuccess(SerializedScriptValue::nullValue()); request->onSuccess(SerializedScriptValue::nullValue(), IDBKey::createInvalid(), IDBKeyPath()); - request->onSuccessWithContinuation(); + request->onSuccess(IDBKey::createInvalid(), IDBKey::createInvalid(), SerializedScriptValue::nullValue()); } } // namespace 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/LayerChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp index 1a14d75bc..b9025b4c8 100644 --- a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp @@ -26,12 +26,12 @@ #include "LayerChromium.h" +#include "CCLayerImpl.h" +#include "CCLayerTreeHost.h" #include "CCLayerTreeTestCommon.h" +#include "CCSingleThreadProxy.h" #include "FakeCCLayerTreeHostClient.h" #include "LayerPainterChromium.h" -#include "cc/CCLayerImpl.h" -#include "cc/CCLayerTreeHost.h" -#include "cc/CCSingleThreadProxy.h" #include <gmock/gmock.h> #include <gtest/gtest.h> #include <public/WebCompositor.h> @@ -79,13 +79,11 @@ protected: { // Initialize without threading support. WebKit::WebCompositor::initialize(0); - DebugScopedSetMainThread main; m_layerTreeHost = adoptPtr(new MockCCLayerTreeHost); } virtual void TearDown() { - DebugScopedSetMainThread main; Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AnyNumber()); m_parent.clear(); @@ -638,7 +636,6 @@ void assertLayerTreeHostMatchesForSubtree(LayerChromium* layer, CCLayerTreeHost* TEST(LayerChromiumLayerTreeHostTest, enteringTree) { WebKit::WebCompositor::initialize(0); - DebugScopedSetMainThread main; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> mask = LayerChromium::create(); @@ -671,7 +668,6 @@ TEST(LayerChromiumLayerTreeHostTest, enteringTree) TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree) { WebKit::WebCompositor::initialize(0); - DebugScopedSetMainThread main; RefPtr<LayerChromium> parent = LayerChromium::create(); OwnPtr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create()); @@ -703,7 +699,6 @@ TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree) TEST(LayerChromiumLayerTreeHostTest, changeHost) { WebKit::WebCompositor::initialize(0); - DebugScopedSetMainThread main; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> mask = LayerChromium::create(); @@ -737,7 +732,6 @@ TEST(LayerChromiumLayerTreeHostTest, changeHost) TEST(LayerChromiumLayerTreeHostTest, changeHostInSubtree) { WebKit::WebCompositor::initialize(0); - DebugScopedSetMainThread main; RefPtr<LayerChromium> firstParent = LayerChromium::create(); RefPtr<LayerChromium> firstChild = LayerChromium::create(); RefPtr<LayerChromium> secondParent = LayerChromium::create(); @@ -775,7 +769,6 @@ TEST(LayerChromiumLayerTreeHostTest, changeHostInSubtree) TEST(LayerChromiumLayerTreeHostTest, replaceMaskAndReplicaLayer) { WebKit::WebCompositor::initialize(0); - DebugScopedSetMainThread main; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> mask = LayerChromium::create(); RefPtr<LayerChromium> replica = LayerChromium::create(); diff --git a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp index c4bddc5fb..36eddc534 100644 --- a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp @@ -25,18 +25,17 @@ #include "config.h" #include "LayerRendererChromium.h" +#include "CCDrawQuad.h" +#include "CCPrioritizedTextureManager.h" +#include "CCSettings.h" +#include "CCSingleThreadProxy.h" #include "CCTestCommon.h" #include "FakeWebCompositorOutputSurface.h" #include "FakeWebGraphicsContext3D.h" #include "GraphicsContext3D.h" -#include "cc/CCDrawQuad.h" -#include "cc/CCPrioritizedTextureManager.h" -#include "cc/CCSettings.h" -#include "cc/CCSingleThreadProxy.h" -#include <public/WebCompositor.h> - #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebCompositor.h> using namespace WebCore; using namespace WebKit; diff --git a/Source/WebKit/chromium/tests/LocaleWinTest.cpp b/Source/WebKit/chromium/tests/LocaleWinTest.cpp index 5f5642e91..32aaa53d7 100644 --- a/Source/WebKit/chromium/tests/LocaleWinTest.cpp +++ b/Source/WebKit/chromium/tests/LocaleWinTest.cpp @@ -211,7 +211,10 @@ TEST_F(LocaleWinTest, TestFormat) EXPECT_STREQ("Jan-1-0001", locale->formatDate("MMM-d-yyyy", 2012, 1, January, 1).utf8().data()); EXPECT_STREQ("Sep-13-275760", locale->formatDate("MMM-d-yyyy", 2012, 275760, September, 13).utf8().data()); - + + OwnPtr<LocaleWin> persian = LocaleWin::create(Persian); + // U+06F0 U+06F1 / U+06F0 U+06F8 / U+06F0 U+06F0 U+06F0 U+06F2 + EXPECT_STREQ("\xDB\xB0\xDB\xB1/\xDB\xB0\xDB\xB8/\xDB\xB0\xDB\xB0\xDB\xB0\xDB\xB1", persian->formatDate("dd/MM/yyyy", 2012, 1, August, 1).utf8().data()); // For the following test, we'd like to confirm they don't crash and their // results are not important because we can assume invalid arguments are @@ -255,6 +258,10 @@ TEST_F(LocaleWinTest, TestParse) EXPECT_TRUE(isnan(locale->parseDate("MMMM/d/y", 2012, "November 27 2"))); EXPECT_TRUE(isnan(locale->parseDate("MMMM/d/y", 2012, "November 32 2"))); EXPECT_TRUE(isnan(locale->parseDate("MMMM/d/y", 2012, "-1/-1/-1"))); + + OwnPtr<LocaleWin> persian = LocaleWin::create(Persian); + // U+06F1 U+06F6 / U+06F0 U+06F8 / 2012 + EXPECT_EQ(msForDate(2012, August, 16), persian->parseDate("dd/MM/yyyy", 2012, String::fromUTF8("\xDB\xB1\xDB\xB6/\xDB\xB0\xDB\xB8/2012"))); } TEST_F(LocaleWinTest, formatDate) diff --git a/Source/WebKit/chromium/tests/MockCCQuadCuller.h b/Source/WebKit/chromium/tests/MockCCQuadCuller.h index 15cb19d6c..7f6e0f85a 100644 --- a/Source/WebKit/chromium/tests/MockCCQuadCuller.h +++ b/Source/WebKit/chromium/tests/MockCCQuadCuller.h @@ -25,9 +25,9 @@ #ifndef MockCCQuadCuller_h #define MockCCQuadCuller_h +#include "CCDrawQuad.h" +#include "CCQuadSink.h" #include "IntRect.h" -#include "cc/CCDrawQuad.h" -#include "cc/CCQuadSink.h" #include <wtf/PassOwnPtr.h> namespace WebCore { diff --git a/Source/WebKit/chromium/tests/PlatformGestureCurveTest.cpp b/Source/WebKit/chromium/tests/PlatformGestureCurveTest.cpp index 362727c04..4f0a2276f 100644 --- a/Source/WebKit/chromium/tests/PlatformGestureCurveTest.cpp +++ b/Source/WebKit/chromium/tests/PlatformGestureCurveTest.cpp @@ -28,11 +28,11 @@ #include "PlatformGestureCurve.h" #include "ActivePlatformGestureAnimation.h" +#include "CCActiveGestureAnimation.h" +#include "CCGestureCurve.h" #include "PlatformGestureCurveTarget.h" #include "TouchpadFlingPlatformGestureCurve.h" #include "WheelFlingPlatformGestureCurve.h" -#include "cc/CCActiveGestureAnimation.h" -#include "cc/CCGestureCurve.h" #include <gtest/gtest.h> #include <wtf/OwnPtr.h> diff --git a/Source/WebKit/chromium/tests/PopupContainerTest.cpp b/Source/WebKit/chromium/tests/PopupContainerTest.cpp new file mode 100644 index 000000000..a721b4cbb --- /dev/null +++ b/Source/WebKit/chromium/tests/PopupContainerTest.cpp @@ -0,0 +1,159 @@ +/* + * 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 INC. 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 INC. 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 "PopupContainer.h" + +#include <gtest/gtest.h> + +using namespace WebCore; + +class MockPopupContent : public PopupContent { +public: + virtual void setMaxHeight(int max) OVERRIDE { maxHeight = max; } + virtual int popupContentHeight() const OVERRIDE { return height; } + virtual ~MockPopupContent() { } + + virtual void layout() OVERRIDE + { + layoutCount++; + width = std::min(maxWidth, width); + height = std::min(maxHeight, height); + height -= height % 16; + } + + virtual void setMaxWidthAndLayout(int max) OVERRIDE + { + maxWidth = max; + layout(); + } + + MockPopupContent(const IntSize& widgetSize) + : width(widgetSize.width() - borderSize * 2) + , height(widgetSize.height() - borderSize * 2) + , maxWidth(width) + , maxHeight(height) + , layoutCount(0) + { + } + + int width; + int height; + int maxWidth; + int maxHeight; + unsigned layoutCount; + + static const int borderSize = 1; // Should match to kBorderSize in PopupContainer.cpp. +}; + +const int screenMaxX = 1024; +const int screenMaxY = 768; +const int targetControlWidth = 130; + +static IntRect calculatePosition(const IntRect& initialRect, PopupContent* content) +{ + const bool isRTL = true; + const int targetControlHeight = 20; + const FloatRect screenRect(0, 0, screenMaxX, screenMaxY); + const FloatRect windowRect(0, 0, 512, 512); + int rtlOffset = targetControlWidth - initialRect.width(); + bool needToResizeView = false; + return PopupContainer::layoutAndCalculateWidgetRectInternal(initialRect, targetControlHeight, windowRect, screenRect, !isRTL, rtlOffset, content, needToResizeView); +} + +TEST(PopupContainerTest, PopupPosition) +{ + // Suppose that initialRect.location is the bottom-left corner of the target + // control such as <select>. + + { + // If initialRect is in the screen, nothing should happen. + IntRect initialRect(100, 100, 256, 258); + MockPopupContent content(initialRect.size()); + IntRect resultRect = calculatePosition(initialRect, &content); + EXPECT_EQ(initialRect, resultRect); + EXPECT_EQ(0u, content.layoutCount); + } + + { + // If the left edge of the control is projecting from the screen, making + // the widget aligned to the right edge of the control. + IntRect initialRect(-10, 100, 100, 258); + MockPopupContent content(initialRect.size()); + IntRect resultRect = calculatePosition(initialRect, &content); + EXPECT_EQ(IntRect(20, 100, 100, 258), resultRect); + } + + { + // Made the widget aligned to the right edge. But it's still projecting + // from the screen. + IntRect initialRect(-10, 100, targetControlWidth, 258); + MockPopupContent content(initialRect.size()); + IntRect resultRect = calculatePosition(initialRect, &content); + EXPECT_EQ(IntRect(0, 100, 120, 258), resultRect); + EXPECT_EQ(118, content.width); + EXPECT_TRUE(content.layoutCount); + } + + { + // If the right edge of the control is projecting from the screen, + // shrink the width of the widget. + IntRect initialRect(screenMaxX - 100, 100, targetControlWidth, 258); + MockPopupContent content(initialRect.size()); + IntRect resultRect = calculatePosition(initialRect, &content); + EXPECT_EQ(IntRect(screenMaxX - 100, 100, 100, 258), resultRect); + EXPECT_EQ(98, content.width); + EXPECT_TRUE(content.layoutCount); + } + + { + // If there is no enough room below, move the widget upwards. + IntRect initialRect(100, 700, targetControlWidth, 258); + MockPopupContent content(initialRect.size()); + IntRect resultRect = calculatePosition(initialRect, &content); + EXPECT_EQ(IntRect(100, 422, targetControlWidth, 258), resultRect); + EXPECT_EQ(0u, content.layoutCount); + } + + { + // There is no enough room below and above, and the below space is larger. + IntRect initialRect(100, 300, targetControlWidth, 514); + MockPopupContent content(initialRect.size()); + IntRect resultRect = calculatePosition(initialRect, &content); + EXPECT_EQ(IntRect(100, 300, targetControlWidth, 466), resultRect); + EXPECT_TRUE(content.layoutCount); + EXPECT_EQ(464, content.height); + } + + { + // There is no enough room below and above, and the above space is larger. + IntRect initialRect(100, 400, targetControlWidth, 514); + MockPopupContent content(initialRect.size()); + IntRect resultRect = calculatePosition(initialRect, &content); + EXPECT_EQ(IntRect(100, 10, targetControlWidth, 370), resultRect); + EXPECT_TRUE(content.layoutCount); + EXPECT_EQ(368, content.height); + } +} diff --git a/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp index 0e3b1fbdb..6242043b3 100644 --- a/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp @@ -26,13 +26,13 @@ #include "ScrollbarLayerChromium.h" +#include "CCScrollbarAnimationController.h" +#include "CCScrollbarLayerImpl.h" +#include "CCSingleThreadProxy.h" #include "FakeWebScrollbarThemeGeometry.h" #include "Scrollbar.h" #include "Settings.h" #include "TreeSynchronizer.h" -#include "cc/CCScrollbarAnimationController.h" -#include "cc/CCScrollbarLayerImpl.h" -#include "cc/CCSingleThreadProxy.h" #include <gtest/gtest.h> #include <public/WebScrollbar.h> #include <public/WebScrollbarThemeGeometry.h> diff --git a/Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp index 54e253995..a4830e53f 100644 --- a/Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp @@ -26,8 +26,8 @@ #include "TextureLayerChromium.h" +#include "CCLayerTreeHost.h" #include "FakeCCLayerTreeHostClient.h" -#include "cc/CCLayerTreeHost.h" #include <gmock/gmock.h> #include <gtest/gtest.h> #include <public/WebCompositor.h> diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index bab7168c4..689b817af 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -29,14 +29,14 @@ #include "BitmapCanvasLayerTextureUpdater.h" #include "CCAnimationTestCommon.h" #include "CCLayerTreeTestCommon.h" +#include "CCOverdrawMetrics.h" +#include "CCRenderingStats.h" +#include "CCSingleThreadProxy.h" // For DebugScopedSetImplThread +#include "CCTextureUpdateController.h" #include "CCTiledLayerTestCommon.h" #include "FakeCCGraphicsContext.h" #include "FakeCCLayerTreeHostClient.h" #include "LayerPainterChromium.h" -#include "cc/CCOverdrawMetrics.h" -#include "cc/CCRenderingStats.h" -#include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread -#include "cc/CCTextureUpdateController.h" #include <gtest/gtest.h> #include <public/WebCompositor.h> #include <public/WebTransformationMatrix.h> @@ -497,6 +497,72 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLay EXPECT_TRUE(layer2Impl->hasTileAt(0, 1)); } +TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately) +{ + // Create a CCLayerTreeHost that has the right viewportsize, + // so the layer is considered small enough. + WebKit::WebCompositor::initialize(0); + FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; + OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCLayerTreeSettings()); + + bool runOutOfMemory[2] = {false, true}; + for (int i = 0; i < 2; i++) { + // Create a layer with 4x4 tiles. + int layerWidth = 4 * FakeTiledLayerChromium::tileSize().width(); + int layerHeight = 4 * FakeTiledLayerChromium::tileSize().height(); + int memoryForLayer = layerWidth * layerHeight * 4; + IntSize viewportSize = IntSize(layerWidth, layerHeight); + ccLayerTreeHost->setViewportSize(viewportSize, viewportSize); + + // Use 8x4 tiles to run out of memory. + if (runOutOfMemory[i]) + layerWidth *= 2; + + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(memoryForLayer, 1024, CCRenderer::ContentPool); + DebugScopedSetImplThread implThread; + + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + + // Full size layer with half being visible. + IntSize contentBounds(layerWidth, layerHeight); + IntRect contentRect(IntPoint::zero(), contentBounds); + IntRect visibleRect(IntPoint::zero(), IntSize(layerWidth / 2, layerHeight)); + + // Pretend the layer is animating. + layer->setDrawTransformIsAnimating(true); + layer->setBounds(contentBounds); + layer->setVisibleContentRect(visibleRect); + layer->invalidateContentRect(contentRect); + layer->setLayerTreeHost(ccLayerTreeHost.get()); + + // 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); + updateTextures(); + layer->pushPropertiesTo(layerImpl.get()); + + // We should have all the tiles for the small animated layer. + // We should still have the visible tiles when we didn't + // have enough memory for all the tiles. + if (!runOutOfMemory[i]) { + for (int i = 0; i < 4; ++i) { + for (int j = 0; j < 4; ++j) + EXPECT_TRUE(layerImpl->hasTileAt(i, j)); + } + } else { + for (int i = 0; i < 8; ++i) { + for (int j = 0; j < 4; ++j) + EXPECT_EQ(layerImpl->hasTileAt(i, j), i < 4); + } + } + } + ccLayerTreeHost.clear(); + WebKit::WebCompositor::shutdown(); +} + TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) { // The tile size is 100x100. Setup 3x3 tiles with one 1x1 visible tile in the center. @@ -581,108 +647,47 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers) IntSize contentBounds(100, 100); IntRect contentRect(IntPoint::zero(), contentBounds); - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(20000, 1024, CCRenderer::ContentPool); + OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); - - // Invalidate the layer but make none of it visible, so nothing paints. - IntRect visibleRect; - layer->setBounds(contentBounds); - layer->setVisibleContentRect(visibleRect); - layer->invalidateContentRect(contentRect); - - for (int i = 0; i < 2; i++) { - // Paint / idle-paint. - layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - layer->updateContentRect(m_queue, visibleRect, 0, m_stats); - - // Non-visible layers don't need idle paint. - EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); - - layer->pushPropertiesTo(layerImpl.get()); - - // We should not have any tiles pushed since the layer is not visible. - EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); - } -} -static void testHaveOuterTiles(FakeCCTiledLayerImpl* layerImpl, int width, int height, int have) -{ - for (int i = 0; i < width; ++i) { - for (int j = 0; j < height; ++j) { - bool hasTile = i < have || j < have || i >= width - have || j >= height - have; - EXPECT_EQ(hasTile, layerImpl->hasTileAt(i, j)); - } - } -} + // Alternate between not visible and visible. + IntRect v(0, 0, 100, 100); + IntRect nv(0, 0, 0, 0); + IntRect visibleRect[10] = {nv, nv, v, v, nv, nv, v, v, nv, nv}; + bool invalidate[10] = {true, true, true, true, true, true, true, true, false, false }; -TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers) -{ - OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(8000*8000*8, 1024, CCRenderer::ContentPool); - DebugScopedSetImplThread implThread; + // 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 }; - int tileWidth = FakeTiledLayerChromium::tileSize().width(); - int tileHeight = FakeTiledLayerChromium::tileSize().height(); - int width[] = { 1, 2, 3, 4, 9, 10, 0 }; - int height[] = { 1, 2, 3, 4, 9, 10, 0 }; + for (int i = 0; i < 10; i++) { + layer->setVisibleContentRect(visibleRect[i]); - for (int j = 0; height[j]; ++j) { - for (int i = 0; width[i]; ++i) { - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); - - // Pretend the layer is animating. - layer->setDrawTransformIsAnimating(true); - - IntSize contentBounds(width[i] * tileWidth, height[j] * tileHeight); - IntRect contentRect(IntPoint::zero(), contentBounds); - IntRect visibleRect; - - layer->setBounds(contentBounds); - layer->setVisibleContentRect(visibleRect); + // Skip invalidation once to insure the tile stays in memory while not visible. + if (invalidate[i]) layer->invalidateContentRect(contentRect); - layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - - // If idlePaintRect gives back a non-empty result then we should paint it. Otherwise, - // we shoud paint nothing. - bool shouldPrepaint = !layer->idlePaintRect(visibleRect).isEmpty(); - - // Normally we don't allow non-visible layers to pre-paint, but if they are animating then we should. - EXPECT_EQ(shouldPrepaint, layer->needsIdlePaint(visibleRect)); - - // If the layer is to be prepainted at all, then after four updates we should have the outer row/columns painted. - for (int k = 0; k < 4; ++k) { - layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); - - layer->updateContentRect(m_queue, visibleRect, 0, m_stats); - updateTextures(); - layer->pushPropertiesTo(layerImpl.get()); - } - - testHaveOuterTiles(layerImpl.get(), width[i], height[j], shouldPrepaint ? 1 : 0); + // Paint / idle-paint. + textureManager->clearPriorities(); + layer->setTexturePriorities(m_priorityCalculator); + textureManager->prioritizeTextures(); + layer->updateContentRect(m_queue, visibleRect[i], 0, m_stats); - // We don't currently idle paint past the outermost tiles. - EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); - for (int k = 0; k < 4; ++k) { - layer->setTexturePriorities(m_priorityCalculator); - textureManager->prioritizeTextures(); + updateTextures(); - layer->updateContentRect(m_queue, visibleRect, 0, m_stats); - updateTextures(); - layer->pushPropertiesTo(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])); - testHaveOuterTiles(layerImpl.get(), width[i], height[j], shouldPrepaint ? 1 : 0); - } + layer->pushPropertiesTo(layerImpl.get()); + EXPECT_EQ(layerImpl->hasTileAt(0, 0), haveTile[i]); } } + TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) { OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool); diff --git a/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp b/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp index 08597f1dc..20e378fba 100644 --- a/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp +++ b/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp @@ -27,12 +27,12 @@ #include "TreeSynchronizer.h" #include "CCAnimationTestCommon.h" +#include "CCLayerAnimationController.h" +#include "CCLayerImpl.h" +#include "CCProxy.h" +#include "CCSingleThreadProxy.h" #include "LayerChromium.h" #include "Region.h" -#include "cc/CCLayerAnimationController.h" -#include "cc/CCLayerImpl.h" -#include "cc/CCProxy.h" -#include "cc/CCSingleThreadProxy.h" #include <gtest/gtest.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/tests/WebAnimationTest.cpp b/Source/WebKit/chromium/tests/WebAnimationTest.cpp index c2ccc4503..a682ab020 100644 --- a/Source/WebKit/chromium/tests/WebAnimationTest.cpp +++ b/Source/WebKit/chromium/tests/WebAnimationTest.cpp @@ -47,13 +47,13 @@ namespace { TEST(WebAnimationTest, MAYBE_DefaultSettings) { WebFloatAnimationCurve curve; - WebAnimation animation(curve, WebAnimation::TargetPropertyOpacity); + OwnPtr<WebAnimation> animation = adoptPtr(WebAnimation::create(curve, WebAnimation::TargetPropertyOpacity)); // Ensure that the defaults are correct. - EXPECT_EQ(1, animation.iterations()); - EXPECT_EQ(0, animation.startTime()); - EXPECT_EQ(0, animation.timeOffset()); - EXPECT_FALSE(animation.alternatesDirection()); + EXPECT_EQ(1, animation->iterations()); + EXPECT_EQ(0, animation->startTime()); + EXPECT_EQ(0, animation->timeOffset()); + EXPECT_FALSE(animation->alternatesDirection()); } // Linux/Win bots failed on this test. @@ -68,16 +68,16 @@ TEST(WebAnimationTest, MAYBE_DefaultSettings) TEST(WebAnimationTest, MAYBE_ModifiedSettings) { WebFloatAnimationCurve curve; - WebAnimation animation(curve, WebAnimation::TargetPropertyOpacity); - animation.setIterations(2); - animation.setStartTime(2); - animation.setTimeOffset(2); - animation.setAlternatesDirection(true); + OwnPtr<WebAnimation> animation = adoptPtr(WebAnimation::create(curve, WebAnimation::TargetPropertyOpacity)); + animation->setIterations(2); + animation->setStartTime(2); + animation->setTimeOffset(2); + animation->setAlternatesDirection(true); - EXPECT_EQ(2, animation.iterations()); - EXPECT_EQ(2, animation.startTime()); - EXPECT_EQ(2, animation.timeOffset()); - EXPECT_TRUE(animation.alternatesDirection()); + EXPECT_EQ(2, animation->iterations()); + EXPECT_EQ(2, animation->startTime()); + EXPECT_EQ(2, animation->timeOffset()); + EXPECT_TRUE(animation->alternatesDirection()); } } // namespace diff --git a/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp b/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp index 902fac981..8313b0f5b 100644 --- a/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp +++ b/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp @@ -27,11 +27,11 @@ #include "WebCompositorInputHandlerImpl.h" +#include "CCActiveGestureAnimation.h" +#include "CCInputHandler.h" +#include "CCSingleThreadProxy.h" #include "WebCompositorInputHandlerClient.h" #include "WebInputEvent.h" -#include "cc/CCActiveGestureAnimation.h" -#include "cc/CCInputHandler.h" -#include "cc/CCSingleThreadProxy.h" #include <public/WebCompositor.h> #include <public/WebFloatPoint.h> #include <public/WebPoint.h> @@ -60,7 +60,7 @@ public: MOCK_METHOD0(scheduleAnimation, void()); MOCK_METHOD2(scrollBegin, ScrollStatus(const WebCore::IntPoint&, WebCore::CCInputHandlerClient::ScrollInputType)); - MOCK_METHOD1(scrollBy, void(const WebCore::IntSize&)); + MOCK_METHOD2(scrollBy, void(const WebCore::IntPoint&, const WebCore::IntSize&)); MOCK_METHOD0(scrollEnd, void()); private: @@ -117,12 +117,24 @@ TEST(WebCompositorInputHandlerImpl, fromIdentifier) WebCompositor::shutdown(); } +class WebCompositorInitializer { +public: + WebCompositorInitializer() + { + WebCompositor::initialize(0); + } + + ~WebCompositorInitializer() + { + WebCompositor::shutdown(); + } +}; + class WebCompositorInputHandlerImplTest : public testing::Test { public: WebCompositorInputHandlerImplTest() : m_expectedDisposition(DidHandle) { - WebCompositor::initialize(0); m_inputHandler = WebCompositorInputHandlerImpl::create(&m_mockCCInputHandlerClient); m_inputHandler->setClient(&m_mockClient); } @@ -131,7 +143,6 @@ public: { m_inputHandler->setClient(0); m_inputHandler.clear(); - WebCompositor::shutdown(); } // This is defined as a macro because when an expectation is not satisfied the only output you get @@ -166,12 +177,11 @@ protected: OwnPtr<WebCompositorInputHandlerImpl> m_inputHandler; MockWebCompositorInputHandlerClient m_mockClient; WebGestureEvent gesture; + WebCore::DebugScopedSetImplThread alwaysImplThread; + WebCompositorInitializer initializer; enum ExpectedDisposition { DidHandle, DidNotHandle, DropEvent }; ExpectedDisposition m_expectedDisposition; - -private: - WebCore::DebugScopedSetImplThread m_alwaysImplThread; }; @@ -191,7 +201,7 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureScrollStarted) gesture.type = WebInputEvent::GestureScrollUpdate; gesture.deltaY = -40; // -Y means scroll down - i.e. in the +Y direction. - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::Property(&WebCore::IntSize::height, testing::Gt(0)))); + EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_, testing::Property(&WebCore::IntSize::height, testing::Gt(0)))); m_inputHandler->handleInputEvent(gesture); VERIFY_AND_RESET_MOCKS(); @@ -376,7 +386,7 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingAnimates) EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted)); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::Property(&WebCore::IntSize::width, testing::Lt(0)))); + EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_, testing::Property(&WebCore::IntSize::width, testing::Lt(0)))); EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()); m_inputHandler->animate(10.1); @@ -388,7 +398,7 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingAnimates) EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollOnMainThread)); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_)).Times(0); + EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_, testing::_)).Times(0); EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()).Times(0); // Expected wheel fling animation parameters: @@ -458,7 +468,7 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingTransferResets) EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted)); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::Property(&WebCore::IntSize::width, testing::Lt(0)))); + EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_, testing::Property(&WebCore::IntSize::width, testing::Lt(0)))); EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()); m_inputHandler->animate(10.1); @@ -470,7 +480,7 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingTransferResets) EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollOnMainThread)); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_)).Times(0); + EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_, testing::_)).Times(0); EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()).Times(0); // Expected wheel fling animation parameters: @@ -537,7 +547,7 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingTransferResets) EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted)); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::Property(&WebCore::IntSize::height, testing::Gt(0)))); + EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_, testing::Property(&WebCore::IntSize::height, testing::Gt(0)))); EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()); m_inputHandler->animate(30.1); @@ -547,7 +557,7 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingTransferResets) EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollOnMainThread)); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_)).Times(0); + EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_, testing::_)).Times(0); EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()).Times(0); // We should get parameters from the second fling, nothing from the first fling should "leak". diff --git a/Source/WebKit/chromium/tests/WebFloatAnimationCurveTest.cpp b/Source/WebKit/chromium/tests/WebFloatAnimationCurveTest.cpp index bdfe4ec7d..3cac764b6 100644 --- a/Source/WebKit/chromium/tests/WebFloatAnimationCurveTest.cpp +++ b/Source/WebKit/chromium/tests/WebFloatAnimationCurveTest.cpp @@ -26,7 +26,7 @@ #include <public/WebFloatAnimationCurve.h> -#include "cc/CCTimingFunction.h" +#include "CCTimingFunction.h" #include <gtest/gtest.h> #include <wtf/OwnPtr.h> diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp index cd23d6268..8fc74988e 100644 --- a/Source/WebKit/chromium/tests/WebFrameTest.cpp +++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp @@ -32,9 +32,11 @@ #include "WebFrame.h" +#include "FloatRect.h" #include "Frame.h" #include "FrameTestHelpers.h" #include "FrameView.h" +#include "Range.h" #include "ResourceError.h" #include "URLTestHelpers.h" #include "WebDataSource.h" @@ -51,11 +53,14 @@ #include "WebSettings.h" #include "WebViewClient.h" #include "WebViewImpl.h" +#include "platform/WebFloatRect.h" #include "v8.h" #include <gtest/gtest.h> #include <webkit/support/webkit_support.h> using namespace WebKit; +using WebCore::FloatRect; +using WebCore::Range; using WebKit::URLTestHelpers::toKURL; namespace { @@ -854,4 +859,193 @@ TEST_F(WebFrameTest, DidCreateFrame) EXPECT_EQ(webFrameClient.m_parent, webView->mainFrame()); } +class FindUpdateWebFrameClient : public WebFrameClient { +public: + FindUpdateWebFrameClient() + : m_findResultsAreReady(false) + { + } + + virtual void reportFindInPageMatchCount(int, int, bool finalUpdate) OVERRIDE + { + if (finalUpdate) + m_findResultsAreReady = true; + } + + bool findResultsAreReady() const { return m_findResultsAreReady; } + +private: + bool m_findResultsAreReady; +}; + +TEST_F(WebFrameTest, FindInPageMatchRects) +{ + registerMockedHttpURLLoad("find_in_page.html"); + registerMockedHttpURLLoad("find_in_page_frame.html"); + + FindUpdateWebFrameClient client; + WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client); + webView->resize(WebSize(640, 480)); + webView->layout(); + webkit_support::RunAllPendingMessages(); + + static const char* kFindString = "result"; + static const int kFindIdentifier = 12345; + static const int kNumResults = 10; + + WebFindOptions options; + WebString searchText = WebString::fromUTF8(kFindString); + WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(webView->mainFrame()); + EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0)); + + for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) + frame->scopeStringMatches(kFindIdentifier, searchText, options, true); + + webkit_support::RunAllPendingMessages(); + EXPECT_TRUE(client.findResultsAreReady()); + + WebVector<WebFloatRect> webMatchRects; + mainFrame->findMatchRects(webMatchRects); + ASSERT_EQ(webMatchRects.size(), static_cast<size_t>(kNumResults)); + int rectsVersion = mainFrame->findMatchMarkersVersion(); + + for (int resultIndex = 0; resultIndex < kNumResults; ++resultIndex) { + FloatRect resultRect = static_cast<FloatRect>(webMatchRects[resultIndex]); + + // Select the match by the center of its rect. + EXPECT_EQ(mainFrame->selectNearestFindMatch(resultRect.center(), 0), resultIndex + 1); + + // Check that the find result ordering matches with our expectations. + Range* result = mainFrame->activeMatchFrame()->activeMatch(); + ASSERT_TRUE(result); + result->setEnd(result->endContainer(), result->endOffset() + 2); + EXPECT_EQ(result->text(), String::format("%s %d", kFindString, resultIndex)); + + // Verify that the expected match rect also matches the currently active match. + // Compare the enclosing rects to prevent precision issues caused by CSS transforms. + FloatRect activeMatch = mainFrame->activeFindMatchRect(); + EXPECT_EQ(enclosingIntRect(activeMatch), enclosingIntRect(resultRect)); + + // The rects version should not have changed. + EXPECT_EQ(mainFrame->findMatchMarkersVersion(), rectsVersion); + } + + // All results after the first two ones should be below between them in find-in-page coordinates. + // This is because results 2 to 9 are inside an iframe located between results 0 and 1. This applies to the fixed div too. + EXPECT_TRUE(webMatchRects[0].y < webMatchRects[1].y); + for (int resultIndex = 2; resultIndex < kNumResults; ++resultIndex) { + EXPECT_TRUE(webMatchRects[0].y < webMatchRects[resultIndex].y); + EXPECT_TRUE(webMatchRects[1].y > webMatchRects[resultIndex].y); + } + + // Result 3 should be below both 2 and 4. This is caused by the CSS transform in the containing div. + // If the transform doesn't work then 3 will be between 2 and 4. + EXPECT_TRUE(webMatchRects[3].y > webMatchRects[2].y); + EXPECT_TRUE(webMatchRects[3].y > webMatchRects[4].y); + + // Results 6, 7, 8 and 9 should be one below the other in that same order. + // If overflow:scroll is not properly handled then result 8 would be below result 9 or + // result 7 above result 6 depending on the scroll. + EXPECT_TRUE(webMatchRects[6].y < webMatchRects[7].y); + EXPECT_TRUE(webMatchRects[7].y < webMatchRects[8].y); + EXPECT_TRUE(webMatchRects[8].y < webMatchRects[9].y); + + // Resizing should update the rects version. + webView->resize(WebSize(800, 600)); + webkit_support::RunAllPendingMessages(); + EXPECT_TRUE(mainFrame->findMatchMarkersVersion() != rectsVersion); + + webView->close(); +} + +static WebView* selectRangeTestCreateWebView(const std::string& url) +{ + WebView* webView = FrameTestHelpers::createWebViewAndLoad(url, true); + webView->settings()->setDefaultFontSize(12); + webView->resize(WebSize(640, 480)); + return webView; +} + +static WebPoint topLeft(const WebRect& rect) +{ + return WebPoint(rect.x, rect.y); +} + +static WebPoint bottomRightMinusOne(const WebRect& rect) +{ + // FIXME: If we don't subtract 1 from the x- and y-coordinates of the + // selection bounds, selectRange() will select the *next* element. That's + // strictly correct, as hit-testing checks the pixel to the lower-right of + // the input coordinate, but it's a wart on the API. + return WebPoint(rect.x + rect.width - 1, rect.y + rect.height - 1); +} + +static std::string selectionAsString(WebFrame* frame) +{ + return std::string(frame->selectionAsText().utf8().data()); +} + +TEST_F(WebFrameTest, SelectRange) +{ + WebView* webView; + WebFrame* frame; + WebRect startWebRect; + WebRect endWebRect; + + registerMockedHttpURLLoad("select_range_basic.html"); + registerMockedHttpURLLoad("select_range_scroll.html"); + registerMockedHttpURLLoad("select_range_iframe.html"); + registerMockedHttpURLLoad("select_range_editable.html"); + + webView = selectRangeTestCreateWebView(m_baseURL + "select_range_basic.html"); + frame = webView->mainFrame(); + EXPECT_EQ("Some test text for testing.", selectionAsString(frame)); + webView->selectionBounds(startWebRect, endWebRect); + frame->executeCommand(WebString::fromUTF8("Unselect")); + EXPECT_EQ("", selectionAsString(frame)); + frame->selectRange(topLeft(startWebRect), bottomRightMinusOne(endWebRect)); + EXPECT_EQ("Some test text for testing.", selectionAsString(frame)); + webView->close(); + + webView = selectRangeTestCreateWebView(m_baseURL + "select_range_scroll.html"); + frame = webView->mainFrame(); + EXPECT_EQ("Some offscreen test text for testing.", selectionAsString(frame)); + webView->selectionBounds(startWebRect, endWebRect); + frame->executeCommand(WebString::fromUTF8("Unselect")); + EXPECT_EQ("", selectionAsString(frame)); + frame->selectRange(topLeft(startWebRect), bottomRightMinusOne(endWebRect)); + EXPECT_EQ("Some offscreen test text for testing.", selectionAsString(frame)); + webView->close(); + + webView = selectRangeTestCreateWebView(m_baseURL + "select_range_iframe.html"); + frame = webView->mainFrame(); + WebFrame* subframe = frame->findChildByExpression(WebString::fromUTF8("/html/body/iframe")); + EXPECT_EQ("Some test text for testing.", selectionAsString(subframe)); + webView->selectionBounds(startWebRect, endWebRect); + subframe->executeCommand(WebString::fromUTF8("Unselect")); + EXPECT_EQ("", selectionAsString(subframe)); + subframe->selectRange(topLeft(startWebRect), bottomRightMinusOne(endWebRect)); + EXPECT_EQ("Some test text for testing.", selectionAsString(subframe)); + webView->close(); + + // Select the middle of an editable element, then try to extend the selection to the top of the document. + // The selection range should be clipped to the bounds of the editable element. + webView = selectRangeTestCreateWebView(m_baseURL + "select_range_editable.html"); + frame = webView->mainFrame(); + EXPECT_EQ("This text is initially selected.", selectionAsString(frame)); + webView->selectionBounds(startWebRect, endWebRect); + frame->selectRange(WebPoint(0, 0), bottomRightMinusOne(endWebRect)); + EXPECT_EQ("16-char header. This text is initially selected.", selectionAsString(frame)); + webView->close(); + + // As above, but extending the selection to the bottom of the document. + webView = selectRangeTestCreateWebView(m_baseURL + "select_range_editable.html"); + frame = webView->mainFrame(); + EXPECT_EQ("This text is initially selected.", selectionAsString(frame)); + webView->selectionBounds(startWebRect, endWebRect); + frame->selectRange(topLeft(startWebRect), WebPoint(640, 480)); + EXPECT_EQ("This text is initially selected. 16-char footer.", selectionAsString(frame)); + webView->close(); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/WebLayerTest.cpp b/Source/WebKit/chromium/tests/WebLayerTest.cpp index 5381173ef..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,74 +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_EQ(otherLayer, layer.maskLayer()); 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); @@ -179,52 +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()); -} - -TEST_F(WebLayerTest, Hierarchy) -{ - EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); - WebLayer layer1 = WebLayer::create(); - WebLayer layer2 = WebLayer::create(); - - EXPECT_TRUE(layer1.parent().isNull()); - EXPECT_TRUE(layer2.parent().isNull()); - - layer1.addChild(layer2); - EXPECT_TRUE(layer1.parent().isNull()); - EXPECT_EQ(layer1, layer2.parent()); - - layer2.removeFromParent(); - EXPECT_TRUE(layer2.parent().isNull()); - - layer1.addChild(layer2); - EXPECT_EQ(layer1, layer2.parent()); - layer1.removeAllChildren(); - EXPECT_TRUE(layer2.parent().isNull()); - - MockWebContentLayerClient contentClient; - EXPECT_CALL(contentClient, paintContents(_, _, _)).Times(AnyNumber()); - WebContentLayer contentLayer = WebContentLayer::create(&contentClient); - WebExternalTextureLayer textureLayer = WebExternalTextureLayer::create(); - - textureLayer.addChild(contentLayer); - contentLayer.addChild(layer1); - layer1.addChild(layer2); - - // Release reference on all layers, checking that destruction (which may - // generate calls to the client) doesn't crash. - layer2.reset(); - layer1.reset(); - contentLayer.reset(); - textureLayer.reset(); + EXPECT_FALSE(contentLayer->layer()->drawsContent()); } } diff --git a/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp b/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp index 4f0330035..1c1602c23 100644 --- a/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp +++ b/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp @@ -28,6 +28,7 @@ #include "CompositorFakeWebGraphicsContext3D.h" #include "FakeWebCompositorOutputSurface.h" +#include "WebLayerTreeViewTestCommon.h" #include <gmock/gmock.h> #include <public/Platform.h> #include <public/WebCompositor.h> @@ -41,27 +42,6 @@ using testing::Test; namespace { -class MockWebLayerTreeViewClient : public WebLayerTreeViewClient { -public: - virtual void scheduleComposite() OVERRIDE { } - virtual void updateAnimations(double frameBeginTime) OVERRIDE { } - MOCK_METHOD0(willBeginFrame, void()); - MOCK_METHOD0(didBeginFrame, void()); - virtual void layout() OVERRIDE { } - virtual void applyScrollAndScale(const WebSize& scrollDelta, float scaleFactor) OVERRIDE { } - - virtual WebCompositorOutputSurface* createOutputSurface() OVERRIDE - { - return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes())).leakPtr(); - } - virtual void didRecreateOutputSurface(bool) OVERRIDE { } - - MOCK_METHOD0(willCommit, void()); - MOCK_METHOD0(didCommit, void()); - virtual void didCommitAndDrawFrame() OVERRIDE { } - virtual void didCompleteSwapBuffers() OVERRIDE { } -}; - class MockWebLayerTreeViewClientForThreadedTests : public MockWebLayerTreeViewClient { public: virtual void didBeginFrame() OVERRIDE @@ -80,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(); } @@ -90,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/WebLayerTreeViewTestCommon.h b/Source/WebKit/chromium/tests/WebLayerTreeViewTestCommon.h new file mode 100644 index 000000000..e2a62b6a3 --- /dev/null +++ b/Source/WebKit/chromium/tests/WebLayerTreeViewTestCommon.h @@ -0,0 +1,58 @@ +/* + * 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 INC. 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 INC. 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 WebLayerTreeViewTestCommon_h +#define WebLayerTreeViewTestCommon_h + +#include "CompositorFakeWebGraphicsContext3D.h" +#include "FakeWebCompositorOutputSurface.h" +#include <gmock/gmock.h> +#include <public/WebLayerTreeViewClient.h> + +namespace WebKit { + +class MockWebLayerTreeViewClient : public WebLayerTreeViewClient { +public: + virtual void scheduleComposite() OVERRIDE { } + virtual void updateAnimations(double frameBeginTime) OVERRIDE { } + MOCK_METHOD0(willBeginFrame, void()); + MOCK_METHOD0(didBeginFrame, void()); + virtual void layout() OVERRIDE { } + virtual void applyScrollAndScale(const WebSize& scrollDelta, float scaleFactor) OVERRIDE { } + + virtual WebCompositorOutputSurface* createOutputSurface() OVERRIDE + { + return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes())).leakPtr(); + } + virtual void didRecreateOutputSurface(bool) OVERRIDE { } + + MOCK_METHOD0(willCommit, void()); + MOCK_METHOD0(didCommit, void()); + virtual void didCommitAndDrawFrame() OVERRIDE { } + virtual void didCompleteSwapBuffers() OVERRIDE { } +}; + +} + +#endif // WebLayerTreeViewTestCommon_h diff --git a/Source/WebKit/chromium/tests/WebTransformAnimationCurveTest.cpp b/Source/WebKit/chromium/tests/WebTransformAnimationCurveTest.cpp index f18f87be2..2f4de73cb 100644 --- a/Source/WebKit/chromium/tests/WebTransformAnimationCurveTest.cpp +++ b/Source/WebKit/chromium/tests/WebTransformAnimationCurveTest.cpp @@ -26,7 +26,7 @@ #include <public/WebTransformAnimationCurve.h> -#include "cc/CCTimingFunction.h" +#include "CCTimingFunction.h" #include <gtest/gtest.h> #include <public/WebTransformOperations.h> diff --git a/Source/WebKit/chromium/tests/data/find_in_page.html b/Source/WebKit/chromium/tests/data/find_in_page.html new file mode 100644 index 000000000..c09c9dd06 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/find_in_page.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html> +<head> +<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> +</head> +<body> +This a find-in-page match rect test.</br> +result 0</br> +<iframe src="find_in_page_frame.html" height="300" scrolling="yes"></iframe> +</br> +result 1 +</body> +</html> diff --git a/Source/WebKit/chromium/tests/data/find_in_page_frame.html b/Source/WebKit/chromium/tests/data/find_in_page_frame.html new file mode 100644 index 000000000..47d29ae0f --- /dev/null +++ b/Source/WebKit/chromium/tests/data/find_in_page_frame.html @@ -0,0 +1,58 @@ +<!DOCTYPE html> +<html> +<head> +<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> +<style type="text/css"> +div.transform { + background-color: #00FF00; + width: 100px; + height: 100px; + padding-left: 30px; + padding-top: 20px; + -webkit-transform:matrix(0.866,0.5,-0.5,0.866,120,150); +} +div.scroll { + background-color: #00FFFF; + width: 100px; + height: 100px; + overflow: scroll; +} +div.fixed { + background-color: #FF0000; + left: 200px; + top: 50px; + width: 100px; + height: 100px; + position: fixed; +} +</style> +</head> +<body> +This is a test. +</br></br> +</br></br> +</br></br> +Foo bar. +</br></br> +</br></br> +</br></br> +result 2 +<div class="transform"> +result 3 +</div> +result 4 +<div class="fixed"> +result 5 +</div> +result 6 +<div class="scroll"> +result 7 +Foo bar. +</br></br> +</br></br> +</br></br> +result 8 +</div> +result 9 +</body> +</html> diff --git a/Source/WebKit/chromium/tests/data/select_range_basic.html b/Source/WebKit/chromium/tests/data/select_range_basic.html new file mode 100644 index 000000000..8ffc3fc2f --- /dev/null +++ b/Source/WebKit/chromium/tests/data/select_range_basic.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<html> +<body> +Some extra text. +<span id='target'>Some test text for testing.</span> +Some extra text. +<script> + function select() { + var range = document.createRange(); + range.selectNode(document.getElementById('target')); + window.getSelection().addRange(range); + } + window.onload = select; +</script> +</body> +</html> + diff --git a/Source/WebKit/chromium/tests/data/select_range_editable.html b/Source/WebKit/chromium/tests/data/select_range_editable.html new file mode 100644 index 000000000..a186979af --- /dev/null +++ b/Source/WebKit/chromium/tests/data/select_range_editable.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> +<body> +This text won't be selected because it isn't editable. +<span id='target' contenteditable="true">16-char header. This text is initially selected. 16-char footer.</span> +This text won't be selected because it isn't editable. +<script> + function select() { + var text = document.getElementById('target').firstChild; + var range = document.createRange(); + range.setStart(text, 16); + range.setEnd(text, 48); + window.getSelection().addRange(range); + } + window.onload = select; +</script> +</body> +</html> + diff --git a/Source/WebKit/chromium/tests/data/select_range_iframe.html b/Source/WebKit/chromium/tests/data/select_range_iframe.html new file mode 100644 index 000000000..f78089abb --- /dev/null +++ b/Source/WebKit/chromium/tests/data/select_range_iframe.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html> +<body> +This is a test case for selecting a range within an iframe. +<iframe width=400 height=200 id="iframe" src="select_range_basic.html"></iframe> +<script> + document.getElementById('iframe').contentWindow.focus(); +</script> +</body> +</html> + diff --git a/Source/WebKit/chromium/tests/data/select_range_scroll.html b/Source/WebKit/chromium/tests/data/select_range_scroll.html new file mode 100644 index 000000000..a67f189c3 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/select_range_scroll.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<html> +<body> +<div style='height:3000px'> + <span id="target">Some offscreen test text for testing.</span> +</div> +<script> + var range = document.createRange(); + range.selectNode(document.getElementById('target')); + window.getSelection().addRange(range); + window.scrollBy(0,500); +</script> +</body> +</html> + |