diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-03-12 14:11:15 +0100 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-03-12 14:11:15 +0100 |
| commit | dd91e772430dc294e3bf478c119ef8d43c0a3358 (patch) | |
| tree | 6f33ce4d5872a5691e0291eb45bf6ab373a5f567 /Source/WebKit/chromium | |
| parent | ad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (diff) | |
| download | qtwebkit-dd91e772430dc294e3bf478c119ef8d43c0a3358.tar.gz | |
Imported WebKit commit 3db4eb1820ac8fb03065d7ea73a4d9db1e8fea1a (http://svn.webkit.org/repository/webkit/trunk@110422)
This includes build fixes for the latest qtbase/qtdeclarative as well as the final QML2 API.
Diffstat (limited to 'Source/WebKit/chromium')
120 files changed, 5919 insertions, 2314 deletions
diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index 797b31c6c..8fe572481 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,1792 @@ +2012-03-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r110359. + http://trac.webkit.org/changeset/110359 + https://bugs.webkit.org/show_bug.cgi?id=80799 + + SelectPopupMenuTest.ClickItem failure (Requested by ukai on + #webkit). + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::gestureEvent): + (WebKit::WebViewImpl::applyAutofillSuggestions): + +2012-03-11 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: [chromium] add provisional test for the downstream sanity test. + https://bugs.webkit.org/show_bug.cgi?id=80784 + + Reviewed by Yury Semikhatsky. + + * src/js/Tests.js: + (.TestSuite.prototype.checkLogAndErrorMessages.validMessage): + (.TestSuite.prototype.checkLogAndErrorMessages.onConsoleMessage): + (.TestSuite.prototype.checkLogAndErrorMessages): + +2012-03-10 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r110384. + http://trac.webkit.org/changeset/110384 + https://bugs.webkit.org/show_bug.cgi?id=80774 + + compile failed on Chromium Win Release (Requested by ukai_home + on #webkit). + + * tests/CCOcclusionTrackerTest.cpp: + (WebCore::LayerChromiumWithForcedDrawsContent::LayerChromiumWithForcedDrawsContent): + (WebCore::LayerChromiumWithForcedDrawsContent::opaqueContentsRegion): + (WebCore::LayerChromiumWithForcedDrawsContent::setOpaquePaintRect): + (LayerChromiumWithForcedDrawsContent): + (WebCore::setLayerPropertiesForTesting): + (WebCore): + (WebCore::TestCCOcclusionTracker::TestCCOcclusionTracker): + (WebCore::TestCCOcclusionTracker::occlusionInScreenSpace): + (WebCore::TestCCOcclusionTracker::occlusionInTargetSurface): + (WebCore::TestCCOcclusionTracker::setOcclusionInScreenSpace): + (WebCore::TestCCOcclusionTracker::setOcclusionInTargetSurface): + (WebCore::TestCCOcclusionTracker::layerScissorRectInTargetSurface): + (WebCore::TestDamageClient::damageRect): + (WebCore::layerAddedToOccludedRegion): + (WebCore::layerAddedToOccludedRegionWithRotation): + (WebCore::layerAddedToOccludedRegionWithTranslation): + (WebCore::layerAddedToOccludedRegionWithRotatedSurface): + (WebCore::layerAddedToOccludedRegionWithSurfaceAlreadyOnStack): + (WebCore::layerAddedToOccludedRegionWithRotatedOffAxisSurface): + (WebCore::layerAddedToOccludedRegionWithMultipleOpaqueLayers): + (WebCore::surfaceOcclusionWithOverlappingSiblingSurfaces): + (WebCore::surfaceOcclusionInScreenSpace): + (WebCore::surfaceOcclusionInScreenSpaceDifferentTransforms): + (WebCore::occlusionInteractionWithFilters): + (WebCore::layerScissorRectOverTile): + (WebCore::screenScissorRectOverTile): + (WebCore::layerScissorRectOverCulledTile): + (WebCore::screenScissorRectOverCulledTile): + (WebCore::layerScissorRectOverPartialTiles): + (WebCore::screenScissorRectOverPartialTiles): + (WebCore::layerScissorRectOverNoTiles): + (WebCore::screenScissorRectOverNoTiles): + (WebCore::layerScissorRectForLayerOffOrigin): + (WebCore::damageRectOverTile): + (WebCore::damageRectOverCulledTile): + (WebCore::damageRectOverPartialTiles): + (WebCore::damageRectOverNoTiles): + (WebCore::TEST): + +2012-03-10 Dana Jansens <danakj@chromium.org> + + [chromium] Clean up culling tests and templatize to test impl constructs + https://bugs.webkit.org/show_bug.cgi?id=80613 + + Reviewed by Adrienne Walker. + + * tests/CCOcclusionTrackerTest.cpp: + (WebCore::TestContentLayerChromium::TestContentLayerChromium): + (WebCore::TestContentLayerChromium::opaqueContentsRegion): + (WebCore::TestContentLayerChromium::setOpaqueContentsRect): + (TestContentLayerChromium): + (TestContentLayerImpl): + (WebCore::TestContentLayerImpl::TestContentLayerImpl): + (WebCore::TestContentLayerImpl::opaqueContentsRegion): + (WebCore::TestContentLayerImpl::setOpaqueContentsRect): + (WebCore): + (WebCore::TestCCOcclusionTrackerBase::TestCCOcclusionTrackerBase): + (WebCore::TestCCOcclusionTrackerBase::occlusionInScreenSpace): + (WebCore::TestCCOcclusionTrackerBase::occlusionInTargetSurface): + (WebCore::TestCCOcclusionTrackerBase::setOcclusionInScreenSpace): + (WebCore::TestCCOcclusionTrackerBase::setOcclusionInTargetSurface): + (WebCore::TestCCOcclusionTrackerBase::layerScissorRectInTargetSurface): + (WebCore::TestDamageClient::damageRect): + (CCOcclusionTrackerTestMainThreadTypes): + (WebCore::CCOcclusionTrackerTestMainThreadTypes::createLayer): + (WebCore::CCOcclusionTrackerTestMainThreadTypes::createContentLayer): + (CCOcclusionTrackerTestImplThreadTypes): + (WebCore::CCOcclusionTrackerTestImplThreadTypes::createLayer): + (WebCore::CCOcclusionTrackerTestImplThreadTypes::createContentLayer): + (CCOcclusionTrackerTest): + (WebCore::CCOcclusionTrackerTest::TearDown): + (WebCore::CCOcclusionTrackerTest::createRoot): + (WebCore::CCOcclusionTrackerTest::createLayer): + (WebCore::CCOcclusionTrackerTest::createSurface): + (WebCore::CCOcclusionTrackerTest::createDrawingLayer): + (WebCore::CCOcclusionTrackerTest::createDrawingSurface): + (WebCore::CCOcclusionTrackerTest::calcDrawEtc): + (WebCore::CCOcclusionTrackerTest::setBaseProperties): + (WebCore::CCOcclusionTrackerTest::setProperties): + (CCOcclusionTrackerTestIdentityTransforms): + (WebCore::CCOcclusionTrackerTestIdentityTransforms::runMyTest): + (CCOcclusionTrackerTestRotatedChild): + (WebCore::CCOcclusionTrackerTestRotatedChild::runMyTest): + (CCOcclusionTrackerTestTranslatedChild): + (WebCore::CCOcclusionTrackerTestTranslatedChild::runMyTest): + (CCOcclusionTrackerTestChildInRotatedChild): + (WebCore::CCOcclusionTrackerTestChildInRotatedChild::runMyTest): + (CCOcclusionTrackerTestVisitTargetTwoTimes): + (WebCore::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest): + (CCOcclusionTrackerTestSurfaceRotatedOffAxis): + (WebCore::CCOcclusionTrackerTestSurfaceRotatedOffAxis::runMyTest): + (CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren): + (WebCore::CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren::runMyTest): + (CCOcclusionTrackerTestOverlappingSurfaceSiblings): + (WebCore::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest): + (CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms): + (WebCore::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest): + (CCOcclusionTrackerTestFilters): + (WebCore::CCOcclusionTrackerTestFilters::runMyTest): + (CCOcclusionTrackerTestLayerScissorRectOutsideChild): + (WebCore::CCOcclusionTrackerTestLayerScissorRectOutsideChild::runMyTest): + (CCOcclusionTrackerTestScreenScissorRectOutsideChild): + (WebCore::CCOcclusionTrackerTestScreenScissorRectOutsideChild::runMyTest): + (CCOcclusionTrackerTestDamageRectOutsideChild): + (WebCore::CCOcclusionTrackerTestDamageRectOutsideChild::runMyTest): + (CCOcclusionTrackerTestLayerScissorRectOverChild): + (WebCore::CCOcclusionTrackerTestLayerScissorRectOverChild::runMyTest): + (CCOcclusionTrackerTestScreenScissorRectOverChild): + (WebCore::CCOcclusionTrackerTestScreenScissorRectOverChild::runMyTest): + (CCOcclusionTrackerTestDamageRectOverChild): + (WebCore::CCOcclusionTrackerTestDamageRectOverChild::runMyTest): + (CCOcclusionTrackerTestLayerScissorRectPartlyOverChild): + (WebCore::CCOcclusionTrackerTestLayerScissorRectPartlyOverChild::runMyTest): + (CCOcclusionTrackerTestScreenScissorRectPartlyOverChild): + (WebCore::CCOcclusionTrackerTestScreenScissorRectPartlyOverChild::runMyTest): + (CCOcclusionTrackerTestDamageRectPartlyOverChild): + (WebCore::CCOcclusionTrackerTestDamageRectPartlyOverChild::runMyTest): + (CCOcclusionTrackerTestLayerScissorRectOverNothing): + (WebCore::CCOcclusionTrackerTestLayerScissorRectOverNothing::runMyTest): + (CCOcclusionTrackerTestScreenScissorRectOverNothing): + (WebCore::CCOcclusionTrackerTestScreenScissorRectOverNothing::runMyTest): + (CCOcclusionTrackerTestDamageRectOverNothing): + (WebCore::CCOcclusionTrackerTestDamageRectOverNothing::runMyTest): + (CCOcclusionTrackerTestLayerScissorRectForLayerOffOrigin): + (WebCore::CCOcclusionTrackerTestLayerScissorRectForLayerOffOrigin::runMyTest): + (CCOcclusionTrackerTestOpaqueContentsRegionEmpty): + (WebCore::CCOcclusionTrackerTestOpaqueContentsRegionEmpty::runMyTest): + (CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty): + (WebCore::CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty::runMyTest): + +2012-03-09 Jon Lee <jonlee@apple.com> + + Rename NotificationPresenter to NotificationClient + https://bugs.webkit.org/show_bug.cgi?id=80488 + <rdar://problem/10965558> + + Reviewed by Kentaro Hara. + + Refactor to use renamed WebCore::NotificationClient. + * src/AssertMatchingEnums.cpp: + * src/NotificationPresenterImpl.cpp: + (WebKit::NotificationPresenterImpl::checkPermission): + * src/NotificationPresenterImpl.h: + (NotificationPresenterImpl): + +2012-03-10 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r110363. + http://trac.webkit.org/changeset/110363 + https://bugs.webkit.org/show_bug.cgi?id=80757 + + link error in chromium: unresolved external symbol + webkit_support::CreateScopedTempDirectory(void) (Requested by + ukai_home on #webkit). + + * WebKit.gypi: + * tests/LevelDBTest.cpp: Removed. + +2012-03-10 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r110353. + http://trac.webkit.org/changeset/110353 + https://bugs.webkit.org/show_bug.cgi?id=80752 + + copmile failed on Chromium (Requested by ukai_home on + #webkit). + + * tests/CCOcclusionTrackerTest.cpp: + (WebCore::LayerChromiumWithForcedDrawsContent::LayerChromiumWithForcedDrawsContent): + (WebCore::LayerChromiumWithForcedDrawsContent::opaqueContentsRegion): + (WebCore::LayerChromiumWithForcedDrawsContent::setOpaquePaintRect): + (LayerChromiumWithForcedDrawsContent): + (WebCore::setLayerPropertiesForTesting): + (WebCore): + (WebCore::TestCCOcclusionTracker::TestCCOcclusionTracker): + (WebCore::TestCCOcclusionTracker::occlusionInScreenSpace): + (WebCore::TestCCOcclusionTracker::occlusionInTargetSurface): + (WebCore::TestCCOcclusionTracker::setOcclusionInScreenSpace): + (WebCore::TestCCOcclusionTracker::setOcclusionInTargetSurface): + (WebCore::TestCCOcclusionTracker::layerScissorRectInTargetSurface): + (WebCore::TestDamageClient::damageRect): + (WebCore::layerAddedToOccludedRegion): + (WebCore::layerAddedToOccludedRegionWithRotation): + (WebCore::layerAddedToOccludedRegionWithTranslation): + (WebCore::layerAddedToOccludedRegionWithRotatedSurface): + (WebCore::layerAddedToOccludedRegionWithSurfaceAlreadyOnStack): + (WebCore::layerAddedToOccludedRegionWithRotatedOffAxisSurface): + (WebCore::layerAddedToOccludedRegionWithMultipleOpaqueLayers): + (WebCore::surfaceOcclusionWithOverlappingSiblingSurfaces): + (WebCore::surfaceOcclusionInScreenSpace): + (WebCore::surfaceOcclusionInScreenSpaceDifferentTransforms): + (WebCore::occlusionInteractionWithFilters): + (WebCore::layerScissorRectOverTile): + (WebCore::screenScissorRectOverTile): + (WebCore::layerScissorRectOverCulledTile): + (WebCore::screenScissorRectOverCulledTile): + (WebCore::layerScissorRectOverPartialTiles): + (WebCore::screenScissorRectOverPartialTiles): + (WebCore::layerScissorRectOverNoTiles): + (WebCore::screenScissorRectOverNoTiles): + (WebCore::layerScissorRectForLayerOffOrigin): + (WebCore::damageRectOverTile): + (WebCore::damageRectOverCulledTile): + (WebCore::damageRectOverPartialTiles): + (WebCore::damageRectOverNoTiles): + (WebCore::TEST): + +2012-03-09 Robert Kroeger <rjkroege@chromium.org> + + Handle more Gesture* events by performing scrolls on the correct target ScrollableArea + https://bugs.webkit.org/show_bug.cgi?id=80311 + + Added a unit test for the changes to ScrollAnimatorNone to make sure that the two-call + transport of fling parameters is correctly delivered. + + Reviewed by James Robinson. + + * tests/ScrollAnimatorNoneTest.cpp: + (MockScrollAnimatorNone): + (MockScrollAnimatorNone::reset): + (MockScrollAnimatorNone::fireUpAnAnimation): + (TEST): + +2012-03-07 James Robinson <jamesr@chromium.org> + + [chromium] Deprecate renderDirectlyToWebView parameter of WebViewClient::createGraphicsContext3D() + https://bugs.webkit.org/show_bug.cgi?id=80523 + + Reviewed by Darin Fisher. + + * public/WebViewClient.h: + (WebViewClient): + (WebKit::WebViewClient::createGraphicsContext3D): + * public/platform/WebKitPlatformSupport.h: + (WebKit): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::createCompositorGraphicsContext3D): + +2012-03-09 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Handle LevelDB database corruption + https://bugs.webkit.org/show_bug.cgi?id=79413 + + Reviewed by Tony Chang. + + * WebKit.gypi: + * tests/LevelDBTest.cpp: Added. + (WebCore): + (SimpleComparator): + (WebCore::SimpleComparator::compare): + (WebCore::SimpleComparator::name): + (WebCore::encodeString): + (WebCore::TEST): + +2012-03-09 Tim Dresser <tdresser@chromium.org> + + [chromium] Increase size of Combo Box Options for touch and high DPI devices + https://bugs.webkit.org/show_bug.cgi?id=80027 + + Reviewed by Darin Fisher. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::gestureEvent): + (WebKit::WebViewImpl::applyAutofillSuggestions): + +2012-03-09 James Robinson <jamesr@chromium.org> + + [chromium] Roll chromium DEPS to r125600 + https://bugs.webkit.org/show_bug.cgi?id=80722 + + Unreviewed + + * DEPS: + +2012-03-09 Dana Jansens <danakj@chromium.org> + + [chromium] Clean up culling tests and templatize to test impl constructs + https://bugs.webkit.org/show_bug.cgi?id=80613 + + Reviewed by Adrienne Walker. + + * tests/CCOcclusionTrackerTest.cpp: + (WebCore::TestContentLayerChromium::TestContentLayerChromium): + (WebCore::TestContentLayerChromium::opaqueContentsRegion): + (WebCore::TestContentLayerChromium::setOpaqueContentsRect): + (TestContentLayerChromium): + (TestContentLayerImpl): + (WebCore::TestContentLayerImpl::TestContentLayerImpl): + (WebCore::TestContentLayerImpl::opaqueContentsRegion): + (WebCore::TestContentLayerImpl::setOpaqueContentsRect): + (WebCore): + (WebCore::TestCCOcclusionTrackerBase::TestCCOcclusionTrackerBase): + (WebCore::TestCCOcclusionTrackerBase::occlusionInScreenSpace): + (WebCore::TestCCOcclusionTrackerBase::occlusionInTargetSurface): + (WebCore::TestCCOcclusionTrackerBase::setOcclusionInScreenSpace): + (WebCore::TestCCOcclusionTrackerBase::setOcclusionInTargetSurface): + (WebCore::TestCCOcclusionTrackerBase::layerScissorRectInTargetSurface): + (WebCore::TestDamageClient::damageRect): + (CCOcclusionTrackerTestMainThreadTypes): + (WebCore::CCOcclusionTrackerTestMainThreadTypes::createLayer): + (WebCore::CCOcclusionTrackerTestMainThreadTypes::createContentLayer): + (CCOcclusionTrackerTestImplThreadTypes): + (WebCore::CCOcclusionTrackerTestImplThreadTypes::createLayer): + (WebCore::CCOcclusionTrackerTestImplThreadTypes::createContentLayer): + (CCOcclusionTrackerTest): + (WebCore::CCOcclusionTrackerTest::TearDown): + (WebCore::CCOcclusionTrackerTest::createRoot): + (WebCore::CCOcclusionTrackerTest::createLayer): + (WebCore::CCOcclusionTrackerTest::createSurface): + (WebCore::CCOcclusionTrackerTest::createDrawingLayer): + (WebCore::CCOcclusionTrackerTest::createDrawingSurface): + (WebCore::CCOcclusionTrackerTest::calcDrawEtc): + (WebCore::CCOcclusionTrackerTest::setBaseProperties): + (WebCore::CCOcclusionTrackerTest::setProperties): + (CCOcclusionTrackerTestIdentityTransforms): + (WebCore::CCOcclusionTrackerTestIdentityTransforms::runMyTest): + (CCOcclusionTrackerTestRotatedChild): + (WebCore::CCOcclusionTrackerTestRotatedChild::runMyTest): + (CCOcclusionTrackerTestTranslatedChild): + (WebCore::CCOcclusionTrackerTestTranslatedChild::runMyTest): + (CCOcclusionTrackerTestChildInRotatedChild): + (WebCore::CCOcclusionTrackerTestChildInRotatedChild::runMyTest): + (CCOcclusionTrackerTestVisitTargetTwoTimes): + (WebCore::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest): + (CCOcclusionTrackerTestSurfaceRotatedOffAxis): + (WebCore::CCOcclusionTrackerTestSurfaceRotatedOffAxis::runMyTest): + (CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren): + (WebCore::CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren::runMyTest): + (CCOcclusionTrackerTestOverlappingSurfaceSiblings): + (WebCore::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest): + (CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms): + (WebCore::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest): + (CCOcclusionTrackerTestFilters): + (WebCore::CCOcclusionTrackerTestFilters::runMyTest): + (CCOcclusionTrackerTestLayerScissorRectOutsideChild): + (WebCore::CCOcclusionTrackerTestLayerScissorRectOutsideChild::runMyTest): + (CCOcclusionTrackerTestScreenScissorRectOutsideChild): + (WebCore::CCOcclusionTrackerTestScreenScissorRectOutsideChild::runMyTest): + (CCOcclusionTrackerTestDamageRectOutsideChild): + (WebCore::CCOcclusionTrackerTestDamageRectOutsideChild::runMyTest): + (CCOcclusionTrackerTestLayerScissorRectOverChild): + (WebCore::CCOcclusionTrackerTestLayerScissorRectOverChild::runMyTest): + (CCOcclusionTrackerTestScreenScissorRectOverChild): + (WebCore::CCOcclusionTrackerTestScreenScissorRectOverChild::runMyTest): + (CCOcclusionTrackerTestDamageRectOverChild): + (WebCore::CCOcclusionTrackerTestDamageRectOverChild::runMyTest): + (CCOcclusionTrackerTestLayerScissorRectPartlyOverChild): + (WebCore::CCOcclusionTrackerTestLayerScissorRectPartlyOverChild::runMyTest): + (CCOcclusionTrackerTestScreenScissorRectPartlyOverChild): + (WebCore::CCOcclusionTrackerTestScreenScissorRectPartlyOverChild::runMyTest): + (CCOcclusionTrackerTestDamageRectPartlyOverChild): + (WebCore::CCOcclusionTrackerTestDamageRectPartlyOverChild::runMyTest): + (CCOcclusionTrackerTestLayerScissorRectOverNothing): + (WebCore::CCOcclusionTrackerTestLayerScissorRectOverNothing::runMyTest): + (CCOcclusionTrackerTestScreenScissorRectOverNothing): + (WebCore::CCOcclusionTrackerTestScreenScissorRectOverNothing::runMyTest): + (CCOcclusionTrackerTestDamageRectOverNothing): + (WebCore::CCOcclusionTrackerTestDamageRectOverNothing::runMyTest): + (CCOcclusionTrackerTestLayerScissorRectForLayerOffOrigin): + (WebCore::CCOcclusionTrackerTestLayerScissorRectForLayerOffOrigin::runMyTest): + (CCOcclusionTrackerTestOpaqueContentsRegionEmpty): + (WebCore::CCOcclusionTrackerTestOpaqueContentsRegionEmpty::runMyTest): + (CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty): + (WebCore::CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty::runMyTest): + +2012-03-09 Emil A Eklund <eae@chromium.org> + + Add roundedPoint to HitTestResult and change platform code to use it + https://bugs.webkit.org/show_bug.cgi?id=80715 + + Reviewed by James Robinson. + + Change ports to use roundedPoint to avoid exposing subpixel types to + platform code. + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::mouseDidMoveOverElement): + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): + +2012-03-09 W. James MacLean <wjmaclean@chromium.org> + + [chromium] Implement scroll physics architecture for impl/main thread + https://bugs.webkit.org/show_bug.cgi?id=79827 + + Reviewed by James Robinson. + + * WebKit.gypi: + * tests/PlatformGestureCurveTest.cpp: Added. + +2012-03-09 Tien-Ren Chen <trchen@chromium.org> + + [chromium] ScrollbarLayerChromium/CCScrollbarLayerImpl for CC-side scrollbar painting + https://bugs.webkit.org/show_bug.cgi?id=78872 + + Reviewed by James Robinson. + + * WebKit.gypi: + * tests/ScrollbarLayerChromiumTest.cpp: Added. + (WebCore): + (MockScrollbar): + (WebCore::MockScrollbar::x): + (WebCore::MockScrollbar::y): + (WebCore::MockScrollbar::width): + (WebCore::MockScrollbar::height): + (WebCore::MockScrollbar::size): + (WebCore::MockScrollbar::location): + (WebCore::MockScrollbar::parent): + (WebCore::MockScrollbar::root): + (WebCore::MockScrollbar::setFrameRect): + (WebCore::MockScrollbar::frameRect): + (WebCore::MockScrollbar::invalidate): + (WebCore::MockScrollbar::invalidateRect): + (WebCore::MockScrollbar::scrollbarOverlayStyle): + (WebCore::MockScrollbar::getTickmarks): + (WebCore::MockScrollbar::isScrollableAreaActive): + (WebCore::MockScrollbar::isScrollViewScrollbar): + (WebCore::MockScrollbar::convertFromContainingWindow): + (WebCore::MockScrollbar::isCustomScrollbar): + (WebCore::MockScrollbar::orientation): + (WebCore::MockScrollbar::value): + (WebCore::MockScrollbar::currentPos): + (WebCore::MockScrollbar::visibleSize): + (WebCore::MockScrollbar::totalSize): + (WebCore::MockScrollbar::maximum): + (WebCore::MockScrollbar::controlSize): + (WebCore::MockScrollbar::lineStep): + (WebCore::MockScrollbar::pageStep): + (WebCore::MockScrollbar::pressedPart): + (WebCore::MockScrollbar::hoveredPart): + (WebCore::MockScrollbar::styleChanged): + (WebCore::MockScrollbar::enabled): + (WebCore::MockScrollbar::setEnabled): + (WebCore::MockScrollbar::MockScrollbar): + (WebCore::MockScrollbar::~MockScrollbar): + (WebCore::TEST): + +2012-03-08 James Robinson <jamesr@chromium.org> + + [chromium] Expose the shared graphics context on WebView so callers can allocate resources on the main thread for the compositor to use + https://bugs.webkit.org/show_bug.cgi?id=80670 + + Reviewed by Stephen White. + + This exposes a context on WebView that is in the compositor's share group and can be used directly from the main + thread. This is useful for content that needs to allocate resources for the compositor to use, but cannot + directly use the compositor's context either because it cannot access the correct thread or because it needs to + initialize in situations where we cannot initialize a compositor (view) context - for instance before the native + window is created. + + * public/WebView.h: + (WebView): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::sharedGraphicsContext3D): + (WebKit): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-03-09 Dana Jansens <danakj@chromium.org> + + [chromium] Use opaque paints in CCOcclusionTracker + https://bugs.webkit.org/show_bug.cgi?id=80173 + + Reviewed by Adrienne Walker. + + * tests/CCOcclusionTrackerTest.cpp: + (WebCore::LayerChromiumWithForcedDrawsContent::opaqueContentsRegion): + (LayerChromiumWithForcedDrawsContent): + (WebCore::LayerChromiumWithForcedDrawsContent::setOpaquePaintRect): + (WebCore::setLayerPropertiesForTesting): + (WebCore): + (WebCore::layerAddedToOccludedRegion): + (WebCore::layerAddedToOccludedRegionWithRotation): + (WebCore::layerAddedToOccludedRegionWithTranslation): + (WebCore::layerAddedToOccludedRegionWithRotatedSurface): + (WebCore::layerAddedToOccludedRegionWithSurfaceAlreadyOnStack): + (WebCore::layerAddedToOccludedRegionWithRotatedOffAxisSurface): + (WebCore::layerAddedToOccludedRegionWithMultipleOpaqueLayers): + (WebCore::surfaceOcclusionWithOverlappingSiblingSurfaces): + (WebCore::surfaceOcclusionInScreenSpace): + (WebCore::surfaceOcclusionInScreenSpaceDifferentTransforms): + (WebCore::occlusionInteractionWithFilters): + (WebCore::layerScissorRectOverTile): + (WebCore::screenScissorRectOverTile): + (WebCore::layerScissorRectOverCulledTile): + (WebCore::screenScissorRectOverCulledTile): + (WebCore::layerScissorRectOverPartialTiles): + (WebCore::screenScissorRectOverPartialTiles): + (WebCore::layerScissorRectOverNoTiles): + (WebCore::screenScissorRectOverNoTiles): + (WebCore::layerScissorRectForLayerOffOrigin): + (WebCore::damageRectOverTile): + (WebCore::damageRectOverCulledTile): + (WebCore::damageRectOverPartialTiles): + (WebCore::damageRectOverNoTiles): + (WebCore::TEST): + * tests/TiledLayerChromiumTest.cpp: + (WTF::TEST): + (WTF): + +2012-03-09 Jon Lee <jonlee@apple.com> + + Add support for ENABLE(LEGACY_NOTIFICATIONS) + https://bugs.webkit.org/show_bug.cgi?id=80497 + + Reviewed by Adam Barth. + + Prep for b80472: Update API for Web Notifications + * features.gypi: + +2012-03-09 Ian Vollick <vollick@chromium.org> + + [chromium] Ensure we use the correct time when notifying animation started + https://bugs.webkit.org/show_bug.cgi?id=79537 + + Reviewed by James Robinson + + * src/WebCompositorInputHandlerImpl.cpp: + (WebKit::WebCompositorInputHandlerImpl::willDraw): + * src/WebCompositorInputHandlerImpl.h: + (WebCompositorInputHandlerImpl): + * tests/CCLayerTreeHostImplTest.cpp: + (WebKit::CCLayerTreeHostImplTest::postAnimationEventsToMainThreadOnImplThread): + (WebKit::TEST_F): + * tests/CCLayerTreeHostTest.cpp: + (WTF::TestHooks::animateLayers): + (WTF::TestHooks::updateAnimations): + (WTF::MockLayerTreeHostImpl::animateLayers): + (WTF::MockLayerTreeHostClient::updateAnimations): + (WTF::CCLayerTreeHostTestAddAnimation::CCLayerTreeHostTestAddAnimation): + (WTF::CCLayerTreeHostTestAddAnimation::animateLayers): + (WTF::CCLayerTreeHostTestAddAnimation::notifyAnimationStarted): + (CCLayerTreeHostTestAddAnimation): + +2012-03-09 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r110191, r110202, and r110279. + http://trac.webkit.org/changeset/110191 + http://trac.webkit.org/changeset/110202 + http://trac.webkit.org/changeset/110279 + https://bugs.webkit.org/show_bug.cgi?id=80694 + + They broke !ENABLE(INSPECTOR) builds (Requested by Ossy on + #webkit). + + * features.gypi: + +2012-03-09 Alexander Pavlov <apavlov@chromium.org> + + [chromium] Unreviewed, build fix after r110191 + + * features.gypi: + +2012-03-08 Ian Vollick <vollick@chromium.org> + + [chromium] Ensure that the cc thread animation framework continues to tick when the tab is backgrounded + https://bugs.webkit.org/show_bug.cgi?id=77668 + + Reviewed by James Robinson. + + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTest::postAddInstantAnimationToMainThread): + (CCLayerTreeHostTest): + (WTF::CCLayerTreeHostTest::dispatchAddInstantAnimation): + (WTF::CCLayerTreeHostTest::dispatchAddAnimation): + (WTF::CCLayerTreeHostTestAddAnimation::beginTest): + (WTF): + (CCLayerTreeHostTestTickAnimationWhileBackgrounded): + (WTF::CCLayerTreeHostTestTickAnimationWhileBackgrounded::CCLayerTreeHostTestTickAnimationWhileBackgrounded): + (WTF::CCLayerTreeHostTestTickAnimationWhileBackgrounded::beginTest): + (WTF::CCLayerTreeHostTestTickAnimationWhileBackgrounded::animateLayers): + (WTF::CCLayerTreeHostTestTickAnimationWhileBackgrounded::afterTest): + (WTF::TEST_F): + +2012-03-08 Jeff Timanus <twiz@chromium.org> + + [chromium] Force the Canvas2D GPU texture cache to 0 bytes for backgrounded tabs. + https://bugs.webkit.org/show_bug.cgi?id=79948 + + Reviewed by Stephen White. + + * src/GraphicsContext3DChromium.cpp: + (WebCore::GrMemoryAllocationChangedCallback::onGpuMemoryAllocationChanged): + (WebCore::GraphicsContext3DPrivate::grContext): + (WebCore::GraphicsContext3DPrivate::setVisibilityCHROMIUM): + +2012-03-08 Dana Jansens <danakj@chromium.org> + + [chromium] Replace completelyContains with Region::contains() + https://bugs.webkit.org/show_bug.cgi?id=80617 + + Reviewed by James Robinson. + + * tests/CCLayerTestCommon.cpp: + (CCLayerTestCommon): + (CCLayerTestCommon::verifyQuadsExactlyCoverRect): + * tests/CCLayerTestCommon.h: + (CCLayerTestCommon): + +2012-03-08 James Robinson <jamesr@chromium.org> + + Use an explicit attribute to signal that a context prefers to use a discrete GPU + https://bugs.webkit.org/show_bug.cgi?id=80639 + + Reviewed by Stephen White. + + * src/GraphicsContext3DChromium.cpp: + (WebCore::GraphicsContext3DPrivate::getContextAttributes): + (WebCore::GraphicsContext3D::create): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::createCompositorGraphicsContext3D): + +2012-03-08 Scott Byer <scottbyer@chromium.org> + + Have ScrollAnimatorNone use requestAnimationFrame + https://bugs.webkit.org/show_bug.cgi?id=78938 + + Reviewed by James Robinson. + + * src/ScrollbarGroup.h: + (WebCore): + (WebKit::ScrollbarGroup::hostWindow): + (ScrollbarGroup): + * tests/ScrollAnimatorNoneTest.cpp: + (MockScrollableArea::hostWindow): + +2012-03-08 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + Make elements with attributes smaller by eliminating the m_element back pointer in NamedNodeMap + https://bugs.webkit.org/show_bug.cgi?id=75069 + + Reviewed by Ryosuke Niwa. + + * src/WebElement.cpp: Include NamedNodeMap.h since Element.h doesn't include it anymore. + +2012-03-07 Kent Tamura <tkent@chromium.org> + + Remove meaningless code in RenderTextControlSingleLine::preferredContentWidth() + https://bugs.webkit.org/show_bug.cgi?id=80493 + + Reviewed by Hajime Morita. + + * src/WebInputElement.cpp: + RenderTextControlSingleLine::speechButtonElement() is removed. The + following functions get it from HTMLInputElement. + (WebKit::WebInputElement::getSpeechInputState): + (WebKit::WebInputElement::startSpeechInput): + (WebKit::WebInputElement::stopSpeechInput): + +2012-03-07 Adam Barth <abarth@webkit.org> + + Remove #define private public from WebCache.cpp + https://bugs.webkit.org/show_bug.cgi?id=80520 + + Reviewed by Eric Seidel. + + This patch removes a hack we added long ago when Chromium used a forked + copy of WebKit and editing WebCore caused merge pain. Now that we're + on trunk, we can unwind this hack. + + * src/WebCache.cpp: + (WebKit::WebCache::getUsageStats): + +2012-03-07 Joshua Bell <jsbell@chromium.org> + + [Chromium] IndexedDB: V8LocalContext creation in IDBKey extraction/injection is slow + https://bugs.webkit.org/show_bug.cgi?id=80358 + + Reviewed by Tony Chang. + + * tests/IDBBindingUtilitiesTest.cpp: + (WebCore::TEST): + +2012-03-07 Scott Byer <scottbyer@chromium.org> + + Get ScrollAnimatorNone to handle the stop and reverse cases. + https://bugs.webkit.org/show_bug.cgi?id=80455 + + Reviewed by James Robinson. + + * tests/ScrollAnimatorNoneTest.cpp: + (ScrollAnimatorNoneTest::updateDataFromParameters): + (TEST_F): + +2012-03-07 Dana Jansens <danakj@chromium.org> + + [chromium] Cull occluded tiles during paint + https://bugs.webkit.org/show_bug.cgi?id=76838 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostTest.cpp: + (WTF::ContentLayerChromiumWithUpdateTracking::idlePaintContentsIfDirty): + * tests/TiledLayerChromiumTest.cpp: + (WTF::FakeLayerTextureUpdater::Texture::prepareRect): + (WTF::FakeLayerTextureUpdater::FakeLayerTextureUpdater): + (FakeLayerTextureUpdater): + (WTF::FakeLayerTextureUpdater::prepareRectCount): + (WTF::FakeLayerTextureUpdater::clearPrepareRectCount): + (WTF::FakeLayerTextureUpdater::prepareRect): + (WTF::FakeTiledLayerChromium::prepareToUpdate): + (WTF::FakeTiledLayerChromium::prepareToUpdateIdle): + (WTF::FakeTiledLayerChromium::paintContentsIfDirty): + (WTF::TEST): + (WTF): + +2012-03-07 Elliot Poger <epoger@google.com> + + [Chromium] Remove use_skia option from GYP + https://bugs.webkit.org/show_bug.cgi?id=75811 + + Reviewed by Tony Chang. + + * WebKit.gyp: + * WebKit.gypi: + * features.gypi: + +2012-03-06 Dana Jansens <danakj@chromium.org> + + [chromium] Add clipping to scissor rect to CCOcclusionTracker + https://bugs.webkit.org/show_bug.cgi?id=79927 + + Reviewed by Adrienne Walker. + + * tests/CCOcclusionTrackerTest.cpp: + (WebCore::TestCCOcclusionTracker::TestCCOcclusionTracker): + (TestCCOcclusionTracker): + (WebCore::TestCCOcclusionTracker::setLayerScissorRect): + (WebCore::TestCCOcclusionTracker::useDefaultLayerScissorRect): + (WebCore::TestCCOcclusionTracker::layerScissorRect): + (WebCore): + (TestDamageClient): + (WebCore::TestDamageClient::damageRect): + (WebCore::TestDamageClient::TestDamageClient): + (WebCore::TestDamageClient::setDamageRect): + (WebCore::TEST): + +2012-03-06 Kenichi Ishibashi <bashi@chromium.org> + + [WebSocket] Introduce ThreadableWebSocketChannel::SendResult + https://bugs.webkit.org/show_bug.cgi?id=80356 + + Reviewed by Kent Tamura. + + * src/WebSocketImpl.cpp: + (WebKit::WebSocketImpl::sendText): Checks whether the return value of send() is ThreadableWebSocketChannel::SendSuccess. + (WebKit::WebSocketImpl::sendArrayBuffer): Ditto. + +2012-03-06 Nat Duca <nduca@chromium.org> + + [chromium] CCThreadProxy context lost support + https://bugs.webkit.org/show_bug.cgi?id=80100 + + Reviewed by James Robinson. + + * tests/CCSchedulerStateMachineTest.cpp: + * tests/CCSchedulerTest.cpp: + (WebKitTests::FakeCCSchedulerClient::scheduledActionBeginContextRecreation): + (WebKitTests::SchedulerClientThatSetNeedsDrawInsideDraw::scheduledActionBeginContextRecreation): + (WebKitTests::SchedulerClientThatSetNeedsCommitInsideDraw::scheduledActionBeginContextRecreation): + +2012-03-06 James Robinson <jamesr@chromium.org> + + [chromium] Null-check m_layerRenderer in CCLayerTreeHostImpl::finishAllRendering() + https://bugs.webkit.org/show_bug.cgi?id=80445 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + (FakeWebGraphicsContext3DMakeCurrentFails): + (WebKit::FakeWebGraphicsContext3DMakeCurrentFails::makeContextCurrent): + (WebKit): + (WebKit::TEST_F): + +2012-03-06 David Grogan <dgrogan@chromium.org> + + [Chromium] Add OVERRIDEs to WebWorkerClientImpl.h + https://bugs.webkit.org/show_bug.cgi?id=80434 + + Reviewed by Tony Chang. + + Tests: just that it compiles. + + * src/WebWorkerClientImpl.h: + (WebWorkerClientImpl): + +2012-03-06 David Grogan <dgrogan@chromium.org> + + IndexedDB: Check WebCommonWorkerClient::allowIndexedDB before proceeding from a shared worker + https://bugs.webkit.org/show_bug.cgi?id=79954 + + Tests: The 'allow' case will be tested once the patch at + http://webkit.org/b/80189 and + https://chromiumcodereview.appspot.com/9585031/ both land. Bug for + testing the 'deny' case is http://crbug.com/113738. + + Reviewed by Tony Chang. + + * public/WebCommonWorkerClient.h: + (WebKit::WebCommonWorkerClient::allowDatabase): + (WebKit::WebCommonWorkerClient::allowFileSystem): + (WebKit::WebCommonWorkerClient::openFileSystem): + (WebCommonWorkerClient): + (WebKit::WebCommonWorkerClient::allowIndexedDB): + * public/WebSharedWorkerClient.h: + (WebSharedWorkerClient): + * src/IDBFactoryBackendProxy.cpp: + (WebKit::AllowIndexedDBMainThreadBridge::create): + (WebKit::AllowIndexedDBMainThreadBridge::cancel): + (WebKit::AllowIndexedDBMainThreadBridge::signalCompleted): + (WebKit::AllowIndexedDBMainThreadBridge::AllowIndexedDBMainThreadBridge): + (WebKit::AllowIndexedDBMainThreadBridge::allowIndexedDBTask): + (AllowIndexedDBMainThreadBridge): + (WebKit::IDBFactoryBackendProxy::allowIDBFromWorkerThread): + * src/WebWorkerClientImpl.cpp: + (WebKit): + (WebKit::WebWorkerClientImpl::allowIndexedDB): + * src/WebWorkerClientImpl.h: + (WebWorkerClientImpl): + +2012-03-06 Stephen White <senorblanco@chromium.org> + + Unreviewed, rolling out r109825. + http://trac.webkit.org/changeset/109825 + https://bugs.webkit.org/show_bug.cgi?id=79413 + + Broke webkit_unit_tests on Chromium Win + + * WebKit.gypi: + * tests/LevelDBTest.cpp: Removed. + +2012-03-06 Takashi Toyoshima <toyoshim@chromium.org> + + [Chromium] [WebSocket] Add WebSocket extensions query WebKit API + https://bugs.webkit.org/show_bug.cgi?id=80190 + + Reviewed by Darin Fisher. + + * public/WebSocket.h: Add extensions() declaration. + (WebSocket): + * src/WebSocketImpl.cpp: Implement extensions() bridge. + (WebKit::WebSocketImpl::extensions): + (WebKit): + * src/WebSocketImpl.h: Add extensions() declaration. + (WebSocketImpl): + +2012-03-05 Kent Tamura <tkent@chromium.org> + + Do not reformat strings in <input type=number> on platforms using LocalizedNumberICU. + https://bugs.webkit.org/show_bug.cgi?id=78326 + + Reviewed by Hajime Morita. + + Add a test for WebCore/platform/text/LocalizedNumberICU. + + * WebKit.gypi: Added LocalizedNumberICUTest.cpp + * tests/LocalizedNumberICUTest.cpp: Added. + +2012-03-05 Kenneth Russell <kbr@google.com> + + [chromium] Notify CCLayerImpl tree of context loss and restoration + https://bugs.webkit.org/show_bug.cgi?id=80339 + + Reviewed by James Robinson. + + Unit test for notification of context loss and restoration. + + * tests/CCLayerTreeHostImplTest.cpp: + (WebKit): + (ContextLostNotificationCheckLayer): + (WebKit::ContextLostNotificationCheckLayer::create): + (WebKit::ContextLostNotificationCheckLayer::didLoseAndRecreateGraphicsContext): + (WebKit::ContextLostNotificationCheckLayer::didLoseAndRecreateGraphicsContextCalled): + (WebKit::ContextLostNotificationCheckLayer::ContextLostNotificationCheckLayer): + (WebKit::TEST_F): + +2012-03-05 Changhun Kang <temoochin@company100.net> + + Change the argument orders to match OpenGL's in GraphicsContext3D functions + https://bugs.webkit.org/show_bug.cgi?id=80120 + + Reviewed by Kenneth Russell. + + No new tests because this patch just change the order of arguments. + + * src/GraphicsContext3DChromium.cpp: + (WebCore::GraphicsContext3DPrivate::uniform1fv): + (WebCore::GraphicsContext3DPrivate::uniform1iv): + (WebCore::GraphicsContext3DPrivate::uniform2fv): + (WebCore::GraphicsContext3DPrivate::uniform2iv): + (WebCore::GraphicsContext3DPrivate::uniform3fv): + (WebCore::GraphicsContext3DPrivate::uniform3iv): + (WebCore::GraphicsContext3DPrivate::uniform4fv): + (WebCore::GraphicsContext3DPrivate::uniform4iv): + (WebCore::GraphicsContext3DPrivate::uniformMatrix2fv): + (WebCore::GraphicsContext3DPrivate::uniformMatrix3fv): + (WebCore::GraphicsContext3DPrivate::uniformMatrix4fv): + (WebCore): + * src/GraphicsContext3DPrivate.h: + (GraphicsContext3DPrivate): + +2012-03-05 Yoshifumi Inoue <yosin@chromium.org> + + [Chromium] WebOptionElement should inherit WebElement instead of WebFormControlElement + https://bugs.webkit.org/show_bug.cgi?id=80089 + + Change class hierarchy of WebOptionElement to match with specification. + + Reviewed by Darin Fisher. + + * public/WebOptionElement.h: Replace to WebElement from WebFormControlElement + (WebKit::WebOptionElement::WebOptionElement): + (WebKit::WebOptionElement::operator=): + (WebKit::WebOptionElement::assign): + * src/WebOptionElement.cpp: + (WebKit::WebOptionElement::WebOptionElement): + +2012-03-05 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Handle LevelDB database corruption + https://bugs.webkit.org/show_bug.cgi?id=79413 + + Reviewed by Tony Chang. + + * WebKit.gypi: + * tests/LevelDBTest.cpp: Added. + (WebCore): + (SimpleComparator): + (WebCore::SimpleComparator::compare): + (WebCore::SimpleComparator::name): + (WebCore::encodeString): + (WebCore::TEST): + +2012-03-05 Min Qin <qinmin@google.com> + + Enable context menu on android + + For android, long press is converted into a right mouse down event + So we will use that to invoke the context menu + https://bugs.webkit.org/show_bug.cgi?id=80332 + + Reviewed by Adam Barth. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::mouseDown): + +2012-03-05 Kent Tamura <tkent@chromium.org> + + [Chromium] Add new popup type: PagePopup + https://bugs.webkit.org/show_bug.cgi?id=80106 + + Reviewed by Darin Fisher. + + This is a preparation of implementing ChromeClient::openPagePopup and + closePagePopup. + + * WebKit.gyp: Add WebPagePopup.h and WebPagePopupImpl.cpp. + * public/WebPagePopup.h: + (WebPagePopup): Add WebPagePopup interface. + * public/WebPopupType.h: Add WebPopupTypePage. + * src/WebPagePopupImpl.cpp: + (WebKit::WebPagePopup::create): Temprary implementation which just returns 0. + +2012-03-05 Charlie Reis <creis@chromium.org> + + [chromium] Pass WebNavigationPolicy to WebViewClient::createView + https://bugs.webkit.org/show_bug.cgi?id=80057 + + Reviewed by Darin Fisher. + + * public/WebViewClient.h: + (WebViewClient): + (WebKit::WebViewClient::createView): + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::ChromeClientImpl): + (WebKit::ChromeClientImpl::createWindow): + (WebKit::ChromeClientImpl::getNavigationPolicy): + (WebKit): + (WebKit::ChromeClientImpl::show): + (WebKit::ChromeClientImpl::setNewWindowNavigationPolicy): + * src/ChromeClientImpl.h: + (ChromeClientImpl): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchCreatePage): + (WebKit::FrameLoaderClientImpl::dispatchDecidePolicyForNewWindowAction): + +2012-03-05 James Robinson <jamesr@chromium.org> + + [chromium] Initialize CCOverdrawCounts struct to zero + https://bugs.webkit.org/show_bug.cgi?id=80204 + + Reviewed by Adrienne Walker. + + Update test to use c'tor instead of {} struct initialization. + + * tests/CCQuadCullerTest.cpp: + (WebCore): + +2012-03-05 Takashi Toyoshima <toyoshim@chromium.org> + + [Chromium] [WebSocket] use OVERRIDE in WebSocketImpl.h + https://bugs.webkit.org/show_bug.cgi?id=80192 + + Reviewed by Kent Tamura. + + * src/WebSocketImpl.h: use OVERRIDE macro. + (WebSocketImpl): + +2012-03-05 Adam Barth <abarth@webkit.org> + + Geolocation should use a ScriptExecutionContext as its context object + https://bugs.webkit.org/show_bug.cgi?id=80248 + + Reviewed by Kentaro Hara. + + Rather than indirecting through the Frame to get the SecurityOrigin, we + should get the SecurityOrigin directly from ScriptExecutionContext. + + * src/WebGeolocationPermissionRequest.cpp: + (WebKit::WebGeolocationPermissionRequest::securityOrigin): + +2012-03-02 Andrey Kosyakov <caseq@chromium.org> + + Add instrumentation for frame start/end on timeline. + + Web Inspector: add timeline instrumentation for frame events + https://bugs.webkit.org/show_bug.cgi?id=80127 + + Reviewed by Pavel Feldman. + + - expose an instrumentation method from WebWidget to mark frame update start + + * public/WebWidget.h: + (WebWidget): + (WebKit::WebWidget::instrumentBeginFrame): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::instrumentBeginFrame): + (WebKit): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-03-03 Benjamin Poulain <benjamin@webkit.org> + + Remove the redundant method KURL::protocolInHTTPFamily() + https://bugs.webkit.org/show_bug.cgi?id=80216 + + Reviewed by Anders Carlsson. + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchWillPerformClientRedirect): + * src/WebPageSerializer.cpp: + (WebCore::retrieveResourcesForElement): + +2012-03-03 Hans Wennborg <hans@chromium.org> + + Implement Speech JavaScript API + https://bugs.webkit.org/show_bug.cgi?id=80019 + + Reviewed by Adam Barth. + + Add ENABLE_SCRIPTED_SPEECH and runtime flag. + + * features.gypi: + * public/WebRuntimeFeatures.h: + (WebRuntimeFeatures): + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enableScriptedSpeech): + (WebKit): + (WebKit::WebRuntimeFeatures::isScriptedSpeechEnabled): + +2012-03-03 Bill Budge <bbudge@chromium.org> + + Fixes AssociatedURLLoader support for Access-Control-Expose-Headers field in response. + https://bugs.webkit.org/show_bug.cgi?id=80198 + + Reviewed by Adam Barth. + + * src/AssociatedURLLoader.cpp: + * tests/AssociatedURLLoaderTest.cpp: + +2012-03-02 Dana Jansens <danakj@chromium.org> + + [Chromium] Allow plugins to set opaque() on their platform layer + https://bugs.webkit.org/show_bug.cgi?id=80171 + + Reviewed by James Robinson. + + * public/WebPluginContainer.h: + (WebPluginContainer): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::setOpaque): + (WebKit): + * src/WebPluginContainerImpl.h: + (WebPluginContainerImpl): + +2012-03-01 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + Make parser code not depend on NamedNodeMap + https://bugs.webkit.org/show_bug.cgi?id=79963 + + Reviewed by Adam Barth. + + * src/WebNamedNodeMap.cpp: + (WebKit::WebNamedNodeMap::attributeItem): + +2012-03-01 Dana Jansens <danakj@chromium.org> + + [chromium] Make opaque paint tracker aware of SkCanvas layers + https://bugs.webkit.org/show_bug.cgi?id=79145 + + Reviewed by Stephen White. + + * tests/PlatformContextSkiaTest.cpp: + (WebCore::TEST): + (WebCore): + +2012-03-01 Hironori Bono <hbono@chromium.org> + + Render overflow controls of an RTL element to its left-side. + https://bugs.webkit.org/show_bug.cgi?id=54623 + + This change adds a new flag WTF_USE_RTL_SCROLLBAR and render the + vertical scrollbars and resizers of RTL elements to their left side if + this new flag is enabled. + + Reviewed by Ryosuke Niwa. + + * features.gypi: Set WTF_USE_RTL_SCROLLBAR to 1 on Chromium. + +2012-03-01 James Robinson <jamesr@chromium.org> + + [chromium] Rename LayerChromium::name to debugName to be more consistent with other debug properties, make threadsafe + https://bugs.webkit.org/show_bug.cgi?id=79723 + + Reviewed by Adrienne Walker. + + * tests/LayerChromiumTest.cpp: + +2012-03-01 Dale Curtis <dalecurtis@chromium.org> + + Remove deprecated FFmpeg build directories. + https://bugs.webkit.org/show_bug.cgi?id=79282 + + We've switched the layout of the FFmpeg repo in Chrome and these paths + are no longer needed or valid. + + Reviewed by Dirk Pranke. + + * DEPS: + +2012-03-01 Dirk Pranke <dpranke@chromium.org> + + Roll chromium DEPS to 124511 + + Unreviewed, DEPS change. + + * DEPS: + +2012-02-29 Nat Duca <nduca@chromium.org> + + [chromium] Move context lost control code from CCSingleThreadProxy to CCLayerTreeHost + https://bugs.webkit.org/show_bug.cgi?id=79964 + + Reviewed by James Robinson. + + * src/WebLayerTreeView.cpp: + (WebKit::WebLayerTreeView::loseCompositorContext): + * src/WebLayerTreeViewImpl.cpp: + (WebKit::WebLayerTreeViewImpl::createContext): + (WebKit::WebLayerTreeViewImpl::didRecreateContext): + * src/WebLayerTreeViewImpl.h: + (WebLayerTreeViewImpl): + * tests/CCLayerTreeHostTest.cpp: + (WTF::MockLayerTreeHostClient::createContext): + (WTF::MockLayerTreeHostClient::didRecreateContext): + * tests/FakeCCLayerTreeHostClient.h: + (WebCore::FakeCCLayerTreeHostClient::createContext): + (WebCore::FakeCCLayerTreeHostClient::didRecreateContext): + +2012-03-01 Kentaro Hara <haraken@chromium.org> + + REGRESSION(r109288): WebViewImpl::enableAutoResizeMode loops infinitely + https://bugs.webkit.org/show_bug.cgi?id=77452 + + Reviewed by Hajime Morita. + + WebViewImpl::enableAutoResizeMode loops infinitely. + This patch fixes the following line: + + enableAutoResizeMode(enable, minSize, maxSize); + + to + enableAutoResizeMode(minSize, maxSize); + + to avoid the infinite loop. I guess this is the change originally intended. + + Test: webkit_unit_tests.WebViewTest.AutoResizeMinimumSize + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::enableAutoResizeMode): + +2012-02-29 Kinuko Yasuda <kinuko@chromium.org> + + Use the new createSnapshotFileAndReadMetadata API for FileEntry.file() + https://bugs.webkit.org/show_bug.cgi?id=79928 + + Reviewed by David Levin. + + In the new flow we first create an internal Blob URL for the + snapshot file and call the new createSnapshotFileAndReadMetadata() + WebKit API with the Blob URL. + + The implementor of createSnapshotFileAndReadMetadata() (i.e. chromium) + registers the created snapshot file with the given internal Blob URL. + + In the callback chain we call File::createWithName() to create a + new File using the returned platform path, and then call + unregisterBlobURL() to clean up the internal Blob URL. + + * src/AsyncFileSystemChromium.cpp: + (WebCore::AsyncFileSystemChromium::createSnapshotFileAndReadMetadata): Added. + (WebCore::AsyncFileSystemChromium::createSnapshotFileCallback): Added. + * src/AsyncFileSystemChromium.h: + * src/WorkerAsyncFileSystemChromium.cpp: + (WebCore::WorkerAsyncFileSystemChromium::createSnapshotFileAndReadMetadata): Added. + * src/WorkerAsyncFileSystemChromium.h: + * src/WorkerFileSystemCallbacksBridge.cpp: + (WebKit::WorkerFileSystemCallbacksBridge::postCreateSnapshotFileToMainThread): Added. + (WebKit::WorkerFileSystemCallbacksBridge::createSnapshotFileOnMainThread): Added. + * src/WorkerFileSystemCallbacksBridge.h: + (WorkerFileSystemCallbacksBridge): + +2012-02-29 Kinuko Yasuda <kinuko@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-02-29 W. James MacLean <wjmaclean@chromium.org> + + [chromium] Estimate pixel count for frame rate control + https://bugs.webkit.org/show_bug.cgi?id=74982 + + Reviewed by James Robinson. + + Adds mechanism to compute and collect statistics on pixel overdraw for selected frames. + + * tests/CCQuadCullerTest.cpp: + (WebCore): + (WebCore::TEST): + +2012-02-29 James Simonsen <simonjam@chromium.org> + + [chromium] Fix navigation start time on cross-renderer navigation + https://bugs.webkit.org/show_bug.cgi?id=75922 + + Reviewed by Darin Fisher. + + * public/WebDataSource.h: + * src/WebDataSource.cpp: + (WebKit::WebDataSource::setNavigationStartTime): Added. + * src/WebDataSource.h: + +2012-02-29 Ian Vollick <vollick@chromium.org> + + [chromium] Add impl-thread support for animation-timing-function + https://bugs.webkit.org/show_bug.cgi?id=79819 + + Reviewed by James Robinson. + + * tests/CCKeyframedAnimationCurveTest.cpp: + (WebCore::TEST): + (WebCore): + +2012-02-29 David Levin <levin@chromium.org> + + [chromium] Add the ability to turn off autoresize. + https://bugs.webkit.org/show_bug.cgi?id=77452 + + Reviewed by Darin Fisher. + + * public/WebView.h: + (WebKit::WebViewImpl::enableAutoResizeMode): Cleaned up the api. + (WebKit::WebViewImpl::disableAutoResizeMode): Added the ability to disable auto-resize. + (WebKit::WebViewImpl::enableAutoResizeMode): Deprecated it. + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::enableAutoResizeMode): Adjust for new api. + (WebKit::WebViewImpl::disableAutoResizeMode): Allow turning off autoresize. + (WebKit::WebViewImpl::enableAutoResizeMode): Call the other two apis, but + this api will be deleted shortly. + (WebKit::WebViewImpl::configureAutoResizeMode): Common code. + * src/WebViewImpl.h: + (WebViewImpl): Adjust to new public api. + +2012-02-29 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-02-29 Dana Jansens <danakj@chromium.org> + + [chromium] Don't let invalidation for next frame prevent tile upload + https://bugs.webkit.org/show_bug.cgi?id=79841 + + Reviewed by James Robinson. + + * tests/TiledLayerChromiumTest.cpp: + (WTF::TEST): + +2012-02-28 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r107917 and r109188. + http://trac.webkit.org/changeset/107917 + http://trac.webkit.org/changeset/109188 + https://bugs.webkit.org/show_bug.cgi?id=79865 + + Fix the chromium build. (Requested by dcheng on #webkit). + + * src/WebDragData.cpp: + (WebKit::WebDragData::items): + +2012-02-28 Ryosuke Niwa <rniwa@webkit.org> + + Chromium build fix attempt. + + * src/WebDragData.cpp: + +2012-02-28 Jonathan Backer <backer@chromium.org> + + [chromium] Reset damage tracker on visibility change. + https://bugs.webkit.org/show_bug.cgi?id=79267 + + Reviewed by James Robinson. + + * tests/CCLayerTreeHostImplTest.cpp: + (WebKit::PartialSwapTrackerContext::getString): + (WebKit): + (WebKit::TEST_F): + +2012-02-28 Tim Dresser <tdresser@chromium.org> + + Provide DefaultDeviceScaleFactor though WebSettings + https://bugs.webkit.org/show_bug.cgi?id=79534 + + Reviewed by Darin Fisher. + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setDefaultDeviceScaleFactor): + (WebKit): + * src/WebSettingsImpl.h: + (WebSettingsImpl): + +2012-02-28 Gary Kacmarcik <garykac@chromium.org> + + [chromium] Set nativeKeyCode to include Windows scan code + https://bugs.webkit.org/show_bug.cgi?id=79289 + + Reviewed by Ryosuke Niwa. + + Set the key event's nativeKeyCode on Windows Chromium so that it + actually includes the native scancode and other context bits. + Currently on Windows, the nativeKeyCode is set to be the same value as + the windowsKeyCode, which is redundant. + + The actual native key information is required so that components (like + plugins) can reconstruct the original key event. The value stored in + the windowsKeyCode is a Windows virtual key code which does not provide + sufficient info to disambiguate the actual key being pressed (for + example, it cannot distinguish between the left and right shift keys). + + All platforms except Windows currently send native key event info, so + this change will bring Windows in line with other platforms. + + This change is part of our effort to send enhanced keycode information + to Pepper plugins in Chromium. + + * src/win/WebInputEventFactory.cpp: + (WebKit::WebInputEventFactory::keyboardEvent): + +2012-02-28 Adam Klein <adamk@chromium.org> + + Unreviewed, speculative test fix after r109016. + + * tests/TransparencyWinTest.cpp: + (WebCore::TEST): Update all ImageBuffer::create calls to include a scale of 1. + +2012-02-28 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-02-27 James Kozianski <koz@chromium.org> + + Add missing parameter to didCreateScriptContext() so it overrides base class again. + https://bugs.webkit.org/show_bug.cgi?id=79742 + + Reviewed by Kent Tamura. + + * tests/WebFrameTest.cpp: + +2012-02-27 Kenichi Ishibashi <bashi@chromium.org> + + [Chromium] Unreviewed gardening, Disable TransparencyWin.OpaqueCompositeLayerPixel + + * tests/TransparencyWinTest.cpp: + (WebCore::TEST): + +2012-02-27 Kinuko Yasuda <kinuko@chromium.org> + + [chromium] Add createSnapshotFile API to WebFileSystem to create File snapshots for filesystem files + https://bugs.webkit.org/show_bug.cgi?id=79394 + + Reviewed by Darin Fisher. + + * public/platform/WebFileSystem.h: + (WebKit::WebFileSystem::createSnapshotFileAndReadMetadata): Added. + +2012-02-27 James Kozianski <koz@chromium.org> + + [chromium] Plumb extensionGroup into didCreateScriptContext(). + https://bugs.webkit.org/show_bug.cgi?id=79072 + + Reviewed by Darin Fisher. + + * public/WebFrameClient.h: + (WebKit::WebFrameClient::didCreateScriptContext): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::didCreateScriptContext): + * src/FrameLoaderClientImpl.h: + (FrameLoaderClientImpl): + +2012-02-27 Adrienne Walker <enne@google.com> + + [chromium] Unreviewed gardening, disable TransparencyWinTest unit tests + https://bugs.webkit.org/show_bug.cgi?id=79718 + + * tests/TransparencyWinTest.cpp: + +2012-02-26 Hajime Morrita <morrita@chromium.org> + + Move ChromeClient::showContextMenu() to ContextMenuClient + https://bugs.webkit.org/show_bug.cgi?id=79427 + + Reviewed by Adam Barth. + + * src/ChromeClientImpl.h: + (ChromeClientImpl): + +2012-02-26 James Robinson <jamesr@chromium.org> + + Take 2 build fix. + + * tests/CCLayerTreeHostImplTest.cpp: + (WebKit::TEST_F): + +2012-02-26 James Robinson <jamesr@chromium.org> + + Compile fix for CCLayerTreeHostImpl test. + + * tests/CCLayerTreeHostImplTest.cpp: + (WebKit::TEST_F): + +2012-02-26 James Robinson <jamesr@chromium.org> + + [chromium] Wire up shouldUpdateScrollPositionOnMainThread and nonFastScrollableRegion to compositor + https://bugs.webkit.org/show_bug.cgi?id=79155 + + Reviewed by Adam Barth. + + Add new tests for shouldScrollOnMainThread and nonFastScrollableRegion properties. + + * tests/CCLayerTreeHostImplTest.cpp: + (WebKit::TEST_F): + (WebKit): + * tests/LayerChromiumTest.cpp: + +2012-02-25 Adrienne Walker <enne@google.com> + + [chromium] Unreviewed gardening, fix Linux Clang OwnPtr breakage + https://bugs.webkit.org/show_bug.cgi?id=78404 + + r108886 doesn't compile on Linux Clang due to OwnPtr's public copy + constructor (i.e. "has internal linkage but is not defined"). Fixed + locally by changing copy initialization to direct initialization. + + * tests/TiledLayerChromiumTest.cpp: + (WTF::TEST): + +2012-02-24 Tien-Ren Chen <trchen@chromium.org> + + [chromium] Replace RefPtr with OwnPtr for CCLayerImpl tree structure + https://bugs.webkit.org/show_bug.cgi?id=78404 + + Reviewed by James Robinson. + + * tests/CCDamageTrackerTest.cpp: + (WebKitTests::executeCalculateDrawTransformsAndVisibility): + (WebKitTests::emulateDrawingOneFrame): + (WebKitTests::createTestTreeWithOneSurface): + (WebKitTests::createTestTreeWithTwoSurfaces): + (WebKitTests::createAndSetUpTestTreeWithOneSurface): + (WebKitTests::createAndSetUpTestTreeWithTwoSurfaces): + (WebKitTests::TEST_F): + * tests/CCLayerImplTest.cpp: + (WebCore::TEST): + * tests/CCLayerIteratorTest.cpp: + * tests/CCLayerSorterTest.cpp: + (WebCore::TEST): + * tests/CCLayerTreeHostCommonTest.cpp: + (WebCore::TEST): + * tests/CCLayerTreeHostImplTest.cpp: + (WebKit::CCLayerTreeHostImplTest::setupScrollAndContentsLayers): + (WebKit::TEST_F): + (WebKit::DidDrawCheckLayer::create): + (WebKit::BlendStateCheckLayer::create): + * tests/CCRenderSurfaceTest.cpp: + (WebCore::TEST): + * tests/CCSolidColorLayerImplTest.cpp: + (CCLayerTestCommon::TEST): + * tests/CCTiledLayerImplTest.cpp: + (CCLayerTestCommon::createLayer): + (CCLayerTestCommon::TEST): + (CCLayerTestCommon::getQuads): + * tests/Canvas2DLayerChromiumTest.cpp: + (WebCore::Canvas2DLayerChromiumTest::fullLifecycleTest): + * tests/TiledLayerChromiumTest.cpp: + (WTF::TEST): + * tests/TreeSynchronizerTest.cpp: + (WebKitTests::MockCCLayerImpl::create): + (WebKitTests::MockLayerChromium::createCCLayerImpl): + (WebKitTests::expectTreesAreIdentical): + (WebKitTests::TEST): + +2012-02-08 James Robinson <jamesr@chromium.org> + + [chromium] Make WebViewImpl depend on WebLayerTreeView instead of CCLayerTreeHost + https://bugs.webkit.org/show_bug.cgi?id=75591 + + Reviewed by Kenneth Russell. + + This converts WebViewImpl from depending on CCLayerTreeHost to WebLayerTreeView in order to provide better + isolation and allow for future refactorings. The changes to WebViewImpl are mostly mechanical. The + WebLayerTreeView and WebLayerTreeViewClient interfaces have both grown and changed slightly: + + - Setup path for WebLayerTreeView changed to expose an initialize() function instead of a create() factory + function. The new model is that a WebLayerTreeView when constructed is in a null state. Calling initialize() + attempts to re-initialize the WLTV, which can either fail or succeed. All other functions must be called on a + successfully initialized view. + + - WebLayerTreeView expanded to include functionality that CCLayerTreeHost exposes but WebLayerTreeView did not. + Some of this is only valid for the single thread case and will be removed when we invert the scheduling control + logic, these bits are commented. + + - WebLayerTreeViewClient expanded with some flow-control related APIs. + + Refactor only, no change in behavior. + + * public/platform/WebLayerTreeView.h: + (WebKit::WebLayerTreeView::Settings::Settings): + (WebKit::WebLayerTreeView::isNull): + * public/platform/WebLayerTreeViewClient.h: + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::scheduleCompositingLayerSync): + * src/WebLayerTreeView.cpp: + (WebKit::WebLayerTreeView::initialize): + (WebKit::WebLayerTreeView::compositorIdentifier): + (WebKit::WebLayerTreeView::setVisible): + (WebKit::WebLayerTreeView::setNeedsAnimate): + (WebKit::WebLayerTreeView::updateAnimations): + (WebKit::WebLayerTreeView::setNeedsRedraw): + (WebKit::WebLayerTreeView::setPageScaleFactorAndLimits): + (WebKit::WebLayerTreeView::startPageScaleAnimation): + (WebKit::WebLayerTreeView::finishAllRendering): + (WebKit::WebLayerTreeView::context): + (WebKit::WebLayerTreeView::loseCompositorContext): + * src/WebLayerTreeViewImpl.cpp: + (WebKit::WebLayerTreeViewImpl::didRecreateGraphicsContext): + (WebKit::WebLayerTreeViewImpl::didCommitAndDrawFrame): + (WebKit::WebLayerTreeViewImpl::didCompleteSwapBuffers): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::animate): + (WebKit::WebViewImpl::doPixelReadbackToCanvas): + (WebKit::WebViewImpl::paint): + (WebKit::WebViewImpl::composite): + (WebKit::WebViewImpl::loseCompositorContext): + (WebKit::WebViewImpl::computePageScaleFactorLimits): + (WebKit::WebViewImpl::addPageOverlay): + (WebKit::WebViewImpl::removePageOverlay): + (WebKit::WebViewImpl::setRootGraphicsLayer): + (WebKit::WebViewImpl::scheduleCompositingLayerSync): + (WebKit::WebViewImpl::scrollRootLayerRect): + (WebKit::WebViewImpl::invalidateRootLayerRect): + (WebKit::WebViewImpl::scheduleAnimation): + (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): + (WebKit::WebViewImpl::createContext3D): + (WebKit::WebViewImpl::applyScrollAndScale): + (WebKit::WebViewImpl::didRebindGraphicsContext): + (WebKit::WebViewImpl::updateLayerTreeViewport): + (WebKit::WebViewImpl::graphicsContext3D): + (WebKit::WebViewImpl::setVisibilityState): + * src/WebViewImpl.h: + * tests/WebLayerTest.cpp: + +2012-02-24 Ian Vollick <vollick@chromium.org> + + [chromium] Plumb animation started notifications from CCLayerTreeHost to GraphicsLayerChromium + https://bugs.webkit.org/show_bug.cgi?id=77646 + + Reviewed by James Robinson. + + * tests/CCLayerTreeHostTest.cpp: + (TestHooks): + (WTF::TestHooks::notifyAnimationStarted): + (WTF::TestHooks::notifyAnimationFinished): + (WTF::MockLayerTreeHost::create): + (WTF::CCLayerTreeHostTestAddAnimation::CCLayerTreeHostTestAddAnimation): + (WTF::CCLayerTreeHostTestAddAnimation::animateLayers): + (WTF::CCLayerTreeHostTestAddAnimation::notifyAnimationStarted): + (CCLayerTreeHostTestAddAnimation): + (WTF::CCLayerTreeHostTestAddAnimation::notifyAnimationFinished): + +2012-02-24 James Robinson <jamesr@chromium.org> + + [chromium] WebKit::setColorNames is a client API + https://bugs.webkit.org/show_bug.cgi?id=79539 + + Reviewed by Darin Fisher. + + * WebKit.gyp: + * public/WebColorName.h: Renamed from Source/Platform/chromium/public/WebColorName.h. + (WebKit): + * public/platform/WebColorName.h: + * src/WebColor.cpp: + +2012-02-24 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r108860. + http://trac.webkit.org/changeset/108860 + https://bugs.webkit.org/show_bug.cgi?id=79544 + + "Breaks Linux compile" (Requested by enne on #webkit). + + * WebKit.gyp: + * public/platform/WebColorName.h: + * src/WebColor.cpp: Renamed from Source/WebKit/chromium/src/WebColorName.cpp. + (WebKit): + (WebKit::toCSSValueKeyword): + (WebKit::setNamedColors): + +2012-02-24 James Robinson <jamesr@chromium.org> + + [chromium] WebKit::setColorNames is a client API + https://bugs.webkit.org/show_bug.cgi?id=79539 + + Reviewed by Darin Fisher. + + * WebKit.gyp: + * public/WebColorName.h: Renamed from Source/Platform/chromium/public/WebColorName.h. + (WebKit): + * public/platform/WebColorName.h: + * src/WebColor.cpp: + +2012-02-22 James Robinson <jamesr@chromium.org> + + [chromium] Move WebGraphicsContext3D header into the Platform directory + https://bugs.webkit.org/show_bug.cgi?id=79301 + + Reviewed by Adam Barth. + + Moves WebGraphicsContext3D and WebNonCopyable (which WGC3D depends on). + + * public/platform/WebGraphicsContext3D.h: + * public/platform/WebNonCopyable.h: + +2012-02-24 Michal Mocny <mmocny@google.com> + + [chromium] Purge Skia's GPU texture cache using GL_CHROMIUM_gpu_memory_manager + https://bugs.webkit.org/show_bug.cgi?id=78265 + + Reviewed by Stephen White. + + * src/GraphicsContext3DChromium.cpp: + (GrMemoryAllocationChangedCallback): + (WebCore::GrMemoryAllocationChangedCallback::GrMemoryAllocationChangedCallback): + (WebCore::GrMemoryAllocationChangedCallback::onGpuMemoryAllocationChanged): + (WebCore): + (WebCore::GraphicsContext3DPrivate::grContext): + +2012-02-24 James Robinson <jamesr@chromium.org> + + [chromium] Remove deprecated and unused WebGraphicsContext3D::initialize call + https://bugs.webkit.org/show_bug.cgi?id=79296 + + Reviewed by Kenneth Russell. + + The old way to initialize a WebGraphicsContext3D from inside WebKit was to call initialize() on it with a + WebView*. The new way to do this is via the WebViewClient interface. This deletes the old, unused path. + + * public/platform/WebGraphicsContext3D.h: + (WebKit): + * tests/CCLayerTreeHostImplTest.cpp: + * tests/FakeWebGraphicsContext3D.h: + +2012-02-23 James Robinson <jamesr@chromium.org> + + [chromium] Move Web*Layer* headers into Platform + https://bugs.webkit.org/show_bug.cgi?id=79425 + + Reviewed by Adam Barth. + + Adds forwarding headers for Web*Layer* APIs and their dependencies. The forwarding headers for the Web*Layer* + APIs are temporary since Web*Layer* is not exposed in the client interface. The other headers (such as + WebColor) are exposed in both the client and platform APIs, so the forwarding headers are permanent, although we + might move them back down to public/ at some point. + + * public/platform/WebCanvas.h: + * public/platform/WebColor.h: + * public/platform/WebColorName.h: + * public/platform/WebContentLayer.h: + * public/platform/WebContentLayerClient.h: + * public/platform/WebExternalTextureLayer.h: + * public/platform/WebLayer.h: + * public/platform/WebLayerTreeView.h: + * public/platform/WebLayerTreeViewClient.h: + * public/platform/WebPrivatePtr.h: + * public/platform/WebSolidColorLayer.h: + +2012-02-24 Peter Collingbourne <peter@pcc.me.uk> + + [chromium] Have WebFrameImpl::selectionAsMarkup create interchange markup. + https://bugs.webkit.org/show_bug.cgi?id=77307 + + Reviewed by Tony Chang. + + This function is currently used to build markup in order to + print the selection, and will also be used to build markup for + the clipboard. Without this change, the markup will refer to + (for example) nonexistent CSS classes and invalid relative + paths and therefore will not be interpreted correctly. + + Chromium bug: http://crbug.com/23329 + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::selectionAsMarkup): + +2012-02-24 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed: chromium image for inspector status bar button updated. + + * src/js/Images/segmentSelectedEndChromium.png: + 2012-02-24 Shinya Kawanaka <shinyak@chromium.org> SpellCheckRequest needs to know the context where the spellcheck happened. diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index ba422445c..23e521aa7 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': '123353' + 'chromium_rev': '125600' } deps = { @@ -145,8 +145,6 @@ deps_os = { 'win': { 'third_party/cygwin': From('chromium_deps', 'src/third_party/cygwin'), - 'third_party/ffmpeg/binaries/chromium/win/ia32': - From('chromium_deps', 'src/third_party/ffmpeg/binaries/chromium/win/ia32'), 'third_party/lighttpd': From('chromium_deps', 'src/third_party/lighttpd'), 'third_party/nss': diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp index f8e58b383..1e1a41665 100644 --- a/Source/WebKit/chromium/WebKit.gyp +++ b/Source/WebKit/chromium/WebKit.gyp @@ -112,6 +112,7 @@ 'public/WebCache.h', 'public/WebColorChooser.h', 'public/WebColorChooserClient.h', + 'public/WebColorName.h', 'public/WebCommonWorkerClient.h', 'public/WebCompositionUnderline.h', 'public/WebCompositor.h', @@ -214,6 +215,7 @@ 'public/WebNotificationPresenter.h', 'public/WebOptionElement.h', 'public/WebPageOverlay.h', + 'public/WebPagePopup.h', 'public/WebPageSerializer.h', 'public/WebPageSerializerClient.h', 'public/WebPageVisibilityState.h', @@ -292,7 +294,6 @@ 'public/platform/WebCanvas.h', 'public/platform/WebClipboard.h', 'public/platform/WebColor.h', - 'public/platform/WebColorName.h', 'public/platform/WebCommon.h', 'public/platform/WebContentLayer.h', 'public/platform/WebContentLayerClient.h', @@ -494,9 +495,9 @@ 'src/WebBlob.cpp', 'src/WebBlobData.cpp', 'src/WebCache.cpp', - 'src/WebColor.cpp', 'src/WebColorChooserClientImpl.cpp', 'src/WebColorChooserClientImpl.h', + 'src/WebColorName.cpp', 'src/WebCommon.cpp', 'src/WebCompositorImpl.cpp', 'src/WebCompositorImpl.h', @@ -615,6 +616,7 @@ 'src/WebNodeList.cpp', 'src/WebNotification.cpp', 'src/WebOptionElement.cpp', + 'src/WebPagePopupImpl.cpp', 'src/WebPageSerializer.cpp', 'src/WebPageSerializerImpl.cpp', 'src/WebPageSerializerImpl.h', @@ -824,20 +826,13 @@ ['exclude', '/android/'], ], }], + # TODO: we exclude CG.cpp on both sides of the below conditional. Move elsewhere? ['OS=="mac"', { 'include_dirs': [ 'public/mac', ], - 'conditions': [ - ['use_skia==0', { - 'sources/': [ - ['exclude', 'Skia\\.cpp$'], - ], - },{ # use_skia - 'sources/': [ - ['exclude', 'CG\\.cpp$'], - ], - }], + 'sources/': [ + ['exclude', 'CG\\.cpp$'], ], }, { # else: OS!="mac" 'sources/': [ diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index e91e336db..87d41bfb9 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -92,6 +92,7 @@ 'tests/ClipboardChromiumTest.cpp', 'tests/CompositorFakeGraphicsContext3D.h', 'tests/CompositorFakeWebGraphicsContext3D.h', + 'tests/DragImageTest.cpp', 'tests/FakeCCLayerTreeHostClient.h', 'tests/FakeGraphicsContext3DTest.cpp', 'tests/FakeWebGraphicsContext3D.h', @@ -101,15 +102,20 @@ 'tests/IDBBindingUtilitiesTest.cpp', 'tests/IDBKeyPathTest.cpp', 'tests/IDBLevelDBCodingTest.cpp', + 'tests/ImageLayerChromiumTest.cpp', 'tests/KeyboardTest.cpp', 'tests/KURLTest.cpp', 'tests/LayerChromiumTest.cpp', 'tests/LayerTextureUpdaterTest.cpp', + 'tests/LocalizedNumberICUTest.cpp', 'tests/PaintAggregatorTest.cpp', + 'tests/PlatformGestureCurveTest.cpp', + 'tests/PlatformContextSkiaTest.cpp', 'tests/PODArenaTest.cpp', 'tests/PODIntervalTreeTest.cpp', 'tests/PODRedBlackTreeTest.cpp', 'tests/RenderTableCellTest.cpp', + 'tests/ScrollbarLayerChromiumTest.cpp', 'tests/TextureManagerTest.cpp', 'tests/TiledLayerChromiumTest.cpp', 'tests/TilingDataTest.cpp', @@ -131,13 +137,6 @@ ], 'conditions': [ - ['use_skia == 1', { - 'webkit_unittest_files': [ - 'tests/DragImageTest.cpp', - 'tests/ImageLayerChromiumTest.cpp', - 'tests/PlatformContextSkiaTest.cpp', - ], - }], ['OS=="win"', { 'webkit_unittest_files': [ # FIXME: Port PopupMenuTest to Linux and Mac. diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index 4c46d4de4..5a033c8cf 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -63,6 +63,7 @@ 'ENABLE_INPUT_TYPE_WEEK=0', 'ENABLE_JAVASCRIPT_DEBUGGER=1', 'ENABLE_JAVASCRIPT_I18N_API=1', + 'ENABLE_LEGACY_NOTIFICATIONS=1', 'ENABLE_LINK_PREFETCH=1', 'ENABLE_MEDIA_SOURCE=1', 'ENABLE_MEDIA_STATISTICS=1', @@ -81,6 +82,7 @@ 'ENABLE_REQUEST_ANIMATION_FRAME=1', 'ENABLE_RUBY=1', 'ENABLE_SANDBOX=1', + 'ENABLE_SCRIPTED_SPEECH=1', 'ENABLE_SHADOW_DOM=1', 'ENABLE_SHARED_WORKERS=1', 'ENABLE_SMOOTH_SCROLLING=1', @@ -106,6 +108,7 @@ # We can't define it here because it should be present only # in Debug or release_valgrind_build=1 builds. 'WTF_USE_OPENTYPE_SANITIZER=1', + 'WTF_USE_RTL_SCROLLBAR=1', 'WTF_USE_SKIA_TEXT=<(enable_skia_text)', 'WTF_USE_WEBP=1', 'WTF_USE_WEBKIT_IMAGE_DECODERS=1', @@ -118,7 +121,6 @@ 'enable_svg%': 1, 'enable_viewport%': 0, 'enable_touch_events%': 1, - 'use_skia%': 0, 'enable_touch_icon_loading%' : 0, 'enable_mutation_observers%': 1, }, @@ -126,7 +128,6 @@ 'enable_skia_text%': '<(enable_skia_text)', 'enable_svg%': '<(enable_svg)', 'enable_touch_events%': '<(enable_touch_events)', - 'use_skia%': '<(use_skia)', 'conditions': [ ['OS=="android"', { 'feature_defines': [ @@ -143,7 +144,7 @@ 'ENABLE_3D_RENDERING=1', ], }], - ['use_accelerated_compositing==1 and (OS!="mac" or use_skia==1)', { + ['use_accelerated_compositing==1', { 'feature_defines': [ 'ENABLE_ACCELERATED_2D_CANVAS=1', ], @@ -153,7 +154,6 @@ 'feature_defines': [ 'WTF_USE_WEBAUDIO_FFMPEG=1', ], - 'use_skia%': 1, }], ['enable_register_protocol_handler==1', { 'feature_defines': [ @@ -168,7 +168,7 @@ ['OS=="mac"', { 'feature_defines': [ 'ENABLE_RUBBER_BANDING=1', - 'WTF_USE_SKIA_ON_MAC_CHROMIUM=<(use_skia)', + 'WTF_USE_SKIA_ON_MAC_CHROMIUM=1', ], }], ], diff --git a/Source/WebKit/chromium/public/WebColorName.h b/Source/WebKit/chromium/public/WebColorName.h new file mode 100644 index 000000000..698f7ce60 --- /dev/null +++ b/Source/WebKit/chromium/public/WebColorName.h @@ -0,0 +1,77 @@ +/* +* Copyright (C) 2009 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 WebColorName_h +#define WebColorName_h + +#include "platform/WebColor.h" +#include "platform/WebCommon.h" + +namespace WebKit { + +enum WebColorName { + WebColorActiveBorder, + WebColorActiveCaption, + WebColorAppworkspace, + WebColorBackground, + WebColorButtonFace, + WebColorButtonHighlight, + WebColorButtonShadow, + WebColorButtonText, + WebColorCaptionText, + WebColorGrayText, + WebColorHighlight, + WebColorHighlightText, + WebColorInactiveBorder, + WebColorInactiveCaption, + WebColorInactiveCaptionText, + WebColorInfoBackground, + WebColorInfoText, + WebColorMenu, + WebColorMenuText, + WebColorScrollbar, + WebColorText, + WebColorThreedDarkShadow, + WebColorThreedShadow, + WebColorThreedFace, + WebColorThreedHighlight, + WebColorThreedLightShadow, + WebColorWebkitFocusRingColor, + WebColorWindow, + WebColorWindowFrame, + WebColorWindowText +}; + +// Sets the values of a set of named colors. +WEBKIT_EXPORT void setNamedColors(const WebColorName*, const WebColor*, size_t length); + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebCommonWorkerClient.h b/Source/WebKit/chromium/public/WebCommonWorkerClient.h index 2ffb54d57..2d87c1401 100644 --- a/Source/WebKit/chromium/public/WebCommonWorkerClient.h +++ b/Source/WebKit/chromium/public/WebCommonWorkerClient.h @@ -47,13 +47,28 @@ class WebWorkerClient; class WebCommonWorkerClient { public: // Called on the main webkit thread before opening a web database. - virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) = 0; + virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) + { + return true; + } // Called on the main webkit thread before opening a file system. - virtual bool allowFileSystem() = 0; + virtual bool allowFileSystem() + { + return true; + } // Called on the main webkit thread before opening a file system. - virtual void openFileSystem(WebFileSystem::Type, long long size, bool create, WebFileSystemCallbacks*) = 0; + virtual void openFileSystem(WebFileSystem::Type, long long size, bool create, WebFileSystemCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + + // Called on the main webkit thread before opening an indexed database. + virtual bool allowIndexedDB(const WebString& name) + { + return true; + } }; diff --git a/Source/WebKit/chromium/public/WebDataSource.h b/Source/WebKit/chromium/public/WebDataSource.h index 07b63490c..77d6e78dc 100644 --- a/Source/WebKit/chromium/public/WebDataSource.h +++ b/Source/WebKit/chromium/public/WebDataSource.h @@ -103,6 +103,14 @@ public: // testing. virtual void setDeferMainResourceDataLoad(bool) = 0; + // Sets the navigation start time for this datasource. Ordinarily, + // navigation start is determined in WebCore. But, in some situations, + // the embedder might have a better value and can override it here. This + // should be called before WebFrameClient::didCommitProvisionalLoad. + // Calling it later may confuse users, because JavaScript may have run and + // the user may have already recorded the original value. + virtual void setNavigationStartTime(double) = 0; + protected: ~WebDataSource() { } }; diff --git a/Source/WebKit/chromium/public/WebFrameClient.h b/Source/WebKit/chromium/public/WebFrameClient.h index d0507e3d1..fa6fc7a33 100644 --- a/Source/WebKit/chromium/public/WebFrameClient.h +++ b/Source/WebKit/chromium/public/WebFrameClient.h @@ -297,7 +297,7 @@ public: // Notifies that a new script context has been created for this frame. // This is similar to didClearWindowObject but only called once per // frame context. - virtual void didCreateScriptContext(WebFrame*, v8::Handle<v8::Context>, int worldId) { } + virtual void didCreateScriptContext(WebFrame*, v8::Handle<v8::Context>, int extensionGroup, int worldId) { } // WebKit is about to release its reference to a v8 context for a frame. virtual void willReleaseScriptContext(WebFrame*, v8::Handle<v8::Context>, int worldId) { } diff --git a/Source/WebKit/chromium/public/WebOptionElement.h b/Source/WebKit/chromium/public/WebOptionElement.h index 3d9390b71..d58ccb4e3 100644 --- a/Source/WebKit/chromium/public/WebOptionElement.h +++ b/Source/WebKit/chromium/public/WebOptionElement.h @@ -31,7 +31,7 @@ #ifndef WebOptionElement_h #define WebOptionElement_h -#include "WebFormControlElement.h" +#include "WebElement.h" #include "platform/WebVector.h" #if WEBKIT_IMPLEMENTATION @@ -41,17 +41,17 @@ namespace WebCore { class HTMLOptionElement; } namespace WebKit { // Provides readonly access to some properties of a DOM option element node. -class WebOptionElement : public WebFormControlElement { +class WebOptionElement : public WebElement { public: - WebOptionElement() : WebFormControlElement() { } - WebOptionElement(const WebOptionElement& element) : WebFormControlElement(element) { } + WebOptionElement() : WebElement() { } + WebOptionElement(const WebOptionElement& element) : WebElement(element) { } WebOptionElement& operator=(const WebOptionElement& element) { - WebFormControlElement::assign(element); + WebElement::assign(element); return *this; } - void assign(const WebOptionElement& element) { WebFormControlElement::assign(element); } + void assign(const WebOptionElement& element) { WebElement::assign(element); } WEBKIT_EXPORT void setValue(const WebString&); WEBKIT_EXPORT WebString value() const; diff --git a/Source/WebKit/chromium/public/WebPagePopup.h b/Source/WebKit/chromium/public/WebPagePopup.h new file mode 100644 index 000000000..d8ab18773 --- /dev/null +++ b/Source/WebKit/chromium/public/WebPagePopup.h @@ -0,0 +1,48 @@ +/* + * 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 WebPagePopup_h +#define WebPagePopup_h + +#include "WebWidget.h" +#include "platform/WebCommon.h" + +namespace WebKit { + +class WebWidgetClient; + +class WebPagePopup : public WebWidget { +public: + WEBKIT_EXPORT static WebPagePopup* create(WebWidgetClient*); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebPluginContainer.h b/Source/WebKit/chromium/public/WebPluginContainer.h index 845cb1a28..777431fb0 100644 --- a/Source/WebKit/chromium/public/WebPluginContainer.h +++ b/Source/WebKit/chromium/public/WebPluginContainer.h @@ -100,6 +100,9 @@ public: // Notifies that the zoom level has changed. virtual void zoomLevelChanged(double zoomLevel) = 0; + // Notifies whether the contents of the plugin are entirely opaque. + virtual void setOpaque(bool) = 0; + // Determines whether the given rectangle in this plugin is above all other // content. The rectangle is in the plugin's coordinate system. virtual bool isRectTopmost(const WebRect&) = 0; diff --git a/Source/WebKit/chromium/public/WebPopupType.h b/Source/WebKit/chromium/public/WebPopupType.h index 8a546bae4..2d0e8e4d2 100644 --- a/Source/WebKit/chromium/public/WebPopupType.h +++ b/Source/WebKit/chromium/public/WebPopupType.h @@ -35,8 +35,9 @@ namespace WebKit { enum WebPopupType { WebPopupTypeNone, // Not a popup. - WebPopupTypeSelect, // A HTML select (combo-box) popup. + WebPopupTypeSelect, // An HTML select (combo-box) popup. WebPopupTypeSuggestion, // An autofill/autocomplete popup. + WebPopupTypePage, // An HTML-capable popup. }; } // namespace WebKit diff --git a/Source/WebKit/chromium/public/WebRuntimeFeatures.h b/Source/WebKit/chromium/public/WebRuntimeFeatures.h index 34e3947f6..187ef0f55 100644 --- a/Source/WebKit/chromium/public/WebRuntimeFeatures.h +++ b/Source/WebKit/chromium/public/WebRuntimeFeatures.h @@ -91,6 +91,9 @@ public: WEBKIT_EXPORT static void enableSpeechInput(bool); WEBKIT_EXPORT static bool isSpeechInputEnabled(); + WEBKIT_EXPORT static void enableScriptedSpeech(bool); + WEBKIT_EXPORT static bool isScriptedSpeechEnabled(); + WEBKIT_EXPORT static void enableXHRResponseBlob(bool); WEBKIT_EXPORT static bool isXHRResponseBlobEnabled(); diff --git a/Source/WebKit/chromium/public/WebSettings.h b/Source/WebKit/chromium/public/WebSettings.h index 7f1bbb0c4..47aaeece0 100644 --- a/Source/WebKit/chromium/public/WebSettings.h +++ b/Source/WebKit/chromium/public/WebSettings.h @@ -62,6 +62,7 @@ public: virtual void setDefaultFixedFontSize(int) = 0; virtual void setMinimumFontSize(int) = 0; virtual void setMinimumLogicalFontSize(int) = 0; + virtual void setDefaultDeviceScaleFactor(int) = 0; virtual void setDefaultTextEncodingName(const WebString&) = 0; virtual void setJavaScriptEnabled(bool) = 0; virtual void setWebSecurityEnabled(bool) = 0; diff --git a/Source/WebKit/chromium/public/WebSharedWorkerClient.h b/Source/WebKit/chromium/public/WebSharedWorkerClient.h index a085a3ea2..4a2b8732f 100644 --- a/Source/WebKit/chromium/public/WebSharedWorkerClient.h +++ b/Source/WebKit/chromium/public/WebSharedWorkerClient.h @@ -79,21 +79,6 @@ public: // Called on the main webkit thread in the worker process during initialization. virtual WebApplicationCacheHost* createApplicationCacheHost(WebApplicationCacheHostClient*) = 0; - // Called on the main webkit thread before opening a web database. - virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) = 0; - - // Called on the main webkit thread before opening a file system. - virtual bool allowFileSystem() - { - return true; - } - - // Called on the main webkit thread before opening a file system. - virtual void openFileSystem(WebFileSystem::Type, long long size, bool create, WebFileSystemCallbacks*) - { - WEBKIT_ASSERT_NOT_REACHED(); - } - virtual void dispatchDevToolsMessage(const WebString&) { } virtual void saveDevToolsAgentState(const WebString&) { } diff --git a/Source/WebKit/chromium/public/WebSocket.h b/Source/WebKit/chromium/public/WebSocket.h index c10c372ad..f2a140cfa 100644 --- a/Source/WebKit/chromium/public/WebSocket.h +++ b/Source/WebKit/chromium/public/WebSocket.h @@ -80,6 +80,7 @@ public: virtual void connect(const WebURL&, const WebString& protocol) = 0; virtual WebString subprotocol() = 0; + virtual WebString extensions() = 0; virtual bool sendText(const WebString&) = 0; virtual bool sendArrayBuffer(const WebArrayBuffer&) = 0; virtual unsigned long bufferedAmount() const = 0; diff --git a/Source/WebKit/chromium/public/WebView.h b/Source/WebKit/chromium/public/WebView.h index ed853e23a..50cf2eaa0 100644 --- a/Source/WebKit/chromium/public/WebView.h +++ b/Source/WebKit/chromium/public/WebView.h @@ -260,10 +260,17 @@ public: // In auto-resize mode, the view is automatically adjusted to fit the html // content within the given bounds. virtual void enableAutoResizeMode( - bool enable, const WebSize& minSize, const WebSize& maxSize) = 0; + // Turn off auto-resize. + virtual void disableAutoResizeMode() = 0; + + // DEPRECATED + virtual void enableAutoResizeMode( + bool enable, + const WebSize& minSize, + const WebSize& maxSize) = 0; // Media --------------------------------------------------------------- @@ -423,6 +430,10 @@ public: // APIs. virtual WebGraphicsContext3D* graphicsContext3D() = 0; + // Context that's in the compositor's share group, but is not the compositor context itself. + // Can be used for allocating resources that the compositor will later access. + virtual WebGraphicsContext3D* sharedGraphicsContext3D() = 0; + // Visibility ----------------------------------------------------------- // Sets the visibility of the WebView. diff --git a/Source/WebKit/chromium/public/WebViewClient.h b/Source/WebKit/chromium/public/WebViewClient.h index b656fd5ad..b2c0e5665 100644 --- a/Source/WebKit/chromium/public/WebViewClient.h +++ b/Source/WebKit/chromium/public/WebViewClient.h @@ -93,10 +93,13 @@ public: // WebStorage specification. // The request parameter is only for the client to check if the request // could be fulfilled. The client should not load the request. + // The policy parameter indicates how the new view will be displayed in + // WebWidgetClient::show. virtual WebView* createView(WebFrame* creator, const WebURLRequest& request, const WebWindowFeatures& features, - const WebString& name) { + const WebString& name, + WebNavigationPolicy policy) { return 0; } @@ -110,10 +113,10 @@ public: // Create a session storage namespace object associated with this WebView. virtual WebStorageNamespace* createSessionStorageNamespace(unsigned quota) { return 0; } - // Creates a graphics context associated with the client's WebView. - // renderDirectlyToWebView means whether the context should be setup to - // render directly to the WebView (e.g. compositor context), or to an - // offscreen surface (e.g. WebGL context). + // Creates a graphics context that renders to the client's WebView. + virtual WebGraphicsContext3D* createGraphicsContext3D(const WebGraphicsContext3D::Attributes&) { return 0; } + + // Deprecated, use the first version of this function. If you want an offscreen context, use WebKitPlatformSupport::createOffscreenGraphicsContext3D(). virtual WebGraphicsContext3D* createGraphicsContext3D(const WebGraphicsContext3D::Attributes&, bool renderDirectlyToWebView) { return 0; } // Misc ---------------------------------------------------------------- diff --git a/Source/WebKit/chromium/public/WebWidget.h b/Source/WebKit/chromium/public/WebWidget.h index 58f3fa169..e9712d743 100644 --- a/Source/WebKit/chromium/public/WebWidget.h +++ b/Source/WebKit/chromium/public/WebWidget.h @@ -192,6 +192,10 @@ public: // rect.) virtual void didChangeWindowResizerRect() { } + // Instrumentation method that marks beginning of frame update that includes + // things like animate()/layout()/paint()/composite(). + virtual void instrumentBeginFrame() { } + protected: ~WebWidget() { } }; diff --git a/Source/WebKit/chromium/public/platform/WebCanvas.h b/Source/WebKit/chromium/public/platform/WebCanvas.h index 4cf729ee1..ba2a7189d 100644 --- a/Source/WebKit/chromium/public/platform/WebCanvas.h +++ b/Source/WebKit/chromium/public/platform/WebCanvas.h @@ -1,54 +1,26 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * 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: + * 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. + * 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 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. + * 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 WebCanvas_h -#define WebCanvas_h - -#include "WebCommon.h" - -#if WEBKIT_USING_SKIA -class SkCanvas; -#elif WEBKIT_USING_CG -struct CGContext; -#endif - -namespace WebKit { - -#if WEBKIT_USING_SKIA -typedef SkCanvas WebCanvas; -#elif WEBKIT_USING_CG -typedef struct CGContext WebCanvas; -#else -#error "Need to define WebCanvas" -#endif - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/WebCanvas.h" diff --git a/Source/WebKit/chromium/public/platform/WebColor.h b/Source/WebKit/chromium/public/platform/WebColor.h index da45eb1c6..65677dae9 100644 --- a/Source/WebKit/chromium/public/platform/WebColor.h +++ b/Source/WebKit/chromium/public/platform/WebColor.h @@ -1,46 +1,26 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * 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: + * 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. + * 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 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. + * 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 WebColor_h -#define WebColor_h - -#include "WebColorName.h" -#include "WebCommon.h" - -namespace WebKit { - -typedef unsigned WebColor; // RGBA quad. Equivalent to SkColor. - -// Sets the values of a set of named colors. -WEBKIT_EXPORT void setNamedColors(const WebColorName*, const WebColor*, size_t length); - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/WebColor.h" diff --git a/Source/WebKit/chromium/public/platform/WebColorName.h b/Source/WebKit/chromium/public/platform/WebColorName.h index f97ed265f..c3a8afedd 100644 --- a/Source/WebKit/chromium/public/platform/WebColorName.h +++ b/Source/WebKit/chromium/public/platform/WebColorName.h @@ -1,71 +1,29 @@ /* -* Copyright (C) 2009 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. -*/ + * 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 WebColorName_h -#define WebColorName_h +// FIXME: This is logically part of the WebKit client API and doesn't belong in platform. This is a forwarding header to avoid requiring a two-sided commit. +// As soon as all chromium code is updated for the new location of this header, remove this. -namespace WebKit { - -enum WebColorName { - WebColorActiveBorder, - WebColorActiveCaption, - WebColorAppworkspace, - WebColorBackground, - WebColorButtonFace, - WebColorButtonHighlight, - WebColorButtonShadow, - WebColorButtonText, - WebColorCaptionText, - WebColorGrayText, - WebColorHighlight, - WebColorHighlightText, - WebColorInactiveBorder, - WebColorInactiveCaption, - WebColorInactiveCaptionText, - WebColorInfoBackground, - WebColorInfoText, - WebColorMenu, - WebColorMenuText, - WebColorScrollbar, - WebColorText, - WebColorThreedDarkShadow, - WebColorThreedShadow, - WebColorThreedFace, - WebColorThreedHighlight, - WebColorThreedLightShadow, - WebColorWebkitFocusRingColor, - WebColorWindow, - WebColorWindowFrame, - WebColorWindowText -}; - -} // namespace WebKit - -#endif +#include "../WebColorName.h" diff --git a/Source/WebKit/chromium/public/platform/WebContentLayer.h b/Source/WebKit/chromium/public/platform/WebContentLayer.h index 6d7f91483..90a16ed91 100644 --- a/Source/WebKit/chromium/public/platform/WebContentLayer.h +++ b/Source/WebKit/chromium/public/platform/WebContentLayer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * 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 @@ -23,49 +23,4 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebContentLayer_h -#define WebContentLayer_h - -#include "WebCommon.h" -#include "WebLayer.h" - -namespace WebKit { -class WebContentLayerClient; -class WebContentLayerImpl; -struct WebFloatRect; - -class WebContentLayer : public WebLayer { -public: - WEBKIT_EXPORT static WebContentLayer create(WebContentLayerClient*); - - WebContentLayer() { } - WebContentLayer(const WebContentLayer& layer) : WebLayer(layer) { } - virtual ~WebContentLayer() { } - WebContentLayer& operator=(const WebContentLayer& layer) - { - WebLayer::assign(layer); - return *this; - } - - // Sets whether the layer draws its content when compositing. - WEBKIT_EXPORT void setDrawsContent(bool); - WEBKIT_EXPORT bool drawsContent() const; - - // Sets a region of the layer as invalid, i.e. needs to update its content. - // The visible area of the dirty rect will be passed to one or more calls to - // WebContentLayerClient::paintContents before the compositing pass occurs. - WEBKIT_EXPORT void invalidateRect(const WebFloatRect&); - - // Sets the entire layer as invalid, i.e. needs to update its content. - WEBKIT_EXPORT void invalidate(); - -#if WEBKIT_IMPLEMENTATION - WebContentLayer(const WTF::PassRefPtr<WebContentLayerImpl>&); - WebContentLayer& operator=(const WTF::PassRefPtr<WebContentLayerImpl>&); - operator WTF::PassRefPtr<WebContentLayerImpl>() const; -#endif -}; - -} // namespace WebKit - -#endif // WebContentLayer_h +#include "../../../../Platform/chromium/public/WebContentLayer.h" diff --git a/Source/WebKit/chromium/public/platform/WebContentLayerClient.h b/Source/WebKit/chromium/public/platform/WebContentLayerClient.h index deb36e077..8f1ca3324 100644 --- a/Source/WebKit/chromium/public/platform/WebContentLayerClient.h +++ b/Source/WebKit/chromium/public/platform/WebContentLayerClient.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * 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 @@ -23,26 +23,4 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebContentLayerClient_h -#define WebContentLayerClient_h - -#include "WebCanvas.h" - -namespace WebKit { -struct WebRect; - -class WebContentLayerClient { -public: - // Paints the content area for the layer, typically dirty rects submitted - // through WebContentLayer::setNeedsDisplay, submitting drawing commands - // through the WebCanvas. - // The canvas is already clipped to the |clip| rect. - virtual void paintContents(WebCanvas*, const WebRect& clip) = 0; - -protected: - virtual ~WebContentLayerClient() { } -}; - -} // namespace WebKit - -#endif // WebContentLayerClient_h +#include "../../../../Platform/chromium/public/WebContentLayerClient.h" diff --git a/Source/WebKit/chromium/public/platform/WebExternalTextureLayer.h b/Source/WebKit/chromium/public/platform/WebExternalTextureLayer.h index ce87bb238..000826df7 100644 --- a/Source/WebKit/chromium/public/platform/WebExternalTextureLayer.h +++ b/Source/WebKit/chromium/public/platform/WebExternalTextureLayer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * 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 @@ -23,61 +23,4 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebExternalTextureLayer_h -#define WebExternalTextureLayer_h - -#include "WebCommon.h" -#include "WebFloatRect.h" -#include "WebLayer.h" - -namespace WebKit { -class WebExternalTextureLayerImpl; - -// This class represents a layer that renders a texture that is generated -// externally (not managed by the WebLayerTreeView). -// The texture will be used by the WebLayerTreeView during compositing passes. -// When in single-thread mode, this means during WebLayerTreeView::composite(). -// When using the threaded compositor, this can mean at an arbitrary time until -// the WebLayerTreeView is destroyed. -class WebExternalTextureLayer : public WebLayer { -public: - WEBKIT_EXPORT static WebExternalTextureLayer create(); - - WebExternalTextureLayer() { } - WebExternalTextureLayer(const WebExternalTextureLayer& layer) : WebLayer(layer) { } - virtual ~WebExternalTextureLayer() { } - WebExternalTextureLayer& operator=(const WebExternalTextureLayer& layer) - { - WebLayer::assign(layer); - return *this; - } - - // Sets the texture id that represents the layer, in the namespace of the - // compositor context. - WEBKIT_EXPORT void setTextureId(unsigned); - WEBKIT_EXPORT unsigned textureId() const; - - // Sets whether or not the texture should be flipped in the Y direction when - // rendered. - WEBKIT_EXPORT void setFlipped(bool); - WEBKIT_EXPORT bool flipped() const; - - // Sets the rect in UV space of the texture that is mapped to the layer - // bounds. - WEBKIT_EXPORT void setUVRect(const WebFloatRect&); - WEBKIT_EXPORT WebFloatRect uvRect() const; - - // Marks a region of the layer as needing a display. These regions are - // collected in a union until the display occurs. - WEBKIT_EXPORT void invalidateRect(const WebFloatRect&); - -#if WEBKIT_IMPLEMENTATION - WebExternalTextureLayer(const WTF::PassRefPtr<WebExternalTextureLayerImpl>&); - WebExternalTextureLayer& operator=(const WTF::PassRefPtr<WebExternalTextureLayerImpl>&); - operator WTF::PassRefPtr<WebExternalTextureLayerImpl>() const; -#endif -}; - -} // namespace WebKit - -#endif // WebExternalTextureLayer_h +#include "../../../../Platform/chromium/public/WebExternalTextureLayer.h" diff --git a/Source/WebKit/chromium/public/platform/WebFileSystem.h b/Source/WebKit/chromium/public/platform/WebFileSystem.h index 583efe07c..2562ef1c3 100644 --- a/Source/WebKit/chromium/public/platform/WebFileSystem.h +++ b/Source/WebKit/chromium/public/platform/WebFileSystem.h @@ -71,6 +71,7 @@ public: virtual void removeRecursively(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } // Retrieves the metadata information of the file or directory at the given |path|. + // This may not always return the local platform path in remote filesystem cases. // WebFileSystemCallbacks::didReadMetadata() must be called with a valid metadata when the retrieval is completed successfully. // WebFileSystemCallbacks::didFail() must be called otherwise. virtual void readMetadata(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } @@ -114,6 +115,15 @@ public: // This is a fast, synchronous call, and should not stat the filesystem. virtual WebFileWriter* createFileWriter(const WebURL& path, WebFileWriterClient*) { WEBKIT_ASSERT_NOT_REACHED(); return 0; } + // Creates a snapshot file for a given file specified by |path| and registers the file with the |blobURL|. It returns the metadata of the created snapshot file. + // The returned metadata should include a local platform path to the snapshot image. + // In local filesystem cases the backend may simply return the metadata of the file itself (as well as readMetadata does), while in remote filesystem case the backend may download the file into a temporary snapshot file and return the metadata of the temporary file. + // The returned metadata is used to create a File object for the |path|. + // The snapshot file is supposed to be deleted when the last reference to the |blobURL| is dropped. + // WebFileSystemCallbacks::didReadMetadata() with the metadata of the snapshot file must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void createSnapshotFileAndReadMetadata(const WebURL& blobURL, const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + protected: virtual ~WebFileSystem() { } }; diff --git a/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h b/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h index f13f7c44d..876b5d9bb 100644 --- a/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h +++ b/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h @@ -1,421 +1,26 @@ /* - * Copyright (C) 2010 Google Inc. All rights reserved. + * 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: + * 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. + * 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 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. + * 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 WebGraphicsContext3D_h -#define WebGraphicsContext3D_h - -#include "WebCommon.h" -#include "WebNonCopyable.h" -#include "WebString.h" - -#define USE_WGC3D_TYPES - -#if WEBKIT_USING_SKIA -struct GrGLInterface; -#endif - -namespace WebKit { - -// WGC3D types match the corresponding GL types as defined in OpenGL ES 2.0 -// header file gl2.h from khronos.org. -typedef char WGC3Dchar; -typedef unsigned int WGC3Denum; -typedef unsigned char WGC3Dboolean; -typedef unsigned int WGC3Dbitfield; -typedef signed char WGC3Dbyte; -typedef unsigned char WGC3Dubyte; -typedef short WGC3Dshort; -typedef unsigned short WGC3Dushort; -typedef int WGC3Dint; -typedef int WGC3Dsizei; -typedef unsigned int WGC3Duint; -typedef float WGC3Dfloat; -typedef float WGC3Dclampf; -typedef signed long int WGC3Dintptr; -typedef signed long int WGC3Dsizeiptr; - -// Typedef for server-side objects like OpenGL textures and program objects. -typedef WGC3Duint WebGLId; - -// FIXME: We shouldn't mention WebView in platform. -class WebView; - -// This interface abstracts the operations performed by the -// GraphicsContext3D in order to implement WebGL. Nearly all of the -// methods exposed on this interface map directly to entry points in -// the OpenGL ES 2.0 API. -// -// Creating a WebGraphicsContext does not make it current, or guarantee -// that the context has been created successfully. Use -// makeContextCurrent() to complete initialization of the context, treating -// a false return value as indication that the context could not be created -// successfully. -class WebGraphicsContext3D : public WebNonCopyable { -public: - // Return value from getActiveUniform and getActiveAttrib. - struct ActiveInfo { - WebString name; - WGC3Denum type; - WGC3Dint size; - }; - - // Context creation attributes. - struct Attributes { - Attributes() - : alpha(true) - , depth(true) - , stencil(true) - , antialias(true) - , premultipliedAlpha(true) - , canRecoverFromContextLoss(true) - , noExtensions(false) - , shareResources(true) - , forUseOnAnotherThread(false) - { - } - - bool alpha; - bool depth; - bool stencil; - bool antialias; - bool premultipliedAlpha; - bool canRecoverFromContextLoss; - bool noExtensions; - bool shareResources; - bool forUseOnAnotherThread; - }; - - class WebGraphicsContextLostCallback { - public: - virtual void onContextLost() = 0; - virtual ~WebGraphicsContextLostCallback() { } - }; - - class WebGraphicsErrorMessageCallback { - public: - virtual void onErrorMessage(const WebString&, WGC3Dint) = 0; - virtual ~WebGraphicsErrorMessageCallback() { } - }; - - class WebGraphicsSwapBuffersCompleteCallbackCHROMIUM { - public: - virtual void onSwapBuffersComplete() = 0; - virtual ~WebGraphicsSwapBuffersCompleteCallbackCHROMIUM() { } - }; - - class WebGraphicsMemoryAllocationChangedCallbackCHROMIUM { - public: - virtual void onMemoryAllocationChanged(size_t gpuResourceSizeInBytes) = 0; - - protected: - virtual ~WebGraphicsMemoryAllocationChangedCallbackCHROMIUM() { } - }; - - // This destructor needs to be public so that using classes can destroy instances if initialization fails. - virtual ~WebGraphicsContext3D() {} - - // This function is deprecated and will be removed soon. - virtual bool initialize(Attributes, WebView*, bool renderDirectlyToWebView) { return false; } - - // Makes the OpenGL context current on the current thread. Returns true on - // success. - virtual bool makeContextCurrent() = 0; - - // The size of the region into which this WebGraphicsContext3D is rendering. - // Returns the last values passed to reshape(). - virtual int width() = 0; - virtual int height() = 0; - - // Resizes the region into which this WebGraphicsContext3D is drawing. - virtual void reshape(int width, int height) = 0; - - // GL_CHROMIUM_setVisibility - Changes the visibility of the backbuffer - virtual void setVisibilityCHROMIUM(bool visible) = 0; - - // GL_CHROMIUM_gpu_memory_manager - sets callback to observe changes to memory allocation limits. - virtual void setMemoryAllocationChangedCallbackCHROMIUM(WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* callback) { } - - // Query whether it is built on top of compliant GLES2 implementation. - virtual bool isGLES2Compliant() = 0; - - virtual bool setParentContext(WebGraphicsContext3D* parentContext) { return false; } - - // Helper for software compositing path. Reads back the frame buffer into - // the memory region pointed to by "pixels" with size "bufferSize". It is - // expected that the storage for "pixels" covers (4 * width * height) bytes. - // Returns true on success. - virtual bool readBackFramebuffer(unsigned char* pixels, size_t bufferSize, WebGLId framebuffer, int width, int height) = 0; - - // Returns the id of the texture which is used for storing the contents of - // the framebuffer associated with this context. This texture is accessible - // by the gpu-based page compositor. - virtual WebGLId getPlatformTextureId() = 0; - - // Copies the contents of the off-screen render target used by the WebGL - // context to the corresponding texture used by the compositor. - virtual void prepareTexture() = 0; - - // GL_CHROMIUM_post_sub_buffer - Copies part of the back buffer to the front buffer. - virtual void postSubBufferCHROMIUM(int x, int y, int width, int height) = 0; - - // Synthesizes an OpenGL error which will be returned from a - // later call to getError. This is used to emulate OpenGL ES - // 2.0 behavior on the desktop and to enforce additional error - // checking mandated by WebGL. - // - // Per the behavior of glGetError, this stores at most one - // instance of any given error, and returns them from calls to - // getError in the order they were added. - virtual void synthesizeGLError(WGC3Denum) = 0; - - virtual bool isContextLost() = 0; - - // GL_CHROMIUM_map_sub - virtual void* mapBufferSubDataCHROMIUM(WGC3Denum target, WGC3Dintptr offset, WGC3Dsizeiptr size, WGC3Denum access) = 0; - virtual void unmapBufferSubDataCHROMIUM(const void*) = 0; - virtual void* mapTexSubImage2DCHROMIUM(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, WGC3Denum access) = 0; - virtual void unmapTexSubImage2DCHROMIUM(const void*) = 0; - - // GL_CHROMIUM_request_extension - virtual WebString getRequestableExtensionsCHROMIUM() = 0; - virtual void requestExtensionCHROMIUM(const char*) = 0; - - // GL_CHROMIUM_framebuffer_multisample - virtual void blitFramebufferCHROMIUM(WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1, WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1, WGC3Dbitfield mask, WGC3Denum filter) = 0; - virtual void renderbufferStorageMultisampleCHROMIUM(WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height) = 0; - - // GL_CHROMIUM_swapbuffers_complete_callback - virtual void setSwapBuffersCompleteCallbackCHROMIUM(WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* callback) { } - - // GL_CHROMIUM_rate_limit_offscreen_context - virtual void rateLimitOffscreenContextCHROMIUM() { } - - // The entry points below map directly to the OpenGL ES 2.0 API. - // See: http://www.khronos.org/registry/gles/ - // and: http://www.khronos.org/opengles/sdk/docs/man/ - virtual void activeTexture(WGC3Denum texture) = 0; - virtual void attachShader(WebGLId program, WebGLId shader) = 0; - virtual void bindAttribLocation(WebGLId program, WGC3Duint index, const WGC3Dchar* name) = 0; - virtual void bindBuffer(WGC3Denum target, WebGLId buffer) = 0; - virtual void bindFramebuffer(WGC3Denum target, WebGLId framebuffer) = 0; - virtual void bindRenderbuffer(WGC3Denum target, WebGLId renderbuffer) = 0; - virtual void bindTexture(WGC3Denum target, WebGLId texture) = 0; - virtual void blendColor(WGC3Dclampf red, WGC3Dclampf green, WGC3Dclampf blue, WGC3Dclampf alpha) = 0; - virtual void blendEquation(WGC3Denum mode) = 0; - virtual void blendEquationSeparate(WGC3Denum modeRGB, WGC3Denum modeAlpha) = 0; - virtual void blendFunc(WGC3Denum sfactor, WGC3Denum dfactor) = 0; - virtual void blendFuncSeparate(WGC3Denum srcRGB, WGC3Denum dstRGB, WGC3Denum srcAlpha, WGC3Denum dstAlpha) = 0; - - virtual void bufferData(WGC3Denum target, WGC3Dsizeiptr size, const void* data, WGC3Denum usage) = 0; - virtual void bufferSubData(WGC3Denum target, WGC3Dintptr offset, WGC3Dsizeiptr size, const void* data) = 0; - - virtual WGC3Denum checkFramebufferStatus(WGC3Denum target) = 0; - virtual void clear(WGC3Dbitfield mask) = 0; - virtual void clearColor(WGC3Dclampf red, WGC3Dclampf green, WGC3Dclampf blue, WGC3Dclampf alpha) = 0; - virtual void clearDepth(WGC3Dclampf depth) = 0; - virtual void clearStencil(WGC3Dint s) = 0; - virtual void colorMask(WGC3Dboolean red, WGC3Dboolean green, WGC3Dboolean blue, WGC3Dboolean alpha) = 0; - virtual void compileShader(WebGLId shader) = 0; - - virtual void compressedTexImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Dsizei imageSize, const void* data) = 0; - virtual void compressedTexSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Dsizei imageSize, const void* data) = 0; - virtual void copyTexImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border) = 0; - virtual void copyTexSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) = 0; - virtual void cullFace(WGC3Denum mode) = 0; - virtual void depthFunc(WGC3Denum func) = 0; - virtual void depthMask(WGC3Dboolean flag) = 0; - virtual void depthRange(WGC3Dclampf zNear, WGC3Dclampf zFar) = 0; - virtual void detachShader(WebGLId program, WebGLId shader) = 0; - virtual void disable(WGC3Denum cap) = 0; - virtual void disableVertexAttribArray(WGC3Duint index) = 0; - virtual void drawArrays(WGC3Denum mode, WGC3Dint first, WGC3Dsizei count) = 0; - virtual void drawElements(WGC3Denum mode, WGC3Dsizei count, WGC3Denum type, WGC3Dintptr offset) = 0; - - virtual void enable(WGC3Denum cap) = 0; - virtual void enableVertexAttribArray(WGC3Duint index) = 0; - virtual void finish() = 0; - virtual void flush() = 0; - virtual void framebufferRenderbuffer(WGC3Denum target, WGC3Denum attachment, WGC3Denum renderbuffertarget, WebGLId renderbuffer) = 0; - virtual void framebufferTexture2D(WGC3Denum target, WGC3Denum attachment, WGC3Denum textarget, WebGLId texture, WGC3Dint level) = 0; - virtual void frontFace(WGC3Denum mode) = 0; - virtual void generateMipmap(WGC3Denum target) = 0; - - virtual bool getActiveAttrib(WebGLId program, WGC3Duint index, ActiveInfo&) = 0; - virtual bool getActiveUniform(WebGLId program, WGC3Duint index, ActiveInfo&) = 0; - virtual void getAttachedShaders(WebGLId program, WGC3Dsizei maxCount, WGC3Dsizei* count, WebGLId* shaders) = 0; - virtual WGC3Dint getAttribLocation(WebGLId program, const WGC3Dchar* name) = 0; - virtual void getBooleanv(WGC3Denum pname, WGC3Dboolean* value) = 0; - virtual void getBufferParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) = 0; - virtual Attributes getContextAttributes() = 0; - virtual WGC3Denum getError() = 0; - virtual void getFloatv(WGC3Denum pname, WGC3Dfloat* value) = 0; - virtual void getFramebufferAttachmentParameteriv(WGC3Denum target, WGC3Denum attachment, WGC3Denum pname, WGC3Dint* value) = 0; - virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value) = 0; - virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value) = 0; - virtual WebString getProgramInfoLog(WebGLId program) = 0; - virtual void getRenderbufferParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) = 0; - virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value) = 0; - virtual WebString getShaderInfoLog(WebGLId shader) = 0; - - // TBD - // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); - - virtual WebString getShaderSource(WebGLId shader) = 0; - virtual WebString getString(WGC3Denum name) = 0; - virtual void getTexParameterfv(WGC3Denum target, WGC3Denum pname, WGC3Dfloat* value) = 0; - virtual void getTexParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) = 0; - virtual void getUniformfv(WebGLId program, WGC3Dint location, WGC3Dfloat* value) = 0; - virtual void getUniformiv(WebGLId program, WGC3Dint location, WGC3Dint* value) = 0; - virtual WGC3Dint getUniformLocation(WebGLId program, const WGC3Dchar* name) = 0; - virtual void getVertexAttribfv(WGC3Duint index, WGC3Denum pname, WGC3Dfloat* value) = 0; - virtual void getVertexAttribiv(WGC3Duint index, WGC3Denum pname, WGC3Dint* value) = 0; - virtual WGC3Dsizeiptr getVertexAttribOffset(WGC3Duint index, WGC3Denum pname) = 0; - - virtual void hint(WGC3Denum target, WGC3Denum mode) = 0; - virtual WGC3Dboolean isBuffer(WebGLId buffer) = 0; - virtual WGC3Dboolean isEnabled(WGC3Denum cap) = 0; - virtual WGC3Dboolean isFramebuffer(WebGLId framebuffer) = 0; - virtual WGC3Dboolean isProgram(WebGLId program) = 0; - virtual WGC3Dboolean isRenderbuffer(WebGLId renderbuffer) = 0; - virtual WGC3Dboolean isShader(WebGLId shader) = 0; - virtual WGC3Dboolean isTexture(WebGLId texture) = 0; - virtual void lineWidth(WGC3Dfloat) = 0; - virtual void linkProgram(WebGLId program) = 0; - virtual void pixelStorei(WGC3Denum pname, WGC3Dint param) = 0; - virtual void polygonOffset(WGC3Dfloat factor, WGC3Dfloat units) = 0; - - virtual void readPixels(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, void* pixels) = 0; - - virtual void releaseShaderCompiler() = 0; - - virtual void renderbufferStorage(WGC3Denum target, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height) = 0; - virtual void sampleCoverage(WGC3Dclampf value, WGC3Dboolean invert) = 0; - virtual void scissor(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) = 0; - virtual void shaderSource(WebGLId shader, const WGC3Dchar* string) = 0; - virtual void stencilFunc(WGC3Denum func, WGC3Dint ref, WGC3Duint mask) = 0; - virtual void stencilFuncSeparate(WGC3Denum face, WGC3Denum func, WGC3Dint ref, WGC3Duint mask) = 0; - virtual void stencilMask(WGC3Duint mask) = 0; - virtual void stencilMaskSeparate(WGC3Denum face, WGC3Duint mask) = 0; - virtual void stencilOp(WGC3Denum fail, WGC3Denum zfail, WGC3Denum zpass) = 0; - virtual void stencilOpSeparate(WGC3Denum face, WGC3Denum fail, WGC3Denum zfail, WGC3Denum zpass) = 0; - - virtual void texImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Denum format, WGC3Denum type, const void* pixels) = 0; - - virtual void texParameterf(WGC3Denum target, WGC3Denum pname, WGC3Dfloat param) = 0; - virtual void texParameteri(WGC3Denum target, WGC3Denum pname, WGC3Dint param) = 0; - - virtual void texSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, const void* pixels) = 0; - - virtual void uniform1f(WGC3Dint location, WGC3Dfloat x) = 0; - virtual void uniform1fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) = 0; - virtual void uniform1i(WGC3Dint location, WGC3Dint x) = 0; - virtual void uniform1iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) = 0; - virtual void uniform2f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y) = 0; - virtual void uniform2fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) = 0; - virtual void uniform2i(WGC3Dint location, WGC3Dint x, WGC3Dint y) = 0; - virtual void uniform2iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) = 0; - virtual void uniform3f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z) = 0; - virtual void uniform3fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) = 0; - virtual void uniform3i(WGC3Dint location, WGC3Dint x, WGC3Dint y, WGC3Dint z) = 0; - virtual void uniform3iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) = 0; - virtual void uniform4f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z, WGC3Dfloat w) = 0; - virtual void uniform4fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) = 0; - virtual void uniform4i(WGC3Dint location, WGC3Dint x, WGC3Dint y, WGC3Dint z, WGC3Dint w) = 0; - virtual void uniform4iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) = 0; - virtual void uniformMatrix2fv(WGC3Dint location, WGC3Dsizei count, WGC3Dboolean transpose, const WGC3Dfloat* value) = 0; - virtual void uniformMatrix3fv(WGC3Dint location, WGC3Dsizei count, WGC3Dboolean transpose, const WGC3Dfloat* value) = 0; - virtual void uniformMatrix4fv(WGC3Dint location, WGC3Dsizei count, WGC3Dboolean transpose, const WGC3Dfloat* value) = 0; - - virtual void useProgram(WebGLId program) = 0; - virtual void validateProgram(WebGLId program) = 0; - - virtual void vertexAttrib1f(WGC3Duint index, WGC3Dfloat x) = 0; - virtual void vertexAttrib1fv(WGC3Duint index, const WGC3Dfloat* values) = 0; - virtual void vertexAttrib2f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y) = 0; - virtual void vertexAttrib2fv(WGC3Duint index, const WGC3Dfloat* values) = 0; - virtual void vertexAttrib3f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z) = 0; - virtual void vertexAttrib3fv(WGC3Duint index, const WGC3Dfloat* values) = 0; - virtual void vertexAttrib4f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z, WGC3Dfloat w) = 0; - virtual void vertexAttrib4fv(WGC3Duint index, const WGC3Dfloat* values) = 0; - virtual void vertexAttribPointer(WGC3Duint index, WGC3Dint size, WGC3Denum type, WGC3Dboolean normalized, - WGC3Dsizei stride, WGC3Dintptr offset) = 0; - - virtual void viewport(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) = 0; - - // Support for buffer creation and deletion. - virtual WebGLId createBuffer() = 0; - virtual WebGLId createFramebuffer() = 0; - virtual WebGLId createProgram() = 0; - virtual WebGLId createRenderbuffer() = 0; - virtual WebGLId createShader(WGC3Denum) = 0; - virtual WebGLId createTexture() = 0; - - virtual void deleteBuffer(WebGLId) = 0; - virtual void deleteFramebuffer(WebGLId) = 0; - virtual void deleteProgram(WebGLId) = 0; - virtual void deleteRenderbuffer(WebGLId) = 0; - virtual void deleteShader(WebGLId) = 0; - virtual void deleteTexture(WebGLId) = 0; - - virtual void setContextLostCallback(WebGraphicsContextLostCallback* callback) {} - virtual void setErrorMessageCallback(WebGraphicsErrorMessageCallback* callback) { } - // GL_ARB_robustness - // - // This entry point must provide slightly different semantics than - // the GL_ARB_robustness extension; specifically, the lost context - // state is sticky, rather than reported only once. - virtual WGC3Denum getGraphicsResetStatusARB() { return 0; /* GL_NO_ERROR */ } - - // FIXME: make this function pure virtual once it is implemented in - // both command buffer port and in-process port. - virtual WebString getTranslatedShaderSourceANGLE(WebGLId shader) { return WebString(); } - - // GL_CHROMIUM_iosurface - virtual void texImageIOSurface2DCHROMIUM(WGC3Denum target, WGC3Dint width, WGC3Dint height, WGC3Duint ioSurfaceId, WGC3Duint plane) { } - - // GL_EXT_texture_storage - virtual void texStorage2DEXT(WGC3Denum target, WGC3Dint levels, WGC3Duint internalformat, - WGC3Dint width, WGC3Dint height) { } - - -#if WEBKIT_USING_SKIA - GrGLInterface* createGrGLInterface(); -#endif - -protected: -#if WEBKIT_USING_SKIA - virtual GrGLInterface* onCreateGrGLInterface() { return 0; } -#endif - -}; - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/WebGraphicsContext3D.h" diff --git a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h index 3bf4cb43a..d2c1fd814 100644 --- a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h +++ b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h @@ -58,7 +58,6 @@ class WebClipboard; class WebCookieJar; class WebFileSystem; class WebFileUtilities; -class WebGraphicsContext3D; class WebIDBFactory; // FIXME: Does this belong in platform? class WebIDBKey; // FIXME: Does this belong in platform? class WebMediaStreamCenter; @@ -386,8 +385,6 @@ public: // May return null if GPU is not supported. // Returns newly allocated and initialized offscreen WebGraphicsContext3D instance. virtual WebGraphicsContext3D* createOffscreenGraphicsContext3D(const WebGraphicsContext3D::Attributes&) { return 0; } - // Deprecated. - virtual WebGraphicsContext3D* createGraphicsContext3D() { return 0; } // Audio -------------------------------------------------------------- diff --git a/Source/WebKit/chromium/public/platform/WebLayer.h b/Source/WebKit/chromium/public/platform/WebLayer.h index 3d919fa46..234c2fc4b 100644 --- a/Source/WebKit/chromium/public/platform/WebLayer.h +++ b/Source/WebKit/chromium/public/platform/WebLayer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * 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 @@ -23,121 +23,4 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebLayer_h -#define WebLayer_h - -#include "WebColor.h" -#include "WebCommon.h" -#include "WebPrivatePtr.h" - -class SkMatrix44; -namespace WebCore { class LayerChromium; } - -namespace WebKit { -struct WebFloatPoint; -struct WebSize; - -class WebLayer { -public: - WEBKIT_EXPORT static WebLayer create(); - - WebLayer() { } - WebLayer(const WebLayer& layer) { assign(layer); } - virtual ~WebLayer() { reset(); } - WebLayer& operator=(const WebLayer& layer) - { - assign(layer); - return *this; - } - bool isNull() { return m_private.isNull(); } - WEBKIT_EXPORT void reset(); - WEBKIT_EXPORT void assign(const WebLayer&); - WEBKIT_EXPORT bool equals(const WebLayer&) const; - - WEBKIT_EXPORT WebLayer rootLayer() const; - WEBKIT_EXPORT WebLayer parent() const; - WEBKIT_EXPORT void addChild(const WebLayer&); - WEBKIT_EXPORT void insertChild(const WebLayer&, size_t index); - WEBKIT_EXPORT void replaceChild(const WebLayer& reference, const WebLayer& newLayer); - WEBKIT_EXPORT void removeFromParent(); - WEBKIT_EXPORT void removeAllChildren(); - - WEBKIT_EXPORT void setAnchorPoint(const WebFloatPoint&); - WEBKIT_EXPORT WebFloatPoint anchorPoint() const; - - WEBKIT_EXPORT void setAnchorPointZ(float); - WEBKIT_EXPORT float anchorPointZ() const; - - WEBKIT_EXPORT void setBounds(const WebSize&); - WEBKIT_EXPORT WebSize bounds() const; - - WEBKIT_EXPORT void setMasksToBounds(bool); - WEBKIT_EXPORT bool masksToBounds() const; - - WEBKIT_EXPORT void setMaskLayer(const WebLayer&); - WEBKIT_EXPORT WebLayer maskLayer() const; - - WEBKIT_EXPORT void setOpacity(float); - WEBKIT_EXPORT float opacity() const; - - WEBKIT_EXPORT void setOpaque(bool); - WEBKIT_EXPORT bool opaque() const; - - WEBKIT_EXPORT void setPosition(const WebFloatPoint&); - WEBKIT_EXPORT WebFloatPoint position() const; - - WEBKIT_EXPORT void setSublayerTransform(const SkMatrix44&); - WEBKIT_EXPORT SkMatrix44 sublayerTransform() const; - - WEBKIT_EXPORT void setTransform(const SkMatrix44&); - WEBKIT_EXPORT SkMatrix44 transform() const; - - WEBKIT_EXPORT void setDebugBorderColor(const WebColor&); - WEBKIT_EXPORT void setDebugBorderWidth(float); - - template<typename T> T to() - { - T res; - res.WebLayer::assign(*this); - return res; - } - - template<typename T> const T toConst() const - { - T res; - res.WebLayer::assign(*this); - return res; - } - -#if WEBKIT_IMPLEMENTATION - WebLayer(const WTF::PassRefPtr<WebCore::LayerChromium>&); - WebLayer& operator=(const WTF::PassRefPtr<WebCore::LayerChromium>&); - operator WTF::PassRefPtr<WebCore::LayerChromium>() const; - template<typename T> T* unwrap() - { - return static_cast<T*>(m_private.get()); - } - - template<typename T> const T* constUnwrap() const - { - return static_cast<const T*>(m_private.get()); - } -#endif - -protected: - WebPrivatePtr<WebCore::LayerChromium> m_private; -}; - -inline bool operator==(const WebLayer& a, const WebLayer& b) -{ - return a.equals(b); -} - -inline bool operator!=(const WebLayer& a, const WebLayer& b) -{ - return !(a == b); -} - -} // namespace WebKit - -#endif // WebLayer_h +#include "../../../../Platform/chromium/public/WebLayer.h" diff --git a/Source/WebKit/chromium/public/platform/WebLayerTreeView.h b/Source/WebKit/chromium/public/platform/WebLayerTreeView.h index 17a876a98..2ea2915e1 100644 --- a/Source/WebKit/chromium/public/platform/WebLayerTreeView.h +++ b/Source/WebKit/chromium/public/platform/WebLayerTreeView.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * 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 @@ -23,110 +23,4 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebLayerTreeView_h -#define WebLayerTreeView_h - -#include "WebCommon.h" -#include "WebPrivatePtr.h" - -namespace WebCore { -class CCLayerTreeHost; -struct CCSettings; -} - -namespace WebKit { -class WebLayer; -class WebLayerTreeViewClient; -struct WebRect; -struct WebSize; - -class WebLayerTreeView { -public: - struct Settings { - Settings() - : acceleratePainting(false) - , compositeOffscreen(false) - , showFPSCounter(false) - , showPlatformLayerTree(false) - , refreshRate(0) - , perTilePainting(false) - , partialSwapEnabled(false) - , threadedAnimationEnabled(false) { } - - bool acceleratePainting; - bool compositeOffscreen; - bool showFPSCounter; - bool showPlatformLayerTree; - double refreshRate; - bool perTilePainting; - bool partialSwapEnabled; - bool threadedAnimationEnabled; -#if WEBKIT_IMPLEMENTATION - operator WebCore::CCSettings() const; -#endif - }; - - WEBKIT_EXPORT static WebLayerTreeView create(WebLayerTreeViewClient*, const WebLayer& root, const Settings&); - - WebLayerTreeView() { } - WebLayerTreeView(const WebLayerTreeView& layer) { assign(layer); } - ~WebLayerTreeView() { reset(); } - WebLayerTreeView& operator=(const WebLayerTreeView& layer) - { - assign(layer); - return *this; - } - WEBKIT_EXPORT void reset(); - WEBKIT_EXPORT void assign(const WebLayerTreeView&); - WEBKIT_EXPORT bool equals(const WebLayerTreeView&) const; - - // Triggers a compositing pass. If the compositor thread was not - // enabled via WebCompositor::initialize, the compositing pass happens - // immediately. If it is enabled, the compositing pass will happen at a - // later time. Before the compositing pass happens (i.e. before composite() - // returns when the compositor thread is disabled), WebContentLayers will be - // asked to paint their dirty region, through - // WebContentLayerClient::paintContents. - WEBKIT_EXPORT void composite(); - - WEBKIT_EXPORT void setViewportSize(const WebSize&); - WEBKIT_EXPORT WebSize viewportSize() const; - - // Composites and attempts to read back the result into the provided - // buffer. If it wasn't possible, e.g. due to context lost, will return - // false. Pixel format is 32bit (RGBA), and the provided buffer must be - // large enough contain viewportSize().width() * viewportSize().height() - // pixels. The WebLayerTreeView does not assume ownership of the buffer. - // The buffer is not modified if the false is returned. - WEBKIT_EXPORT bool compositeAndReadback(void *pixels, const WebRect&); - - // Sets the root of the tree. The root is set by way of the constructor. - // This is typically used to explicitly set the root to null to break - // cycles. - WEBKIT_EXPORT void setRootLayer(WebLayer*); - -#if WEBKIT_IMPLEMENTATION - WebLayerTreeView(const WTF::PassRefPtr<WebCore::CCLayerTreeHost>&); - WebLayerTreeView& operator=(const WTF::PassRefPtr<WebCore::CCLayerTreeHost>&); - operator WTF::PassRefPtr<WebCore::CCLayerTreeHost>() const; -#endif - - WEBKIT_EXPORT void setNeedsRedraw(); - -protected: - WebPrivatePtr<WebCore::CCLayerTreeHost> m_private; -}; - -inline bool operator==(const WebLayerTreeView& a, const WebLayerTreeView& b) -{ - return a.equals(b); -} - -inline bool operator!=(const WebLayerTreeView& a, const WebLayerTreeView& b) -{ - return !(a == b); -} - -} // namespace WebKit - -#endif // WebLayerTreeView_h +#include "../../../../Platform/chromium/public/WebLayerTreeView.h" diff --git a/Source/WebKit/chromium/public/platform/WebLayerTreeViewClient.h b/Source/WebKit/chromium/public/platform/WebLayerTreeViewClient.h index 9c4dfb77b..36c61f584 100644 --- a/Source/WebKit/chromium/public/platform/WebLayerTreeViewClient.h +++ b/Source/WebKit/chromium/public/platform/WebLayerTreeViewClient.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * 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 @@ -23,45 +23,4 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebLayerTreeViewClient_h -#define WebLayerTreeViewClient_h - -namespace WebKit { -class WebGraphicsContext3D; -struct WebSize; -class WebThread; - -class WebLayerTreeViewClient { -public: - // Updates animation and layout. These are called before the compositing - // pass so that layers can be updated at the given frame time. - virtual void updateAnimations(double frameBeginTime) = 0; - virtual void layout() = 0; - - // Applies a scroll delta to the root layer, which is bundled with a page - // scale factor that may apply a CSS transform on the whole document (used - // for mobile-device pinch zooming). This is triggered by events sent to the - // compositor thread through the WebCompositor interface. - virtual void applyScrollAndScale(const WebSize& scrollDelta, float scaleFactor) = 0; - - // Creates a 3D context suitable for the compositing. This may be called - // more than once if the context gets lost. - virtual WebGraphicsContext3D* createContext3D() = 0; - - // Signals a successful rebinding of the 3D context (e.g. after a lost - // context event). - virtual void didRebindGraphicsContext(bool success) = 0; - - // Schedules a compositing pass, meaning the client should call - // WebLayerTreeView::composite at a later time. This is only called if the - // compositor thread is disabled; when enabled, the compositor will - // internally schedule a compositing pass when needed. - virtual void scheduleComposite() = 0; - -protected: - virtual ~WebLayerTreeViewClient() { } -}; - -} // namespace WebKit - -#endif // WebLayerTreeViewClient_h +#include "../../../../Platform/chromium/public/WebLayerTreeViewClient.h" diff --git a/Source/WebKit/chromium/public/platform/WebNonCopyable.h b/Source/WebKit/chromium/public/platform/WebNonCopyable.h index b0bd4565c..d44d2802c 100644 --- a/Source/WebKit/chromium/public/platform/WebNonCopyable.h +++ b/Source/WebKit/chromium/public/platform/WebNonCopyable.h @@ -1,49 +1,26 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * 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: + * 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. + * 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 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. + * 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 WebNonCopyable_h -#define WebNonCopyable_h - -namespace WebKit { - -// A base class to extend from if you do not support copying. -class WebNonCopyable { -protected: - WebNonCopyable() { } - ~WebNonCopyable() { } - -private: - WebNonCopyable(const WebNonCopyable&); - WebNonCopyable& operator=(const WebNonCopyable&); -}; - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/WebNonCopyable.h" diff --git a/Source/WebKit/chromium/public/platform/WebPrivatePtr.h b/Source/WebKit/chromium/public/platform/WebPrivatePtr.h index 31d09a90b..208096ed3 100644 --- a/Source/WebKit/chromium/public/platform/WebPrivatePtr.h +++ b/Source/WebKit/chromium/public/platform/WebPrivatePtr.h @@ -1,107 +1,26 @@ /* - * Copyright (C) 2010 Google Inc. All rights reserved. + * 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: + * 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. + * 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 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. + * 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 WebPrivatePtr_h -#define WebPrivatePtr_h - -#include "WebCommon.h" - -#if WEBKIT_IMPLEMENTATION -#include <wtf/PassRefPtr.h> -#endif - -namespace WebKit { - -// This class is an implementation detail of the WebKit API. It exists -// to help simplify the implementation of WebKit interfaces that merely -// wrap a reference counted WebCore class. -template <typename T> -class WebPrivatePtr { -public: - WebPrivatePtr() : m_ptr(0) { } - ~WebPrivatePtr() { WEBKIT_ASSERT(!m_ptr); } - - bool isNull() const { return !m_ptr; } - -#if WEBKIT_IMPLEMENTATION - WebPrivatePtr(const PassRefPtr<T>& prp) - : m_ptr(prp.leakRef()) - { - } - - void reset() - { - assign(0); - } - - WebPrivatePtr<T>& operator=(const WebPrivatePtr<T>& other) - { - T* p = other.m_ptr; - if (p) - p->ref(); - assign(p); - return *this; - } - - WebPrivatePtr<T>& operator=(const PassRefPtr<T>& prp) - { - assign(prp.leakRef()); - return *this; - } - - T* get() const - { - return m_ptr; - } - - T* operator->() const - { - ASSERT(m_ptr); - return m_ptr; - } -#endif - -private: -#if WEBKIT_IMPLEMENTATION - void assign(T* p) - { - // p is already ref'd for us by the caller - if (m_ptr) - m_ptr->deref(); - m_ptr = p; - } -#endif - - T* m_ptr; -}; - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/WebPrivatePtr.h" diff --git a/Source/WebKit/chromium/public/platform/WebSolidColorLayer.h b/Source/WebKit/chromium/public/platform/WebSolidColorLayer.h index ad9123d96..f4edbd489 100644 --- a/Source/WebKit/chromium/public/platform/WebSolidColorLayer.h +++ b/Source/WebKit/chromium/public/platform/WebSolidColorLayer.h @@ -23,26 +23,4 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebSolidColorLayer_h -#define WebSolidColorLayer_h - -#include "WebCommon.h" -#include "WebFloatRect.h" -#include "WebLayer.h" - -namespace WebKit { -class WebSolidColorLayerImpl; - -class WebSolidColorLayer : public WebLayer { -public: - WEBKIT_EXPORT static WebSolidColorLayer create(); - WEBKIT_EXPORT void setBackgroundColor(const WebColor&); - -#if WEBKIT_IMPLEMENTATION - WebSolidColorLayer(const WTF::PassRefPtr<WebSolidColorLayerImpl>&); -#endif -}; - -} // namespace WebKit - -#endif // WebSolidColorLayer_h +#include "../../../../Platform/chromium/public/WebSolidColorLayer.h" diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index 3f0875b53..ac6fa0447 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -53,7 +53,7 @@ #include "IconURL.h" #include "MediaPlayer.h" #include "MediaStreamSource.h" -#include "NotificationPresenter.h" +#include "NotificationClient.h" #include "PageVisibilityState.h" #include "PasteboardPrivate.h" #include "PlatformCursor.h" @@ -394,9 +394,9 @@ COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatASCII, VideoFrameChromium::ASC #endif #if ENABLE(NOTIFICATIONS) -COMPILE_ASSERT_MATCHING_ENUM(WebNotificationPresenter::PermissionAllowed, NotificationPresenter::PermissionAllowed); -COMPILE_ASSERT_MATCHING_ENUM(WebNotificationPresenter::PermissionNotAllowed, NotificationPresenter::PermissionNotAllowed); -COMPILE_ASSERT_MATCHING_ENUM(WebNotificationPresenter::PermissionDenied, NotificationPresenter::PermissionDenied); +COMPILE_ASSERT_MATCHING_ENUM(WebNotificationPresenter::PermissionAllowed, NotificationClient::PermissionAllowed); +COMPILE_ASSERT_MATCHING_ENUM(WebNotificationPresenter::PermissionNotAllowed, NotificationClient::PermissionNotAllowed); +COMPILE_ASSERT_MATCHING_ENUM(WebNotificationPresenter::PermissionDenied, NotificationClient::PermissionDenied); #endif COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::Horizontal, HorizontalScrollbar); diff --git a/Source/WebKit/chromium/src/AssociatedURLLoader.cpp b/Source/WebKit/chromium/src/AssociatedURLLoader.cpp index c314411b4..0c3a0cf55 100644 --- a/Source/WebKit/chromium/src/AssociatedURLLoader.cpp +++ b/Source/WebKit/chromium/src/AssociatedURLLoader.cpp @@ -79,6 +79,7 @@ void HTTPRequestHeaderValidator::visitHeader(const WebString& name, const WebStr m_isSafe = m_isSafe && isValidHTTPToken(name) && XMLHttpRequest::isAllowedHTTPHeader(name) && isValidHTTPHeaderValue(value); } +// FIXME: Remove this and use WebCore code that does the same thing. class HTTPResponseHeaderValidator : public WebHTTPHeaderVisitor { WTF_MAKE_NONCOPYABLE(HTTPResponseHeaderValidator); public: @@ -97,7 +98,7 @@ void HTTPResponseHeaderValidator::visitHeader(const WebString& name, const WebSt { String headerName(name); if (m_usingAccessControl) { - if (equalIgnoringCase(headerName, "access-control-expose-header")) + if (equalIgnoringCase(headerName, "access-control-expose-headers")) parseAccessControlExposeHeadersAllowList(value, m_exposedHeaders); else if (!isOnAccessControlResponseHeaderWhitelist(headerName)) m_blockedHeaders.add(name); @@ -112,7 +113,7 @@ const HTTPHeaderSet& HTTPResponseHeaderValidator::blockedHeaders() m_exposedHeaders.remove("set-cookie"); m_exposedHeaders.remove("set-cookie2"); // Block Access-Control-Expose-Header itself. It could be exposed later. - m_blockedHeaders.add("access-control-expose-header"); + m_blockedHeaders.add("access-control-expose-headers"); HTTPHeaderSet::const_iterator end = m_exposedHeaders.end(); for (HTTPHeaderSet::const_iterator it = m_exposedHeaders.begin(); it != end; ++it) m_blockedHeaders.remove(*it); diff --git a/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp b/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp index 1f93cf93e..8d8a3fedc 100644 --- a/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp @@ -34,7 +34,10 @@ #include "AsyncFileSystemCallbacks.h" #include "AsyncFileWriterChromium.h" +#include "BlobURL.h" +#include "FileMetadata.h" #include "SecurityOrigin.h" +#include "ThreadableBlobRegistry.h" #include "WebFileInfo.h" #include "WebFileSystemCallbacksImpl.h" #include "WebFileWriter.h" @@ -46,11 +49,51 @@ namespace WebCore { +namespace { + // ChromeOS-specific filesystem type. const AsyncFileSystem::Type externalType = static_cast<AsyncFileSystem::Type>(WebKit::WebFileSystem::TypeExternal); const char externalPathPrefix[] = "external"; const size_t externalPathPrefixLength = sizeof(externalPathPrefix) - 1; +// Specialized callback class for createSnapshotFileAndReadMetadata. +class SnapshotFileCallbacks : public AsyncFileSystemCallbacks { +public: + static PassOwnPtr<SnapshotFileCallbacks> create(const KURL& internalBlobURL, PassOwnPtr<WebCore::AsyncFileSystemCallbacks> callbacks) + { + return adoptPtr(new SnapshotFileCallbacks(internalBlobURL, callbacks)); + } + + virtual void didReadMetadata(const FileMetadata& metadata) + { + ASSERT(m_callbacks); + + // This will create a new File object using the metadata. + m_callbacks->didReadMetadata(metadata); + + // Now that we've registered the snapshot file, we can unregister our internalBlobURL which has played a placeholder for the file during the IPC. + ThreadableBlobRegistry::unregisterBlobURL(m_internalBlobURL); + } + + virtual void didFail(int error) + { + ASSERT(m_callbacks); + m_callbacks->didFail(error); + } + +private: + SnapshotFileCallbacks(const KURL& internalBlobURL, PassOwnPtr<WebCore::AsyncFileSystemCallbacks> callbacks) + : m_internalBlobURL(internalBlobURL) + , m_callbacks(callbacks) + { + } + + KURL m_internalBlobURL; + OwnPtr<WebCore::AsyncFileSystemCallbacks> m_callbacks; +}; + +} // namespace + // static bool AsyncFileSystem::isAvailable() { @@ -254,6 +297,15 @@ void AsyncFileSystemChromium::createWriter(AsyncFileWriterClient* client, const m_webFileSystem->readMetadata(pathAsURL, new FileWriterHelperCallbacks(client, pathAsURL, m_webFileSystem, callbacks)); } +void AsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + KURL pathAsURL = virtualPathToFileSystemURL(path); + KURL internalBlobURL = BlobURL::createInternalURL(); + + // This will create a snapshot file and register the file to a blob using the given internalBlobURL. + m_webFileSystem->createSnapshotFileAndReadMetadata(internalBlobURL, pathAsURL, new WebKit::WebFileSystemCallbacksImpl(createSnapshotFileCallback(internalBlobURL, callbacks))); +} + KURL AsyncFileSystemChromium::virtualPathToFileSystemURL(const String& virtualPath) const { ASSERT(!m_filesystemRootURL.isEmpty()); @@ -263,6 +315,11 @@ KURL AsyncFileSystemChromium::virtualPathToFileSystemURL(const String& virtualPa return url; } +PassOwnPtr<AsyncFileSystemCallbacks> AsyncFileSystemChromium::createSnapshotFileCallback(const KURL& internalBlobURL, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) const +{ + return SnapshotFileCallbacks::create(internalBlobURL, callbacks); +} + } // namespace WebCore #endif diff --git a/Source/WebKit/chromium/src/AsyncFileSystemChromium.h b/Source/WebKit/chromium/src/AsyncFileSystemChromium.h index a8cbca276..8255d8e72 100644 --- a/Source/WebKit/chromium/src/AsyncFileSystemChromium.h +++ b/Source/WebKit/chromium/src/AsyncFileSystemChromium.h @@ -66,9 +66,13 @@ public: virtual void directoryExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); virtual void readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); virtual void createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); protected: AsyncFileSystemChromium(AsyncFileSystem::Type, const KURL& rootURL); + + PassOwnPtr<AsyncFileSystemCallbacks> createSnapshotFileCallback(const KURL& internalBlobURL, PassOwnPtr<AsyncFileSystemCallbacks>) const; + WebKit::WebFileSystem* m_webFileSystem; // Converts a given absolute virtual path to a full origin-qualified FileSystem URL. diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index 45a813859..ad35382b9 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -136,6 +136,7 @@ ChromeClientImpl::ChromeClientImpl(WebViewImpl* webView) , m_scrollbarsVisible(true) , m_menubarVisible(true) , m_resizable(true) + , m_nextNewWindowNavigationPolicy(WebNavigationPolicyIgnore) { } @@ -238,13 +239,23 @@ Page* ChromeClientImpl::createWindow( if (!m_webView->client()) return 0; + // FrameLoaderClientImpl may have given us a policy to use for the next new + // window navigation. If not, determine the policy using the same logic as + // show(). + WebNavigationPolicy policy; + if (m_nextNewWindowNavigationPolicy != WebNavigationPolicyIgnore) { + policy = m_nextNewWindowNavigationPolicy; + m_nextNewWindowNavigationPolicy = WebNavigationPolicyIgnore; + } else + policy = getNavigationPolicy(); + WrappedResourceRequest request; if (!r.resourceRequest().isEmpty()) request.bind(r.resourceRequest()); else if (!action.resourceRequest().isEmpty()) request.bind(action.resourceRequest()); WebViewImpl* newView = static_cast<WebViewImpl*>( - m_webView->client()->createView(WebFrameImpl::fromFrame(frame), request, features, r.frameName())); + m_webView->client()->createView(WebFrameImpl::fromFrame(frame), request, features, r.frameName(), policy)); if (!newView) return 0; @@ -287,11 +298,8 @@ static inline bool currentEventShouldCauseBackgroundTab(const WebInputEvent* inp return policy == WebNavigationPolicyNewBackgroundTab; } -void ChromeClientImpl::show() +WebNavigationPolicy ChromeClientImpl::getNavigationPolicy() { - if (!m_webView->client()) - return; - // If our default configuration was modified by a script or wasn't // created by a user gesture, then show as a popup. Else, let this // new window be opened as a toplevel window. @@ -306,8 +314,15 @@ void ChromeClientImpl::show() policy = WebNavigationPolicyNewPopup; if (currentEventShouldCauseBackgroundTab(WebViewImpl::currentInputEvent())) policy = WebNavigationPolicyNewBackgroundTab; + return policy; +} + +void ChromeClientImpl::show() +{ + if (!m_webView->client()) + return; - m_webView->client()->show(policy); + m_webView->client()->show(getNavigationPolicy()); } bool ChromeClientImpl::canRunModal() @@ -603,7 +618,7 @@ void ChromeClientImpl::mouseDidMoveOverElement( Widget* widget = toRenderWidget(object)->widget(); if (widget && widget->isPluginContainer()) { WebPluginContainerImpl* plugin = static_cast<WebPluginContainerImpl*>(widget); - url = plugin->plugin()->linkAtPosition(result.point()); + url = plugin->plugin()->linkAtPosition(result.roundedPoint()); } } } @@ -802,6 +817,11 @@ void ChromeClientImpl::setCursorForPlugin(const WebCursorInfo& cursor) setCursor(cursor); } +void ChromeClientImpl::setNewWindowNavigationPolicy(WebNavigationPolicy policy) +{ + m_nextNewWindowNavigationPolicy = policy; +} + void ChromeClientImpl::formStateDidChange(const Node* node) { // The current history item is not updated yet. That happens lazily when @@ -890,7 +910,7 @@ void ChromeClientImpl::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* grap void ChromeClientImpl::scheduleCompositingLayerSync() { - m_webView->setRootLayerNeedsDisplay(); + m_webView->scheduleCompositingLayerSync(); } ChromeClient::CompositingTriggerFlags ChromeClientImpl::allowedCompositingTriggers() const diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.h b/Source/WebKit/chromium/src/ChromeClientImpl.h index 23e02ff3d..c34945404 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.h +++ b/Source/WebKit/chromium/src/ChromeClientImpl.h @@ -35,6 +35,7 @@ #include "ChromeClientChromium.h" #include "PopupMenu.h" #include "SearchPopupMenu.h" +#include "WebNavigationPolicy.h" namespace WebCore { class AccessibilityObject; @@ -189,6 +190,7 @@ public: // ChromeClientImpl: void setCursorForPlugin(const WebCursorInfo&); + void setNewWindowNavigationPolicy(WebNavigationPolicy); virtual bool selectItemWritingDirectionIsNatural(); virtual bool selectItemAlignmentFollowsMenuWritingDirection(); @@ -196,10 +198,6 @@ public: virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const; virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const; -#if ENABLE(CONTEXT_MENUS) - virtual void showContextMenu() { } -#endif - virtual bool shouldRunModalDialogDuringPageDismissal(const DialogType&, const String& dialogMessage, WebCore::FrameLoader::PageDismissalType) const; virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const; @@ -213,6 +211,7 @@ public: #endif private: + WebNavigationPolicy getNavigationPolicy(); void getPopupMenuInfo(WebCore::PopupContainer*, WebPopupMenuInfo*); void setCursor(const WebCursorInfo&); @@ -222,6 +221,9 @@ private: bool m_scrollbarsVisible; bool m_menubarVisible; bool m_resizable; + + // The policy for how the next webview to be created will be shown. + WebNavigationPolicy m_nextNewWindowNavigationPolicy; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp index 790a9c52b..4712eff7d 100644 --- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -158,7 +158,7 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( Frame* selectedFrame = r.innerNonSharedNode()->document()->frame(); WebContextMenuData data; - data.mousePosition = selectedFrame->view()->contentsToWindow(r.point()); + data.mousePosition = selectedFrame->view()->contentsToWindow(r.roundedPoint()); // Compute edit flags. data.editFlags = WebContextMenuData::CanDoNone; diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp index a85ccbd2e..2dada5c50 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -145,10 +145,10 @@ void FrameLoaderClientImpl::documentElementAvailable() } #if USE(V8) -void FrameLoaderClientImpl::didCreateScriptContext(v8::Handle<v8::Context> context, int worldId) +void FrameLoaderClientImpl::didCreateScriptContext(v8::Handle<v8::Context> context, int extensionGroup, int worldId) { if (m_webFrame->client()) - m_webFrame->client()->didCreateScriptContext(m_webFrame, context, worldId); + m_webFrame->client()->didCreateScriptContext(m_webFrame, context, extensionGroup, worldId); } void FrameLoaderClientImpl::willReleaseScriptContext(v8::Handle<v8::Context> context, int worldId) @@ -612,7 +612,7 @@ void FrameLoaderClientImpl::dispatchWillPerformClientRedirect( // carry out such a navigation anyway, the best thing we can do for now to // not get confused is ignore this notification. if (m_expectedClientRedirectDest.isLocalFile() - && m_expectedClientRedirectSrc.protocolInHTTPFamily()) { + && m_expectedClientRedirectSrc.protocolIsInHTTPFamily()) { m_expectedClientRedirectSrc = KURL(); m_expectedClientRedirectDest = KURL(); return; @@ -873,21 +873,27 @@ void FrameLoaderClientImpl::dispatchDidFirstVisuallyNonEmptyLayout() Frame* FrameLoaderClientImpl::dispatchCreatePage(const NavigationAction& action) { - struct WindowFeatures features; - Page* newPage = m_webFrame->frame()->page()->chrome()->createWindow( - m_webFrame->frame(), FrameLoadRequest(m_webFrame->frame()->document()->securityOrigin()), - features, action); - // Make sure that we have a valid disposition. This should have been set in // the preceeding call to dispatchDecidePolicyForNewWindowAction. ASSERT(m_nextNavigationPolicy != WebNavigationPolicyIgnore); WebNavigationPolicy policy = m_nextNavigationPolicy; m_nextNavigationPolicy = WebNavigationPolicyIgnore; + // Store the disposition on the opener ChromeClientImpl so that we can pass + // it to WebViewClient::createView. + ChromeClientImpl* chromeClient = static_cast<ChromeClientImpl*>(m_webFrame->frame()->page()->chrome()->client()); + chromeClient->setNewWindowNavigationPolicy(policy); + + struct WindowFeatures features; + Page* newPage = m_webFrame->frame()->page()->chrome()->createWindow( + m_webFrame->frame(), FrameLoadRequest(m_webFrame->frame()->document()->securityOrigin()), + features, action); + // createWindow can return null (e.g., popup blocker denies the window). if (!newPage) return 0; + // Also give the disposition to the new window. WebViewImpl::fromPage(newPage)->setInitialNavigationPolicy(policy); return newPage->mainFrame(); } @@ -949,6 +955,11 @@ void FrameLoaderClientImpl::dispatchDecidePolicyForNewWindowAction( // creating or showing the new window that would allow us to avoid having // to keep this state. m_nextNavigationPolicy = navigationPolicy; + + // Store the disposition on the opener ChromeClientImpl so that we can pass + // it to WebViewClient::createView. + ChromeClientImpl* chromeClient = static_cast<ChromeClientImpl*>(m_webFrame->frame()->page()->chrome()->client()); + chromeClient->setNewWindowNavigationPolicy(navigationPolicy); } (m_webFrame->frame()->loader()->policyChecker()->*function)(policyAction); } diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h index 0bf935d6d..53d5997e8 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -62,7 +62,7 @@ public: virtual void documentElementAvailable(); #if USE(V8) - virtual void didCreateScriptContext(v8::Handle<v8::Context>, int worldId); + virtual void didCreateScriptContext(v8::Handle<v8::Context>, int extensionGroup, int worldId); virtual void willReleaseScriptContext(v8::Handle<v8::Context>, int worldId); #endif diff --git a/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp b/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp index c7ac894b0..4bfa2e5bc 100644 --- a/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp +++ b/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp @@ -67,6 +67,15 @@ #include "GrGLInterface.h" #endif +namespace { + +// The limit of the number of textures we hold in the GrContext's bitmap->texture cache. +const int maxGaneshTextureCacheCount = 512; +// The limit of the bytes allocated toward textures in the GrContext's bitmap->texture cache. +const size_t maxGaneshTextureCacheBytes = 96 * 1024 * 1024; + +} + // There are two levels of delegation in this file: // // 1. GraphicsContext3D delegates to GraphicsContext3DPrivate. This is done @@ -158,18 +167,41 @@ Platform3DObject GraphicsContext3DPrivate::platformTexture() const } #if USE(SKIA) +class GrMemoryAllocationChangedCallback : public Extensions3DChromium::GpuMemoryAllocationChangedCallbackCHROMIUM { +public: + GrMemoryAllocationChangedCallback(GraphicsContext3DPrivate* context) + : m_context(context) + { + } + + virtual void onGpuMemoryAllocationChanged(size_t gpuResourceSizeInBytes) + { + GrContext* context = m_context->grContext(); + if (!context) + return; + + if (!gpuResourceSizeInBytes) { + context->freeGpuResources(); + context->setTextureCacheLimits(0, 0); + } else + context->setTextureCacheLimits(maxGaneshTextureCacheCount, maxGaneshTextureCacheBytes); + } + +private: + GraphicsContext3DPrivate* m_context; +}; + GrContext* GraphicsContext3DPrivate::grContext() { - // Limit the number of textures we hold in the bitmap->texture cache. - static const int maxTextureCacheCount = 512; - // Limit the bytes allocated toward textures in the bitmap->texture cache. - static const size_t maxTextureCacheBytes = 96 * 1024 * 1024; - if (!m_grContext) { SkAutoTUnref<GrGLInterface> interface(m_impl->createGrGLInterface()); m_grContext = GrContext::Create(kOpenGL_Shaders_GrEngine, reinterpret_cast<GrPlatform3DContext>(interface.get())); - if (m_grContext) - m_grContext->setTextureCacheLimits(maxTextureCacheCount, maxTextureCacheBytes); + if (m_grContext) { + m_grContext->setTextureCacheLimits(maxGaneshTextureCacheCount, maxGaneshTextureCacheBytes); + Extensions3DChromium* extensions3DChromium = static_cast<Extensions3DChromium*>(getExtensions()); + if (extensions3DChromium->supports("GL_CHROMIUM_gpu_memory_manager")) + extensions3DChromium->setGpuMemoryAllocationChangedCallbackCHROMIUM(adoptPtr(new GrMemoryAllocationChangedCallback(this))); + } } return m_grContext; } @@ -552,6 +584,7 @@ GraphicsContext3D::Attributes GraphicsContext3DPrivate::getContextAttributes() attributes.antialias = webAttributes.antialias; attributes.premultipliedAlpha = webAttributes.premultipliedAlpha; attributes.preserveDrawingBuffer = m_preserveDrawingBuffer; + attributes.preferDiscreteGPU = webAttributes.preferDiscreteGPU; return attributes; } @@ -651,71 +684,71 @@ void GraphicsContext3DPrivate::texSubImage2D(GC3Denum target, GC3Dint level, GC3 DELEGATE_TO_IMPL_2(uniform1f, GC3Dint, GC3Dfloat) -void GraphicsContext3DPrivate::uniform1fv(GC3Dint location, GC3Dfloat* v, GC3Dsizei size) +void GraphicsContext3DPrivate::uniform1fv(GC3Dint location, GC3Dsizei size, GC3Dfloat* v) { m_impl->uniform1fv(location, size, v); } DELEGATE_TO_IMPL_2(uniform1i, GC3Dint, GC3Dint) -void GraphicsContext3DPrivate::uniform1iv(GC3Dint location, GC3Dint* v, GC3Dsizei size) +void GraphicsContext3DPrivate::uniform1iv(GC3Dint location, GC3Dsizei size, GC3Dint* v) { m_impl->uniform1iv(location, size, v); } DELEGATE_TO_IMPL_3(uniform2f, GC3Dint, GC3Dfloat, GC3Dfloat) -void GraphicsContext3DPrivate::uniform2fv(GC3Dint location, GC3Dfloat* v, GC3Dsizei size) +void GraphicsContext3DPrivate::uniform2fv(GC3Dint location, GC3Dsizei size, GC3Dfloat* v) { m_impl->uniform2fv(location, size, v); } DELEGATE_TO_IMPL_3(uniform2i, GC3Dint, GC3Dint, GC3Dint) -void GraphicsContext3DPrivate::uniform2iv(GC3Dint location, GC3Dint* v, GC3Dsizei size) +void GraphicsContext3DPrivate::uniform2iv(GC3Dint location, GC3Dsizei size, GC3Dint* v) { m_impl->uniform2iv(location, size, v); } DELEGATE_TO_IMPL_4(uniform3f, GC3Dint, GC3Dfloat, GC3Dfloat, GC3Dfloat) -void GraphicsContext3DPrivate::uniform3fv(GC3Dint location, GC3Dfloat* v, GC3Dsizei size) +void GraphicsContext3DPrivate::uniform3fv(GC3Dint location, GC3Dsizei size, GC3Dfloat* v) { m_impl->uniform3fv(location, size, v); } DELEGATE_TO_IMPL_4(uniform3i, GC3Dint, GC3Dint, GC3Dint, GC3Dint) -void GraphicsContext3DPrivate::uniform3iv(GC3Dint location, GC3Dint* v, GC3Dsizei size) +void GraphicsContext3DPrivate::uniform3iv(GC3Dint location, GC3Dsizei size, GC3Dint* v) { m_impl->uniform3iv(location, size, v); } DELEGATE_TO_IMPL_5(uniform4f, GC3Dint, GC3Dfloat, GC3Dfloat, GC3Dfloat, GC3Dfloat) -void GraphicsContext3DPrivate::uniform4fv(GC3Dint location, GC3Dfloat* v, GC3Dsizei size) +void GraphicsContext3DPrivate::uniform4fv(GC3Dint location, GC3Dsizei size, GC3Dfloat* v) { m_impl->uniform4fv(location, size, v); } DELEGATE_TO_IMPL_5(uniform4i, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint) -void GraphicsContext3DPrivate::uniform4iv(GC3Dint location, GC3Dint* v, GC3Dsizei size) +void GraphicsContext3DPrivate::uniform4iv(GC3Dint location, GC3Dsizei size, GC3Dint* v) { m_impl->uniform4iv(location, size, v); } -void GraphicsContext3DPrivate::uniformMatrix2fv(GC3Dint location, GC3Dboolean transpose, GC3Dfloat* value, GC3Dsizei size) +void GraphicsContext3DPrivate::uniformMatrix2fv(GC3Dint location, GC3Dsizei size, GC3Dboolean transpose, GC3Dfloat* value) { m_impl->uniformMatrix2fv(location, size, transpose, value); } -void GraphicsContext3DPrivate::uniformMatrix3fv(GC3Dint location, GC3Dboolean transpose, GC3Dfloat* value, GC3Dsizei size) +void GraphicsContext3DPrivate::uniformMatrix3fv(GC3Dint location, GC3Dsizei size, GC3Dboolean transpose, GC3Dfloat* value) { m_impl->uniformMatrix3fv(location, size, transpose, value); } -void GraphicsContext3DPrivate::uniformMatrix4fv(GC3Dint location, GC3Dboolean transpose, GC3Dfloat* value, GC3Dsizei size) +void GraphicsContext3DPrivate::uniformMatrix4fv(GC3Dint location, GC3Dsizei size, GC3Dboolean transpose, GC3Dfloat* value) { m_impl->uniformMatrix4fv(location, size, transpose, value); } @@ -996,6 +1029,7 @@ PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attri webAttributes.canRecoverFromContextLoss = attrs.canRecoverFromContextLoss; webAttributes.noExtensions = attrs.noExtensions; webAttributes.shareResources = attrs.shareResources; + webAttributes.preferDiscreteGPU = attrs.preferDiscreteGPU; OwnPtr<WebKit::WebGraphicsContext3D> webContext = adoptPtr(WebKit::webKitPlatformSupport()->createOffscreenGraphicsContext3D(webAttributes)); if (!webContext) @@ -1155,24 +1189,24 @@ DELEGATE_TO_INTERNAL_3(texParameteri, GC3Denum, GC3Denum, GC3Dint) DELEGATE_TO_INTERNAL_9(texSubImage2D, GC3Denum, GC3Dint, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei, GC3Denum, GC3Denum, const void*) DELEGATE_TO_INTERNAL_2(uniform1f, GC3Dint, GC3Dfloat) -DELEGATE_TO_INTERNAL_3(uniform1fv, GC3Dint, GC3Dfloat*, GC3Dsizei) +DELEGATE_TO_INTERNAL_3(uniform1fv, GC3Dint, GC3Dsizei, GC3Dfloat*) DELEGATE_TO_INTERNAL_2(uniform1i, GC3Dint, GC3Dint) -DELEGATE_TO_INTERNAL_3(uniform1iv, GC3Dint, GC3Dint*, GC3Dsizei) +DELEGATE_TO_INTERNAL_3(uniform1iv, GC3Dint, GC3Dsizei, GC3Dint*) DELEGATE_TO_INTERNAL_3(uniform2f, GC3Dint, GC3Dfloat, GC3Dfloat) -DELEGATE_TO_INTERNAL_3(uniform2fv, GC3Dint, GC3Dfloat*, GC3Dsizei) +DELEGATE_TO_INTERNAL_3(uniform2fv, GC3Dint, GC3Dsizei, GC3Dfloat*) DELEGATE_TO_INTERNAL_3(uniform2i, GC3Dint, GC3Dint, GC3Dint) -DELEGATE_TO_INTERNAL_3(uniform2iv, GC3Dint, GC3Dint*, GC3Dsizei) +DELEGATE_TO_INTERNAL_3(uniform2iv, GC3Dint, GC3Dsizei, GC3Dint*) DELEGATE_TO_INTERNAL_4(uniform3f, GC3Dint, GC3Dfloat, GC3Dfloat, GC3Dfloat) -DELEGATE_TO_INTERNAL_3(uniform3fv, GC3Dint, GC3Dfloat*, GC3Dsizei) +DELEGATE_TO_INTERNAL_3(uniform3fv, GC3Dint, GC3Dsizei, GC3Dfloat*) DELEGATE_TO_INTERNAL_4(uniform3i, GC3Dint, GC3Dint, GC3Dint, GC3Dint) -DELEGATE_TO_INTERNAL_3(uniform3iv, GC3Dint, GC3Dint*, GC3Dsizei) +DELEGATE_TO_INTERNAL_3(uniform3iv, GC3Dint, GC3Dsizei, GC3Dint*) DELEGATE_TO_INTERNAL_5(uniform4f, GC3Dint, GC3Dfloat, GC3Dfloat, GC3Dfloat, GC3Dfloat) -DELEGATE_TO_INTERNAL_3(uniform4fv, GC3Dint, GC3Dfloat*, GC3Dsizei) +DELEGATE_TO_INTERNAL_3(uniform4fv, GC3Dint, GC3Dsizei, GC3Dfloat*) DELEGATE_TO_INTERNAL_5(uniform4i, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint) -DELEGATE_TO_INTERNAL_3(uniform4iv, GC3Dint, GC3Dint*, GC3Dsizei) -DELEGATE_TO_INTERNAL_4(uniformMatrix2fv, GC3Dint, GC3Dboolean, GC3Dfloat*, GC3Dsizei) -DELEGATE_TO_INTERNAL_4(uniformMatrix3fv, GC3Dint, GC3Dboolean, GC3Dfloat*, GC3Dsizei) -DELEGATE_TO_INTERNAL_4(uniformMatrix4fv, GC3Dint, GC3Dboolean, GC3Dfloat*, GC3Dsizei) +DELEGATE_TO_INTERNAL_3(uniform4iv, GC3Dint, GC3Dsizei, GC3Dint*) +DELEGATE_TO_INTERNAL_4(uniformMatrix2fv, GC3Dint, GC3Dsizei, GC3Dboolean, GC3Dfloat*) +DELEGATE_TO_INTERNAL_4(uniformMatrix3fv, GC3Dint, GC3Dsizei, GC3Dboolean, GC3Dfloat*) +DELEGATE_TO_INTERNAL_4(uniformMatrix4fv, GC3Dint, GC3Dsizei, GC3Dboolean, GC3Dfloat*) DELEGATE_TO_INTERNAL_1(useProgram, Platform3DObject) DELEGATE_TO_INTERNAL_1(validateProgram, Platform3DObject) diff --git a/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h b/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h index d296eeb9b..be9db4287 100644 --- a/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h +++ b/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h @@ -209,24 +209,24 @@ public: void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, const void* pixels); void uniform1f(GC3Dint location, GC3Dfloat x); - void uniform1fv(GC3Dint location, GC3Dfloat* v, GC3Dsizei); + void uniform1fv(GC3Dint location, GC3Dsizei, GC3Dfloat* v); void uniform1i(GC3Dint location, GC3Dint x); - void uniform1iv(GC3Dint location, GC3Dint* v, GC3Dsizei); + void uniform1iv(GC3Dint location, GC3Dsizei, GC3Dint* v); void uniform2f(GC3Dint location, GC3Dfloat x, float y); - void uniform2fv(GC3Dint location, GC3Dfloat* v, GC3Dsizei); + void uniform2fv(GC3Dint location, GC3Dsizei, GC3Dfloat* v); void uniform2i(GC3Dint location, GC3Dint x, GC3Dint y); - void uniform2iv(GC3Dint location, GC3Dint* v, GC3Dsizei); + void uniform2iv(GC3Dint location, GC3Dsizei, GC3Dint* v); void uniform3f(GC3Dint location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z); - void uniform3fv(GC3Dint location, GC3Dfloat* v, GC3Dsizei); + void uniform3fv(GC3Dint location, GC3Dsizei, GC3Dfloat* v); void uniform3i(GC3Dint location, GC3Dint x, GC3Dint y, GC3Dint z); - void uniform3iv(GC3Dint location, GC3Dint* v, GC3Dsizei); + void uniform3iv(GC3Dint location, GC3Dsizei, GC3Dint* v); void uniform4f(GC3Dint location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, GC3Dfloat w); - void uniform4fv(GC3Dint location, GC3Dfloat* v, GC3Dsizei); + void uniform4fv(GC3Dint location, GC3Dsizei, GC3Dfloat* v); void uniform4i(GC3Dint location, GC3Dint x, GC3Dint y, GC3Dint z, GC3Dint w); - void uniform4iv(GC3Dint location, GC3Dint* v, GC3Dsizei); - void uniformMatrix2fv(GC3Dint location, GC3Dboolean transpose, GC3Dfloat* value, GC3Dsizei); - void uniformMatrix3fv(GC3Dint location, GC3Dboolean transpose, GC3Dfloat* value, GC3Dsizei); - void uniformMatrix4fv(GC3Dint location, GC3Dboolean transpose, GC3Dfloat* value, GC3Dsizei); + void uniform4iv(GC3Dint location, GC3Dsizei, GC3Dint* v); + void uniformMatrix2fv(GC3Dint location, GC3Dsizei, GC3Dboolean transpose, GC3Dfloat* value); + void uniformMatrix3fv(GC3Dint location, GC3Dsizei, GC3Dboolean transpose, GC3Dfloat* value); + void uniformMatrix4fv(GC3Dint location, GC3Dsizei, GC3Dboolean transpose, GC3Dfloat* value); void useProgram(Platform3DObject); void validateProgram(Platform3DObject); diff --git a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp index a1cce45b0..149bfe12a 100755 --- a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp @@ -90,16 +90,16 @@ static const char allowIndexedDBMode[] = "allowIndexedDBMode"; class AllowIndexedDBMainThreadBridge : public ThreadSafeRefCounted<AllowIndexedDBMainThreadBridge> { public: - static PassRefPtr<AllowIndexedDBMainThreadBridge> create(WebWorkerClientImpl* webWorkerClientImpl, const String& mode, const String& name) + static PassRefPtr<AllowIndexedDBMainThreadBridge> create(WebWorkerBase* webWorkerBase, const String& mode, const String& name) { - return adoptRef(new AllowIndexedDBMainThreadBridge(webWorkerClientImpl, mode, name)); + return adoptRef(new AllowIndexedDBMainThreadBridge(webWorkerBase, mode, name)); } // These methods are invoked on the worker context. void cancel() { MutexLocker locker(m_mutex); - m_webWorkerClientImpl = 0; + m_webWorkerBase = 0; } bool result() @@ -111,31 +111,28 @@ public: void signalCompleted(bool result, const String& mode) { MutexLocker locker(m_mutex); - if (m_webWorkerClientImpl) - m_webWorkerClientImpl->postTaskForModeToWorkerContext(createCallbackTask(&didComplete, this, result), mode); + if (m_webWorkerBase) + m_webWorkerBase->postTaskForModeToWorkerContext(createCallbackTask(&didComplete, this, result), mode); } private: - AllowIndexedDBMainThreadBridge(WebWorkerClientImpl* webWorkerClientImpl, const String& mode, const String& name) + AllowIndexedDBMainThreadBridge(WebWorkerBase* webWorkerBase, const String& mode, const String& name) : m_result(false) - , m_webWorkerClientImpl(webWorkerClientImpl) + , m_webWorkerBase(webWorkerBase) { - WebFrameImpl* webFrame = static_cast<WebFrameImpl*>(webWorkerClientImpl->view()->mainFrame()); - // webFrame is not deleted as long as the process is alive, relying on - // it to exist on the main thread should be ok. + WebCommonWorkerClient* commonClient = webWorkerBase->commonClient(); + // See note about thread-safety below. WebWorkerBase::dispatchTaskToMainThread( - createCallbackTask(&allowIndexedDBTask, this, WebCore::AllowCrossThreadAccess(webFrame), name, mode)); + createCallbackTask(&allowIndexedDBTask, this, WebCore::AllowCrossThreadAccess(commonClient), name, mode)); } - static void allowIndexedDBTask(ScriptExecutionContext*, PassRefPtr<AllowIndexedDBMainThreadBridge> bridge, PassRefPtr<WebFrameImpl> prpWebFrame, const String& name, const String& mode) + static void allowIndexedDBTask(ScriptExecutionContext*, PassRefPtr<AllowIndexedDBMainThreadBridge> bridge, WebCommonWorkerClient* commonClient, const String& name, const String& mode) { - RefPtr<WebFrameImpl> webFrame = prpWebFrame; - WebViewImpl* webView = webFrame->viewImpl(); - if (!webView) { + if (!commonClient) { bridge->signalCompleted(false, mode); return; } - bool allowed = !webView->permissionClient() || webView->permissionClient()->allowIndexedDB(webFrame.get(), name, WebSecurityOrigin()); + bool allowed = commonClient->allowIndexedDB(name); bridge->signalCompleted(allowed, mode); } @@ -146,29 +143,33 @@ private: bool m_result; Mutex m_mutex; - // WebWorkerClientImpl is never deleted as long as the renderer process - // is alive. We use it on the main thread to notify the worker thread that - // the permission result has been set. The underlying message proxy object - // is valid as long as the worker run loop hasn't returned - // MessageQueueTerminated, in which case we don't use the - // WebWorkerClientImpl. - WebWorkerClientImpl* m_webWorkerClientImpl; + // AllowIndexedDBMainThreadBridge uses two non-threadsafe classes across + // threads: WebWorkerBase and WebCommonWorkerClient. + // In the dedicated worker case, these are both the same object of type + // WebWorkerClientImpl, which isn't deleted for the life of the renderer + // process so we don't have to worry about use-after-frees. + // In the shared worker case, these are of type WebSharedWorkerImpl and + // chromium's WebSharedWorkerClientProxy, respectively. These are both + // deleted on the main thread in response to a request on the worker thread, + // but only after the worker run loop stops processing tasks. So even in + // the most interleaved case, we have: + // W AllowIndexedDBMainThreadBridge schedules allowIndexedDBTask + // M workerRunLoop marked as killed + // W runLoop stops and schedules object deletion on main thread + // M allowIndexedDBTask calls commonClient->allowIndexedDB() + // M WebWorkerBase and WebCommonWorkerClient are deleted + WebWorkerBase* m_webWorkerBase; }; bool IDBFactoryBackendProxy::allowIDBFromWorkerThread(WorkerContext* workerContext, const String& name, const WebSecurityOrigin&) { - // FIXME: Bypass checking for permission so as not to block shared worker - // testing until a permissions check is implemented. This has to be fixed - // before m19 goes to beta. http://crbug.com/112855 - if (workerContext->isSharedWorkerContext()) - return true; - WebWorkerClientImpl* webWorkerClientImpl = static_cast<WebWorkerClientImpl*>(&workerContext->thread()->workerLoaderProxy()); + WebWorkerBase* webWorkerBase = static_cast<WebWorkerBase*>(&workerContext->thread()->workerLoaderProxy()); WorkerRunLoop& runLoop = workerContext->thread()->runLoop(); String mode = allowIndexedDBMode; mode.append(String::number(runLoop.createUniqueId())); - RefPtr<AllowIndexedDBMainThreadBridge> bridge = AllowIndexedDBMainThreadBridge::create(webWorkerClientImpl, mode, name); + RefPtr<AllowIndexedDBMainThreadBridge> bridge = AllowIndexedDBMainThreadBridge::create(webWorkerBase, mode, name); // Either the bridge returns, or the queue gets terminated. if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated) { diff --git a/Source/WebKit/chromium/src/NotificationPresenterImpl.cpp b/Source/WebKit/chromium/src/NotificationPresenterImpl.cpp index 4b68235a1..99a7ea378 100644 --- a/Source/WebKit/chromium/src/NotificationPresenterImpl.cpp +++ b/Source/WebKit/chromium/src/NotificationPresenterImpl.cpp @@ -98,10 +98,10 @@ void NotificationPresenterImpl::notificationControllerDestroyed() { } -NotificationPresenter::Permission NotificationPresenterImpl::checkPermission(ScriptExecutionContext* context) +NotificationClient::Permission NotificationPresenterImpl::checkPermission(ScriptExecutionContext* context) { int result = m_presenter->checkPermission(WebSecurityOrigin(context->securityOrigin())); - return static_cast<NotificationPresenter::Permission>(result); + return static_cast<NotificationClient::Permission>(result); } void NotificationPresenterImpl::requestPermission(ScriptExecutionContext* context, PassRefPtr<VoidCallback> callback) diff --git a/Source/WebKit/chromium/src/NotificationPresenterImpl.h b/Source/WebKit/chromium/src/NotificationPresenterImpl.h index 3eb5a87da..cad5b8801 100644 --- a/Source/WebKit/chromium/src/NotificationPresenterImpl.h +++ b/Source/WebKit/chromium/src/NotificationPresenterImpl.h @@ -31,7 +31,7 @@ #ifndef NotificationPresenterImpl_h #define NotificationPresenterImpl_h -#include "NotificationPresenter.h" +#include "NotificationClient.h" #include "VoidCallback.h" #include <wtf/HashMap.h> @@ -43,7 +43,7 @@ namespace WebKit { class WebNotificationPresenter; -class NotificationPresenterImpl : public WebCore::NotificationPresenter { +class NotificationPresenterImpl : public WebCore::NotificationClient { public: NotificationPresenterImpl() : m_presenter(0) { } @@ -55,7 +55,7 @@ public: virtual void cancel(WebCore::Notification* object); virtual void notificationObjectDestroyed(WebCore::Notification* object); virtual void notificationControllerDestroyed(); - virtual WebCore::NotificationPresenter::Permission checkPermission(WebCore::ScriptExecutionContext*); + virtual WebCore::NotificationClient::Permission checkPermission(WebCore::ScriptExecutionContext*); virtual void requestPermission(WebCore::ScriptExecutionContext* , WTF::PassRefPtr<WebCore::VoidCallback> callback); virtual void cancelRequestsForPermission(WebCore::ScriptExecutionContext*) {} diff --git a/Source/WebKit/chromium/src/WebCache.cpp b/Source/WebKit/chromium/src/WebCache.cpp index fa260cc4c..d7bbc813b 100644 --- a/Source/WebKit/chromium/src/WebCache.cpp +++ b/Source/WebKit/chromium/src/WebCache.cpp @@ -31,14 +31,9 @@ #include "config.h" #include "WebCache.h" -// Instead of providing accessors, we make all members of MemoryCache public. -// This will make it easier to track WebCore changes to the MemoryCache class. -// FIXME: We should introduce public getters on the MemoryCache class. -#define private public #include "MemoryCache.h" -#undef private -using namespace WebCore; +using WebCore::MemoryCache; namespace WebKit { @@ -83,11 +78,11 @@ void WebCache::getUsageStats(UsageStats* result) MemoryCache* cache = WebCore::memoryCache(); if (cache) { - result->minDeadCapacity = cache->m_minDeadCapacity; - result->maxDeadCapacity = cache->m_maxDeadCapacity; - result->capacity = cache->m_capacity; - result->liveSize = cache->m_liveSize; - result->deadSize = cache->m_deadSize; + result->minDeadCapacity = cache->minDeadCapacity(); + result->maxDeadCapacity = cache->maxDeadCapacity(); + result->capacity = cache->capacity(); + result->liveSize = cache->liveSize(); + result->deadSize = cache->deadSize(); } else memset(result, 0, sizeof(UsageStats)); } diff --git a/Source/WebKit/chromium/src/WebColor.cpp b/Source/WebKit/chromium/src/WebColorName.cpp index 737338a8b..04d8ed8a8 100644 --- a/Source/WebKit/chromium/src/WebColor.cpp +++ b/Source/WebKit/chromium/src/WebColorName.cpp @@ -29,21 +29,21 @@ */ #include "config.h" -#include "platform/WebColor.h" +#include "WebColorName.h" -#include "Color.h" #include "CSSValueKeywords.h" +#include "Color.h" #include "RenderTheme.h" #include "UnusedParam.h" -#include "platform/WebColorName.h" +#include <public/WebColor.h> using namespace::WebCore; namespace WebKit { -static int toCSSValueKeyword(WebColorName in_value) +static int toCSSValueKeyword(WebColorName name) { - switch (in_value) { + switch (name) { case WebColorActiveBorder: return CSSValueActiveborder; case WebColorActiveCaption: diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp index 397308b52..c2dbee3b4 100644 --- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp +++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp @@ -206,7 +206,7 @@ int WebCompositorInputHandlerImpl::identifier() const return m_identifier; } -void WebCompositorInputHandlerImpl::willDraw(double frameBeginTimeMs) +void WebCompositorInputHandlerImpl::willDraw(double monotonicTime) { } diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h index a2f13025d..83b4bd546 100644 --- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h +++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h @@ -61,7 +61,7 @@ public: // WebCore::CCInputHandler implementation virtual int identifier() const; - virtual void willDraw(double frameBeginTimeMs); + virtual void willDraw(double monotonicTime); private: explicit WebCompositorInputHandlerImpl(WebCore::CCInputHandlerClient*); diff --git a/Source/WebKit/chromium/src/WebDataSourceImpl.cpp b/Source/WebKit/chromium/src/WebDataSourceImpl.cpp index d6d98c752..501fd447c 100644 --- a/Source/WebKit/chromium/src/WebDataSourceImpl.cpp +++ b/Source/WebKit/chromium/src/WebDataSourceImpl.cpp @@ -129,6 +129,11 @@ void WebDataSourceImpl::setDeferMainResourceDataLoad(bool defer) DocumentLoader::setDeferMainResourceDataLoad(defer); } +void WebDataSourceImpl::setNavigationStartTime(double navigationStart) +{ + timing()->setNavigationStart(navigationStart); +} + WebNavigationType WebDataSourceImpl::toWebNavigationType(NavigationType type) { switch (type) { diff --git a/Source/WebKit/chromium/src/WebDataSourceImpl.h b/Source/WebKit/chromium/src/WebDataSourceImpl.h index 8cc2c80c6..3e8c8bb55 100644 --- a/Source/WebKit/chromium/src/WebDataSourceImpl.h +++ b/Source/WebKit/chromium/src/WebDataSourceImpl.h @@ -70,6 +70,7 @@ public: virtual void setExtraData(ExtraData*); virtual WebApplicationCacheHost* applicationCacheHost(); virtual void setDeferMainResourceDataLoad(bool); + virtual void setNavigationStartTime(double); static WebNavigationType toWebNavigationType(WebCore::NavigationType type); diff --git a/Source/WebKit/chromium/src/WebDragData.cpp b/Source/WebKit/chromium/src/WebDragData.cpp index 9e634340e..322dfbaeb 100644 --- a/Source/WebKit/chromium/src/WebDragData.cpp +++ b/Source/WebKit/chromium/src/WebDragData.cpp @@ -69,8 +69,8 @@ void WebDragData::assign(const WebDragData& other) WebVector<WebDragData::Item> WebDragData::items() const { Vector<Item> itemList; - RefPtr<DOMStringList> types = m_private->types(); - if (types->contains(mimeTypeTextPlain)) { + const HashSet<String>& types = m_private->types(); + if (types.contains(mimeTypeTextPlain)) { Item item; item.storageType = Item::StorageTypeString; item.stringType = String(mimeTypeTextPlain); @@ -78,7 +78,7 @@ WebVector<WebDragData::Item> WebDragData::items() const item.stringData = m_private->getData(mimeTypeTextPlain, ignored); itemList.append(item); } - if (types->contains(mimeTypeTextURIList)) { + if (types.contains(mimeTypeTextURIList)) { Item item; item.storageType = Item::StorageTypeString; item.stringType = String(mimeTypeTextURIList); @@ -87,7 +87,7 @@ WebVector<WebDragData::Item> WebDragData::items() const item.title = m_private->urlTitle(); itemList.append(item); } - if (types->contains(mimeTypeTextHTML)) { + if (types.contains(mimeTypeTextHTML)) { Item item; item.storageType = Item::StorageTypeString; item.stringType = String(mimeTypeTextHTML); @@ -96,7 +96,7 @@ WebVector<WebDragData::Item> WebDragData::items() const item.baseURL = m_private->htmlBaseUrl(); itemList.append(item); } - if (types->contains(mimeTypeDownloadURL)) { + if (types.contains(mimeTypeDownloadURL)) { Item item; item.storageType = Item::StorageTypeString; item.stringType = String(mimeTypeDownloadURL); diff --git a/Source/WebKit/chromium/src/WebElement.cpp b/Source/WebKit/chromium/src/WebElement.cpp index 43e51d4bf..e6a1b6e4e 100644 --- a/Source/WebKit/chromium/src/WebElement.cpp +++ b/Source/WebKit/chromium/src/WebElement.cpp @@ -34,6 +34,7 @@ #include "WebDocument.h" #include "Element.h" +#include "NamedNodeMap.h" #include "RenderBoxModelObject.h" #include "RenderObject.h" #include <wtf/PassRefPtr.h> diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp b/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp index b3a332b2a..c9ba0bc7b 100644 --- a/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp +++ b/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp @@ -68,7 +68,7 @@ WebFloatRect WebExternalTextureLayer::uvRect() const void WebExternalTextureLayer::invalidateRect(const WebFloatRect& updateRect) { - unwrap<WebExternalTextureLayerImpl>()->invalidateRect(updateRect); + unwrap<WebExternalTextureLayerImpl>()->setNeedsDisplayRect(updateRect); } WebExternalTextureLayer::WebExternalTextureLayer(const PassRefPtr<WebExternalTextureLayerImpl>& node) diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index adf202371..39897c823 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -1347,7 +1347,7 @@ WebString WebFrameImpl::selectionAsMarkup() const if (!range) return WebString(); - return createMarkup(range.get(), 0); + return createMarkup(range.get(), 0, AnnotateForInterchange, false, ResolveNonLocalURLs); } void WebFrameImpl::selectWordAroundPosition(Frame* frame, VisiblePosition pos) diff --git a/Source/WebKit/chromium/src/WebGeolocationPermissionRequest.cpp b/Source/WebKit/chromium/src/WebGeolocationPermissionRequest.cpp index b4c7f3d17..6d7ec631a 100644 --- a/Source/WebKit/chromium/src/WebGeolocationPermissionRequest.cpp +++ b/Source/WebKit/chromium/src/WebGeolocationPermissionRequest.cpp @@ -39,7 +39,7 @@ namespace WebKit { WebSecurityOrigin WebGeolocationPermissionRequest::securityOrigin() const { - return WebSecurityOrigin(m_private->frame()->document()->securityOrigin()); + return WebSecurityOrigin(m_private->scriptExecutionContext()->securityOrigin()); } void WebGeolocationPermissionRequest::setIsAllowed(bool allowed) diff --git a/Source/WebKit/chromium/src/WebInputElement.cpp b/Source/WebKit/chromium/src/WebInputElement.cpp index 736165bbf..f5d52da80 100644 --- a/Source/WebKit/chromium/src/WebInputElement.cpp +++ b/Source/WebKit/chromium/src/WebInputElement.cpp @@ -33,8 +33,6 @@ #include "HTMLInputElement.h" #include "HTMLNames.h" -#include "RenderObject.h" -#include "RenderTextControlSingleLine.h" #include "TextControlInnerElements.h" #include "platform/WebString.h" #include <wtf/PassRefPtr.h> @@ -165,12 +163,7 @@ bool WebInputElement::isSpeechInputEnabled() const WebInputElement::SpeechInputState WebInputElement::getSpeechInputState() const { #if ENABLE(INPUT_SPEECH) - RenderObject* renderer = constUnwrap<HTMLInputElement>()->renderer(); - if (!renderer) - return Idle; - - RenderTextControlSingleLine* control = toRenderTextControlSingleLine(renderer); - InputFieldSpeechButtonElement* speechButton = toInputFieldSpeechButtonElement(control->speechButtonElement()); + InputFieldSpeechButtonElement* speechButton = toInputFieldSpeechButtonElement(constUnwrap<HTMLInputElement>()->speechButtonElement()); if (speechButton) return static_cast<WebInputElement::SpeechInputState>(speechButton->state()); #endif @@ -181,12 +174,7 @@ WebInputElement::SpeechInputState WebInputElement::getSpeechInputState() const void WebInputElement::startSpeechInput() { #if ENABLE(INPUT_SPEECH) - RenderObject* renderer = constUnwrap<HTMLInputElement>()->renderer(); - if (!renderer) - return; - - RenderTextControlSingleLine* control = toRenderTextControlSingleLine(renderer); - InputFieldSpeechButtonElement* speechButton = toInputFieldSpeechButtonElement(control->speechButtonElement()); + InputFieldSpeechButtonElement* speechButton = toInputFieldSpeechButtonElement(constUnwrap<HTMLInputElement>()->speechButtonElement()); if (speechButton) speechButton->startSpeechInput(); #endif @@ -195,12 +183,7 @@ void WebInputElement::startSpeechInput() void WebInputElement::stopSpeechInput() { #if ENABLE(INPUT_SPEECH) - RenderObject* renderer = constUnwrap<HTMLInputElement>()->renderer(); - if (!renderer) - return; - - RenderTextControlSingleLine* control = toRenderTextControlSingleLine(renderer); - InputFieldSpeechButtonElement* speechButton = toInputFieldSpeechButtonElement(control->speechButtonElement()); + InputFieldSpeechButtonElement* speechButton = toInputFieldSpeechButtonElement(constUnwrap<HTMLInputElement>()->speechButtonElement()); if (speechButton) speechButton->stopSpeechInput(); #endif diff --git a/Source/WebKit/chromium/src/WebLayerTreeView.cpp b/Source/WebKit/chromium/src/WebLayerTreeView.cpp index d2c0f0c12..3314dc2f5 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeView.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeView.cpp @@ -26,9 +26,11 @@ #include "config.h" #include "platform/WebLayerTreeView.h" +#include "GraphicsContext3DPrivate.h" #include "WebLayerTreeViewImpl.h" #include "cc/CCLayerTreeHost.h" #include "platform/WebLayer.h" +#include "platform/WebPoint.h" #include "platform/WebRect.h" #include "platform/WebSize.h" @@ -51,11 +53,6 @@ WebLayerTreeView::Settings::operator CCSettings() const return settings; } -WebLayerTreeView WebLayerTreeView::create(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings) -{ - return WebLayerTreeView(WebLayerTreeViewImpl::create(client, root, settings)); -} - void WebLayerTreeView::reset() { m_private.reset(); @@ -71,12 +68,23 @@ bool WebLayerTreeView::equals(const WebLayerTreeView& n) const return (m_private.get() == n.m_private.get()); } -void WebLayerTreeView::composite() +bool WebLayerTreeView::initialize(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings) { - if (CCProxy::hasImplThread()) - m_private->setNeedsCommit(); + m_private = WebLayerTreeViewImpl::create(client, root, settings); + return !isNull(); +} + +void WebLayerTreeView::setRootLayer(WebLayer *root) +{ + if (root) + m_private->setRootLayer(*root); else - m_private->composite(); + m_private->setRootLayer(PassRefPtr<LayerChromium>()); +} + +int WebLayerTreeView::compositorIdentifier() +{ + return m_private->compositorIdentifier(); } void WebLayerTreeView::setViewportSize(const WebSize& viewportSize) @@ -89,38 +97,62 @@ WebSize WebLayerTreeView::viewportSize() const return WebSize(m_private->viewportSize()); } -bool WebLayerTreeView::compositeAndReadback(void *pixels, const WebRect& rect) +void WebLayerTreeView::setVisible(bool visible) { - return m_private->compositeAndReadback(pixels, rect); + m_private->setVisible(visible); } -void WebLayerTreeView::setRootLayer(WebLayer *root) +void WebLayerTreeView::setPageScaleFactorAndLimits(float pageScaleFactor, float minimum, float maximum) { - if (root) - m_private->setRootLayer(*root); + m_private->setPageScaleFactorAndLimits(pageScaleFactor, minimum, maximum); +} + +void WebLayerTreeView::startPageScaleAnimation(const WebPoint& scroll, bool useAnchor, float newPageScale, double durationSec) +{ + m_private->startPageScaleAnimation(IntSize(scroll.x, scroll.y), useAnchor, newPageScale, durationSec); +} + +void WebLayerTreeView::setNeedsAnimate() +{ + m_private->setNeedsAnimate(); +} + +void WebLayerTreeView::setNeedsRedraw() +{ + m_private->setNeedsRedraw(); +} + +void WebLayerTreeView::composite() +{ + if (CCProxy::hasImplThread()) + m_private->setNeedsCommit(); else - m_private->setRootLayer(PassRefPtr<LayerChromium>()); + m_private->composite(); +} + +void WebLayerTreeView::updateAnimations(double frameBeginTime) +{ + m_private->updateAnimations(frameBeginTime); } -WebLayerTreeView::WebLayerTreeView(const PassRefPtr<CCLayerTreeHost>& node) - : m_private(node) +bool WebLayerTreeView::compositeAndReadback(void *pixels, const WebRect& rect) { + return m_private->compositeAndReadback(pixels, rect); } -WebLayerTreeView& WebLayerTreeView::operator=(const PassRefPtr<CCLayerTreeHost>& node) +void WebLayerTreeView::finishAllRendering() { - m_private = node; - return *this; + m_private->finishAllRendering(); } -WebLayerTreeView::operator PassRefPtr<CCLayerTreeHost>() const +WebGraphicsContext3D* WebLayerTreeView::context() { - return m_private.get(); + return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_private->context()); } -void WebLayerTreeView::setNeedsRedraw() +void WebLayerTreeView::loseCompositorContext(int numTimes) { - m_private->setNeedsRedraw(); + m_private->loseContext(numTimes); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp index 29d033215..335879b66 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp @@ -78,7 +78,7 @@ void WebLayerTreeViewImpl::applyScrollAndScale(const WebCore::IntSize& scrollDel m_client->applyScrollAndScale(WebSize(scrollDelta), pageScale); } -PassRefPtr<GraphicsContext3D> WebLayerTreeViewImpl::createLayerTreeHostContext3D() +PassRefPtr<GraphicsContext3D> WebLayerTreeViewImpl::createContext() { if (!m_client) return 0; @@ -89,20 +89,22 @@ PassRefPtr<GraphicsContext3D> WebLayerTreeViewImpl::createLayerTreeHostContext3D return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow, false /* preserveDrawingBuffer */ ); } -void WebLayerTreeViewImpl::didCommitAndDrawFrame() +void WebLayerTreeViewImpl::didRecreateContext(bool success) { - // FIXME: route this up to the WebLayerTreeView client + if (m_client) + m_client->didRebindGraphicsContext(success); } -void WebLayerTreeViewImpl::didCompleteSwapBuffers() +void WebLayerTreeViewImpl::didCommitAndDrawFrame() { - // FIXME: route this up to the WebLayerTreeView client + if (m_client) + m_client->didCommitAndDrawFrame(); } -void WebLayerTreeViewImpl::didRecreateGraphicsContext(bool success) +void WebLayerTreeViewImpl::didCompleteSwapBuffers() { if (m_client) - m_client->didRebindGraphicsContext(success); + m_client->didCompleteSwapBuffers(); } void WebLayerTreeViewImpl::scheduleComposite() diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h index 580e9af84..b1b26d0fc 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h +++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h @@ -44,8 +44,8 @@ private: virtual void updateAnimations(double frameBeginTime); virtual void layout(); virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale); - virtual PassRefPtr<WebCore::GraphicsContext3D> createLayerTreeHostContext3D(); - virtual void didRecreateGraphicsContext(bool success); + virtual PassRefPtr<WebCore::GraphicsContext3D> createContext(); + virtual void didRecreateContext(bool success); virtual void didCommitAndDrawFrame(); virtual void didCompleteSwapBuffers(); diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index ec74b6bea..74c4a7200 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -152,7 +152,7 @@ void WebMediaPlayerClientImpl::repaint() ASSERT(m_mediaPlayer); #if USE(ACCELERATED_COMPOSITING) if (m_videoLayer && supportsAcceleratedRendering()) - m_videoLayer->contentChanged(); + m_videoLayer->setNeedsDisplay(); #endif m_mediaPlayer->repaint(); } diff --git a/Source/WebKit/chromium/src/WebNamedNodeMap.cpp b/Source/WebKit/chromium/src/WebNamedNodeMap.cpp index e2455e6b9..ba5f29625 100644 --- a/Source/WebKit/chromium/src/WebNamedNodeMap.cpp +++ b/Source/WebKit/chromium/src/WebNamedNodeMap.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "WebNamedNodeMap.h" +#include "Element.h" #include "NamedNodeMap.h" #include "Node.h" #include "WebAttribute.h" @@ -63,7 +64,7 @@ unsigned WebNamedNodeMap::length() const WebAttribute WebNamedNodeMap::attributeItem(unsigned index) const { - return WebAttribute(m_private->attributeItem(index)); + return WebAttribute(m_private->element()->attributeItem(index)); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebOptionElement.cpp b/Source/WebKit/chromium/src/WebOptionElement.cpp index d48492594..c71f7b565 100644 --- a/Source/WebKit/chromium/src/WebOptionElement.cpp +++ b/Source/WebKit/chromium/src/WebOptionElement.cpp @@ -83,7 +83,7 @@ bool WebOptionElement::isEnabled() const } WebOptionElement::WebOptionElement(const PassRefPtr<HTMLOptionElement>& elem) - : WebFormControlElement(elem) + : WebElement(elem) { } diff --git a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp new file mode 100644 index 000000000..bc810c7b1 --- /dev/null +++ b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2009 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 "WebPagePopup.h" + +namespace WebKit { + +// WebPagePopupImpl ---------------------------------------------------------------- + +// FIXME: WebPagePopupImpl implementation will be written here. + +// WebPagePopup ---------------------------------------------------------------- + +WebPagePopup* WebPagePopup::create(WebWidgetClient*) +{ + // FIXME: Returns a WebPagePopupImpl object. + return 0; +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebPageSerializer.cpp b/Source/WebKit/chromium/src/WebPageSerializer.cpp index dc2bc99e3..1ad70b1b4 100644 --- a/Source/WebKit/chromium/src/WebPageSerializer.cpp +++ b/Source/WebKit/chromium/src/WebPageSerializer.cpp @@ -127,7 +127,7 @@ void retrieveResourcesForElement(Element* element, // Ignore URLs that have a non-standard protocols. Since the FTP protocol // does no have a cache mechanism, we skip it as well. - if (!url.protocolInHTTPFamily() && !url.isLocalFile()) + if (!url.protocolIsInHTTPFamily() && !url.isLocalFile()) return; if (!resourceURLs->contains(url)) diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp index 10c3e2e4b..a71703b15 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -370,8 +370,8 @@ void WebPluginContainerImpl::setBackingIOSurfaceId(int width, void WebPluginContainerImpl::commitBackingTexture() { #if USE(ACCELERATED_COMPOSITING) - if (m_platformLayer.get()) - m_platformLayer->invalidateRect(FloatRect(FloatPoint(), m_platformLayer->bounds())); + if (m_platformLayer) + m_platformLayer->setNeedsDisplay(); #endif } @@ -435,6 +435,14 @@ void WebPluginContainerImpl::zoomLevelChanged(double zoomLevel) view->fullFramePluginZoomLevelChanged(zoomLevel); } +void WebPluginContainerImpl::setOpaque(bool opaque) +{ +#if USE(ACCELERATED_COMPOSITING) + if (m_platformLayer) + m_platformLayer->setOpaque(opaque); +#endif +} + bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect) { Page* page = m_element->document()->page(); diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.h b/Source/WebKit/chromium/src/WebPluginContainerImpl.h index 898130084..9d970f2f8 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.h +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.h @@ -104,6 +104,7 @@ public: virtual WebString executeScriptURL(const WebURL&, bool popupsAllowed); virtual void loadFrameRequest(const WebURLRequest&, const WebString& target, bool notifyNeeded, void* notifyData); virtual void zoomLevelChanged(double zoomLevel); + virtual void setOpaque(bool); virtual bool isRectTopmost(const WebRect&); // This cannot be null. diff --git a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp index f1960eb31..d297a828c 100644 --- a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp +++ b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp @@ -34,7 +34,7 @@ #include "AbstractDatabase.h" #include "RuntimeEnabledFeatures.h" #include "WebMediaPlayerClientImpl.h" -#include "websockets/WebSocket.h" +#include "Modules/websockets/WebSocket.h" #include <wtf/UnusedParam.h> @@ -260,6 +260,22 @@ bool WebRuntimeFeatures::isSpeechInputEnabled() return RuntimeEnabledFeatures::speechInputEnabled(); } +void WebRuntimeFeatures::enableScriptedSpeech(bool enable) +{ +#if ENABLE(SCRIPTED_SPEECH) + RuntimeEnabledFeatures::setScriptedSpeechEnabled(enable); +#endif +} + +bool WebRuntimeFeatures::isScriptedSpeechEnabled() +{ +#if ENABLE(SCRIPTED_SPEECH) + return RuntimeEnabledFeatures::scriptedSpeechEnabled(); +#else + return false; +#endif +} + void WebRuntimeFeatures::enableXHRResponseBlob(bool enable) { #if ENABLE(XHR_RESPONSE_BLOB) diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp index 485a5b051..3b3a84f98 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp @@ -109,6 +109,11 @@ void WebSettingsImpl::setMinimumLogicalFontSize(int size) m_settings->setMinimumLogicalFontSize(size); } +void WebSettingsImpl::setDefaultDeviceScaleFactor(int defaultDeviceScaleFactor) +{ + m_settings->setDefaultDeviceScaleFactor(defaultDeviceScaleFactor); +} + void WebSettingsImpl::setDefaultTextEncodingName(const WebString& encoding) { m_settings->setDefaultTextEncodingName((String)encoding); diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index 51d9323a4..7024b5164 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -54,6 +54,7 @@ public: virtual void setDefaultFixedFontSize(int); virtual void setMinimumFontSize(int); virtual void setMinimumLogicalFontSize(int); + virtual void setDefaultDeviceScaleFactor(int); virtual void setDefaultTextEncodingName(const WebString&); virtual void setJavaScriptEnabled(bool); virtual void setWebSecurityEnabled(bool); diff --git a/Source/WebKit/chromium/src/WebSocketImpl.cpp b/Source/WebKit/chromium/src/WebSocketImpl.cpp index f0bf28206..30a6033d3 100644 --- a/Source/WebKit/chromium/src/WebSocketImpl.cpp +++ b/Source/WebKit/chromium/src/WebSocketImpl.cpp @@ -105,10 +105,19 @@ WebString WebSocketImpl::subprotocol() #endif } +WebString WebSocketImpl::extensions() +{ +#if ENABLE(WEB_SOCKETS) + return m_private->extensions(); +#else + ASSERT_NOT_REACHED(); +#endif +} + bool WebSocketImpl::sendText(const WebString& message) { #if ENABLE(WEB_SOCKETS) - return m_private->send(message); + return m_private->send(message) == ThreadableWebSocketChannel::SendSuccess; #else ASSERT_NOT_REACHED(); #endif @@ -117,7 +126,7 @@ bool WebSocketImpl::sendText(const WebString& message) bool WebSocketImpl::sendArrayBuffer(const WebArrayBuffer& webArrayBuffer) { #if ENABLE(WEB_SOCKETS) - return m_private->send(*PassRefPtr<ArrayBuffer>(webArrayBuffer)); + return m_private->send(*PassRefPtr<ArrayBuffer>(webArrayBuffer)) == ThreadableWebSocketChannel::SendSuccess; #else ASSERT_NOT_REACHED(); #endif diff --git a/Source/WebKit/chromium/src/WebSocketImpl.h b/Source/WebKit/chromium/src/WebSocketImpl.h index 3d42bd506..ef14b18c7 100644 --- a/Source/WebKit/chromium/src/WebSocketImpl.h +++ b/Source/WebKit/chromium/src/WebSocketImpl.h @@ -53,25 +53,26 @@ public: bool isNull() const { return !m_private; } - BinaryType binaryType() const; - virtual bool setBinaryType(BinaryType); - virtual void connect(const WebURL&, const WebString& protocol); - virtual WebString subprotocol(); - virtual bool sendText(const WebString&); - virtual bool sendArrayBuffer(const WebArrayBuffer&); - virtual unsigned long bufferedAmount() const; - virtual void close(int code, const WebString& reason); - virtual void fail(const WebString& reason); - virtual void disconnect(); + virtual BinaryType binaryType() const OVERRIDE; + virtual bool setBinaryType(BinaryType) OVERRIDE; + virtual void connect(const WebURL&, const WebString& protocol) OVERRIDE; + virtual WebString subprotocol() OVERRIDE; + virtual WebString extensions() OVERRIDE; + virtual bool sendText(const WebString&) OVERRIDE; + virtual bool sendArrayBuffer(const WebArrayBuffer&) OVERRIDE; + virtual unsigned long bufferedAmount() const OVERRIDE; + virtual void close(int code, const WebString& reason) OVERRIDE; + virtual void fail(const WebString& reason) OVERRIDE; + virtual void disconnect() OVERRIDE; // WebSocketChannelClient - virtual void didConnect(); - virtual void didReceiveMessage(const String& message); - virtual void didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData); - virtual void didReceiveMessageError(); - virtual void didUpdateBufferedAmount(unsigned long bufferedAmount); - virtual void didStartClosingHandshake(); - virtual void didClose(unsigned long bufferedAmount, ClosingHandshakeCompletionStatus, unsigned short code, const String& reason); + virtual void didConnect() OVERRIDE; + virtual void didReceiveMessage(const String& message) OVERRIDE; + virtual void didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData) OVERRIDE; + virtual void didReceiveMessageError() OVERRIDE; + virtual void didUpdateBufferedAmount(unsigned long bufferedAmount) OVERRIDE; + virtual void didStartClosingHandshake() OVERRIDE; + virtual void didClose(unsigned long bufferedAmount, ClosingHandshakeCompletionStatus, unsigned short code, const String& reason) OVERRIDE; private: RefPtr<WebCore::WebSocketChannel> m_private; diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index 55a2052a4..52a022ce9 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -34,6 +34,7 @@ #include "AutofillPopupMenuClient.h" #include "AXObjectCache.h" #include "BackForwardListChromium.h" +#include "cc/CCProxy.h" #include "CSSStyleSelector.h" #include "CSSValueKeywords.h" #include "Chrome.h" @@ -73,6 +74,7 @@ #include "Image.h" #include "ImageBuffer.h" #include "InspectorController.h" +#include "InspectorInstrumentation.h" #include "KeyboardCodes.h" #include "KeyboardEvent.h" #include "LayerChromium.h" @@ -102,6 +104,7 @@ #include "SecurityOrigin.h" #include "SecurityPolicy.h" #include "Settings.h" +#include "SharedGraphicsContext3D.h" #include "SpeechInputClientImpl.h" #include "TextIterator.h" #include "Timer.h" @@ -123,6 +126,8 @@ #include "WebInputEventConversion.h" #include "WebKit.h" #include "platform/WebKitPlatformSupport.h" +#include "platform/WebLayer.h" +#include "platform/WebLayerTreeView.h" #include "WebMediaPlayerAction.h" #include "WebNode.h" #include "WebPlugin.h" @@ -137,7 +142,6 @@ #include "platform/WebString.h" #include "platform/WebVector.h" #include "WebViewClient.h" -#include "cc/CCProxy.h" #include <wtf/ByteArray.h> #include <wtf/CurrentTime.h> #include <wtf/MainThread.h> @@ -168,27 +172,6 @@ using namespace WebCore; using namespace std; -namespace { - -WebKit::WebGraphicsContext3D::Attributes getCompositorContextAttributes(bool threaded) -{ - // Explicitly disable antialiasing for the compositor. As of the time of - // this writing, the only platform that supported antialiasing for the - // compositor was Mac OS X, because the on-screen OpenGL context creation - // code paths on Windows and Linux didn't yet have multisampling support. - // Mac OS X essentially always behaves as though it's rendering offscreen. - // Multisampling has a heavy cost especially on devices with relatively low - // fill rate like most notebooks, and the Mac implementation would need to - // be optimized to resolve directly into the IOSurface shared between the - // GPU and browser processes. For these reasons and to avoid platform - // disparities we explicitly disable antialiasing. - WebKit::WebGraphicsContext3D::Attributes attributes; - attributes.antialias = false; - attributes.shareResources = true; - attributes.forUseOnAnotherThread = threaded; - return attributes; -} - // The following constants control parameters for automated scaling of webpages // (such as due to a double tap gesture or find in page etc.). These are // experimentally determined. @@ -197,8 +180,6 @@ static const float minScaleDifference = 0.01; static const float doubleTapZoomContentDefaultMargin = 5; static const float doubleTapZoomContentMinimumMargin = 2; -} // anonymous namespace - namespace WebKit { // Change the text zoom level by kTextSizeMultiplierRatio each time the user @@ -525,7 +506,7 @@ void WebViewImpl::mouseDown(const WebMouseEvent& event) || (event.button == WebMouseEvent::ButtonLeft && event.modifiers & WebMouseEvent::ControlKey)) mouseContextMenu(event); -#elif OS(UNIX) +#elif OS(UNIX) || OS(ANDROID) if (event.button == WebMouseEvent::ButtonRight) mouseContextMenu(event); #endif @@ -627,8 +608,8 @@ bool WebViewImpl::gestureEvent(const WebGestureEvent& event) void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor, float newScale, double durationSec) { - if (m_layerTreeHost) - m_layerTreeHost->startPageScaleAnimation(IntSize(scroll.x(), scroll.y()), useAnchor, newScale, durationSec); + if (!m_layerTreeView.isNull()) + m_layerTreeView.startPageScaleAnimation(scroll, useAnchor, newScale, durationSec); } #endif @@ -1264,6 +1245,11 @@ void WebViewImpl::didExitFullScreen() #endif } +void WebViewImpl::instrumentBeginFrame() +{ + InspectorInstrumentation::didBeginFrame(m_page.get()); +} + void WebViewImpl::animate(double frameBeginTime) { #if ENABLE(REQUEST_ANIMATION_FRAME) @@ -1276,7 +1262,7 @@ void WebViewImpl::animate(double frameBeginTime) // In composited mode, we always go through the compositor so it can apply // appropriate flow-control mechanisms. if (isAcceleratedCompositingActive()) - m_layerTreeHost->updateAnimations(frameBeginTime); + m_layerTreeView.updateAnimations(frameBeginTime); else #endif updateAnimations(frameBeginTime); @@ -1324,6 +1310,7 @@ void WebViewImpl::layout() #if USE(ACCELERATED_COMPOSITING) void WebViewImpl::doPixelReadbackToCanvas(WebCanvas* canvas, const IntRect& rect) { + ASSERT(!m_layerTreeView.isNull()); #if USE(SKIA) PlatformContextSkia context(canvas); @@ -1342,7 +1329,7 @@ void WebViewImpl::doPixelReadbackToCanvas(WebCanvas* canvas, const IntRect& rect OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(rect.size())); RefPtr<ByteArray> pixelArray(ByteArray::create(rect.width() * rect.height() * 4)); if (imageBuffer && pixelArray) { - m_layerTreeHost->compositeAndReadback(pixelArray->data(), invertRect); + m_layerTreeView.compositeAndReadback(pixelArray->data(), invertRect); imageBuffer->putByteArray(Premultiplied, pixelArray.get(), rect.size(), IntRect(IntPoint(), rect.size()), IntPoint()); gc.save(); gc.translate(IntSize(0, bitmapHeight)); @@ -1364,7 +1351,7 @@ void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) if (canvas) { // Clip rect to the confines of the rootLayerTexture. IntRect resizeRect(rect); - resizeRect.intersect(IntRect(IntPoint(0, 0), m_layerTreeHost->viewportSize())); + resizeRect.intersect(IntRect(IntPoint(0, 0), m_layerTreeView.viewportSize())); doPixelReadbackToCanvas(canvas, resizeRect); } #endif @@ -1394,7 +1381,7 @@ void WebViewImpl::composite(bool) { #if USE(ACCELERATED_COMPOSITING) if (CCProxy::hasImplThread()) - m_layerTreeHost->setNeedsRedraw(); + m_layerTreeView.setNeedsRedraw(); else { ASSERT(isAcceleratedCompositingActive()); if (!page()) @@ -1403,7 +1390,7 @@ void WebViewImpl::composite(bool) if (m_pageOverlays) m_pageOverlays->update(); - m_layerTreeHost->composite(); + m_layerTreeView.composite(); } #endif } @@ -1411,16 +1398,16 @@ void WebViewImpl::composite(bool) void WebViewImpl::setNeedsRedraw() { #if USE(ACCELERATED_COMPOSITING) - if (m_layerTreeHost && isAcceleratedCompositingActive()) - m_layerTreeHost->setNeedsRedraw(); + if (!m_layerTreeView.isNull() && isAcceleratedCompositingActive()) + m_layerTreeView.setNeedsRedraw(); #endif } void WebViewImpl::loseCompositorContext(int numTimes) { #if USE(ACCELERATED_COMPOSITING) - if (m_layerTreeHost) - m_layerTreeHost->loseCompositorContext(numTimes); + if (!m_layerTreeView.isNull()) + m_layerTreeView.loseCompositorContext(numTimes); #endif } @@ -2261,15 +2248,27 @@ void WebViewImpl::enableFixedLayoutMode(bool enable) #endif } -void WebViewImpl::enableAutoResizeMode(bool enable, const WebSize& minSize, const WebSize& maxSize) + +void WebViewImpl::enableAutoResizeMode(const WebSize& minSize, const WebSize& maxSize) { - m_shouldAutoResize = enable; + m_shouldAutoResize = true; m_minAutoSize = minSize; m_maxAutoSize = maxSize; - if (!mainFrameImpl() || !mainFrameImpl()->frame() || !mainFrameImpl()->frame()->view()) - return; + configureAutoResizeMode(); +} - mainFrameImpl()->frame()->view()->enableAutoSizeMode(m_shouldAutoResize, m_minAutoSize, m_maxAutoSize); +void WebViewImpl::disableAutoResizeMode() +{ + m_shouldAutoResize = false; + configureAutoResizeMode(); +} + +void WebViewImpl::enableAutoResizeMode(bool enable, const WebSize& minSize, const WebSize& maxSize) +{ + if (enable) + enableAutoResizeMode(minSize, maxSize); + else + disableAutoResizeMode(); } void WebViewImpl::setPageScaleFactorLimits(float minPageScale, float maxPageScale) @@ -2302,8 +2301,8 @@ bool WebViewImpl::computePageScaleFactorLimits() float clampedScale = clampPageScaleFactorToLimits(pageScaleFactor()); #if USE(ACCELERATED_COMPOSITING) - if (m_layerTreeHost) - m_layerTreeHost->setPageScaleFactorAndLimits(clampedScale, m_minimumPageScaleFactor, m_maximumPageScaleFactor); + if (!m_layerTreeView.isNull()) + m_layerTreeView.setPageScaleFactorAndLimits(clampedScale, m_minimumPageScaleFactor, m_maximumPageScaleFactor); #endif if (clampedScale != pageScaleFactor()) { setPageScaleFactorPreservingScrollOffset(clampedScale); @@ -2582,6 +2581,14 @@ void WebViewImpl::sendResizeEventAndRepaint() } } +void WebViewImpl::configureAutoResizeMode() +{ + if (!mainFrameImpl() || !mainFrameImpl()->frame() || !mainFrameImpl()->frame()->view()) + return; + + mainFrameImpl()->frame()->view()->enableAutoSizeMode(m_shouldAutoResize, m_minAutoSize, m_maxAutoSize); +} + unsigned long WebViewImpl::createUniqueIdentifierForRequest() { if (m_page) @@ -2929,17 +2936,12 @@ void WebViewImpl::addPageOverlay(WebPageOverlay* overlay, int zOrder) m_pageOverlays = PageOverlayList::create(this); m_pageOverlays->add(overlay, zOrder); - setRootLayerNeedsDisplay(); } void WebViewImpl::removePageOverlay(WebPageOverlay* overlay) { - if (m_pageOverlays && m_pageOverlays->remove(overlay)) { - setRootLayerNeedsDisplay(); - - if (m_pageOverlays->empty()) - m_pageOverlays = nullptr; - } + if (m_pageOverlays && m_pageOverlays->remove(overlay) && m_pageOverlays->empty()) + m_pageOverlays = nullptr; } void WebViewImpl::setOverlayLayer(WebCore::GraphicsLayer* layer) @@ -3047,29 +3049,31 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) } m_nonCompositedContentHost->setScrollLayer(scrollLayer); } - if (m_layerTreeHost) - m_layerTreeHost->setRootLayer(layer ? layer->platformLayer() : 0); + + if (layer) + m_rootLayer = WebLayer(layer->platformLayer()); + + if (!m_layerTreeView.isNull()) + m_layerTreeView.setRootLayer(layer ? &m_rootLayer : 0); IntRect damagedRect(0, 0, m_size.width, m_size.height); if (!m_isAcceleratedCompositingActive) m_client->didInvalidateRect(damagedRect); } -void WebViewImpl::setRootLayerNeedsDisplay() +void WebViewImpl::scheduleCompositingLayerSync() { - if (m_layerTreeHost) - m_layerTreeHost->setNeedsCommit(); + m_layerTreeView.setNeedsRedraw(); } -void WebViewImpl::scrollRootLayerRect(const IntSize& scrollDelta, const IntRect& clipRect) +void WebViewImpl::scrollRootLayerRect(const IntSize&, const IntRect&) { updateLayerTreeViewport(); - setRootLayerNeedsDisplay(); } void WebViewImpl::invalidateRootLayerRect(const IntRect& rect) { - ASSERT(m_layerTreeHost); + ASSERT(!m_layerTreeView.isNull()); if (!page()) return; @@ -3078,7 +3082,6 @@ void WebViewImpl::invalidateRootLayerRect(const IntRect& rect) IntRect dirtyRect = view->windowToContents(rect); updateLayerTreeViewport(); m_nonCompositedContentHost->invalidateRect(dirtyRect); - setRootLayerNeedsDisplay(); } NonCompositedContentHost* WebViewImpl::nonCompositedContentHost() @@ -3091,8 +3094,8 @@ void WebViewImpl::scheduleAnimation() { if (isAcceleratedCompositingActive()) { if (CCProxy::hasImplThread()) { - ASSERT(m_layerTreeHost); - m_layerTreeHost->setNeedsAnimate(); + ASSERT(!m_layerTreeView.isNull()); + m_layerTreeView.setNeedsAnimate(); } else m_client->scheduleAnimation(); } else @@ -3145,26 +3148,26 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) m_isAcceleratedCompositingActive = false; // We need to finish all GL rendering before sending didDeactivateCompositor() to prevent // flickering when compositing turns off. - if (m_layerTreeHost) - m_layerTreeHost->finishAllRendering(); + if (!m_layerTreeView.isNull()) + m_layerTreeView.finishAllRendering(); m_client->didDeactivateCompositor(); - } else if (m_layerTreeHost) { + } else if (!m_layerTreeView.isNull()) { m_isAcceleratedCompositingActive = true; updateLayerTreeViewport(); - m_client->didActivateCompositor(m_layerTreeHost->compositorIdentifier()); + m_client->didActivateCompositor(m_layerTreeView.compositorIdentifier()); } else { TRACE_EVENT("WebViewImpl::setIsAcceleratedCompositingActive(true)", this, 0); - WebCore::CCSettings ccSettings; - ccSettings.acceleratePainting = page()->settings()->acceleratedDrawingEnabled(); - ccSettings.compositeOffscreen = settings()->compositeToTextureEnabled(); - ccSettings.showFPSCounter = settings()->showFPSCounter(); - ccSettings.showPlatformLayerTree = settings()->showPlatformLayerTree(); + WebLayerTreeView::Settings layerTreeViewSettings; + layerTreeViewSettings.acceleratePainting = page()->settings()->acceleratedDrawingEnabled(); + layerTreeViewSettings.compositeOffscreen = settings()->compositeToTextureEnabled(); + layerTreeViewSettings.showFPSCounter = settings()->showFPSCounter(); + layerTreeViewSettings.showPlatformLayerTree = settings()->showPlatformLayerTree(); - ccSettings.perTilePainting = page()->settings()->perTileDrawingEnabled(); - ccSettings.partialSwapEnabled = page()->settings()->partialSwapEnabled(); - ccSettings.threadedAnimationEnabled = page()->settings()->threadedAnimationEnabled(); + layerTreeViewSettings.perTilePainting = page()->settings()->perTileDrawingEnabled(); + layerTreeViewSettings.partialSwapEnabled = page()->settings()->partialSwapEnabled(); + layerTreeViewSettings.threadedAnimationEnabled = page()->settings()->threadedAnimationEnabled(); m_nonCompositedContentHost = NonCompositedContentHost::create(WebViewImplContentPainter::create(this)); m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->showDebugBorders()); @@ -3172,17 +3175,16 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) if (page() && page()->mainFrame()->view()) m_nonCompositedContentHost->setBackgroundColor(page()->mainFrame()->view()->documentBackgroundColor()); - m_layerTreeHost = CCLayerTreeHost::create(this, ccSettings); - if (m_layerTreeHost) { - m_layerTreeHost->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor); + m_layerTreeView.initialize(this, m_rootLayer, layerTreeViewSettings); + if (!m_layerTreeView.isNull()) { + m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor); updateLayerTreeViewport(); - m_client->didActivateCompositor(m_layerTreeHost->compositorIdentifier()); + m_client->didActivateCompositor(m_layerTreeView.compositorIdentifier()); m_isAcceleratedCompositingActive = true; m_compositorCreationFailed = false; if (m_pageOverlays) m_pageOverlays->update(); } else { - m_layerTreeHost.clear(); m_nonCompositedContentHost.clear(); m_isAcceleratedCompositingActive = false; m_client->didDeactivateCompositor(); @@ -3195,29 +3197,44 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) #endif -PassRefPtr<GraphicsContext3D> WebViewImpl::createCompositorGraphicsContext3D() +PassOwnPtr<WebKit::WebGraphicsContext3D> WebViewImpl::createCompositorGraphicsContext3D() { - WebKit::WebGraphicsContext3D::Attributes attributes = getCompositorContextAttributes(CCProxy::hasImplThread()); - OwnPtr<WebGraphicsContext3D> webContext = adoptPtr(client()->createGraphicsContext3D(attributes, true /* renderDirectlyToHostWindow */)); + // Explicitly disable antialiasing for the compositor. As of the time of + // this writing, the only platform that supported antialiasing for the + // compositor was Mac OS X, because the on-screen OpenGL context creation + // code paths on Windows and Linux didn't yet have multisampling support. + // Mac OS X essentially always behaves as though it's rendering offscreen. + // Multisampling has a heavy cost especially on devices with relatively low + // fill rate like most notebooks, and the Mac implementation would need to + // be optimized to resolve directly into the IOSurface shared between the + // GPU and browser processes. For these reasons and to avoid platform + // disparities we explicitly disable antialiasing. + WebKit::WebGraphicsContext3D::Attributes attributes; + attributes.antialias = false; + attributes.shareResources = true; + + OwnPtr<WebGraphicsContext3D> webContext = adoptPtr(client()->createGraphicsContext3D(attributes)); if (!webContext) - return 0; + return nullptr; - return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow); + return webContext.release(); } -PassRefPtr<GraphicsContext3D> WebViewImpl::createLayerTreeHostContext3D() +WebKit::WebGraphicsContext3D* WebViewImpl::createContext3D() { - RefPtr<GraphicsContext3D> context; + OwnPtr<WebKit::WebGraphicsContext3D> webContext; // If we've already created an onscreen context for this view, return that. if (m_temporaryOnscreenGraphicsContext3D) - context = m_temporaryOnscreenGraphicsContext3D.release(); + webContext = m_temporaryOnscreenGraphicsContext3D.release(); else // Otherwise make a new one. - context = createCompositorGraphicsContext3D(); - return context; + webContext = createCompositorGraphicsContext3D(); + // The caller takes ownership of this object, but since there's no equivalent of PassOwnPtr<> in the WebKit API + // we return a raw pointer. + return webContext.leakPtr(); } -void WebViewImpl::applyScrollAndScale(const IntSize& scrollDelta, float pageScaleDelta) +void WebViewImpl::applyScrollAndScale(const WebSize& scrollDelta, float pageScaleDelta) { if (!mainFrameImpl() || !mainFrameImpl()->frameView()) return; @@ -3230,8 +3247,8 @@ void WebViewImpl::applyScrollAndScale(const IntSize& scrollDelta, float pageScal // in the old coordinate space, so we first need to multiply them // by the page scale delta. WebSize scrollOffset = mainFrame()->scrollOffset(); - scrollOffset.width += scrollDelta.width(); - scrollOffset.height += scrollDelta.height(); + scrollOffset.width += scrollDelta.width; + scrollOffset.height += scrollDelta.height; WebPoint scaledScrollOffset(scrollOffset.width * pageScaleDelta, scrollOffset.height * pageScaleDelta); setPageScaleFactor(pageScaleFactor() * pageScaleDelta, scaledScrollOffset); @@ -3250,7 +3267,7 @@ void WebViewImpl::didCompleteSwapBuffers() m_client->didCompleteSwapBuffers(); } -void WebViewImpl::didRecreateGraphicsContext(bool success) +void WebViewImpl::didRebindGraphicsContext(bool success) { // Switch back to software rendering mode, if necessary @@ -3277,7 +3294,7 @@ void WebViewImpl::scheduleComposite() void WebViewImpl::updateLayerTreeViewport() { - if (!page() || !m_nonCompositedContentHost || !m_layerTreeHost) + if (!page() || !m_nonCompositedContentHost || m_layerTreeView.isNull()) return; FrameView* view = page()->mainFrame()->view(); @@ -3293,18 +3310,18 @@ void WebViewImpl::updateLayerTreeViewport() layerAdjustX = -view->contentsSize().width() + view->visibleContentRect(false).width(); } m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll, pageScaleFactor(), layerAdjustX); - m_layerTreeHost->setViewportSize(visibleRect.size()); - m_layerTreeHost->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor); + m_layerTreeView.setViewportSize(visibleRect.size()); + m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor); } WebGraphicsContext3D* WebViewImpl::graphicsContext3D() { #if USE(ACCELERATED_COMPOSITING) if (m_page->settings()->acceleratedCompositingEnabled() && allowsAcceleratedCompositing()) { - if (m_layerTreeHost) { - WebGraphicsContext3D* webContext = GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_layerTreeHost->context()); - if (webContext && !webContext->isContextLost()) - return webContext; + if (!m_layerTreeView.isNull()) { + WebGraphicsContext3D* context = m_layerTreeView.context(); + if (context && !context->isContextLost()) + return context; } // If we get here it means that some system needs access to the context the compositor will use but the compositor itself // hasn't requested a context or it was unable to successfully instantiate a context. @@ -3313,7 +3330,7 @@ WebGraphicsContext3D* WebViewImpl::graphicsContext3D() if (!m_temporaryOnscreenGraphicsContext3D) m_temporaryOnscreenGraphicsContext3D = createCompositorGraphicsContext3D(); - WebGraphicsContext3D* webContext = GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_temporaryOnscreenGraphicsContext3D.get()); + WebGraphicsContext3D* webContext = m_temporaryOnscreenGraphicsContext3D.get(); if (webContext && !webContext->isContextLost()) return webContext; } @@ -3321,6 +3338,14 @@ WebGraphicsContext3D* WebViewImpl::graphicsContext3D() return 0; } +WebGraphicsContext3D* WebViewImpl::sharedGraphicsContext3D() +{ + if (!m_page->settings()->acceleratedCompositingEnabled() || !allowsAcceleratedCompositing()) + return 0; + + return GraphicsContext3DPrivate::extractWebGraphicsContext3D(SharedGraphicsContext3D::get()); +} + void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, bool isInitialState) { if (!page()) @@ -3338,7 +3363,7 @@ void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, bool visible = visibilityState == WebPageVisibilityStateVisible; if (!visible) m_nonCompositedContentHost->protectVisibleTileTextures(); - m_layerTreeHost->setVisible(visible); + m_layerTreeView.setVisible(visible); } #endif } diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index bc7a53d04..3819ecb65 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -32,6 +32,9 @@ #define WebViewImpl_h #include "WebNavigationPolicy.h" +#include "platform/WebLayer.h" +#include "platform/WebLayerTreeView.h" +#include "platform/WebLayerTreeViewClient.h" #include "platform/WebPoint.h" #include "platform/WebRect.h" #include "platform/WebSize.h" @@ -50,7 +53,6 @@ #include "NotificationPresenterImpl.h" #include "PageOverlayList.h" #include "UserMediaClientImpl.h" -#include "cc/CCLayerTreeHost.h" #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> @@ -94,7 +96,7 @@ class WebMouseWheelEvent; class WebSettingsImpl; class WebTouchEvent; -class WebViewImpl : public WebView, public WebCore::CCLayerTreeHostClient, public RefCounted<WebViewImpl> { +class WebViewImpl : public WebView, public WebLayerTreeViewClient, public RefCounted<WebViewImpl> { public: enum AutoZoomType { DoubleTap, @@ -137,6 +139,7 @@ public: virtual void didNotAcquirePointerLock(); virtual void didLosePointerLock(); virtual void didChangeWindowResizerRect(); + virtual void instrumentBeginFrame(); // WebView methods: virtual void initializeMainFrame(WebFrameClient*); @@ -186,6 +189,10 @@ public: virtual WebSize fixedLayoutSize() const; virtual void setFixedLayoutSize(const WebSize&); virtual void enableAutoResizeMode( + const WebSize& minSize, + const WebSize& maxSize); + virtual void disableAutoResizeMode(); + virtual void enableAutoResizeMode( bool enable, const WebSize& minSize, const WebSize& maxSize); @@ -246,13 +253,13 @@ public: virtual void addPageOverlay(WebPageOverlay*, int /* zOrder */); virtual void removePageOverlay(WebPageOverlay*); - // CCLayerTreeHostClient + // WebLayerTreeViewClient virtual void updateAnimations(double frameBeginTime); - virtual void applyScrollAndScale(const WebCore::IntSize&, float); - virtual PassRefPtr<WebCore::GraphicsContext3D> createLayerTreeHostContext3D(); + virtual void applyScrollAndScale(const WebSize&, float); + virtual WebGraphicsContext3D* createContext3D(); + virtual void didRebindGraphicsContext(bool); virtual void didCommitAndDrawFrame(); virtual void didCompleteSwapBuffers(); - virtual void didRecreateGraphicsContext(bool success); virtual void scheduleComposite(); // WebViewImpl @@ -434,7 +441,7 @@ public: bool allowsAcceleratedCompositing(); bool pageHasRTLStyle() const; void setRootGraphicsLayer(WebCore::GraphicsLayer*); - void setRootLayerNeedsDisplay(); + void scheduleCompositingLayerSync(); void scrollRootLayerRect(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& clipRect); void invalidateRootLayerRect(const WebCore::IntRect&); NonCompositedContentHost* nonCompositedContentHost(); @@ -450,7 +457,9 @@ public: // we could not successfully instantiate a context. virtual WebGraphicsContext3D* graphicsContext3D(); - PassRefPtr<WebCore::GraphicsContext3D> createCompositorGraphicsContext3D(); + virtual WebGraphicsContext3D* sharedGraphicsContext3D(); + + PassOwnPtr<WebGraphicsContext3D> createCompositorGraphicsContext3D(); virtual void setVisibilityState(WebPageVisibilityState, bool); @@ -532,6 +541,7 @@ private: DragAction); void sendResizeEventAndRepaint(); + void configureAutoResizeMode(); #if USE(ACCELERATED_COMPOSITING) void setIsAcceleratedCompositingActive(bool); @@ -688,7 +698,8 @@ private: #if USE(ACCELERATED_COMPOSITING) WebCore::IntRect m_rootLayerScrollDamage; OwnPtr<NonCompositedContentHost> m_nonCompositedContentHost; - RefPtr<WebCore::CCLayerTreeHost> m_layerTreeHost; + WebLayerTreeView m_layerTreeView; + WebLayer m_rootLayer; WebCore::GraphicsLayer* m_rootGraphicsLayer; bool m_isAcceleratedCompositingActive; bool m_compositorCreationFailed; @@ -703,7 +714,7 @@ private: // If we attempt to fetch the on-screen GraphicsContext3D before // the compositor has been turned on, we need to instantiate it // early. This member holds on to the GC3D in this case. - RefPtr<WebCore::GraphicsContext3D> m_temporaryOnscreenGraphicsContext3D; + OwnPtr<WebGraphicsContext3D> m_temporaryOnscreenGraphicsContext3D; OwnPtr<DeviceOrientationClientProxy> m_deviceOrientationClientProxy; OwnPtr<GeolocationClientProxy> m_geolocationClientProxy; diff --git a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp index 1db2d1dd9..a69f01a5f 100644 --- a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp @@ -214,6 +214,16 @@ bool WebWorkerClientImpl::allowDatabase(WebFrame*, const WebString& name, const return false; return !webView->permissionClient() || webView->permissionClient()->allowDatabase(m_webFrame, name, displayName, estimatedSize); } + +bool WebWorkerClientImpl::allowIndexedDB(const WebString& name) +{ + if (m_proxy->askedToTerminate()) + return false; + WebKit::WebViewImpl* webView = m_webFrame->viewImpl(); + if (!webView) + return false; + return !webView->permissionClient() || webView->permissionClient()->allowIndexedDB(m_webFrame, name, WebSecurityOrigin()); +} WebView* WebWorkerClientImpl::view() const { diff --git a/Source/WebKit/chromium/src/WebWorkerClientImpl.h b/Source/WebKit/chromium/src/WebWorkerClientImpl.h index 3d5dab0de..d47744c9c 100644 --- a/Source/WebKit/chromium/src/WebWorkerClientImpl.h +++ b/Source/WebKit/chromium/src/WebWorkerClientImpl.h @@ -69,45 +69,46 @@ public: virtual void startWorkerContext(const WebCore::KURL&, const WTF::String&, const WTF::String&, - WebCore::WorkerThreadStartMode); - virtual void terminateWorkerContext(); + WebCore::WorkerThreadStartMode) OVERRIDE; + virtual void terminateWorkerContext() OVERRIDE; virtual void postMessageToWorkerContext( PassRefPtr<WebCore::SerializedScriptValue> message, - PassOwnPtr<WebCore::MessagePortChannelArray> channels); - virtual bool hasPendingActivity() const; - virtual void workerObjectDestroyed(); + PassOwnPtr<WebCore::MessagePortChannelArray> channels) OVERRIDE; + virtual bool hasPendingActivity() const OVERRIDE; + virtual void workerObjectDestroyed() OVERRIDE; #if ENABLE(INSPECTOR) - virtual void connectToInspector(WebCore::WorkerContextProxy::PageInspector*); - virtual void disconnectFromInspector(); - virtual void sendMessageToInspector(const String&); - virtual void postMessageToPageInspector(const String&); - virtual void updateInspectorStateCookie(const String&); + virtual void connectToInspector(WebCore::WorkerContextProxy::PageInspector*) OVERRIDE; + virtual void disconnectFromInspector() OVERRIDE; + virtual void sendMessageToInspector(const String&) OVERRIDE; + virtual void postMessageToPageInspector(const String&) OVERRIDE; + virtual void updateInspectorStateCookie(const String&) OVERRIDE; #endif // WebCore::WorkerLoaderProxy methods: - virtual void postTaskToLoader(PassOwnPtr<WebCore::ScriptExecutionContext::Task>); - virtual void postTaskForModeToWorkerContext(PassOwnPtr<WebCore::ScriptExecutionContext::Task>, const String& mode); + virtual void postTaskToLoader(PassOwnPtr<WebCore::ScriptExecutionContext::Task>) OVERRIDE; + virtual void postTaskForModeToWorkerContext(PassOwnPtr<WebCore::ScriptExecutionContext::Task>, const String& mode) OVERRIDE; // WebCore::WorkerObjectProxy methods: - virtual void postMessageToWorkerObject(PassRefPtr<WebCore::SerializedScriptValue>, PassOwnPtr<WebCore::MessagePortChannelArray>); - virtual void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL); + virtual void postMessageToWorkerObject(PassRefPtr<WebCore::SerializedScriptValue>, PassOwnPtr<WebCore::MessagePortChannelArray>) OVERRIDE; + virtual void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL) OVERRIDE; virtual void postConsoleMessageToWorkerObject(WebCore::MessageSource, WebCore::MessageType, WebCore::MessageLevel, - const String& message, int lineNumber, const String& sourceURL); - virtual void confirmMessageFromWorkerObject(bool); - virtual void reportPendingActivity(bool); - virtual void workerContextClosed(); - virtual void workerContextDestroyed(); + const String& message, int lineNumber, const String& sourceURL) OVERRIDE; + virtual void confirmMessageFromWorkerObject(bool) OVERRIDE; + virtual void reportPendingActivity(bool) OVERRIDE; + virtual void workerContextClosed() OVERRIDE; + virtual void workerContextDestroyed() OVERRIDE; // WebWorkerClientBase methods: - virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize); + virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) OVERRIDE; virtual bool allowFileSystem(); virtual void openFileSystem(WebFileSystem::Type, long long size, bool create, - WebFileSystemCallbacks*); + WebFileSystemCallbacks*) OVERRIDE; + virtual bool allowIndexedDB(const WebString& name) OVERRIDE; // WebCommentWorkerBase methods: - virtual WebCommonWorkerClient* commonClient() { return this; } - virtual WebView* view() const; + virtual WebCommonWorkerClient* commonClient() OVERRIDE { return this; } + virtual WebView* view() const OVERRIDE; private: WebWorkerClientImpl(WebCore::Worker*, WebFrameImpl*); diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp index 7fbb1f468..80a26ff03 100644 --- a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp @@ -34,6 +34,7 @@ #if ENABLE(FILE_SYSTEM) && ENABLE(WORKERS) #include "AsyncFileSystemCallbacks.h" +#include "BlobURL.h" #include "FileMetadata.h" #include "FileSystem.h" #include "NotImplemented.h" @@ -208,6 +209,14 @@ void WorkerAsyncFileSystemChromium::createWriter(AsyncFileWriterClient* client, createWorkerFileSystemCallbacksBridge(WorkerFileWriterHelperCallbacks::create(client, pathAsURL, m_webFileSystem, callbacks, m_workerContext))->postReadMetadataToMainThread(m_webFileSystem, pathAsURL, m_modeForCurrentOperation); } +void WorkerAsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + KURL pathAsURL = virtualPathToFileSystemURL(path); + KURL internalBlobURL = BlobURL::createInternalURL(); + + createWorkerFileSystemCallbacksBridge(createSnapshotFileCallback(internalBlobURL, callbacks))->postCreateSnapshotFileToMainThread(m_webFileSystem, internalBlobURL, pathAsURL, m_modeForCurrentOperation); +} + PassRefPtr<WorkerFileSystemCallbacksBridge> WorkerAsyncFileSystemChromium::createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { ASSERT(!m_synchronous || !m_bridgeForCurrentOperation); diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h index c8ae3565f..08918518a 100644 --- a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h +++ b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h @@ -74,6 +74,7 @@ public: virtual void directoryExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); virtual void readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); virtual void createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); private: WorkerAsyncFileSystemChromium(ScriptExecutionContext*, AsyncFileSystem::Type, const WebKit::WebURL& rootURL, bool synchronous); diff --git a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp index b1dad7035..8fd5cfa6d 100644 --- a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp +++ b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp @@ -289,6 +289,15 @@ void WorkerFileSystemCallbacksBridge::postReadDirectoryToMainThread(WebFileSyste this, mode)); } +void WorkerFileSystemCallbacksBridge::postCreateSnapshotFileToMainThread(WebFileSystem* fileSystem, const KURL& internalBlobURL, const KURL& path, const String& mode) +{ + ASSERT(fileSystem); + dispatchTaskToMainThread( + createCallbackTask(&createSnapshotFileOnMainThread, + AllowCrossThreadAccess(fileSystem), + internalBlobURL, path, this, mode)); +} + void WorkerFileSystemCallbacksBridge::openFileSystemOnMainThread(ScriptExecutionContext*, WebCommonWorkerClient* commonClient, WebFileSystem::Type type, long long size, bool create, PassRefPtr<WorkerFileSystemCallbacksBridge> bridge, const String& mode) { if (!commonClient) @@ -348,6 +357,11 @@ void WorkerFileSystemCallbacksBridge::readDirectoryOnMainThread(WebCore::ScriptE fileSystem->readDirectory(path, MainThreadFileSystemCallbacks::createLeakedPtr(bridge, mode)); } +void WorkerFileSystemCallbacksBridge::createSnapshotFileOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem* fileSystem, const KURL& internalBlobURL, const KURL& path, PassRefPtr<WorkerFileSystemCallbacksBridge> bridge, const String& mode) +{ + fileSystem->createSnapshotFileAndReadMetadata(internalBlobURL, path, MainThreadFileSystemCallbacks::createLeakedPtr(bridge, mode)); +} + void WorkerFileSystemCallbacksBridge::didFailOnMainThread(WebFileError error, const String& mode) { mayPostTaskToWorker(createCallbackTask(&didFailOnWorkerThread, this, error), mode); diff --git a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h index 350839cd5..e496de2ef 100644 --- a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h +++ b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h @@ -94,6 +94,7 @@ public: void postFileExistsToMainThread(WebFileSystem*, const WebCore::KURL& path, const String& mode); void postDirectoryExistsToMainThread(WebFileSystem*, const WebCore::KURL& path, const String& mode); void postReadDirectoryToMainThread(WebFileSystem*, const WebCore::KURL& path, const String& mode); + void postCreateSnapshotFileToMainThread(WebFileSystem*, const WebCore::KURL& internalBlobURL, const WebCore::KURL& path, const String& mode); // Callback methods that are called on the main thread. void didFailOnMainThread(WebFileError, const String& mode); @@ -117,6 +118,7 @@ private: static void fileExistsOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem*, const WebCore::KURL& path, PassRefPtr<WorkerFileSystemCallbacksBridge>, const String& mode); static void directoryExistsOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem*, const WebCore::KURL& path, PassRefPtr<WorkerFileSystemCallbacksBridge>, const String& mode); static void readDirectoryOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem*, const WebCore::KURL& path, PassRefPtr<WorkerFileSystemCallbacksBridge>, const String& mode); + static void createSnapshotFileOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem*, const WebCore::KURL& internalBlobURL, const WebCore::KURL& path, PassRefPtr<WorkerFileSystemCallbacksBridge>, const String& mode); friend class MainThreadFileSystemCallbacks; diff --git a/Source/WebKit/chromium/src/js/Images/segmentSelectedEndChromium.png b/Source/WebKit/chromium/src/js/Images/segmentSelectedEndChromium.png Binary files differindex abe8db8ec..425ab5ed2 100644 --- a/Source/WebKit/chromium/src/js/Images/segmentSelectedEndChromium.png +++ b/Source/WebKit/chromium/src/js/Images/segmentSelectedEndChromium.png diff --git a/Source/WebKit/chromium/src/js/Tests.js b/Source/WebKit/chromium/src/js/Tests.js index 16a1ba257..b8dc8de50 100644 --- a/Source/WebKit/chromium/src/js/Tests.js +++ b/Source/WebKit/chromium/src/js/Tests.js @@ -579,6 +579,50 @@ TestSuite.prototype.waitForTestResultsInConsole = function() this.takeControl(); }; +TestSuite.prototype.checkLogAndErrorMessages = function() +{ + var messages = WebInspector.console.messages; + + var matchesCount = 0; + function validMessage(message) + { + if (message.text === "log" && message.level === WebInspector.ConsoleMessage.MessageLevel.Log) { + ++matchesCount; + return true; + } + + if (message.text === "error" && message.level === WebInspector.ConsoleMessage.MessageLevel.Error) { + ++matchesCount; + return true; + } + return false; + } + + for (var i = 0; i < messages.length; ++i) { + if (validMessage(messages[i])) + continue; + this.fail(messages[i].text + ":" + messages[i].level); // This will throw. + } + + if (matchesCount === 2) + return; + + // Wait for more messages. + function onConsoleMessage(event) + { + var message = event.data; + if (validMessage(message)) { + if (matchesCount === 2) { + this.releaseControl(); + return; + } + } else + this.fail(message.text + ":" + messages[i].level); + } + + WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, onConsoleMessage, this); + this.takeControl(); +}; /** * Serializes array of uiSourceCodes to string. diff --git a/Source/WebKit/chromium/src/win/WebInputEventFactory.cpp b/Source/WebKit/chromium/src/win/WebInputEventFactory.cpp index c71a3b6c6..9da4b4a27 100644 --- a/Source/WebKit/chromium/src/win/WebInputEventFactory.cpp +++ b/Source/WebKit/chromium/src/win/WebInputEventFactory.cpp @@ -107,7 +107,9 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(HWND hwnd, UINT message, // caller, who would know for sure. result.timeStampSeconds = GetMessageTime() / 1000.0; - result.windowsKeyCode = result.nativeKeyCode = static_cast<int>(wparam); + result.windowsKeyCode = static_cast<int>(wparam); + // Record the scan code (along with other context bits) for this key event. + result.nativeKeyCode = static_cast<int>(lparam); switch (message) { case WM_SYSKEYDOWN: diff --git a/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp b/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp index 677865ac0..a168ebca9 100644 --- a/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp +++ b/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp @@ -241,7 +241,7 @@ public: m_expectedResponse.setMIMEType("text/html"); m_expectedResponse.addHTTPHeaderField("Access-Control-Allow-Origin", "*"); if (exposed) - m_expectedResponse.addHTTPHeaderField("access-control-expose-header", headerNameString); + m_expectedResponse.addHTTPHeaderField("access-control-expose-headers", headerNameString); m_expectedResponse.addHTTPHeaderField(headerNameString, "foo"); webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath); diff --git a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp index a9f7b1c1a..74d635b40 100644 --- a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp @@ -39,11 +39,11 @@ using namespace WebKitTests; namespace { -void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* root, Vector<RefPtr<CCLayerImpl> >& renderSurfaceLayerList) +void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* root, Vector<CCLayerImpl*>& renderSurfaceLayerList) { CCLayerSorter layerSorter; TransformationMatrix identityMatrix; - Vector<RefPtr<CCLayerImpl> > dummyLayerList; + Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; // Sanity check: The test itself should create the root layer's render surface, so @@ -64,7 +64,7 @@ void emulateDrawingOneFrame(CCLayerImpl* root) // 2. updating all damage trackers in the correct order // 3. resetting all updateRects and propertyChanged flags for all layers and surfaces. - Vector<RefPtr<CCLayerImpl> > renderSurfaceLayerList; + Vector<CCLayerImpl*> renderSurfaceLayerList; executeCalculateDrawTransformsAndVisibility(root, renderSurfaceLayerList); // Iterate back-to-front, so that damage correctly propagates from descendant surfaces to ancestors. @@ -76,10 +76,10 @@ void emulateDrawingOneFrame(CCLayerImpl* root) root->resetAllChangeTrackingForSubtree(); } -PassRefPtr<CCLayerImpl> createTestTreeWithOneSurface() +PassOwnPtr<CCLayerImpl> createTestTreeWithOneSurface() { - RefPtr<CCLayerImpl> root = CCLayerImpl::create(1); - RefPtr<CCLayerImpl> child = CCLayerImpl::create(2); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> child = CCLayerImpl::create(2); root->setPosition(FloatPoint::zero()); root->setAnchorPoint(FloatPoint::zero()); @@ -92,22 +92,22 @@ PassRefPtr<CCLayerImpl> createTestTreeWithOneSurface() child->setAnchorPoint(FloatPoint::zero()); child->setBounds(IntSize(30, 30)); child->setDrawsContent(true); - root->addChild(child); + root->addChild(child.release()); return root.release(); } -PassRefPtr<CCLayerImpl> createTestTreeWithTwoSurfaces() +PassOwnPtr<CCLayerImpl> createTestTreeWithTwoSurfaces() { // This test tree has two render surfaces: one for the root, and one for // child1. Additionally, the root has a second child layer, and child1 has two // children of its own. - RefPtr<CCLayerImpl> root = CCLayerImpl::create(1); - RefPtr<CCLayerImpl> child1 = CCLayerImpl::create(2); - RefPtr<CCLayerImpl> child2 = CCLayerImpl::create(3); - RefPtr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4); - RefPtr<CCLayerImpl> grandChild2 = CCLayerImpl::create(5); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> child1 = CCLayerImpl::create(2); + OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3); + OwnPtr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4); + OwnPtr<CCLayerImpl> grandChild2 = CCLayerImpl::create(5); root->setPosition(FloatPoint::zero()); root->setAnchorPoint(FloatPoint::zero()); @@ -137,17 +137,17 @@ PassRefPtr<CCLayerImpl> createTestTreeWithTwoSurfaces() grandChild2->setBounds(IntSize(6, 8)); grandChild2->setDrawsContent(true); - child1->addChild(grandChild1); - child1->addChild(grandChild2); - root->addChild(child1); - root->addChild(child2); + child1->addChild(grandChild1.release()); + child1->addChild(grandChild2.release()); + root->addChild(child1.release()); + root->addChild(child2.release()); return root.release(); } -PassRefPtr<CCLayerImpl> createAndSetUpTestTreeWithOneSurface() +PassOwnPtr<CCLayerImpl> createAndSetUpTestTreeWithOneSurface() { - RefPtr<CCLayerImpl> root = createTestTreeWithOneSurface(); + OwnPtr<CCLayerImpl> root = createTestTreeWithOneSurface(); // Setup includes going past the first frame which always damages everything, so // that we can actually perform specific tests. @@ -156,9 +156,9 @@ PassRefPtr<CCLayerImpl> createAndSetUpTestTreeWithOneSurface() return root.release(); } -PassRefPtr<CCLayerImpl> createAndSetUpTestTreeWithTwoSurfaces() +PassOwnPtr<CCLayerImpl> createAndSetUpTestTreeWithTwoSurfaces() { - RefPtr<CCLayerImpl> root = createTestTreeWithTwoSurfaces(); + OwnPtr<CCLayerImpl> root = createTestTreeWithTwoSurfaces(); // Setup includes going past the first frame which always damages everything, so // that we can actually perform specific tests. @@ -178,7 +178,7 @@ TEST_F(CCDamageTrackerTest, sanityCheckTestTreeWithOneSurface) // Sanity check that the simple test tree will actually produce the expected render // surfaces and layer lists. - RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); EXPECT_EQ(static_cast<size_t>(2), root->renderSurface()->layerList().size()); EXPECT_EQ(1, root->renderSurface()->layerList()[0]->id()); @@ -193,10 +193,10 @@ TEST_F(CCDamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces) // Sanity check that the complex test tree will actually produce the expected render // surfaces and layer lists. - RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - RefPtr<CCLayerImpl> child1 = root->children()[0]; - RefPtr<CCLayerImpl> child2 = root->children()[1]; + CCLayerImpl* child1 = root->children()[0].get(); + CCLayerImpl* child2 = root->children()[1].get(); FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect(); FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect(); @@ -212,8 +212,8 @@ TEST_F(CCDamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces) TEST_F(CCDamageTrackerTest, verifyDamageForUpdateRects) { - RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - RefPtr<CCLayerImpl> child = root->children()[0]; + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + CCLayerImpl* child = root->children()[0].get(); // CASE 1: Setting the update rect should cause the corresponding damage to the surface. // @@ -243,8 +243,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForUpdateRects) TEST_F(CCDamageTrackerTest, verifyDamageForPropertyChanges) { - RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - RefPtr<CCLayerImpl> child = root->children()[0]; + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + CCLayerImpl* child = root->children()[0].get(); // CASE 1: The layer's property changed flag takes priority over update rect. // @@ -284,8 +284,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForTransformedLayer) // If a layer is transformed, the damage rect should still enclose the entire // transformed layer. - RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - RefPtr<CCLayerImpl> child = root->children()[0]; + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + CCLayerImpl* child = root->children()[0].get(); TransformationMatrix rotation; rotation.rotate(45); @@ -317,18 +317,20 @@ TEST_F(CCDamageTrackerTest, verifyDamageForTransformedLayer) TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingLayer) { - RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - RefPtr<CCLayerImpl> child1 = root->children()[0]; - - RefPtr<CCLayerImpl> child2 = CCLayerImpl::create(3); - child2->setPosition(FloatPoint(400, 380)); - child2->setAnchorPoint(FloatPoint::zero()); - child2->setBounds(IntSize(6, 8)); - child2->setDrawsContent(true); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + CCLayerImpl* child1 = root->children()[0].get(); + + { + OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3); + child2->setPosition(FloatPoint(400, 380)); + child2->setAnchorPoint(FloatPoint::zero()); + child2->setBounds(IntSize(6, 8)); + child2->setDrawsContent(true); + root->addChild(child2.release()); + } // CASE 1: Adding a new layer should cause the appropriate damage. // - root->addChild(child2); emulateDrawingOneFrame(root.get()); // Sanity check - all 3 layers should be on the same render surface; render surfaces are tested elsewhere. @@ -353,15 +355,18 @@ TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingLayer) TEST_F(CCDamageTrackerTest, verifyDamageForMultipleLayers) { - RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - RefPtr<CCLayerImpl> child1 = root->children()[0]; - - RefPtr<CCLayerImpl> child2 = CCLayerImpl::create(3); - child2->setPosition(FloatPoint(400, 380)); - child2->setAnchorPoint(FloatPoint::zero()); - child2->setBounds(IntSize(6, 8)); - child2->setDrawsContent(true); - root->addChild(child2); + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + CCLayerImpl* child1 = root->children()[0].get(); + + { + OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3); + child2->setPosition(FloatPoint(400, 380)); + child2->setAnchorPoint(FloatPoint::zero()); + child2->setBounds(IntSize(6, 8)); + child2->setDrawsContent(true); + root->addChild(child2.release()); + } + CCLayerImpl* child2 = root->children()[1].get(); // In this test we don't want the above tree manipulation to be considered part of the same frame. emulateDrawingOneFrame(root.get()); @@ -378,10 +383,10 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMultipleLayers) TEST_F(CCDamageTrackerTest, verifyDamageForNestedSurfaces) { - RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - RefPtr<CCLayerImpl> child1 = root->children()[0]; - RefPtr<CCLayerImpl> child2 = root->children()[1]; - RefPtr<CCLayerImpl> grandChild1 = root->children()[0]->children()[0]; + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + CCLayerImpl* child1 = root->children()[0].get(); + CCLayerImpl* child2 = root->children()[1].get(); + CCLayerImpl* grandChild1 = root->children()[0]->children()[0].get(); FloatRect childDamageRect; FloatRect rootDamageRect; @@ -415,9 +420,9 @@ TEST_F(CCDamageTrackerTest, verifyDamageForSurfaceChangeFromDescendantLayer) // This is a tricky case, since only the first grandChild changes, but the entire // surface should be marked dirty. - RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - RefPtr<CCLayerImpl> child1 = root->children()[0]; - RefPtr<CCLayerImpl> grandChild1 = root->children()[0]->children()[0]; + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + CCLayerImpl* child1 = root->children()[0].get(); + CCLayerImpl* grandChild1 = root->children()[0]->children()[0].get(); FloatRect childDamageRect; FloatRect rootDamageRect; @@ -447,9 +452,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer) // should be completely unchanged, since we are only transforming it, while the // root surface would be damaged appropriately. - RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - RefPtr<CCLayerImpl> child1 = root->children()[0]; - RefPtr<CCLayerImpl> grandChild1 = root->children()[0]->children()[0]; + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + CCLayerImpl* child1 = root->children()[0].get(); FloatRect childDamageRect; FloatRect rootDamageRect; @@ -469,8 +473,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer) TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces) { - RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - RefPtr<CCLayerImpl> child1 = root->children()[0]; + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + CCLayerImpl* child1 = root->children()[0].get(); FloatRect childDamageRect; FloatRect rootDamageRect; @@ -510,8 +514,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces) TEST_F(CCDamageTrackerTest, verifyNoDamageWhenNothingChanged) { - RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - RefPtr<CCLayerImpl> child1 = root->children()[0]; + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + CCLayerImpl* child1 = root->children()[0].get(); FloatRect childDamageRect; FloatRect rootDamageRect; @@ -534,8 +538,8 @@ TEST_F(CCDamageTrackerTest, verifyNoDamageWhenNothingChanged) TEST_F(CCDamageTrackerTest, verifyNoDamageForUpdateRectThatDoesNotDrawContent) { - RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - RefPtr<CCLayerImpl> child1 = root->children()[0]; + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + CCLayerImpl* child1 = root->children()[0].get(); FloatRect childDamageRect; FloatRect rootDamageRect; @@ -551,10 +555,10 @@ TEST_F(CCDamageTrackerTest, verifyNoDamageForUpdateRectThatDoesNotDrawContent) TEST_F(CCDamageTrackerTest, verifyDamageForReplica) { - RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - RefPtr<CCLayerImpl> child1 = root->children()[0]; - RefPtr<CCLayerImpl> grandChild1 = child1->children()[0]; - RefPtr<CCLayerImpl> grandChild2 = child1->children()[1]; + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + CCLayerImpl* child1 = root->children()[0].get(); + CCLayerImpl* grandChild1 = child1->children()[0].get(); + CCLayerImpl* grandChild2 = child1->children()[1].get(); // Damage on a surface that has a reflection should cause the target surface to // receive the surface's damage and the surface's reflected damage. @@ -563,24 +567,28 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica) // of child1's surface. This way, we can test reflection changes without changing // contentBounds of the surface. grandChild2->setPosition(FloatPoint(180, 180)); - RefPtr<CCLayerImpl> grandChild3 = CCLayerImpl::create(6); - grandChild3->setPosition(FloatPoint(240, 240)); - grandChild3->setAnchorPoint(FloatPoint::zero()); - grandChild3->setBounds(IntSize(10, 10)); - grandChild3->setDrawsContent(true); + { + OwnPtr<CCLayerImpl> grandChild3 = CCLayerImpl::create(6); + grandChild3->setPosition(FloatPoint(240, 240)); + grandChild3->setAnchorPoint(FloatPoint::zero()); + grandChild3->setBounds(IntSize(10, 10)); + grandChild3->setDrawsContent(true); + child1->addChild(grandChild3.release()); + } child1->setOpacity(0.5); - child1->addChild(grandChild3); emulateDrawingOneFrame(root.get()); // CASE 1: adding a reflection about the left edge of grandChild1. // - RefPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(7); - grandChild1Replica->setPosition(FloatPoint::zero()); - grandChild1Replica->setAnchorPoint(FloatPoint::zero()); - TransformationMatrix reflection; - reflection.scale3d(-1.0, 1.0, 1.0); - grandChild1Replica->setTransform(reflection); - grandChild1->setReplicaLayer(grandChild1Replica); + { + OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(7); + grandChild1Replica->setPosition(FloatPoint::zero()); + grandChild1Replica->setAnchorPoint(FloatPoint::zero()); + TransformationMatrix reflection; + reflection.scale3d(-1.0, 1.0, 1.0); + grandChild1Replica->setTransform(reflection); + grandChild1->setReplicaLayer(grandChild1Replica.release()); + } emulateDrawingOneFrame(root.get()); FloatRect grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect(); @@ -614,7 +622,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica) // CASE 3: removing the reflection should cause the entire region including reflection // to damage the target surface. - grandChild1->setReplicaLayer(0); + grandChild1->setReplicaLayer(nullptr); emulateDrawingOneFrame(root.get()); ASSERT_EQ(oldContentRect.width(), child1->renderSurface()->contentRect().width()); ASSERT_EQ(oldContentRect.height(), child1->renderSurface()->contentRect().height()); @@ -629,27 +637,32 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica) TEST_F(CCDamageTrackerTest, verifyDamageForMask) { - RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - RefPtr<CCLayerImpl> child = root->children()[0]; + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + CCLayerImpl* child = root->children()[0].get(); // In the current implementation of the damage tracker, changes to mask layers should // damage the entire corresponding surface. // Set up the mask layer. - RefPtr<CCLayerImpl> maskLayer = CCLayerImpl::create(3); - maskLayer->setPosition(child->position()); - maskLayer->setAnchorPoint(FloatPoint::zero()); - maskLayer->setBounds(child->bounds()); - child->setMaskLayer(maskLayer); + { + OwnPtr<CCLayerImpl> maskLayer = CCLayerImpl::create(3); + maskLayer->setPosition(child->position()); + maskLayer->setAnchorPoint(FloatPoint::zero()); + maskLayer->setBounds(child->bounds()); + child->setMaskLayer(maskLayer.release()); + } + CCLayerImpl* maskLayer = child->maskLayer(); // Add opacity and a grandChild so that the render surface persists even after we remove the mask. child->setOpacity(0.5); - RefPtr<CCLayerImpl> grandChild = CCLayerImpl::create(4); - grandChild->setPosition(FloatPoint(2.0, 2.0)); - grandChild->setAnchorPoint(FloatPoint::zero()); - grandChild->setBounds(IntSize(2, 2)); - grandChild->setDrawsContent(true); - child->addChild(grandChild); + { + OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(4); + grandChild->setPosition(FloatPoint(2.0, 2.0)); + grandChild->setAnchorPoint(FloatPoint::zero()); + grandChild->setBounds(IntSize(2, 2)); + grandChild->setDrawsContent(true); + child->addChild(grandChild.release()); + } emulateDrawingOneFrame(root.get()); // Sanity check that a new surface was created for the child. @@ -685,7 +698,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMask) EXPECT_TRUE(childDamageRect.isEmpty()); // Then test mask removal. - child->setMaskLayer(0); + child->setMaskLayer(nullptr); ASSERT_TRUE(child->layerPropertyChanged()); emulateDrawingOneFrame(root.get()); @@ -698,28 +711,34 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMask) TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) { - RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - RefPtr<CCLayerImpl> child1 = root->children()[0]; - RefPtr<CCLayerImpl> grandChild1 = child1->children()[0]; + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + CCLayerImpl* child1 = root->children()[0].get(); + CCLayerImpl* grandChild1 = child1->children()[0].get(); // Changes to a replica's mask should not damage the original surface, because it is // not masked. But it does damage the ancestor target surface. // Create a reflection about the left edge of grandChild1. - RefPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6); - grandChild1Replica->setPosition(FloatPoint::zero()); - grandChild1Replica->setAnchorPoint(FloatPoint::zero()); - TransformationMatrix reflection; - reflection.scale3d(-1.0, 1.0, 1.0); - grandChild1Replica->setTransform(reflection); - grandChild1->setReplicaLayer(grandChild1Replica); + { + OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6); + grandChild1Replica->setPosition(FloatPoint::zero()); + grandChild1Replica->setAnchorPoint(FloatPoint::zero()); + TransformationMatrix reflection; + reflection.scale3d(-1.0, 1.0, 1.0); + grandChild1Replica->setTransform(reflection); + grandChild1->setReplicaLayer(grandChild1Replica.release()); + } + CCLayerImpl* grandChild1Replica = grandChild1->replicaLayer(); // Set up the mask layer on the replica layer - RefPtr<CCLayerImpl> replicaMaskLayer = CCLayerImpl::create(7); - replicaMaskLayer->setPosition(FloatPoint::zero()); - replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); - replicaMaskLayer->setBounds(grandChild1->bounds()); - grandChild1Replica->setMaskLayer(replicaMaskLayer); + { + OwnPtr<CCLayerImpl> replicaMaskLayer = CCLayerImpl::create(7); + replicaMaskLayer->setPosition(FloatPoint::zero()); + replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); + replicaMaskLayer->setBounds(grandChild1->bounds()); + grandChild1Replica->setMaskLayer(replicaMaskLayer.release()); + } + CCLayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); emulateDrawingOneFrame(root.get()); @@ -738,7 +757,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) // CASE 2: removing the replica mask damages only the reflected region on the target surface. // - grandChild1Replica->setMaskLayer(0); + grandChild1Replica->setMaskLayer(nullptr); emulateDrawingOneFrame(root.get()); grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect(); @@ -750,8 +769,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) TEST_F(CCDamageTrackerTest, verifyDamageWhenReset) { - RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - RefPtr<CCLayerImpl> child = root->children()[0]; + OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + CCLayerImpl* child = root->children()[0].get(); // Case 1: This test ensures that when the tracker is forced to have full damage, that // it takes priority over any other partial damage. diff --git a/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp b/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp index b7732aeab..15b554a06 100644 --- a/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp +++ b/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp @@ -48,9 +48,8 @@ void expectTranslateX(double translateX, const TransformationMatrix& matrix) // Tests that a float animation with one keyframe works as expected. TEST(CCKeyframedAnimationCurveTest, OneFloatKeyframe) { - Vector<CCFloatKeyframe> keyframes; - keyframes.append(CCFloatKeyframe(0, 2)); - OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create(keyframes)); + OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); + curve->addKeyframe(CCFloatKeyframe::create(0, 2, nullptr)); EXPECT_FLOAT_EQ(2, curve->getValue(-1)); EXPECT_FLOAT_EQ(2, curve->getValue(0)); EXPECT_FLOAT_EQ(2, curve->getValue(0.5)); @@ -61,10 +60,9 @@ TEST(CCKeyframedAnimationCurveTest, OneFloatKeyframe) // Tests that a float animation with two keyframes works as expected. TEST(CCKeyframedAnimationCurveTest, TwoFloatKeyframe) { - Vector<CCFloatKeyframe> keyframes; - keyframes.append(CCFloatKeyframe(0, 2)); - keyframes.append(CCFloatKeyframe(1, 4)); - OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create(keyframes)); + OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); + curve->addKeyframe(CCFloatKeyframe::create(0, 2, nullptr)); + curve->addKeyframe(CCFloatKeyframe::create(1, 4, nullptr)); EXPECT_FLOAT_EQ(2, curve->getValue(-1)); EXPECT_FLOAT_EQ(2, curve->getValue(0)); EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); @@ -75,11 +73,10 @@ TEST(CCKeyframedAnimationCurveTest, TwoFloatKeyframe) // Tests that a float animation with three keyframes works as expected. TEST(CCKeyframedAnimationCurveTest, ThreeFloatKeyframe) { - Vector<CCFloatKeyframe> keyframes; - keyframes.append(CCFloatKeyframe(0, 2)); - keyframes.append(CCFloatKeyframe(1, 4)); - keyframes.append(CCFloatKeyframe(2, 8)); - OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create(keyframes)); + OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); + curve->addKeyframe(CCFloatKeyframe::create(0, 2, nullptr)); + curve->addKeyframe(CCFloatKeyframe::create(1, 4, nullptr)); + curve->addKeyframe(CCFloatKeyframe::create(2, 8, nullptr)); EXPECT_FLOAT_EQ(2, curve->getValue(-1)); EXPECT_FLOAT_EQ(2, curve->getValue(0)); EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); @@ -92,13 +89,11 @@ TEST(CCKeyframedAnimationCurveTest, ThreeFloatKeyframe) // Tests that a float animation with multiple keys at a given time works sanely. TEST(CCKeyframedAnimationCurveTest, RepeatedFloatKeyTimes) { - Vector<CCFloatKeyframe> keyframes; - // A step function. - keyframes.append(CCFloatKeyframe(0, 4)); - keyframes.append(CCFloatKeyframe(1, 4)); - keyframes.append(CCFloatKeyframe(1, 6)); - keyframes.append(CCFloatKeyframe(2, 6)); - OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create(keyframes)); + OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); + curve->addKeyframe(CCFloatKeyframe::create(0, 4, nullptr)); + curve->addKeyframe(CCFloatKeyframe::create(1, 4, nullptr)); + curve->addKeyframe(CCFloatKeyframe::create(1, 6, nullptr)); + curve->addKeyframe(CCFloatKeyframe::create(2, 6, nullptr)); EXPECT_FLOAT_EQ(4, curve->getValue(-1)); EXPECT_FLOAT_EQ(4, curve->getValue(0)); @@ -117,11 +112,11 @@ TEST(CCKeyframedAnimationCurveTest, RepeatedFloatKeyTimes) // Tests that a transform animation with one keyframe works as expected. TEST(CCKeyframedAnimationCurveTest, OneTransformKeyframe) { - Vector<CCTransformKeyframe> keyframes; + OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); TransformOperations operations; operations.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); - keyframes.append(CCTransformKeyframe(0, operations)); - OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create(keyframes)); + curve->addKeyframe(CCTransformKeyframe::create(0, operations, nullptr)); + IntSize layerSize; // ignored expectTranslateX(2, curve->getValue(-1, layerSize)); expectTranslateX(2, curve->getValue(0, layerSize)); @@ -133,14 +128,13 @@ TEST(CCKeyframedAnimationCurveTest, OneTransformKeyframe) // Tests that a transform animation with two keyframes works as expected. TEST(CCKeyframedAnimationCurveTest, TwoTransformKeyframe) { - Vector<CCTransformKeyframe> keyframes; + OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); TransformOperations operations1; operations1.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); TransformOperations operations2; operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); - keyframes.append(CCTransformKeyframe(0, operations1)); - keyframes.append(CCTransformKeyframe(1, operations2)); - OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create(keyframes)); + curve->addKeyframe(CCTransformKeyframe::create(0, operations1, nullptr)); + curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr)); IntSize layerSize; // ignored expectTranslateX(2, curve->getValue(-1, layerSize)); expectTranslateX(2, curve->getValue(0, layerSize)); @@ -152,17 +146,16 @@ TEST(CCKeyframedAnimationCurveTest, TwoTransformKeyframe) // Tests that a transform animation with three keyframes works as expected. TEST(CCKeyframedAnimationCurveTest, ThreeTransformKeyframe) { - Vector<CCTransformKeyframe> keyframes; + OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); TransformOperations operations1; operations1.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); TransformOperations operations2; operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); TransformOperations operations3; operations3.operations().append(TranslateTransformOperation::create(Length(8, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); - keyframes.append(CCTransformKeyframe(0, operations1)); - keyframes.append(CCTransformKeyframe(1, operations2)); - keyframes.append(CCTransformKeyframe(2, operations3)); - OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create(keyframes)); + curve->addKeyframe(CCTransformKeyframe::create(0, operations1, nullptr)); + curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr)); + curve->addKeyframe(CCTransformKeyframe::create(2, operations3, nullptr)); IntSize layerSize; // ignored expectTranslateX(2, curve->getValue(-1, layerSize)); expectTranslateX(2, curve->getValue(0, layerSize)); @@ -176,7 +169,7 @@ TEST(CCKeyframedAnimationCurveTest, ThreeTransformKeyframe) // Tests that a transform animation with multiple keys at a given time works sanely. TEST(CCKeyframedAnimationCurveTest, RepeatedTransformKeyTimes) { - Vector<CCTransformKeyframe> keyframes; + OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); // A step function. TransformOperations operations1; operations1.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); @@ -186,11 +179,10 @@ TEST(CCKeyframedAnimationCurveTest, RepeatedTransformKeyTimes) operations3.operations().append(TranslateTransformOperation::create(Length(6, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); TransformOperations operations4; operations4.operations().append(TranslateTransformOperation::create(Length(6, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); - keyframes.append(CCTransformKeyframe(0, operations1)); - keyframes.append(CCTransformKeyframe(1, operations2)); - keyframes.append(CCTransformKeyframe(1, operations3)); - keyframes.append(CCTransformKeyframe(2, operations4)); - OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create(keyframes)); + curve->addKeyframe(CCTransformKeyframe::create(0, operations1, nullptr)); + curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr)); + curve->addKeyframe(CCTransformKeyframe::create(1, operations3, nullptr)); + curve->addKeyframe(CCTransformKeyframe::create(2, operations4, nullptr)); IntSize layerSize; // ignored @@ -209,33 +201,36 @@ TEST(CCKeyframedAnimationCurveTest, RepeatedTransformKeyTimes) expectTranslateX(6, curve->getValue(3, layerSize)); } -// Tests that invalid lists of keyframes result in nothing being returned from ::create. -TEST(CCKeyframedAnimationCurveTest, InvalidKeyframes) +// Tests that the keyframes may be added out of order. +TEST(CCKeyframedAnimationCurveTest, UnsortedKeyframes) { - // It is invalid to pass an empty vector of keyframes to create. - Vector<CCTransformKeyframe> transformKeyframes; - OwnPtr<CCKeyframedTransformAnimationCurve> transformCurve = CCKeyframedTransformAnimationCurve::create(transformKeyframes); - EXPECT_FALSE(transformCurve.get()); - - Vector<CCFloatKeyframe> floatKeyframes; - OwnPtr<CCKeyframedFloatAnimationCurve> floatCurve = CCKeyframedFloatAnimationCurve::create(floatKeyframes); - EXPECT_FALSE(floatCurve.get()); - - // It is invalid to pass a vector of unsorted keyframes to create; - TransformOperations operations1; - operations1.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); - TransformOperations operations2; - operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); - transformKeyframes.append(CCTransformKeyframe(1, operations1)); - transformKeyframes.append(CCTransformKeyframe(0, operations2)); - transformCurve = CCKeyframedTransformAnimationCurve::create(transformKeyframes); - EXPECT_FALSE(transformCurve.get()); - - floatKeyframes.append(CCFloatKeyframe(1, 2)); - floatKeyframes.append(CCFloatKeyframe(0, 4)); - floatCurve = CCKeyframedFloatAnimationCurve::create(floatKeyframes); - EXPECT_FALSE(floatCurve.get()); + OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); + curve->addKeyframe(CCFloatKeyframe::create(2, 8, nullptr)); + curve->addKeyframe(CCFloatKeyframe::create(0, 2, nullptr)); + curve->addKeyframe(CCFloatKeyframe::create(1, 4, nullptr)); + EXPECT_FLOAT_EQ(2, curve->getValue(-1)); + EXPECT_FLOAT_EQ(2, curve->getValue(0)); + EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); + EXPECT_FLOAT_EQ(4, curve->getValue(1)); + EXPECT_FLOAT_EQ(6, curve->getValue(1.5)); + EXPECT_FLOAT_EQ(8, curve->getValue(2)); + EXPECT_FLOAT_EQ(8, curve->getValue(3)); } +// Tests that a cubic bezier timing function works as expected. +TEST(CCKeyframedAnimationCurveTest, CubicBezierTimingFunction) +{ + OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); + curve->addKeyframe(CCFloatKeyframe::create(0, 0, CCCubicBezierTimingFunction::create(0.25, 0, 0.75, 1))); + curve->addKeyframe(CCFloatKeyframe::create(1, 1, nullptr)); + + EXPECT_FLOAT_EQ(0, curve->getValue(0)); + EXPECT_LT(0, curve->getValue(0.25)); + EXPECT_GT(0.25, curve->getValue(0.25)); + EXPECT_FLOAT_EQ(0.5, curve->getValue(0.5)); + EXPECT_LT(0.75, curve->getValue(0.75)); + EXPECT_GT(1, curve->getValue(0.75)); + EXPECT_FLOAT_EQ(1, curve->getValue(1)); +} } // namespace diff --git a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp index 16a25e12e..8a9f35dc8 100644 --- a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp @@ -65,14 +65,11 @@ TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly) DebugScopedSetImplThread setImplThread; // Create a simple CCLayerImpl tree: - RefPtr<CCLayerImpl> root = CCLayerImpl::create(1); - RefPtr<CCLayerImpl> child = CCLayerImpl::create(2); - RefPtr<CCLayerImpl> grandChild = CCLayerImpl::create(3); - root->addChild(child); - child->addChild(grandChild); - - RefPtr<CCLayerImpl> dummyMask = CCLayerImpl::create(4); - RefPtr<CCLayerImpl> dummyReplica = CCLayerImpl::create(5); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); + root->addChild(CCLayerImpl::create(2)); + CCLayerImpl* child = root->children()[0].get(); + child->addChild(CCLayerImpl::create(3)); + CCLayerImpl* grandChild = child->children()[0].get(); // Adding children is an internal operation and should not mark layers as changed. EXPECT_FALSE(root->layerPropertyChanged()); @@ -95,11 +92,11 @@ TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setAnchorPoint(arbitraryFloatPoint)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setAnchorPointZ(arbitraryNumber)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setFilters(arbitraryFilters)); - EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setMaskLayer(dummyMask)); + EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setMaskLayer(CCLayerImpl::create(4))); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setMasksToBounds(true)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setOpaque(true)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setOpacity(arbitraryNumber)); - EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setReplicaLayer(dummyReplica)); + EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setReplicaLayer(CCLayerImpl::create(5))); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setPosition(arbitraryFloatPoint)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setPreserves3D(true)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setTransform(arbitraryTransform)); @@ -134,9 +131,7 @@ TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly) // not cause any change. EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setAnchorPoint(arbitraryFloatPoint)); EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setAnchorPointZ(arbitraryNumber)); - EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setMaskLayer(dummyMask)); EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setMasksToBounds(true)); - EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setReplicaLayer(dummyReplica)); EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setPosition(arbitraryFloatPoint)); EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setPreserves3D(true)); EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setTransform(arbitraryTransform)); diff --git a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp index bff7e1ba9..2f5a7a25d 100644 --- a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp @@ -67,8 +67,8 @@ private: EXPECT_EQ(contrib, layer->m_countRepresentingContributingSurface); \ EXPECT_EQ(itself, layer->m_countRepresentingItself); -typedef CCLayerIterator<LayerChromium, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> FrontToBack; -typedef CCLayerIterator<LayerChromium, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> BackToFront; +typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> FrontToBack; +typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> BackToFront; void resetCounts(Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList) { @@ -137,7 +137,7 @@ TEST(CCLayerIteratorTest, simpleTree) Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; Vector<RefPtr<LayerChromium> > layerList; - renderSurfaceLayerList.append(rootLayer); + renderSurfaceLayerList.append(rootLayer.get()); CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer.get(), rootLayer.get(), TransformationMatrix(), TransformationMatrix(), renderSurfaceLayerList, layerList, @@ -184,7 +184,7 @@ TEST(CCLayerIteratorTest, complexTree) Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; Vector<RefPtr<LayerChromium> > layerList; - renderSurfaceLayerList.append(rootLayer); + renderSurfaceLayerList.append(rootLayer.get()); CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer.get(), rootLayer.get(), TransformationMatrix(), TransformationMatrix(), renderSurfaceLayerList, layerList, @@ -243,7 +243,7 @@ TEST(CCLayerIteratorTest, complexTreeMultiSurface) Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; Vector<RefPtr<LayerChromium> > layerList; - renderSurfaceLayerList.append(rootLayer); + renderSurfaceLayerList.append(rootLayer.get()); CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer.get(), rootLayer.get(), TransformationMatrix(), TransformationMatrix(), renderSurfaceLayerList, layerList, diff --git a/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp b/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp index 69342cda7..a533c9373 100644 --- a/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp @@ -174,11 +174,11 @@ TEST(CCLayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) // - 3 and 4 do not have a 3d z difference, and therefore their relative ordering should be retained. // - 3 and 4 should be re-sorted so they are in front of 1, 2, and 5. - RefPtr<CCLayerImpl> layer1 = CCLayerImpl::create(1); - RefPtr<CCLayerImpl> layer2 = CCLayerImpl::create(2); - RefPtr<CCLayerImpl> layer3 = CCLayerImpl::create(3); - RefPtr<CCLayerImpl> layer4 = CCLayerImpl::create(4); - RefPtr<CCLayerImpl> layer5 = CCLayerImpl::create(5); + OwnPtr<CCLayerImpl> layer1 = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> layer2 = CCLayerImpl::create(2); + OwnPtr<CCLayerImpl> layer3 = CCLayerImpl::create(3); + OwnPtr<CCLayerImpl> layer4 = CCLayerImpl::create(4); + OwnPtr<CCLayerImpl> layer5 = CCLayerImpl::create(5); TransformationMatrix BehindMatrix; BehindMatrix.translate3d(0, 0, 2); @@ -205,12 +205,12 @@ TEST(CCLayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) layer5->setDrawTransform(BehindMatrix); layer5->setDrawsContent(true); - Vector<RefPtr<CCLayerImpl> > layerList; - layerList.append(layer1); - layerList.append(layer2); - layerList.append(layer3); - layerList.append(layer4); - layerList.append(layer5); + Vector<CCLayerImpl*> layerList; + layerList.append(layer1.get()); + layerList.append(layer2.get()); + layerList.append(layer3.get()); + layerList.append(layer4.get()); + layerList.append(layer5.get()); ASSERT_EQ(static_cast<size_t>(5), layerList.size()); EXPECT_EQ(1, layerList[0]->id()); diff --git a/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp b/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp index 9fe377766..423c668d9 100644 --- a/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp @@ -36,15 +36,6 @@ namespace CCLayerTestCommon { // Align with expected and actual output const char* quadString = " Quad: "; -bool completelyContains(const Region& container, const IntRect& rect) -{ - Region tester(rect); - Vector<IntRect> rects = container.rects(); - for (size_t i = 0; i < rects.size(); ++i) - tester.subtract(rects[i]); - return tester.isEmpty(); -} - void verifyQuadsExactlyCoverRect(const CCQuadList& quads, const IntRect& rect) { Region remaining(rect); @@ -53,7 +44,7 @@ void verifyQuadsExactlyCoverRect(const CCQuadList& quads, const IntRect& rect) CCDrawQuad* quad = quads[i].get(); EXPECT_TRUE(rect.contains(quad->quadRect())) << quadString << i; - EXPECT_TRUE(completelyContains(remaining, quad->quadRect())) << quadString << i; + EXPECT_TRUE(remaining.contains(quad->quadRect())) << quadString << i; remaining.subtract(Region(quad->quadRect())); } diff --git a/Source/WebKit/chromium/tests/CCLayerTestCommon.h b/Source/WebKit/chromium/tests/CCLayerTestCommon.h index c5add93a9..052d44bc9 100644 --- a/Source/WebKit/chromium/tests/CCLayerTestCommon.h +++ b/Source/WebKit/chromium/tests/CCLayerTestCommon.h @@ -33,7 +33,6 @@ namespace CCLayerTestCommon { extern const char* quadString; -bool completelyContains(const WebCore::Region&, const WebCore::IntRect&); void verifyQuadsExactlyCoverRect(const WebCore::CCQuadList&, const WebCore::IntRect&); } // namespace CCLayerTestCommon diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp index d2e1cfef9..e6206cc58 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp @@ -573,7 +573,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces) // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too. parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); - renderSurfaceLayerList.append(parent); + renderSurfaceLayerList.append(parent.get()); CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp index 9ba1cf4ad..d75c12890 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp @@ -49,10 +49,11 @@ public: m_hostImpl = CCLayerTreeHostImpl::create(settings, this); } + virtual void didLoseContextOnImplThread() { } virtual void onSwapBuffersCompleteOnImplThread() { } virtual void setNeedsRedrawOnImplThread() { m_didRequestRedraw = true; } virtual void setNeedsCommitOnImplThread() { m_didRequestCommit = true; } - virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>) { } + virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) { } static void expectClearedScrollDeltasRecursive(CCLayerImpl* layer) { @@ -78,16 +79,16 @@ public: void setupScrollAndContentsLayers(const IntSize& contentSize) { - RefPtr<CCLayerImpl> root = CCLayerImpl::create(0); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0); root->setScrollable(true); root->setScrollPosition(IntPoint(0, 0)); root->setMaxScrollPosition(contentSize); - RefPtr<CCLayerImpl> contents = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> contents = CCLayerImpl::create(1); contents->setDrawsContent(true); contents->setBounds(contentSize); contents->setContentBounds(contentSize); - root->addChild(contents); - m_hostImpl->setRootLayer(root); + root->addChild(contents.release()); + m_hostImpl->setRootLayer(root.release()); } protected: @@ -112,37 +113,43 @@ TEST_F(CCLayerTreeHostImplTest, scrollDeltaNoLayers) TEST_F(CCLayerTreeHostImplTest, scrollDeltaTreeButNoChanges) { - RefPtr<CCLayerImpl> root = CCLayerImpl::create(0); - root->addChild(CCLayerImpl::create(1)); - root->addChild(CCLayerImpl::create(2)); - root->children()[1]->addChild(CCLayerImpl::create(3)); - root->children()[1]->addChild(CCLayerImpl::create(4)); - root->children()[1]->children()[0]->addChild(CCLayerImpl::create(5)); - m_hostImpl->setRootLayer(root); + { + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0); + root->addChild(CCLayerImpl::create(1)); + root->addChild(CCLayerImpl::create(2)); + root->children()[1]->addChild(CCLayerImpl::create(3)); + root->children()[1]->addChild(CCLayerImpl::create(4)); + root->children()[1]->children()[0]->addChild(CCLayerImpl::create(5)); + m_hostImpl->setRootLayer(root.release()); + } + CCLayerImpl* root = m_hostImpl->rootLayer(); - expectClearedScrollDeltasRecursive(root.get()); + expectClearedScrollDeltasRecursive(root); OwnPtr<CCScrollAndScaleSet> scrollInfo; scrollInfo = m_hostImpl->processScrollDeltas(); ASSERT_EQ(scrollInfo->scrolls.size(), 0u); - expectClearedScrollDeltasRecursive(root.get()); + expectClearedScrollDeltasRecursive(root); scrollInfo = m_hostImpl->processScrollDeltas(); ASSERT_EQ(scrollInfo->scrolls.size(), 0u); - expectClearedScrollDeltasRecursive(root.get()); + expectClearedScrollDeltasRecursive(root); } TEST_F(CCLayerTreeHostImplTest, scrollDeltaRepeatedScrolls) { IntPoint scrollPosition(20, 30); IntSize scrollDelta(11, -15); - RefPtr<CCLayerImpl> root = CCLayerImpl::create(10); - root->setScrollPosition(scrollPosition); - root->setScrollable(true); - root->setMaxScrollPosition(IntSize(100, 100)); - root->scrollBy(scrollDelta); - m_hostImpl->setRootLayer(root); + { + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(10); + root->setScrollPosition(scrollPosition); + root->setScrollable(true); + root->setMaxScrollPosition(IntSize(100, 100)); + root->scrollBy(scrollDelta); + m_hostImpl->setRootLayer(root.release()); + } + CCLayerImpl* root = m_hostImpl->rootLayer(); OwnPtr<CCScrollAndScaleSet> scrollInfo; @@ -165,11 +172,14 @@ TEST_F(CCLayerTreeHostImplTest, scrollDeltaRepeatedScrolls) TEST_F(CCLayerTreeHostImplTest, scrollRootCallsCommitAndRedraw) { - RefPtr<CCLayerImpl> root = CCLayerImpl::create(0); - root->setScrollable(true); - root->setScrollPosition(IntPoint(0, 0)); - root->setMaxScrollPosition(IntSize(100, 100)); - m_hostImpl->setRootLayer(root); + { + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0); + root->setScrollable(true); + root->setScrollPosition(IntPoint(0, 0)); + root->setMaxScrollPosition(IntSize(100, 100)); + m_hostImpl->setRootLayer(root.release()); + } + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); m_hostImpl->scrollBy(IntSize(0, 10)); m_hostImpl->scrollEnd(); @@ -179,11 +189,15 @@ TEST_F(CCLayerTreeHostImplTest, scrollRootCallsCommitAndRedraw) TEST_F(CCLayerTreeHostImplTest, wheelEventHandlers) { - RefPtr<CCLayerImpl> root = CCLayerImpl::create(0); - root->setScrollable(true); - root->setScrollPosition(IntPoint(0, 0)); - root->setMaxScrollPosition(IntSize(100, 100)); - m_hostImpl->setRootLayer(root); + { + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0); + root->setScrollable(true); + root->setScrollPosition(IntPoint(0, 0)); + root->setMaxScrollPosition(IntSize(100, 100)); + m_hostImpl->setRootLayer(root.release()); + } + CCLayerImpl* root = m_hostImpl->rootLayer(); + root->setHaveWheelEventHandlers(true); // With registered event handlers, wheel scrolls have to go to the main thread. EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollFailed); @@ -192,6 +206,61 @@ TEST_F(CCLayerTreeHostImplTest, wheelEventHandlers) EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollStarted); } +TEST_F(CCLayerTreeHostImplTest, shouldScrollOnMainThread) +{ + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0); + root->setScrollable(true); + root->setScrollPosition(IntPoint(0, 0)); + root->setMaxScrollPosition(IntSize(100, 100)); + root->setShouldScrollOnMainThread(true); + m_hostImpl->setRootLayer(root.release()); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollFailed); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollFailed); +} + +TEST_F(CCLayerTreeHostImplTest, nonFastScrollableRegionBasic) +{ + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0); + root->setScrollable(true); + root->setScrollPosition(IntPoint(0, 0)); + root->setMaxScrollPosition(IntSize(100, 100)); + root->setNonFastScrollableRegion(IntRect(0, 0, 50, 50)); + m_hostImpl->setRootLayer(root.release()); + // All scroll types inside the non-fast scrollable region should fail. + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollFailed); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollFailed); + + // 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->scrollEnd(); + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(75, 75), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollStarted); + m_hostImpl->scrollBy(IntSize(0, 10)); + m_hostImpl->scrollEnd(); +} + +TEST_F(CCLayerTreeHostImplTest, nonFastScrollableRegionWithOffset) +{ + m_hostImpl->initializeLayerRenderer(createContext()); + + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0); + root->setScrollable(true); + root->setScrollPosition(IntPoint(0, 0)); + root->setMaxScrollPosition(IntSize(100, 100)); + root->setNonFastScrollableRegion(IntRect(0, 0, 50, 50)); + root->setPosition(FloatPoint(-25, 0)); + m_hostImpl->setRootLayer(root.release()); + m_hostImpl->drawLayers(); // Update draw transforms so we can correctly map points into layer space. + + // 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->scrollEnd(); + + // This point is still inside the non-fast region. + EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(10, 10), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollFailed); +} + TEST_F(CCLayerTreeHostImplTest, pinchGesture) { setupScrollAndContentsLayers(IntSize(100, 100)); @@ -281,8 +350,10 @@ TEST_F(CCLayerTreeHostImplTest, pageScaleAnimation) ASSERT(scrollLayer); const float minPageScale = 0.5, maxPageScale = 4; - const double startTimeMs = 1000; - const double durationMs = 100; + const double startTime = 1; + const double duration = 0.1; + const double halfwayThroughAnimation = startTime + duration / 2; + const double endTime = startTime + duration; // Non-anchor zoom-in { @@ -290,10 +361,10 @@ TEST_F(CCLayerTreeHostImplTest, pageScaleAnimation) scrollLayer->setPageScaleDelta(1); scrollLayer->setScrollPosition(IntPoint(50, 50)); - m_hostImpl->startPageScaleAnimation(IntSize(0, 0), false, 2, startTimeMs, durationMs); - m_hostImpl->animate(startTimeMs + durationMs / 2); + m_hostImpl->startPageScaleAnimation(IntSize(0, 0), false, 2, startTime, duration); + m_hostImpl->animate(halfwayThroughAnimation, halfwayThroughAnimation); EXPECT_TRUE(m_didRequestRedraw); - m_hostImpl->animate(startTimeMs + durationMs); + m_hostImpl->animate(endTime, endTime); EXPECT_TRUE(m_didRequestCommit); OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); @@ -307,8 +378,8 @@ TEST_F(CCLayerTreeHostImplTest, pageScaleAnimation) scrollLayer->setPageScaleDelta(1); scrollLayer->setScrollPosition(IntPoint(50, 50)); - m_hostImpl->startPageScaleAnimation(IntSize(25, 25), true, minPageScale, startTimeMs, durationMs); - m_hostImpl->animate(startTimeMs + durationMs); + m_hostImpl->startPageScaleAnimation(IntSize(25, 25), true, minPageScale, startTime, duration); + m_hostImpl->animate(endTime, endTime); EXPECT_TRUE(m_didRequestRedraw); EXPECT_TRUE(m_didRequestCommit); @@ -321,7 +392,7 @@ TEST_F(CCLayerTreeHostImplTest, pageScaleAnimation) class DidDrawCheckLayer : public CCLayerImpl { public: - static PassRefPtr<DidDrawCheckLayer> create(int id) { return adoptRef(new DidDrawCheckLayer(id)); } + static PassOwnPtr<DidDrawCheckLayer> create(int id) { return adoptPtr(new DidDrawCheckLayer(id)); } virtual void didDraw() { @@ -353,14 +424,13 @@ private: TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) { - RefPtr<GraphicsContext3D> context = createContext(); - m_hostImpl->initializeLayerRenderer(context); + m_hostImpl->initializeLayerRenderer(createContext()); // Ensure visibleLayerRect for root layer is empty m_hostImpl->setViewportSize(IntSize(0, 0)); - RefPtr<DidDrawCheckLayer> root = DidDrawCheckLayer::create(0); - m_hostImpl->setRootLayer(root); + m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0)); + DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); EXPECT_FALSE(root->willDrawCalled()); EXPECT_FALSE(root->didDrawCalled()); @@ -388,18 +458,17 @@ TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) TEST_F(CCLayerTreeHostImplTest, didDrawCalledOnAllLayers) { - RefPtr<GraphicsContext3D> context = createContext(); - m_hostImpl->initializeLayerRenderer(context); + m_hostImpl->initializeLayerRenderer(createContext()); m_hostImpl->setViewportSize(IntSize(10, 10)); - RefPtr<DidDrawCheckLayer> root = DidDrawCheckLayer::create(0); - m_hostImpl->setRootLayer(root); + m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0)); + DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); - RefPtr<DidDrawCheckLayer> layer1 = DidDrawCheckLayer::create(1); - root->addChild(layer1); + root->addChild(DidDrawCheckLayer::create(1)); + DidDrawCheckLayer* layer1 = static_cast<DidDrawCheckLayer*>(root->children()[0].get()); - RefPtr<DidDrawCheckLayer> layer2 = DidDrawCheckLayer::create(2); - layer1->addChild(layer2); + layer1->addChild(DidDrawCheckLayer::create(2)); + DidDrawCheckLayer* layer2 = static_cast<DidDrawCheckLayer*>(layer1->children()[0].get()); layer1->setOpacity(0.3); layer1->setPreserves3D(false); @@ -422,8 +491,6 @@ class BlendStateTrackerContext: public FakeWebGraphicsContext3D { public: BlendStateTrackerContext() : m_blend(false) { } - virtual bool initialize(Attributes, WebView*, bool renderDirectlyToWebView) { return true; } - virtual void enable(WGC3Denum cap) { if (cap == GraphicsContext3D::BLEND) @@ -444,7 +511,7 @@ private: class BlendStateCheckLayer : public CCLayerImpl { public: - static PassRefPtr<BlendStateCheckLayer> create(int id) { return adoptRef(new BlendStateCheckLayer(id)); } + static PassOwnPtr<BlendStateCheckLayer> create(int id) { return adoptPtr(new BlendStateCheckLayer(id)); } virtual void appendQuads(CCQuadList& quadList, const CCSharedQuadState* sharedQuadState) { @@ -489,18 +556,20 @@ private: // https://bugs.webkit.org/show_bug.cgi?id=75783 TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) { - RefPtr<GraphicsContext3D> context = createContext(); - m_hostImpl->initializeLayerRenderer(context); + m_hostImpl->initializeLayerRenderer(createContext()); m_hostImpl->setViewportSize(IntSize(10, 10)); - RefPtr<CCLayerImpl> root = CCLayerImpl::create(0); - root->setAnchorPoint(FloatPoint(0, 0)); - root->setBounds(IntSize(10, 10)); - root->setDrawsContent(false); - m_hostImpl->setRootLayer(root); + { + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0); + root->setAnchorPoint(FloatPoint(0, 0)); + root->setBounds(IntSize(10, 10)); + root->setDrawsContent(false); + m_hostImpl->setRootLayer(root.release()); + } + CCLayerImpl* root = m_hostImpl->rootLayer(); - RefPtr<BlendStateCheckLayer> layer1 = BlendStateCheckLayer::create(1); - root->addChild(layer1); + root->addChild(BlendStateCheckLayer::create(1)); + BlendStateCheckLayer* layer1 = static_cast<BlendStateCheckLayer*>(root->children()[0].get()); // Opaque layer, drawn without blending. layer1->setOpaque(true); @@ -539,8 +608,8 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) m_hostImpl->drawLayers(); EXPECT_TRUE(layer1->quadsAppended()); - RefPtr<BlendStateCheckLayer> layer2 = BlendStateCheckLayer::create(2); - layer1->addChild(layer2); + layer1->addChild(BlendStateCheckLayer::create(2)); + BlendStateCheckLayer* layer2 = static_cast<BlendStateCheckLayer*>(layer1->children()[0].get()); // 2 opaque layers, drawn without blending. layer1->setOpaque(true); @@ -632,8 +701,6 @@ class ReshapeTrackerContext: public FakeWebGraphicsContext3D { public: ReshapeTrackerContext() : m_reshapeCalled(false) { } - virtual bool initialize(Attributes, WebView*, bool renderDirectlyToWebView) { return true; } - virtual void reshape(int width, int height) { m_reshapeCalled = true; @@ -660,11 +727,11 @@ TEST_F(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw) m_hostImpl->initializeLayerRenderer(context); m_hostImpl->setViewportSize(IntSize(10, 10)); - RefPtr<CCLayerImpl> root = adoptRef(new FakeDrawableCCLayerImpl(1)); + CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); root->setAnchorPoint(FloatPoint(0, 0)); root->setBounds(IntSize(10, 10)); root->setDrawsContent(true); - m_hostImpl->setRootLayer(root); + m_hostImpl->setRootLayer(adoptPtr(root)); EXPECT_FALSE(reshapeTracker->reshapeCalled()); m_hostImpl->drawLayers(); @@ -673,8 +740,6 @@ TEST_F(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw) class PartialSwapTrackerContext : public FakeWebGraphicsContext3D { public: - virtual bool initialize(Attributes, WebView*, bool renderDirectlyToWebView) { return true; } - virtual void postSubBufferCHROMIUM(int x, int y, int width, int height) { m_partialSwapRect = IntRect(x, y, width, height); @@ -683,7 +748,7 @@ public: virtual WebString getString(WGC3Denum name) { if (name == GraphicsContext3D::EXTENSIONS) - return WebString("GL_CHROMIUM_post_sub_buffer"); + return WebString("GL_CHROMIUM_post_sub_buffer GL_CHROMIUM_set_visibility"); return WebString(); } @@ -709,8 +774,8 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) layerTreeHostImpl->initializeLayerRenderer(context); layerTreeHostImpl->setViewportSize(IntSize(500, 500)); - RefPtr<CCLayerImpl> root = adoptRef(new FakeDrawableCCLayerImpl(1)); - RefPtr<CCLayerImpl> child = adoptRef(new FakeDrawableCCLayerImpl(2)); + CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); + CCLayerImpl* child = new FakeDrawableCCLayerImpl(2); child->setPosition(FloatPoint(12, 13)); child->setAnchorPoint(FloatPoint(0, 0)); child->setBounds(IntSize(14, 15)); @@ -718,8 +783,8 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) root->setAnchorPoint(FloatPoint(0, 0)); root->setBounds(IntSize(500, 500)); root->setDrawsContent(true); - root->addChild(child); - layerTreeHostImpl->setRootLayer(root); + root->addChild(adoptPtr(child)); + layerTreeHostImpl->setRootLayer(adoptPtr(root)); // First frame, the entire screen should get swapped. layerTreeHostImpl->drawLayers(); @@ -760,4 +825,106 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) EXPECT_EQ(expectedSwapRect.height(), actualSwapRect.height()); } +// Make sure that we reset damage tracking on visibility change because the +// state of the front buffer that we push to with PostSubBuffer is undefined. +TEST_F(CCLayerTreeHostImplTest, visibilityChangeResetsDamage) +{ + PartialSwapTrackerContext* partialSwapTracker = new PartialSwapTrackerContext(); + RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(partialSwapTracker), GraphicsContext3D::RenderDirectlyToHostWindow); + + // This test creates its own CCLayerTreeHostImpl, so + // that we can force partial swap enabled. + CCSettings settings; + settings.partialSwapEnabled = true; + OwnPtr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::create(settings, this); + layerTreeHostImpl->initializeLayerRenderer(context); + layerTreeHostImpl->setViewportSize(IntSize(500, 500)); + + CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); + root->setAnchorPoint(FloatPoint(0, 0)); + root->setBounds(IntSize(500, 500)); + root->setDrawsContent(true); + layerTreeHostImpl->setRootLayer(adoptPtr(root)); + + // First frame: ignore. + layerTreeHostImpl->drawLayers(); + layerTreeHostImpl->swapBuffers(); + + // Second frame: nothing has changed --- so we souldn't push anything with partial swap. + layerTreeHostImpl->drawLayers(); + layerTreeHostImpl->swapBuffers(); + EXPECT_TRUE(partialSwapTracker->partialSwapRect().isEmpty()); + + // Third frame: visibility change --- so we should push a full frame with partial swap. + layerTreeHostImpl->setVisible(false); + layerTreeHostImpl->setVisible(true); + layerTreeHostImpl->drawLayers(); + layerTreeHostImpl->swapBuffers(); + IntRect actualSwapRect = partialSwapTracker->partialSwapRect(); + IntRect expectedSwapRect = IntRect(IntPoint::zero(), IntSize(500, 500)); + EXPECT_EQ(expectedSwapRect.x(), actualSwapRect.x()); + EXPECT_EQ(expectedSwapRect.y(), actualSwapRect.y()); + EXPECT_EQ(expectedSwapRect.width(), actualSwapRect.width()); + EXPECT_EQ(expectedSwapRect.height(), actualSwapRect.height()); +} + +// Make sure that context lost notifications are propagated through the tree. +class ContextLostNotificationCheckLayer : public CCLayerImpl { +public: + static PassOwnPtr<ContextLostNotificationCheckLayer> create(int id) { return adoptPtr(new ContextLostNotificationCheckLayer(id)); } + + virtual void didLoseContext() + { + m_didLoseContextCalled = true; + } + + bool didLoseContextCalled() const { return m_didLoseContextCalled; } + +private: + explicit ContextLostNotificationCheckLayer(int id) + : CCLayerImpl(id) + , m_didLoseContextCalled(false) + { + } + + bool m_didLoseContextCalled; +}; + +TEST_F(CCLayerTreeHostImplTest, contextLostAndRestoredNotificationSentToAllLayers) +{ + m_hostImpl->initializeLayerRenderer(createContext()); + m_hostImpl->setViewportSize(IntSize(10, 10)); + + m_hostImpl->setRootLayer(ContextLostNotificationCheckLayer::create(0)); + ContextLostNotificationCheckLayer* root = static_cast<ContextLostNotificationCheckLayer*>(m_hostImpl->rootLayer()); + + root->addChild(ContextLostNotificationCheckLayer::create(1)); + ContextLostNotificationCheckLayer* layer1 = static_cast<ContextLostNotificationCheckLayer*>(root->children()[0].get()); + + layer1->addChild(ContextLostNotificationCheckLayer::create(2)); + ContextLostNotificationCheckLayer* layer2 = static_cast<ContextLostNotificationCheckLayer*>(layer1->children()[0].get()); + + EXPECT_FALSE(root->didLoseContextCalled()); + EXPECT_FALSE(layer1->didLoseContextCalled()); + EXPECT_FALSE(layer2->didLoseContextCalled()); + + m_hostImpl->initializeLayerRenderer(createContext()); + + EXPECT_TRUE(root->didLoseContextCalled()); + EXPECT_TRUE(layer1->didLoseContextCalled()); + EXPECT_TRUE(layer2->didLoseContextCalled()); +} + +class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D { +public: + virtual bool makeContextCurrent() { return false; } +}; + +TEST_F(CCLayerTreeHostImplTest, finishAllRenderingAfterContextLost) +{ + // The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects. + m_hostImpl->initializeLayerRenderer(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow)); + m_hostImpl->finishAllRendering(); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp index 10cfa6931..2c4e7ce59 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp @@ -38,6 +38,7 @@ #include "WebKit.h" #include "cc/CCActiveAnimation.h" #include "cc/CCLayerAnimationController.h" +#include "cc/CCLayerAnimationDelegate.h" #include "cc/CCLayerImpl.h" #include "cc/CCLayerTreeHostImpl.h" #include "cc/CCScopedThreadProxy.h" @@ -59,15 +60,21 @@ using namespace WTF; namespace { // Used by test stubs to notify the test when something interesting happens. -class TestHooks { +class TestHooks : public CCLayerAnimationDelegate { public: virtual void beginCommitOnCCThread(CCLayerTreeHostImpl*) { } virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) { } virtual void drawLayersOnCCThread(CCLayerTreeHostImpl*) { } - virtual void animateLayers(CCLayerTreeHostImpl*) { } + virtual void animateLayers(CCLayerTreeHostImpl*, double monotonicTime) { } virtual void applyScrollAndScale(const IntSize&, float) { } - virtual void updateAnimations(double frameBeginTime) { } + virtual void updateAnimations(double monotonicTime) { } virtual void layout() { } + virtual void didRecreateContext(bool succeded) { } + virtual void didCommitAndDrawFrame() { } + + // Implementation of CCLayerAnimationDelegate + virtual void notifyAnimationStarted(double time) { } + virtual void notifyAnimationFinished(int animationId) { } }; // Adapts CCLayerTreeHostImpl for test. Runs real code, then invokes test hooks. @@ -97,10 +104,10 @@ public: } protected: - virtual void animateLayers(double frameBeginTimeMs) + virtual void animateLayers(double monotonicTime, double wallClockTime) { - CCLayerTreeHostImpl::animateLayers(frameBeginTimeMs); - m_testHooks->animateLayers(this); + CCLayerTreeHostImpl::animateLayers(monotonicTime, wallClockTime); + m_testHooks->animateLayers(this, monotonicTime); } private: @@ -130,6 +137,8 @@ public: // LayerTreeHostImpl won't draw if it has 1x1 viewport. layerTreeHost->setViewportSize(IntSize(1, 1)); + layerTreeHost->rootLayer()->setLayerAnimationDelegate(testHooks); + return layerTreeHost.release(); } @@ -205,9 +214,9 @@ public: return adoptPtr(new MockLayerTreeHostClient(testHooks)); } - virtual void updateAnimations(double frameBeginTime) + virtual void updateAnimations(double monotonicTime) { - m_testHooks->updateAnimations(frameBeginTime); + m_testHooks->updateAnimations(monotonicTime); } virtual void layout() @@ -220,7 +229,7 @@ public: m_testHooks->applyScrollAndScale(scrollDelta, scale); } - virtual PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D() + virtual PassRefPtr<GraphicsContext3D> createContext() { GraphicsContext3D::Attributes attrs; WebGraphicsContext3D::Attributes webAttrs; @@ -232,14 +241,16 @@ public: virtual void didCommitAndDrawFrame() { + m_testHooks->didCommitAndDrawFrame(); } virtual void didCompleteSwapBuffers() { } - virtual void didRecreateGraphicsContext(bool) + virtual void didRecreateContext(bool succeeded) { + m_testHooks->didRecreateContext(succeeded); } virtual void scheduleComposite() @@ -279,6 +290,11 @@ public: callOnMainThread(CCLayerTreeHostTest::dispatchAddAnimation, this); } + void postAddInstantAnimationToMainThread() + { + callOnMainThread(CCLayerTreeHostTest::dispatchAddInstantAnimation, this); + } + void postSetNeedsCommitToMainThread() { callOnMainThread(CCLayerTreeHostTest::dispatchSetNeedsCommit, this); @@ -329,67 +345,76 @@ protected: static void dispatchSetNeedsAnimate(void* self) { - ASSERT(isMainThread()); - CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); - ASSERT(test); - if (test->m_layerTreeHost) - test->m_layerTreeHost->setNeedsAnimate(); + ASSERT(isMainThread()); + CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); + ASSERT(test); + if (test->m_layerTreeHost) + test->m_layerTreeHost->setNeedsAnimate(); + } + + static void dispatchAddInstantAnimation(void* self) + { + ASSERT(isMainThread()); + CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); + ASSERT(test); + if (test->m_layerTreeHost && test->m_layerTreeHost->rootLayer()) + addOpacityTransitionToLayer(*test->m_layerTreeHost->rootLayer(), 0, 0, 1); } static void dispatchAddAnimation(void* self) { - ASSERT(isMainThread()); - CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); - ASSERT(test); - if (test->m_layerTreeHost && test->m_layerTreeHost->rootLayer()) - addOpacityTransitionToLayer(*test->m_layerTreeHost->rootLayer(), 0, 0, 1); + ASSERT(isMainThread()); + CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); + ASSERT(test); + if (test->m_layerTreeHost && test->m_layerTreeHost->rootLayer()) + addOpacityTransitionToLayer(*test->m_layerTreeHost->rootLayer(), 10, 0, 1); } static void dispatchSetNeedsAnimateAndCommit(void* self) { - ASSERT(isMainThread()); - CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); - ASSERT(test); - if (test->m_layerTreeHost) { - test->m_layerTreeHost->setNeedsAnimate(); - test->m_layerTreeHost->setNeedsCommit(); - } + ASSERT(isMainThread()); + CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); + ASSERT(test); + if (test->m_layerTreeHost) { + test->m_layerTreeHost->setNeedsAnimate(); + test->m_layerTreeHost->setNeedsCommit(); + } } static void dispatchSetNeedsCommit(void* self) { - ASSERT(isMainThread()); - CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); - ASSERT_TRUE(test); - if (test->m_layerTreeHost) - test->m_layerTreeHost->setNeedsCommit(); + ASSERT(isMainThread()); + CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); + ASSERT_TRUE(test); + if (test->m_layerTreeHost) + test->m_layerTreeHost->setNeedsCommit(); } static void dispatchSetNeedsRedraw(void* self) { - ASSERT(isMainThread()); - CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); - ASSERT_TRUE(test); - if (test->m_layerTreeHost) - test->m_layerTreeHost->setNeedsRedraw(); + ASSERT(isMainThread()); + CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); + ASSERT_TRUE(test); + if (test->m_layerTreeHost) + test->m_layerTreeHost->setNeedsRedraw(); } static void dispatchSetVisible(void* self) { - ASSERT(isMainThread()); - CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); - ASSERT(test); - if (test->m_layerTreeHost) - test->m_layerTreeHost->setVisible(true); + ASSERT(isMainThread()); + CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); + ASSERT(test); + if (test->m_layerTreeHost) + test->m_layerTreeHost->setVisible(true); } static void dispatchSetInvisible(void* self) { - ASSERT(isMainThread()); - CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); - ASSERT(test); - if (test->m_layerTreeHost) - test->m_layerTreeHost->setVisible(false); + ASSERT(isMainThread()); + CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); + ASSERT(test); + if (test->m_layerTreeHost) + test->m_layerTreeHost->setVisible(false); } class TimeoutTask : public WebThread::Task { @@ -827,34 +852,57 @@ class CCLayerTreeHostTestAddAnimation : public CCLayerTreeHostTestThreadOnly { public: CCLayerTreeHostTestAddAnimation() : m_numAnimates(0) - , m_layerTreeHostImpl(0) + , m_receivedAnimationStartedNotification(false) + , m_receivedAnimationFinishedNotification(false) + , m_startTime(0) + , m_firstMonotonicTime(0) { } virtual void beginTest() { - postAddAnimationToMainThread(); + postAddInstantAnimationToMainThread(); } - virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl) + virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) { if (!m_numAnimates) { // The animation had zero duration so layerTreeHostImpl should no // longer need to animate its layers. EXPECT_FALSE(layerTreeHostImpl->needsAnimateLayers()); m_numAnimates++; + m_firstMonotonicTime = monotonicTime; return; } + EXPECT_LT(0, m_startTime); + EXPECT_LT(0, m_firstMonotonicTime); + EXPECT_NE(m_startTime, m_firstMonotonicTime); + EXPECT_TRUE(m_receivedAnimationStartedNotification); + EXPECT_TRUE(m_receivedAnimationFinishedNotification); endTest(); } + virtual void notifyAnimationStarted(double wallClockTime) + { + m_receivedAnimationStartedNotification = true; + m_startTime = wallClockTime; + } + + virtual void notifyAnimationFinished(int) + { + m_receivedAnimationFinishedNotification = true; + } + virtual void afterTest() { } private: int m_numAnimates; - CCLayerTreeHostImpl* m_layerTreeHostImpl; + bool m_receivedAnimationStartedNotification; + bool m_receivedAnimationFinishedNotification; + double m_startTime; + double m_firstMonotonicTime; }; TEST_F(CCLayerTreeHostTestAddAnimation, runMultiThread) @@ -862,6 +910,43 @@ TEST_F(CCLayerTreeHostTestAddAnimation, runMultiThread) runTestThreaded(); } +// Ensures that animations continue to be ticked when we are backgrounded. +class CCLayerTreeHostTestTickAnimationWhileBackgrounded : public CCLayerTreeHostTestThreadOnly { +public: + CCLayerTreeHostTestTickAnimationWhileBackgrounded() + : m_numAnimates(0) + { + } + + virtual void beginTest() + { + postAddAnimationToMainThread(); + } + + virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) + { + if (!m_numAnimates) { + // We have a long animation running. It should continue to tick even if we are not visible. + postSetVisibleToMainThread(false); + m_numAnimates++; + return; + } + endTest(); + } + + virtual void afterTest() + { + } + +private: + int m_numAnimates; +}; + +TEST_F(CCLayerTreeHostTestTickAnimationWhileBackgrounded, runMultiThread) +{ + runTestThreaded(); +} + class CCLayerTreeHostTestScrollSimple : public CCLayerTreeHostTestThreadOnly { public: CCLayerTreeHostTestScrollSimple() @@ -1154,9 +1239,9 @@ public: m_paintContentsCount++; } - virtual void idlePaintContentsIfDirty() + virtual void idlePaintContentsIfDirty(const Region& occluded) { - ContentLayerChromium::idlePaintContentsIfDirty(); + ContentLayerChromium::idlePaintContentsIfDirty(occluded); m_idlePaintContentsCount++; } @@ -1883,4 +1968,72 @@ public: SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestManySurfaces) +// A loseContext(1) should lead to a didRecreateContext(true) +class CCLayerTreeHostTestSetSingleLostContext : public CCLayerTreeHostTestThreadOnly { +public: + CCLayerTreeHostTestSetSingleLostContext() + { + } + + virtual void beginTest() + { + postSetNeedsCommitToMainThread(); + } + + virtual void didCommitAndDrawFrame() + { + m_layerTreeHost->loseContext(1); + } + + virtual void didRecreateContext(bool succeeded) + { + EXPECT_TRUE(succeeded); + endTest(); + } + + virtual void afterTest() + { + } +}; + +TEST_F(CCLayerTreeHostTestSetSingleLostContext, runMultiThread) +{ + runTestThreaded(); +} + +// A loseContext(10) should lead to a didRecreateContext(false), and +// a finishAllRendering() should not hang. +class CCLayerTreeHostTestSetRepeatedLostContext : public CCLayerTreeHostTestThreadOnly { +public: + CCLayerTreeHostTestSetRepeatedLostContext() + { + } + + virtual void beginTest() + { + postSetNeedsCommitToMainThread(); + } + + virtual void didCommitAndDrawFrame() + { + m_layerTreeHost->loseContext(10); + } + + virtual void didRecreateContext(bool succeeded) + { + EXPECT_FALSE(succeeded); + m_layerTreeHost->finishAllRendering(); + endTest(); + } + + virtual void afterTest() + { + } +}; + +TEST_F(CCLayerTreeHostTestSetRepeatedLostContext, runMultiThread) +{ + runTestThreaded(); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp index 678ec9645..26d52523b 100644 --- a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp @@ -45,16 +45,6 @@ using namespace WebCore; namespace { -void setLayerPropertiesForTesting(LayerChromium* layer, const TransformationMatrix& transform, const TransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque) -{ - layer->setTransform(transform); - layer->setSublayerTransform(sublayerTransform); - layer->setAnchorPoint(anchor); - layer->setPosition(position); - layer->setBounds(bounds); - layer->setOpaque(opaque); -} - class LayerChromiumWithForcedDrawsContent : public LayerChromium { public: LayerChromiumWithForcedDrawsContent() @@ -63,30 +53,106 @@ public: } virtual bool drawsContent() const { return true; } + virtual Region opaqueContentsRegion() const + { + return intersection(m_opaquePaintRect, visibleLayerRect()); + } + + void setOpaquePaintRect(const IntRect& opaquePaintRect) { m_opaquePaintRect = opaquePaintRect; } + +private: + IntRect m_opaquePaintRect; }; +void setLayerPropertiesForTesting(LayerChromium* layer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) +{ + layer->setTransform(transform); + layer->setSublayerTransform(TransformationMatrix()); + layer->setAnchorPoint(FloatPoint(0, 0)); + layer->setPosition(position); + layer->setBounds(bounds); +} + +void setLayerPropertiesForTesting(LayerChromiumWithForcedDrawsContent* layer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque, bool opaqueLayers) +{ + setLayerPropertiesForTesting(layer, transform, position, bounds); + if (opaqueLayers) + layer->setOpaque(opaque); + else { + layer->setOpaque(false); + if (opaque) + layer->setOpaquePaintRect(IntRect(IntPoint(), bounds)); + else + layer->setOpaquePaintRect(IntRect()); + } +} + // A subclass to expose the total current occlusion. class TestCCOcclusionTracker : public CCOcclusionTracker { public: + TestCCOcclusionTracker(IntRect screenScissorRect) + : CCOcclusionTracker(screenScissorRect) + , m_overrideLayerScissorRect(false) + { + } + + TestCCOcclusionTracker(IntRect screenScissorRect, const CCOcclusionTrackerDamageClient* damageClient) + : CCOcclusionTracker(screenScissorRect, damageClient) + , m_overrideLayerScissorRect(false) + { + } + Region occlusionInScreenSpace() const { return CCOcclusionTracker::m_stack.last().occlusionInScreen; } Region occlusionInTargetSurface() const { return CCOcclusionTracker::m_stack.last().occlusionInTarget; } void setOcclusionInScreenSpace(const Region& region) { CCOcclusionTracker::m_stack.last().occlusionInScreen = region; } void setOcclusionInTargetSurface(const Region& region) { CCOcclusionTracker::m_stack.last().occlusionInTarget = region; } + + void setLayerScissorRect(const IntRect& rect) { m_overrideLayerScissorRect = true; m_layerScissorRect = rect;} + void useDefaultLayerScissorRect() { m_overrideLayerScissorRect = false; } + +protected: + virtual IntRect layerScissorRectInTargetSurface(const LayerChromium* layer) const { return m_overrideLayerScissorRect ? m_layerScissorRect : CCOcclusionTracker::layerScissorRectInTargetSurface(layer); } + +private: + bool m_overrideLayerScissorRect; + IntRect m_layerScissorRect; }; -TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegion) +class TestDamageClient : public CCOcclusionTrackerDamageClient { +public: + // The interface + virtual FloatRect damageRect(const RenderSurfaceChromium*) const { return m_damageRect; } + + // Testing stuff + TestDamageClient(const FloatRect& damageRect) : m_damageRect(damageRect) { } + void setDamageRect(const FloatRect& damageRect) { m_damageRect = damageRect; } + +private: + FloatRect m_damageRect; +}; + +#define TEST_OPAQUE_AND_PAINTED_OPAQUE(FULLTESTNAME, SHORTTESTNAME) \ + TEST(FULLTESTNAME, opaqueLayer) \ + { \ + SHORTTESTNAME(true); \ + } \ + TEST(FULLTESTNAME, opaquePaintRect) \ + { \ + SHORTTESTNAME(false); \ + } + +void layerAddedToOccludedRegion(bool opaqueLayers) { // This tests that the right transforms are being used. - TestCCOcclusionTracker occlusion; const TransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); parent->createRenderSurface(); parent->addChild(layer); - setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); - setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); + setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(30, 30), IntSize(500, 500), true, opaqueLayers); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; Vector<RefPtr<LayerChromium> > dummyLayerList; @@ -98,6 +164,9 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegion) CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); + occlusion.enterTargetRenderSurface(parent->renderSurface()); occlusion.markOccludedBehindLayer(layer.get()); EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); @@ -111,6 +180,14 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegion) EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(31, 30, 70, 70))); EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 31, 70, 70))); + occlusion.useDefaultLayerScissorRect(); + EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 30, 70, 70))); + EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(29, 30, 70, 70))); + EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 29, 70, 70))); + EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(31, 30, 70, 70))); + EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 31, 70, 70))); + occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(30, 30, 70, 70)).isEmpty()); EXPECT_EQ_RECT(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent.get(), IntRect(29, 30, 70, 70))); EXPECT_EQ_RECT(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent.get(), IntRect(29, 29, 70, 70))); @@ -122,10 +199,11 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegion) EXPECT_EQ_RECT(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent.get(), IntRect(29, 31, 70, 70))); } -TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithRotation) +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerAddedToOccludedRegion, layerAddedToOccludedRegion); + +void layerAddedToOccludedRegionWithRotation(bool opaqueLayers) { // This tests that the right transforms are being used. - TestCCOcclusionTracker occlusion; const TransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); @@ -137,8 +215,8 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithRotation) layerTransform.rotate(90); layerTransform.translate(-250, -250); - setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); - setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); + setLayerPropertiesForTesting(layer.get(), layerTransform, FloatPoint(30, 30), IntSize(500, 500), true, opaqueLayers); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; Vector<RefPtr<LayerChromium> > dummyLayerList; @@ -150,6 +228,9 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithRotation) CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); + occlusion.enterTargetRenderSurface(parent->renderSurface()); occlusion.markOccludedBehindLayer(layer.get()); EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); @@ -163,6 +244,14 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithRotation) EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(31, 30, 70, 70))); EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 31, 70, 70))); + occlusion.useDefaultLayerScissorRect(); + EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 30, 70, 70))); + EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(29, 30, 70, 70))); + EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 29, 70, 70))); + EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(31, 30, 70, 70))); + EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 31, 70, 70))); + occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(30, 30, 70, 70)).isEmpty()); EXPECT_EQ_RECT(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent.get(), IntRect(29, 30, 70, 70))); EXPECT_EQ_RECT(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent.get(), IntRect(29, 29, 70, 70))); @@ -174,10 +263,11 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithRotation) EXPECT_EQ_RECT(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent.get(), IntRect(29, 31, 70, 70))); } -TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithTranslation) +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerAddedToOccludedRegionWithRotation, layerAddedToOccludedRegionWithRotation); + +void layerAddedToOccludedRegionWithTranslation(bool opaqueLayers) { // This tests that the right transforms are being used. - TestCCOcclusionTracker occlusion; const TransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); @@ -187,8 +277,8 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithTranslation) TransformationMatrix layerTransform; layerTransform.translate(20, 20); - setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); - setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); + setLayerPropertiesForTesting(layer.get(), layerTransform, FloatPoint(30, 30), IntSize(500, 500), true, opaqueLayers); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; Vector<RefPtr<LayerChromium> > dummyLayerList; @@ -200,6 +290,9 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithTranslation) CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); + occlusion.enterTargetRenderSurface(parent->renderSurface()); occlusion.markOccludedBehindLayer(layer.get()); EXPECT_EQ_RECT(IntRect(50, 50, 50, 50), occlusion.occlusionInScreenSpace().bounds()); @@ -213,6 +306,14 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithTranslation) EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(51, 50, 50, 50))); EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(50, 51, 50, 50))); + occlusion.useDefaultLayerScissorRect(); + EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(50, 50, 50, 50))); + EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(49, 50, 50, 50))); + EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(50, 49, 50, 50))); + EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(51, 50, 50, 50))); + EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(50, 51, 50, 50))); + occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(50, 50, 50, 50)).isEmpty()); EXPECT_EQ_RECT(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(49, 50, 50, 50))); EXPECT_EQ_RECT(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(49, 49, 50, 50))); @@ -222,12 +323,25 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithTranslation) EXPECT_EQ_RECT(IntRect(51, 51, 50, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(51, 51, 50, 50))); EXPECT_EQ_RECT(IntRect(50, 100, 50, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(50, 51, 50, 50))); EXPECT_EQ_RECT(IntRect(49, 51, 50, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(49, 51, 50, 50))); + + occlusion.useDefaultLayerScissorRect(); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(50, 50, 50, 50)).isEmpty()); + EXPECT_EQ_RECT(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(49, 50, 50, 50))); + EXPECT_EQ_RECT(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(49, 49, 50, 50))); + EXPECT_EQ_RECT(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(50, 49, 50, 50))); + EXPECT_EQ_RECT(IntRect(51, 49, 49, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(51, 49, 50, 50))); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(51, 50, 50, 50)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(51, 51, 50, 50)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(50, 51, 50, 50)).isEmpty()); + EXPECT_EQ_RECT(IntRect(49, 51, 1, 49), occlusion.unoccludedContentRect(parent.get(), IntRect(49, 51, 50, 50))); + occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); } -TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithRotatedSurface) +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerAddedToOccludedRegionWithTranslation, layerAddedToOccludedRegionWithTranslation); + +void layerAddedToOccludedRegionWithRotatedSurface(bool opaqueLayers) { // This tests that the right transforms are being used. - TestCCOcclusionTracker occlusion; const TransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); @@ -241,9 +355,9 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithRotatedSurface) childTransform.rotate(90); childTransform.translate(-250, -250); - setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); - setLayerPropertiesForTesting(child.get(), childTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false); - setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); + setLayerPropertiesForTesting(child.get(), childTransform, FloatPoint(30, 30), IntSize(500, 500)); + setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true, opaqueLayers); child->setMasksToBounds(true); @@ -257,6 +371,9 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithRotatedSurface) CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); + occlusion.enterTargetRenderSurface(child->renderSurface()); occlusion.markOccludedBehindLayer(layer.get()); @@ -271,6 +388,14 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithRotatedSurface) EXPECT_FALSE(occlusion.occluded(child.get(), IntRect(10, 430, 61, 70))); EXPECT_FALSE(occlusion.occluded(child.get(), IntRect(10, 430, 60, 71))); + occlusion.useDefaultLayerScissorRect(); + EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(10, 430, 60, 70))); + EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(9, 430, 60, 70))); + EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(10, 429, 60, 70))); + EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(10, 430, 61, 70))); + EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(10, 430, 60, 71))); + occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); + occlusion.markOccludedBehindLayer(child.get()); occlusion.finishedTargetRenderSurface(child.get(), child->renderSurface()); occlusion.leaveToTargetRenderSurface(parent->renderSurface()); @@ -283,6 +408,16 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithRotatedSurface) EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 40, 70, 60))); EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(29, 40, 70, 60))); EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 39, 70, 60))); + EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(31, 40, 70, 60))); + EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 41, 70, 60))); + + occlusion.useDefaultLayerScissorRect(); + EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 40, 70, 60))); + EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(29, 40, 70, 60))); + EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 39, 70, 60))); + EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(31, 40, 70, 60))); + EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 41, 70, 60))); + occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); /* Justification for the above occlusion from |layer|: @@ -311,10 +446,11 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithRotatedSurface) */ } -TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithSurfaceAlreadyOnStack) +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerAddedToOccludedRegionWithRotatedSurface, layerAddedToOccludedRegionWithRotatedSurface); + +void layerAddedToOccludedRegionWithSurfaceAlreadyOnStack(bool opaqueLayers) { // This tests that the right transforms are being used. - TestCCOcclusionTracker occlusion; const TransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); @@ -330,13 +466,13 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithSurfaceAlreadyOnStack childTransform.rotate(90); childTransform.translate(-250, -250); - setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); - setLayerPropertiesForTesting(child.get(), childTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false); - setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); + setLayerPropertiesForTesting(child.get(), childTransform, FloatPoint(30, 30), IntSize(500, 500)); + setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true, opaqueLayers); // |child2| makes |parent|'s surface get considered by CCOcclusionTracker first, instead of |child|'s. This exercises different code in // leaveToTargetRenderSurface, as the target surface has already been seen. - setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(60, 20), true); + setLayerPropertiesForTesting(child2.get(), identityMatrix, FloatPoint(30, 30), IntSize(60, 20), true, opaqueLayers); child->setMasksToBounds(true); @@ -350,6 +486,9 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithSurfaceAlreadyOnStack CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + occlusion.setLayerScissorRect(IntRect(-10, -10, 1000, 1000)); + occlusion.enterTargetRenderSurface(parent->renderSurface()); occlusion.markOccludedBehindLayer(child2.get()); @@ -372,6 +511,14 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithSurfaceAlreadyOnStack EXPECT_FALSE(occlusion.occluded(child.get(), IntRect(11, 430, 60, 70))); EXPECT_FALSE(occlusion.occluded(child.get(), IntRect(10, 431, 60, 70))); + occlusion.useDefaultLayerScissorRect(); + EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(10, 430, 60, 70))); + EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(9, 430, 60, 70))); + EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(10, 429, 60, 70))); + EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(11, 430, 60, 70))); + EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(10, 431, 60, 70))); + occlusion.setLayerScissorRect(IntRect(-10, -10, 1000, 1000)); + EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(10, 430, 60, 70)).isEmpty()); // This is the little piece not occluded by child2 EXPECT_EQ_RECT(IntRect(9, 430, 1, 10), occlusion.unoccludedContentRect(child.get(), IntRect(9, 430, 60, 70))); @@ -387,8 +534,16 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithSurfaceAlreadyOnStack EXPECT_EQ_RECT(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child.get(), IntRect(11, 430, 60, 70))); EXPECT_EQ_RECT(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child.get(), IntRect(10, 431, 60, 70))); - // Surface is not occluded by things that draw into itself. - EXPECT_EQ_RECT(IntRect(10, 430, 60, 70), occlusion.surfaceUnoccludedContentRect(child.get(), IntRect(10, 430, 60, 70))); + occlusion.useDefaultLayerScissorRect(); + EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(10, 430, 60, 70)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(9, 430, 60, 70)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(9, 430, 60, 80)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(-10, 430, 60, 70)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(-10, 430, 60, 80)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(10, 429, 60, 70)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(11, 430, 60, 70)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(10, 431, 60, 70)).isEmpty()); + occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); occlusion.markOccludedBehindLayer(child.get()); // |child2| should get merged with the surface we are leaving now @@ -433,10 +588,6 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithSurfaceAlreadyOnStack EXPECT_EQ_RECT(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent.get(), IntRect(31, 40, 70, 60))); EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(30, 41, 70, 60))); - // Surface is not occluded by things that draw into itself. - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.surfaceUnoccludedContentRect(parent.get(), IntRect(30, 40, 70, 60))); - - /* Justification for the above occlusion from |layer|: 100 +---------------------+ +---------------------+ @@ -463,9 +614,10 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithSurfaceAlreadyOnStack */ } -TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithRotatedOffAxisSurface) +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerAddedToOccludedRegionWithSurfaceAlreadyOnStack, layerAddedToOccludedRegionWithSurfaceAlreadyOnStack); + +void layerAddedToOccludedRegionWithRotatedOffAxisSurface(bool opaqueLayers) { - TestCCOcclusionTracker occlusion; const TransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); @@ -485,9 +637,9 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithRotatedOffAxisSurface TransformationMatrix layerTransform; layerTransform.translate(10, 10); - setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); - setLayerPropertiesForTesting(child.get(), childTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false); - setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), true); + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); + setLayerPropertiesForTesting(child.get(), childTransform, FloatPoint(30, 30), IntSize(500, 500)); + setLayerPropertiesForTesting(layer.get(), layerTransform, FloatPoint(0, 0), IntSize(500, 500), true, opaqueLayers); child->setMasksToBounds(true); @@ -501,6 +653,9 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithRotatedOffAxisSurface CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); + IntRect clippedLayerInChild = layerTransform.mapRect(layer->visibleLayerRect()); occlusion.enterTargetRenderSurface(child->renderSurface()); @@ -530,9 +685,6 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithRotatedOffAxisSurface EXPECT_FALSE(occlusion.unoccludedContentRect(parent.get(), clippedLayerInChild).isEmpty()); clippedLayerInChild.move(0, -1); - // Surface is not occluded by things that draw into itself. - EXPECT_EQ_RECT(IntRect(0, 0, 500, 500), occlusion.surfaceUnoccludedContentRect(child.get(), IntRect(0, 0, 500, 500))); - occlusion.markOccludedBehindLayer(child.get()); occlusion.finishedTargetRenderSurface(child.get(), child->renderSurface()); occlusion.leaveToTargetRenderSurface(parent->renderSurface()); @@ -544,15 +696,13 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithRotatedOffAxisSurface EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(75, 55, 1, 1))); EXPECT_EQ_RECT(IntRect(75, 55, 1, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(75, 55, 1, 1))); - - // Surface is not occluded by things that draw into itself. - EXPECT_EQ_RECT(IntRect(0, 0, 100, 100), occlusion.surfaceUnoccludedContentRect(parent.get(), IntRect(0, 0, 100, 100))); } -TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithMultipleOpaqueLayers) +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerAddedToOccludedRegionWithRotatedOffAxisSurface, layerAddedToOccludedRegionWithRotatedOffAxisSurface); + +void layerAddedToOccludedRegionWithMultipleOpaqueLayers(bool opaqueLayers) { // This is similar to the previous test but now we make a few opaque layers inside of |child| so that the occluded parts of child are not a simple rect. - TestCCOcclusionTracker occlusion; const TransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); @@ -568,10 +718,10 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithMultipleOpaqueLayers) childTransform.rotate(90); childTransform.translate(-250, -250); - setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); - setLayerPropertiesForTesting(child.get(), childTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false); - setLayerPropertiesForTesting(layer1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 440), true); - setLayerPropertiesForTesting(layer2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(10, 450), IntSize(500, 60), true); + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); + setLayerPropertiesForTesting(child.get(), childTransform, FloatPoint(30, 30), IntSize(500, 500)); + setLayerPropertiesForTesting(layer1.get(), identityMatrix, FloatPoint(10, 10), IntSize(500, 440), true, opaqueLayers); + setLayerPropertiesForTesting(layer2.get(), identityMatrix, FloatPoint(10, 450), IntSize(500, 60), true, opaqueLayers); child->setMasksToBounds(true); @@ -585,6 +735,9 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithMultipleOpaqueLayers) CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); + occlusion.enterTargetRenderSurface(child->renderSurface()); occlusion.markOccludedBehindLayer(layer2.get()); occlusion.markOccludedBehindLayer(layer1.get()); @@ -606,9 +759,6 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithMultipleOpaqueLayers) EXPECT_EQ_RECT(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child.get(), IntRect(11, 430, 60, 70))); EXPECT_EQ_RECT(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child.get(), IntRect(10, 431, 60, 70))); - // Surface is not occluded by things that draw into itself. - EXPECT_EQ_RECT(IntRect(10, 430, 60, 70), occlusion.surfaceUnoccludedContentRect(child.get(), IntRect(10, 430, 60, 70))); - occlusion.markOccludedBehindLayer(child.get()); occlusion.finishedTargetRenderSurface(child.get(), child->renderSurface()); occlusion.leaveToTargetRenderSurface(parent->renderSurface()); @@ -628,10 +778,6 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithMultipleOpaqueLayers) EXPECT_EQ_RECT(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent.get(), IntRect(31, 40, 70, 60))); EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(30, 41, 70, 60))); - // Surface is not occluded by things that draw into itself. - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.surfaceUnoccludedContentRect(parent.get(), IntRect(30, 40, 70, 60))); - - /* Justification for the above occlusion from |layer1| and |layer2|: +---------------------+ @@ -658,10 +804,11 @@ TEST(CCOcclusionTrackerTest, layerAddedToOccludedRegionWithMultipleOpaqueLayers) */ } -TEST(CCOcclusionTrackerTest, surfaceOcclusionWithOverlappingSiblingSurfaces) +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerAddedToOccludedRegionWithMultipleOpaqueLayers, layerAddedToOccludedRegionWithMultipleOpaqueLayers); + +void surfaceOcclusionWithOverlappingSiblingSurfaces(bool opaqueLayers) { // This tests that the right transforms are being used. - TestCCOcclusionTracker occlusion; const TransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child1 = LayerChromium::create(); @@ -679,11 +826,11 @@ TEST(CCOcclusionTrackerTest, surfaceOcclusionWithOverlappingSiblingSurfaces) childTransform.rotate(90); childTransform.translate(-250, -250); - setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); - setLayerPropertiesForTesting(child1.get(), childTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false); - setLayerPropertiesForTesting(layer1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), true); - setLayerPropertiesForTesting(child2.get(), childTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(20, 40), IntSize(500, 500), false); - setLayerPropertiesForTesting(layer2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), true); + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); + setLayerPropertiesForTesting(child1.get(), childTransform, FloatPoint(30, 30), IntSize(500, 500)); + setLayerPropertiesForTesting(layer1.get(), identityMatrix, FloatPoint(0, 0), IntSize(500, 500), true, opaqueLayers); + setLayerPropertiesForTesting(child2.get(), childTransform, FloatPoint(20, 40), IntSize(500, 500)); + setLayerPropertiesForTesting(layer2.get(), identityMatrix, FloatPoint(0, 0), IntSize(500, 500), true, opaqueLayers); child1->setMasksToBounds(true); child2->setMasksToBounds(true); @@ -698,6 +845,9 @@ TEST(CCOcclusionTrackerTest, surfaceOcclusionWithOverlappingSiblingSurfaces) CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + occlusion.setLayerScissorRect(IntRect(-10, -10, 1000, 1000)); + occlusion.enterTargetRenderSurface(child2->renderSurface()); occlusion.markOccludedBehindLayer(layer2.get()); @@ -712,9 +862,6 @@ TEST(CCOcclusionTrackerTest, surfaceOcclusionWithOverlappingSiblingSurfaces) EXPECT_FALSE(occlusion.occluded(child2.get(), IntRect(0, 420, 61, 80))); EXPECT_FALSE(occlusion.occluded(child2.get(), IntRect(0, 420, 60, 81))); - // Surface is not occluded by things that draw into itself. - EXPECT_EQ_RECT(IntRect(0, 420, 60, 80), occlusion.surfaceUnoccludedContentRect(child2.get(), IntRect(0, 420, 60, 80))); - occlusion.markOccludedBehindLayer(child2.get()); occlusion.finishedTargetRenderSurface(child2.get(), child2->renderSurface()); occlusion.leaveToTargetRenderSurface(parent->renderSurface()); @@ -732,9 +879,6 @@ TEST(CCOcclusionTrackerTest, surfaceOcclusionWithOverlappingSiblingSurfaces) EXPECT_FALSE(occlusion.occluded(child1.get(), IntRect(0, 430, 71, 70))); EXPECT_FALSE(occlusion.occluded(child1.get(), IntRect(0, 430, 70, 71))); - // Surface is not occluded by things that draw into itself, but the |child1| surface should be occluded by the |child2| surface. - EXPECT_EQ_RECT(IntRect(0, 430, 10, 70), occlusion.surfaceUnoccludedContentRect(child1.get(), IntRect(0, 430, 70, 70))); - occlusion.markOccludedBehindLayer(child1.get()); occlusion.finishedTargetRenderSurface(child1.get(), child1->renderSurface()); occlusion.leaveToTargetRenderSurface(parent->renderSurface()); @@ -754,10 +898,6 @@ TEST(CCOcclusionTrackerTest, surfaceOcclusionWithOverlappingSiblingSurfaces) EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(19, 40, 80, 60))); EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(20, 39, 80, 60))); - // |child1| and |child2| both draw into parent so they should not occlude it. - EXPECT_EQ_RECT(IntRect(20, 30, 80, 70), occlusion.surfaceUnoccludedContentRect(parent.get(), IntRect(20, 30, 80, 70))); - - /* Justification for the above occlusion: 100 +---------------------+ @@ -784,10 +924,11 @@ TEST(CCOcclusionTrackerTest, surfaceOcclusionWithOverlappingSiblingSurfaces) */ } -TEST(CCOcclusionTrackerTest, surfaceOcclusionInScreenSpace) +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_surfaceOcclusionWithOverlappingSiblingSurfaces, surfaceOcclusionWithOverlappingSiblingSurfaces); + +void surfaceOcclusionInScreenSpace(bool opaqueLayers) { // This tests that the right transforms are being used. - TestCCOcclusionTracker occlusion; const TransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child1 = LayerChromium::create(); @@ -806,11 +947,11 @@ TEST(CCOcclusionTrackerTest, surfaceOcclusionInScreenSpace) childTransform.translate(-250, -250); // The owning layers have very different bounds from the surfaces that they own. - setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); - setLayerPropertiesForTesting(child1.get(), childTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(10, 10), false); - setLayerPropertiesForTesting(layer1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(-10, -10), IntSize(510, 510), true); - setLayerPropertiesForTesting(child2.get(), childTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(20, 40), IntSize(10, 10), false); - setLayerPropertiesForTesting(layer2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(-10, -10), IntSize(510, 510), true); + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); + setLayerPropertiesForTesting(child1.get(), childTransform, FloatPoint(30, 30), IntSize(10, 10)); + setLayerPropertiesForTesting(layer1.get(), identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true, opaqueLayers); + setLayerPropertiesForTesting(child2.get(), childTransform, FloatPoint(20, 40), IntSize(10, 10)); + setLayerPropertiesForTesting(layer2.get(), identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true, opaqueLayers); // Make them both render surfaces FilterOperations filters; @@ -831,6 +972,9 @@ TEST(CCOcclusionTrackerTest, surfaceOcclusionInScreenSpace) CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + occlusion.setLayerScissorRect(IntRect(-20, -20, 1000, 1000)); + occlusion.enterTargetRenderSurface(child2->renderSurface()); occlusion.markOccludedBehindLayer(layer2.get()); @@ -845,9 +989,13 @@ TEST(CCOcclusionTrackerTest, surfaceOcclusionInScreenSpace) EXPECT_FALSE(occlusion.occluded(child2.get(), IntRect(-10, 420, 71, 80))); EXPECT_FALSE(occlusion.occluded(child2.get(), IntRect(-10, 420, 70, 81))); - // Surface is not occluded by things that draw into itself. - EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.surfaceUnoccludedContentRect(child2.get(), IntRect(-10, 420, 70, 80))); - EXPECT_FALSE(occlusion.surfaceOccluded(child2.get(), IntRect(30, 250, 1, 1))); + occlusion.useDefaultLayerScissorRect(); + EXPECT_TRUE(occlusion.occluded(child2.get(), IntRect(-10, 420, 70, 80))); + EXPECT_TRUE(occlusion.occluded(child2.get(), IntRect(-11, 420, 70, 80))); + EXPECT_TRUE(occlusion.occluded(child2.get(), IntRect(-10, 419, 70, 80))); + EXPECT_TRUE(occlusion.occluded(child2.get(), IntRect(-10, 420, 71, 80))); + EXPECT_TRUE(occlusion.occluded(child2.get(), IntRect(-10, 420, 70, 81))); + occlusion.setLayerScissorRect(IntRect(-20, -20, 1000, 1000)); occlusion.markOccludedBehindLayer(child2.get()); occlusion.finishedTargetRenderSurface(child2.get(), child2->renderSurface()); @@ -866,14 +1014,6 @@ TEST(CCOcclusionTrackerTest, surfaceOcclusionInScreenSpace) EXPECT_FALSE(occlusion.occluded(child1.get(), IntRect(-10, 430, 81, 70))); EXPECT_FALSE(occlusion.occluded(child1.get(), IntRect(-10, 430, 80, 71))); - // Surface is not occluded by things that draw into itself, but the |child1| surface should be occluded by the |child2| surface. - EXPECT_EQ_RECT(IntRect(-10, 430, 10, 80), occlusion.surfaceUnoccludedContentRect(child1.get(), IntRect(-10, 430, 70, 80))); - EXPECT_TRUE(occlusion.surfaceOccluded(child1.get(), IntRect(0, 430, 70, 80))); - EXPECT_FALSE(occlusion.surfaceOccluded(child1.get(), IntRect(-1, 430, 70, 80))); - EXPECT_FALSE(occlusion.surfaceOccluded(child1.get(), IntRect(0, 429, 70, 80))); - EXPECT_FALSE(occlusion.surfaceOccluded(child1.get(), IntRect(1, 430, 70, 80))); - EXPECT_FALSE(occlusion.surfaceOccluded(child1.get(), IntRect(0, 431, 70, 80))); - occlusion.markOccludedBehindLayer(child1.get()); occlusion.finishedTargetRenderSurface(child1.get(), child1->renderSurface()); occlusion.leaveToTargetRenderSurface(parent->renderSurface()); @@ -893,11 +1033,6 @@ TEST(CCOcclusionTrackerTest, surfaceOcclusionInScreenSpace) EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(19, 30, 80, 70))); EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(20, 29, 80, 70))); - // |child1| and |child2| both draw into parent so they should not occlude it. - EXPECT_EQ_RECT(IntRect(20, 20, 80, 80), occlusion.surfaceUnoccludedContentRect(parent.get(), IntRect(20, 20, 80, 80))); - EXPECT_FALSE(occlusion.surfaceOccluded(parent.get(), IntRect(50, 50, 1, 1))); - - /* Justification for the above occlusion: 100 +---------------------+ @@ -923,10 +1058,11 @@ TEST(CCOcclusionTrackerTest, surfaceOcclusionInScreenSpace) */ } -TEST(CCOcclusionTrackerTest, surfaceOcclusionInScreenSpaceDifferentTransforms) +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_surfaceOcclusionInScreenSpace, surfaceOcclusionInScreenSpace); + +void surfaceOcclusionInScreenSpaceDifferentTransforms(bool opaqueLayers) { // This tests that the right transforms are being used. - TestCCOcclusionTracker occlusion; const TransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child1 = LayerChromium::create(); @@ -950,11 +1086,11 @@ TEST(CCOcclusionTrackerTest, surfaceOcclusionInScreenSpaceDifferentTransforms) child2Transform.translate(-250, -250); // The owning layers have very different bounds from the surfaces that they own. - setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); - setLayerPropertiesForTesting(child1.get(), child1Transform, identityMatrix, FloatPoint(0, 0), FloatPoint(30, 20), IntSize(10, 10), false); - setLayerPropertiesForTesting(layer1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(-10, -20), IntSize(510, 520), true); - setLayerPropertiesForTesting(child2.get(), child2Transform, identityMatrix, FloatPoint(0, 0), FloatPoint(20, 40), IntSize(10, 10), false); - setLayerPropertiesForTesting(layer2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(-10, -10), IntSize(510, 510), true); + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); + setLayerPropertiesForTesting(child1.get(), child1Transform, FloatPoint(30, 20), IntSize(10, 10)); + setLayerPropertiesForTesting(layer1.get(), identityMatrix, FloatPoint(-10, -20), IntSize(510, 520), true, opaqueLayers); + setLayerPropertiesForTesting(child2.get(), child2Transform, FloatPoint(20, 40), IntSize(10, 10)); + setLayerPropertiesForTesting(layer2.get(), identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true, opaqueLayers); // Make them both render surfaces FilterOperations filters; @@ -975,6 +1111,9 @@ TEST(CCOcclusionTrackerTest, surfaceOcclusionInScreenSpaceDifferentTransforms) CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + occlusion.setLayerScissorRect(IntRect(-30, -30, 1000, 1000)); + occlusion.enterTargetRenderSurface(child2->renderSurface()); occlusion.markOccludedBehindLayer(layer2.get()); @@ -989,10 +1128,6 @@ TEST(CCOcclusionTrackerTest, surfaceOcclusionInScreenSpaceDifferentTransforms) EXPECT_FALSE(occlusion.occluded(child2.get(), IntRect(-10, 420, 71, 80))); EXPECT_FALSE(occlusion.occluded(child2.get(), IntRect(-10, 420, 70, 81))); - // Surface is not occluded by things that draw into itself. - EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.surfaceUnoccludedContentRect(child2.get(), IntRect(-10, 420, 70, 80))); - EXPECT_FALSE(occlusion.surfaceOccluded(child2.get(), IntRect(30, 250, 1, 1))); - occlusion.markOccludedBehindLayer(child2.get()); occlusion.finishedTargetRenderSurface(child2.get(), child2->renderSurface()); occlusion.leaveToTargetRenderSurface(parent->renderSurface()); @@ -1010,16 +1145,6 @@ TEST(CCOcclusionTrackerTest, surfaceOcclusionInScreenSpaceDifferentTransforms) EXPECT_FALSE(occlusion.occluded(child1.get(), IntRect(420, -19, 80, 90))); EXPECT_FALSE(occlusion.occluded(child1.get(), IntRect(421, -20, 80, 90))); - // Surface is not occluded by things that draw into itself, but the |child1| surface should be occluded by the |child2| surface. - EXPECT_EQ_RECT(IntRect(420, -20, 80, 90), occlusion.surfaceUnoccludedContentRect(child1.get(), IntRect(420, -20, 80, 90))); - EXPECT_EQ_RECT(IntRect(490, -10, 10, 80), occlusion.surfaceUnoccludedContentRect(child1.get(), IntRect(420, -10, 80, 80))); - EXPECT_EQ_RECT(IntRect(420, -20, 70, 10), occlusion.surfaceUnoccludedContentRect(child1.get(), IntRect(420, -20, 70, 90))); - EXPECT_TRUE(occlusion.surfaceOccluded(child1.get(), IntRect(420, -10, 70, 80))); - EXPECT_FALSE(occlusion.surfaceOccluded(child1.get(), IntRect(419, -10, 70, 80))); - EXPECT_FALSE(occlusion.surfaceOccluded(child1.get(), IntRect(420, -11, 70, 80))); - EXPECT_FALSE(occlusion.surfaceOccluded(child1.get(), IntRect(421, -10, 70, 80))); - EXPECT_FALSE(occlusion.surfaceOccluded(child1.get(), IntRect(420, -9, 70, 80))); - occlusion.markOccludedBehindLayer(child1.get()); occlusion.finishedTargetRenderSurface(child1.get(), child1->renderSurface()); occlusion.leaveToTargetRenderSurface(parent->renderSurface()); @@ -1035,14 +1160,6 @@ TEST(CCOcclusionTrackerTest, surfaceOcclusionInScreenSpaceDifferentTransforms) EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(11, 20, 90, 80))); EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(10, 21, 90, 80))); - // |child1| and |child2| both draw into parent so they should not occlude it. - EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), occlusion.surfaceUnoccludedContentRect(parent.get(), IntRect(10, 20, 90, 80))); - EXPECT_FALSE(occlusion.surfaceOccluded(parent.get(), IntRect(10, 20, 1, 1))); - EXPECT_FALSE(occlusion.surfaceOccluded(parent.get(), IntRect(99, 20, 1, 1))); - EXPECT_FALSE(occlusion.surfaceOccluded(parent.get(), IntRect(10, 9, 1, 1))); - EXPECT_FALSE(occlusion.surfaceOccluded(parent.get(), IntRect(99, 99, 1, 1))); - - /* Justification for the above occlusion: 100 +---------------------+ @@ -1068,10 +1185,11 @@ TEST(CCOcclusionTrackerTest, surfaceOcclusionInScreenSpaceDifferentTransforms) */ } -TEST(CCOcclusionTrackerTest, occlusionInteractionWithFilters) +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_surfaceOcclusionInScreenSpaceDifferentTransforms, surfaceOcclusionInScreenSpaceDifferentTransforms); + +void occlusionInteractionWithFilters(bool opaqueLayers) { // This tests that the right transforms are being used. - TestCCOcclusionTracker occlusion; const TransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> blurLayer = adoptRef(new LayerChromiumWithForcedDrawsContent()); @@ -1087,10 +1205,10 @@ TEST(CCOcclusionTrackerTest, occlusionInteractionWithFilters) layerTransform.rotate(90); layerTransform.translate(-250, -250); - setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); - setLayerPropertiesForTesting(blurLayer.get(), layerTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); - setLayerPropertiesForTesting(opaqueLayer.get(), layerTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); - setLayerPropertiesForTesting(opacityLayer.get(), layerTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); + setLayerPropertiesForTesting(blurLayer.get(), layerTransform, FloatPoint(30, 30), IntSize(500, 500), true, opaqueLayers); + setLayerPropertiesForTesting(opaqueLayer.get(), layerTransform, FloatPoint(30, 30), IntSize(500, 500), true, opaqueLayers); + setLayerPropertiesForTesting(opacityLayer.get(), layerTransform, FloatPoint(30, 30), IntSize(500, 500), true, opaqueLayers); { FilterOperations filters; @@ -1121,6 +1239,9 @@ TEST(CCOcclusionTrackerTest, occlusionInteractionWithFilters) CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); + // Opacity layer won't contribute to occlusion. occlusion.enterTargetRenderSurface(opacityLayer->renderSurface()); occlusion.markOccludedBehindLayer(opacityLayer.get()); @@ -1170,4 +1291,922 @@ TEST(CCOcclusionTrackerTest, occlusionInteractionWithFilters) EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_occlusionInteractionWithFilters, occlusionInteractionWithFilters); + +void layerScissorRectOverTile(bool opaqueLayers) +{ + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(parentLayer); + parent->addChild(layer); + + FilterOperations filters; + filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE)); + parentLayer->setFilters(filters); + layer->setFilters(filters); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); + setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers); + setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + occlusion.setLayerScissorRect(IntRect(200, 100, 100, 100)); + + occlusion.enterTargetRenderSurface(layer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(200, 100, 100, 100))); + + occlusion.useDefaultLayerScissorRect(); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(200, 100, 100, 100))); + occlusion.setLayerScissorRect(IntRect(200, 100, 100, 100)); + + occlusion.markOccludedBehindLayer(layer.get()); + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + occlusion.enterTargetRenderSurface(parentLayer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100))); + + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + + EXPECT_EQ_RECT(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300))); +} + +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerScissorRectOverTile, layerScissorRectOverTile); + +void screenScissorRectOverTile(bool opaqueLayers) +{ + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(parentLayer); + parent->addChild(layer); + + FilterOperations filters; + filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE)); + parentLayer->setFilters(filters); + layer->setFilters(filters); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); + setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers); + setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + TestCCOcclusionTracker occlusion(IntRect(200, 100, 100, 100)); + + occlusion.enterTargetRenderSurface(layer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100))); + + // Occluded since its outside the surface bounds. + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(200, 100, 100, 100))); + + // Test without any scissors. + occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(200, 100, 100, 100))); + occlusion.useDefaultLayerScissorRect(); + + occlusion.markOccludedBehindLayer(layer.get()); + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + occlusion.enterTargetRenderSurface(parentLayer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100))); + + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + + EXPECT_EQ_RECT(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300))); +} + +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_screenScissorRectOverTile, screenScissorRectOverTile); + +void layerScissorRectOverCulledTile(bool opaqueLayers) +{ + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(parentLayer); + parent->addChild(layer); + + FilterOperations filters; + filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE)); + parentLayer->setFilters(filters); + layer->setFilters(filters); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); + setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers); + setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + occlusion.setLayerScissorRect(IntRect(100, 100, 100, 100)); + + occlusion.enterTargetRenderSurface(layer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100))); + + occlusion.markOccludedBehindLayer(layer.get()); + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + occlusion.enterTargetRenderSurface(parentLayer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100))); + + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300)).isEmpty()); +} + +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerScissorRectOverCulledTile, layerScissorRectOverCulledTile); + +void screenScissorRectOverCulledTile(bool opaqueLayers) +{ + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(parentLayer); + parent->addChild(layer); + + FilterOperations filters; + filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE)); + parentLayer->setFilters(filters); + layer->setFilters(filters); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); + setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers); + setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + TestCCOcclusionTracker occlusion(IntRect(100, 100, 100, 100)); + + occlusion.enterTargetRenderSurface(layer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100))); + + occlusion.markOccludedBehindLayer(layer.get()); + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + occlusion.enterTargetRenderSurface(parentLayer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100))); + + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300)).isEmpty()); +} + +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_screenScissorRectOverCulledTile, screenScissorRectOverCulledTile); + +void layerScissorRectOverPartialTiles(bool opaqueLayers) +{ + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(parentLayer); + parent->addChild(layer); + + FilterOperations filters; + filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE)); + parentLayer->setFilters(filters); + layer->setFilters(filters); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); + setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers); + setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + occlusion.setLayerScissorRect(IntRect(50, 50, 200, 200)); + + occlusion.enterTargetRenderSurface(layer->renderSurface()); + + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100))); + + occlusion.markOccludedBehindLayer(layer.get()); + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + occlusion.enterTargetRenderSurface(parentLayer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100))); + + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + + EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300))); + EXPECT_EQ_RECT(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 100))); + EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 100, 300, 100))); + EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent.get(), IntRect(200, 100, 100, 100))); + EXPECT_EQ_RECT(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(100, 200, 100, 100))); +} + +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerScissorRectOverPartialTiles, layerScissorRectOverPartialTiles); + +void screenScissorRectOverPartialTiles(bool opaqueLayers) +{ + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(parentLayer); + parent->addChild(layer); + + FilterOperations filters; + filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE)); + parentLayer->setFilters(filters); + layer->setFilters(filters); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); + setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers); + setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + TestCCOcclusionTracker occlusion(IntRect(50, 50, 200, 200)); + + occlusion.enterTargetRenderSurface(layer->renderSurface()); + + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100))); + + occlusion.markOccludedBehindLayer(layer.get()); + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + occlusion.enterTargetRenderSurface(parentLayer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100))); + + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + + EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300))); + EXPECT_EQ_RECT(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 100))); + EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 100, 300, 100))); + EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent.get(), IntRect(200, 100, 100, 100))); + EXPECT_EQ_RECT(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(100, 200, 100, 100))); +} + +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_screenScissorRectOverPartialTiles, screenScissorRectOverPartialTiles); + +void layerScissorRectOverNoTiles(bool opaqueLayers) +{ + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(parentLayer); + parent->addChild(layer); + + FilterOperations filters; + filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE)); + parentLayer->setFilters(filters); + layer->setFilters(filters); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); + setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers); + setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + occlusion.setLayerScissorRect(IntRect(500, 500, 100, 100)); + + occlusion.enterTargetRenderSurface(layer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100))); + + occlusion.markOccludedBehindLayer(layer.get()); + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + occlusion.enterTargetRenderSurface(parentLayer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100))); + + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 100)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 100, 300, 100)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(200, 100, 100, 100)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(100, 200, 100, 100)).isEmpty()); +} + +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerScissorRectOverNoTiles, layerScissorRectOverNoTiles); + +void screenScissorRectOverNoTiles(bool opaqueLayers) +{ + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(parentLayer); + parent->addChild(layer); + + FilterOperations filters; + filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE)); + parentLayer->setFilters(filters); + layer->setFilters(filters); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); + setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers); + setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + TestCCOcclusionTracker occlusion(IntRect(500, 500, 100, 100)); + + occlusion.enterTargetRenderSurface(layer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100))); + + occlusion.markOccludedBehindLayer(layer.get()); + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + occlusion.enterTargetRenderSurface(parentLayer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100))); + + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 100)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 100, 300, 100)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(200, 100, 100, 100)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(100, 200, 100, 100)).isEmpty()); +} + +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_screenScissorRectOverNoTiles, screenScissorRectOverNoTiles); + +void layerScissorRectForLayerOffOrigin(bool opaqueLayers) +{ + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(parentLayer); + parent->addChild(layer); + + FilterOperations filters; + filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE)); + parentLayer->setFilters(filters); + layer->setFilters(filters); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); + setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers); + setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(100, 100), IntSize(200, 200), true, opaqueLayers); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + + occlusion.enterTargetRenderSurface(layer->renderSurface()); + + // This layer is translated when drawn into its target. So if the scissor rect given from the target surface + // is not in that target space, then after translating these query rects into the target, they will fall outside + // the scissor and be considered occluded. + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100))); +} + +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerScissorRectForLayerOffOrigin, layerScissorRectForLayerOffOrigin); + +void damageRectOverTile(bool opaqueLayers) +{ + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(parentLayer); + parent->addChild(layer); + + FilterOperations filters; + filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE)); + parentLayer->setFilters(filters); + layer->setFilters(filters); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); + setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers); + setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + TestDamageClient damage(FloatRect(200, 100, 100, 100)); + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000), &damage); + + occlusion.enterTargetRenderSurface(layer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100))); + + // Outside the layer's clip rect. + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(200, 100, 100, 100))); + + occlusion.markOccludedBehindLayer(layer.get()); + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + occlusion.enterTargetRenderSurface(parentLayer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100))); + + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + + EXPECT_EQ_RECT(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300))); +} + +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_damageRectOverTile, damageRectOverTile); + +void damageRectOverCulledTile(bool opaqueLayers) +{ + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(parentLayer); + parent->addChild(layer); + + FilterOperations filters; + filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE)); + parentLayer->setFilters(filters); + layer->setFilters(filters); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); + setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers); + setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + TestDamageClient damage(FloatRect(100, 100, 100, 100)); + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000), &damage); + + occlusion.enterTargetRenderSurface(layer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100))); + + occlusion.markOccludedBehindLayer(layer.get()); + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + occlusion.enterTargetRenderSurface(parentLayer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100))); + + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300)).isEmpty()); +} + +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_damageRectOverCulledTile, damageRectOverCulledTile); + +void damageRectOverPartialTiles(bool opaqueLayers) +{ + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(parentLayer); + parent->addChild(layer); + + FilterOperations filters; + filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE)); + parentLayer->setFilters(filters); + layer->setFilters(filters); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); + setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers); + setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + TestDamageClient damage(FloatRect(50, 50, 200, 200)); + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000), &damage); + + occlusion.enterTargetRenderSurface(layer->renderSurface()); + + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100))); + + occlusion.markOccludedBehindLayer(layer.get()); + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + occlusion.enterTargetRenderSurface(parentLayer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100))); + + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + + EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300))); + EXPECT_EQ_RECT(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 100))); + EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 100, 300, 100))); + EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent.get(), IntRect(200, 100, 100, 100))); + EXPECT_EQ_RECT(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(100, 200, 100, 100))); +} + +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_damageRectOverPartialTiles, damageRectOverPartialTiles); + +void damageRectOverNoTiles(bool opaqueLayers) +{ + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(parentLayer); + parent->addChild(layer); + + FilterOperations filters; + filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE)); + parentLayer->setFilters(filters); + layer->setFilters(filters); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); + setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers); + setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + TestDamageClient damage(FloatRect(500, 500, 100, 100)); + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000), &damage); + + occlusion.enterTargetRenderSurface(layer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100))); + + occlusion.markOccludedBehindLayer(layer.get()); + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + occlusion.enterTargetRenderSurface(parentLayer->renderSurface()); + + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100))); + + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 100)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 100, 300, 100)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(200, 100, 100, 100)).isEmpty()); + EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(100, 200, 100, 100)).isEmpty()); +} + +TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_damageRectOverNoTiles, damageRectOverNoTiles); + +TEST(CCOcclusionTrackerTest, opaqueContentsRegionEmpty) +{ + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(layer); + + FilterOperations filters; + filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE)); + layer->setFilters(filters); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); + setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), false, false); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + + occlusion.enterTargetRenderSurface(layer->renderSurface()); + + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100))); + + // Occluded since its outside the surface bounds. + EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(200, 100, 100, 100))); + + // Test without any scissors. + occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); + EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(200, 100, 100, 100))); + occlusion.useDefaultLayerScissorRect(); + + occlusion.markOccludedBehindLayer(layer.get()); + occlusion.leaveToTargetRenderSurface(parent->renderSurface()); + + EXPECT_TRUE(occlusion.occlusionInScreenSpace().bounds().isEmpty()); + EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); +} + +TEST(CCOcclusionTrackerTest, opaqueContentsRegionNonEmpty) +{ + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(layer); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); + setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(100, 100), IntSize(200, 200), false, false); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + { + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + layer->setOpaquePaintRect(IntRect(0, 0, 100, 100)); + + occlusion.enterTargetRenderSurface(parent->renderSurface()); + occlusion.markOccludedBehindLayer(layer.get()); + + EXPECT_EQ_RECT(IntRect(100, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); + + EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(0, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(100, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(200, 200, 100, 100))); + } + + { + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + layer->setOpaquePaintRect(IntRect(20, 20, 180, 180)); + + occlusion.enterTargetRenderSurface(parent->renderSurface()); + occlusion.markOccludedBehindLayer(layer.get()); + + EXPECT_EQ_RECT(IntRect(120, 120, 180, 180), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); + + EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(0, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(100, 100, 100, 100))); + EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(200, 200, 100, 100))); + } + + { + TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000)); + layer->setOpaquePaintRect(IntRect(150, 150, 100, 100)); + + occlusion.enterTargetRenderSurface(parent->renderSurface()); + occlusion.markOccludedBehindLayer(layer.get()); + + EXPECT_EQ_RECT(IntRect(250, 250, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); + + EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(0, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(100, 100, 100, 100))); + EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(200, 200, 100, 100))); + } +} + } // namespace diff --git a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp index d49703e14..42776bc94 100644 --- a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp +++ b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp @@ -64,6 +64,7 @@ void setQuads(CCSharedQuadState* rootState, CCSharedQuadState* childState, CCQua #define DECLARE_AND_INITIALIZE_TEST_QUADS \ CCQuadList quadList; \ + CCOverdrawCounts overdraw; \ TransformationMatrix childTransform; \ IntSize rootSize = IntSize(300, 300); \ IntRect rootRect = IntRect(IntPoint(), rootSize); \ @@ -79,8 +80,11 @@ TEST(CCQuadCullerTest, verifyCullChildLinesUpTopLeft) setQuads(rootState.get(), childState.get(), quadList); EXPECT_EQ(quadList.size(), 13u); - CCQuadCuller::cullOccludedQuads(quadList, false, IntRect()); + CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw); EXPECT_EQ(quadList.size(), 9u); + EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 90000, 1); + EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 0, 1); + EXPECT_NEAR(overdraw.m_pixelsCulled, 40000, 1); } TEST(CCQuadCullerTest, verifyCullWhenChildOpacityNotOne) @@ -92,8 +96,11 @@ TEST(CCQuadCullerTest, verifyCullWhenChildOpacityNotOne) setQuads(rootState.get(), childState.get(), quadList); EXPECT_EQ(quadList.size(), 13u); - CCQuadCuller::cullOccludedQuads(quadList, false, IntRect()); + CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw); EXPECT_EQ(quadList.size(), 13u); + EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 90000, 1); + EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 40000, 1); + EXPECT_NEAR(overdraw.m_pixelsCulled, 0, 1); } TEST(CCQuadCullerTest, verifyCullWhenChildOpaqueFlagFalse) @@ -105,8 +112,11 @@ TEST(CCQuadCullerTest, verifyCullWhenChildOpaqueFlagFalse) setQuads(rootState.get(), childState.get(), quadList); EXPECT_EQ(quadList.size(), 13u); - CCQuadCuller::cullOccludedQuads(quadList, false, IntRect()); + CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw); EXPECT_EQ(quadList.size(), 13u); + EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 90000, 1); + EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 40000, 1); + EXPECT_NEAR(overdraw.m_pixelsCulled, 0, 1); } TEST(CCQuadCullerTest, verifyCullCenterTileOnly) @@ -120,7 +130,7 @@ TEST(CCQuadCullerTest, verifyCullCenterTileOnly) setQuads(rootState.get(), childState.get(), quadList); EXPECT_EQ(quadList.size(), 13u); - CCQuadCuller::cullOccludedQuads(quadList, false, IntRect()); + CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw); EXPECT_EQ(quadList.size(), 12u); IntRect quadVisibleRect1 = quadList[1].get()->quadVisibleRect(); @@ -137,6 +147,10 @@ TEST(CCQuadCullerTest, verifyCullCenterTileOnly) IntRect quadVisibleRect6 = quadList[6].get()->quadVisibleRect(); EXPECT_EQ(quadVisibleRect6.height(), 50); EXPECT_EQ(quadVisibleRect6.y(), 250); + + EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 100000, 1); + EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 0, 1); + EXPECT_NEAR(overdraw.m_pixelsCulled, 30000, 1); } TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize1) @@ -158,8 +172,12 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize1) quadList.append(MakeTileQuad(childState.get(), IntRect(IntPoint(), IntSize(100, 100)))); EXPECT_EQ(quadList.size(), 2u); - CCQuadCuller::cullOccludedQuads(quadList, false, IntRect()); + CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw); EXPECT_EQ(quadList.size(), 2u); + + EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 20363, 1); + EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 0, 1); + EXPECT_NEAR(overdraw.m_pixelsCulled, 0, 1); } TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize2) @@ -181,8 +199,12 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize2) quadList.append(MakeTileQuad(childState.get(), IntRect(IntPoint(), IntSize(100, 100)))); EXPECT_EQ(quadList.size(), 2u); - CCQuadCuller::cullOccludedQuads(quadList, false, IntRect()); + CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw); EXPECT_EQ(quadList.size(), 2u); + + EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 19643, 1); + EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 0, 1); + EXPECT_NEAR(overdraw.m_pixelsCulled, 0, 1); } TEST(CCQuadCullerTest, verifyCullChildLinesUpBottomRight) @@ -196,8 +218,11 @@ TEST(CCQuadCullerTest, verifyCullChildLinesUpBottomRight) setQuads(rootState.get(), childState.get(), quadList); EXPECT_EQ(quadList.size(), 13u); - CCQuadCuller::cullOccludedQuads(quadList, false, IntRect()); + CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw); EXPECT_EQ(quadList.size(), 9u); + EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 90000, 1); + EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 0, 1); + EXPECT_NEAR(overdraw.m_pixelsCulled, 40000, 1); } TEST(CCQuadCullerTest, verifyCullSubRegion) @@ -212,8 +237,11 @@ TEST(CCQuadCullerTest, verifyCullSubRegion) setQuads(rootState.get(), childState.get(), quadList, childOpaqueRect); EXPECT_EQ(quadList.size(), 13u); - CCQuadCuller::cullOccludedQuads(quadList, false, IntRect()); + CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw); EXPECT_EQ(quadList.size(), 12u); + EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 90000, 1); + EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 30000, 1); + EXPECT_NEAR(overdraw.m_pixelsCulled, 10000, 1); } TEST(CCQuadCullerTest, verifyCullSubRegion2) @@ -228,8 +256,11 @@ TEST(CCQuadCullerTest, verifyCullSubRegion2) setQuads(rootState.get(), childState.get(), quadList, childOpaqueRect); EXPECT_EQ(quadList.size(), 13u); - CCQuadCuller::cullOccludedQuads(quadList, false, IntRect()); + CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw); EXPECT_EQ(quadList.size(), 12u); + EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 90000, 1); + EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 25000, 1); + EXPECT_NEAR(overdraw.m_pixelsCulled, 15000, 1); } TEST(CCQuadCullerTest, verifyCullSubRegionCheckOvercull) @@ -244,7 +275,7 @@ TEST(CCQuadCullerTest, verifyCullSubRegionCheckOvercull) setQuads(rootState.get(), childState.get(), quadList, childOpaqueRect); EXPECT_EQ(quadList.size(), 13u); - CCQuadCuller::cullOccludedQuads(quadList, false, IntRect()); + CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw); EXPECT_EQ(quadList.size(), 13u); } @@ -260,8 +291,11 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude) setQuads(rootState.get(), childState.get(), quadList); EXPECT_EQ(quadList.size(), 13u); - CCQuadCuller::cullOccludedQuads(quadList, false, IntRect()); + CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw); EXPECT_EQ(quadList.size(), 13u); + EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 130000, 1); + EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 0, 1); + EXPECT_NEAR(overdraw.m_pixelsCulled, 0, 1); } // This test requires some explanation: here we are rotating the quads to be culled. @@ -282,11 +316,14 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsSafelyCulled) setQuads(rootState.get(), childState.get(), quadList); EXPECT_EQ(quadList.size(), 13u); - CCQuadCuller::cullOccludedQuads(quadList, false, IntRect()); + CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw); EXPECT_EQ(quadList.size(), 12u); + EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 120000, 1); + EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 0, 1); + EXPECT_NEAR(overdraw.m_pixelsCulled, 10000, 1); } -TEST(CCQuadCullerTest, veriftyCullOutsideScissorOverTile) +TEST(CCQuadCullerTest, verifyCullOutsideScissorOverTile) { DECLARE_AND_INITIALIZE_TEST_QUADS @@ -295,11 +332,14 @@ TEST(CCQuadCullerTest, veriftyCullOutsideScissorOverTile) setQuads(rootState.get(), childState.get(), quadList); EXPECT_EQ(quadList.size(), 13u); - CCQuadCuller::cullOccludedQuads(quadList, true, IntRect(200, 100, 100, 100)); + CCQuadCuller::cullOccludedQuads(quadList, true, IntRect(200, 100, 100, 100), &overdraw); EXPECT_EQ(quadList.size(), 1u); + EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 10000, 1); + EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 0, 1); + EXPECT_NEAR(overdraw.m_pixelsCulled, 120000, 1); } -TEST(CCQuadCullerTest, veriftyCullOutsideScissorOverCulledTile) +TEST(CCQuadCullerTest, verifyCullOutsideScissorOverCulledTile) { DECLARE_AND_INITIALIZE_TEST_QUADS @@ -308,11 +348,11 @@ TEST(CCQuadCullerTest, veriftyCullOutsideScissorOverCulledTile) setQuads(rootState.get(), childState.get(), quadList); EXPECT_EQ(quadList.size(), 13u); - CCQuadCuller::cullOccludedQuads(quadList, true, IntRect(100, 100, 100, 100)); + CCQuadCuller::cullOccludedQuads(quadList, true, IntRect(100, 100, 100, 100), &overdraw); EXPECT_EQ(quadList.size(), 1u); } -TEST(CCQuadCullerTest, veriftyCullOutsideScissorOverPartialTiles) +TEST(CCQuadCullerTest, verifyCullOutsideScissorOverPartialTiles) { DECLARE_AND_INITIALIZE_TEST_QUADS @@ -321,11 +361,11 @@ TEST(CCQuadCullerTest, veriftyCullOutsideScissorOverPartialTiles) setQuads(rootState.get(), childState.get(), quadList); EXPECT_EQ(quadList.size(), 13u); - CCQuadCuller::cullOccludedQuads(quadList, true, IntRect(50, 50, 200, 200)); + CCQuadCuller::cullOccludedQuads(quadList, true, IntRect(50, 50, 200, 200), &overdraw); EXPECT_EQ(quadList.size(), 9u); } -TEST(CCQuadCullerTest, veriftyCullOutsideScissorOverNoTiles) +TEST(CCQuadCullerTest, verifyCullOutsideScissorOverNoTiles) { DECLARE_AND_INITIALIZE_TEST_QUADS @@ -334,8 +374,11 @@ TEST(CCQuadCullerTest, veriftyCullOutsideScissorOverNoTiles) setQuads(rootState.get(), childState.get(), quadList); EXPECT_EQ(quadList.size(), 13u); - CCQuadCuller::cullOccludedQuads(quadList, true, IntRect(500, 500, 100, 100)); + CCQuadCuller::cullOccludedQuads(quadList, true, IntRect(500, 500, 100, 100), &overdraw); EXPECT_EQ(quadList.size(), 0u); + EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 0, 1); + EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 0, 1); + EXPECT_NEAR(overdraw.m_pixelsCulled, 130000, 1); } diff --git a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp index c3b366dda..1201587c7 100644 --- a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp +++ b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp @@ -54,7 +54,7 @@ TEST(CCRenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) // This will fake that we are on the correct thread for testing purposes. DebugScopedSetImplThread setImplThread; - RefPtr<CCLayerImpl> owningLayer = CCLayerImpl::create(0); + OwnPtr<CCLayerImpl> owningLayer = CCLayerImpl::create(0); owningLayer->createRenderSurface(); ASSERT_TRUE(owningLayer->renderSurface()); CCRenderSurface* renderSurface = owningLayer->renderSurface(); @@ -74,7 +74,7 @@ TEST(CCRenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setClipRect(testRect)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setContentRect(testRect)); - RefPtr<CCLayerImpl> dummyMask = CCLayerImpl::create(1); + OwnPtr<CCLayerImpl> dummyMask = CCLayerImpl::create(1); TransformationMatrix dummyMatrix; dummyMatrix.translate(1.0, 2.0); diff --git a/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp b/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp index 3908f40a9..0853e5a36 100644 --- a/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp +++ b/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp @@ -604,4 +604,178 @@ TEST(CCSchedulerStateMachineTest, TestGoesInvisibleMidCommit) EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); } +TEST(CCSchedulerStateMachineTest, TestContextLostWhenCompletelyIdle) +{ + StateMachine state; + state.setVisible(true); + + state.didLoseContext(); + + EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); + state.updateState(state.nextAction()); + + // Once context recreation begins, nothing should happen. + EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + + // Recreate the context + state.didRecreateContext(); + + // When the context is recreated, we should begin a commit + EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + state.updateState(state.nextAction()); +} + +TEST(CCSchedulerStateMachineTest, TestContextLostWhenIdleAndCommitRequestedWhileRecreating) +{ + StateMachine state; + state.setVisible(true); + + state.didLoseContext(); + + EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); + state.updateState(state.nextAction()); + + // Once context recreation begins, nothing should happen. + EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + + // While context is recreating, commits shouldn't begin. + state.setNeedsCommit(true); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + + // Recreate the context + state.didRecreateContext(); + + // When the context is recreated, we should begin a commit + EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + state.updateState(state.nextAction()); + + // Once the context is recreated, whether we draw should be based on + // setCanDraw. + state.setNeedsRedraw(true); + state.didEnterVSync(); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction()); + state.setCanDraw(false); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + state.setCanDraw(true); + state.didLeaveVSync(); +} + +TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgress) +{ + StateMachine state; + state.setVisible(true); + + // Get a commit in flight. + state.setNeedsCommit(true); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + state.updateState(state.nextAction()); + + // Set damage and expect a draw. + state.setNeedsRedraw(true); + state.didEnterVSync(); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction()); + state.updateState(state.nextAction()); + state.didLeaveVSync(); + + // Cause a lost context while the begin frame is in flight. + state.didLoseContext(); + + // Ask for another draw. Expect nothing happens. + state.setNeedsRedraw(true); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + + // Finish the frame, update resources, and commit. + state.beginFrameComplete(); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_UPDATE_MORE_RESOURCES, state.nextAction()); + state.updateState(state.nextAction()); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + state.beginUpdateMoreResourcesComplete(false); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction()); + state.updateState(state.nextAction()); + + // Expect to be told to begin context recreation, independent of vsync state + state.didEnterVSync(); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); + state.didLeaveVSync(); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); +} + +TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgressAndAnotherCommitRequested) +{ + StateMachine state; + state.setVisible(true); + + // Get a commit in flight. + state.setNeedsCommit(true); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + state.updateState(state.nextAction()); + + // Set damage and expect a draw. + state.setNeedsRedraw(true); + state.didEnterVSync(); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction()); + state.updateState(state.nextAction()); + state.didLeaveVSync(); + + // Cause a lost context while the begin frame is in flight. + state.didLoseContext(); + + // Ask for another draw and also set needs commit. Expect nothing happens. + // Setting another commit will put us into + // COMMIT_STATE_WAITING_FOR_FIRST_DRAW after we finish the frame on the main + // thread. + state.setNeedsRedraw(true); + state.setNeedsCommit(true); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + + // Finish the frame, update resources, and commit. + state.beginFrameComplete(); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_UPDATE_MORE_RESOURCES, state.nextAction()); + state.updateState(state.nextAction()); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + state.beginUpdateMoreResourcesComplete(false); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction()); + state.updateState(state.nextAction()); + + EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState()); + + EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction()); + state.updateState(state.nextAction()); + + // Expect to be told to begin context recreation, independent of vsync state + state.didEnterVSync(); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); + state.didLeaveVSync(); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); +} + + +TEST(CCSchedulerStateMachineTest, TestFinishAllRenderingWhileContextLost) +{ + StateMachine state; + state.setVisible(true); + + // Cause a lost context lost. + state.didLoseContext(); + + // Ask a forced redraw and verify it ocurrs. + state.setNeedsForcedRedraw(true); + state.didEnterVSync(); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction()); + state.didLeaveVSync(); + + // Clear the forced redraw bit. + state.setNeedsForcedRedraw(false); + + // Expect to be told to begin context recreation, independent of vsync state + EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_CONTEXT_RECREATION, state.nextAction()); + state.updateState(state.nextAction()); + + // Ask a forced redraw and verify it ocurrs. + state.setNeedsForcedRedraw(true); + state.didEnterVSync(); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction()); + state.didLeaveVSync(); +} + } diff --git a/Source/WebKit/chromium/tests/CCSchedulerTest.cpp b/Source/WebKit/chromium/tests/CCSchedulerTest.cpp index 475987f13..45f61b90b 100644 --- a/Source/WebKit/chromium/tests/CCSchedulerTest.cpp +++ b/Source/WebKit/chromium/tests/CCSchedulerTest.cpp @@ -59,6 +59,7 @@ public: virtual void scheduledActionDrawAndSwap() { m_actions.push_back("scheduledActionDrawAndSwap"); } virtual void scheduledActionUpdateMoreResources() { m_actions.push_back("scheduledActionUpdateMoreResources"); } virtual void scheduledActionCommit() { m_actions.push_back("scheduledActionCommit"); } + virtual void scheduledActionBeginContextRecreation() { m_actions.push_back("scheduledActionBeginContextRecreation"); } protected: bool m_hasMoreResourceUpdates; @@ -158,6 +159,7 @@ public: virtual void scheduledActionUpdateMoreResources() { } virtual void scheduledActionCommit() { } + virtual void scheduledActionBeginContextRecreation() { } protected: int m_numDraws; @@ -215,6 +217,7 @@ public: virtual void scheduledActionUpdateMoreResources() { } virtual void scheduledActionCommit() { } + virtual void scheduledActionBeginContextRecreation() { } protected: int m_numDraws; diff --git a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp index 059ef2adc..02dc908ab 100644 --- a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp @@ -46,7 +46,7 @@ TEST(CCSolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap) IntSize layerSize = IntSize(800, 600); IntRect visibleLayerRect = IntRect(IntPoint(), layerSize); - RefPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(0); + OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(0); layer->setVisibleLayerRect(visibleLayerRect); layer->setBounds(layerSize); @@ -66,7 +66,7 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) IntSize layerSize = IntSize(100, 100); IntRect visibleLayerRect = IntRect(IntPoint(), layerSize); - RefPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(0); + OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(0); layer->setVisibleLayerRect(visibleLayerRect); layer->setBounds(layerSize); layer->setBackgroundColor(testColor); diff --git a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp index d55c0bc16..ff7daa3c9 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp @@ -39,9 +39,9 @@ namespace { // Create a default tiled layer with textures for all tiles and a default // visibility of the entire layer size. -static PassRefPtr<CCTiledLayerImpl> createLayer(const IntSize& tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexels) +static PassOwnPtr<CCTiledLayerImpl> createLayer(const IntSize& tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexels) { - RefPtr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(0); + OwnPtr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(0); OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(tileSize, borderTexels); tiler->setBounds(layerSize); layer->setTilingData(*tiler); @@ -68,7 +68,7 @@ TEST(CCTiledLayerImplTest, emptyQuadList) // Verify default layer does creates quads { - RefPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); + OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); CCQuadList quads; OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); layer->appendQuads(quads, sharedQuadState.get()); @@ -78,7 +78,7 @@ TEST(CCTiledLayerImplTest, emptyQuadList) // Layer with empty visible layer rect produces no quads { - RefPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); + OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); layer->setVisibleLayerRect(IntRect()); CCQuadList quads; @@ -89,7 +89,7 @@ TEST(CCTiledLayerImplTest, emptyQuadList) // Layer with non-intersecting visible layer rect produces no quads { - RefPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); + OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); IntRect outsideBounds(IntPoint(-100, -100), IntSize(50, 50)); layer->setVisibleLayerRect(outsideBounds); @@ -102,7 +102,7 @@ TEST(CCTiledLayerImplTest, emptyQuadList) // Layer with skips draw produces no quads { - RefPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); + OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); layer->setSkipsDraw(true); CCQuadList quads; @@ -121,7 +121,7 @@ TEST(CCTiledLayerImplTest, checkerboarding) const int numTilesY = 2; const IntSize layerSize(tileSize.width() * numTilesX, tileSize.height() * numTilesY); - RefPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); + OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); // No checkerboarding @@ -150,7 +150,7 @@ TEST(CCTiledLayerImplTest, checkerboarding) static PassOwnPtr<CCSharedQuadState> getQuads(CCQuadList& quads, IntSize tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleLayerRect) { - RefPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTexelOption); + OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTexelOption); layer->setVisibleLayerRect(visibleLayerRect); layer->setBounds(layerSize); @@ -260,7 +260,7 @@ TEST(CCTiledLayerImplTest, backgroundCoversViewport) const int numTilesY = 2; const unsigned numTiles = numTilesX * numTilesY; const IntSize layerSize(tileSize.width() * numTilesX, tileSize.height() * numTilesY); - RefPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); + OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); layer->setBackgroundColor(Color::gray); layer->setBackgroundCoversViewport(true); diff --git a/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp index ec0ce0c6a..580f15791 100644 --- a/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp @@ -131,7 +131,7 @@ protected: canvas->setBounds(IntSize(600, 300)); canvas->setTextureId(backTextureId); - canvas->contentChanged(); + canvas->setNeedsDisplay(); EXPECT_TRUE(canvas->needsDisplay()); Region occludedScreenSpace; canvas->paintContentsIfDirty(occludedScreenSpace); @@ -139,7 +139,7 @@ protected: { DebugScopedSetImplThread scopedImplThread; - RefPtr<CCLayerImpl> layerImpl = canvas->createCCLayerImpl(); + OwnPtr<CCLayerImpl> layerImpl = canvas->createCCLayerImpl(); EXPECT_EQ(0u, static_cast<CCCanvasLayerImpl*>(layerImpl.get())->textureId()); canvas->updateCompositorResources(implContext.get(), updater); diff --git a/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h b/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h index 23231038a..38876d737 100755 --- a/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h +++ b/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h @@ -37,12 +37,12 @@ public: virtual void updateAnimations(double frameBeginTime) { } virtual void layout() { } virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) { } - virtual PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D() + virtual PassRefPtr<GraphicsContext3D> createContext() { GraphicsContext3D::Attributes attrs; return createCompositorMockGraphicsContext3D(attrs); } - virtual void didRecreateGraphicsContext(bool success) { } + virtual void didRecreateContext(bool success) { } virtual void didCommitAndDrawFrame() { } virtual void didCompleteSwapBuffers() { } diff --git a/Source/WebKit/chromium/tests/FakeWebGraphicsContext3D.h b/Source/WebKit/chromium/tests/FakeWebGraphicsContext3D.h index ae27da730..268dc1da3 100644 --- a/Source/WebKit/chromium/tests/FakeWebGraphicsContext3D.h +++ b/Source/WebKit/chromium/tests/FakeWebGraphicsContext3D.h @@ -35,8 +35,6 @@ namespace WebKit { // All operations are no-ops (returning 0 if necessary). class FakeWebGraphicsContext3D : public WebGraphicsContext3D { public: - virtual bool initialize(Attributes, WebView*, bool renderDirectlyToWebView) { return false; } - virtual bool makeContextCurrent() { return true; } virtual int width() { return 0; } diff --git a/Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp b/Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp index adceadf08..d60295a5f 100644 --- a/Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp +++ b/Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp @@ -95,7 +95,7 @@ void checkKeyPathNumberValue(SerializedScriptValue* value, const String& keyPath TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyStringValue) { - V8LocalContext v8context; + V8AuxiliaryContext v8context; v8::Local<v8::Object> object = v8::Object::New(); object->Set(v8::String::New("foo"), v8::String::New("zoo")); @@ -107,7 +107,7 @@ TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyStringValue) TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyNumberValue) { - V8LocalContext v8context; + V8AuxiliaryContext v8context; v8::Local<v8::Object> object = v8::Object::New(); object->Set(v8::String::New("foo"), v8::Number::New(456)); @@ -119,7 +119,7 @@ TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyNumberValue) TEST(IDBKeyFromValueAndKeyPathTest, SubProperty) { - V8LocalContext v8context; + V8AuxiliaryContext v8context; v8::Local<v8::Object> object = v8::Object::New(); v8::Local<v8::Object> subProperty = v8::Object::New(); subProperty->Set(v8::String::New("bar"), v8::String::New("zee")); @@ -133,7 +133,7 @@ TEST(IDBKeyFromValueAndKeyPathTest, SubProperty) TEST(InjectIDBKeyTest, TopLevelPropertyStringValue) { - V8LocalContext v8context; + V8AuxiliaryContext v8context; v8::Local<v8::Object> object = v8::Object::New(); object->Set(v8::String::New("foo"), v8::String::New("zoo")); @@ -145,7 +145,7 @@ TEST(InjectIDBKeyTest, TopLevelPropertyStringValue) TEST(InjectIDBKeyTest, SubProperty) { - V8LocalContext v8context; + V8AuxiliaryContext v8context; v8::Local<v8::Object> object = v8::Object::New(); v8::Local<v8::Object> subProperty = v8::Object::New(); subProperty->Set(v8::String::New("bar"), v8::String::New("zee")); diff --git a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp index 2e9ca9661..d8858cc12 100644 --- a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp @@ -489,7 +489,6 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) EXPECT_FALSE(testLayer->needsDisplay()); // Test properties that should not call needsDisplay and needsCommit when changed. - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setName("Test Layer")); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setVisibleLayerRect(IntRect(0, 0, 40, 50))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setUsesLayerClipping(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setIsNonCompositedContent(true)); @@ -515,10 +514,13 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setReplicaLayer(dummyLayer.get())); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setSublayerTransform(TransformationMatrix(0, 0, 0, 0, 0, 0))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setScrollable(true)); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setShouldScrollOnMainThread(true)); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setNonFastScrollableRegion(Region(IntRect(1, 1, 2, 2)))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setHaveWheelEventHandlers(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setScrollPosition(IntPoint(10, 10))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setTransform(TransformationMatrix(0, 0, 0, 0, 0, 0))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setDoubleSided(false)); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setDebugName("Test Layer")); // The above tests should not have caused a change to the needsDisplay flag. EXPECT_FALSE(testLayer->needsDisplay()); diff --git a/Source/WebKit/chromium/tests/LocalizedNumberICUTest.cpp b/Source/WebKit/chromium/tests/LocalizedNumberICUTest.cpp new file mode 100644 index 000000000..6203d35d7 --- /dev/null +++ b/Source/WebKit/chromium/tests/LocalizedNumberICUTest.cpp @@ -0,0 +1,81 @@ +/* + * 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 "LocalizedNumberICU.h" + +#include <gtest/gtest.h> +#include <wtf/PassOwnPtr.h> + +using namespace WebCore; + +void testNumberIsReversible(const char* localeString, const char* original, const char* shouldHave = 0) +{ + OwnPtr<ICULocale> locale = ICULocale::create(localeString); + String localized = locale->convertToLocalizedNumber(original); + if (shouldHave) + EXPECT_TRUE(localized.contains(shouldHave)); + String converted = locale->convertFromLocalizedNumber(localized); + EXPECT_EQ(original, converted); +} + +void testNumbers(const char* localeString) +{ + testNumberIsReversible(localeString, "123456789012345678901234567890"); + testNumberIsReversible(localeString, "-123.456"); + testNumberIsReversible(localeString, ".456"); + testNumberIsReversible(localeString, "-0.456"); +} + +TEST(LocalizedNumberICUTest, Reversible) +{ + testNumberIsReversible("en_US", "123456789012345678901234567890"); + testNumberIsReversible("en_US", "-123.456", "."); + testNumberIsReversible("en_US", ".456", "."); + testNumberIsReversible("en_US", "-0.456", "."); + + testNumberIsReversible("fr", "123456789012345678901234567890"); + testNumberIsReversible("fr", "-123.456", ","); + testNumberIsReversible("fr", ".456", ","); + testNumberIsReversible("fr", "-0.456", ","); + + // Persian locale has a negative prefix and a negative suffix. + testNumbers("fa"); + + // Test some of major locales. + testNumbers("ar"); + testNumbers("de_DE"); + testNumbers("es_ES"); + testNumbers("ja_JP"); + testNumbers("ko_KR"); + testNumbers("zh_CN"); + testNumbers("zh_HK"); + testNumbers("zh_TW"); +} diff --git a/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp b/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp index d097c499a..b0d86ddf6 100644 --- a/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp +++ b/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp @@ -641,4 +641,44 @@ TEST(PlatformContextSkiaTest, layerTransformScaleOpaqueTest) EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect()); } +TEST(PlatformContextSkiaTest, contextTransparencyLayerTest) +{ + SkBitmap bitmap; + bitmap.setConfig(SkBitmap::kARGB_8888_Config, 400, 400); + bitmap.allocPixels(); + bitmap.eraseColor(0); + SkCanvas canvas(bitmap); + AffineTransform transform; + transform.scale(2); + + PlatformContextSkia platformContext(&canvas); + platformContext.setTrackOpaqueRegion(true); + platformContext.setOpaqueRegionTransform(transform); + GraphicsContext context(&platformContext); + + Color opaque(1.0f, 0.0f, 0.0f, 1.0f); + + context.fillRect(FloatRect(20, 20, 10, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(40, 40, 20, 20), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, transform.inverse().mapRect(platformContext.opaqueRegion().asRect())); + + context.clearRect(FloatRect(20, 20, 10, 10)); + EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect()); + + context.beginTransparencyLayer(0.5); + context.save(); + context.fillRect(FloatRect(20, 20, 10, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + context.restore(); + context.endTransparencyLayer(); + EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect()); + + context.clearRect(FloatRect(20, 20, 10, 10)); + EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect()); + + context.beginTransparencyLayer(0.5); + context.fillRect(FloatRect(20, 20, 10, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + context.endTransparencyLayer(); + EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect()); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/PlatformGestureCurveTest.cpp b/Source/WebKit/chromium/tests/PlatformGestureCurveTest.cpp new file mode 100644 index 000000000..74ca57667 --- /dev/null +++ b/Source/WebKit/chromium/tests/PlatformGestureCurveTest.cpp @@ -0,0 +1,119 @@ +/* + * 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 "PlatformGestureCurve.h" + +#include "ActivePlatformGestureAnimation.h" +#include "PlatformGestureCurveTarget.h" +#include "TouchFlingPlatformGestureCurve.h" +#include "WheelFlingPlatformGestureCurve.h" +#include "cc/CCActiveGestureAnimation.h" +#include "cc/CCGestureCurve.h" +#include <gtest/gtest.h> +#include <wtf/OwnPtr.h> + +namespace { + +using namespace WebCore; + +class MockPlatformGestureCurveTarget : public PlatformGestureCurveTarget { +public: + virtual void setScrollIncrement(const IntPoint& delta) + { + m_cumulativeDelta = m_cumulativeDelta + delta; + } + + IntPoint cumulativeDelta() const { return m_cumulativeDelta; } + void resetCumulativeDelta() { m_cumulativeDelta = IntPoint(); } + +private: + IntPoint m_cumulativeDelta; +}; + +TEST(PlatformGestureCurve, flingCurve) +{ + MockPlatformGestureCurveTarget target; + OwnPtr<ActivePlatformGestureAnimation> animation = ActivePlatformGestureAnimation::create(0, WheelFlingPlatformGestureCurve::create(FloatPoint(100, 0)), &target); + + // Note: the expectations below are dependent on the value of sigma hard-coded in the Rayleigh + // curve. If sigma changes, these test expectations will also change. + EXPECT_TRUE(animation->animate(0)); + EXPECT_TRUE(animation->animate(0.25)); + EXPECT_TRUE(animation->animate(0.45)); // Use non-uniform tick spacing. + EXPECT_TRUE(animation->animate(0.75)); + EXPECT_TRUE(animation->animate(1000)); + EXPECT_FALSE(animation->animate(1001)); + // Since the Rayleigh CDF maxes out at 1, we expect the cumulative scroll increments to + // match the input velocity parameter. + // Since we can be off by +/-0.5 on each conversion to int for setScrollIncrement, + // pick the 'nearness' to be within the number of times animate returns true. + EXPECT_NEAR(target.cumulativeDelta().x(), 100, 1); + EXPECT_EQ(target.cumulativeDelta().y(), 0); + + double baseTime = 42.42; + animation = ActivePlatformGestureAnimation::create(baseTime, WheelFlingPlatformGestureCurve::create(FloatPoint(100, 0)), &target); + target.resetCumulativeDelta(); + + EXPECT_TRUE(animation->animate(baseTime + 0.35)); + EXPECT_TRUE(animation->animate(baseTime + 1.35)); + EXPECT_FALSE(animation->animate(baseTime + 1000)); + EXPECT_NEAR(target.cumulativeDelta().x(), 100, 1); + + animation = ActivePlatformGestureAnimation::create(0, WheelFlingPlatformGestureCurve::create(FloatPoint(50, 150)), &target); + target.resetCumulativeDelta(); + + EXPECT_TRUE(animation->animate(0)); + EXPECT_TRUE(animation->animate(0.25)); + EXPECT_TRUE(animation->animate(0.45)); + EXPECT_TRUE(animation->animate(0.75)); + EXPECT_TRUE(animation->animate(1000)); + EXPECT_FALSE(animation->animate(1001)); + EXPECT_NEAR(target.cumulativeDelta().x(), 50, 1); + EXPECT_NEAR(target.cumulativeDelta().y(), 150, 1); +} + +TEST(PlatformGestureCurve, flingCurveTouch) +{ + MockPlatformGestureCurveTarget target; + OwnPtr<ActivePlatformGestureAnimation> animation = ActivePlatformGestureAnimation::create(0, TouchFlingPlatformGestureCurve::create(FloatPoint(1000, 0)), &target); + + // Note: the expectations below are dependent on the value of sigma hard-coded in the Rayleigh + // curve. If sigma changes, these test expectations will also change. + EXPECT_TRUE(animation->animate(0)); + EXPECT_TRUE(animation->animate(0.25)); + EXPECT_TRUE(animation->animate(0.45)); // Use non-uniform tick spacing. + EXPECT_TRUE(animation->animate(0.75)); + EXPECT_TRUE(animation->animate(0.9)); + EXPECT_TRUE(animation->animate(1000)); + EXPECT_FALSE(animation->animate(1001)); + // Since we can be off by +/-0.5 on each conversion to int for setScrollIncrement, + // pick the 'nearness' to be within the 5 * number of times animate returns true. + EXPECT_NEAR(target.cumulativeDelta().x(), 1000, 1); + EXPECT_EQ(target.cumulativeDelta().y(), 0); +} + +} // namespace anonymous diff --git a/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp b/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp index 85cca9066..9d21b8a9e 100644 --- a/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp +++ b/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp @@ -81,6 +81,9 @@ public: float currentX() { return m_currentPosX; } float currentY() { return m_currentPosY; } + FloatPoint m_fp; + int m_count; + void reset() { stopAnimationTimerIfNeeded(); @@ -88,6 +91,14 @@ public: m_currentPosY = 0; m_horizontalData.reset(); m_verticalData.reset(); + m_fp = FloatPoint::zero(); + m_count = 0; + } + + virtual void fireUpAnAnimation(FloatPoint fp) + { + m_fp = fp; + m_count++; } MOCK_METHOD1(scrollToOffsetWithoutAnimation, void(const FloatPoint&)); @@ -120,6 +131,30 @@ TEST(ScrollAnimatorEnabled, Enabled) scrollAnimatorNone.reset(); } +TEST(ScrollAnimatorEnabled, flingScrollEncoding) +{ + MockScrollableArea scrollableArea(true); + MockScrollAnimatorNone scrollAnimatorNone(&scrollableArea); + + scrollAnimatorNone.reset(); + + scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPixelVelocity, 111, -42); + scrollAnimatorNone.scroll(VerticalScrollbar, ScrollByPixelVelocity, 222, 42); + EXPECT_EQ(-42, scrollAnimatorNone.m_fp.x()); + EXPECT_EQ(42, scrollAnimatorNone.m_fp.y()); + EXPECT_EQ(1, scrollAnimatorNone.m_count); + scrollAnimatorNone.reset(); + + scrollAnimatorNone.scroll(VerticalScrollbar, ScrollByPixelVelocity, 222, 42); + scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPixelVelocity, 111, -42); + EXPECT_EQ(-42, scrollAnimatorNone.m_fp.x()); + EXPECT_EQ(42, scrollAnimatorNone.m_fp.y()); + EXPECT_EQ(1, scrollAnimatorNone.m_count); + scrollAnimatorNone.reset(); +} + + + TEST(ScrollAnimatorEnabled, Disabled) { MockScrollableArea scrollableArea(false); @@ -231,7 +266,8 @@ void ScrollAnimatorNoneTest::reset() bool ScrollAnimatorNoneTest::updateDataFromParameters(float step, float multiplier, float scrollableSize, double currentTime, ScrollAnimatorNone::Parameters* parameters) { - m_scrollingDown = (step * multiplier > 0); + if (step * multiplier) + m_scrollingDown = (step * multiplier > 0); double oldVelocity = m_data->m_currentVelocity; double oldDesiredVelocity = m_data->m_desiredVelocity; @@ -249,16 +285,18 @@ bool ScrollAnimatorNoneTest::updateDataFromParameters(float step, float multipli double sustainTimeLeft = max(0., timeLeft - releaseTimeLeft - attackTimeLeft); // If we're getting near the finish, the desired velocity can decrease since the time left gets increased. - double allowedVelocityDecreaseFactor = 0.99 * oldTimeLeft / timeLeft; - allowedVelocityDecreaseFactor *= allowedVelocityDecreaseFactor; - if (m_scrollingDown) - EXPECT_LE(oldDesiredVelocity * allowedVelocityDecreaseFactor, m_data->m_desiredVelocity); - else - EXPECT_GE(oldDesiredVelocity * allowedVelocityDecreaseFactor, m_data->m_desiredVelocity); - - double startPosition = attackTimeLeft ? m_data->m_attackPosition : m_currentPosition; - double expectedReleasePosition = startPosition + sustainTimeLeft * m_data->m_desiredVelocity; - EXPECT_NEAR(expectedReleasePosition, m_data->m_releasePosition, result ? .0001 : 1); + if (step * multiplier) { + double allowedVelocityDecreaseFactor = 0.99 * oldTimeLeft / timeLeft; + allowedVelocityDecreaseFactor *= allowedVelocityDecreaseFactor; + if (m_scrollingDown) + EXPECT_LE(oldDesiredVelocity * allowedVelocityDecreaseFactor, m_data->m_desiredVelocity); + else + EXPECT_GE(oldDesiredVelocity * allowedVelocityDecreaseFactor, m_data->m_desiredVelocity); + + double startPosition = attackTimeLeft ? m_data->m_attackPosition : m_currentPosition; + double expectedReleasePosition = startPosition + sustainTimeLeft * m_data->m_desiredVelocity; + EXPECT_NEAR(expectedReleasePosition, m_data->m_releasePosition, result ? .0001 : 1); + } return result; } @@ -427,7 +465,7 @@ TEST_F(ScrollAnimatorNoneTest, ScrollOnceLinear) { ScrollAnimatorNone::Parameters parameters(true, 7 * kTickTime, 0, ScrollAnimatorNone::Linear, 3 * kTickTime, ScrollAnimatorNone::Linear, 3 * kTickTime, ScrollAnimatorNone::Linear, 0); - updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters)); bool result = true; for (double t = kStartTime; result && t < kEndTime; t += kAnimationTime) result = animateScroll(t); @@ -437,7 +475,7 @@ TEST_F(ScrollAnimatorNoneTest, ScrollOnceQuadratic) { ScrollAnimatorNone::Parameters parameters(true, 7 * kTickTime, 0, ScrollAnimatorNone::Quadratic, 3 * kTickTime, ScrollAnimatorNone::Quadratic, 3 * kTickTime, ScrollAnimatorNone::Linear, 0); - updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters)); bool result = true; for (double t = kStartTime; result && t < kEndTime; t += kAnimationTime) result = animateScroll(t); @@ -447,7 +485,7 @@ TEST_F(ScrollAnimatorNoneTest, ScrollLongQuadratic) { ScrollAnimatorNone::Parameters parameters(true, 20 * kTickTime, 0, ScrollAnimatorNone::Quadratic, 3 * kTickTime, ScrollAnimatorNone::Quadratic, 3 * kTickTime, ScrollAnimatorNone::Linear, 0); - updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters)); bool result = true; for (double t = kStartTime; result && t < kEndTime; t += kAnimationTime) result = animateScroll(t); @@ -457,7 +495,7 @@ TEST_F(ScrollAnimatorNoneTest, ScrollQuadraticNoSustain) { ScrollAnimatorNone::Parameters parameters(true, 8 * kTickTime, 0, ScrollAnimatorNone::Quadratic, 4 * kTickTime, ScrollAnimatorNone::Quadratic, 4 * kTickTime, ScrollAnimatorNone::Linear, 0); - updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters)); bool result = true; for (double t = kStartTime; result && t < kEndTime; t += kAnimationTime) result = animateScroll(t); @@ -467,7 +505,7 @@ TEST_F(ScrollAnimatorNoneTest, ScrollQuadraticSmoothed) { ScrollAnimatorNone::Parameters parameters(true, 8 * kTickTime, 8 * kTickTime, ScrollAnimatorNone::Quadratic, 4 * kTickTime, ScrollAnimatorNone::Quadratic, 4 * kTickTime, ScrollAnimatorNone::Linear, 0); - updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters)); bool result = true; for (double t = kStartTime; result && t < kEndTime; t += kAnimationTime) result = animateScroll(t); @@ -477,7 +515,7 @@ TEST_F(ScrollAnimatorNoneTest, ScrollOnceCubic) { ScrollAnimatorNone::Parameters parameters(true, 7 * kTickTime, 0, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Linear, 0); - updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters)); bool result = true; for (double t = kStartTime; result && t < kEndTime; t += kAnimationTime) result = animateScroll(t); @@ -487,7 +525,7 @@ TEST_F(ScrollAnimatorNoneTest, ScrollOnceQuartic) { ScrollAnimatorNone::Parameters parameters(true, 7 * kTickTime, 0, ScrollAnimatorNone::Quartic, 3 * kTickTime, ScrollAnimatorNone::Quartic, 3 * kTickTime, ScrollAnimatorNone::Linear, 0); - updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters)); bool result = true; for (double t = kStartTime; result && t < kEndTime; t += kAnimationTime) result = animateScroll(t); @@ -497,7 +535,7 @@ TEST_F(ScrollAnimatorNoneTest, ScrollOnceShort) { ScrollAnimatorNone::Parameters parameters(true, 7 * kTickTime, 0, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Linear, 0); - updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters)); bool result = true; for (double t = kStartTime; result && t < kEndTime; t += kTickTime) result = animateScroll(t); @@ -507,7 +545,7 @@ TEST_F(ScrollAnimatorNoneTest, ScrollTwiceQuadratic) { ScrollAnimatorNone::Parameters parameters(true, 7 * kTickTime, 0, ScrollAnimatorNone::Quadratic, 3 * kTickTime, ScrollAnimatorNone::Quadratic, 3 * kTickTime, ScrollAnimatorNone::Linear, 0); - updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters)); bool result = true; double t; for (t = kStartTime; result && t < kStartTime + 1.5 * kTickTime; t += kAnimationTime) @@ -538,7 +576,7 @@ TEST_F(ScrollAnimatorNoneTest, ScrollLotsQuadratic) { ScrollAnimatorNone::Parameters parameters(true, 7 * kTickTime, 0, ScrollAnimatorNone::Quadratic, 3 * kTickTime, ScrollAnimatorNone::Quadratic, 3 * kTickTime, ScrollAnimatorNone::Linear, 0); - updateDataFromParameters(1, 40, 10000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 40, 10000, kStartTime, ¶meters)); bool result = true; double t; for (t = kStartTime; result && t < kStartTime + 1.5 * kTickTime; t += kAnimationTime) @@ -559,7 +597,7 @@ TEST_F(ScrollAnimatorNoneTest, ScrollLotsQuadraticSmoothed) { ScrollAnimatorNone::Parameters parameters(true, 10 * kTickTime, 6 * kTickTime, ScrollAnimatorNone::Quadratic, 3 * kTickTime, ScrollAnimatorNone::Quadratic, 3 * kTickTime, ScrollAnimatorNone::Linear, 0); - updateDataFromParameters(1, 40, 10000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 40, 10000, kStartTime, ¶meters)); bool result = true; double t; for (t = kStartTime; result && t < kStartTime + 1.5 * kTickTime; t += kAnimationTime) @@ -580,7 +618,7 @@ TEST_F(ScrollAnimatorNoneTest, ScrollTwiceCubic) { ScrollAnimatorNone::Parameters parameters(true, 7 * kTickTime, 0, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Linear, 0); - updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters)); bool result = true; double t; for (t = kStartTime; result && t < kStartTime + 1.5 * kTickTime; t += kAnimationTime) @@ -611,7 +649,7 @@ TEST_F(ScrollAnimatorNoneTest, ScrollLotsCubic) { ScrollAnimatorNone::Parameters parameters(true, 7 * kTickTime, 0, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Linear, 0); - updateDataFromParameters(1, 40, 10000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 40, 10000, kStartTime, ¶meters)); bool result = true; double t; for (t = kStartTime; result && t < kStartTime + 1.5 * kTickTime; t += kAnimationTime) @@ -632,7 +670,7 @@ TEST_F(ScrollAnimatorNoneTest, ScrollLotsCubicSmoothed) { ScrollAnimatorNone::Parameters parameters(true, 10 * kTickTime, 6 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Linear, 0); - updateDataFromParameters(1, 40, 10000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 40, 10000, kStartTime, ¶meters)); bool result = true; double t; for (t = kStartTime; result && t < kStartTime + 1.5 * kTickTime; t += kAnimationTime) @@ -761,7 +799,7 @@ TEST_F(ScrollAnimatorNoneTest, ScrollDownToBumper) { ScrollAnimatorNone::Parameters parameters(true, 10 * kTickTime, 7 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Linear, 0); - updateDataFromParameters(1, 20, 200, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 20, 200, kStartTime, ¶meters)); bool result = true; double t = kStartTime; for (int i = 0; i < 10; ++i) { @@ -781,7 +819,7 @@ TEST_F(ScrollAnimatorNoneTest, ScrollUpToBumper) { ScrollAnimatorNone::Parameters parameters(true, 10 * kTickTime, 7 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Linear, 0); - updateDataFromParameters(1, -20, 200, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, -20, 200, kStartTime, ¶meters)); bool result = true; double t = kStartTime; for (int i = 0; i < 10; ++i) { @@ -802,7 +840,7 @@ TEST_F(ScrollAnimatorNoneTest, ScrollUpToBumperCoast) ScrollAnimatorNone::Parameters parameters(true, 11 * kTickTime, 2 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Linear, 1); m_currentPosition = 40000; - updateDataFromParameters(1, -10000, 50000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, -10000, 50000, kStartTime, ¶meters)); bool result = true; double t = kStartTime; for (int i = 0; i < 10; ++i) { @@ -823,7 +861,7 @@ TEST_F(ScrollAnimatorNoneTest, ScrollDownToBumperCoast) ScrollAnimatorNone::Parameters parameters(true, 11 * kTickTime, 2 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Linear, 1); m_currentPosition = 10000; - updateDataFromParameters(1, 10000, 50000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 10000, 50000, kStartTime, ¶meters)); bool result = true; double t = kStartTime; for (int i = 0; i < 10; ++i) { @@ -844,27 +882,27 @@ TEST_F(ScrollAnimatorNoneTest, VaryingInputsEquivalency) ScrollAnimatorNone::Parameters parameters(true, 15 * kTickTime, 10 * kTickTime, ScrollAnimatorNone::Cubic, 5 * kTickTime, ScrollAnimatorNone::Cubic, 5 * kTickTime, ScrollAnimatorNone::Linear, 0); reset(); - updateDataFromParameters(1, 300, 50000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 300, 50000, kStartTime, ¶meters)); SavePerAxisData dataSingle(*m_data); reset(); - updateDataFromParameters(1, 150, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 150, 50000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 150, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 150, 50000, kStartTime, ¶meters)); SavePerAxisData dataDouble(*m_data); reset(); - updateDataFromParameters(1, 100, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 100, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 100, 50000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 100, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 100, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 100, 50000, kStartTime, ¶meters)); SavePerAxisData dataTriple(*m_data); reset(); - updateDataFromParameters(1, 50, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 50, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 50, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 50, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 50, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 50, 50000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 50, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 50, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 50, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 50, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 50, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 50, 50000, kStartTime, ¶meters)); SavePerAxisData dataMany(*m_data); EXPECT_EQ(dataSingle, dataDouble); @@ -910,27 +948,27 @@ TEST_F(ScrollAnimatorNoneTest, VaryingInputsEquivalencyCoastLarge) ScrollAnimatorNone::Parameters parameters(true, 15 * kTickTime, 10 * kTickTime, ScrollAnimatorNone::Cubic, 5 * kTickTime, ScrollAnimatorNone::Cubic, 5 * kTickTime, ScrollAnimatorNone::Linear, 1); reset(); - updateDataFromParameters(1, 30000, 50000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 30000, 50000, kStartTime, ¶meters)); SavePerAxisData dataSingle(*m_data); reset(); - updateDataFromParameters(1, 15000, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 15000, 50000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 15000, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 15000, 50000, kStartTime, ¶meters)); SavePerAxisData dataDouble(*m_data); reset(); - updateDataFromParameters(1, 10000, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 10000, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 10000, 50000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 10000, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 10000, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 10000, 50000, kStartTime, ¶meters)); SavePerAxisData dataTriple(*m_data); reset(); - updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters)); SavePerAxisData dataMany(*m_data); EXPECT_EQ(dataSingle, dataDouble); @@ -943,27 +981,27 @@ TEST_F(ScrollAnimatorNoneTest, VaryingInputsEquivalencyCoastSteep) ScrollAnimatorNone::Parameters parameters(true, 15 * kTickTime, 10 * kTickTime, ScrollAnimatorNone::Cubic, 5 * kTickTime, ScrollAnimatorNone::Cubic, 5 * kTickTime, ScrollAnimatorNone::Quadratic, 1); reset(); - updateDataFromParameters(1, 30000, 50000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 30000, 50000, kStartTime, ¶meters)); SavePerAxisData dataSingle(*m_data); reset(); - updateDataFromParameters(1, 15000, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 15000, 50000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 15000, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 15000, 50000, kStartTime, ¶meters)); SavePerAxisData dataDouble(*m_data); reset(); - updateDataFromParameters(1, 10000, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 10000, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 10000, 50000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 10000, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 10000, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 10000, 50000, kStartTime, ¶meters)); SavePerAxisData dataTriple(*m_data); reset(); - updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters); - updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters); + EXPECT_TRUE(updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters)); + EXPECT_TRUE(updateDataFromParameters(1, 5000, 50000, kStartTime, ¶meters)); SavePerAxisData dataMany(*m_data); EXPECT_EQ(dataSingle, dataDouble); @@ -971,5 +1009,50 @@ TEST_F(ScrollAnimatorNoneTest, VaryingInputsEquivalencyCoastSteep) EXPECT_EQ(dataSingle, dataMany); } +TEST_F(ScrollAnimatorNoneTest, ScrollStopInMiddle) +{ + ScrollAnimatorNone::Parameters parameters(true, 7 * kTickTime, 0, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Linear, 0); + + EXPECT_TRUE(updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters)); + bool result = true; + double t; + for (t = kStartTime; result && t < kStartTime + 1.5 * kTickTime; t += kAnimationTime) + result = animateScroll(t); + + result = result && animateScroll(t); + EXPECT_TRUE(result); + double before = m_currentPosition; + result = result && updateDataFromParameters(0, 0, 1000, t, ¶meters); + EXPECT_FALSE(result); + result = result && animateScroll(t); + double after = m_currentPosition; + EXPECT_EQ(before, after); + checkDesiredPosition(after); +} + +TEST_F(ScrollAnimatorNoneTest, ReverseInMiddle) +{ + ScrollAnimatorNone::Parameters parameters(true, 7 * kTickTime, 0, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Linear, 0); + + EXPECT_TRUE(updateDataFromParameters(1, 40, 1000, kStartTime, ¶meters)); + bool result = true; + double t; + for (t = kStartTime; result && t < kStartTime + 1.5 * kTickTime; t += kAnimationTime) + result = animateScroll(t); + + result = result && animateScroll(t); + EXPECT_TRUE(result); + double before = m_currentPosition; + result = result && updateDataFromParameters(1, -10, 1000, t, ¶meters); + EXPECT_TRUE(result); + result = result && animateScroll(t); + double after = m_currentPosition; + EXPECT_GE(before, after); + + t += kAnimationTime; + for (; result && t < kEndTime; t += kAnimationTime) + result = result && animateScroll(t); + EXPECT_GE(before, m_currentPosition); +} #endif // ENABLE(SMOOTH_SCROLLING) diff --git a/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp new file mode 100644 index 000000000..78b96b495 --- /dev/null +++ b/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp @@ -0,0 +1,126 @@ +/* + * 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 "ScrollbarLayerChromium.h" + +#include "Scrollbar.h" +#include "TreeSynchronizer.h" +#include "cc/CCScrollbarLayerImpl.h" +#include "cc/CCSingleThreadProxy.h" +#include <gtest/gtest.h> + +using namespace WebCore; + +namespace { + +class MockScrollbar : public Scrollbar { +public: + virtual int x() const { return 0; } + virtual int y() const { return 0; } + virtual int width() const { return 0; } + virtual int height() const { return 0; } + virtual IntSize size() const { return IntSize(); } + virtual IntPoint location() const { return IntPoint(); } + + virtual ScrollView* parent() const { return 0; } + virtual ScrollView* root() const { return 0; } + + virtual void setFrameRect(const IntRect&) { } + virtual IntRect frameRect() const { return IntRect(); } + + virtual void invalidate() { } + virtual void invalidateRect(const IntRect&) { } + + virtual ScrollbarOverlayStyle scrollbarOverlayStyle() const { return ScrollbarOverlayStyleDefault; } + virtual void getTickmarks(Vector<IntRect>&) const { } + virtual bool isScrollableAreaActive() const { return false; } + virtual bool isScrollViewScrollbar() const { return false; } + + virtual IntPoint convertFromContainingWindow(const IntPoint& windowPoint) { return IntPoint(); } + + virtual bool isCustomScrollbar() const { return false; } + virtual ScrollbarOrientation orientation() const { return HorizontalScrollbar; } + + virtual int value() const { return 0; } + virtual float currentPos() const { return 0; } + virtual int visibleSize() const { return 1; } + virtual int totalSize() const { return 1; } + virtual int maximum() const { return 0; } + virtual ScrollbarControlSize controlSize() const { return RegularScrollbar; } + + virtual int lineStep() const { return 0; } + virtual int pageStep() const { return 0; } + + virtual ScrollbarPart pressedPart() const { return NoPart; } + virtual ScrollbarPart hoveredPart() const { return NoPart; } + + virtual void styleChanged() { } + + virtual bool enabled() const { return false; } + virtual void setEnabled(bool) { } + + MockScrollbar() : Scrollbar(0, HorizontalScrollbar, RegularScrollbar) { } + virtual ~MockScrollbar() { } +}; + +TEST(ScrollbarLayerChromiumTest, resolveScrollLayerPointer) +{ + DebugScopedSetImplThread impl; + + { + RefPtr<MockScrollbar> scrollbar = adoptRef(new MockScrollbar); + RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create(); + RefPtr<LayerChromium> child1 = LayerChromium::create(); + RefPtr<LayerChromium> child2 = ScrollbarLayerChromium::create(scrollbar.get(), child1->id()); + layerTreeRoot->addChild(child1); + layerTreeRoot->addChild(child2); + + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr); + + CCLayerImpl* ccChild1 = ccLayerTreeRoot->children()[0].get(); + CCScrollbarLayerImpl* ccChild2 = static_cast<CCScrollbarLayerImpl*>(ccLayerTreeRoot->children()[1].get()); + + EXPECT_EQ(ccChild1, ccChild2->scrollLayer()); + } + + { // another traverse order + RefPtr<MockScrollbar> scrollbar = adoptRef(new MockScrollbar); + RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create(); + RefPtr<LayerChromium> child2 = LayerChromium::create(); + RefPtr<LayerChromium> child1 = ScrollbarLayerChromium::create(scrollbar.get(), child2->id()); + layerTreeRoot->addChild(child1); + layerTreeRoot->addChild(child2); + + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr); + + CCScrollbarLayerImpl* ccChild1 = static_cast<CCScrollbarLayerImpl*>(ccLayerTreeRoot->children()[0].get()); + CCLayerImpl* ccChild2 = ccLayerTreeRoot->children()[1].get(); + + EXPECT_EQ(ccChild1->scrollLayer(), ccChild2); + } +} + +} diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index e03559046..2523230e0 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -68,6 +68,7 @@ public: virtual ~Texture() { } virtual void updateRect(GraphicsContext3D*, TextureAllocator*, const IntRect&, const IntRect&) { m_layer->updateRect(); } + virtual void prepareRect(const IntRect&) { m_layer->prepareRect(); } private: FakeLayerTextureUpdater* m_layer; @@ -76,6 +77,7 @@ public: FakeLayerTextureUpdater() : m_prepareCount(0) , m_updateCount(0) + , m_prepareRectCount(0) { } virtual ~FakeLayerTextureUpdater() { } @@ -93,6 +95,11 @@ public: void clearUpdateCount() { m_updateCount = 0; } void updateRect() { m_updateCount++; } + // Number of times prepareRect() has been invoked on a texture. + int prepareRectCount() const { return m_prepareRectCount; } + void clearPrepareRectCount() { m_prepareRectCount = 0; } + void prepareRect() { m_prepareRectCount++; } + void setOpaquePaintRect(const IntRect& opaquePaintRect) { m_opaquePaintRect = opaquePaintRect; } // Last rect passed to prepareToUpdate(). @@ -105,6 +112,7 @@ public: private: int m_prepareCount; int m_updateCount; + int m_prepareRectCount; IntRect m_rectToInvalidate; IntRect m_lastUpdateRect; IntRect m_opaquePaintRect; @@ -142,14 +150,14 @@ public: TiledLayerChromium::invalidateRect(rect); } - void prepareToUpdate(const IntRect& rect) + void prepareToUpdate(const IntRect& rect, const Region& occluded) { - TiledLayerChromium::prepareToUpdate(rect); + TiledLayerChromium::prepareToUpdate(rect, occluded); } - void prepareToUpdateIdle(const IntRect& rect) + void prepareToUpdateIdle(const IntRect& rect, const Region& occluded) { - TiledLayerChromium::prepareToUpdateIdle(rect); + TiledLayerChromium::prepareToUpdateIdle(rect, occluded); } bool needsIdlePaint(const IntRect& rect) @@ -174,9 +182,9 @@ public: virtual TextureManager* textureManager() const { return m_textureManager; } - virtual void paintContentsIfDirty(const Region& /* occludedScreenSpace */) + virtual void paintContentsIfDirty(const Region& occludedScreenSpace) { - prepareToUpdate(visibleLayerRect()); + prepareToUpdate(visibleLayerRect(), occludedScreenSpace); } private: @@ -231,7 +239,8 @@ TEST(TiledLayerChromiumTest, pushDirtyTiles) OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; - RefPtr<FakeCCTiledLayerImpl> layerImpl = adoptRef(new FakeCCTiledLayerImpl(0)); + OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0))); + Region noOcclusion; FakeTextureAllocator textureAllocator; CCTextureUpdater updater(&textureAllocator); @@ -239,7 +248,7 @@ TEST(TiledLayerChromiumTest, pushDirtyTiles) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); layer->invalidateRect(IntRect(0, 0, 100, 200)); - layer->prepareToUpdate(IntRect(0, 0, 100, 200)); + layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion); layer->updateCompositorResources(0, updater); layer->pushPropertiesTo(layerImpl.get()); @@ -252,7 +261,7 @@ TEST(TiledLayerChromiumTest, pushDirtyTiles) // Invalidates both tiles... layer->invalidateRect(IntRect(0, 0, 100, 200)); // ....but then only update one of them. - layer->prepareToUpdate(IntRect(0, 0, 100, 100)); + layer->prepareToUpdate(IntRect(0, 0, 100, 100), noOcclusion); layer->updateCompositorResources(0, updater); layer->pushPropertiesTo(layerImpl.get()); @@ -261,12 +270,49 @@ TEST(TiledLayerChromiumTest, pushDirtyTiles) EXPECT_FALSE(layerImpl->hasTileAt(0, 1)); } +TEST(TiledLayerChromiumTest, pushOccludedDirtyTiles) +{ + OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + DebugScopedSetImplThread implThread; + OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0))); + Region noOcclusion; + + FakeTextureAllocator textureAllocator; + CCTextureUpdater updater(&textureAllocator); + + // The tile size is 100x100, so this invalidates and then paints two tiles. + layer->setBounds(IntSize(100, 200)); + layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion); + layer->updateCompositorResources(0, updater); + layer->pushPropertiesTo(layerImpl.get()); + + // We should have both tiles on the impl side. + EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); + EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); + + textureManager->unprotectAllTextures(); + + // Invalidates part of the top tile... + layer->invalidateRect(IntRect(0, 0, 50, 50)); + // ....but the area is occluded. + Region occlusion(IntRect(0, 0, 50, 50)); + layer->prepareToUpdate(IntRect(0, 0, 100, 100), occlusion); + layer->updateCompositorResources(0, updater); + layer->pushPropertiesTo(layerImpl.get()); + + // We should still have both tiles, as part of the top tile is still unoccluded. + EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); + EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); +} + TEST(TiledLayerChromiumTest, pushIdlePaintTiles) { OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; - RefPtr<FakeCCTiledLayerImpl> layerImpl = adoptRef(new FakeCCTiledLayerImpl(0)); + OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0))); FakeTextureAllocator textureAllocator; CCTextureUpdater updater(&textureAllocator); @@ -275,12 +321,13 @@ TEST(TiledLayerChromiumTest, pushIdlePaintTiles) IntSize contentBounds(500, 500); IntRect contentRect(IntPoint::zero(), contentBounds); IntRect visibleRect(200, 200, 100, 100); + Region noOcclusion; // This invalidates 25 tiles and then paints one visible tile. layer->setBounds(contentBounds); layer->setVisibleLayerRect(visibleRect); layer->invalidateRect(contentRect); - layer->prepareToUpdate(visibleRect); + layer->prepareToUpdate(visibleRect, noOcclusion); // We should need idle-painting for 3x3 tiles in the center. EXPECT_TRUE(layer->needsIdlePaint(visibleRect)); @@ -295,9 +342,9 @@ TEST(TiledLayerChromiumTest, pushIdlePaintTiles) // For the next four updates, we should detect we still need idle painting. for (int i = 0; i < 4; i++) { - layer->prepareToUpdate(visibleRect); + layer->prepareToUpdate(visibleRect, noOcclusion); EXPECT_TRUE(layer->needsIdlePaint(visibleRect)); - layer->prepareToUpdateIdle(visibleRect); + layer->prepareToUpdateIdle(visibleRect, noOcclusion); layer->updateCompositorResources(0, updater); layer->pushPropertiesTo(layerImpl.get()); textureManager->unprotectAllTextures(); @@ -318,6 +365,105 @@ TEST(TiledLayerChromiumTest, pushIdlePaintTiles) } } +TEST(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint) +{ + OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + DebugScopedSetImplThread implThread; + OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0))); + + FakeTextureAllocator textureAllocator; + CCTextureUpdater updater(&textureAllocator); + Region noOcclusion; + + // The tile size is 100x100, so this invalidates and then paints two tiles. + // However, during the paint, we invalidate one of the tiles. This should + // not prevent the tile from being pushed. + layer->setBounds(IntSize(100, 200)); + layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer.get()); + layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion); + layer->updateCompositorResources(0, updater); + layer->pushPropertiesTo(layerImpl.get()); + + // We should have both tiles on the impl side. + EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); + EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); +} + +TEST(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) +{ + OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); + RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + DebugScopedSetImplThread implThread; + OwnPtr<FakeCCTiledLayerImpl> layer1Impl(adoptPtr(new FakeCCTiledLayerImpl(0))); + OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(0))); + + FakeTextureAllocator textureAllocator; + CCTextureUpdater updater(&textureAllocator); + Region noOcclusion; + + layer1->setBounds(IntSize(100, 200)); + layer1->invalidateRect(IntRect(0, 0, 100, 200)); + layer2->setBounds(IntSize(100, 200)); + layer2->invalidateRect(IntRect(0, 0, 100, 200)); + + layer1->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion); + + // Invalidate a tile on layer1 + layer2->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get()); + layer2->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion); + + layer1->updateCompositorResources(0, updater); + layer2->updateCompositorResources(0, updater); + + layer1->pushPropertiesTo(layer1Impl.get()); + layer2->pushPropertiesTo(layer2Impl.get()); + + // We should have both tiles on the impl side for all layers. + EXPECT_TRUE(layer1Impl->hasTileAt(0, 0)); + EXPECT_TRUE(layer1Impl->hasTileAt(0, 1)); + EXPECT_TRUE(layer2Impl->hasTileAt(0, 0)); + EXPECT_TRUE(layer2Impl->hasTileAt(0, 1)); +} + +TEST(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer) +{ + OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); + RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + DebugScopedSetImplThread implThread; + OwnPtr<FakeCCTiledLayerImpl> layer1Impl(adoptPtr(new FakeCCTiledLayerImpl(0))); + OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(0))); + + FakeTextureAllocator textureAllocator; + CCTextureUpdater updater(&textureAllocator); + Region noOcclusion; + + layer1->setBounds(IntSize(100, 200)); + layer1->invalidateRect(IntRect(0, 0, 100, 200)); + layer2->setBounds(IntSize(100, 200)); + layer2->invalidateRect(IntRect(0, 0, 100, 200)); + + // Invalidate a tile on layer2 + layer1->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get()); + layer1->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion); + + layer2->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion); + + layer1->updateCompositorResources(0, updater); + layer2->updateCompositorResources(0, updater); + + layer1->pushPropertiesTo(layer1Impl.get()); + layer2->pushPropertiesTo(layer2Impl.get()); + + // We should have both tiles on the impl side for all layers. + EXPECT_TRUE(layer1Impl->hasTileAt(0, 0)); + EXPECT_TRUE(layer1Impl->hasTileAt(0, 1)); + EXPECT_TRUE(layer2Impl->hasTileAt(0, 0)); + EXPECT_TRUE(layer2Impl->hasTileAt(0, 1)); +} TEST(TiledLayerChromiumTest, idlePaintOutOfMemory) { @@ -325,6 +471,7 @@ TEST(TiledLayerChromiumTest, idlePaintOutOfMemory) IntSize contentBounds(300, 300); IntRect contentRect(IntPoint::zero(), contentBounds); IntRect visibleRect(100, 100, 100, 100); + Region noOcclusion; // We have enough memory for only the visible rect, so we will run out of memory in first idle paint. int memoryLimit = 4 * 100 * 100; // 2 tiles, 4 bytes per pixel. @@ -332,7 +479,7 @@ TEST(TiledLayerChromiumTest, idlePaintOutOfMemory) OwnPtr<TextureManager> textureManager = TextureManager::create(memoryLimit, memoryLimit / 2, 1024); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; - RefPtr<FakeCCTiledLayerImpl> layerImpl = adoptRef(new FakeCCTiledLayerImpl(0)); + OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0))); FakeTextureAllocator textureAllocator; CCTextureUpdater updater(&textureAllocator); @@ -341,7 +488,7 @@ TEST(TiledLayerChromiumTest, idlePaintOutOfMemory) layer->setBounds(contentBounds); layer->setVisibleLayerRect(visibleRect); layer->invalidateRect(contentRect); - layer->prepareToUpdate(visibleRect); + layer->prepareToUpdate(visibleRect, noOcclusion); // We should need idle-painting for 3x3 tiles surounding visible tile. EXPECT_TRUE(layer->needsIdlePaint(visibleRect)); @@ -353,8 +500,8 @@ TEST(TiledLayerChromiumTest, idlePaintOutOfMemory) EXPECT_TRUE(layerImpl->hasTileAt(1, 1)); textureManager->unprotectAllTextures(); - layer->prepareToUpdate(visibleRect); - layer->prepareToUpdateIdle(visibleRect); + layer->prepareToUpdate(visibleRect, noOcclusion); + layer->prepareToUpdateIdle(visibleRect, noOcclusion); // We shouldn't signal we need another idle paint after we run out of memory. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -368,7 +515,8 @@ TEST(TiledLayerChromiumTest, invalidateFromPrepare) OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; - RefPtr<FakeCCTiledLayerImpl> layerImpl = adoptRef(new FakeCCTiledLayerImpl(0)); + OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0))); + Region noOcclusion; FakeTextureAllocator textureAllocator; CCTextureUpdater updater(&textureAllocator); @@ -376,7 +524,7 @@ TEST(TiledLayerChromiumTest, invalidateFromPrepare) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); layer->invalidateRect(IntRect(0, 0, 100, 200)); - layer->prepareToUpdate(IntRect(0, 0, 100, 200)); + layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion); layer->updateCompositorResources(0, updater); layer->pushPropertiesTo(layerImpl.get()); @@ -389,18 +537,18 @@ TEST(TiledLayerChromiumTest, invalidateFromPrepare) layer->fakeLayerTextureUpdater()->clearPrepareCount(); // Invoke prepareToUpdate again. As the layer is valid prepareToUpdate shouldn't be invoked on // the LayerTextureUpdater. - layer->prepareToUpdate(IntRect(0, 0, 100, 200)); + layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion); EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareCount()); layer->invalidateRect(IntRect(0, 0, 50, 50)); // setRectToInvalidate triggers invalidateRect() being invoked from prepareToUpdate. layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(25, 25, 50, 50), layer.get()); layer->fakeLayerTextureUpdater()->clearPrepareCount(); - layer->prepareToUpdate(IntRect(0, 0, 100, 200)); + layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion); EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); layer->fakeLayerTextureUpdater()->clearPrepareCount(); // The layer should still be invalid as prepareToUpdate invoked invalidate. - layer->prepareToUpdate(IntRect(0, 0, 100, 200)); + layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion); EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); } @@ -411,6 +559,7 @@ TEST(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); RefPtr<FakeTiledLayerWithScaledBounds> layer = adoptRef(new FakeTiledLayerWithScaledBounds(textureManager.get())); + Region noOcclusion; FakeTextureAllocator textureAllocator; CCTextureUpdater updater(&textureAllocator); @@ -425,20 +574,20 @@ TEST(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) // On first update, the updateRect includes all tiles, even beyond the boundaries of the layer. // However, it should still be in layer space, not content space. layer->invalidateRect(contentBounds); - layer->prepareToUpdate(contentBounds); + layer->prepareToUpdate(contentBounds, noOcclusion); layer->updateCompositorResources(0, updater); EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 300, 300 * 0.8), layer->updateRect()); // After the tiles are updated once, another invalidate only needs to update the bounds of the layer. layer->invalidateRect(contentBounds); - layer->prepareToUpdate(contentBounds); + layer->prepareToUpdate(contentBounds, noOcclusion); layer->updateCompositorResources(0, updater); EXPECT_FLOAT_RECT_EQ(FloatRect(layerBounds), layer->updateRect()); // Partial re-paint should also be represented by the updateRect in layer space, not content space. IntRect partialDamage(30, 100, 10, 10); layer->invalidateRect(partialDamage); - layer->prepareToUpdate(contentBounds); + layer->prepareToUpdate(contentBounds, noOcclusion); layer->updateCompositorResources(0, updater); EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect()); } @@ -448,10 +597,11 @@ TEST(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); DebugScopedSetImplThread implThread; - RefPtr<FakeCCTiledLayerImpl> layerImpl = adoptRef(new FakeCCTiledLayerImpl(0)); + OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0))); FakeTextureAllocator textureAllocator; CCTextureUpdater updater(&textureAllocator); + Region noOcclusion; // Create a layer with one tile. layer->setBounds(IntSize(100, 100)); @@ -461,7 +611,7 @@ TEST(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect()); // Push the tiles to the impl side and check that there is exactly one. - layer->prepareToUpdate(IntRect(0, 0, 100, 100)); + layer->prepareToUpdate(IntRect(0, 0, 100, 100), noOcclusion); layer->updateCompositorResources(0, updater); layer->pushPropertiesTo(layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); @@ -475,7 +625,7 @@ TEST(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect()); // The impl side should get 2x2 tiles now. - layer->prepareToUpdate(IntRect(0, 0, 200, 200)); + layer->prepareToUpdate(IntRect(0, 0, 200, 200), noOcclusion); layer->updateCompositorResources(0, updater); layer->pushPropertiesTo(layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); @@ -486,6 +636,7 @@ TEST(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // Invalidate the entire layer again, but do not paint. All tiles should be gone now from the // impl side. layer->setNeedsDisplay(); + layer->prepareToUpdate(IntRect(0, 0, 0, 0), noOcclusion); layer->updateCompositorResources(0, updater); layer->pushPropertiesTo(layerImpl.get()); EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); @@ -547,132 +698,15 @@ TEST(TiledLayerChromiumTest, skipsDrawGetsReset) WebKit::WebCompositor::shutdown(); } -TEST(TiledLayerChromiumTest, layerAddsSelfToOccludedRegion) -{ - OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); - RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); - - // The tile size is 100x100, so this invalidates and then paints two tiles in various ways. - - Region occluded; - IntRect contentBounds = IntRect(0, 0, 100, 200); - IntRect visibleBounds = IntRect(0, 0, 100, 150); - - layer->setBounds(contentBounds.size()); - layer->setVisibleLayerRect(visibleBounds); - layer->setDrawOpacity(1); - - // The screenSpaceTransform is verified in CCLayerTreeHostCommonTests - TransformationMatrix screenSpaceTransform; - layer->setScreenSpaceTransform(screenSpaceTransform); - - // If the layer is opaque then the occluded region should be the whole layer's visible region. - layer->setOpaque(true); - layer->invalidateRect(contentBounds); - layer->prepareToUpdate(contentBounds); - - occluded = Region(); - layer->addSelfToOccludedScreenSpace(occluded); - EXPECT_EQ_RECT(visibleBounds, occluded.bounds()); - EXPECT_EQ(1u, occluded.rects().size()); - - // If the layer is not opaque then the occluded region should be empty. - layer->setOpaque(false); - layer->invalidateRect(contentBounds); - layer->prepareToUpdate(contentBounds); - - occluded = Region(); - layer->addSelfToOccludedScreenSpace(occluded); - EXPECT_EQ_RECT(IntRect(), occluded.bounds()); - EXPECT_EQ(0u, occluded.rects().size()); - - // If the layer paints opaque content, then the occluded region should match the visible opaque content. - IntRect opaquePaintRect = IntRect(10, 10, 90, 190); - layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect); - layer->invalidateRect(contentBounds); - layer->prepareToUpdate(contentBounds); - - occluded = Region(); - layer->addSelfToOccludedScreenSpace(occluded); - EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), occluded.bounds()); - EXPECT_EQ(1u, occluded.rects().size()); - - // If we paint again without invalidating, the same stuff should be occluded. - layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->prepareToUpdate(contentBounds); - - occluded = Region(); - layer->addSelfToOccludedScreenSpace(occluded); - EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), occluded.bounds()); - EXPECT_EQ(1u, occluded.rects().size()); - - // If we repaint a non-opaque part of the tile, then it shouldn't lose its opaque-ness. And other tiles should - // not be affected. - layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->invalidateRect(IntRect(0, 0, 1, 1)); - layer->prepareToUpdate(contentBounds); - - occluded = Region(); - layer->addSelfToOccludedScreenSpace(occluded); - EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), occluded.bounds()); - EXPECT_EQ(1u, occluded.rects().size()); - - // If we repaint an opaque part of the tile, then it should lose its opaque-ness. But other tiles should still - // not be affected. - layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->invalidateRect(IntRect(10, 10, 1, 1)); - layer->prepareToUpdate(contentBounds); - - occluded = Region(); - layer->addSelfToOccludedScreenSpace(occluded); - EXPECT_EQ_RECT(intersection(IntRect(10, 100, 90, 100), visibleBounds), occluded.bounds()); - EXPECT_EQ(1u, occluded.rects().size()); - - // If the layer is transformed then the resulting occluded area needs to be transformed to its target space. - TransformationMatrix transform; - transform.translate(contentBounds.width() / 2.0, contentBounds.height() / 2.0); - transform.rotate(90); - transform.translate(-contentBounds.width() / 2.0, -contentBounds.height() / 2.0); - transform.translate(10, 10); - screenSpaceTransform.translate(contentBounds.width() / 2.0, contentBounds.height() / 2.0); - screenSpaceTransform *= transform; - screenSpaceTransform.translate(-contentBounds.width() / 2.0, -contentBounds.height() / 2.0); - layer->setScreenSpaceTransform(screenSpaceTransform); - layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect); - layer->invalidateRect(opaquePaintRect); - layer->prepareToUpdate(contentBounds); - - occluded = Region(); - layer->addSelfToOccludedScreenSpace(occluded); - EXPECT_EQ_RECT(screenSpaceTransform.mapRect(intersection(opaquePaintRect, visibleBounds)), occluded.bounds()); - EXPECT_EQ(1u, occluded.rects().size()); - - // But a non-axis-aligned transform does not get considered for occlusion. - transform.translate(contentBounds.width() / 2.0, contentBounds.height() / 2.0); - transform.rotate(5); - transform.translate(-contentBounds.width() / 2.0, -contentBounds.height() / 2.0); - screenSpaceTransform.translate(contentBounds.width() / 2.0, contentBounds.height() / 2.0); - screenSpaceTransform *= transform; - screenSpaceTransform.translate(-contentBounds.width() / 2.0, -contentBounds.height() / 2.0); - layer->setScreenSpaceTransform(screenSpaceTransform); - layer->prepareToUpdate(contentBounds); - - occluded = Region(); - layer->addSelfToOccludedScreenSpace(occluded); - // FIXME: If we find an opaque rect contained in the rotated non-axis-aligned rect, then - // this won't be an empty result. - EXPECT_EQ_RECT(IntRect(), occluded.bounds()); - EXPECT_EQ(0u, occluded.rects().size()); -} - TEST(TiledLayerChromiumTest, resizeToSmaller) { OwnPtr<TextureManager> textureManager = TextureManager::create(60*1024*1024, 60*1024*1024, 1024); RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + Region noOcclusion; layer->setBounds(IntSize(700, 700)); layer->invalidateRect(IntRect(0, 0, 700, 700)); - layer->prepareToUpdate(IntRect(0, 0, 700, 700)); + layer->prepareToUpdate(IntRect(0, 0, 700, 700), noOcclusion); layer->setBounds(IntSize(200, 200)); layer->invalidateRect(IntRect(0, 0, 200, 200)); @@ -749,4 +783,238 @@ TEST(TiledLayerChromiumTest, partialUpdates) WebKit::WebCompositor::shutdown(); } +TEST(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion) +{ + OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + Region occluded; + + // The tile size is 100x100, so this invalidates and then paints two tiles. + layer->setBounds(IntSize(100, 200)); + + layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->prepareToUpdate(IntRect(0, 0, 100, 200), occluded); + EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->prepareRectCount()); +} + +TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusion) +{ + OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + Region occluded; + + // The tile size is 100x100. + + layer->setBounds(IntSize(600, 600)); + + occluded = IntRect(200, 200, 300, 100); + layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded); + EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); + + layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); + + occluded = IntRect(250, 200, 300, 100); + layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded); + EXPECT_EQ(36-2, layer->fakeLayerTextureUpdater()->prepareRectCount()); + + layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); + + occluded = IntRect(250, 250, 300, 100); + layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded); + EXPECT_EQ(36, layer->fakeLayerTextureUpdater()->prepareRectCount()); +} + +TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) +{ + OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + Region occluded; + + // The tile size is 100x100. + + layer->setBounds(IntSize(600, 600)); + + // The partially occluded tiles (by the 150 occlusion height) are visible beyond the occlusion, so not culled. + occluded = IntRect(200, 200, 300, 150); + layer->setVisibleLayerRect(IntRect(0, 0, 600, 360)); + layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded); + EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); + + layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); + + // Now the visible region stops at the edge of the occlusion so the partly visible tiles become fully occluded. + occluded = IntRect(200, 200, 300, 150); + layer->setVisibleLayerRect(IntRect(0, 0, 600, 350)); + layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded); + EXPECT_EQ(36-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); + + layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); + + // Now the visible region is even smaller than the occlusion, it should have the same result. + occluded = IntRect(200, 200, 300, 150); + layer->setVisibleLayerRect(IntRect(0, 0, 600, 340)); + layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded); + EXPECT_EQ(36-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); +} + +TEST(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) +{ + OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + Region occluded; + + // The tile size is 100x100. + + layer->setBounds(IntSize(600, 600)); + + occluded = IntRect(200, 200, 300, 100); + layer->setVisibleLayerRect(IntRect(0, 0, 600, 600)); + layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded); + EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); + + layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); + + // Repaint without marking it dirty. + layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded); + EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareRectCount()); +} + +TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) +{ + OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + Region occluded; + + // The tile size is 100x100. + + // This makes sure the painting works when the occluded region (in screen space) + // is transformed differently than the layer. + layer->setBounds(IntSize(600, 600)); + TransformationMatrix screenTransform; + screenTransform.scale(0.5); + layer->setScreenSpaceTransform(screenTransform); + + occluded = IntRect(100, 100, 150, 50); + layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded); + EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); +} + +TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) +{ + OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + Region occluded; + + // The tile size is 100x100. + + // This makes sure the painting works when the content space is scaled to + // a different layer space. In this case tiles are scaled to be 200x200 + // pixels, which means none should be occluded. + layer->setContentsScale(0.5); + layer->setBounds(IntSize(600, 600)); + + occluded = IntRect(200, 200, 300, 100); + layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded); + // The content is half the size of the layer (so the number of tiles is fewer). + // In this case, the content is 300x300, and since the tile size is 100, the + // number of tiles 3x3. + EXPECT_EQ(9, layer->fakeLayerTextureUpdater()->prepareRectCount()); + + layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); + + // This makes sure the painting works when the content space is scaled to + // a different layer space. In this case the occluded region catches the + // blown up tiles. + occluded = IntRect(200, 200, 300, 200); + layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded); + EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); + + layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); + + // This makes sure content scaling and transforms work together. + TransformationMatrix screenTransform; + screenTransform.scale(0.5); + layer->setScreenSpaceTransform(screenTransform); + + occluded = IntRect(100, 100, 150, 100); + layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded); + EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); +} + +TEST(TiledLayerChromiumTest, opaqueContentsRegion) +{ + OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + + // The tile size is 100x100, so this invalidates and then paints two tiles in various ways. + + IntRect opaquePaintRect; + Region opaqueContents; + Region noOcclusion; + + IntRect contentBounds = IntRect(0, 0, 100, 200); + IntRect visibleBounds = IntRect(0, 0, 100, 150); + + layer->setBounds(contentBounds.size()); + layer->setVisibleLayerRect(visibleBounds); + layer->setDrawOpacity(1); + + // If the layer doesn't paint opaque content, then the opaqueContentsRegion should be empty. + layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect); + layer->invalidateRect(contentBounds); + layer->prepareToUpdate(contentBounds, noOcclusion); + opaqueContents = layer->opaqueContentsRegion(); + EXPECT_TRUE(opaqueContents.isEmpty()); + + // opaqueContentsRegion should match the visible part of what is painted opaque. + opaquePaintRect = IntRect(10, 10, 90, 190); + layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect); + layer->invalidateRect(contentBounds); + layer->prepareToUpdate(contentBounds, noOcclusion); + opaqueContents = layer->opaqueContentsRegion(); + EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); + EXPECT_EQ(1u, opaqueContents.rects().size()); + + // If we paint again without invalidating, the same stuff should be opaque. + layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); + layer->prepareToUpdate(contentBounds, noOcclusion); + opaqueContents = layer->opaqueContentsRegion(); + EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); + EXPECT_EQ(1u, opaqueContents.rects().size()); + + // If we repaint a non-opaque part of the tile, then it shouldn't lose its opaque-ness. And other tiles should + // not be affected. + layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); + layer->invalidateRect(IntRect(0, 0, 1, 1)); + layer->prepareToUpdate(contentBounds, noOcclusion); + opaqueContents = layer->opaqueContentsRegion(); + EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); + EXPECT_EQ(1u, opaqueContents.rects().size()); + + // If we repaint an opaque part of the tile, then it should lose its opaque-ness. But other tiles should still + // not be affected. + layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); + layer->invalidateRect(IntRect(10, 10, 1, 1)); + layer->prepareToUpdate(contentBounds, noOcclusion); + opaqueContents = layer->opaqueContentsRegion(); + EXPECT_EQ_RECT(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds()); + EXPECT_EQ(1u, opaqueContents.rects().size()); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/TransparencyWinTest.cpp b/Source/WebKit/chromium/tests/TransparencyWinTest.cpp index 54898ca8a..5052bb166 100644 --- a/Source/WebKit/chromium/tests/TransparencyWinTest.cpp +++ b/Source/WebKit/chromium/tests/TransparencyWinTest.cpp @@ -100,7 +100,7 @@ static std::ostream& operator<<(std::ostream& out, const Color& c) TEST(TransparencyWin, NoLayer) { - OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(17, 16), ColorSpaceDeviceRGB)); + OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(17, 16), 1, ColorSpaceDeviceRGB)); // KeepTransform { @@ -139,7 +139,7 @@ TEST(TransparencyWin, NoLayer) TEST(TransparencyWin, WhiteLayer) { - OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), ColorSpaceDeviceRGB)); + OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), 1, ColorSpaceDeviceRGB)); // KeepTransform { @@ -191,7 +191,7 @@ TEST(TransparencyWin, WhiteLayer) TEST(TransparencyWin, TextComposite) { - OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), ColorSpaceDeviceRGB)); + OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), 1, ColorSpaceDeviceRGB)); // KeepTransform is the only valid transform mode for TextComposite. { @@ -210,7 +210,7 @@ TEST(TransparencyWin, TextComposite) TEST(TransparencyWin, OpaqueCompositeLayer) { - OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), ColorSpaceDeviceRGB)); + OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), 1, ColorSpaceDeviceRGB)); // KeepTransform { @@ -280,7 +280,7 @@ TEST(TransparencyWin, OpaqueCompositeLayer) TEST(TransparencyWin, WhiteLayerPixelTest) { // Make a total transparent buffer, and draw the white layer inset by 1 px. - OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), ColorSpaceDeviceRGB)); + OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), 1, ColorSpaceDeviceRGB)); { TransparencyWin helper; @@ -309,7 +309,7 @@ TEST(TransparencyWin, OpaqueCompositeLayerPixel) Color green(0xFF00FF00); // Make a red bottom layer, followed by a half green next layer @ 50%. - OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), ColorSpaceDeviceRGB)); + OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), 1, ColorSpaceDeviceRGB)); FloatRect fullRect(0, 0, 16, 16); src->context()->fillRect(fullRect, red, ColorSpaceDeviceRGB); @@ -362,7 +362,7 @@ TEST(TransparencyWin, OpaqueCompositeLayerPixel) TEST(TransparencyWin, TranslateOpaqueCompositeLayer) { // Fill with white. - OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), ColorSpaceDeviceRGB)); + OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), 1, ColorSpaceDeviceRGB)); Color white(0xFFFFFFFF); FloatRect fullRect(0, 0, 16, 16); src->context()->fillRect(fullRect, white, ColorSpaceDeviceRGB); @@ -399,7 +399,7 @@ TEST(TransparencyWin, TranslateOpaqueCompositeLayer) // tests that the propert transform is applied to the copied layer. TEST(TransparencyWin, RotateOpaqueCompositeLayer) { - OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), ColorSpaceDeviceRGB)); + OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), 1, ColorSpaceDeviceRGB)); // The background is white. Color white(0xFFFFFFFF); @@ -478,7 +478,7 @@ TEST(TransparencyWin, RotateOpaqueCompositeLayer) TEST(TransparencyWin, DISABLED_TranslateScaleOpaqueCompositeLayer) { - OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), ColorSpaceDeviceRGB)); + OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), 1, ColorSpaceDeviceRGB)); // The background is white on top with red on bottom. Color white(0xFFFFFFFF); @@ -526,7 +526,7 @@ TEST(TransparencyWin, DISABLED_TranslateScaleOpaqueCompositeLayer) TEST(TransparencyWin, Scale) { // Create an opaque white buffer. - OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), ColorSpaceDeviceRGB)); + OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), 1, ColorSpaceDeviceRGB)); FloatRect fullBuffer(0, 0, 16, 16); src->context()->fillRect(fullBuffer, Color::white, ColorSpaceDeviceRGB); @@ -579,7 +579,7 @@ TEST(TransparencyWin, Scale) TEST(TransparencyWin, ScaleTransparency) { // Create an opaque white buffer. - OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), ColorSpaceDeviceRGB)); + OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), 1, ColorSpaceDeviceRGB)); FloatRect fullBuffer(0, 0, 16, 16); src->context()->fillRect(fullBuffer, Color::white, ColorSpaceDeviceRGB); @@ -637,7 +637,7 @@ TEST(TransparencyWin, ScaleTransparency) TEST(TransparencyWin, Text) { - OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), ColorSpaceDeviceRGB)); + OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), 1, ColorSpaceDeviceRGB)); // Our text should end up 50% transparent blue-green. Color fullResult(0x80008080); diff --git a/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp b/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp index 4724b4a43..eb3850dab 100644 --- a/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp +++ b/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp @@ -41,9 +41,9 @@ namespace { class MockCCLayerImpl : public CCLayerImpl { public: - static PassRefPtr<MockCCLayerImpl> create(int layerId) + static PassOwnPtr<MockCCLayerImpl> create(int layerId) { - return adoptRef(new MockCCLayerImpl(layerId)); + return adoptPtr(new MockCCLayerImpl(layerId)); } virtual ~MockCCLayerImpl() { @@ -72,7 +72,7 @@ public: virtual ~MockLayerChromium() { } - virtual PassRefPtr<CCLayerImpl> createCCLayerImpl() + virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() { return MockCCLayerImpl::create(m_layerId); } @@ -134,7 +134,7 @@ void expectTreesAreIdentical(LayerChromium* layer, CCLayerImpl* ccLayer) expectTreesAreIdentical(layer->replicaLayer(), ccLayer->replicaLayer()); const Vector<RefPtr<LayerChromium> >& layerChildren = layer->children(); - const Vector<RefPtr<CCLayerImpl> >& ccLayerChildren = ccLayer->children(); + const Vector<OwnPtr<CCLayerImpl> >& ccLayerChildren = ccLayer->children(); ASSERT_EQ(layerChildren.size(), ccLayerChildren.size()); @@ -150,7 +150,7 @@ TEST(TreeSynchronizerTest, syncSimpleTreeFromEmpty) layerTreeRoot->addChild(LayerChromium::create()); layerTreeRoot->addChild(LayerChromium::create()); - RefPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), 0); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get()); } @@ -165,7 +165,7 @@ TEST(TreeSynchronizerTest, syncSimpleTreeReusingLayers) layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList)); layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList)); - RefPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), 0); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get()); // Add a new layer to the LayerChromium side @@ -199,7 +199,7 @@ TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties) IntSize secondChildBounds = IntSize(25, 53); layerTreeRoot->children()[1]->setBounds(secondChildBounds); - RefPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), 0); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get()); // Check that the property values we set on the LayerChromium tree are reflected in the CCLayerImpl tree. @@ -236,7 +236,7 @@ TEST(TreeSynchronizerTest, reuseCCLayersAfterStructuralChange) layerB->addChild(MockLayerChromium::create(&ccLayerDestructionList)); RefPtr<LayerChromium> layerD = layerB->children()[1].get(); - RefPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), 0); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get()); // Now restructure the tree to look like this: @@ -274,7 +274,7 @@ TEST(TreeSynchronizerTest, syncSimpleTreeThenDestroy) int oldTreeFirstChildLayerId = oldLayerTreeRoot->children()[0]->id(); int oldTreeSecondChildLayerId = oldLayerTreeRoot->children()[1]->id(); - RefPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(oldLayerTreeRoot.get(), 0); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(oldLayerTreeRoot.get(), nullptr); expectTreesAreIdentical(oldLayerTreeRoot.get(), ccLayerTreeRoot.get()); // Remove all children on the LayerChromium side. @@ -314,23 +314,23 @@ TEST(TreeSynchronizerTest, syncMaskReplicaAndReplicaMaskLayers) replicaLayerWithMask->setMaskLayer(replicaMaskLayer.get()); layerTreeRoot->children()[2]->setReplicaLayer(replicaLayerWithMask.get()); - RefPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), 0); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get()); // Remove the mask layer. layerTreeRoot->children()[0]->setMaskLayer(0); - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.get()); + ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release()); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get()); // Remove the replica layer. layerTreeRoot->children()[1]->setReplicaLayer(0); - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.get()); + ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release()); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get()); // Remove the replica mask. replicaLayerWithMask->setMaskLayer(0); - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.get()); + ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release()); expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get()); } @@ -343,8 +343,8 @@ TEST(TreeSynchronizerTest, synchronizeAnimations) EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerAnimationController())->synchronizedAnimations()); - RefPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), 0); - ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.get()); + OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr); + ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release()); EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerAnimationController())->synchronizedAnimations()); } diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp index f61e98648..481bd916f 100644 --- a/Source/WebKit/chromium/tests/WebFrameTest.cpp +++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp @@ -186,27 +186,27 @@ TEST_F(WebFrameTest, DivAutoZoomParamsTest) EXPECT_EQ(vScroll, scroll.y); // Test zoom out to overview scale. - webViewImpl->applyScrollAndScale(WebCore::IntSize(scroll.x, scroll.y), scale / webViewImpl->pageScaleFactor()); + webViewImpl->applyScrollAndScale(WebSize(scroll.x, scroll.y), scale / webViewImpl->pageScaleFactor()); webViewImpl->computeScaleAndScrollForHitRect(doubleTapPoint, WebViewImpl::DoubleTap, scale, scroll); EXPECT_FLOAT_EQ(1, scale); EXPECT_EQ(WebPoint(0, 0), scroll); // Tests for clamped scaling. // Test clamp to device scale: - webViewImpl->applyScrollAndScale(WebCore::IntSize(scroll.x, scroll.y), scale / webViewImpl->pageScaleFactor()); + webViewImpl->applyScrollAndScale(WebSize(scroll.x, scroll.y), scale / webViewImpl->pageScaleFactor()); webViewImpl->setDeviceScaleFactor(2.5); webViewImpl->computeScaleAndScrollForHitRect(doubleTapPoint, WebViewImpl::DoubleTap, scale, scroll); EXPECT_FLOAT_EQ(2.5, scale); // Test clamp to minimum scale: - webViewImpl->applyScrollAndScale(WebCore::IntSize(scroll.x, scroll.y), scale / webViewImpl->pageScaleFactor()); + webViewImpl->applyScrollAndScale(WebSize(scroll.x, scroll.y), scale / webViewImpl->pageScaleFactor()); webViewImpl->setPageScaleFactorLimits(1.5 / webViewImpl->deviceScaleFactor(), 4 / webViewImpl->deviceScaleFactor()); webViewImpl->computeScaleAndScrollForHitRect(doubleTapPoint, WebViewImpl::DoubleTap, scale, scroll); EXPECT_FLOAT_EQ(1.5, scale); EXPECT_EQ(WebPoint(0, 0), scroll); // Test clamp to maximum scale: - webViewImpl->applyScrollAndScale(WebCore::IntSize(scroll.x, scroll.y), scale / webViewImpl->pageScaleFactor()); + webViewImpl->applyScrollAndScale(WebSize(scroll.x, scroll.y), scale / webViewImpl->pageScaleFactor()); webViewImpl->setDeviceScaleFactor(4); webViewImpl->setPageScaleFactorLimits(0, 3 / webViewImpl->deviceScaleFactor()); webViewImpl->computeScaleAndScrollForHitRect(doubleTapPoint, WebViewImpl::DoubleTap, scale, scroll); @@ -322,12 +322,12 @@ public: std::vector<Notification*> releaseNotifications; private: - virtual void didCreateScriptContext(WebFrame* frame, v8::Handle<v8::Context> context, int worldId) + virtual void didCreateScriptContext(WebFrame* frame, v8::Handle<v8::Context> context, int extensionGroup, int worldId) OVERRIDE { createNotifications.push_back(new Notification(frame, context, worldId)); } - virtual void willReleaseScriptContext(WebFrame* frame, v8::Handle<v8::Context> context, int worldId) + virtual void willReleaseScriptContext(WebFrame* frame, v8::Handle<v8::Context> context, int worldId) OVERRIDE { releaseNotifications.push_back(new Notification(frame, context, worldId)); } diff --git a/Source/WebKit/chromium/tests/WebLayerTest.cpp b/Source/WebKit/chromium/tests/WebLayerTest.cpp index e0cab87bd..1eed81aea 100644 --- a/Source/WebKit/chromium/tests/WebLayerTest.cpp +++ b/Source/WebKit/chromium/tests/WebLayerTest.cpp @@ -57,6 +57,8 @@ public: virtual void applyScrollAndScale(const WebSize& scrollDelta, float scaleFactor) { } virtual WebGraphicsContext3D* createContext3D() { return CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()).leakPtr(); } virtual void didRebindGraphicsContext(bool success) { } + virtual void didCommitAndDrawFrame() { } + virtual void didCompleteSwapBuffers() { } }; class MockWebContentLayerClient : public WebContentLayerClient { @@ -72,7 +74,7 @@ public: WebKit::WebCompositor::initialize(0); m_rootLayer = WebLayer::create(); EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); - m_view = WebLayerTreeView::create(&m_client, m_rootLayer, WebLayerTreeView::Settings()); + EXPECT_TRUE(m_view.initialize(&m_client, m_rootLayer, WebLayerTreeView::Settings())); Mock::VerifyAndClearExpectations(&m_client); } |
