diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-10 19:10:20 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-10 19:10:20 +0200 |
commit | 284837daa07b29d6a63a748544a90b1f5842ac5c (patch) | |
tree | ecd258180bde91fe741e0cfd2638beb3c6da7e8e /Source/WebKit/chromium | |
parent | 2e2ba8ff45915f40ed3e014101269c175f2a89a0 (diff) | |
download | qtwebkit-284837daa07b29d6a63a748544a90b1f5842ac5c.tar.gz |
Imported WebKit commit 68645295d2e3e09af2c942f092556f06aa5f8b0d (http://svn.webkit.org/repository/webkit/trunk@128073)
New snapshot
Diffstat (limited to 'Source/WebKit/chromium')
155 files changed, 7826 insertions, 2543 deletions
diff --git a/Source/WebKit/chromium/.gitignore b/Source/WebKit/chromium/.gitignore deleted file mode 100644 index 4def72c92..000000000 --- a/Source/WebKit/chromium/.gitignore +++ /dev/null @@ -1,40 +0,0 @@ -# Ignore Chromium dependencies - -*.Makefile -*.mk -*.sln -*.vcproj* -*.vcxproj* -All.ncb -All.sdf -All.xcodeproj -WebKit.ncb -WebKit.xcodeproj -WebKitUnitTests.xcodeproj - -.gclient -.gclient_entries -base/ -cc/ -chromium_deps/ -crypto/ -depot_tools/ -dbus/ -gfx/ -googleurl/ -gpu/ -ipc/ -media/ -net/ -ppapi/ -printing/ -sdch/ -skia/ -sql/ -testing/ -third_party/ -tools/ -ui/ -v8/ -webkit/ -xcodebuild/ diff --git a/Source/WebKit/chromium/All.gyp b/Source/WebKit/chromium/All.gyp index 739a0c8ec..882120207 100644 --- a/Source/WebKit/chromium/All.gyp +++ b/Source/WebKit/chromium/All.gyp @@ -47,8 +47,15 @@ 'conditions': [ ['OS=="android"', { 'dependencies': [ - 'WebKitUnitTests.gyp:webkit_unit_tests_apk', '../../../Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp:DumpRenderTree_apk', + ], + }], + # Special target to wrap a gtest_target_type==shared_library + # webkit_unit_tests and TestWebKitAPI into an android apk for + # execution. See base.gyp for TODO(jrg)s about this strategy. + ['OS=="android" and gtest_target_type == "shared_library"', { + 'dependencies': [ + 'WebKitUnitTests.gyp:webkit_unit_tests_apk', '../../../Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp:TestWebKitAPI_apk', ], }], diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index 2e08a17ed..2a621451b 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,2495 @@ +2012-09-10 Rick Byers <rbyers@chromium.org> + + [chromium] Don't use WebGestureEvent.boundingBox for touch adjustment + https://bugs.webkit.org/show_bug.cgi?id=95996 + + Reviewed by Adam Barth. + + Switch from WebGestureEvent.boundingBox to new gesture-type specific + data fields. + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleGestureEvent): + +2012-09-09 Keishi Hattori <keishi@webkit.org> + + REGRESSION(r127558): Fix a crash in DateTimeChooserImpl::didClosePopup + https://bugs.webkit.org/show_bug.cgi?id=96222 + + Reviewed by Kent Tamura. + + DateTimeChooserClient will delete DateTimeChooserImpl inside didEndChooser() + so we shouldn't be changing the members after that. + + Testing covered by fast/forms/date/calendar-picker-appearance-pre-100.html. + + * src/DateTimeChooserImpl.cpp: + (WebKit::DateTimeChooserImpl::didClosePopup): + +2012-09-09 Kenichi Ishibashi <bashi@chromium.org> + + [Chromium] Unreviewed gardening after r127907 + + Fix CCRenderPassTest::copyShouldBeIdenticalExceptIdAndQuads + + * tests/CCRenderPassTest.cpp: + (CCRenderPassSize): Changed type of m_id + +2012-09-09 Emil A Eklund <eae@chromium.org> + + Rename Node::getRect/getPixelSnappedRect and remove ContainerNode::getRect + https://bugs.webkit.org/show_bug.cgi?id=81413 + + Reviewed by David Hyatt. + + Update WebViewImpl to call boundingBox/pixelSnappedBoundingBox. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::computeBlockBounds): + (WebKit::WebViewImpl::applyAutofillSuggestions): + (WebKit::WebViewImpl::refreshAutofillPopup): + +2012-09-09 James Robinson <jamesr@chromium.org> + + [chromium] webkit_platform should only be linked into the webkit target + https://bugs.webkit.org/show_bug.cgi?id=96213 + + Reviewed by Adrienne Walker. + + The Platform.gyp:webkit_platform target provides the implementation of several WEBKIT_EXPORTed symbols. It only + makes sense as a target of WebKit.gyp:webkit, other targets shouldn't directly depend on it. + + * WebKit.gyp: + +2012-09-09 James Robinson <jamesr@chromium.org> + + [chromium] Use WebCompositorSupport creation functions in GraphicsLayerChromiumTest + https://bugs.webkit.org/show_bug.cgi?id=96212 + + Reviewed by Adrienne Walker. + + The static ::create()s the test references currently are going away soon. + + * tests/GraphicsLayerChromiumTest.cpp: + (WebKit::GraphicsLayerChromiumTest::GraphicsLayerChromiumTest): + (WebKit::TEST_F): + +2012-09-07 Benjamin Poulain <benjamin@webkit.org> + + Unreviewed prospective build fix. + + * tests/WebCompositorInputHandlerImplTest.cpp: Looks like someone is missing an #include. + Remove the using directive from r127959. + +2012-09-07 Simon Hausmann <simon.hausmann@nokia.com> + + Unreviewed prospective build fix. + + Use WTF namespace like in other files in the same directory to resolve unqualified + adoptPtr correctly. + + * tests/WebCompositorInputHandlerImplTest.cpp: + +2012-09-07 James Robinson <jamesr@chromium.org> + + [chromium] Remove transitional WebCompositorSupport fallback code + https://bugs.webkit.org/show_bug.cgi?id=96155 + + Reviewed by Adrienne Walker. + + * src/LinkHighlight.cpp: + (WebKit::LinkHighlight::LinkHighlight): + (WebKit::LinkHighlight::startHighlightAnimation): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::readyStateChanged): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::setBackingTextureId): + (WebKit::WebPluginContainerImpl::setBackingIOSurfaceId): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): + (WebKit): + +2012-09-07 James Robinson <jamesr@chromium.org> + + [chromium] Implement WebCompositorInputHandlerImpl on top of exposed API instead of CC internals + https://bugs.webkit.org/show_bug.cgi?id=96151 + + Reviewed by Adrienne Walker. + + Moves input handler setup code up to the WebKit layer instead of reaching in to CC internals. + WebLayerTreeViewImpl implements createInputHandler() by asking its embedder for a WebInputHandler. If one is + provided, it wraps the WebInputHandler in a CCInputHandler implementation to pass down to CC. + + WebViewImpl implements WebLayerTreeView::createInputHandler() by constructing a WebCompositorInputHandlerImpl + and storing its identifier for the didActivateCompositor call. From this point on the setup is the same as + before. + + WCIHI changes covered by unit tests, overall scrolling behavior manually tested. + + * WebKit.gypi: + * src/WebCompositorInputHandlerImpl.cpp: + (WebKit::WebCompositorInputHandlerImpl::fromIdentifier): + (WebKit::WebCompositorInputHandlerImpl::WebCompositorInputHandlerImpl): + (WebKit::WebCompositorInputHandlerImpl::~WebCompositorInputHandlerImpl): + (WebKit::WebCompositorInputHandlerImpl::setClient): + (WebKit::WebCompositorInputHandlerImpl::handleInputEvent): + (WebKit::WebCompositorInputHandlerImpl::handleInputEventInternal): + (WebKit::WebCompositorInputHandlerImpl::handleGestureFling): + (WebKit::WebCompositorInputHandlerImpl::bindToClient): + * src/WebCompositorInputHandlerImpl.h: + (WebCompositorInputHandlerImpl): + (WebKit::WebCompositorInputHandlerImpl::identifier): + * src/WebLayerTreeViewImpl.cpp: + (WebKit::WebLayerTreeViewImpl::createInputHandler): + (WebKit): + * src/WebLayerTreeViewImpl.h: + (WebLayerTreeViewImpl): + * src/WebToCCInputHandlerAdapter.cpp: Added. + (WebKit): + (WebKit::WebToCCInputHandlerAdapter::create): + (WebKit::WebToCCInputHandlerAdapter::WebToCCInputHandlerAdapter): + (WebKit::WebToCCInputHandlerAdapter::~WebToCCInputHandlerAdapter): + (WebToCCInputHandlerAdapter::ClientAdapter): + (WebKit::WebToCCInputHandlerAdapter::ClientAdapter::ClientAdapter): + (WebKit::WebToCCInputHandlerAdapter::ClientAdapter::~ClientAdapter): + (WebKit::WebToCCInputHandlerAdapter::bindToClient): + (WebKit::WebToCCInputHandlerAdapter::animate): + * src/WebToCCInputHandlerAdapter.h: Copied from Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostClient.h. + (WebKit): + (WebToCCInputHandlerAdapter): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): + (WebKit): + (WebKit::WebViewImpl::createInputHandler): + * src/WebViewImpl.h: + (WebViewImpl): + * tests/CCThreadedTest.cpp: + * tests/FakeCCLayerTreeHostClient.h: + * tests/WebCompositorInputHandlerImplTest.cpp: + (MockWebInputHandlerClient): + (WebKit::MockWebInputHandlerClient::MockWebInputHandlerClient): + (WebKit::MockWebInputHandlerClient::~MockWebInputHandlerClient): + (WebKit::WebCompositorInputHandlerImplTest::WebCompositorInputHandlerImplTest): + (WebCompositorInputHandlerImplTest): + (WebKit::TEST_F): + +2012-09-07 David Reveman <reveman@chromium.org> + + [Chromium] Multiple commits without invalidation allowed per redraw. + https://bugs.webkit.org/show_bug.cgi?id=95661 + + Reviewed by James Robinson. + + * tests/CCLayerTreeHostTest.cpp: + (CCLayerTreeHostTestContinuousCommit): + (WebKitTests::CCLayerTreeHostTestContinuousCommit::CCLayerTreeHostTestContinuousCommit): + (WebKitTests): + (WebKitTests::TEST_F): + (CCLayerTreeHostTestContinuousInvalidate): + (WebKitTests::CCLayerTreeHostTestContinuousInvalidate::CCLayerTreeHostTestContinuousInvalidate): + (CCLayerTreeHostTestContinuousAnimate): + (WebKitTests::CCLayerTreeHostTestContinuousAnimate::CCLayerTreeHostTestContinuousAnimate): + * tests/CCSchedulerStateMachineTest.cpp: + (WebCore::TEST): + +2012-09-07 Dominic Mazzoni <dmazzoni@google.com> + + AX: WebCore accessibility roles should be cross-platform + https://bugs.webkit.org/show_bug.cgi?id=94870 + + Reviewed by Chris Fleizach. + + Add a new accessibility role. + + * public/WebAccessibilityRole.h: + * src/AssertMatchingEnums.cpp: + +2012-09-07 Dominic Mazzoni <dmazzoni@google.com> + + AX: Chromium needs access to canvasHasFallbackContent + https://bugs.webkit.org/show_bug.cgi?id=96124 + + Reviewed by Chris Fleizach. + + Expose canvasHasFallbackContent on Chromium. + + * public/WebAccessibilityObject.h: + (WebAccessibilityObject): + * src/WebAccessibilityObject.cpp: + (WebKit::WebAccessibilityObject::canvasHasFallbackContent): + (WebKit): + +2012-09-07 Robert Kroeger <rjkroege@chromium.org> + + [chromium] Add touchscreen specific fling curve parametrization + https://bugs.webkit.org/show_bug.cgi?id=95997 + + Reviewed by James Robinson. + + Added a new set of fling curve parameters with a good feel for touchscreen + initiated flings. Renamed TouchpadFlingPlatformGestureCurve to + TouchFlingPlatformGestureCurve to better reflect that the class + can serve for both touchscreen and touchpad flings when appropriately + parametrized. Updated build files as necessary for the rename. + + No new tests - existing tests apply. + + + * tests/PlatformGestureCurveTest.cpp: To use the renamed curve constructor. + +2012-09-07 Dana Jansens <danakj@chromium.org> + + [chromium] Make RenderPass ids hold both generating layer id and an index + https://bugs.webkit.org/show_bug.cgi?id=95500 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCLayerTreeHostTest.cpp: + * tests/CCRenderSurfaceTest.cpp: + * tests/CCRendererGLTest.cpp: + (FakeCCRendererClient::FakeCCRendererClient): + +2012-09-07 Joshua Bell <jsbell@chromium.org> + + [Chromium] IndexedDB: public WebKit API changes for consolidating two-phase connect + https://bugs.webkit.org/show_bug.cgi?id=96122 + + Reviewed by Adam Barth. + + Prep work for landing Chromium side of http://webkit.org/b/90411 - the IDBFactory + open() method now takes the "database callbacks", rather than being sent through + in a later call. + + Also, delete an obsolete method. + + * public/WebIDBFactory.h: + (WebKit): + (WebIDBFactory): Delete pre-version overload of open(). + (WebKit::WebIDBFactory::open): Add overload that takes WebIDBDatabaseCallbacks. + +2012-09-07 Sami Kyostila <skyostil@google.com> + + [Chromium] GraphicsLayerChromiumTest::applyScrollToScrollableArea() is failing + https://bugs.webkit.org/show_bug.cgi?id=95932 + + Reviewed by James Robinson. + + Give the FakeScrollableArea valid geometry to allow ScrollAnimatorMac to + properly scroll it. + + * tests/GraphicsLayerChromiumTest.cpp: + (WebKit::TEST_F): Re-enable the test. + +2012-09-07 James Robinson <jamesr@chromium.org> + + [chromium] Move some CC unit tests into correct gyp variable + https://bugs.webkit.org/show_bug.cgi?id=96048 + + Reviewed by Adrienne Walker. + + These tests are testing compositor internals, so they belong in the webkit_compositor_unittest_files variable. + + * WebKit.gypi: + +2012-09-07 James Robinson <jamesr@chromium.org> + + [chromium] Remove dead CCActiveGestureAnimation code and related classes + https://bugs.webkit.org/show_bug.cgi?id=96075 + + Reviewed by Adrienne Walker. + + Cuts out unnecessary boilerplate in PlatformGestureCurve evaluation for handling flings. WCIHI can easily + evaluate the curve itself without intermediate classes. + + * src/WebCompositorInputHandlerImpl.cpp: + (WebKit::WebCompositorInputHandlerImpl::handleGestureFling): + (WebKit::WebCompositorInputHandlerImpl::animate): + (WebKit::WebCompositorInputHandlerImpl::cancelCurrentFling): + * src/WebCompositorInputHandlerImpl.h: + (WebCore): + (WebCompositorInputHandlerImpl): + * tests/PlatformGestureCurveTest.cpp: + * tests/WebCompositorInputHandlerImplTest.cpp: + +2012-09-07 James Robinson <jamesr@chromium.org> + + [chromium] Clean up dependencies in ScrollbarLayerChromiumTest + https://bugs.webkit.org/show_bug.cgi?id=96052 + + Reviewed by Adrienne Walker. + + Fixes two minor but annoying dependencies in ScrollbarLayerChromiumTest: + *) WebScrollbarImpl.h is #included, but not use + *) The two-arg constructor of WebThemeScrollbarPainter is used, but this is guarded by #if + WEBKIT_IMPLEMENTATION. The no-arg c'tor does the right thing for this test. + + * tests/ScrollbarLayerChromiumTest.cpp: + (WebCore::TEST): + +2012-09-07 Dominic Mazzoni <dmazzoni@google.com> + + AX: ARIA spin button should support range value attributes + https://bugs.webkit.org/show_bug.cgi?id=96076 + + Reviewed by Chris Fleizach. + + Expose supportsRangeValue to simplify Chromium logic for when to + extract a value from a range. + + * public/WebAccessibilityObject.h: + (WebAccessibilityObject): + * src/WebAccessibilityObject.cpp: + (WebKit::WebAccessibilityObject::supportsRangeValue): + (WebKit): + +2012-09-07 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + Simplify hitTestResultAtPoint and nodesFromRect APIs + https://bugs.webkit.org/show_bug.cgi?id=95720 + + Reviewed by Antonio Gomes. + + Update calls to new API. + + * src/ContextMenuClientImpl.cpp: + (WebKit::selectMisspelledWord): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchDecidePolicyForNavigationAction): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::characterIndexForPoint): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::isRectTopmost): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleMouseUp): + (WebKit::WebViewImpl::computeBlockBounds): + +2012-09-07 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: NMI: move WebCore specific code to separate header + https://bugs.webkit.org/show_bug.cgi?id=96101 + + Reviewed by Yury Semikhatsky. + + I extracted WebCore related code from MemoryInstrumentation.h to WebCoreMemoryInstrumentation.h + + * tests/MemoryInstrumentationTest.cpp: + +2012-09-07 Ian Vollick <vollick@chromium.org> + + [chromium] We should accelerate all transformations, except when we must blend matrices that cannot be decomposed. + https://bugs.webkit.org/show_bug.cgi?id=95855 + + Reviewed by James Robinson. + + Added the following unit tests: + AnimationTranslationUtilTest.createTransformAnimationWithNonDecomposableMatrix + AnimationTranslationUtilTest.createTransformAnimationWithNonInvertibleTransform + + * tests/AnimationTranslationUtilTest.cpp: + (WebKit::TEST): + (WebKit): + +2012-09-07 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + X11 Global Selection + https://bugs.webkit.org/show_bug.cgi?id=88238 + + Reviewed by Tony Chang. + + Use new editor command for pasting global selection. + + * src/EditorClientImpl.cpp: + (WebKit::EditorClientImpl::supportsGlobalSelection): + * src/EditorClientImpl.h: + (EditorClientImpl): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleMouseUp): + +2012-09-07 Yoshifumi Inoue <yosin@chromium.org> + + We should have a localized string of empty for date time field + https://bugs.webkit.org/show_bug.cgi?id=96081 + + Reviewed by Kent Tamura. + + This patch add a function for getting localized string of empty field + value of date time fields for accessibility inside + ENABLE_INPUT_TYPE_TIME_MULTIPLE_FIELDS. + + These functions will be used by derived classes of DateTimeFieldElement. + + Note: We'll rename ENABLE_INPUT_TYPE_MULTIPLE_FIELDS to generic name + to support "date", "datetime", "month" and "week" multiple fields input + UI. + + * src/LocalizedStrings.cpp: + (WebCore::AXDateTimeFieldEmptyValueText): Added. + +2012-09-06 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r127822. + http://trac.webkit.org/changeset/127822 + https://bugs.webkit.org/show_bug.cgi?id=96073 + + It broke compilation on chromium debug bots (Requested by + loislo on #webkit). + + * tests/CCDrawQuadTest.cpp: + (WebCore::TEST): + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCLayerTreeHostTest.cpp: + * tests/CCRenderPassTest.cpp: + (WebCore::TEST): + * tests/CCRenderSurfaceTest.cpp: + * tests/CCRendererGLTest.cpp: + (FakeCCRendererClient::FakeCCRendererClient): + +2012-09-06 Dana Jansens <danakj@chromium.org> + + [chromium] Make RenderPass ids hold both generating layer id and an index + https://bugs.webkit.org/show_bug.cgi?id=95500 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCLayerTreeHostTest.cpp: + * tests/CCRenderSurfaceTest.cpp: + * tests/CCRendererGLTest.cpp: + (FakeCCRendererClient::FakeCCRendererClient): + +2012-09-06 Yoshifumi Inoue <yosin@chromium.org> + + We should have localized strings of date time fields for accessibility + https://bugs.webkit.org/show_bug.cgi?id=96050 + + Reviewed by Kent Tamura. + + This patch adds functions for getting localized strings of date time + fields for accessibility inside ENABLE_INPUT_TYPE_TIME_MULTIPLE_FIELDS. + + These functions will be used by derived classes of DateTimeFieldElement. + + Note: We'll rename ENABLE_INPUT_TYPE_MULTIPLE_FIELDS to generic name + to support "date", "datetime", "month" and "week" multiple fields input + UI. + + * src/LocalizedStrings.cpp: + (WebCore::AXAMPMFieldText): Added. + (WebCore::AXDayOfMonthFieldText): Added. + (WebCore::AXHourFieldText): Added. + (WebCore::AXMillisecondFieldText): Added. + (WebCore::AXMinuteFieldText): Added. + (WebCore::AXMonthFieldText): Added. + (WebCore::AXSecondFieldText): Added. + (WebCore::AXWeekOfYearFieldText): Added. + (WebCore::AXYearFieldText): Added. + +2012-09-06 James Robinson <jamesr@chromium.org> + + [chromium] Don't link cc in to WebKit.dll when use_libcc_for_compositor=1 + https://bugs.webkit.org/show_bug.cgi?id=96024 + + Reviewed by Adam Barth. + + When use_libcc_for_compositor=1, the implementation of the compositor guts are provided through PlatformSupport. + We don't need to link anything in to WebKit.dll. + + * WebKit.gyp: + +2012-09-06 James Robinson <jamesr@chromium.org> + + [chromium] Use WebCompositorSupport functions instead of WebCompositor statics + https://bugs.webkit.org/show_bug.cgi?id=96007 + + Reviewed by Adrienne Walker. + + Updates many tests to initialize / shutdown compositing with WebCompositorSupport. Adds a + WebCompositorInitializer RAII class to simplify this somewhat tedious process. + + * WebKit.gypi: + * public/WebCompositorInputHandlerClient.h: + (WebCompositorInputHandlerClient): + * src/WebCompositorInputHandlerImpl.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::composite): + (WebKit::WebViewImpl::scheduleAnimation): + (WebKit::WebViewImpl::scheduleComposite): + * tests/CCPrioritizedTextureTest.cpp: + (WTF::CCPrioritizedTextureTest::CCPrioritizedTextureTest): + (WTF::CCPrioritizedTextureTest::~CCPrioritizedTextureTest): + (CCPrioritizedTextureTest): + * tests/CCRendererGLTest.cpp: + (CCRendererGLTest::CCRendererGLTest): + (CCRendererGLTest::SetUp): + (CCRendererGLTest): + * tests/CCTextureUpdateControllerTest.cpp: + * tests/CCThreadedTest.cpp: + (WebKitTests::CCThreadedTest::runTest): + * tests/Canvas2DLayerBridgeTest.cpp: + (Canvas2DLayerBridgeTest::fullLifecycleTest): + * tests/GraphicsLayerChromiumTest.cpp: + (WebKit::GraphicsLayerChromiumTest::GraphicsLayerChromiumTest): + (WebKit::GraphicsLayerChromiumTest::~GraphicsLayerChromiumTest): + * tests/LayerChromiumTest.cpp: + * tests/LinkHighlightTest.cpp: + (WebCore::TEST): + * tests/TextureLayerChromiumTest.cpp: + * tests/TiledLayerChromiumTest.cpp: + * tests/WebCompositorInitializer.h: Added. + (WebKit): + (WebKitTests): + (WebCompositorInitializer): + (WebKitTests::WebCompositorInitializer::WebCompositorInitializer): + (WebKitTests::WebCompositorInitializer::~WebCompositorInitializer): + * tests/WebCompositorInputHandlerImplTest.cpp: + (WebKit::TEST): + (WebKit::WebCompositorInputHandlerImplTest::WebCompositorInputHandlerImplTest): + (WebCompositorInputHandlerImplTest): + * tests/WebLayerTest.cpp: + * tests/WebLayerTreeViewTest.cpp: + +2012-09-06 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-09-06 Alec Flett <alecflett@chromium.org> + + IndexedDB: make IDBKeyPath's string and array constructors explicit + https://bugs.webkit.org/show_bug.cgi?id=96004 + + Reviewed by Tony Chang. + + Fix test to use explicit constructor for IDBKeyPath. + + * tests/IDBDatabaseBackendTest.cpp: + +2012-09-06 Adrienne Walker <enne@google.com> + + [chromium] Remove GraphicsContext references from ContentLayerChromiumTest + https://bugs.webkit.org/show_bug.cgi?id=96002 + + Reviewed by James Robinson. + + This is a compositor unit test, so it shouldn't reference things + outside of the compositor like GraphicsContext. The + OpaqueRectTrackingContentLayerDelegateTest already tests opaque + tracking right at the time of paint. This test is about verifying that + transformed canvases work properly, so can just fake the opaque rect + coming back from the paint. + + * tests/ContentLayerChromiumTest.cpp: + (WebKit::MockContentLayerChromiumClient::MockContentLayerChromiumClient): + (WebKit::TEST): + +2012-09-06 Jeff Timanus <twiz@chromium.org> + + [Chromium] Remove contentsScale and related logic from GraphicsLayerChromium. + https://bugs.webkit.org/show_bug.cgi?id=95094 + + Reviewed by Adrienne Walker. + + In the short term, the page-scale logic is to be unified in the CCLayerTreeHost class. This is a first pass to + try to remove the page-scale logic from GraphicsLayerChromium. This change should be a no-op in terms of + contentsScale behaviour. + This change exports the disregardsPageScale() set of functions from WebContentLayer to LayerChromium. + + * src/NonCompositedContentHost.cpp: + (WebKit::NonCompositedContentHost::NonCompositedContentHost): + Inform the layer associated with the NCCH that it is to disregard the page scale factor. + Also remove now unused m_deviceScaleFactor and associated routines. + (WebKit::NonCompositedContentHost::setViewport): + * src/NonCompositedContentHost.h: + (NonCompositedContentHost): + * src/WebContentLayerImpl.cpp: + (WebKit::WebContentLayerImpl::setBoundsContainPageScale): + (WebKit): + (WebKit::WebContentLayerImpl::boundsContainPageScale): + * src/WebContentLayerImpl.h: + (WebContentLayerImpl): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::updateLayerTreeViewport): + * tests/CCLayerTreeHostTest.cpp: + (NoScaleContentLayerChromium): + (WebKitTests::NoScaleContentLayerChromium::create): + (WebKitTests::NoScaleContentLayerChromium::NoScaleContentLayerChromium): + (WebKitTests): + (WebKitTests::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers): + Rebaselined to correspond to the new behaviour. Because the layers are now assigned a contentsScale, the + scale on the draw transforms remain identity. + * tests/GraphicsLayerChromiumTest.cpp: + (WebKit): Remove now obsolete unit-test. + +2012-09-06 Adrienne Walker <enne@google.com> + + [chromium] Remove Scrollbar/Settings dependencies from ScrollbarLayerChromiumTest + https://bugs.webkit.org/show_bug.cgi?id=95994 + + Reviewed by James Robinson. + + This compositor test shouldn't depend on code outside the compositor. + + * tests/ScrollbarLayerChromiumTest.cpp: + (WebCore::FakeWebScrollbar::create): + (FakeWebScrollbar): + (WebCore::TEST): + +2012-09-06 James Robinson <jamesr@chromium.org> + + [chromium] Put chromium implementations of WTF symbols in separate static library + https://bugs.webkit.org/show_bug.cgi?id=95933 + + Reviewed by Adam Barth. + + A few symbols from WTF are implemented in chromium on top of the chromium WebKit Platform API. These + implementation files are in WebKit/chromium/src and currently link into the webkit target, which in the + component build is a DLL. This moves these files into a static library that webkit depends on so targets can + statically link in wtf and these support files without depending directly on webkit. + + * WebKit.gyp: + +2012-09-06 Iain Merrick <husky@chromium.org> + + [chromium] Add WebFrame::moveSelectionStart, moveSelectionEnd, moveCaret + https://bugs.webkit.org/show_bug.cgi?id=93998 + + Reviewed by Adam Barth. + + These provide the same functionality selectRange(WebPoint, WebPoint), + with finer-grained control needed on the Android platform. By passing + allowCollapsedSelection=false, we can ensure the selection stays at + least one character wide. + + I have reimplemented WebFrameImpl::selectRange(WebPoint, WebPoint) by + calling the new methods. The existing test passes, and I've added new + tests for the new methods. + + * public/WebFrame.h: + (WebFrame): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::selectRange): + (WebKit): + (WebKit::WebFrameImpl::moveSelectionStart): + (WebKit::WebFrameImpl::moveSelectionEnd): + (WebKit::WebFrameImpl::moveCaret): + * src/WebFrameImpl.h: + (WebFrameImpl): + * tests/WebFrameTest.cpp: + * tests/data/text_selection.html: Added. + +2012-09-06 Robert Kroeger <rjkroege@chromium.org> + + [chromium] Enable different fling behaviour for touchscreen and touchpad + https://bugs.webkit.org/show_bug.cgi?id=95756 + + Reviewed by James Robinson. + + Add support for a flag on WebGestureEvents that differentiates GestureFlingStart + events by their originating device and pass this flag to a factory that produces + different device specific fling curves based on the value of the flag. + + * public/WebActiveWheelFlingParameters.h: + (WebActiveWheelFlingParameters): Store source device for transfer to mainthread. + (WebKit::WebActiveWheelFlingParameters::WebActiveWheelFlingParameters): + * public/WebInputEvent.h: Added source device flag to WebGestureEvent. + * src/WebCompositorInputHandlerImpl.cpp: + (WebKit::WebCompositorInputHandlerImpl::handleGestureFling): Use factory to + obtain device-appropriate fling curve. + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleGestureEvent): Use factory to obtain device-appropriate + fling curve. + (WebKit::WebViewImpl::transferActiveWheelFlingAnimation): + +2012-09-05 Sam Weinig <sam@webkit.org> + + Part 2 of removing PlatformString.h, remove PlatformString.h + https://bugs.webkit.org/show_bug.cgi?id=95931 + + Reviewed by Adam Barth. + + Remove PlatformString.h + + * src/ContextMenuClientImpl.cpp: + * src/EditorClientImpl.cpp: + * src/InspectorFrontendClientImpl.cpp: + * src/LocalFileSystemChromium.cpp: + * src/SpeechInputClientImpl.cpp: + * src/SpeechRecognitionClientProxy.h: + * src/WebDevToolsAgentImpl.cpp: + * src/WebDevToolsFrontendImpl.cpp: + * src/WebDevToolsFrontendImpl.h: + * src/WebEntities.h: + * src/WebFrameImpl.h: + * src/WorkerFileSystemCallbacksBridge.h: + * tests/UniscribeHelperTest.cpp: + +2012-09-06 Dana Jansens <danakj@chromium.org> + + [chromium] Add a customized copy() method to CCRenderPassDrawQuad + https://bugs.webkit.org/show_bug.cgi?id=95871 + + Reviewed by Adrienne Walker. + + * tests/CCDrawQuadTest.cpp: + (WebCore): + (WebCore::TEST): + +2012-09-06 Ilya Tikhonovsky <loislo@chromium.org> + + Unreviewed Web Inspector: test fix. + + * tests/MemoryInstrumentationTest.cpp: + (StringOwnerInstrumented): + (WebCore::StringOwnerInstrumented::StringOwnerInstrumented): + (WebCore::StringOwnerInstrumented::reportMemoryUsage): + (WebCore): + (WebCore::TEST): + +2012-09-06 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: NMI: switch to hierarchical identifiers of MemoryBlockTypes and use these identifiers in protocol. + https://bugs.webkit.org/show_bug.cgi?id=95957 + + Reviewed by Yury Semikhatsky. + + Now when we use string identifiers as MemoryObjectType we can use them as the identifiers for the protocol + instead of MemoryBlockNames hardcoded in InspectorMemoryAgent.. + At a later stage, when each memory type is counted in MemoryInstrumentation + we will build the blocks hierarchy for the front-end automatically. + + * tests/MemoryInstrumentationTest.cpp: + (WebCore::InstrumentedUndefined::InstrumentedUndefined): + (WebCore::InstrumentedUndefined::reportMemoryUsage): + (WebCore::InstrumentedDOM::InstrumentedDOM): + (WebCore::InstrumentedDOM::reportMemoryUsage): + (InstrumentedDOM): + (WebCore::TEST): + +2012-09-06 Kenichi Ishibashi <bashi@chromium.org> + + [Chromium] Win build fix attempt after r127715 + + * tests/CCRenderPassTest.cpp: + (WebCore::TEST): + +2012-09-06 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-09-06 Dana Jansens <danakj@chromium.org> + + [chromium] Add a copy() method to CCRenderPass + https://bugs.webkit.org/show_bug.cgi?id=95485 + + Reviewed by Adrienne Walker. + + * WebKit.gypi: + * tests/CCRenderPassTest.cpp: Added. + (CCTestRenderPass): + (CCTestRenderPass::quadList): + (CCTestRenderPass::sharedQuadStateList): + (CCRenderPassSize): + (TEST): + +2012-09-06 Peter Beverloo <peter@chromium.org> + + [Chromium] Chromium Mac build fix after revision r127711 + https://bugs.webkit.org/show_bug.cgi?id=95958 + + Unreviewed build fix. + + This is a clear typo in the source file, so changing the function to + call locationModifiersFromWindowsKeyCode instead. + + * src/mac/WebInputEventFactory.mm: + (WebKit::WebInputEventFactory::keyboardEvent): + +2012-09-06 Raymes Khoury <raymes@chromium.org> + + Added modifiers to distinguish between left/right Shift/Ctrl/Alt in WebInputEvents + https://bugs.webkit.org/show_bug.cgi?id=94142 + + Reviewed by Tony Chang. + + Previously we distinguished between left/right Shift/Ctrl/Alt in + WebInputEvents by using the location-specific virtual keycodes (e.g. + VK_LSHIFT instead of VK_SHIFT. However, the Windows API for key events + always returns the non-locational version (e.g. VK_SHIFT). + Furthermore, KeyboardEvent also returns + non-locational keycodes and separates the location information which + matches the behavior described in the DOM3 + spec http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboardevents. We + should be consistent with this in our representation of key events. + This patch changes WebInputEvents so they always store the + non-locational keycode and location information is stored in + modifiers. Since this only changes internal representation, no new + tests are added. + + This patch also ensures that when KeyboardEvents are converted back to + WebInputEvents location information is preserved (which was not + happening before). This is important so that key location information + is passed on to plugins. A unittest is added for this. + + * WebKit.gypi: + * public/WebInputEvent.h: + (WebKeyboardEvent): + * src/WebInputEvent.cpp: + (WebKit): + (WebKit::WebKeyboardEvent::windowsKeyCodeWithoutLocation): + (WebKit::WebKeyboardEvent::locationModifiersFromWindowsKeyCode): + * src/WebInputEventConversion.cpp: + (WebKit::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): + (WebKit::WebKeyboardEventBuilder::WebKeyboardEventBuilder): + * src/android/WebInputEventFactory.cpp: + (WebKit::WebInputEventFactory::keyboardEvent): + * src/gtk/WebInputEventFactory.cpp: + (WebKit::WebInputEventFactory::keyboardEvent): + * src/mac/WebInputEventFactory.mm: + (WebKit::WebInputEventFactory::keyboardEvent): + * src/win/WebInputEventFactory.cpp: + (WebKit::getLocationModifier): + (WebKit::WebInputEventFactory::keyboardEvent): + * tests/WebInputEventConversionTest.cpp: Added. + +2012-09-06 Adam Barth <abarth@webkit.org> + + Chromium should call restrictScaleFactorToInitialScaleIfNotUserScalable unless/until userScalable is supported directly. + https://bugs.webkit.org/show_bug.cgi?id=91110 + + Reviewed by Tony Chang. + + Prior to this patch, we were ignoring the user-scalable property of + viewport meta tags. This patch enforces the user-scalable property by + claming the minimum-scale and maximum-scale values, effectively + preventing user scaling. This approach isn't perfect, as discussed in + https://bugs.webkit.org/show_bug.cgi?id=70609, but it is an improvement + over the status quo. + + This approach is also used by EFL, GTK, and Qt. + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::dispatchViewportPropertiesDidChange): + +2012-09-05 Dana Jansens <danakj@chromium.org> + + [chromium] Add a copy() method to CCDrawQuad and CCSharedQuadState + https://bugs.webkit.org/show_bug.cgi?id=95374 + + Reviewed by Adrienne Walker. + + * WebKit.gypi: + * tests/CCDrawQuadTest.cpp: Added. + (TEST): + (createSharedQuadState): + (compareDrawQuad): + +2012-09-05 Kenichi Ishibashi <bashi@chromium.org> + + [Chromium] Unreviewed gardening + + * tests/GraphicsLayerChromiumTest.cpp: + (WebKit::TEST_F): Disabled applyScrollToScrollableArea() + +2012-09-05 Tony Chang <tony@chromium.org> + + [chromium] Remove dependency on webkit_user_agent + https://bugs.webkit.org/show_bug.cgi?id=95886 + + Reviewed by Adam Barth. + + The code isn't used by webkit_unit_tests. + + * WebKitUnitTests.gyp: + +2012-09-05 Nate Chapin <japhet@chromium.org> + + Test for https://bugs.webkit.org/show_bug.cgi?id=91685 + + Reviewed by Adam Barth. + + * tests/WebFrameTest.cpp: + +2012-09-05 Rick Byers <rbyers@chromium.org> + + Use new type-specific WebGestureEvent fields + https://bugs.webkit.org/show_bug.cgi?id=95573 + + Reviewed by James Robinson. + + Chromium has been updated to store gesture-type specific details in the + new WebGestureEvent fields (crrev.com/152508, crrev.com/154815 and + crrev.com/154959), so we can now rely on them. + + * src/WebCompositorInputHandlerImpl.cpp: + Update the compositor scroll, pinch and fling handling to use these new fields. + (WebKit::WebCompositorInputHandlerImpl::handleInputEventInternal): + (WebKit::WebCompositorInputHandlerImpl::handleGestureFling): + * src/WebInputEventConversion.cpp: + Update PlatformGestureEvent/WebGestureEvent conversion to use the new + fields, storing into the existing overloaded PlatformGestureEvent + fields (which will be cleaned up in my next CL). + (WebKit::PlatformGestureEventBuilder::PlatformGestureEventBuilder): + (WebKit::WebGestureEventBuilder::WebGestureEventBuilder): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleGestureEvent): + Update fling scrolling implementation for correct location of velocity. + * tests/WebCompositorInputHandlerImplTest.cpp: + (WebKit::TEST_F): + Update tests to use the new fields. + + +2012-09-05 James Robinson <jamesr@chromium.org> + + [chromium] Test WebSolidColorLayer in WebLayerTest.Client unit test + https://bugs.webkit.org/show_bug.cgi?id=95819 + + Reviewed by Adam Barth. + + This unit test doesn't do all that much, but it does verify that WebSolidColorLayer doesn't completely explode + upon use and also makes sure that the WebSolidColorLayer::create() symbol is referenced and not dropped from + webkit.dll in the component build. + + * tests/WebLayerTest.cpp: + +2012-09-05 Victoria Kirst <vrk@chromium.org> + + Add the duration attribute to MediaSource + https://bugs.webkit.org/show_bug.cgi?id=95149 + + Reviewed by Eric Carlson. + + Add support for the duration attribute recently added to the MediaSource spec. + http://dev.w3.org/html5/spec/media-elements.html#dom-media-duration + + * public/WebMediaPlayer.h: + (WebKit::WebMediaPlayer::sourceSetDuration): Add empty definition. + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::sourceSetDuration): Forward call to m_webMediaPlayer. + (WebKit): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + +2012-09-05 Mihai Parparita <mihaip@chromium.org> + + [Chromium] history.{push,replace}State should no longer be V8EnabledAtRuntime + https://bugs.webkit.org/show_bug.cgi?id=95865 + + Reviewed by Darin Fisher. + + Make WebRuntimeFeatures::{enablePushState,isPushStateEnabled} into + no-ops. + + * public/WebRuntimeFeatures.h: + (WebRuntimeFeatures): + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enablePushState): + (WebKit::WebRuntimeFeatures::isPushStateEnabled): + +2012-09-05 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Remove getRenderStyleForStrike from PlatformSupport + https://bugs.webkit.org/show_bug.cgi?id=95363 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * public/linux/WebFontInfo.h: + * public/linux/WebFontRenderStyle.h: + * src/PlatformSupport.cpp: + (WebCore): + +2012-09-05 Ilya Tikhonovsky <loislo@chromium.org> + + Unreviewed: WebInspector: remove accidentally committed speed test. + + * tests/MemoryInstrumentationTest.cpp: + +2012-09-05 Sami Kyostila <skyostil@chromium.org> + + [chromium] Wire up scrollable sublayers in ScrollingCoordinatorChromium + https://bugs.webkit.org/show_bug.cgi?id=95679 + + Reviewed by James Robinson. + + Introduce WebLayerScrollClient for getting notified about scroll events targeting a WebLayer. + + * src/WebLayerImpl.cpp: + (WebKit::WebLayerImpl::setMaxScrollPosition): + (WebKit): + (WebKit::WebLayerImpl::setScrollClient): + (WebKit::WebLayerImpl::scrollBy): + * src/WebLayerImpl.h: + (WebLayerImpl): + * tests/CCLayerTreeHostTest.cpp: + * tests/GraphicsLayerChromiumTest.cpp: + (MockScrollableArea): + (WebKit): + (WebKit::TEST_F): + * tests/WebLayerTest.cpp: + +2012-09-05 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: NMI: extract MemoryObjectType constants from MemoryInstrumentation. + https://bugs.webkit.org/show_bug.cgi?id=95850 + + Reviewed by Yury Semikhatsky. + + I'd like to extract MemoryObjectTypes into separate classes. + After that we will be able to move core NMI instrumentation code to WTF. + + * tests/MemoryInstrumentationTest.cpp: + (WebCore::Instrumented::reportMemoryUsage): + (WebCore::InstrumentedRefPtr::reportMemoryUsage): + (WebCore::InstrumentedWithOwnPtr::reportMemoryUsage): + (WebCore::InstrumentedOther::reportMemoryUsage): + (WebCore::InstrumentedDOM::reportMemoryUsage): + (WebCore::TEST): + (WebCore::NonVirtualInstrumented::reportMemoryUsage): + +2012-09-05 Peter Beverloo <peter@chromium.org> + + Unreviewed, rolling out r127590. + http://trac.webkit.org/changeset/127590 + + Broke the Chromium bots because of a compile error in the compositor. + + * DEPS: + +2012-09-05 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-09-04 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: NMI: replace ObjectType enum with static const char* string identifiers. + https://bugs.webkit.org/show_bug.cgi?id=95739 + + Reviewed by Yury Semikhatsky. + + When we go deeper into different parts of browser like skia, chromium itself etc. + we can't use a single enum for all reported object types. + The current idea is to use plain simple strings as ObjectType identifiers. + In the future patches we will extract these identifiers into separate class or namespace + and and split it between components. + + * tests/MemoryInstrumentationTest.cpp: + (WebCore::TEST): + (WebCore): + +2012-09-04 Keishi Hattori <keishi@webkit.org> + + Move PagePopupClient implementation for input[type=date] to Chromium WebKit layer + https://bugs.webkit.org/show_bug.cgi?id=95681 + + Reviewed by Kent Tamura. + + * WebKit.gyp: + * src/ChromeClientImpl.cpp: + (WebKit): + (WebKit::ChromeClientImpl::openDateTimeChooser): + * src/ChromeClientImpl.h: + (WebCore): + (ChromeClientImpl): + * src/DateTimeChooserImpl.cpp: Added. + (WebKit): + (WebKit::DateTimeChooserImpl::DateTimeChooserImpl): + (WebKit::DateTimeChooserImpl::~DateTimeChooserImpl): + (WebKit::DateTimeChooserImpl::endChooser): + (WebKit::DateTimeChooserImpl::contentSize): + (WebKit::DateTimeChooserImpl::writeDocument): + (WebKit::DateTimeChooserImpl::setValueAndClosePopup): + (WebKit::DateTimeChooserImpl::didClosePopup): + * src/DateTimeChooserImpl.h: + (WebCore): + (WebKit): + (DateTimeChooserImpl): + +2012-09-04 Adam Barth <abarth@chromium.org> + + Make chromium-linux build without WTF_DEPRECATED_STRING_OPERATORS + https://bugs.webkit.org/show_bug.cgi?id=95798 + + Reviewed by Eric Seidel. + + * src/WebAccessibilityObject.cpp: + (WebKit::WebAccessibilityObject::keyboardShortcut): + - Remove use of WTF::String::operator+= + * src/WebPageSerializerImpl.cpp: + - Whitelist use of WTF::String::operator+=. Remove this use will take + some more careful thought. + +2012-09-04 Alec Flett <alecflett@chromium.org> + + IndexedDB: remove final createIndex backend glue + https://bugs.webkit.org/show_bug.cgi?id=95385 + + Reviewed by Adam Barth. + + Remove chromium glue for old key-generation code. + + * public/WebIDBKey.h: + (WebIDBKey): + * src/WebIDBKey.cpp: + +2012-09-04 Tien-Ren Chen <trchen@chromium.org> + + [chromium] Rename WebViewClient::handleDisambiguationPopup + https://bugs.webkit.org/show_bug.cgi?id=95529 + + Reviewed by Adam Barth. + + Rename it to something more descriptive (WebViewClient::didTapMultipleTargets) before people start using it. + + * public/WebViewClient.h: + (WebKit::WebViewClient::didTapMultipleTargets): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleGestureEvent): + * tests/WebFrameTest.cpp: + +2012-09-03 Tao Bai <michaelbai@chromium.org> + + Added ANDROID_GDBSERVER definition for Ant + https://bugs.webkit.org/show_bug.cgi?id=95265 + + Reviewed by Adam Barth. + + ANDROID_GDBSERVER will replace ANDROID_TOOLCHAIN, because the ANDROID_TOOLCHAIN + is only used for finding the gdbserver. + + * WebKitUnitTests.gyp: + +2012-09-03 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-09-03 Tommy Widenflycht <tommyw@google.com> + + MediaStream API: Add Ice-related functionality to RTCPeerConnection + https://bugs.webkit.org/show_bug.cgi?id=95565 + + Reviewed by Adam Barth. + + * src/AssertMatchingEnums.cpp: + +2012-09-01 James Robinson <jamesr@chromium.org> + + Unreviewed chromium buildfix when use_libcc_for_compositor=1 + + This gyp target was renamed downstream. + + * WebKit.gyp: + +2012-09-01 Tommy Widenflycht <tommyw@google.com> + + MediaStream API: Add MediaStream management to RTCPeerConnection + https://bugs.webkit.org/show_bug.cgi?id=95543 + + Reviewed by Adam Barth. + + * src/AssertMatchingEnums.cpp: + +2012-08-31 Koji Ishii <kojiishi@gmail.com> + + Glyphs in vertical text tests are rotated 90 degrees clockwise on Chromium Windows + https://bugs.webkit.org/show_bug.cgi?id=51450 + + Reviewed by Tony Chang. + + When writing-mode is vertical-*, Chromium Win does not render glyphs correctly. + http://dev.w3.org/csswg/css3-writing-modes/#writing-mode + Glyphs are now drawn in the correct orientation, regardless of the leading '@' in the font name, + and vertical alternate glyphs (OpenType 'vert' feature) is not enabled. + CJK characters drawn at wrong baseline position is also fixed. + In addition, fontMetrics().unitsPerEm() and SimpleFontData::platformBoundsForGlyph() were empty + in Chromium Win but they were implemented because they were needed to draw vertical flow correctly. + + Note that this patch does not address issues in vertical flow for complex code path. + The issue is under discussion with Google people and it will not be fixed in short term. + + Existing tests in fast/writing-mode/* are enabled in LayoutTests/platform/chromium/TestExpectations. + + * features.gypi: ENABLE_OPENTYPE_VERTICAL=1. + +2012-08-31 W. James MacLean <wjmaclean@chromium.org> + + [chromium] Make link highlighter use same node selection criteria as Chromium for Android. + https://bugs.webkit.org/show_bug.cgi?id=95371 + + Reviewed by James Robinson. + + This CL brings the selection criteria for link highlight targets into alignment with Chromium for Android. + + * src/WebViewImpl.cpp: + (WebKit::highlightConditions): + (WebKit::WebViewImpl::bestTouchLinkNode): + * tests/data/test_touch_link_highlight.html: + +2012-08-31 James Robinson <jamesr@chromium.org> + + [chromium] Consolidate geometry unit testing functions for cc + https://bugs.webkit.org/show_bug.cgi?id=95526 + + Reviewed by Julien Chaffraix. + + This consolidates geometry equality (rects, matrices) in CCGeometryUtils and removes a few duplicate macros for + testing rect equality. + + * WebKit.gypi: + * tests/CCDamageTrackerTest.cpp: + (WebKitTests::TEST_F): + * tests/CCGeometryTestUtils.cpp: Added. + (WebKitTests): + (WebKitTests::ExpectTransformationMatrixEq): + * tests/CCGeometryTestUtils.h: Renamed from Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h. + (WebKit): + (WebKitTests): + * tests/CCLayerTreeHostTest.cpp: + * tests/CCMathUtilTest.cpp: + (WebKit::TEST): + * tests/TiledLayerChromiumTest.cpp: + +2012-08-31 James Robinson <jamesr@chromium.org> + + [chromium] Clean up Web*Layer initialization paths + https://bugs.webkit.org/show_bug.cgi?id=95523 + + Reviewed by Darin Fisher. + + Constructing a Web*LayerImpl (or other compositor type) wrapper shouldn't require knowledge of the underyling + implementation. Also normalizes naming conventions in these files. + + * src/WebAnimationImpl.cpp: + (WebKit::WebAnimation::create): + (WebKit::WebAnimationImpl::WebAnimationImpl): + * src/WebAnimationImpl.h: + (WebAnimationImpl): + * src/WebContentLayerImpl.cpp: + (WebKit::WebContentLayerImpl::WebContentLayerImpl): + (WebKit::WebContentLayerImpl::~WebContentLayerImpl): + (WebKit::WebContentLayerImpl::layer): + (WebKit::WebContentLayerImpl::setDoubleSided): + (WebKit::WebContentLayerImpl::setContentsScale): + (WebKit::WebContentLayerImpl::setUseLCDText): + (WebKit::WebContentLayerImpl::setDrawCheckerboardForMissingTiles): + * src/WebContentLayerImpl.h: + (WebContentLayerImpl): + * src/WebFloatAnimationCurveImpl.cpp: + (WebKit::WebFloatAnimationCurve::create): + (WebKit::WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl): + * src/WebFloatAnimationCurveImpl.h: + (WebFloatAnimationCurveImpl): + * src/WebIOSurfaceLayerImpl.cpp: + (WebKit::WebIOSurfaceLayer::create): + (WebKit::WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl): + * src/WebIOSurfaceLayerImpl.h: + (WebIOSurfaceLayerImpl): + * src/WebImageLayerImpl.cpp: + (WebKit::WebImageLayer::create): + (WebKit::WebImageLayerImpl::WebImageLayerImpl): + * src/WebImageLayerImpl.h: + (WebImageLayerImpl): + * src/WebLayerImpl.cpp: + (WebKit::WebLayer::create): + (WebKit): + (WebKit::WebLayerImpl::WebLayerImpl): + * src/WebLayerImpl.h: + (WebLayerImpl): + * src/WebScrollbarLayerImpl.cpp: + (WebKit::WebScrollbarLayer::create): + (WebKit::WebScrollbarLayerImpl::WebScrollbarLayerImpl): + * src/WebScrollbarLayerImpl.h: + (WebScrollbarLayerImpl): + * src/WebSolidColorLayerImpl.cpp: + (WebKit::WebSolidColorLayer::create): + (WebKit::WebSolidColorLayerImpl::WebSolidColorLayerImpl): + * src/WebSolidColorLayerImpl.h: + (WebSolidColorLayerImpl): + * src/WebTransformAnimationCurveImpl.cpp: + (WebKit::WebTransformAnimationCurve::create): + (WebKit::WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl): + * src/WebTransformAnimationCurveImpl.h: + (WebTransformAnimationCurveImpl): + * src/WebVideoLayerImpl.cpp: + (WebKit::WebVideoLayer::create): + (WebKit::WebVideoLayerImpl::WebVideoLayerImpl): + * src/WebVideoLayerImpl.h: + (WebVideoLayerImpl): + +2012-08-31 Tony Chang <tony@chromium.org> + + Remove ENABLE_CSS3_FLEXBOX compile time flag + https://bugs.webkit.org/show_bug.cgi?id=95382 + + Reviewed by Ojan Vafai. + + Everyone is already enabling this by default and the spec has stablized. + + * features.gypi: + +2012-08-31 Christopher Cameron <ccameron@chromium.org> + + [chromium] Add main versus impl thread asserts + https://bugs.webkit.org/show_bug.cgi?id=95596 + + Reviewed by James Robinson. + + Add asserts to prioritized texture manager that specify that a + function be called on the main or impl thread. + + Add debug signs that the main thread is blocked to the threaded + proxy. + + Add a mechanism to simultaneously set the thread to the impl thread + and indicate that the main thread is blocked. + + Update tests that hit asserts in the prioritized texture manager to + set their impl thread and main thread blocked state correctly. + + * tests/CCPrioritizedTextureTest.cpp: + (WTF::CCPrioritizedTextureTest::CCPrioritizedTextureTest): + (WTF::CCPrioritizedTextureTest::~CCPrioritizedTextureTest): + (WTF::CCPrioritizedTextureTest::validateTexture): + (WTF::TEST_F): + * tests/TiledLayerChromiumTest.cpp: + +2012-08-30 James Robinson <jamesr@chromium.org> + + [chromium] Put compositor client interfaces in separate headers, normalize naming + https://bugs.webkit.org/show_bug.cgi?id=95522 + + Reviewed by Adam Barth. + + * src/WebContentLayerImpl.cpp: + (WebKit::WebContentLayerImpl::~WebContentLayerImpl): + * src/WebContentLayerImpl.h: + (WebContentLayerImpl): + * src/WebExternalTextureLayerImpl.h: + * src/WebLayerTreeViewImpl.h: + (WebCore): + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/CCLayerTreeHostTest.cpp: + (WebKitTests::ContentLayerChromiumWithUpdateTracking::create): + (WebKitTests::ContentLayerChromiumWithUpdateTracking::ContentLayerChromiumWithUpdateTracking): + (WebKitTests::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers): + (WebKitTests::CCLayerTreeHostTestAtomicCommit::CCLayerTreeHostTestAtomicCommit): + (WebKitTests::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::CCLayerTreeHostTestAtomicCommitWithPartialUpdate): + (WebKitTests::CCLayerTreeHostTestLostContextWhileUpdatingResources::CCLayerTreeHostTestLostContextWhileUpdatingResources): + (CCLayerTreeHostTestLostContextWhileUpdatingResources): + * tests/ContentLayerChromiumTest.cpp: + (WebKit::MockContentLayerChromiumClient::MockContentLayerChromiumClient): + (WebKit::TEST): + +2012-08-31 Gavin Peters <gavinp@chromium.org> + + [chromium] DEPS roll with a test skip. + https://bugs.webkit.org/show_bug.cgi?id=95601 + + Unreviewed gardening & DEPS roll. + + + fast/frames/cached-frame-counter.html was never the most stable test, and now it's failing on more platforms. Marking it flaky, along with a DEPS roll (earlier attempts at the DEPS roll failed on this) + + * DEPS: + +2012-08-31 Gavin Peters <gavinp@chromium.org> + + [chromium] Disable WebViewTest.AutoResizeMinimumSize + https://bugs.webkit.org/show_bug.cgi?id=95571 + + Unreviewed gardening. + + Disabling this test since it started failing in build 17225, see http://build.chromium.org/p/chromium.webkit/builders/Webkit%20Win/builds/17247 for instance. Will shortly file bug to re-enable this. + + * tests/WebViewTest.cpp: + +2012-08-30 James Robinson <jamesr@chromium.org> + + [chromium] Revert WebCompositorSupport to raw ptrs, make dtor protected + https://bugs.webkit.org/show_bug.cgi?id=95520 + + Reviewed by Darin Fisher. + + Adopt the return value of WebCompositorSupport explicitly. + + * src/LinkHighlight.cpp: + (WebKit::LinkHighlight::LinkHighlight): + (WebKit::LinkHighlight::startHighlightAnimation): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::readyStateChanged): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::setBackingTextureId): + (WebKit::WebPluginContainerImpl::setBackingIOSurfaceId): + +2012-08-30 James Robinson <jamesr@chromium.org> + + [chromium] Make webkit_compositor specific unit test compilation conditional on gyp var + https://bugs.webkit.org/show_bug.cgi?id=95401 + + Reviewed by Dirk Pranke. + + If use_libcc_for_compositor is set, these tests are being compiled and run elsewhere. + + * WebKit.gyp: + * WebKit.gypi: + * WebKitUnitTests.gyp: + +2012-08-27 James Robinson <jamesr@chromium.org> + + [chromium] Add CompositorSupport interface for constructing compositor classes + https://bugs.webkit.org/show_bug.cgi?id=95040 + + Reviewed by Darin Fisher. + + * src/LinkHighlight.cpp: + (WebKit::LinkHighlight::LinkHighlight): + (WebKit::LinkHighlight::startHighlightAnimation): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::readyStateChanged): + * src/WebMediaPlayerClientImpl.h: + (WebKit): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::setBackingTextureId): + (WebKit::WebPluginContainerImpl::setBackingIOSurfaceId): + * src/WebPluginContainerImpl.h: + (WebKit): + +2012-08-30 Gavin Peters <gavinp@chromium.org> + + [chromium] Disable CCLayerTreeHostTestScrollMultipleRedraw.runMultiThread + https://bugs.webkit.org/show_bug.cgi?id=95472 + + Unreviewed gardening. + + When landing r127079, this test was re-enabled, and has not passed since. I'm disabling it, and created bug 95473 to track fixing this issue. + + * tests/CCLayerTreeHostTest.cpp: + (WebKitTests::TEST_F): + +2012-08-30 James Robinson <jamesr@chromium.org> + + [chromium] Clean up some webkit compositor unit tests + https://bugs.webkit.org/show_bug.cgi?id=95410 + + Reviewed by Adrienne Walker. + + This adds includes that were implicitly being picked up, removes ones that weren't being used, removes + dead code, adds OVERRIDE on functions that OVERRIDE, and deinlines virtuals that the chromium clang style + plugin is unhappy about. + + * tests/CCAnimationTestCommon.cpp: + (WebKitTests::FakeFloatAnimationCurve::duration): + (WebKitTests): + (WebKitTests::FakeFloatAnimationCurve::getValue): + (WebKitTests::FakeTransformTransition::duration): + (WebKitTests::FakeFloatTransition::duration): + (WebKitTests::FakeLayerAnimationControllerClient::id): + (WebKitTests::FakeLayerAnimationControllerClient::setOpacityFromAnimation): + (WebKitTests::FakeLayerAnimationControllerClient::opacity): + (WebKitTests::FakeLayerAnimationControllerClient::setTransformFromAnimation): + (WebKitTests::FakeLayerAnimationControllerClient::transform): + * tests/CCAnimationTestCommon.h: + (FakeFloatAnimationCurve): + (FakeTransformTransition): + (FakeFloatTransition): + (FakeLayerAnimationControllerClient): + * tests/CCTiledLayerTestCommon.cpp: + (WebKitTests::FakeLayerTextureUpdater::sampledTexelFormat): + (WebKitTests): + (WebKitTests::FakeTiledLayerWithScaledBounds::FakeTiledLayerWithScaledBounds): + (WebKitTests::FakeTiledLayerChromium::textureManager): + (WebKitTests::FakeTiledLayerChromium::textureUpdater): + (WebKitTests::FakeTiledLayerWithScaledBounds::contentBounds): + (WebKitTests::FakeTextureUploader::isBusy): + (WebKitTests::FakeTextureUploader::uploadTexture): + * tests/CCTiledLayerTestCommon.h: + (FakeLayerTextureUpdater): + (FakeTiledLayerChromium): + (FakeTiledLayerWithScaledBounds): + (FakeTextureUploader): + * tests/FakeWebCompositorOutputSurface.h: + * tests/TextureCopierTest.cpp: + (MockContext): + (TEST): + * tests/ThrottledTextureUploaderTest.cpp: + (WebKit::TEST): + * tests/WebLayerTreeViewTest.cpp: + +2012-08-29 Hironori Bono <hbono@chromium.org> + + Fix Chromium builds (Win and Mac) + https://bugs.webkit.org/show_bug.cgi?id=95421 + + Reviewed by James Robinson. + + This change replaces 'class WebRect' with 'struct WebRect' to fix build breaks + on the "Chromium Mac Release" and the "Chromium Win Release" bot caused by + r127095. + + * public/WebViewClient.h: + (WebKit): + +2012-08-29 Nat Duca <nduca@chromium.org> + + [chromium] setNeedsAnimate should not cause commitRequested to become true + https://bugs.webkit.org/show_bug.cgi?id=95393 + + Reviewed by James Robinson. + + * tests/CCLayerTreeHostTest.cpp: + (CCLayerTreeHostTestSetNeedsAnimateShouldNotSetCommitRequested): + (CCLayerTreeHostTestSetNeedsAnimateShouldNotSetCommitRequested::CCLayerTreeHostTestSetNeedsAnimateShouldNotSetCommitRequested): + +2012-08-29 Tien-Ren Chen <trchen@chromium.org> + + [chromium] Implement disambiguation popup (a.k.a. Link Preview) + https://bugs.webkit.org/show_bug.cgi?id=94182 + + Reviewed by Adam Barth. + + In this new implementation, we add a new WebViewClient::handleDisambiguationPopup delegate. + The disambiguation sequence will be initiated by the gesture event handler + in WebViewImpl if an ambiguous tap is detected, then + m_client->handleDisambiguationPopup will be called, so the embedder can + decide whether to swallow the touch event and show a popup. + + New test: WebFrameTest.DisambiguationPopupTest + + * WebKit.gyp: + * features.gypi: + * public/WebInputEvent.h: + (WebGestureEvent): + (WebKit::WebGestureEvent::WebGestureEvent): + * public/WebTouchCandidatesInfo.h: Removed. + * public/WebView.h: + (WebKit): + * public/WebViewClient.h: + (WebKit): + (WebViewClient): + (WebKit::WebViewClient::triggersLinkPreview): + * src/WebInputEvent.cpp: + (SameSizeAsWebGestureEvent): + * src/WebViewImpl.cpp: + (WebKit): + (WebKit::WebViewImpl::handleGestureEventWithLinkPreview): + (WebKit::WebViewImpl::handleGestureEvent): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-08-29 Dominic Mazzoni <dmazzoni@google.com> + + AX: Canvas should have a distinct role + https://bugs.webkit.org/show_bug.cgi?id=95248 + + Reviewed by Chris Fleizach. + + Add support for canvas accessibility role. + + * public/WebAccessibilityRole.h: + * src/AssertMatchingEnums.cpp: + +2012-08-29 Alex Sakhartchouk <alexst@chromium.org> + + [chromium] CCLayerTreeHost::finishCommitOnImplThread wrong setter order + https://bugs.webkit.org/show_bug.cgi?id=94828 + + Reviewed by Adrienne Walker. + + Testing that setDeviceScaleFactor properly changes maxScrollPosition + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-08-29 James Robinson <jamesr@chromium.org> + + Unreviewed, rolling out r126956. + http://trac.webkit.org/changeset/126956 + https://bugs.webkit.org/show_bug.cgi?id=94721 + + Breaks several unit tests + + * tests/CCSchedulerTest.cpp: + (WebKitTests::FakeCCSchedulerClient::reset): + (WebKitTests::FakeCCSchedulerClient::setHasMoreResourceUpdates): + (WebKitTests::TEST): + * tests/CCTextureUpdateControllerTest.cpp: + +2012-08-29 James Robinson <jamesr@chromium.org> + + [chromium] Register/unregister contents layers with GraphicsLayerChromium + https://bugs.webkit.org/show_bug.cgi?id=95379 + + Reviewed by Adrienne Walker. + + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl): + (WebKit::WebMediaPlayerClientImpl::readyStateChanged): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::setBackingTextureId): + (WebKit::WebPluginContainerImpl::setBackingIOSurfaceId): + (WebKit::WebPluginContainerImpl::~WebPluginContainerImpl): + +2012-08-29 W. James MacLean <wjmaclean@chromium.org> + + [chromium] Add WebSettings support for flag to enable/disable gesture tap highlights. + https://bugs.webkit.org/show_bug.cgi?id=95119 + + Reviewed by Adam Barth. + + Add support to WebSettings for flag to enable/disable gesture tap highlights. Relies on existing tests. + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::WebSettingsImpl): + (WebKit::WebSettingsImpl::setGestureTapHighlightEnabled): + (WebKit): + * src/WebSettingsImpl.h: + (WebSettingsImpl): + (WebKit::WebSettingsImpl::gestureTapHighlightEnabled): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleGestureEvent): + +2012-08-29 Dana Jansens <danakj@chromium.org> + + [chromium] Remove HUD layer when rootLayer is set to null + https://bugs.webkit.org/show_bug.cgi?id=95257 + + Reviewed by James Robinson. + + * WebKit.gypi: + * tests/CCHeadsUpDisplayTest.cpp: Added. + (CCHeadsUpDisplayTest): + (DrawsContentLayerChromium): + (DrawsContentLayerChromium::create): + (DrawsContentLayerChromium::DrawsContentLayerChromium): + (CCHudWithRootLayerChange): + (CCHudWithRootLayerChange::CCHudWithRootLayerChange): + (TEST_F): + * tests/CCLayerTreeHostTest.cpp: + * tests/CCThreadedTest.cpp: + (WebKitTests::CCThreadedTest::runTest): + * tests/CCThreadedTest.h: + (WebKitTests::CCThreadedTest::initializeSettings): + (CCThreadedTest): + +2012-08-29 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Add more unit test coverage for semantics of drawableContentRect and visibleContentRect + https://bugs.webkit.org/show_bug.cgi?id=94542 + + Reviewed by Adrienne Walker. + + To make upcoming refactors safer, it was appropriate to (finally) + add unit tests that check the behavior of drawableContentRect and + visibleContentRect computations in calculateDrawTransforms. + + * tests/CCLayerTreeHostCommonTest.cpp: + +2012-08-29 W. James MacLean <wjmaclean@chromium.org> + + [chromium] Link highlight should clear on page navigation. + https://bugs.webkit.org/show_bug.cgi?id=95129 + + Reviewed by James Robinson. + + Modified WebViewImpl to clear link highlight when navigating to new url. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::didCommitLoad): + +2012-08-29 James Robinson <jamesr@chromium.org> + + [chromium] CCThreadImpl / WebCompositorImpl shouldn't compile from webkit when use_libcc_for_compositor=1 + https://bugs.webkit.org/show_bug.cgi?id=94995 + + Reviewed by Adam Barth. + + * WebKit.gyp: + +2012-08-28 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Do not clip root layer's subtree to viewport + https://bugs.webkit.org/show_bug.cgi?id=95235 + + Reviewed by Adrienne Walker. + + Existing tests updated, and otherwise this change is already + covered by layout and unit tests. + + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/CCOcclusionTrackerTest.cpp: + (WebKitTests::CCOcclusionTrackerTestChildInRotatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren::runMyTest): + (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest): + (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest): + (WebKitTests::CCOcclusionTrackerTestFilters::runMyTest): + (WebKitTests::CCOcclusionTrackerTestReplicaWithClipping::runMyTest): + (WebKitTests::CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceChildOfClippingSurface::runMyTest): + +2012-08-29 Julien Chaffraix <jchaffraix@webkit.org> + + [Chromium] CCLayerTreeHostTestScrollChildLayer makes the wrong assumptions + https://bugs.webkit.org/show_bug.cgi?id=95358 + + Unreviewed gardening. + + * tests/CCLayerTreeHostTest.cpp: + Disabled the test until it is fixed. + +2012-08-29 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r126972. + http://trac.webkit.org/changeset/126972 + https://bugs.webkit.org/show_bug.cgi?id=95349 + + accessibility/canvas-description-and-role.html has been + failing consistently on several bots and Dominic needs some + time to investigate why (Requested by jchaffraix on #webkit). + + * public/WebAccessibilityRole.h: + * src/AssertMatchingEnums.cpp: + +2012-08-29 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-08-29 Dominic Mazzoni <dmazzoni@google.com> + + AX: Canvas should have a distinct role + https://bugs.webkit.org/show_bug.cgi?id=95248 + + Reviewed by Chris Fleizach. + + Add support for canvas accessibility role. + + * public/WebAccessibilityRole.h: + * src/AssertMatchingEnums.cpp: + +2012-08-28 David Reveman <reveman@chromium.org> + + [Chromium] Scheduler will never process a commit until it receives a vsync tick. + https://bugs.webkit.org/show_bug.cgi?id=94721 + + Reviewed by James Robinson. + + * tests/CCSchedulerTest.cpp: + (WebKitTests::FakeCCSchedulerClient::reset): + (WebKitTests::TEST): + * tests/CCTextureUpdateControllerTest.cpp: + +2012-08-28 Adam Barth <abarth@webkit.org> + + Fix ASSERT in fast/events/touch/gesture/context-menu-on-two-finger-tap.html + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::detectContentOnTouch): + +2012-08-28 Leandro Gracia Gil <leandrogracia@chromium.org> + + Content detection should not disrupt the page behaviour + https://bugs.webkit.org/show_bug.cgi?id=94727 + + Reviewed by Adam Barth. + + Triggers content detection in the embedder on tap gestures and + add checks for the appropriate event listeners in order to prevent + triggering content detection when it would disrupt the page's behaviour. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleGestureEvent): + (WebKit::WebViewImpl::detectContentOnTouch): + * tests/WebViewTest.cpp: + * tests/data/content_listeners.html: Added. + +2012-08-28 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r126933. + http://trac.webkit.org/changeset/126933 + https://bugs.webkit.org/show_bug.cgi?id=95261 + + Turns out we do need this! (Requested by abarth on #webkit). + + * public/WebWidget.h: + (WebKit::WebWidget::paint): + * src/WebPagePopupImpl.cpp: + (WebKit::WebPagePopupImpl::paint): + * src/WebPagePopupImpl.h: + (WebPagePopupImpl): + * src/WebPopupMenuImpl.cpp: + (WebKit::WebPopupMenuImpl::paint): + * src/WebPopupMenuImpl.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::paint): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-08-28 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Remove decodeAudioFileData from PlatformSupport + https://bugs.webkit.org/show_bug.cgi?id=95250 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * src/PlatformSupport.cpp: + (WebCore): + +2012-08-28 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r126344. + http://trac.webkit.org/changeset/126344 + https://bugs.webkit.org/show_bug.cgi?id=95253 + + This change is no longer needed (Requested by abarth on + #webkit). + + * public/WebWidget.h: + (WebKit::WebWidget::paint): + * src/WebPagePopupImpl.cpp: + (WebKit::WebPagePopupImpl::paint): + * src/WebPagePopupImpl.h: + (WebPagePopupImpl): + * src/WebPopupMenuImpl.cpp: + (WebKit::WebPopupMenuImpl::paint): + * src/WebPopupMenuImpl.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::paint): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-08-28 Dominic Mazzoni <dmazzoni@google.com> + + AX: Crash due to object getting deleted inside updateBackingStore + https://bugs.webkit.org/show_bug.cgi?id=94619 + + Reviewed by Chris Fleizach. + + Chromium now calls updateBackingStoreAndCheckValidity explicitly, + so we can now get rid of calls to updateBackingStore in the + method implementations, and just make sure we're checking isDetached. + + * public/WebAccessibilityObject.h: + (WebAccessibilityObject): + * src/WebAccessibilityObject.cpp: + (WebKit::WebAccessibilityObject::axID): + (WebKit::WebAccessibilityObject::accessibilityDescription): + (WebKit::WebAccessibilityObject::actionVerb): + (WebKit::WebAccessibilityObject::canSetFocusAttribute): + (WebKit::WebAccessibilityObject::canSetValueAttribute): + (WebKit::WebAccessibilityObject::childCount): + (WebKit::WebAccessibilityObject::childAt): + (WebKit::WebAccessibilityObject::firstChild): + (WebKit::WebAccessibilityObject::focusedChild): + (WebKit::WebAccessibilityObject::lastChild): + (WebKit::WebAccessibilityObject::nextSibling): + (WebKit::WebAccessibilityObject::parentObject): + (WebKit::WebAccessibilityObject::previousSibling): + (WebKit::WebAccessibilityObject::canSetSelectedAttribute): + (WebKit::WebAccessibilityObject::isAnchor): + (WebKit::WebAccessibilityObject::isAriaReadOnly): + (WebKit::WebAccessibilityObject::isButtonStateMixed): + (WebKit::WebAccessibilityObject::isChecked): + (WebKit::WebAccessibilityObject::isCollapsed): + (WebKit::WebAccessibilityObject::isControl): + (WebKit::WebAccessibilityObject::isEnabled): + (WebKit::WebAccessibilityObject::isFocused): + (WebKit::WebAccessibilityObject::isHovered): + (WebKit::WebAccessibilityObject::isIndeterminate): + (WebKit::WebAccessibilityObject::isLinked): + (WebKit::WebAccessibilityObject::isLoaded): + (WebKit::WebAccessibilityObject::isMultiSelectable): + (WebKit::WebAccessibilityObject::isOffScreen): + (WebKit::WebAccessibilityObject::isPasswordField): + (WebKit::WebAccessibilityObject::isPressed): + (WebKit::WebAccessibilityObject::isReadOnly): + (WebKit::WebAccessibilityObject::isRequired): + (WebKit::WebAccessibilityObject::isSelected): + (WebKit::WebAccessibilityObject::isSelectedOptionActive): + (WebKit::WebAccessibilityObject::isVertical): + (WebKit::WebAccessibilityObject::isVisible): + (WebKit::WebAccessibilityObject::isVisited): + (WebKit::WebAccessibilityObject::accessKey): + (WebKit::WebAccessibilityObject::ariaHasPopup): + (WebKit::WebAccessibilityObject::ariaLiveRegionAtomic): + (WebKit::WebAccessibilityObject::ariaLiveRegionBusy): + (WebKit::WebAccessibilityObject::ariaLiveRegionRelevant): + (WebKit::WebAccessibilityObject::ariaLiveRegionStatus): + (WebKit::WebAccessibilityObject::boundingBoxRect): + (WebKit::WebAccessibilityObject::estimatedLoadingProgress): + (WebKit::WebAccessibilityObject::helpText): + (WebKit::WebAccessibilityObject::headingLevel): + (WebKit::WebAccessibilityObject::hierarchicalLevel): + (WebKit::WebAccessibilityObject::hitTest): + (WebKit::WebAccessibilityObject::keyboardShortcut): + (WebKit::WebAccessibilityObject::performDefaultAction): + (WebKit::WebAccessibilityObject::roleValue): + (WebKit::WebAccessibilityObject::selectionEnd): + (WebKit::WebAccessibilityObject::selectionStart): + (WebKit::WebAccessibilityObject::stringValue): + (WebKit::WebAccessibilityObject::title): + (WebKit::WebAccessibilityObject::titleUIElement): + (WebKit::WebAccessibilityObject::url): + (WebKit::WebAccessibilityObject::valueDescription): + (WebKit::WebAccessibilityObject::valueForRange): + (WebKit::WebAccessibilityObject::maxValueForRange): + (WebKit::WebAccessibilityObject::minValueForRange): + (WebKit::WebAccessibilityObject::node): + (WebKit::WebAccessibilityObject::document): + (WebKit::WebAccessibilityObject::accessibilityIsIgnored): + (WebKit::WebAccessibilityObject::lineBreaks): + (WebKit::WebAccessibilityObject::columnCount): + (WebKit::WebAccessibilityObject::rowCount): + (WebKit::WebAccessibilityObject::cellForColumnAndRow): + (WebKit::WebAccessibilityObject::cellColumnIndex): + (WebKit::WebAccessibilityObject::cellColumnSpan): + (WebKit::WebAccessibilityObject::cellRowIndex): + (WebKit::WebAccessibilityObject::cellRowSpan): + (WebKit::WebAccessibilityObject::scrollToMakeVisible): + (WebKit::WebAccessibilityObject::scrollToMakeVisibleWithSubFocus): + (WebKit::WebAccessibilityObject::scrollToGlobalPoint): + +2012-08-28 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r126914. + http://trac.webkit.org/changeset/126914 + https://bugs.webkit.org/show_bug.cgi?id=95239 + + it breaks everything and fixes nothing (Requested by pizlo on + #webkit). + + * src/WebGeolocationPermissionRequestManager.cpp: + (WebGeolocationPermissionRequestManager::remove): + * src/WebIDBMetadata.cpp: + (WebKit::WebIDBMetadata::WebIDBMetadata): + * src/WebIntent.cpp: + (WebKit::WebIntent::extrasValue): + * tests/WebSocketExtensionDispatcherTest.cpp: + (WebCore::TEST_F): + +2012-08-28 W. James MacLean <wjmaclean@chromium.org> + + [unreviewed] Compile fix: windows compiler expects float but find double. + + Need to specify a float literal when initialising the highlight animation duration. + + * src/LinkHighlight.cpp: + (WebKit::LinkHighlight::startHighlightAnimation): + +2012-08-28 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + Rename first/second to key/value in HashMap iterators + https://bugs.webkit.org/show_bug.cgi?id=82784 + + Reviewed by Eric Seidel. + + * src/WebGeolocationPermissionRequestManager.cpp: + (WebGeolocationPermissionRequestManager::remove): + * src/WebIDBMetadata.cpp: + (WebKit::WebIDBMetadata::WebIDBMetadata): + * src/WebIntent.cpp: + (WebKit::WebIntent::extrasValue): + * tests/WebSocketExtensionDispatcherTest.cpp: + (WebCore::TEST_F): + +2012-08-28 W. James MacLean <wjmaclean@chromium.org> + + [chromium] Drastically shorten the link highlight duration. + https://bugs.webkit.org/show_bug.cgi?id=95216 + + Reviewed by James Robinson. + + Parameter change; covered by existing layout tests. + + * src/LinkHighlight.cpp: + (WebKit::LinkHighlight::startHighlightAnimation): + +2012-08-27 Tien-Ren Chen <trchen@chromium.org> + + [Chromium] Remove stub for WebView::getTouchHighlightQuads() + https://bugs.webkit.org/show_bug.cgi?id=95164 + + Reviewed by Adam Barth. + + Reverts https://bugs.webkit.org/show_bug.cgi?id=92997 + We're uploading a new implementation that no longer uses this API. + See https://bugs.webkit.org/show_bug.cgi?id=94182 + + * WebKit.gyp: + * public/WebTouchCandidatesInfo.h: Removed. + * public/WebView.h: + (WebKit): + * src/WebViewImpl.cpp: + * src/WebViewImpl.h: + (WebViewImpl): + +2012-08-27 Ian Vollick <vollick@chromium.org> + + [chromium] Should accelerate rotations of >= 180 degrees + https://bugs.webkit.org/show_bug.cgi?id=94860 + + Reviewed by James Robinson. + + Added new unit tests: + WebTransformOperationTest.transformTypesAreUnique + WebTransformOperationTest.matchTypesSameLength + WebTransformOperationTest.identityAlwaysMatches + WebTransformOperationTest.largeRotationsWithSameAxis + WebTransformOperationTest.largeRotationsWithSameAxisInDifferentDirection + WebTransformOperationTest.largeRotationsWithDifferentAxes + WebTransformOperationTest.blendRotationFromIdentity + WebTransformOperationTest.blendTranslationFromIdentity + WebTransformOperationTest.blendScaleFromIdentity + WebTransformOperationTest.blendSkewFromIdentity + WebTransformOperationTest.blendPerspectiveFromIdentity + WebTransformOperationTest.blendRotationToIdentity + WebTransformOperationTest.blendTranslationToIdentity + WebTransformOperationTest.blendScaleToIdentity + WebTransformOperationTest.blendSkewToIdentity + WebTransformOperationTest.blendPerspectiveToIdentity + AnimationTranslationUtilTest.createTransformAnimationWithBigRotation + AnimationTranslationUtilTest.createTransformAnimationWithBigRotationAndEmptyTransformOperationList + + * tests/AnimationTranslationUtilTest.cpp: + (WebKit::TEST): + * tests/WebTransformOperationsTest.cpp: + (TEST): + (getIdentityOperations): + +2012-08-27 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r126836. + http://trac.webkit.org/changeset/126836 + https://bugs.webkit.org/show_bug.cgi?id=95163 + + Broke all Apple ports, EFL, and Qt. (Requested by tkent on + #webkit). + + * src/WebGeolocationPermissionRequestManager.cpp: + (WebGeolocationPermissionRequestManager::remove): + * src/WebIDBMetadata.cpp: + (WebKit::WebIDBMetadata::WebIDBMetadata): + * src/WebIntent.cpp: + (WebKit::WebIntent::extrasValue): + * tests/WebSocketExtensionDispatcherTest.cpp: + (WebCore::TEST_F): + +2012-08-27 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + Rename first/second to key/value in HashMap iterators + https://bugs.webkit.org/show_bug.cgi?id=82784 + + Reviewed by Eric Seidel. + + * src/WebGeolocationPermissionRequestManager.cpp: + (WebGeolocationPermissionRequestManager::remove): + * src/WebIDBMetadata.cpp: + (WebKit::WebIDBMetadata::WebIDBMetadata): + * src/WebIntent.cpp: + (WebKit::WebIntent::extrasValue): + * tests/WebSocketExtensionDispatcherTest.cpp: + (WebCore::TEST_F): + +2012-08-27 David Reveman <reveman@chromium.org> + + [Chromium] Stop texture updates when context is lost. + https://bugs.webkit.org/show_bug.cgi?id=94983 + + Reviewed by James Robinson. + + * tests/CCLayerTreeHostTest.cpp: + (CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext): + (CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::create): + (CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::setContextLostCallback): + (CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::isContextLost): + (CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::beginQueryEXT): + (CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::endQueryEXT): + (CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::getQueryObjectuivEXT): + (CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext): + (CCLayerTreeHostTestLostContextWhileUpdatingResources): + (CCLayerTreeHostTestLostContextWhileUpdatingResources::CCLayerTreeHostTestLostContextWhileUpdatingResources): + (CCLayerTreeHostTestLostContextWhileUpdatingResources::createOutputSurface): + (CCLayerTreeHostTestLostContextWhileUpdatingResources::beginTest): + (CCLayerTreeHostTestLostContextWhileUpdatingResources::commitCompleteOnCCThread): + (CCLayerTreeHostTestLostContextWhileUpdatingResources::layout): + (CCLayerTreeHostTestLostContextWhileUpdatingResources::afterTest): + (TEST_F): + +2012-08-27 Dana Jansens <danakj@chromium.org> + + [chromium] A general mechanism for passing data into and out of appendQuads and quadCuller via CCAppendQuadsData + https://bugs.webkit.org/show_bug.cgi?id=95109 + + Reviewed by Adrienne Walker. + + Update tests to use the new data structure. + + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCLayerTreeHostTest.cpp: + * tests/CCQuadCullerTest.cpp: + * tests/CCRenderSurfaceTest.cpp: + * tests/CCSolidColorLayerImplTest.cpp: + (CCLayerTestCommon::TEST): + * tests/CCTiledLayerImplTest.cpp: + (CCLayerTestCommon::TEST): + (CCLayerTestCommon::getQuads): + * tests/MockCCQuadCuller.h: + +2012-08-24 James Robinson <jamesr@chromium.org> + + [chromium] Clean up dependencies of WebScrollbar and WebScrollbarLayer + https://bugs.webkit.org/show_bug.cgi?id=94996 + + Reviewed by Adrienne Walker. + + Fix up tests for API changes. + + * WebKit.gyp: + * src/WebScrollbarLayerImpl.cpp: + (WebKit::WebScrollbarLayer::create): + * tests/ScrollbarLayerChromiumTest.cpp: + (WebCore::TEST): + +2012-08-27 Adrienne Walker <enne@google.com> + + [chromium] Prevent scrollbar thumb size from changing during compositor zoom + https://bugs.webkit.org/show_bug.cgi?id=94859 + + Reviewed by James Robinson. + + Update test. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-08-27 Dana Jansens <danakj@chromium.org> + + [chromium] Have RenderSurface create and add its own generated RenderPass + https://bugs.webkit.org/show_bug.cgi?id=94957 + + Reviewed by Adrienne Walker. + + Test that a RenderSurface generates the RenderPass that we expect. + + * tests/CCRenderSurfaceTest.cpp: + +2012-08-27 Justin Novosad <junov@chromium.org> + + [Chromium] Fixing infinite recursion in Canvas2DLayerManager + https://bugs.webkit.org/show_bug.cgi?id=95110 + + Reviewed by Stephen White. + + Breaking recursion cycle by not reporting a change in memory allocation + when no memory is freed in FakeCanvas2DLayer::freeMemoryIfPossible. + + * tests/Canvas2DLayerManagerTest.cpp: + +2012-08-27 Justin Novosad <junov@chromium.org> + + [Chromium] Implementing a global limit on memory consumed by deferred 2D canvases + https://bugs.webkit.org/show_bug.cgi?id=94386 + + Reviewed by Stephen White. + + Adding unit tests for WebCore::Canvas2DLayerManager + + * WebKit.gypi: + +2012-08-27 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-08-27 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + Rename RegisterProtocolHandler API to NavigatorContentUtils + https://bugs.webkit.org/show_bug.cgi?id=94920 + + Reviewed by Adam Barth. + + Renaming whatever RegisterProtocolHandler-prefixed to NavigatorContentUtils-prefixed. + RegisterProtocolHandlerClientImpl is renamed to NavigatorContentUtilsClientImpl. + + * features.gypi: + * src/ChromeClientImpl.cpp: + (WebKit): + (WebKit::NavigatorContentUtilsClientImpl::create): + (WebKit::NavigatorContentUtilsClientImpl::NavigatorContentUtilsClientImpl): + (WebKit::NavigatorContentUtilsClientImpl::registerProtocolHandler): + * src/ChromeClientImpl.h: + (NavigatorContentUtilsClientImpl): + (WebKit::NavigatorContentUtilsClientImpl::~NavigatorContentUtilsClientImpl): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + * src/WebViewImpl.h: + +2012-08-27 Johnny Ding <jnd@chromium.org> + + [Chromium-Android]Move webkit_unit_tests_apk and TestWebKitAPI_apk into a + condition block:['OS=="android" and gtest_target_type == "shared_library"']. + https://bugs.webkit.org/show_bug.cgi?id=95049 + + Reviewed by Adam Barth. + + Move webkit_unit_tests_apk and TestWebKitAPI_apk into block of gtest_target_type == "shared_library" + + * All.gyp: + +2012-08-24 Dominic Mazzoni <dmazzoni@google.com> + + Chromium: WebAccessibilityObject should expose updateBackingStore + https://bugs.webkit.org/show_bug.cgi?id=94611 + + Reviewed by Chris Fleizach. + + This change just exposes a method, with no new tests. Next, Chromium + will be modified to call this new method, and this will be followed + by a change that gets rid of calls to updateBackingStore under the + hood. That last change may add a test or update an existing test. + + * public/WebAccessibilityObject.h: + (WebAccessibilityObject): + * src/WebAccessibilityObject.cpp: + (WebKit::WebAccessibilityObject::updateBackingStoreAndCheckValidity): + (WebKit): + +2012-08-24 W. James MacLean <wjmaclean@chromium.org> + + [chromium] WebViewImpl::enableTouchHighlight() should always clear any existing highlight when invoked. + https://bugs.webkit.org/show_bug.cgi?id=94978 + + Reviewed by James Robinson. + + Modified WebViewImpl::enableTouchHighlight() so it always clears any existing highlight, even if no new + highlight target is found. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::enableTouchHighlight): + +2012-08-23 James Robinson <jamesr@chromium.org> + + [chromium] Convert WebLayerTreeView interface into pure virtual + https://bugs.webkit.org/show_bug.cgi?id=94866 + + Reviewed by Adrienne Walker. + + Updates WebLayerTreeView implementation and callers to new interface. The createGraphicsContext3D() wrapper + stuff can just go away now since downstream has updated to createOutputSurface(). + + * WebKit.gypi: + * src/WebLayerTreeView.cpp: Removed. + * src/WebLayerTreeViewImpl.cpp: + (WebKit::WebLayerTreeView::create): + (WebKit::WebLayerTreeViewImpl::WebLayerTreeViewImpl): + (WebKit::WebLayerTreeViewImpl::initialize): + (WebKit): + (WebKit::WebLayerTreeViewImpl::setSurfaceReady): + (WebKit::WebLayerTreeViewImpl::setRootLayer): + (WebKit::WebLayerTreeViewImpl::clearRootLayer): + (WebKit::WebLayerTreeViewImpl::compositorIdentifier): + (WebKit::WebLayerTreeViewImpl::setViewportSize): + (WebKit::WebLayerTreeViewImpl::layoutViewportSize): + (WebKit::WebLayerTreeViewImpl::deviceViewportSize): + (WebKit::WebLayerTreeViewImpl::setDeviceScaleFactor): + (WebKit::WebLayerTreeViewImpl::deviceScaleFactor): + (WebKit::WebLayerTreeViewImpl::setBackgroundColor): + (WebKit::WebLayerTreeViewImpl::setHasTransparentBackground): + (WebKit::WebLayerTreeViewImpl::setVisible): + (WebKit::WebLayerTreeViewImpl::setPageScaleFactorAndLimits): + (WebKit::WebLayerTreeViewImpl::startPageScaleAnimation): + (WebKit::WebLayerTreeViewImpl::setNeedsAnimate): + (WebKit::WebLayerTreeViewImpl::setNeedsRedraw): + (WebKit::WebLayerTreeViewImpl::commitRequested): + (WebKit::WebLayerTreeViewImpl::composite): + (WebKit::WebLayerTreeViewImpl::updateAnimations): + (WebKit::WebLayerTreeViewImpl::compositeAndReadback): + (WebKit::WebLayerTreeViewImpl::finishAllRendering): + (WebKit::WebLayerTreeViewImpl::renderingStats): + (WebKit::WebLayerTreeViewImpl::setFontAtlas): + (WebKit::WebLayerTreeViewImpl::loseCompositorContext): + (WebKit::WebLayerTreeViewImpl::willBeginFrame): + (WebKit::WebLayerTreeViewImpl::didBeginFrame): + (WebKit::WebLayerTreeViewImpl::animate): + (WebKit::WebLayerTreeViewImpl::layout): + (WebKit::WebLayerTreeViewImpl::applyScrollAndScale): + (WebKit::WebLayerTreeViewImpl::createOutputSurface): + (WebKit::WebLayerTreeViewImpl::didRecreateOutputSurface): + (WebKit::WebLayerTreeViewImpl::willCommit): + (WebKit::WebLayerTreeViewImpl::didCommit): + (WebKit::WebLayerTreeViewImpl::didCommitAndDrawFrame): + (WebKit::WebLayerTreeViewImpl::didCompleteSwapBuffers): + (WebKit::WebLayerTreeViewImpl::scheduleComposite): + * src/WebLayerTreeViewImpl.h: + (WebLayerTreeViewImpl): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::renderingStats): + (WebKit::WebViewImpl::startPageScaleAnimation): + (WebKit::WebViewImpl::setCompositorSurfaceReady): + (WebKit::WebViewImpl::animate): + (WebKit::WebViewImpl::doPixelReadbackToCanvas): + (WebKit::WebViewImpl::paint): + (WebKit::WebViewImpl::composite): + (WebKit::WebViewImpl::setNeedsRedraw): + (WebKit::WebViewImpl::isInputThrottled): + (WebKit::WebViewImpl::loseCompositorContext): + (WebKit::WebViewImpl::setDeviceScaleFactor): + (WebKit::WebViewImpl::computePageScaleFactorLimits): + (WebKit::WebViewImpl::setIsTransparent): + (WebKit::WebViewImpl::setRootGraphicsLayer): + (WebKit::WebViewImpl::scheduleCompositingLayerSync): + (WebKit::WebViewImpl::invalidateRootLayerRect): + (WebKit::WebViewImpl::setBackgroundColor): + (WebKit::WebViewImpl::scheduleAnimation): + (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): + (WebKit): + (WebKit::WebViewImpl::updateLayerTreeViewport): + (WebKit::WebViewImpl::setVisibilityState): + * src/WebViewImpl.h: + (WebKit): + * tests/CCLayerTreeHostTest.cpp: + * tests/CCThreadedTest.cpp: + * tests/CCThreadedTest.h: + (WebKitTests::TestHooks::animate): + * tests/FakeCCLayerTreeHostClient.h: + * tests/GraphicsLayerChromiumTest.cpp: + (WebKit::GraphicsLayerChromiumTest::GraphicsLayerChromiumTest): + (WebKit::GraphicsLayerChromiumTest::~GraphicsLayerChromiumTest): + (GraphicsLayerChromiumTest): + * tests/WebLayerTest.cpp: + * tests/WebLayerTreeViewTest.cpp: + * tests/WebLayerTreeViewTestCommon.h: + (MockWebLayerTreeViewClient): + +2012-08-24 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-08-24 James Robinson <jamesr@chromium.org> + + [chromium] Clean up WebAnimation animationId/groupId generation + https://bugs.webkit.org/show_bug.cgi?id=94973 + + Reviewed by Adrienne Walker. + + * src/WebAnimationImpl.cpp: + (WebKit::WebAnimation::create): + (WebKit::WebAnimationImpl::WebAnimationImpl): + (WebKit::WebAnimationImpl::id): + (WebKit): + * src/WebAnimationImpl.h: + (WebAnimationImpl): + * tests/AnimationTranslationUtilTest.cpp: + (WebKit::animationCanBeTranslated): + * tests/GraphicsLayerChromiumTest.cpp: + (WebKit::TEST_F): + +2012-08-24 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Remove visitedLinkHash from PlatformSupport + https://bugs.webkit.org/show_bug.cgi?id=94965 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * src/PlatformSupport.cpp: + (WebCore): + +2012-08-24 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r126620. + http://trac.webkit.org/changeset/126620 + https://bugs.webkit.org/show_bug.cgi?id=94976 + + ASSERT((intptr_t)m_bytesAllocated + deltaBytes > 0) is + triggering on the bots (Requested by jchaffraix on #webkit). + + * WebKit.gypi: + * tests/Canvas2DLayerManagerTest.cpp: Removed. + +2012-08-24 Justin Novosad <junov@chromium.org> + + [Chromium] Implementing a global limit on memory consumed by deferred 2D canvases + https://bugs.webkit.org/show_bug.cgi?id=94386 + + Reviewed by Stephen White. + + Adding unit tests for WebCore::Canvas2DLayerManager + + * WebKit.gypi: + * tests/Canvas2DLayerManagerTest.cpp: Added. + (FakeCanvas2DLayerBridge): + (FakeCanvas2DLayerBridge::FakeCanvas2DLayerBridge): + (FakeCanvas2DLayerBridge::fakeFreeableBytes): + (Canvas2DLayerManagerTest): + (Canvas2DLayerManagerTest::storageAllocationTrackingTest): + (Canvas2DLayerManagerTest::evictionTest): + (Canvas2DLayerManagerTest::flushEvictionTest): + +2012-08-24 Cris Neckar <cdn@chromium.org> + + Plumb consumeUserGesture() to the chromium platform layer. + https://bugs.webkit.org/show_bug.cgi?id=9475294867 + + Reviewed by Adam Barth. + + * public/WebFrame.h: + (WebFrame): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::consumeUserGesture): + (WebKit): + * src/WebFrameImpl.h: + (WebFrameImpl): + +2012-08-24 W. James MacLean <wjmaclean@chromium.org> + + [chromium] gestureTapDown should not select a RenderView node as target. + https://bugs.webkit.org/show_bug.cgi?id=94956 + + Reviewed by James Robinson. + + Add check to prevent selecting a RenderView node as a highlight target. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::bestTouchLinkNode): + +2012-08-24 Tommy Widenflycht <tommyw@google.com> + + MediaStream API: Add readyState functionality to RTCPeerConnection + https://bugs.webkit.org/show_bug.cgi?id=94813 + + Reviewed by Adam Barth. + + * src/AssertMatchingEnums.cpp: + +2012-08-24 Dan Carney <dcarney@google.com> + + [V8] Refactor away IsolatedWorld + https://bugs.webkit.org/show_bug.cgi?id=93971 + + Reviewed by Kentaro Hara. + + Remove IsolatedWorld class as it was 1:1 with DOMWrapperWorld. + + * src/WebViewImpl.cpp: + (WebKit::WebView::addUserScript): + (WebKit::WebView::addUserStyleSheet): + 2012-08-23 Antoine Labour <piman@chromium.org> [chromium] Fix lost context when textures are evicted @@ -14482,7 +16974,7 @@ (WebKit::WebAccessibilityObject::ariaLiveRegionBusy): (WebKit::WebAccessibilityObject::ariaLiveRegionRelevant): (WebKit::WebAccessibilityObject::ariaLiveRegionStatus): - (WebKit::WebAccessibilityObject::boundingBoxRect): + (WebKit::WebAccessibilityObject::boundingBox): (WebKit::WebAccessibilityObject::estimatedLoadingProgress): (WebKit::WebAccessibilityObject::helpText): (WebKit::WebAccessibilityObject::headingLevel): diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index 479de4270..d16efe14c 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': '153032' + 'chromium_rev': '155215' } deps = { diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp index 1fd2164bc..179ad50ef 100644 --- a/Source/WebKit/chromium/WebKit.gyp +++ b/Source/WebKit/chromium/WebKit.gyp @@ -54,7 +54,7 @@ # stored as is. Otherwise, a concatenated file is stored. 'debug_devtools%': 0, - # If set to 1, links against the compositor bindings from the chromium repository + # If set to 1, uses the compositor bindings provided by PlatformSupport # instead of the compositor-implementation binding files in WebKit/chromium/src. 'use_libcc_for_compositor%': 0, @@ -71,13 +71,14 @@ 'type': 'static_library', 'variables': { 'enable_wexit_time_destructors': 1, }, 'dependencies': [ - '../../WebCore/WebCore.gyp/WebCore.gyp:webcore', '../../Platform/Platform.gyp/Platform.gyp:webkit_platform', + '../../WebCore/WebCore.gyp/WebCore.gyp:webcore', '<(chromium_src_dir)/skia/skia.gyp:skia', + '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:translator_glsl', '<(chromium_src_dir)/third_party/icu/icu.gyp:icuuc', '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi', - '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:translator_glsl', '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8', + 'webkit_wtf_support', ], 'export_dependent_settings': [ '../../Platform/Platform.gyp/Platform.gyp:webkit_platform', @@ -277,7 +278,6 @@ 'public/WebTextInputType.h', 'public/WebTextRun.h', 'public/WebTimeRange.h', - 'public/WebTouchCandidatesInfo.h', 'public/WebURLLoaderOptions.h', 'public/WebUserMediaClient.h', 'public/WebUserMediaRequest.h', @@ -359,11 +359,10 @@ 'src/BatteryClientImpl.h', 'src/BlobRegistryProxy.cpp', 'src/BlobRegistryProxy.h', + 'src/DateTimeChooserImpl.cpp', + 'src/DateTimeChooserImpl.h', 'src/ChromeClientImpl.cpp', 'src/ChromeClientImpl.h', - 'src/ChromiumCurrentTime.cpp', - 'src/ChromiumOSRandomSource.cpp', - 'src/ChromiumThreading.cpp', 'src/ColorChooserUIController.cpp', 'src/ColorChooserUIController.h', 'src/CompositionUnderlineBuilder.h', @@ -486,6 +485,8 @@ 'src/WebCache.cpp', 'src/WebColorName.cpp', 'src/WebCommon.cpp', + 'src/WebCompositorInputHandlerImpl.cpp', + 'src/WebCompositorInputHandlerImpl.h', 'src/WebCrossOriginPreflightResultCache.cpp', 'src/WebCursorInfo.cpp', 'src/WebDOMEvent.cpp', @@ -605,8 +606,6 @@ 'src/WebScopedMicrotaskSuppression.cpp', 'src/WebScopedUserGesture.cpp', 'src/WebScriptController.cpp', - 'src/WebScrollbarImpl.cpp', - 'src/WebScrollbarImpl.h', 'src/WebScrollbarThemeClientImpl.cpp', 'src/WebScrollbarThemeClientImpl.h', 'src/WebScrollbarThemePainter.cpp', @@ -741,6 +740,11 @@ 'WARNING_CFLAGS!': ['-Wglobal-constructors'], }, }], + ['use_libcc_for_compositor==0', { + 'sources': [ + '<@(webkit_compositor_unittest_files)', + ], + }], ], 'msvs_settings': { 'VCLinkerTool': { @@ -836,8 +840,11 @@ }, }], ['use_libcc_for_compositor==1', { - 'dependencies': [ - '<(chromium_src_dir)/webkit/compositor/compositor.gyp:webkit_compositor', + 'sources!': [ + '../../WebCore/platform/chromium/support/CCThreadImpl.cpp', + '../../WebCore/platform/chromium/support/CCThreadImpl.h', + '../../WebCore/platform/chromium/support/WebCompositorImpl.cpp', + '../../WebCore/platform/chromium/support/WebCompositorImpl.h', ], }, { # else: use_libcc_for_compositor==0 'sources': [ @@ -855,6 +862,31 @@ ], }, { + 'target_name': 'webkit_wtf_support', + 'type': 'static_library', + 'dependencies': [ + '../../WTF/WTF.gyp/WTF.gyp:wtf', + ], + 'defines': [ + 'WEBKIT_IMPLEMENTATION=1', + ], + 'include_dirs': [ + '../../Platform/chromium', + ], + 'sources': [ + 'src/ChromiumCurrentTime.cpp', + 'src/ChromiumOSRandomSource.cpp', + 'src/ChromiumThreading.cpp', + ], + 'conditions': [ + ['component=="shared_library"', { + 'defines': [ + 'WEBKIT_DLL', + ], + }], + ], + }, + { 'target_name': 'inspector_resources', 'type': 'none', 'dependencies': [ diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index 890b3f675..5d3f850d5 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -56,12 +56,72 @@ 'tests/ArenaTestHelpers.h', 'tests/AssociatedURLLoaderTest.cpp', 'tests/Canvas2DLayerBridgeTest.cpp', + 'tests/Canvas2DLayerManagerTest.cpp', + 'tests/ClipboardChromiumTest.cpp', + 'tests/DateTimeFormatTest.cpp', + 'tests/DecimalTest.cpp', + 'tests/DragImageTest.cpp', + 'tests/EventListenerTest.cpp', + 'tests/FrameLoaderClientImplTest.cpp', + 'tests/FrameTestHelpers.cpp', + 'tests/FrameTestHelpers.h', + 'tests/GraphicsLayerChromiumTest.cpp', + 'tests/IDBAbortOnCorruptTest.cpp', + 'tests/IDBBindingUtilitiesTest.cpp', + 'tests/IDBDatabaseBackendTest.cpp', + 'tests/IDBFakeBackingStore.h', + 'tests/IDBKeyPathTest.cpp', + 'tests/IDBLevelDBCodingTest.cpp', + 'tests/IDBRequestTest.cpp', + 'tests/ImageLayerChromiumTest.cpp', + 'tests/KeyboardTest.cpp', + 'tests/KURLTest.cpp', + 'tests/LevelDBTest.cpp', + 'tests/LinkHighlightTest.cpp', + 'tests/ListenerLeakTest.cpp', + 'tests/MemoryInfo.cpp', + 'tests/MemoryInstrumentationTest.cpp', + 'tests/OpaqueRectTrackingContentLayerDelegateTest.cpp', + 'tests/OpenTypeVerticalDataTest.cpp', + 'tests/PaintAggregatorTest.cpp', + 'tests/PlatformGestureCurveTest.cpp', + 'tests/PlatformContextSkiaTest.cpp', + 'tests/PODArenaTest.cpp', + 'tests/PODIntervalTreeTest.cpp', + 'tests/PODRedBlackTreeTest.cpp', + 'tests/PopupContainerTest.cpp', + 'tests/RegionTest.cpp', + 'tests/RenderTableCellTest.cpp', + 'tests/RenderTableRowTest.cpp', + 'tests/TilingDataTest.cpp', + 'tests/TreeTestHelpers.cpp', + 'tests/TreeTestHelpers.h', + 'tests/URLTestHelpers.cpp', + 'tests/URLTestHelpers.h', + 'tests/WebCompositorInitializer.h', + 'tests/WebCompositorInputHandlerImplTest.cpp', + 'tests/WebFrameTest.cpp', + 'tests/WebMediaPlayerClientImplTest.cpp', + 'tests/WebPageNewSerializerTest.cpp', + 'tests/WebPageSerializerTest.cpp', + 'tests/WebSocketDeflaterTest.cpp', + 'tests/WebSocketExtensionDispatcherTest.cpp', + 'tests/WebURLRequestTest.cpp', + 'tests/WebURLResponseTest.cpp', + 'tests/WebViewTest.cpp', + ], + + 'webkit_compositor_unittest_files': [ 'tests/CCActiveAnimationTest.cpp', 'tests/CCAnimationTestCommon.cpp', 'tests/CCAnimationTestCommon.h', 'tests/CCDamageTrackerTest.cpp', 'tests/CCDelayBasedTimeSourceTest.cpp', + 'tests/CCDrawQuadTest.cpp', 'tests/CCFrameRateControllerTest.cpp', + 'tests/CCGeometryTestUtils.cpp', + 'tests/CCGeometryTestUtils.h', + 'tests/CCHeadsUpDisplayTest.cpp', 'tests/CCKeyframedAnimationCurveTest.cpp', 'tests/CCLayerAnimationControllerTest.cpp', 'tests/CCLayerImplTest.cpp', @@ -73,36 +133,33 @@ 'tests/CCLayerTreeHostCommonTest.cpp', 'tests/CCLayerTreeHostImplTest.cpp', 'tests/CCLayerTreeHostTest.cpp', - 'tests/CCLayerTreeTestCommon.h', 'tests/CCMathUtilTest.cpp', 'tests/CCOcclusionTrackerTest.cpp', 'tests/CCOcclusionTrackerTestCommon.h', + 'tests/CCPrioritizedTextureTest.cpp', 'tests/CCQuadCullerTest.cpp', + 'tests/CCRenderPassTest.cpp', 'tests/CCRenderSurfaceFiltersTest.cpp', 'tests/CCRenderSurfaceTest.cpp', + 'tests/CCRendererGLTest.cpp', 'tests/CCResourceProviderTest.cpp', 'tests/CCSchedulerStateMachineTest.cpp', - 'tests/CCSchedulerTestCommon.h', 'tests/CCSchedulerTest.cpp', + 'tests/CCSchedulerTestCommon.h', 'tests/CCScopedTextureTest.cpp', 'tests/CCScrollbarAnimationControllerLinearFadeTest.cpp', 'tests/CCSolidColorLayerImplTest.cpp', 'tests/CCTestCommon.h', 'tests/CCTextureUpdateControllerTest.cpp', - 'tests/CCTiledLayerImplTest.cpp', - 'tests/CCTiledLayerTestCommon.h', - 'tests/CCTiledLayerTestCommon.cpp', 'tests/CCThreadTaskTest.cpp', 'tests/CCThreadedTest.cpp', 'tests/CCThreadedTest.h', + 'tests/CCTiledLayerImplTest.cpp', + 'tests/CCTiledLayerTestCommon.cpp', + 'tests/CCTiledLayerTestCommon.h', 'tests/CCTimerTest.cpp', - 'tests/ClipboardChromiumTest.cpp', 'tests/CompositorFakeWebGraphicsContext3D.h', 'tests/ContentLayerChromiumTest.cpp', - 'tests/DateTimeFormatTest.cpp', - 'tests/DecimalTest.cpp', - 'tests/DragImageTest.cpp', - 'tests/EventListenerTest.cpp', 'tests/FakeCCLayerTreeHostClient.h', 'tests/FakeGraphicsContext3DTest.cpp', 'tests/FakeWebCompositorOutputSurface.h', @@ -110,70 +167,23 @@ 'tests/FakeWebScrollbarThemeGeometry.h', 'tests/FilterOperationsTest.cpp', 'tests/FloatQuadTest.cpp', - 'tests/FrameLoaderClientImplTest.cpp', - 'tests/FrameTestHelpers.cpp', - 'tests/FrameTestHelpers.h', - 'tests/GraphicsLayerChromiumTest.cpp', - 'tests/IDBAbortOnCorruptTest.cpp', - 'tests/IDBBindingUtilitiesTest.cpp', - 'tests/IDBDatabaseBackendTest.cpp', - 'tests/IDBFakeBackingStore.h', - 'tests/IDBKeyPathTest.cpp', - 'tests/IDBLevelDBCodingTest.cpp', - 'tests/IDBRequestTest.cpp', - 'tests/ImageLayerChromiumTest.cpp', - 'tests/KeyboardTest.cpp', - 'tests/KURLTest.cpp', 'tests/LayerChromiumTest.cpp', - 'tests/CCRendererGLTest.cpp', - 'tests/LevelDBTest.cpp', - 'tests/LinkHighlightTest.cpp', - 'tests/ListenerLeakTest.cpp', - 'tests/MemoryInfo.cpp', - 'tests/MemoryInstrumentationTest.cpp', 'tests/MockCCQuadCuller.h', - 'tests/OpaqueRectTrackingContentLayerDelegateTest.cpp', - 'tests/OpenTypeVerticalDataTest.cpp', - 'tests/PaintAggregatorTest.cpp', - 'tests/PlatformGestureCurveTest.cpp', - 'tests/PlatformContextSkiaTest.cpp', - 'tests/PODArenaTest.cpp', - 'tests/PODIntervalTreeTest.cpp', - 'tests/PODRedBlackTreeTest.cpp', - 'tests/PopupContainerTest.cpp', - 'tests/CCPrioritizedTextureTest.cpp', - 'tests/RegionTest.cpp', - 'tests/RenderTableCellTest.cpp', - 'tests/RenderTableRowTest.cpp', 'tests/ScrollbarLayerChromiumTest.cpp', 'tests/TextureCopierTest.cpp', 'tests/TextureLayerChromiumTest.cpp', 'tests/ThrottledTextureUploaderTest.cpp', 'tests/TiledLayerChromiumTest.cpp', - 'tests/TilingDataTest.cpp', 'tests/TreeSynchronizerTest.cpp', - 'tests/TreeTestHelpers.cpp', - 'tests/TreeTestHelpers.h', - 'tests/URLTestHelpers.cpp', - 'tests/URLTestHelpers.h', 'tests/WebAnimationTest.cpp', - 'tests/WebCompositorInputHandlerImplTest.cpp', 'tests/WebFloatAnimationCurveTest.cpp', - 'tests/WebFrameTest.cpp', + 'tests/WebInputEventConversionTest.cpp', 'tests/WebLayerTest.cpp', 'tests/WebLayerTreeViewTest.cpp', 'tests/WebLayerTreeViewTestCommon.h', - 'tests/WebMediaPlayerClientImplTest.cpp', - 'tests/WebPageNewSerializerTest.cpp', - 'tests/WebPageSerializerTest.cpp', - 'tests/WebSocketDeflaterTest.cpp', - 'tests/WebSocketExtensionDispatcherTest.cpp', 'tests/WebTransformAnimationCurveTest.cpp', - 'tests/WebTransformationMatrixTest.cpp', 'tests/WebTransformOperationsTest.cpp', - 'tests/WebURLRequestTest.cpp', - 'tests/WebURLResponseTest.cpp', - 'tests/WebViewTest.cpp', + 'tests/WebTransformationMatrixTest.cpp', ], 'webkit_compositor_bindings_files': [ @@ -181,8 +191,6 @@ 'src/WebAnimationCurveCommon.h', 'src/WebAnimationImpl.cpp', 'src/WebAnimationImpl.h', - 'src/WebCompositorInputHandlerImpl.cpp', - 'src/WebCompositorInputHandlerImpl.h', 'src/WebContentLayerImpl.cpp', 'src/WebContentLayerImpl.h', 'src/WebExternalTextureLayerImpl.cpp', @@ -195,7 +203,8 @@ 'src/WebImageLayerImpl.h', 'src/WebLayerImpl.cpp', 'src/WebLayerImpl.h', - 'src/WebLayerTreeView.cpp', + 'src/WebToCCInputHandlerAdapter.cpp', + 'src/WebToCCInputHandlerAdapter.h', 'src/WebLayerTreeViewImpl.cpp', 'src/WebLayerTreeViewImpl.h', 'src/WebScrollbarLayerImpl.cpp', diff --git a/Source/WebKit/chromium/WebKitUnitTests.gyp b/Source/WebKit/chromium/WebKitUnitTests.gyp index a77392ef4..b0f155a74 100644 --- a/Source/WebKit/chromium/WebKitUnitTests.gyp +++ b/Source/WebKit/chromium/WebKitUnitTests.gyp @@ -46,6 +46,8 @@ 'chromium_src_dir': '../../../../..', }], ], + + 'use_libcc_for_compositor%': 0, }, 'targets': [ { @@ -64,7 +66,6 @@ '<(chromium_src_dir)/base/base.gyp:test_support_base', '<(chromium_src_dir)/third_party/zlib/zlib.gyp:zlib', '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support', - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_user_agent', ], 'sources': [ 'tests/RunAllTests.cpp', @@ -103,6 +104,11 @@ 'chromium_code': 1, }, }], + ['use_libcc_for_compositor==0', { + 'sources': [ + '<@(webkit_compositor_unittest_files)', + ], + }], ], }], ['inside_chromium_build==1 and OS=="win" and component!="shared_library"', { @@ -190,6 +196,8 @@ '--ant-args', '-DANDROID_TOOLCHAIN=<(android_toolchain)', '--ant-args', + '-DANDROID_GDBSERVER=<(android_gdbserver)', + '--ant-args', '-DPRODUCT_DIR=<(ant_build_out)', '--ant-args', '-DCHROMIUM_SRC=<(ant_build_to_chromium_src)', diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index 6b165fd8e..4664b04a4 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -38,7 +38,6 @@ 'ENABLE_BLOB_SLICE=1', 'ENABLE_CHANNEL_MESSAGING=1', 'ENABLE_CSP_NEXT=1', - 'ENABLE_CSS3_FLEXBOX=1', 'ENABLE_CSS3_TEXT_DECORATION=0', 'ENABLE_CSS_BOX_DECORATION_BREAK=1', 'ENABLE_CSS_COMPOSITING=0', @@ -87,11 +86,11 @@ 'ENABLE_MHTML=1', 'ENABLE_MICRODATA=0', 'ENABLE_MUTATION_OBSERVERS=<(enable_mutation_observers)', + 'ENABLE_NAVIGATOR_CONTENT_UTILS=1', 'ENABLE_PAGE_VISIBILITY_API=1', 'ENABLE_POINTER_LOCK=1', 'ENABLE_PROGRESS_ELEMENT=1', 'ENABLE_QUOTA=1', - 'ENABLE_REGISTER_PROTOCOL_HANDLER=1', 'ENABLE_REQUEST_ANIMATION_FRAME=1', 'ENABLE_RUBY=1', 'ENABLE_SANDBOX=1', @@ -201,6 +200,11 @@ 'WTF_USE_WEBAUDIO_FFMPEG=1', ], }], + ['OS=="win"', { + 'feature_defines': [ + 'ENABLE_OPENTYPE_VERTICAL=1', + ], + }], ['enable_web_intents==1', { 'feature_defines': [ 'ENABLE_WEB_INTENTS=1', diff --git a/Source/WebKit/chromium/public/WebAccessibilityObject.h b/Source/WebKit/chromium/public/WebAccessibilityObject.h index 029f43872..3a32a95ee 100644 --- a/Source/WebKit/chromium/public/WebAccessibilityObject.h +++ b/Source/WebKit/chromium/public/WebAccessibilityObject.h @@ -69,6 +69,7 @@ public: WEBKIT_EXPORT bool equals(const WebAccessibilityObject&) const; bool isNull() const { return m_private.isNull(); } + // isDetached also checks for null, so it's safe to just call isDetached. WEBKIT_EXPORT bool isDetached() const; // Static methods for enabling accessibility. @@ -77,11 +78,17 @@ public: WEBKIT_EXPORT int axID() const; + // Update the underlying tree, and return true if this object is + // still valid (not detached). Note that calling this method + // can cause other WebAccessibilityObjects to become invalid, too, + // so always call isDetached if updateBackingStoreAndCheckValidity + // has been called on any object, or if any other WebCore code has run. + WEBKIT_EXPORT bool updateBackingStoreAndCheckValidity(); + WEBKIT_EXPORT WebString accessibilityDescription() const; WEBKIT_EXPORT WebString actionVerb() const; WEBKIT_EXPORT bool canSetFocusAttribute() const; WEBKIT_EXPORT bool canSetValueAttribute() const; - WEBKIT_EXPORT bool isValid() const; WEBKIT_EXPORT unsigned childCount() const; @@ -126,6 +133,7 @@ public: WEBKIT_EXPORT WebString ariaLiveRegionRelevant() const; WEBKIT_EXPORT WebString ariaLiveRegionStatus() const; WEBKIT_EXPORT WebRect boundingBoxRect() const; + WEBKIT_EXPORT bool canvasHasFallbackContent() const; WEBKIT_EXPORT double estimatedLoadingProgress() const; WEBKIT_EXPORT WebString helpText() const; WEBKIT_EXPORT int headingLevel() const; @@ -142,6 +150,7 @@ public: WEBKIT_EXPORT WebAccessibilityObject titleUIElement() const; WEBKIT_EXPORT WebURL url() const; + WEBKIT_EXPORT bool supportsRangeValue() const; WEBKIT_EXPORT WebString valueDescription() const; WEBKIT_EXPORT float valueForRange() const; WEBKIT_EXPORT float maxValueForRange() const; diff --git a/Source/WebKit/chromium/public/WebAccessibilityRole.h b/Source/WebKit/chromium/public/WebAccessibilityRole.h index f40c1d99b..db8fbcbd4 100644 --- a/Source/WebKit/chromium/public/WebAccessibilityRole.h +++ b/Source/WebKit/chromium/public/WebAccessibilityRole.h @@ -49,6 +49,7 @@ enum WebAccessibilityRole { WebAccessibilityRoleBrowser, WebAccessibilityRoleBusyIndicator, WebAccessibilityRoleButton, + WebAccessibilityRoleCanvas, WebAccessibilityRoleCell, WebAccessibilityRoleCheckBox, WebAccessibilityRoleColorWell, @@ -74,6 +75,7 @@ enum WebAccessibilityRole { WebAccessibilityRoleGrowArea, WebAccessibilityRoleHeading, WebAccessibilityRoleHelpTag, + WebAccessibilityRoleHorizontalRule, WebAccessibilityRoleIgnored, WebAccessibilityRoleImage, WebAccessibilityRoleImageMap, diff --git a/Source/WebKit/chromium/public/WebActiveWheelFlingParameters.h b/Source/WebKit/chromium/public/WebActiveWheelFlingParameters.h index ef277d5fd..2133e8508 100644 --- a/Source/WebKit/chromium/public/WebActiveWheelFlingParameters.h +++ b/Source/WebKit/chromium/public/WebActiveWheelFlingParameters.h @@ -26,6 +26,7 @@ #ifndef WebActiveWheelFlingParameters_h #define WebActiveWheelFlingParameters_h +#include "WebInputEvent.h" #include "platform/WebCommon.h" #include "platform/WebFloatPoint.h" @@ -39,11 +40,13 @@ struct WebActiveWheelFlingParameters { WebPoint point; WebPoint globalPoint; int modifiers; + WebGestureEvent::SourceDevice sourceDevice; WebSize cumulativeScroll; double startTime; WebActiveWheelFlingParameters() : modifiers(0) + , sourceDevice(WebGestureEvent::Touchpad) , startTime(0) { } diff --git a/Source/WebKit/chromium/public/WebCompositorInputHandlerClient.h b/Source/WebKit/chromium/public/WebCompositorInputHandlerClient.h index 7c911d8f8..a4c4f62c3 100644 --- a/Source/WebKit/chromium/public/WebCompositorInputHandlerClient.h +++ b/Source/WebKit/chromium/public/WebCompositorInputHandlerClient.h @@ -35,12 +35,12 @@ public: // Callbacks invoked from the compositor thread. virtual void willShutdown() = 0; - // Exactly one of the following two callbacks will be invoked after every call to WebCompositor::handleInputEvent(): + // Exactly one of the following two callbacks will be invoked after every call to WebCompositorInputHandler::handleInputEvent(): - // Called when the WebCompositor handled the input event and no further processing is required. + // Called when the WebCompositorInputHandler handled the input event and no further processing is required. virtual void didHandleInputEvent() = 0; - // Called when the WebCompositor did not handle the input event. If sendToWidget is true, the input event + // Called when the WebCompositorInputHandler did not handle the input event. If sendToWidget is true, the input event // should be forwarded to the WebWidget associated with this compositor for further processing. virtual void didNotHandleInputEvent(bool sendToWidget) = 0; diff --git a/Source/WebKit/chromium/public/WebFrame.h b/Source/WebKit/chromium/public/WebFrame.h index 06531df8f..56cbe1ea4 100644 --- a/Source/WebKit/chromium/public/WebFrame.h +++ b/Source/WebKit/chromium/public/WebFrame.h @@ -415,6 +415,9 @@ public: // Returns true if a user gesture is currently being processed. virtual bool isProcessingUserGesture() const = 0; + // Returns true if a consumable gesture exists and has been successfully consumed. + virtual bool consumeUserGesture() const = 0; + // Returns true if this frame is in the process of opening a new frame // with a suppressed opener. virtual bool willSuppressOpenerInNewFrame() const = 0; @@ -469,10 +472,29 @@ public: // there is ranged selection. virtual bool selectWordAroundCaret() = 0; + // DEPRECATED: Use moveSelectionStart / moveSelectionEnd / moveCaret + // This method is intended for touch-based UIs, but it's missing some + // functionality needed on Android, like preventing collapsed selections. virtual void selectRange(const WebPoint& start, const WebPoint& end) = 0; virtual void selectRange(const WebRange&) = 0; + // The methods below are for adjusting the start and/or end of the current + // selection by direct manipulation on a touch-based UI. To enter selection + // mode in the first place, call selectRange() or send a fake mouse event. + + // Moves the start of the current selection, keeping the end fixed. + // Returns true on success, false if there is no selection to modify. + virtual bool moveSelectionStart(const WebPoint&, bool allowCollapsedSelection) = 0; + + // Moves the end of the current selection, keeping the start fixed. + // Returns true on success, false if there is no selection to modify. + virtual bool moveSelectionEnd(const WebPoint&, bool allowCollapsedSelection) = 0; + + // Move both endpoints of the current selection to the given position. + // The caret will remain pinned inside the current editable region. + // Returns true on success, false if there is no selection or if we're not editing. + virtual bool moveCaret(const WebPoint&) = 0; // Printing ------------------------------------------------------------ diff --git a/Source/WebKit/chromium/public/WebIDBFactory.h b/Source/WebKit/chromium/public/WebIDBFactory.h index f10a8eb9a..70c8c840c 100644 --- a/Source/WebKit/chromium/public/WebIDBFactory.h +++ b/Source/WebKit/chromium/public/WebIDBFactory.h @@ -41,6 +41,7 @@ namespace WebKit { class WebFrame; class WebIDBDatabase; +class WebIDBDatabaseCallbacks; class WebSecurityOrigin; // The entry point into the IndexedDatabase API. These classes match their Foo and @@ -54,16 +55,13 @@ public: virtual void getDatabaseNames(WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } - // FIXME: Delete this method when derived classes in chromium have - // implemented the other open method. - virtual void open(const WebString& name, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir) - { - open(name, WebIDBMetadata::NoIntVersion, callbacks, origin, frame, dataDir); - } - + // FIXME: This overload should be removed when WK90411 lands. // The WebKit implementation of open ignores the WebFrame* parameter. virtual void open(const WebString& name, long long version, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } + // The WebKit implementation of open ignores the WebFrame* parameter. + virtual void open(const WebString& name, long long version, WebIDBCallbacks* callbacks, WebIDBDatabaseCallbacks* databaseCallbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void deleteDatabase(const WebString& name, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } }; diff --git a/Source/WebKit/chromium/public/WebIDBKey.h b/Source/WebKit/chromium/public/WebIDBKey.h index 0b704cac2..3819de875 100644 --- a/Source/WebKit/chromium/public/WebIDBKey.h +++ b/Source/WebKit/chromium/public/WebIDBKey.h @@ -35,9 +35,6 @@ namespace WebCore { class IDBKey; } namespace WebKit { -class WebIDBKeyPath; -class WebSerializedScriptValue; - class WebIDBKey { public: // Please use one of the factory methods. This is public only to allow WebVector. @@ -50,8 +47,6 @@ public: WEBKIT_EXPORT static WebIDBKey createNumber(double); WEBKIT_EXPORT static WebIDBKey createInvalid(); WEBKIT_EXPORT static WebIDBKey createNull(); - WEBKIT_EXPORT static WebIDBKey createFromValueAndKeyPath(const WebSerializedScriptValue&, const WebIDBKeyPath&); - WEBKIT_EXPORT static WebSerializedScriptValue injectIDBKeyIntoSerializedValue(const WebIDBKey&, const WebSerializedScriptValue&, const WebIDBKeyPath&); WebIDBKey(const WebIDBKey& e) { assign(e); } WebIDBKey& operator=(const WebIDBKey& e) diff --git a/Source/WebKit/chromium/public/WebInputEvent.h b/Source/WebKit/chromium/public/WebInputEvent.h index d1f5173e9..63ce7131c 100644 --- a/Source/WebKit/chromium/public/WebInputEvent.h +++ b/Source/WebKit/chromium/public/WebInputEvent.h @@ -151,6 +151,10 @@ public: // event and back will not preserve these flags. CapsLockOn = 1 << 9, NumLockOn = 1 << 10, + + // Left/right modifiers for keyboard events. + IsLeft = 1 << 11, + IsRight = 1 << 12, }; static const int InputModifiers = ShiftKey | ControlKey | AltKey | MetaKey; @@ -237,7 +241,11 @@ public: // |windowsKeyCode| is the Windows key code associated with this key // event. Sometimes it's direct from the event (i.e. on Windows), // sometimes it's via a mapping function. If you want a list, see - // WebCore/platform/chromium/KeyboardCodes* . + // WebCore/platform/chromium/KeyboardCodes* . Note that this should + // ALWAYS store the non-locational version of a keycode as this is + // what is returned by the Windows API. For example, it should + // store VK_SHIFT instead of VK_RSHIFT. The location information + // should be stored in |modifiers|. int windowsKeyCode; // The actual key code genenerated by the platform. The DOM spec runs @@ -279,6 +287,9 @@ public: // Sets keyIdentifier based on the value of windowsKeyCode. This is // handy for generating synthetic keyboard events. WEBKIT_EXPORT void setKeyIdentifierFromWindowsKeyCode(); + + static int windowsKeyCodeWithoutLocation(int keycode); + static int locationModifiersFromWindowsKeyCode(int keycode); }; // WebMouseEvent -------------------------------------------------------------- @@ -365,6 +376,11 @@ public: class WebGestureEvent : public WebInputEvent { public: + enum SourceDevice { + Touchpad, + Touchscreen, + }; + int x; int y; int globalX; @@ -398,6 +414,7 @@ public: struct { float velocityX; float velocityY; + SourceDevice sourceDevice; } flingStart; struct { diff --git a/Source/WebKit/chromium/public/WebMediaPlayer.h b/Source/WebKit/chromium/public/WebMediaPlayer.h index ed62754d3..e0395ccd3 100644 --- a/Source/WebKit/chromium/public/WebMediaPlayer.h +++ b/Source/WebKit/chromium/public/WebMediaPlayer.h @@ -186,6 +186,7 @@ public: virtual WebTimeRanges sourceBuffered(const WebString& id) { return WebTimeRanges(); }; virtual bool sourceAppend(const WebString& id, const unsigned char* data, unsigned length) { return false; } virtual bool sourceAbort(const WebString& id) { return false; } + virtual void sourceSetDuration(double) { } virtual void sourceEndOfStream(EndOfStreamStatus) { } virtual bool sourceSetTimestampOffset(const WebString& id, double offset) { return false; } diff --git a/Source/WebKit/chromium/public/WebRuntimeFeatures.h b/Source/WebKit/chromium/public/WebRuntimeFeatures.h index 7152249e5..012efe82d 100644 --- a/Source/WebKit/chromium/public/WebRuntimeFeatures.h +++ b/Source/WebKit/chromium/public/WebRuntimeFeatures.h @@ -63,7 +63,7 @@ public: WEBKIT_EXPORT static void enableApplicationCache(bool); WEBKIT_EXPORT static bool isApplicationCacheEnabled(); - + WEBKIT_EXPORT static void enableDataTransferItems(bool); WEBKIT_EXPORT static bool isDataTransferItemsEnabled(); @@ -76,6 +76,7 @@ public: WEBKIT_EXPORT static void enableWebAudio(bool); WEBKIT_EXPORT static bool isWebAudioEnabled(); + // TODO: Remove these (since they're no-ops) once Chromium code stops calling them. WEBKIT_EXPORT static void enablePushState(bool); WEBKIT_EXPORT static bool isPushStateEnabled(bool); @@ -99,7 +100,7 @@ public: WEBKIT_EXPORT static void enableFileSystem(bool); WEBKIT_EXPORT static bool isFileSystemEnabled(); - + WEBKIT_EXPORT static void enableJavaScriptI18NAPI(bool); WEBKIT_EXPORT static bool isJavaScriptI18NAPIEnabled(); diff --git a/Source/WebKit/chromium/public/WebSettings.h b/Source/WebKit/chromium/public/WebSettings.h index e1e74a9b9..f47ff9f7c 100644 --- a/Source/WebKit/chromium/public/WebSettings.h +++ b/Source/WebKit/chromium/public/WebSettings.h @@ -103,6 +103,7 @@ public: virtual void setForceCompositingMode(bool) = 0; virtual void setFrameFlatteningEnabled(bool) = 0; virtual void setFullScreenEnabled(bool) = 0; + virtual void setGestureTapHighlightEnabled(bool) = 0; virtual void setHyperlinkAuditingEnabled(bool) = 0; virtual void setImagesEnabled(bool) = 0; virtual void setInteractiveFormValidationEnabled(bool) = 0; diff --git a/Source/WebKit/chromium/public/WebView.h b/Source/WebKit/chromium/public/WebView.h index e95ec6b53..5bb5712fa 100644 --- a/Source/WebKit/chromium/public/WebView.h +++ b/Source/WebKit/chromium/public/WebView.h @@ -60,11 +60,9 @@ class WebString; class WebTextFieldDecoratorClient; class WebViewClient; struct WebActiveWheelFlingParameters; -struct WebFloatQuad; struct WebMediaPlayerAction; struct WebPluginAction; struct WebPoint; -struct WebTouchCandidatesInfo; class WebView : public WebWidget { public: @@ -469,20 +467,6 @@ public: virtual WebViewBenchmarkSupport* benchmarkSupport() { return 0; } - - // Touch ---------------------------------------------------------------- - - // Returns a list of layout bounding boxes of the event target node touched by - // the input point with the padding. If no target node is found, an empty - // list is returned. If the node is of an inline type, each line box is returned - // separately. Otherwise, one bounding box is returned. Also returns information - // about the found candidates and their dimension, and the highlight color to use. - virtual WebVector<WebFloatQuad> getTouchHighlightQuads(const WebPoint&, - int padding, - WebTouchCandidatesInfo& outTouchInfo, - WebColor& outTapHighlightColor) = 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 904d4a2d2..839ed0d17 100644 --- a/Source/WebKit/chromium/public/WebViewClient.h +++ b/Source/WebKit/chromium/public/WebViewClient.h @@ -62,6 +62,7 @@ class WebFileChooserCompletion; class WebFrame; class WebGeolocationClient; class WebGeolocationService; +class WebGestureEvent; class WebHelperPlugin; class WebHitTestResult; class WebIconLoadingCompletion; @@ -84,6 +85,7 @@ struct WebConsoleMessage; struct WebContextMenuData; struct WebPoint; struct WebPopupMenuInfo; +struct WebRect; struct WebSize; struct WebWindowFeatures; @@ -285,6 +287,9 @@ public: // unless the view did not need a layout. virtual void didUpdateLayout() { } + // Return true to swallow the input event if the embedder will start a disambiguation popup + virtual bool didTapMultipleTargets(const WebGestureEvent&, const WebVector<WebRect>& targetRects) { return false; } + // Session history ----------------------------------------------------- // Tells the embedder to navigate back or forward in session history by diff --git a/Source/WebKit/chromium/public/linux/WebFontInfo.h b/Source/WebKit/chromium/public/linux/WebFontInfo.h index ed88b9306..a5758f1d4 100644 --- a/Source/WebKit/chromium/public/linux/WebFontInfo.h +++ b/Source/WebKit/chromium/public/linux/WebFontInfo.h @@ -28,51 +28,4 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebFontInfo_h -#define WebFontInfo_h - -#include "../linux/WebFontRenderStyle.h" -#include "../platform/WebCString.h" -#include "../platform/linux/WebFontFamily.h" - -#include <string.h> -#include <unistd.h> - -namespace WebKit { - -class WebFontInfo { -public: - // Set a global preference describing whether renderStyleForStrike() should - // enable subpixel positioning or not. FontConfig doesn't currently provide - // a parameter for controlling this. - WEBKIT_EXPORT static void setSubpixelPositioning(bool); - - // Return a font family which provides glyphs for the Unicode code points - // specified by |utf16| - // characters: a native-endian UTF16 string - // numCharacters: the number of 16-bit words in |utf16| - // preferredLocale: preferred locale identifier for the |characters| - // (e.g. "en", "ja", "zh-CN") - // - // Returns: the font family or an empty string if the request could not be - // satisfied. - // Returns: the font family instance. The instance has an empty font name if the request could not be satisfied. - WEBKIT_EXPORT static void familyForChars(const WebUChar* characters, size_t numCharacters, const char* preferredLocale, WebFontFamily*); - - // Fill out the given WebFontRenderStyle with the user's preferences for - // rendering the given font at the given size (in pixels). - // family: i.e. "Times New Roman" - // sizeAndStyle: - // 3322222222221111111111 - // 10987654321098765432109876543210 - // +--------------------------------+ - // |..............Size............IB| - // +--------------------------------+ - // I: italic flag - // B: bold flag - WEBKIT_EXPORT static void renderStyleForStrike(const char* family, int sizeAndStyle, WebFontRenderStyle* result); -}; - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/linux/WebFontInfo.h" diff --git a/Source/WebKit/chromium/public/linux/WebFontRenderStyle.h b/Source/WebKit/chromium/public/linux/WebFontRenderStyle.h index f4858f3ec..26f61aa4b 100644 --- a/Source/WebKit/chromium/public/linux/WebFontRenderStyle.h +++ b/Source/WebKit/chromium/public/linux/WebFontRenderStyle.h @@ -28,36 +28,4 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebFontRenderStyle_h -#define WebFontRenderStyle_h - -#include "../platform/WebCommon.h" - -namespace WebCore { struct FontRenderStyle; } - -namespace WebKit { - -struct WEBKIT_EXPORT WebFontRenderStyle { - // Each of the use* members below can take one of three values: - // 0: off - // 1: on - // 2: no preference expressed - char useBitmaps; // use embedded bitmap strike if possible - char useAutoHint; // use 'auto' hinting (FreeType specific) - char useHinting; // hint glyphs to the pixel grid - char hintStyle; // level of hinting, 0..3 - char useAntiAlias; // antialias glyph shapes - char useSubpixelRendering; // use subpixel rendering (partially-filled pixels) - char useSubpixelPositioning; // use subpixel positioning (fractional X positions for glyphs) - -#if WEBKIT_IMPLEMENTATION - // Translates the members of this struct to a FontRenderStyle - void toFontRenderStyle(WebCore::FontRenderStyle*); -#endif - - void setDefaults(); -}; - -} // namespace WebKit - -#endif // WebFontRenderStyle_h +#include "../../../../Platform/chromium/public/linux/WebFontRenderStyle.h" diff --git a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h index 70ad85228..a4e2397cd 100644 --- a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h +++ b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h @@ -49,8 +49,6 @@ namespace WebKit { class WebApplicationCacheHost; // FIXME: Does this belong in platform? class WebApplicationCacheHostClient; // FIXME: Does this belong in platform? class WebIDBFactory; // FIXME: Does this belong in platform? -class WebIDBKey; // FIXME: Does this belong in platform? -class WebIDBKeyPath; // FIXME: Does this belong in platform? class WebPluginListBuilder; // FIXME: Does this belong in platform? class WebSharedWorkerRepository; // FIXME: Does this belong in platform? @@ -60,8 +58,6 @@ public: // Indexed Database ---------------------------------------------------- virtual WebIDBFactory* idbFactory() { return 0; } - virtual void createIDBKeysFromSerializedValuesAndKeyPath(const WebVector<WebSerializedScriptValue>& values, const WebIDBKeyPath& keyPath, WebVector<WebIDBKey>& keys) { } - virtual WebSerializedScriptValue injectIDBKeyIntoSerializedValue(const WebIDBKey& key, const WebSerializedScriptValue& value, const WebIDBKeyPath& keyPath) { return WebSerializedScriptValue(); } // Plugins ------------------------------------------------------------- diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index 27239d769..cfaa26bab 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -64,6 +64,7 @@ #include "PageVisibilityState.h" #include "PeerConnection00.h" #include "PlatformCursor.h" +#include "RTCPeerConnectionHandlerClient.h" #include "ReferrerPolicy.h" #include "ResourceResponse.h" #include "Settings.h" @@ -108,13 +109,15 @@ #include "WebTextCheckingResult.h" #include "WebTextCheckingType.h" #include "WebView.h" -#include "platform/WebICEOptions.h" -#include "platform/WebMediaStreamSource.h" -#include "platform/WebPeerConnection00Handler.h" -#include "platform/WebPeerConnection00HandlerClient.h" #include <public/WebClipboard.h> #include <public/WebFileSystem.h> #include <public/WebFilterOperation.h> +#include <public/WebICEOptions.h> +#include <public/WebMediaStreamSource.h> +#include <public/WebPeerConnection00Handler.h> +#include <public/WebPeerConnection00HandlerClient.h> +#include <public/WebRTCPeerConnectionHandler.h> +#include <public/WebRTCPeerConnectionHandlerClient.h> #include <public/WebReferrerPolicy.h> #include <public/WebScrollbar.h> #include <public/WebURLResponse.h> @@ -258,6 +261,7 @@ COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDocumentNote, DocumentNoteRole) COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDocumentRegion, DocumentRegionRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleUserInterfaceTooltip, UserInterfaceTooltipRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleToggleButton, ToggleButtonRole); +COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleCanvas, CanvasRole); COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::Uncached, ApplicationCacheHost::UNCACHED); COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::Idle, ApplicationCacheHost::IDLE); @@ -592,6 +596,21 @@ COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ICEStateConnected COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ICEStateCompleted, PeerConnection00::ICE_COMPLETED); COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ICEStateFailed, PeerConnection00::ICE_FAILED); COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ICEStateClosed, PeerConnection00::ICE_CLOSED); + +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ReadyStateNew, RTCPeerConnectionHandlerClient::ReadyStateNew); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ReadyStateOpening, RTCPeerConnectionHandlerClient::ReadyStateOpening); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ReadyStateActive, RTCPeerConnectionHandlerClient::ReadyStateActive); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ReadyStateClosing, RTCPeerConnectionHandlerClient::ReadyStateClosing); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ReadyStateClosed, RTCPeerConnectionHandlerClient::ReadyStateClosed); + +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateNew, RTCPeerConnectionHandlerClient::IceStateNew); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateGathering, RTCPeerConnectionHandlerClient::IceStateGathering); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateWaiting, RTCPeerConnectionHandlerClient::IceStateWaiting); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateChecking, RTCPeerConnectionHandlerClient::IceStateChecking); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateConnected, RTCPeerConnectionHandlerClient::IceStateConnected); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateCompleted, RTCPeerConnectionHandlerClient::IceStateCompleted); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateFailed, RTCPeerConnectionHandlerClient::IceStateFailed); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateClosed, RTCPeerConnectionHandlerClient::IceStateClosed); #endif #if ENABLE(SCRIPTED_SPEECH) diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index d73654578..985757783 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -42,6 +42,7 @@ #include "Console.h" #include "Cursor.h" #include "DatabaseTracker.h" +#include "DateTimeChooserImpl.h" #include "Document.h" #include "DocumentLoader.h" #include "ExternalPopupMenu.h" @@ -652,6 +653,8 @@ void ChromeClientImpl::dispatchViewportPropertiesDidChange(const ViewportArgumen args, settings->layoutFallbackWidth(), deviceRect.width, deviceRect.height, dpi / ViewportArguments::deprecatedTargetDPI, IntSize(deviceRect.width, deviceRect.height)); + restrictScaleFactorToInitialScaleIfNotUserScalable(computed); + if (m_webView->ignoreViewportTagMaximumScale()) { computed.maximumScale = max(computed.maximumScale, m_webView->maxPageScaleFactor); computed.userScalable = true; @@ -704,6 +707,13 @@ PassOwnPtr<WebColorChooser> ChromeClientImpl::createWebColorChooser(WebColorChoo } #endif +#if ENABLE(CALENDAR_PICKER) +PassOwnPtr<WebCore::DateTimeChooser> ChromeClientImpl::openDateTimeChooser(WebCore::DateTimeChooserClient* pickerClient, const WebCore::DateTimeChooserParameters& parameters) +{ + return adoptPtr(new DateTimeChooserImpl(this, pickerClient, parameters)); +} +#endif + void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileChooser) { WebViewClient* client = m_webView->client(); @@ -1119,18 +1129,18 @@ void ChromeClientImpl::dashboardRegionsChanged() } #endif -#if ENABLE(REGISTER_PROTOCOL_HANDLER) -PassOwnPtr<RegisterProtocolHandlerClientImpl> RegisterProtocolHandlerClientImpl::create(WebViewImpl* webView) +#if ENABLE(NAVIGATOR_CONTENT_UTILS) +PassOwnPtr<NavigatorContentUtilsClientImpl> NavigatorContentUtilsClientImpl::create(WebViewImpl* webView) { - return adoptPtr(new RegisterProtocolHandlerClientImpl(webView)); + return adoptPtr(new NavigatorContentUtilsClientImpl(webView)); } -RegisterProtocolHandlerClientImpl::RegisterProtocolHandlerClientImpl(WebViewImpl* webView) +NavigatorContentUtilsClientImpl::NavigatorContentUtilsClientImpl(WebViewImpl* webView) : m_webView(webView) { } -void RegisterProtocolHandlerClientImpl::registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title) +void NavigatorContentUtilsClientImpl::registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title) { m_webView->client()->registerProtocolHandler(scheme, baseURL, url, title); } diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.h b/Source/WebKit/chromium/src/ChromeClientImpl.h index a786dc5eb..7d456fbf5 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.h +++ b/Source/WebKit/chromium/src/ChromeClientImpl.h @@ -33,8 +33,8 @@ #define ChromeClientImpl_h #include "ChromeClientChromium.h" +#include "NavigatorContentUtilsClient.h" #include "PopupMenu.h" -#include "RegisterProtocolHandlerClient.h" #include "SearchPopupMenu.h" #include "WebNavigationPolicy.h" #include <public/WebColor.h> @@ -50,6 +50,8 @@ class PopupContainer; class PopupMenuClient; class RenderBox; class SecurityOrigin; +class DateTimeChooser; +class DateTimeChooserClient; struct WindowFeatures; } @@ -144,6 +146,9 @@ public: virtual PassOwnPtr<WebCore::ColorChooser> createColorChooser(WebCore::ColorChooserClient*, const WebCore::Color&) OVERRIDE; PassOwnPtr<WebColorChooser> createWebColorChooser(WebColorChooserClient*, const WebColor&); #endif +#if ENABLE(CALENDAR_PICKER) + virtual PassOwnPtr<WebCore::DateTimeChooser> openDateTimeChooser(WebCore::DateTimeChooserClient*, const WebCore::DateTimeChooserParameters&) OVERRIDE; +#endif virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>); virtual void loadIconForFiles(const Vector<WTF::String>&, WebCore::FileIconLoader*); #if ENABLE(DIRECTORY_UPLOAD) @@ -237,15 +242,15 @@ private: #endif }; -class RegisterProtocolHandlerClientImpl : public WebCore::RegisterProtocolHandlerClient { +class NavigatorContentUtilsClientImpl : public WebCore::NavigatorContentUtilsClient { public: - static PassOwnPtr<RegisterProtocolHandlerClientImpl> create(WebViewImpl*); - ~RegisterProtocolHandlerClientImpl() { } + static PassOwnPtr<NavigatorContentUtilsClientImpl> create(WebViewImpl*); + ~NavigatorContentUtilsClientImpl() { } virtual void registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title) OVERRIDE; private: - explicit RegisterProtocolHandlerClientImpl(WebViewImpl*); + explicit NavigatorContentUtilsClientImpl(WebViewImpl*); WebViewImpl* m_webView; }; diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp index adaa41392..2fd6431c1 100644 --- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -53,7 +53,6 @@ #include "KURL.h" #include "MediaError.h" #include "Page.h" -#include "PlatformString.h" #include "RenderWidget.h" #include "Settings.h" #include "TextBreakIterator.h" @@ -75,6 +74,7 @@ #include "platform/WebVector.h" #include "WebViewClient.h" #include "WebViewImpl.h" +#include <wtf/text/WTFString.h> using namespace WebCore; @@ -122,7 +122,7 @@ static String selectMisspelledWord(const ContextMenu* defaultMenu, Frame* select // Selection is empty, so change the selection to the word under the cursor. HitTestResult hitTestResult = selectedFrame->eventHandler()-> - hitTestResultAtPoint(selectedFrame->page()->contextMenuController()->hitTestResult().point(), true); + hitTestResultAtPoint(selectedFrame->page()->contextMenuController()->hitTestResult().point(), HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AllowShadowContent); Node* innerNode = hitTestResult.innerNode(); VisiblePosition pos(innerNode->renderer()->positionForPoint( hitTestResult.localPoint())); diff --git a/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp b/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp new file mode 100644 index 000000000..69718dcb6 --- /dev/null +++ b/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp @@ -0,0 +1,132 @@ +/* + * 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 "DateTimeChooserImpl.h" + +#if ENABLE(CALENDAR_PICKER) + +#include "CalendarPicker.h" +#include "ChromeClientImpl.h" +#include "DateComponents.h" +#include "DateTimeChooserClient.h" +#include "Language.h" +#include "LocalizedDate.h" +#include "NotImplemented.h" +#include "PickerCommon.h" +#include "RenderTheme.h" +#include "platform/WebKitPlatformSupport.h" +#include <public/WebLocalizedString.h> + +using namespace WTF::Unicode; + +namespace WebKit { + +DateTimeChooserImpl::DateTimeChooserImpl(ChromeClientImpl* chromeClient, WebCore::DateTimeChooserClient* client, const WebCore::DateTimeChooserParameters& parameters) + : m_chromeClient(chromeClient) + , m_client(client) + , m_popup(0) + , m_parameters(parameters) +{ + ASSERT(m_chromeClient); + ASSERT(m_client); + m_popup = m_chromeClient->openPagePopup(this, m_parameters.anchorRectInRootView); +} + +DateTimeChooserImpl::~DateTimeChooserImpl() +{ +} + +void DateTimeChooserImpl::endChooser() +{ + if (!m_popup) + return; + m_chromeClient->closePagePopup(m_popup); +} + +WebCore::IntSize DateTimeChooserImpl::contentSize() +{ + return WebCore::IntSize(0, 0); +} + +void DateTimeChooserImpl::writeDocument(WebCore::DocumentWriter& writer) +{ + WebCore::DateComponents date; + date.setMillisecondsSinceEpochForDate(m_parameters.minimum); + String minString = date.toString(); + date.setMillisecondsSinceEpochForDate(m_parameters.maximum); + String maxString = date.toString(); + String stepString = String::number(m_parameters.step); + + addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", writer); + writer.addData(WebCore::pickerCommonCss, sizeof(WebCore::pickerCommonCss)); + writer.addData(WebCore::calendarPickerCss, sizeof(WebCore::calendarPickerCss)); + CString extraStyle = WebCore::RenderTheme::defaultTheme()->extraCalendarPickerStyleSheet(); + if (extraStyle.length()) + writer.addData(extraStyle.data(), extraStyle.length()); + addString("</style></head><body><div id=main>Loading...</div><script>\n" + "window.dialogArguments = {\n", writer); + addProperty("min", minString, writer); + addProperty("max", maxString, writer); + addProperty("step", stepString, writer); + addProperty("required", m_parameters.required, writer); + addProperty("currentValue", m_parameters.currentValue, writer); + addProperty("locale", WebCore::defaultLanguage(), writer); + addProperty("todayLabel", Platform::current()->queryLocalizedString(WebLocalizedString::CalendarToday), writer); + addProperty("clearLabel", Platform::current()->queryLocalizedString(WebLocalizedString::CalendarClear), writer); + addProperty("weekStartDay", WebCore::firstDayOfWeek(), writer); + addProperty("monthLabels", WebCore::monthLabels(), writer); + addProperty("dayLabels", WebCore::weekDayShortLabels(), writer); + Direction dir = direction(WebCore::monthLabels()[0][0]); + addProperty("isRTL", dir == RightToLeft || dir == RightToLeftArabic, writer); + addString("}\n", writer); + + writer.addData(WebCore::pickerCommonJs, sizeof(WebCore::pickerCommonJs)); + writer.addData(WebCore::calendarPickerJs, sizeof(WebCore::calendarPickerJs)); + addString("</script></body>\n", writer); +} + +void DateTimeChooserImpl::setValueAndClosePopup(int numValue, const String& stringValue) +{ + if (numValue >= 0) + m_client->didChooseValue(stringValue); + endChooser(); +} + +void DateTimeChooserImpl::didClosePopup() +{ + ASSERT(m_client); + m_popup = 0; + m_client->didEndChooser(); +} + +} // namespace WebKit + +#endif // ENABLE(CALENDAR_PICKER) diff --git a/Source/WebKit/chromium/src/DateTimeChooserImpl.h b/Source/WebKit/chromium/src/DateTimeChooserImpl.h new file mode 100644 index 000000000..e504592bc --- /dev/null +++ b/Source/WebKit/chromium/src/DateTimeChooserImpl.h @@ -0,0 +1,73 @@ +/* + * 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 DateTimeChooserImpl_h +#define DateTimeChooserImpl_h + +#include "DateTimeChooser.h" +#include "PagePopupClient.h" + +#if ENABLE(CALENDAR_PICKER) + +namespace WebCore { +class PagePopup; +class DateTimeChooserClient; +} + +namespace WebKit { + +class ChromeClientImpl; + +class DateTimeChooserImpl : public WebCore::DateTimeChooser, public WebCore::PagePopupClient { +public: + DateTimeChooserImpl(ChromeClientImpl*, WebCore::DateTimeChooserClient*, const WebCore::DateTimeChooserParameters&); + virtual ~DateTimeChooserImpl(); + + // DateTimeChooser functions: + virtual void endChooser() OVERRIDE; + +private: + // PagePopupClient functions: + virtual WebCore::IntSize contentSize() OVERRIDE; + virtual void writeDocument(WebCore::DocumentWriter&) OVERRIDE; + virtual void setValueAndClosePopup(int, const String&) OVERRIDE; + virtual void didClosePopup() OVERRIDE; + + ChromeClientImpl* m_chromeClient; + WebCore::DateTimeChooserClient* m_client; + WebCore::PagePopup* m_popup; + WebCore::DateTimeChooserParameters m_parameters; +}; + +} + +#endif // ENABLE(CALENDAR_PICKER) + +#endif // DateTimeChooserImpl_h diff --git a/Source/WebKit/chromium/src/EditorClientImpl.cpp b/Source/WebKit/chromium/src/EditorClientImpl.cpp index b5eaf595f..3046db32e 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.cpp +++ b/Source/WebKit/chromium/src/EditorClientImpl.cpp @@ -37,7 +37,6 @@ #include "KeyboardCodes.h" #include "KeyboardEvent.h" #include "PlatformKeyboardEvent.h" -#include "PlatformString.h" #include "RenderObject.h" #include "Settings.h" #include "SpellChecker.h" @@ -61,6 +60,7 @@ #include "WebTextCheckingResult.h" #include "WebViewClient.h" #include "WebViewImpl.h" +#include <wtf/text/WTFString.h> using namespace WebCore; @@ -849,6 +849,15 @@ void EditorClientImpl::getGuessesForWord(const String& word, notImplemented(); } +bool EditorClientImpl::supportsGlobalSelection() +{ +#if OS(UNIX) && !OS(DARWIN) + return true; +#else + return false; +#endif +} + void EditorClientImpl::willSetInputMethodState() { if (m_webView->client()) diff --git a/Source/WebKit/chromium/src/EditorClientImpl.h b/Source/WebKit/chromium/src/EditorClientImpl.h index 3ee9ebaaa..a79bb9b1f 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.h +++ b/Source/WebKit/chromium/src/EditorClientImpl.h @@ -113,6 +113,7 @@ public: virtual void willSetInputMethodState(); virtual void setInputMethodState(bool enabled); virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>); + virtual bool supportsGlobalSelection() OVERRIDE; virtual WebCore::TextCheckerClient* textChecker() { return this; } diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp index 5dd02b563..c99bd7c57 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -997,8 +997,7 @@ void FrameLoaderClientImpl::dispatchDecidePolicyForNavigationAction( if (event->isMouseEvent()) { const MouseEvent* mouseEvent = static_cast<const MouseEvent*>(event); - node = m_webFrame->frame()->eventHandler()->hitTestResultAtPoint( - mouseEvent->absoluteLocation(), false).innerNonSharedNode(); + node = m_webFrame->frame()->eventHandler()->hitTestResultAtPoint(mouseEvent->absoluteLocation()).innerNonSharedNode(); break; } } diff --git a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp index 4f257c77c..f2657a7bd 100644 --- a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp +++ b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp @@ -35,13 +35,13 @@ #include "Frame.h" #include "InspectorFrontendHost.h" #include "Page.h" -#include "PlatformString.h" #include "ScriptController.h" #include "V8InspectorFrontendHost.h" #include "WebDevToolsFrontendClient.h" #include "WebDevToolsFrontendImpl.h" #include "platform/WebFloatPoint.h" #include "platform/WebString.h" +#include <wtf/text/WTFString.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/LinkHighlight.cpp b/Source/WebKit/chromium/src/LinkHighlight.cpp index 2c804a8cd..1e72900c4 100644 --- a/Source/WebKit/chromium/src/LinkHighlight.cpp +++ b/Source/WebKit/chromium/src/LinkHighlight.cpp @@ -41,7 +41,9 @@ #include "WebFrameImpl.h" #include "WebKit.h" #include "WebViewImpl.h" +#include <public/Platform.h> #include <public/WebAnimationCurve.h> +#include <public/WebCompositorSupport.h> #include <public/WebFloatAnimationCurve.h> #include <public/WebFloatPoint.h> #include <public/WebRect.h> @@ -59,16 +61,16 @@ PassOwnPtr<LinkHighlight> LinkHighlight::create(Node* node, WebViewImpl* owningW } LinkHighlight::LinkHighlight(Node* node, WebViewImpl* owningWebViewImpl) - : m_contentLayer(adoptPtr(WebContentLayer::create(this))) - , m_clipLayer(adoptPtr(WebLayer::create())) - , m_node(node) + : m_node(node) , m_owningWebViewImpl(owningWebViewImpl) , m_currentGraphicsLayer(0) , m_geometryNeedsUpdate(false) { ASSERT(m_node); ASSERT(owningWebViewImpl); - + WebCompositorSupport* compositorSupport = Platform::current()->compositorSupport(); + m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this)); + m_clipLayer = adoptPtr(compositorSupport->createLayer()); m_clipLayer->setAnchorPoint(WebFloatPoint()); m_clipLayer->addChild(m_contentLayer->layer()); m_contentLayer->layer()->setDrawsContent(false); @@ -147,7 +149,7 @@ bool LinkHighlight::computeHighlightLayerPathAndPosition(RenderLayer* compositin return false; bool pathHasChanged = false; - FloatRect boundingRect = m_node->getPixelSnappedRect(); + FloatRect boundingRect = m_node->pixelSnappedBoundingBox(); // FIXME: If we ever use a more sophisticated highlight path, we'll need // to devise a way of detecting when it changes. @@ -196,17 +198,21 @@ void LinkHighlight::startHighlightAnimation() { const float startOpacity = 1; // FIXME: Should duration be configurable? - const float duration = 2; + const float duration = 0.1f; m_contentLayer->layer()->setOpacity(startOpacity); - OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + WebCompositorSupport* compositorSupport = Platform::current()->compositorSupport(); + + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(compositorSupport->createFloatAnimationCurve()); + curve->add(WebFloatKeyframe(0, startOpacity)); curve->add(WebFloatKeyframe(duration / 2, startOpacity)); // For layout tests we don't fade out. curve->add(WebFloatKeyframe(duration, WebKit::layoutTestMode() ? startOpacity : 0)); - m_animation = adoptPtr(WebAnimation::create(*curve, WebAnimation::TargetPropertyOpacity)); + m_animation = adoptPtr(compositorSupport->createAnimation(*curve, WebAnimation::TargetPropertyOpacity)); + m_contentLayer->layer()->setDrawsContent(true); m_contentLayer->layer()->addAnimation(m_animation.get()); diff --git a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp index d22412ac8..5fa07ddad 100644 --- a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp @@ -39,7 +39,6 @@ #include "FileSystemCallback.h" #include "FileSystemCallbacks.h" #include "FileSystemType.h" -#include "PlatformString.h" #include "WebFileError.h" #include "WebFileSystemCallbacksImpl.h" #include "WebFrameClient.h" @@ -52,6 +51,7 @@ #include "WorkerThread.h" #include <public/WebFileSystem.h> #include <wtf/Threading.h> +#include <wtf/text/WTFString.h> using namespace WebKit; diff --git a/Source/WebKit/chromium/src/LocalizedStrings.cpp b/Source/WebKit/chromium/src/LocalizedStrings.cpp index 2a4432d8a..40a009369 100644 --- a/Source/WebKit/chromium/src/LocalizedStrings.cpp +++ b/Source/WebKit/chromium/src/LocalizedStrings.cpp @@ -202,6 +202,58 @@ String AXMenuListActionVerb() return String(); } +#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) +String AXAMPMFieldText() +{ + return query(WebLocalizedString::AXAMPMFieldText); +} + +String AXDayOfMonthFieldText() +{ + return query(WebLocalizedString::AXDayOfMonthFieldText); +} + +String AXDateTimeFieldEmptyValueText() +{ + return query(WebLocalizedString::AXDateTimeFieldEmptyValueText); +} + +String AXHourFieldText() +{ + return query(WebLocalizedString::AXHourFieldText); +} + +String AXMillisecondFieldText() +{ + return query(WebLocalizedString::AXMillisecondFieldText); +} + +String AXMinuteFieldText() +{ + return query(WebLocalizedString::AXMinuteFieldText); +} + +String AXMonthFieldText() +{ + return query(WebLocalizedString::AXMonthFieldText); +} + +String AXSecondFieldText() +{ + return query(WebLocalizedString::AXSecondFieldText); +} + +String AXWeekOfYearFieldText() +{ + return query(WebLocalizedString::AXWeekOfYearFieldText); +} + +String AXYearFieldText() +{ + return query(WebLocalizedString::AXYearFieldText); +} +#endif + String missingPluginText() { return query(WebLocalizedString::MissingPluginText); diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp index 4df4204b3..ae99ba889 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp @@ -42,13 +42,13 @@ NonCompositedContentHost::NonCompositedContentHost(WebViewImpl* webView) : m_webView(webView) , m_opaque(true) , m_showDebugBorders(false) - , m_deviceScaleFactor(1.0) { m_graphicsLayer = WebCore::GraphicsLayer::create(this); #ifndef NDEBUG m_graphicsLayer->setName("non-composited content"); #endif m_graphicsLayer->setDrawsContent(true); + m_graphicsLayer->setAppliesPageScale(true); WebContentLayer* layer = static_cast<WebCore::GraphicsLayerChromium*>(m_graphicsLayer.get())->contentLayer(); layer->setUseLCDText(true); layer->layer()->setOpaque(true); @@ -88,7 +88,7 @@ void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer) ASSERT(haveScrollLayer()); } -void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, float deviceScale) +void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin) { if (!haveScrollLayer()) return; @@ -102,8 +102,6 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, // Due to the possibility of pinch zoom, the noncomposited layer is always // assumed to be scrollable. layer->setScrollable(true); - m_deviceScaleFactor = deviceScale; - m_graphicsLayer->deviceOrPageScaleFactorChanged(); m_graphicsLayer->setSize(contentsSize); // In RTL-style pages, the origin of the initial containing block for the diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.h b/Source/WebKit/chromium/src/NonCompositedContentHost.h index 08b5f6a41..69776d90f 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.h +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.h @@ -58,7 +58,7 @@ public: void setBackgroundColor(const WebCore::Color&); void setOpaque(bool); void setScrollLayer(WebCore::GraphicsLayer*); - void setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, float deviceScale); + void setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin); WebCore::GraphicsLayer* topLevelRootLayer() const { return m_graphicsLayer.get(); } void setShowDebugBorders(bool); @@ -73,11 +73,6 @@ private: virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect); virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const; virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const; - // The deviceScaleFactor given to the GraphicsLayer can be non-1 when the - // contents are scaled in the compositor instead of by the pageScaleFactor. - // However, the pageScaleFactor is always baked into the GraphicsLayer's - // size, so it is always 1 for the GraphicsLayer. - virtual float deviceScaleFactor() const OVERRIDE { return m_deviceScaleFactor; } bool haveScrollLayer(); WebLayer* scrollLayer(); @@ -89,7 +84,6 @@ private: bool m_opaque; bool m_showDebugBorders; - float m_deviceScaleFactor; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/PlatformSupport.cpp b/Source/WebKit/chromium/src/PlatformSupport.cpp index aca97d0a3..762055497 100644 --- a/Source/WebKit/chromium/src/PlatformSupport.cpp +++ b/Source/WebKit/chromium/src/PlatformSupport.cpp @@ -31,8 +31,6 @@ #include "config.h" #include "PlatformSupport.h" -#include <googleurl/src/url_util.h> - #include "Chrome.h" #include "ChromeClientImpl.h" #include "FileMetadata.h" @@ -41,8 +39,6 @@ #include "WebFileUtilities.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" -#include "WebIDBKey.h" -#include "WebIDBKeyPath.h" #include "WebKit.h" #include "WebPluginContainerImpl.h" #include "WebPluginListBuilderImpl.h" @@ -257,23 +253,6 @@ void PlatformSupport::getFontFamilyForCharacters(const UChar* characters, size_t #endif } -void PlatformSupport::getRenderStyleForStrike(const char* font, int sizeAndStyle, FontRenderStyle* result) -{ - WebFontRenderStyle style; - -#if OS(ANDROID) - style.setDefaults(); -#else - if (!font || !*font) - style.setDefaults(); // It's probably a webfont. Take the system defaults. - else if (WebKit::Platform::current()->sandboxSupport()) - WebKit::Platform::current()->sandboxSupport()->getRenderStyleForStrike(font, sizeAndStyle, &style); - else - WebFontInfo::renderStyleForStrike(font, sizeAndStyle, &style); -#endif - - style.toFontRenderStyle(result); -} #endif // Indexed Database ----------------------------------------------------------- @@ -285,23 +264,6 @@ PassRefPtr<IDBFactoryBackendInterface> PlatformSupport::idbFactory() return IDBFactoryBackendProxy::create(); } -void PlatformSupport::createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue> >& values, const IDBKeyPath& keyPath, Vector<RefPtr<IDBKey> >& keys) -{ - WebVector<WebSerializedScriptValue> webValues = values; - WebVector<WebIDBKey> webKeys; - webKitPlatformSupport()->createIDBKeysFromSerializedValuesAndKeyPath(webValues, keyPath, webKeys); - - size_t webKeysSize = webKeys.size(); - keys.reserveCapacity(webKeysSize); - for (size_t i = 0; i < webKeysSize; ++i) - keys.append(PassRefPtr<IDBKey>(webKeys[i])); -} - -PassRefPtr<SerializedScriptValue> PlatformSupport::injectIDBKeyIntoSerializedValue(PassRefPtr<IDBKey> key, PassRefPtr<SerializedScriptValue> value, const IDBKeyPath& keyPath) -{ - return webKitPlatformSupport()->injectIDBKeyIntoSerializedValue(key, value, keyPath); -} - // Plugin --------------------------------------------------------------------- bool PlatformSupport::plugins(bool refresh, Vector<PluginInfo>* results) @@ -319,20 +281,6 @@ NPObject* PlatformSupport::pluginScriptableObject(Widget* widget) return static_cast<WebPluginContainerImpl*>(widget)->scriptableObject(); } -// Resources ------------------------------------------------------------------ - -#if ENABLE(WEB_AUDIO) - -PassOwnPtr<AudioBus> PlatformSupport::decodeAudioFileData(const char* data, size_t size, double sampleRate) -{ - WebAudioBus webAudioBus; - if (webKitPlatformSupport()->loadAudioResource(&webAudioBus, data, size, sampleRate)) - return webAudioBus.release(); - return nullptr; -} - -#endif // ENABLE(WEB_AUDIO) - // Theming -------------------------------------------------------------------- #if OS(WINDOWS) @@ -547,51 +495,6 @@ void PlatformSupport::paintThemePart( #endif -// Visited Links -------------------------------------------------------------- - -LinkHash PlatformSupport::visitedLinkHash(const UChar* url, unsigned length) -{ - url_canon::RawCanonOutput<2048> buffer; - url_parse::Parsed parsed; - if (!url_util::Canonicalize(url, length, 0, &buffer, &parsed)) - return 0; // Invalid URLs are unvisited. - return webKitPlatformSupport()->visitedLinkHash(buffer.data(), buffer.length()); -} - -LinkHash PlatformSupport::visitedLinkHash(const KURL& base, - const AtomicString& attributeURL) -{ - // Resolve the relative URL using googleurl and pass the absolute URL up to - // the embedder. We could create a GURL object from the base and resolve - // the relative URL that way, but calling the lower-level functions - // directly saves us the string allocation in most cases. - url_canon::RawCanonOutput<2048> buffer; - url_parse::Parsed parsed; - -#if USE(GOOGLEURL) - const CString& cstr = base.utf8String(); - const char* data = cstr.data(); - int length = cstr.length(); - const url_parse::Parsed& srcParsed = base.parsed(); -#else - // When we're not using GoogleURL, first canonicalize it so we can resolve it - // below. - url_canon::RawCanonOutput<2048> srcCanon; - url_parse::Parsed srcParsed; - String str = base.string(); - if (!url_util::Canonicalize(str.characters(), str.length(), 0, &srcCanon, &srcParsed)) - return 0; - const char* data = srcCanon.data(); - int length = srcCanon.length(); -#endif - - if (!url_util::ResolveRelative(data, length, srcParsed, attributeURL.characters(), - attributeURL.length(), 0, &buffer, &parsed)) - return 0; // Invalid resolved URL. - - return webKitPlatformSupport()->visitedLinkHash(buffer.data(), buffer.length()); -} - // These are temporary methods that the WebKit layer can use to call to the // Glue layer. Once the Glue layer moves entirely into the WebKit layer, these // methods will be deleted. diff --git a/Source/WebKit/chromium/src/SpeechInputClientImpl.cpp b/Source/WebKit/chromium/src/SpeechInputClientImpl.cpp index 147f40e13..09176ee98 100644 --- a/Source/WebKit/chromium/src/SpeechInputClientImpl.cpp +++ b/Source/WebKit/chromium/src/SpeechInputClientImpl.cpp @@ -31,7 +31,6 @@ #include "config.h" #include "SpeechInputClientImpl.h" -#include "PlatformString.h" #include "SecurityOrigin.h" #include "SpeechInputListener.h" #include "WebSecurityOrigin.h" @@ -39,6 +38,7 @@ #include "platform/WebString.h" #include "WebViewClient.h" #include <wtf/PassOwnPtr.h> +#include <wtf/text/WTFString.h> #if ENABLE(INPUT_SPEECH) diff --git a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h index 750cbae5c..312e88b13 100644 --- a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h +++ b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h @@ -26,11 +26,11 @@ #ifndef SpeechRecognitionClientProxy_h #define SpeechRecognitionClientProxy_h -#include "PlatformString.h" #include "SpeechRecognitionClient.h" #include "WebSpeechRecognizerClient.h" #include <wtf/Compiler.h> #include <wtf/PassOwnPtr.h> +#include <wtf/text/WTFString.h> namespace WebKit { diff --git a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp index 1eb69d28f..f559715d9 100644 --- a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp +++ b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp @@ -50,6 +50,7 @@ #include "platform/WebRect.h" #include "platform/WebString.h" #include "platform/WebURL.h" +#include <wtf/text/StringBuilder.h> using namespace WebCore; @@ -95,16 +96,21 @@ int WebAccessibilityObject::axID() const if (isDetached()) return -1; - m_private->updateBackingStore(); return m_private->axObjectID(); } +bool WebAccessibilityObject::updateBackingStoreAndCheckValidity() +{ + if (!isDetached()) + m_private->updateBackingStore(); + return !isDetached(); +} + WebString WebAccessibilityObject::accessibilityDescription() const { if (isDetached()) return WebString(); - m_private->updateBackingStore(); return m_private->accessibilityDescription(); } @@ -113,7 +119,6 @@ WebString WebAccessibilityObject::actionVerb() const if (isDetached()) return WebString(); - m_private->updateBackingStore(); return m_private->actionVerb(); } @@ -122,7 +127,6 @@ bool WebAccessibilityObject::canSetFocusAttribute() const if (isDetached()) return false; - m_private->updateBackingStore(); return m_private->canSetFocusAttribute(); } @@ -131,25 +135,14 @@ bool WebAccessibilityObject::canSetValueAttribute() const if (isDetached()) return false; - m_private->updateBackingStore(); return m_private->canSetValueAttribute(); } -bool WebAccessibilityObject::isValid() const -{ - if (isDetached()) - return false; - - m_private->updateBackingStore(); - return m_private->axObjectID(); -} - unsigned WebAccessibilityObject::childCount() const { if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->children().size(); } @@ -158,7 +151,6 @@ WebAccessibilityObject WebAccessibilityObject::childAt(unsigned index) const if (isDetached()) return WebAccessibilityObject(); - m_private->updateBackingStore(); if (m_private->children().size() <= index) return WebAccessibilityObject(); @@ -170,7 +162,6 @@ WebAccessibilityObject WebAccessibilityObject::firstChild() const if (isDetached()) return WebAccessibilityObject(); - m_private->updateBackingStore(); return WebAccessibilityObject(m_private->firstChild()); } @@ -179,7 +170,6 @@ WebAccessibilityObject WebAccessibilityObject::focusedChild() const if (isDetached()) return WebAccessibilityObject(); - m_private->updateBackingStore(); RefPtr<AccessibilityObject> focused = m_private->focusedUIElement(); if (m_private.get() == focused.get() || m_private.get() == focused->parentObject()) return WebAccessibilityObject(focused); @@ -192,7 +182,6 @@ WebAccessibilityObject WebAccessibilityObject::lastChild() const if (isDetached()) return WebAccessibilityObject(); - m_private->updateBackingStore(); return WebAccessibilityObject(m_private->lastChild()); } @@ -202,7 +191,6 @@ WebAccessibilityObject WebAccessibilityObject::nextSibling() const if (isDetached()) return WebAccessibilityObject(); - m_private->updateBackingStore(); return WebAccessibilityObject(m_private->nextSibling()); } @@ -211,7 +199,6 @@ WebAccessibilityObject WebAccessibilityObject::parentObject() const if (isDetached()) return WebAccessibilityObject(); - m_private->updateBackingStore(); return WebAccessibilityObject(m_private->parentObject()); } @@ -221,7 +208,6 @@ WebAccessibilityObject WebAccessibilityObject::previousSibling() const if (isDetached()) return WebAccessibilityObject(); - m_private->updateBackingStore(); return WebAccessibilityObject(m_private->previousSibling()); } @@ -230,7 +216,6 @@ bool WebAccessibilityObject::canSetSelectedAttribute() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->canSetSelectedAttribute(); } @@ -239,7 +224,6 @@ bool WebAccessibilityObject::isAnchor() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isAnchor(); } @@ -248,7 +232,6 @@ bool WebAccessibilityObject::isAriaReadOnly() const if (isDetached()) return 0; - m_private->updateBackingStore(); return equalIgnoringCase(m_private->getAttribute(HTMLNames::aria_readonlyAttr), "true"); } @@ -257,7 +240,6 @@ bool WebAccessibilityObject::isButtonStateMixed() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->checkboxOrRadioValue() == ButtonStateMixed; } @@ -266,7 +248,6 @@ bool WebAccessibilityObject::isChecked() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isChecked(); } @@ -275,7 +256,6 @@ bool WebAccessibilityObject::isCollapsed() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isCollapsed(); } @@ -284,7 +264,6 @@ bool WebAccessibilityObject::isControl() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isControl(); } @@ -293,7 +272,6 @@ bool WebAccessibilityObject::isEnabled() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isEnabled(); } @@ -302,7 +280,6 @@ bool WebAccessibilityObject::isFocused() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isFocused(); } @@ -311,7 +288,6 @@ bool WebAccessibilityObject::isHovered() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isHovered(); } @@ -320,7 +296,6 @@ bool WebAccessibilityObject::isIndeterminate() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isIndeterminate(); } @@ -329,7 +304,6 @@ bool WebAccessibilityObject::isLinked() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isLinked(); } @@ -338,7 +312,6 @@ bool WebAccessibilityObject::isLoaded() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isLoaded(); } @@ -347,7 +320,6 @@ bool WebAccessibilityObject::isMultiSelectable() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isMultiSelectable(); } @@ -356,7 +328,6 @@ bool WebAccessibilityObject::isOffScreen() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isOffScreen(); } @@ -365,7 +336,6 @@ bool WebAccessibilityObject::isPasswordField() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isPasswordField(); } @@ -374,7 +344,6 @@ bool WebAccessibilityObject::isPressed() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isPressed(); } @@ -383,7 +352,6 @@ bool WebAccessibilityObject::isReadOnly() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isReadOnly(); } @@ -392,7 +360,6 @@ bool WebAccessibilityObject::isRequired() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isRequired(); } @@ -401,7 +368,6 @@ bool WebAccessibilityObject::isSelected() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isSelected(); } @@ -410,7 +376,6 @@ bool WebAccessibilityObject::isSelectedOptionActive() const if (isDetached()) return false; - m_private->updateBackingStore(); return m_private->isSelectedOptionActive(); } @@ -419,7 +384,6 @@ bool WebAccessibilityObject::isVertical() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->orientation() == AccessibilityOrientationVertical; } @@ -428,7 +392,6 @@ bool WebAccessibilityObject::isVisible() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isVisible(); } @@ -437,7 +400,6 @@ bool WebAccessibilityObject::isVisited() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isVisited(); } @@ -446,7 +408,6 @@ WebString WebAccessibilityObject::accessKey() const if (isDetached()) return WebString(); - m_private->updateBackingStore(); return WebString(m_private->accessKey()); } @@ -455,7 +416,6 @@ bool WebAccessibilityObject::ariaHasPopup() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->ariaHasPopup(); } @@ -464,7 +424,6 @@ bool WebAccessibilityObject::ariaLiveRegionAtomic() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->ariaLiveRegionAtomic(); } @@ -473,7 +432,6 @@ bool WebAccessibilityObject::ariaLiveRegionBusy() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->ariaLiveRegionBusy(); } @@ -482,7 +440,6 @@ WebString WebAccessibilityObject::ariaLiveRegionRelevant() const if (isDetached()) return WebString(); - m_private->updateBackingStore(); return m_private->ariaLiveRegionRelevant(); } @@ -491,7 +448,6 @@ WebString WebAccessibilityObject::ariaLiveRegionStatus() const if (isDetached()) return WebString(); - m_private->updateBackingStore(); return m_private->ariaLiveRegionStatus(); } @@ -500,16 +456,22 @@ WebRect WebAccessibilityObject::boundingBoxRect() const if (isDetached()) return WebRect(); - m_private->updateBackingStore(); return m_private->pixelSnappedBoundingBoxRect(); } +bool WebAccessibilityObject::canvasHasFallbackContent() const +{ + if (isDetached()) + return false; + + return m_private->canvasHasFallbackContent(); +} + double WebAccessibilityObject::estimatedLoadingProgress() const { if (isDetached()) return 0.0; - m_private->updateBackingStore(); return m_private->estimatedLoadingProgress(); } @@ -518,7 +480,6 @@ WebString WebAccessibilityObject::helpText() const if (isDetached()) return WebString(); - m_private->updateBackingStore(); return m_private->helpText(); } @@ -527,7 +488,6 @@ int WebAccessibilityObject::headingLevel() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->headingLevel(); } @@ -536,7 +496,6 @@ int WebAccessibilityObject::hierarchicalLevel() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->hierarchicalLevel(); } @@ -545,7 +504,6 @@ WebAccessibilityObject WebAccessibilityObject::hitTest(const WebPoint& point) co if (isDetached()) return WebAccessibilityObject(); - m_private->updateBackingStore(); IntPoint contentsPoint = m_private->documentFrameView()->windowToContents(point); RefPtr<AccessibilityObject> hit = m_private->accessibilityHitTest(contentsPoint); @@ -563,7 +521,6 @@ WebString WebAccessibilityObject::keyboardShortcut() const if (isDetached()) return WebString(); - m_private->updateBackingStore(); String accessKey = m_private->accessKey(); if (accessKey.isNull()) return WebString(); @@ -574,14 +531,16 @@ WebString WebAccessibilityObject::keyboardShortcut() const // Follow the same order as Mozilla MSAA implementation: // Ctrl+Alt+Shift+Meta+key. MSDN states that keyboard shortcut strings // should not be localized and defines the separator as "+". + StringBuilder modifierStringBuilder; if (modifiers & PlatformEvent::CtrlKey) - modifierString += "Ctrl+"; + modifierStringBuilder.appendLiteral("Ctrl+"); if (modifiers & PlatformEvent::AltKey) - modifierString += "Alt+"; + modifierStringBuilder.appendLiteral("Alt+"); if (modifiers & PlatformEvent::ShiftKey) - modifierString += "Shift+"; + modifierStringBuilder.appendLiteral("Shift+"); if (modifiers & PlatformEvent::MetaKey) - modifierString += "Win+"; + modifierStringBuilder.appendLiteral("Win+"); + modifierString = modifierStringBuilder.toString(); } return String(modifierString + accessKey); @@ -594,7 +553,6 @@ bool WebAccessibilityObject::performDefaultAction() const UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); - m_private->updateBackingStore(); return m_private->performDefaultAction(); } @@ -603,7 +561,6 @@ WebAccessibilityRole WebAccessibilityObject::roleValue() const if (isDetached()) return WebKit::WebAccessibilityRoleUnknown; - m_private->updateBackingStore(); return static_cast<WebAccessibilityRole>(m_private->roleValue()); } @@ -612,7 +569,6 @@ unsigned WebAccessibilityObject::selectionEnd() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->selectedTextRange().start + m_private->selectedTextRange().length; } @@ -621,7 +577,6 @@ unsigned WebAccessibilityObject::selectionStart() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->selectedTextRange().start; } @@ -636,7 +591,6 @@ WebString WebAccessibilityObject::stringValue() const if (isDetached()) return WebString(); - m_private->updateBackingStore(); return m_private->stringValue(); } @@ -645,7 +599,6 @@ WebString WebAccessibilityObject::title() const if (isDetached()) return WebString(); - m_private->updateBackingStore(); return m_private->title(); } @@ -654,7 +607,6 @@ WebAccessibilityObject WebAccessibilityObject::titleUIElement() const if (isDetached()) return WebAccessibilityObject(); - m_private->updateBackingStore(); return WebAccessibilityObject(m_private->titleUIElement()); } @@ -663,16 +615,22 @@ WebURL WebAccessibilityObject::url() const if (isDetached()) return WebURL(); - m_private->updateBackingStore(); return m_private->url(); } +bool WebAccessibilityObject::supportsRangeValue() const +{ + if (isDetached()) + return false; + + return m_private->supportsRangeValue(); +} + WebString WebAccessibilityObject::valueDescription() const { if (isDetached()) return WebString(); - m_private->updateBackingStore(); return m_private->valueDescription(); } @@ -681,7 +639,6 @@ float WebAccessibilityObject::valueForRange() const if (isDetached()) return 0.0; - m_private->updateBackingStore(); return m_private->valueForRange(); } @@ -690,7 +647,6 @@ float WebAccessibilityObject::maxValueForRange() const if (isDetached()) return 0.0; - m_private->updateBackingStore(); return m_private->maxValueForRange(); } @@ -699,7 +655,6 @@ float WebAccessibilityObject::minValueForRange() const if (isDetached()) return 0.0; - m_private->updateBackingStore(); return m_private->minValueForRange(); } @@ -708,8 +663,6 @@ WebNode WebAccessibilityObject::node() const if (isDetached()) return WebNode(); - m_private->updateBackingStore(); - Node* node = m_private->node(); if (!node) return WebNode(); @@ -722,8 +675,6 @@ WebDocument WebAccessibilityObject::document() const if (isDetached()) return WebDocument(); - m_private->updateBackingStore(); - Document* document = m_private->document(); if (!document) return WebDocument(); @@ -772,7 +723,6 @@ bool WebAccessibilityObject::accessibilityIsIgnored() const if (isDetached()) return false; - m_private->updateBackingStore(); return m_private->accessibilityIsIgnored(); } @@ -781,7 +731,6 @@ bool WebAccessibilityObject::lineBreaks(WebVector<int>& result) const if (isDetached()) return false; - m_private->updateBackingStore(); int textLength = m_private->textLength(); if (!textLength) return false; @@ -805,7 +754,6 @@ unsigned WebAccessibilityObject::columnCount() const if (isDetached()) return false; - m_private->updateBackingStore(); if (!m_private->isAccessibilityTable()) return 0; @@ -817,7 +765,6 @@ unsigned WebAccessibilityObject::rowCount() const if (isDetached()) return false; - m_private->updateBackingStore(); if (!m_private->isAccessibilityTable()) return 0; @@ -826,7 +773,9 @@ unsigned WebAccessibilityObject::rowCount() const WebAccessibilityObject WebAccessibilityObject::cellForColumnAndRow(unsigned column, unsigned row) const { - m_private->updateBackingStore(); + if (isDetached()) + return WebAccessibilityObject(); + if (!m_private->isAccessibilityTable()) return WebAccessibilityObject(); @@ -836,7 +785,9 @@ WebAccessibilityObject WebAccessibilityObject::cellForColumnAndRow(unsigned colu unsigned WebAccessibilityObject::cellColumnIndex() const { - m_private->updateBackingStore(); + if (isDetached()) + return 0; + if (!m_private->isTableCell()) return 0; @@ -847,7 +798,9 @@ unsigned WebAccessibilityObject::cellColumnIndex() const unsigned WebAccessibilityObject::cellColumnSpan() const { - m_private->updateBackingStore(); + if (isDetached()) + return 0; + if (!m_private->isTableCell()) return 0; @@ -858,7 +811,9 @@ unsigned WebAccessibilityObject::cellColumnSpan() const unsigned WebAccessibilityObject::cellRowIndex() const { - m_private->updateBackingStore(); + if (isDetached()) + return 0; + if (!m_private->isTableCell()) return 0; @@ -869,7 +824,9 @@ unsigned WebAccessibilityObject::cellRowIndex() const unsigned WebAccessibilityObject::cellRowSpan() const { - m_private->updateBackingStore(); + if (isDetached()) + return 0; + if (!m_private->isTableCell()) return 0; @@ -880,20 +837,20 @@ unsigned WebAccessibilityObject::cellRowSpan() const void WebAccessibilityObject::scrollToMakeVisible() const { - m_private->updateBackingStore(); - m_private->scrollToMakeVisible(); + if (!isDetached()) + m_private->scrollToMakeVisible(); } void WebAccessibilityObject::scrollToMakeVisibleWithSubFocus(const WebRect& subfocus) const { - m_private->updateBackingStore(); - m_private->scrollToMakeVisibleWithSubFocus(subfocus); + if (!isDetached()) + m_private->scrollToMakeVisibleWithSubFocus(subfocus); } void WebAccessibilityObject::scrollToGlobalPoint(const WebPoint& point) const { - m_private->updateBackingStore(); - m_private->scrollToGlobalPoint(point); + if (!isDetached()) + m_private->scrollToGlobalPoint(point); } WebAccessibilityObject::WebAccessibilityObject(const WTF::PassRefPtr<WebCore::AccessibilityObject>& object) diff --git a/Source/WebKit/chromium/src/WebAnimationImpl.cpp b/Source/WebKit/chromium/src/WebAnimationImpl.cpp index e5d9ef2a3..b5a94d714 100644 --- a/Source/WebKit/chromium/src/WebAnimationImpl.cpp +++ b/Source/WebKit/chromium/src/WebAnimationImpl.cpp @@ -26,7 +26,6 @@ #include "WebAnimationImpl.h" -#include "AnimationIdVendor.h" #include "CCActiveAnimation.h" #include "CCAnimationCurve.h" #include "WebFloatAnimationCurveImpl.h" @@ -36,23 +35,24 @@ #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> -using WebCore::AnimationIdVendor; using WebCore::CCActiveAnimation; namespace WebKit { -WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, TargetProperty targetProperty) +WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, TargetProperty targetProperty, int animationId) { - return WebAnimation::create(curve, AnimationIdVendor::getNextAnimationId(), AnimationIdVendor::getNextGroupId(), targetProperty); + return new WebAnimationImpl(curve, targetProperty, animationId, 0); } -WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, int animationId, int groupId, TargetProperty targetProperty) +WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& webCurve, TargetProperty targetProperty, int animationId, int groupId) { - return new WebAnimationImpl(curve, animationId, groupId, targetProperty); -} + static int nextAnimationId = 1; + static int nextGroupId = 1; + if (!animationId) + animationId = nextAnimationId++; + if (!groupId) + groupId = nextGroupId++; -WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& webCurve, int animationId, int groupId, TargetProperty targetProperty) -{ WebAnimationCurve::AnimationCurveType curveType = webCurve.type(); OwnPtr<WebCore::CCAnimationCurve> curve; switch (curveType) { @@ -74,6 +74,11 @@ WebAnimationImpl::~WebAnimationImpl() { } +int WebAnimationImpl::id() +{ + return m_animation->id(); +} + WebAnimation::TargetProperty WebAnimationImpl::targetProperty() const { return static_cast<WebAnimationImpl::TargetProperty>(m_animation->targetProperty()); diff --git a/Source/WebKit/chromium/src/WebAnimationImpl.h b/Source/WebKit/chromium/src/WebAnimationImpl.h index d7ceba51f..ccf451786 100644 --- a/Source/WebKit/chromium/src/WebAnimationImpl.h +++ b/Source/WebKit/chromium/src/WebAnimationImpl.h @@ -37,10 +37,11 @@ namespace WebKit { class WebAnimationImpl : public WebAnimation { public: - WebAnimationImpl(const WebAnimationCurve&, int animationId, int groupId, TargetProperty); + WebAnimationImpl(const WebAnimationCurve&, TargetProperty, int animationId, int groupId = 0); virtual ~WebAnimationImpl(); // WebAnimation implementation + virtual int id() OVERRIDE; virtual TargetProperty targetProperty() const OVERRIDE; virtual int iterations() const OVERRIDE; virtual void setIterations(int) OVERRIDE; diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp index 8084d715c..16222ac4f 100644 --- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp +++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp @@ -27,63 +27,16 @@ #include "WebCompositorInputHandlerImpl.h" -#include "CCActiveGestureAnimation.h" -#include "CCProxy.h" +#include "PlatformGestureCurveFactory.h" #include "PlatformGestureCurveTarget.h" -#include "TouchpadFlingPlatformGestureCurve.h" #include "TraceEvent.h" -#include "WebCompositorImpl.h" #include "WebCompositorInputHandlerClient.h" #include "WebInputEvent.h" +#include <public/WebInputHandlerClient.h> #include <wtf/ThreadingPrimitives.h> using namespace WebCore; -namespace WebCore { - -PassOwnPtr<CCInputHandler> CCInputHandler::create(CCInputHandlerClient* inputHandlerClient) -{ - return WebKit::WebCompositorInputHandlerImpl::create(inputHandlerClient); -} - -class PlatformGestureToCCGestureAdapter : public CCGestureCurve, public PlatformGestureCurveTarget { -public: - static PassOwnPtr<CCGestureCurve> create(PassOwnPtr<PlatformGestureCurve> platformCurve) - { - return adoptPtr(new PlatformGestureToCCGestureAdapter(platformCurve)); - } - - virtual const char* debugName() const - { - return m_curve->debugName(); - } - - virtual bool apply(double time, CCGestureCurveTarget* target) - { - ASSERT(target); - m_target = target; - return m_curve->apply(time, this); - } - - virtual void scrollBy(const IntPoint& scrollDelta) - { - ASSERT(m_target); - m_target->scrollBy(scrollDelta); - } - -private: - PlatformGestureToCCGestureAdapter(PassOwnPtr<PlatformGestureCurve> curve) - : m_curve(curve) - , m_target(0) - { - } - - OwnPtr<PlatformGestureCurve> m_curve; - CCGestureCurveTarget* m_target; -}; - -} - namespace WebKit { // These statics may only be accessed from the compositor thread. @@ -95,15 +48,8 @@ WebCompositorInputHandler* WebCompositorInputHandler::fromIdentifier(int identif return WebCompositorInputHandlerImpl::fromIdentifier(identifier); } -PassOwnPtr<WebCompositorInputHandlerImpl> WebCompositorInputHandlerImpl::create(WebCore::CCInputHandlerClient* inputHandlerClient) -{ - return adoptPtr(new WebCompositorInputHandlerImpl(inputHandlerClient)); -} - WebCompositorInputHandler* WebCompositorInputHandlerImpl::fromIdentifier(int identifier) { - ASSERT(WebCompositorImpl::initialized()); - ASSERT(CCProxy::isImplThread()); if (!s_compositors) return 0; @@ -115,26 +61,20 @@ WebCompositorInputHandler* WebCompositorInputHandlerImpl::fromIdentifier(int ide return 0; } -WebCompositorInputHandlerImpl::WebCompositorInputHandlerImpl(CCInputHandlerClient* inputHandlerClient) +WebCompositorInputHandlerImpl::WebCompositorInputHandlerImpl() : m_client(0) , m_identifier(s_nextAvailableIdentifier++) - , m_inputHandlerClient(inputHandlerClient) + , m_inputHandlerClient(0) #ifndef NDEBUG , m_expectScrollUpdateEnd(false) , m_expectPinchUpdateEnd(false) #endif , m_gestureScrollStarted(false) { - ASSERT(CCProxy::isImplThread()); - - if (!s_compositors) - s_compositors = new HashSet<WebCompositorInputHandlerImpl*>; - s_compositors->add(this); } WebCompositorInputHandlerImpl::~WebCompositorInputHandlerImpl() { - ASSERT(CCProxy::isImplThread()); if (m_client) m_client->willShutdown(); @@ -148,7 +88,6 @@ WebCompositorInputHandlerImpl::~WebCompositorInputHandlerImpl() void WebCompositorInputHandlerImpl::setClient(WebCompositorInputHandlerClient* client) { - ASSERT(CCProxy::isImplThread()); // It's valid to set a new client if we've never had one or to clear the client, but it's not valid to change from having one client to a different one. ASSERT(!m_client || !client); m_client = client; @@ -156,7 +95,6 @@ void WebCompositorInputHandlerImpl::setClient(WebCompositorInputHandlerClient* c void WebCompositorInputHandlerImpl::handleInputEvent(const WebInputEvent& event) { - ASSERT(CCProxy::isImplThread()); ASSERT(m_client); WebCompositorInputHandlerImpl::EventDisposition disposition = handleInputEventInternal(event); @@ -177,19 +115,19 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h { if (event.type == WebInputEvent::MouseWheel) { const WebMouseWheelEvent& wheelEvent = *static_cast<const WebMouseWheelEvent*>(&event); - CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(wheelEvent.x, wheelEvent.y), CCInputHandlerClient::Wheel); + WebInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(WebPoint(wheelEvent.x, wheelEvent.y), WebInputHandlerClient::ScrollInputTypeWheel); switch (scrollStatus) { - case CCInputHandlerClient::ScrollStarted: { + case WebInputHandlerClient::ScrollStatusStarted: { TRACE_EVENT_INSTANT2("cc", "WebCompositorInputHandlerImpl::handleInput wheel scroll", "deltaX", -wheelEvent.deltaX, "deltaY", -wheelEvent.deltaY); - m_inputHandlerClient->scrollBy(IntPoint(wheelEvent.x, wheelEvent.y), IntSize(-wheelEvent.deltaX, -wheelEvent.deltaY)); + m_inputHandlerClient->scrollBy(WebPoint(wheelEvent.x, wheelEvent.y), IntSize(-wheelEvent.deltaX, -wheelEvent.deltaY)); m_inputHandlerClient->scrollEnd(); return DidHandle; } - case CCInputHandlerClient::ScrollIgnored: + case WebInputHandlerClient::ScrollStatusIgnored: // FIXME: This should be DropEvent, but in cases where we fail to properly sync scrollability it's safer to send the // event to the main thread. Change back to DropEvent once we have synchronization bugs sorted out. return DidNotHandle; - case CCInputHandlerClient::ScrollOnMainThread: + case WebInputHandlerClient::ScrollStatusOnMainThread: return DidNotHandle; } } else if (event.type == WebInputEvent::GestureScrollBegin) { @@ -199,14 +137,14 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h m_expectScrollUpdateEnd = true; #endif const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event); - CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(gestureEvent.x, gestureEvent.y), CCInputHandlerClient::Gesture); + WebInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(WebPoint(gestureEvent.x, gestureEvent.y), WebInputHandlerClient::ScrollInputTypeGesture); switch (scrollStatus) { - case CCInputHandlerClient::ScrollStarted: + case WebInputHandlerClient::ScrollStatusStarted: m_gestureScrollStarted = true; return DidHandle; - case CCInputHandlerClient::ScrollOnMainThread: + case WebInputHandlerClient::ScrollStatusOnMainThread: return DidNotHandle; - case CCInputHandlerClient::ScrollIgnored: + case WebInputHandlerClient::ScrollStatusIgnored: return DropEvent; } } else if (event.type == WebInputEvent::GestureScrollUpdate) { @@ -216,7 +154,8 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h return DidNotHandle; const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event); - m_inputHandlerClient->scrollBy(IntPoint(gestureEvent.x, gestureEvent.y), IntSize(-gestureEvent.deltaX, -gestureEvent.deltaY)); + m_inputHandlerClient->scrollBy(WebPoint(gestureEvent.x, gestureEvent.y), + IntSize(-gestureEvent.data.scrollUpdate.deltaX, -gestureEvent.data.scrollUpdate.deltaY)); return DidHandle; } else if (event.type == WebInputEvent::GestureScrollEnd) { ASSERT(m_expectScrollUpdateEnd); @@ -246,7 +185,7 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h } else if (event.type == WebInputEvent::GesturePinchUpdate) { ASSERT(m_expectPinchUpdateEnd); const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event); - m_inputHandlerClient->pinchGestureUpdate(gestureEvent.deltaX, IntPoint(gestureEvent.x, gestureEvent.y)); + m_inputHandlerClient->pinchGestureUpdate(gestureEvent.data.pinchUpdate.scale, WebPoint(gestureEvent.x, gestureEvent.y)); return DidHandle; } else if (event.type == WebInputEvent::GestureFlingStart) { const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event); @@ -263,24 +202,24 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::handleGestureFling(const WebGestureEvent& gestureEvent) { - CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(gestureEvent.x, gestureEvent.y), CCInputHandlerClient::Gesture); + WebInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(WebPoint(gestureEvent.x, gestureEvent.y), WebInputHandlerClient::ScrollInputTypeGesture); switch (scrollStatus) { - case CCInputHandlerClient::ScrollStarted: { - TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::handleGestureFling::started"); - OwnPtr<PlatformGestureCurve> flingCurve = TouchpadFlingPlatformGestureCurve::create(FloatPoint(gestureEvent.deltaX, gestureEvent.deltaY)); - m_wheelFlingAnimation = CCActiveGestureAnimation::create(PlatformGestureToCCGestureAdapter::create(flingCurve.release()), this); - m_wheelFlingParameters.delta = WebFloatPoint(gestureEvent.deltaX, gestureEvent.deltaY); + case WebInputHandlerClient::ScrollStatusStarted: { + m_wheelFlingCurve = PlatformGestureCurveFactory::get()->createCurve(gestureEvent.data.flingStart.sourceDevice, FloatPoint(gestureEvent.data.flingStart.velocityX, gestureEvent.data.flingStart.velocityY)); + TRACE_EVENT_ASYNC_BEGIN1("cc", "WebCompositorInputHandlerImpl::handleGestureFling::started", this, "curve", m_wheelFlingCurve->debugName()); + m_wheelFlingParameters.delta = WebFloatPoint(gestureEvent.data.flingStart.velocityX, gestureEvent.data.flingStart.velocityY); m_wheelFlingParameters.point = WebPoint(gestureEvent.x, gestureEvent.y); m_wheelFlingParameters.globalPoint = WebPoint(gestureEvent.globalX, gestureEvent.globalY); m_wheelFlingParameters.modifiers = gestureEvent.modifiers; + m_wheelFlingParameters.sourceDevice = gestureEvent.data.flingStart.sourceDevice; m_inputHandlerClient->scheduleAnimation(); return DidHandle; } - case CCInputHandlerClient::ScrollOnMainThread: { + case WebInputHandlerClient::ScrollStatusOnMainThread: { TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::handleGestureFling::scrollOnMainThread"); return DidNotHandle; } - case CCInputHandlerClient::ScrollIgnored: { + case WebInputHandlerClient::ScrollStatusIgnored: { TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::handleGestureFling::ignored"); // We still pass the curve to the main thread if there's nothing scrollable, in case something // registers a handler before the curve is over. @@ -290,21 +229,30 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h return DidNotHandle; } -int WebCompositorInputHandlerImpl::identifier() const +void WebCompositorInputHandlerImpl::bindToClient(WebInputHandlerClient* client) { - ASSERT(CCProxy::isImplThread()); - return m_identifier; + ASSERT(!m_inputHandlerClient); + + TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::bindToClient"); + if (!s_compositors) + s_compositors = new HashSet<WebCompositorInputHandlerImpl*>; + s_compositors->add(this); + + m_inputHandlerClient = client; } void WebCompositorInputHandlerImpl::animate(double monotonicTime) { - if (!m_wheelFlingAnimation) + if (!m_wheelFlingCurve) return; - if (!m_wheelFlingParameters.startTime) + if (!m_wheelFlingParameters.startTime) { m_wheelFlingParameters.startTime = monotonicTime; + m_inputHandlerClient->scheduleAnimation(); + return; + } - if (m_wheelFlingAnimation->animate(monotonicTime)) + if (m_wheelFlingCurve->apply(monotonicTime - m_wheelFlingParameters.startTime, this)) m_inputHandlerClient->scheduleAnimation(); else { TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::animate::flingOver"); @@ -314,9 +262,12 @@ void WebCompositorInputHandlerImpl::animate(double monotonicTime) bool WebCompositorInputHandlerImpl::cancelCurrentFling() { - bool hadFlingAnimation = m_wheelFlingAnimation; + bool hadFlingAnimation = m_wheelFlingCurve; + if (hadFlingAnimation) + TRACE_EVENT_ASYNC_END0("cc", "WebCompositorInputHandlerImpl::handleGestureFling::started", this); + TRACE_EVENT_INSTANT1("cc", "WebCompositorInputHandlerImpl::cancelCurrentFling", "hadFlingAnimation", hadFlingAnimation); - m_wheelFlingAnimation.clear(); + m_wheelFlingCurve.clear(); m_wheelFlingParameters = WebActiveWheelFlingParameters(); return hadFlingAnimation; } diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h index 9474b2193..fa81de945 100644 --- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h +++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h @@ -26,12 +26,11 @@ #ifndef WebCompositorInputHandlerImpl_h #define WebCompositorInputHandlerImpl_h -#include "CCGestureCurve.h" -#include "CCInputHandler.h" +#include "PlatformGestureCurveTarget.h" #include "WebActiveWheelFlingParameters.h" #include "WebCompositorInputHandler.h" #include "WebInputEvent.h" -#include <public/WebCompositor.h> +#include <public/WebInputHandler.h> #include <wtf/HashSet.h> #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> @@ -42,36 +41,35 @@ class Mutex; namespace WebCore { class IntPoint; -class CCGestureCurveTarget; -class CCInputHandlerClient; -class CCThread; +class PlatformGestureCurve; } namespace WebKit { class WebCompositorInputHandlerClient; -class WebCompositorInputHandlerImpl : public WebCompositorInputHandler, public WebCore::CCInputHandler, public WebCore::CCGestureCurveTarget { +class WebCompositorInputHandlerImpl : public WebCompositorInputHandler, public WebInputHandler, public WebCore::PlatformGestureCurveTarget { WTF_MAKE_NONCOPYABLE(WebCompositorInputHandlerImpl); public: - static PassOwnPtr<WebCompositorInputHandlerImpl> create(WebCore::CCInputHandlerClient*); static WebCompositorInputHandler* fromIdentifier(int identifier); + WebCompositorInputHandlerImpl(); virtual ~WebCompositorInputHandlerImpl(); // WebCompositorInputHandler implementation. virtual void setClient(WebCompositorInputHandlerClient*); virtual void handleInputEvent(const WebInputEvent&); - // WebCore::CCInputHandler implementation. - virtual int identifier() const; + // WebInputHandler implementation. + virtual void bindToClient(WebInputHandlerClient*); virtual void animate(double monotonicTime); - // WebCore::CCGestureCurveTarget implementation. + // WebCore::PlatformGestureCurveTarget implementation. virtual void scrollBy(const WebCore::IntPoint&); + int identifier() const { return m_identifier; } + private: - explicit WebCompositorInputHandlerImpl(WebCore::CCInputHandlerClient*); enum EventDisposition { DidHandle, DidNotHandle, DropEvent }; // This function processes the input event and determines the disposition, but does not make @@ -83,13 +81,13 @@ private: // Returns true if we actually had an active fling to cancel. bool cancelCurrentFling(); - OwnPtr<WebCore::CCActiveGestureAnimation> m_wheelFlingAnimation; + OwnPtr<WebCore::PlatformGestureCurve> m_wheelFlingCurve; // Parameters for the active fling animation, stored in case we need to transfer it out later. WebActiveWheelFlingParameters m_wheelFlingParameters; WebCompositorInputHandlerClient* m_client; int m_identifier; - WebCore::CCInputHandlerClient* m_inputHandlerClient; + WebInputHandlerClient* m_inputHandlerClient; #ifndef NDEBUG bool m_expectScrollUpdateEnd; diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp index fa21e8974..862b19be6 100644 --- a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "WebContentLayerImpl.h" +#include "ContentLayerChromium.h" #include "SkMatrix44.h" #include <public/WebContentLayerClient.h> #include <public/WebFloatPoint.h> @@ -43,40 +44,45 @@ WebContentLayer* WebContentLayer::create(WebContentLayerClient* client) } WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* client) - : m_webLayerImpl(adoptPtr(new WebLayerImpl(ContentLayerChromium::create(this)))) + : m_layer(adoptPtr(new WebLayerImpl(ContentLayerChromium::create(this)))) , m_client(client) { - m_webLayerImpl->layer()->setIsDrawable(true); + m_layer->layer()->setIsDrawable(true); } WebContentLayerImpl::~WebContentLayerImpl() { - static_cast<ContentLayerChromium*>(m_webLayerImpl->layer())->clearDelegate(); + static_cast<ContentLayerChromium*>(m_layer->layer())->clearClient(); } WebLayer* WebContentLayerImpl::layer() { - return m_webLayerImpl.get(); + return m_layer.get(); } void WebContentLayerImpl::setDoubleSided(bool doubleSided) { - m_webLayerImpl->layer()->setDoubleSided(doubleSided); + m_layer->layer()->setDoubleSided(doubleSided); } -void WebContentLayerImpl::setContentsScale(float scale) +void WebContentLayerImpl::setBoundsContainPageScale(bool boundsContainPageScale) { - m_webLayerImpl->layer()->setContentsScale(scale); + return m_layer->layer()->setBoundsContainPageScale(boundsContainPageScale); +} + +bool WebContentLayerImpl::boundsContainPageScale() const +{ + return m_layer->layer()->boundsContainPageScale(); } void WebContentLayerImpl::setUseLCDText(bool enable) { - m_webLayerImpl->layer()->setUseLCDText(enable); + m_layer->layer()->setUseLCDText(enable); } void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) { - m_webLayerImpl->layer()->setDrawCheckerboardForMissingTiles(enable); + m_layer->layer()->setDrawCheckerboardForMissingTiles(enable); } diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.h b/Source/WebKit/chromium/src/WebContentLayerImpl.h index 511f8e0ba..45fa79b0e 100644 --- a/Source/WebKit/chromium/src/WebContentLayerImpl.h +++ b/Source/WebKit/chromium/src/WebContentLayerImpl.h @@ -26,33 +26,34 @@ #ifndef WebContentLayerImpl_h #define WebContentLayerImpl_h -#include "ContentLayerChromium.h" +#include "ContentLayerChromiumClient.h" #include "WebLayerImpl.h" #include <public/WebContentLayer.h> -#include <wtf/PassRefPtr.h> +#include <wtf/OwnPtr.h> namespace WebKit { class WebContentLayerClient; class WebContentLayerImpl : public WebContentLayer, - public WebCore::ContentLayerDelegate { + public WebCore::ContentLayerChromiumClient { public: explicit WebContentLayerImpl(WebContentLayerClient*); // WebContentLayer implementation. virtual WebLayer* layer() OVERRIDE; virtual void setDoubleSided(bool) OVERRIDE; - virtual void setContentsScale(float) OVERRIDE; + virtual void setBoundsContainPageScale(bool) OVERRIDE; + virtual bool boundsContainPageScale() const OVERRIDE; virtual void setUseLCDText(bool) OVERRIDE; virtual void setDrawCheckerboardForMissingTiles(bool) OVERRIDE; protected: virtual ~WebContentLayerImpl(); - // ContentLayerDelegate implementation. + // ContentLayerChromiumClient implementation. virtual void paintContents(SkCanvas*, const WebCore::IntRect& clip, WebCore::FloatRect& opaque) OVERRIDE; - OwnPtr<WebLayerImpl> m_webLayerImpl; + OwnPtr<WebLayerImpl> m_layer; WebContentLayerClient* m_client; bool m_drawsContent; }; diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index c639f674d..a0a75b48c 100644 --- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -45,7 +45,6 @@ #include "PageGroup.h" #include "PageScriptDebugServer.h" #include "painting/GraphicsContextBuilder.h" -#include "PlatformString.h" #include "RenderView.h" #include "ResourceError.h" #include "ResourceRequest.h" @@ -67,6 +66,7 @@ #include <wtf/MathExtras.h> #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> +#include <wtf/text/WTFString.h> using namespace WebCore; using namespace std; diff --git a/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp index 800568a61..f723390b5 100644 --- a/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp +++ b/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp @@ -43,7 +43,6 @@ #include "Node.h" #include "Page.h" #include "Pasteboard.h" -#include "PlatformString.h" #include "ScriptController.h" #include "SecurityOrigin.h" #include "Settings.h" @@ -59,6 +58,7 @@ #include "WebViewImpl.h" #include <wtf/OwnPtr.h> #include <wtf/Vector.h> +#include <wtf/text/WTFString.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.h b/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.h index a5dca3074..4030da7b3 100644 --- a/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.h +++ b/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.h @@ -31,11 +31,11 @@ #ifndef WebDevToolsFrontendImpl_h #define WebDevToolsFrontendImpl_h -#include "PlatformString.h" #include "WebDevToolsFrontend.h" #include <wtf/Forward.h> #include <wtf/Noncopyable.h> #include <wtf/Vector.h> +#include <wtf/text/WTFString.h> namespace WebKit { diff --git a/Source/WebKit/chromium/src/WebEntities.h b/Source/WebKit/chromium/src/WebEntities.h index f21056664..68a434367 100644 --- a/Source/WebKit/chromium/src/WebEntities.h +++ b/Source/WebKit/chromium/src/WebEntities.h @@ -31,8 +31,8 @@ #ifndef WebEntities_h #define WebEntities_h -#include "PlatformString.h" #include <wtf/HashMap.h> +#include <wtf/text/WTFString.h> namespace WebKit { diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h index 5348895bf..6c03c2342 100644 --- a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h +++ b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h @@ -26,7 +26,7 @@ #ifndef WebExternalTextureLayerImpl_h #define WebExternalTextureLayerImpl_h -#include "TextureLayerChromium.h" +#include "TextureLayerChromiumClient.h" #include <public/WebExternalTextureLayer.h> namespace WebKit { diff --git a/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.cpp b/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.cpp index 9f5665cb8..4349f84e2 100644 --- a/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.cpp +++ b/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.cpp @@ -37,11 +37,11 @@ namespace WebKit { WebFloatAnimationCurve* WebFloatAnimationCurve::create() { - return new WebFloatAnimationCurveImpl(WebCore::CCKeyframedFloatAnimationCurve::create()); + return new WebFloatAnimationCurveImpl(); } -WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl(PassOwnPtr<WebCore::CCKeyframedFloatAnimationCurve> curve) - : m_curve(curve) +WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl() + : m_curve(WebCore::CCKeyframedFloatAnimationCurve::create()) { } diff --git a/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.h b/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.h index e8f1620d6..12ca3c66e 100644 --- a/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.h +++ b/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.h @@ -38,7 +38,7 @@ namespace WebKit { class WebFloatAnimationCurveImpl : public WebFloatAnimationCurve { public: - explicit WebFloatAnimationCurveImpl(PassOwnPtr<WebCore::CCKeyframedFloatAnimationCurve>); + WebFloatAnimationCurveImpl(); virtual ~WebFloatAnimationCurveImpl(); // WebAnimationCurve implementation. diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index 4279febe0..4395c6d70 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -170,6 +170,7 @@ #include "WebSecurityOrigin.h" #include "WebViewImpl.h" #include "XPathResult.h" +#include "htmlediting.h" #include "markup.h" #include "painting/GraphicsContextBuilder.h" #include "platform/WebFloatPoint.h" @@ -1190,6 +1191,11 @@ bool WebFrameImpl::isProcessingUserGesture() const return ScriptController::processingUserGesture(); } +bool WebFrameImpl::consumeUserGesture() const +{ + return UserGestureIndicator::consumeUserGesture(); +} + bool WebFrameImpl::willSuppressOpenerInNewFrame() const { return frame()->loader()->suppressOpenerInNewFrame(); @@ -1257,7 +1263,7 @@ size_t WebFrameImpl::characterIndexForPoint(const WebPoint& webPoint) const return notFound; IntPoint point = frame()->view()->windowToContents(webPoint); - HitTestResult result = frame()->eventHandler()->hitTestResultAtPoint(point, false); + HitTestResult result = frame()->eventHandler()->hitTestResultAtPoint(point); RefPtr<Range> range = frame()->rangeForPoint(result.roundedPoint()); if (!range) return notFound; @@ -1460,24 +1466,69 @@ bool WebFrameImpl::selectWordAroundCaret() void WebFrameImpl::selectRange(const WebPoint& start, const WebPoint& end) { - VisiblePosition startPosition = visiblePositionForWindowPoint(start); - VisiblePosition endPosition = visiblePositionForWindowPoint(end); + if (start == end && moveCaret(start)) + return; - // To correctly handle editable boundaries, we adjust the selection by setting its extent - // while keeping its base fixed. For a touch-based UI, this means that moving the selection - // handles behaves like a drag-select with the mouse, which is what we want here. If both - // endpoints changed, we need to set the extent twice. - // FIXME: the WebFrame::SelectRange API should explicitly state which endpoint is moving. - VisibleSelection newSelection = frame()->selection()->selection(); - if (startPosition != newSelection.visibleStart()) - newSelection = VisibleSelection(newSelection.visibleEnd(), startPosition); - if (endPosition != newSelection.visibleEnd()) - newSelection = VisibleSelection(newSelection.visibleStart(), endPosition); + if (moveSelectionStart(start, true) && moveSelectionEnd(end, true)) + return; + // Failed to move endpoints, probably because there's no current selection. + // Just set the selection explicitly (but this won't handle editable boundaries correctly). + VisibleSelection newSelection(visiblePositionForWindowPoint(start), visiblePositionForWindowPoint(end)); if (frame()->selection()->shouldChangeSelection(newSelection)) frame()->selection()->setSelection(newSelection, CharacterGranularity); } +bool WebFrameImpl::moveSelectionStart(const WebPoint& point, bool allowCollapsedSelection) +{ + const VisibleSelection& selection = frame()->selection()->selection(); + if (selection.isNone()) + return false; + + VisiblePosition start = visiblePositionForWindowPoint(point); + if (!allowCollapsedSelection) { + VisiblePosition maxStart = selection.visibleEnd().previous(); + if (comparePositions(start, maxStart) > 0) + start = maxStart; + } + + // start is moving, so base=end, extent=start + VisibleSelection newSelection = VisibleSelection(selection.visibleEnd(), start); + frame()->selection()->setNonDirectionalSelectionIfNeeded(newSelection, CharacterGranularity); + return true; +} + +bool WebFrameImpl::moveSelectionEnd(const WebPoint& point, bool allowCollapsedSelection) +{ + const VisibleSelection& selection = frame()->selection()->selection(); + if (selection.isNone()) + return false; + + VisiblePosition end = visiblePositionForWindowPoint(point); + if (!allowCollapsedSelection) { + VisiblePosition minEnd = selection.visibleStart().next(); + if (comparePositions(end, minEnd) < 0) + end = minEnd; + } + + // end is moving, so base=start, extent=end + VisibleSelection newSelection = VisibleSelection(selection.visibleStart(), end); + frame()->selection()->setNonDirectionalSelectionIfNeeded(newSelection, CharacterGranularity); + return true; +} + +bool WebFrameImpl::moveCaret(const WebPoint& point) +{ + FrameSelection* frameSelection = frame()->selection(); + if (frameSelection->isNone() || !frameSelection->isContentEditable()) + return false; + + VisiblePosition pos = visiblePositionForWindowPoint(point); + frameSelection->setExtent(pos, UserTriggered); + frameSelection->setBase(frameSelection->extent(), UserTriggered); + return true; +} + void WebFrameImpl::selectRange(const WebRange& webRange) { RefPtr<Range> range = static_cast<PassRefPtr<Range> >(webRange); diff --git a/Source/WebKit/chromium/src/WebFrameImpl.h b/Source/WebKit/chromium/src/WebFrameImpl.h index 20c5fe9d3..e59c932c5 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.h +++ b/Source/WebKit/chromium/src/WebFrameImpl.h @@ -36,10 +36,10 @@ #include "Frame.h" #include "FrameLoaderClientImpl.h" -#include "PlatformString.h" #include <wtf/Compiler.h> #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> +#include <wtf/text/WTFString.h> namespace WebCore { class GraphicsContext; @@ -162,6 +162,7 @@ public: virtual void commitDocumentData(const char* data, size_t length); virtual unsigned unloadListenerCount() const; virtual bool isProcessingUserGesture() const; + virtual bool consumeUserGesture() const; virtual bool willSuppressOpenerInNewFrame() const; virtual void replaceSelection(const WebString&); virtual void insertText(const WebString&); @@ -185,6 +186,9 @@ public: virtual bool selectWordAroundCaret(); virtual void selectRange(const WebPoint& start, const WebPoint& end); virtual void selectRange(const WebRange&); + virtual bool moveSelectionStart(const WebPoint&, bool allowCollapsedSelection); + virtual bool moveSelectionEnd(const WebPoint&, bool allowCollapsedSelection); + virtual bool moveCaret(const WebPoint&); virtual int printBegin(const WebPrintParams&, const WebNode& constrainToNode, bool* useBrowserOverlays); diff --git a/Source/WebKit/chromium/src/WebIDBKey.cpp b/Source/WebKit/chromium/src/WebIDBKey.cpp index cfadafbac..d60b5f5c1 100644 --- a/Source/WebKit/chromium/src/WebIDBKey.cpp +++ b/Source/WebKit/chromium/src/WebIDBKey.cpp @@ -32,10 +32,6 @@ #include "IDBBindingUtilities.h" #include "IDBKey.h" -#include "IDBKeyPath.h" -#include "SerializedScriptValue.h" -#include "WebIDBKeyPath.h" -#include "platform/WebSerializedScriptValue.h" using namespace WebCore; @@ -83,19 +79,6 @@ WebIDBKey WebIDBKey::createNull() return key; } -WebIDBKey WebIDBKey::createFromValueAndKeyPath(const WebSerializedScriptValue& serializedScriptValue, const WebIDBKeyPath& idbKeyPath) -{ - // FIXME: If key path is empty string, this should return invalid key instead - if (serializedScriptValue.isNull()) - return WebIDBKey::createNull(); - return createIDBKeyFromSerializedValueAndKeyPath(serializedScriptValue, idbKeyPath); -} - -WebSerializedScriptValue WebIDBKey::injectIDBKeyIntoSerializedValue(const WebIDBKey& key, const WebSerializedScriptValue& value, const WebIDBKeyPath& path) -{ - return WebCore::injectIDBKeyIntoSerializedValue(key, value, path); -} - void WebIDBKey::assign(const WebIDBKey& value) { m_private = value.m_private; diff --git a/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp b/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp index bab70c61d..d2df09045 100644 --- a/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp @@ -35,14 +35,13 @@ namespace WebKit { WebIOSurfaceLayer* WebIOSurfaceLayer::create() { - RefPtr<IOSurfaceLayerChromium> layer = IOSurfaceLayerChromium::create(); - layer->setIsDrawable(true); - return new WebIOSurfaceLayerImpl(layer.release()); + return new WebIOSurfaceLayerImpl(); } -WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl(PassRefPtr<IOSurfaceLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl() + : m_layer(adoptPtr(new WebLayerImpl(IOSurfaceLayerChromium::create()))) { + m_layer->layer()->setIsDrawable(true); } WebIOSurfaceLayerImpl::~WebIOSurfaceLayerImpl() diff --git a/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h b/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h index 3dbb02759..7aaeb02c1 100644 --- a/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h +++ b/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h @@ -29,15 +29,11 @@ #include <public/WebIOSurfaceLayer.h> #include <wtf/OwnPtr.h> -namespace WebCore { -class IOSurfaceLayerChromium; -} - namespace WebKit { class WebIOSurfaceLayerImpl : public WebIOSurfaceLayer { public: - explicit WebIOSurfaceLayerImpl(PassRefPtr<WebCore::IOSurfaceLayerChromium>); + WebIOSurfaceLayerImpl(); virtual ~WebIOSurfaceLayerImpl(); // WebIOSurfaceLayer implementation. diff --git a/Source/WebKit/chromium/src/WebImageLayerImpl.cpp b/Source/WebKit/chromium/src/WebImageLayerImpl.cpp index d93af8045..7038e3550 100644 --- a/Source/WebKit/chromium/src/WebImageLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebImageLayerImpl.cpp @@ -35,11 +35,11 @@ namespace WebKit { WebImageLayer* WebImageLayer::create() { - return new WebImageLayerImpl(WebCore::ImageLayerChromium::create()); + return new WebImageLayerImpl(); } -WebImageLayerImpl::WebImageLayerImpl(PassRefPtr<WebCore::ImageLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +WebImageLayerImpl::WebImageLayerImpl() + : m_layer(adoptPtr(new WebLayerImpl(ImageLayerChromium::create()))) { } diff --git a/Source/WebKit/chromium/src/WebImageLayerImpl.h b/Source/WebKit/chromium/src/WebImageLayerImpl.h index 9a4b8b3eb..feea60b9c 100644 --- a/Source/WebKit/chromium/src/WebImageLayerImpl.h +++ b/Source/WebKit/chromium/src/WebImageLayerImpl.h @@ -38,7 +38,7 @@ class WebLayerImpl; class WebImageLayerImpl : public WebImageLayer { public: - explicit WebImageLayerImpl(PassRefPtr<WebCore::ImageLayerChromium>); + WebImageLayerImpl(); virtual ~WebImageLayerImpl(); // WebImageLayer implementation. diff --git a/Source/WebKit/chromium/src/WebInputEvent.cpp b/Source/WebKit/chromium/src/WebInputEvent.cpp index d61eb2d31..96123c62e 100644 --- a/Source/WebKit/chromium/src/WebInputEvent.cpp +++ b/Source/WebKit/chromium/src/WebInputEvent.cpp @@ -202,4 +202,41 @@ void WebKeyboardEvent::setKeyIdentifierFromWindowsKeyCode() snprintf(keyIdentifier, sizeof(keyIdentifier), "U+%04X", toupper(windowsKeyCode)); } +// static +int WebKeyboardEvent::windowsKeyCodeWithoutLocation(int keycode) +{ + switch (keycode) { + case VK_LCONTROL: + case VK_RCONTROL: + return VK_CONTROL; + case VK_LSHIFT: + case VK_RSHIFT: + return VK_SHIFT; + case VK_LMENU: + case VK_RMENU: + return VK_MENU; + default: + return keycode; + } +} + +// static +int WebKeyboardEvent::locationModifiersFromWindowsKeyCode(int keycode) +{ + switch (keycode) { + case VK_LCONTROL: + case VK_LSHIFT: + case VK_LMENU: + case VK_LWIN: + return IsLeft; + case VK_RCONTROL: + case VK_RSHIFT: + case VK_RMENU: + case VK_RWIN: + return IsRight; + default: + return 0; + } +} + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebInputEventConversion.cpp b/Source/WebKit/chromium/src/WebInputEventConversion.cpp index 0391c285b..2afc7dcfe 100644 --- a/Source/WebKit/chromium/src/WebInputEventConversion.cpp +++ b/Source/WebKit/chromium/src/WebInputEventConversion.cpp @@ -149,10 +149,14 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W break; case WebInputEvent::GestureScrollUpdate: m_type = PlatformEvent::GestureScrollUpdate; + m_deltaX = e.data.scrollUpdate.deltaX; + m_deltaY = e.data.scrollUpdate.deltaY; break; case WebInputEvent::GestureTap: m_type = PlatformEvent::GestureTap; - m_area = IntSize(e.boundingBox.width, e.boundingBox.height); + m_area = IntSize(e.data.tap.width, e.data.tap.height); + // FIXME: PlatformGestureEvent deltaX is overloaded - wkb.ug/93123 + m_deltaX = static_cast<int>(e.data.tap.tapCount); break; case WebInputEvent::GestureTapDown: m_type = PlatformEvent::GestureTapDown; @@ -165,7 +169,7 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W break; case WebInputEvent::GestureLongPress: m_type = PlatformEvent::GestureLongPress; - m_area = IntSize(e.boundingBox.width, e.boundingBox.height); + m_area = IntSize(e.data.longPress.width, e.data.longPress.height); break; case WebInputEvent::GesturePinchBegin: m_type = PlatformEvent::GesturePinchBegin; @@ -175,14 +179,14 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W break; case WebInputEvent::GesturePinchUpdate: m_type = PlatformEvent::GesturePinchUpdate; + // FIXME: PlatformGestureEvent deltaX is overloaded - wkb.ug/93123 + m_deltaX = e.data.pinchUpdate.scale; break; default: ASSERT_NOT_REACHED(); } m_position = widget->convertFromContainingWindow(IntPoint(e.x, e.y)); m_globalPosition = IntPoint(e.globalX, e.globalY); - m_deltaX = e.deltaX; - m_deltaY = e.deltaY; m_timestamp = e.timeStampSeconds; m_modifiers = 0; @@ -223,7 +227,6 @@ PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder(const WebKeyboardEven m_unmodifiedText = String(e.unmodifiedText); m_keyIdentifier = String(e.keyIdentifier); m_autoRepeat = (e.modifiers & WebInputEvent::IsAutoRepeat); - m_windowsVirtualKeyCode = e.windowsKeyCode; m_nativeVirtualKeyCode = e.nativeKeyCode; m_isKeypad = (e.modifiers & WebInputEvent::IsKeyPad); m_isSystemKey = e.isSystemKey; @@ -237,6 +240,28 @@ PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder(const WebKeyboardEven m_modifiers |= PlatformEvent::AltKey; if (e.modifiers & WebInputEvent::MetaKey) m_modifiers |= PlatformEvent::MetaKey; + + // FIXME: PlatformKeyboardEvents expect a locational version of the keycode (e.g. VK_LSHIFT + // instead of VK_SHIFT). This should be changed so the location/keycode are stored separately, + // as in other places in the code. + m_windowsVirtualKeyCode = e.windowsKeyCode; + if (e.windowsKeyCode == VK_SHIFT) { + if (e.modifiers & WebInputEvent::IsLeft) + m_windowsVirtualKeyCode = VK_LSHIFT; + else if (e.modifiers & WebInputEvent::IsRight) + m_windowsVirtualKeyCode = VK_RSHIFT; + } else if (e.windowsKeyCode == VK_CONTROL) { + if (e.modifiers & WebInputEvent::IsLeft) + m_windowsVirtualKeyCode = VK_LCONTROL; + else if (e.modifiers & WebInputEvent::IsRight) + m_windowsVirtualKeyCode = VK_RCONTROL; + } else if (e.windowsKeyCode == VK_MENU) { + if (e.modifiers & WebInputEvent::IsLeft) + m_windowsVirtualKeyCode = VK_LMENU; + else if (e.modifiers & WebInputEvent::IsRight) + m_windowsVirtualKeyCode = VK_RMENU; + } + } void PlatformKeyboardEventBuilder::setKeyType(Type type) @@ -448,8 +473,12 @@ WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) return; // Skip all other keyboard events. modifiers = getWebInputModifiers(event); - if (event.keyLocation() & KeyboardEvent::DOM_KEY_LOCATION_NUMPAD) + if (event.keyLocation() == KeyboardEvent::DOM_KEY_LOCATION_NUMPAD) modifiers |= WebInputEvent::IsKeyPad; + else if (event.keyLocation() == KeyboardEvent::DOM_KEY_LOCATION_LEFT) + modifiers |= WebInputEvent::IsLeft; + else if (event.keyLocation() == KeyboardEvent::DOM_KEY_LOCATION_RIGHT) + modifiers |= WebInputEvent::IsRight; timeStampSeconds = event.timeStamp() / millisPerSecond; windowsKeyCode = event.keyCode(); @@ -526,8 +555,11 @@ WebGestureEventBuilder::WebGestureEventBuilder(const Widget* widget, const Gestu type = GestureScrollBegin; else if (event.type() == eventNames().gesturescrollendEvent) type = GestureScrollEnd; - else if (event.type() == eventNames().gesturescrollupdateEvent) + else if (event.type() == eventNames().gesturescrollupdateEvent) { type = GestureScrollUpdate; + data.scrollUpdate.deltaX = event.deltaX(); + data.scrollUpdate.deltaY = event.deltaY(); + } timeStampSeconds = event.timeStamp() / millisPerSecond; modifiers = getWebInputModifiers(event); @@ -536,9 +568,6 @@ WebGestureEventBuilder::WebGestureEventBuilder(const Widget* widget, const Gestu globalY = event.screenY(); x = event.absoluteLocation().x() - widget->location().x(); y = event.absoluteLocation().y() - widget->location().y(); - - deltaX = event.deltaX(); - deltaY = event.deltaY(); } #endif // ENABLE(GESTURE_EVENTS) diff --git a/Source/WebKit/chromium/src/WebLayerImpl.cpp b/Source/WebKit/chromium/src/WebLayerImpl.cpp index bf64a8f2a..85f9b4db4 100644 --- a/Source/WebKit/chromium/src/WebLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebLayerImpl.cpp @@ -79,7 +79,12 @@ SkMatrix44 skMatrix44FromTransformationMatrix(const WebTransformationMatrix& mat WebLayer* WebLayer::create() { - return new WebLayerImpl(LayerChromium::create()); + return new WebLayerImpl(); +} + +WebLayerImpl::WebLayerImpl() + : m_layer(LayerChromium::create()) +{ } WebLayerImpl::WebLayerImpl(PassRefPtr<LayerChromium> layer) @@ -87,6 +92,7 @@ WebLayerImpl::WebLayerImpl(PassRefPtr<LayerChromium> layer) { } + WebLayerImpl::~WebLayerImpl() { m_layer->clearRenderSurface(); @@ -349,6 +355,16 @@ void WebLayerImpl::setScrollPosition(WebPoint position) m_layer->setScrollPosition(position); } +WebPoint WebLayerImpl::scrollPosition() const +{ + return m_layer->scrollPosition(); +} + +void WebLayerImpl::setMaxScrollPosition(WebSize maxScrollPosition) +{ + m_layer->setMaxScrollPosition(maxScrollPosition); +} + void WebLayerImpl::setScrollable(bool scrollable) { m_layer->setScrollable(scrollable); @@ -385,6 +401,11 @@ void WebLayerImpl::setFixedToContainerLayer(bool enable) m_layer->setFixedToContainerLayer(enable); } +void WebLayerImpl::setScrollClient(WebLayerScrollClient* scrollClient) +{ + m_layer->setLayerScrollClient(scrollClient); +} + LayerChromium* WebLayerImpl::layer() const { return m_layer.get(); diff --git a/Source/WebKit/chromium/src/WebLayerImpl.h b/Source/WebKit/chromium/src/WebLayerImpl.h index 0a61826a5..6739fd5ed 100644 --- a/Source/WebKit/chromium/src/WebLayerImpl.h +++ b/Source/WebKit/chromium/src/WebLayerImpl.h @@ -27,6 +27,7 @@ #define WebLayerImpl_h #include <public/WebLayer.h> +#include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> namespace WebCore { @@ -37,6 +38,7 @@ namespace WebKit { class WebLayerImpl : public WebLayer { public: + WebLayerImpl(); explicit WebLayerImpl(PassRefPtr<WebCore::LayerChromium>); virtual ~WebLayerImpl(); @@ -92,12 +94,15 @@ public: virtual void transferAnimationsTo(WebLayer*) OVERRIDE; virtual void setForceRenderSurface(bool) OVERRIDE; virtual void setScrollPosition(WebPoint) OVERRIDE; + virtual WebPoint scrollPosition() const OVERRIDE; + virtual void setMaxScrollPosition(WebSize) OVERRIDE; virtual void setScrollable(bool) OVERRIDE; virtual void setHaveWheelEventHandlers(bool) OVERRIDE; virtual void setShouldScrollOnMainThread(bool) OVERRIDE; virtual void setNonFastScrollableRegion(const WebVector<WebRect>&) OVERRIDE; virtual void setIsContainerForFixedPositionLayers(bool) OVERRIDE; virtual void setFixedToContainerLayer(bool) OVERRIDE; + virtual void setScrollClient(WebLayerScrollClient*) OVERRIDE; WebCore::LayerChromium* layer() const; diff --git a/Source/WebKit/chromium/src/WebLayerTreeView.cpp b/Source/WebKit/chromium/src/WebLayerTreeView.cpp deleted file mode 100644 index 7dfbcd129..000000000 --- a/Source/WebKit/chromium/src/WebLayerTreeView.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include <public/WebLayerTreeView.h> - -#include "CCFontAtlas.h" -#include "CCGraphicsContext.h" -#include "CCLayerTreeHost.h" -#include "CCRenderingStats.h" -#include "LayerChromium.h" -#include "WebLayerImpl.h" -#include "WebLayerTreeViewImpl.h" -#include <public/WebLayer.h> -#include <public/WebPoint.h> -#include <public/WebRect.h> -#include <public/WebRenderingStats.h> -#include <public/WebSize.h> - -using namespace WebCore; - -namespace WebKit { - -WebLayerTreeView::Settings::operator CCLayerTreeSettings() const -{ - CCLayerTreeSettings settings; - settings.showFPSCounter = showFPSCounter; - settings.showPlatformLayerTree = showPlatformLayerTree; - settings.showPaintRects = showPaintRects; - settings.renderVSyncEnabled = renderVSyncEnabled; - settings.refreshRate = refreshRate; - settings.defaultTileSize = defaultTileSize; - settings.maxUntiledLayerSize = maxUntiledLayerSize; - settings.acceleratePainting = acceleratePainting; - - // FIXME: showFPSCounter / showPlatformLayerTree / maxPartialTextureUpdates aren't supported currently. - return settings; -} - -void WebLayerTreeView::reset() -{ - m_private.reset(0); -} - -bool WebLayerTreeView::isNull() const -{ - return !m_private.get(); -} - -bool WebLayerTreeView::initialize(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings) -{ - // We have to leak the pointer here into a WebPrivateOwnPtr. We free this object in reset(). - m_private.reset(WebLayerTreeViewImpl::create(client, root, settings).leakPtr()); - return !isNull(); -} - -void WebLayerTreeView::setSurfaceReady() -{ - m_private->layerTreeHost()->setSurfaceReady(); -} - -void WebLayerTreeView::setRootLayer(WebLayer *root) -{ - if (root) - m_private->layerTreeHost()->setRootLayer(static_cast<WebLayerImpl*>(root)->layer()); - else - m_private->layerTreeHost()->setRootLayer(PassRefPtr<LayerChromium>()); -} - -int WebLayerTreeView::compositorIdentifier() -{ - return m_private->layerTreeHost()->compositorIdentifier(); -} - -void WebLayerTreeView::setViewportSize(const WebSize& layoutViewportSize, const WebSize& deviceViewportSize) -{ - if (!deviceViewportSize.isEmpty()) - m_private->layerTreeHost()->setViewportSize(layoutViewportSize, deviceViewportSize); - else - m_private->layerTreeHost()->setViewportSize(layoutViewportSize, layoutViewportSize); -} - -WebSize WebLayerTreeView::layoutViewportSize() const -{ - return WebSize(m_private->layerTreeHost()->layoutViewportSize()); -} - -WebSize WebLayerTreeView::deviceViewportSize() const -{ - return WebSize(m_private->layerTreeHost()->deviceViewportSize()); -} - -void WebLayerTreeView::setDeviceScaleFactor(const float deviceScaleFactor) -{ - m_private->layerTreeHost()->setDeviceScaleFactor(deviceScaleFactor); -} - -float WebLayerTreeView::deviceScaleFactor() const -{ - return m_private->layerTreeHost()->deviceScaleFactor(); -} - -void WebLayerTreeView::setBackgroundColor(WebColor color) -{ - m_private->layerTreeHost()->setBackgroundColor(color); -} - -void WebLayerTreeView::setHasTransparentBackground(bool transparent) -{ - m_private->layerTreeHost()->setHasTransparentBackground(transparent); -} - -void WebLayerTreeView::setVisible(bool visible) -{ - m_private->layerTreeHost()->setVisible(visible); -} - -void WebLayerTreeView::setPageScaleFactorAndLimits(float pageScaleFactor, float minimum, float maximum) -{ - m_private->layerTreeHost()->setPageScaleFactorAndLimits(pageScaleFactor, minimum, maximum); -} - -void WebLayerTreeView::startPageScaleAnimation(const WebPoint& scroll, bool useAnchor, float newPageScale, double durationSec) -{ - m_private->layerTreeHost()->startPageScaleAnimation(IntSize(scroll.x, scroll.y), useAnchor, newPageScale, durationSec); -} - -void WebLayerTreeView::setNeedsAnimate() -{ - m_private->layerTreeHost()->setNeedsAnimate(); -} - -void WebLayerTreeView::setNeedsRedraw() -{ - m_private->layerTreeHost()->setNeedsRedraw(); -} - -bool WebLayerTreeView::commitRequested() const -{ - return m_private->layerTreeHost()->commitRequested(); -} - -void WebLayerTreeView::composite() -{ - if (CCProxy::hasImplThread()) - m_private->layerTreeHost()->setNeedsCommit(); - else - m_private->layerTreeHost()->composite(); -} - -void WebLayerTreeView::updateAnimations(double frameBeginTime) -{ - m_private->layerTreeHost()->updateAnimations(frameBeginTime); -} - -bool WebLayerTreeView::compositeAndReadback(void *pixels, const WebRect& rect) -{ - return m_private->layerTreeHost()->compositeAndReadback(pixels, rect); -} - -void WebLayerTreeView::finishAllRendering() -{ - m_private->layerTreeHost()->finishAllRendering(); -} - -void WebLayerTreeView::renderingStats(WebRenderingStats& stats) const -{ - CCRenderingStats ccStats; - m_private->layerTreeHost()->renderingStats(ccStats); - - stats.numAnimationFrames = ccStats.numAnimationFrames; - stats.numFramesSentToScreen = ccStats.numFramesSentToScreen; - stats.droppedFrameCount = ccStats.droppedFrameCount; - stats.totalPaintTimeInSeconds = ccStats.totalPaintTimeInSeconds; - stats.totalRasterizeTimeInSeconds = ccStats.totalRasterizeTimeInSeconds; -} - -void WebLayerTreeView::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectTable[128], int fontHeight) -{ - IntRect asciiToRectTable[128]; - for (int i = 0; i < 128; ++i) - asciiToRectTable[i] = asciiToWebRectTable[i]; - OwnPtr<CCFontAtlas> fontAtlas = CCFontAtlas::create(bitmap, asciiToRectTable, fontHeight); - m_private->layerTreeHost()->setFontAtlas(fontAtlas.release()); -} - -void WebLayerTreeView::loseCompositorContext(int numTimes) -{ - m_private->layerTreeHost()->loseContext(numTimes); -} - -} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp index 1fd823976..bb898c966 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp @@ -26,130 +26,35 @@ #include "config.h" #include "WebLayerTreeViewImpl.h" +#include "CCFontAtlas.h" +#include "CCInputHandler.h" #include "CCLayerTreeHost.h" -#include "CCThreadProxy.h" #include "LayerChromium.h" #include "WebLayerImpl.h" +#include "WebToCCInputHandlerAdapter.h" #include <public/WebGraphicsContext3D.h> +#include <public/WebInputHandler.h> #include <public/WebLayer.h> #include <public/WebLayerTreeView.h> #include <public/WebLayerTreeViewClient.h> +#include <public/WebRenderingStats.h> #include <public/WebSize.h> -#include <public/WebThread.h> using namespace WebCore; -namespace { - -// Adapts a pure WebGraphicsContext3D into a WebCompositorOutputSurface until -// downstream code can be updated to produce output surfaces directly. -class WebGraphicsContextToOutputSurfaceAdapter : public WebKit::WebCompositorOutputSurface { -public: - explicit WebGraphicsContextToOutputSurfaceAdapter(PassOwnPtr<WebKit::WebGraphicsContext3D> context) - : m_context3D(context) - , m_client(0) - { - } - - virtual bool bindToClient(WebKit::WebCompositorOutputSurfaceClient* client) OVERRIDE - { - ASSERT(client); - if (!m_context3D->makeContextCurrent()) - return false; - m_client = client; - return true; - } - - virtual const Capabilities& capabilities() const OVERRIDE - { - return m_capabilities; - } - - virtual WebKit::WebGraphicsContext3D* context3D() const OVERRIDE - { - return m_context3D.get(); - } - - virtual void sendFrameToParentCompositor(const WebKit::WebCompositorFrame&) OVERRIDE - { - } - -private: - OwnPtr<WebKit::WebGraphicsContext3D> m_context3D; - Capabilities m_capabilities; - WebKit::WebCompositorOutputSurfaceClient* m_client; -}; +namespace WebKit { +WebLayerTreeView* WebLayerTreeView::create(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings) +{ + OwnPtr<WebLayerTreeViewImpl> layerTreeViewImpl = adoptPtr(new WebLayerTreeViewImpl(client)); + if (!layerTreeViewImpl->initialize(settings)) + return 0; + layerTreeViewImpl->setRootLayer(root); + return layerTreeViewImpl.leakPtr(); } -namespace WebKit { - -// Converts messages from CCLayerTreeHostClient to WebLayerTreeViewClient. -class WebLayerTreeViewClientAdapter : public WebCore::CCLayerTreeHostClient { -public: - WebLayerTreeViewClientAdapter(WebLayerTreeViewClient* client) - : m_client(client) - , m_usingRealOutputSurface(false) - { - } - virtual ~WebLayerTreeViewClientAdapter() { } - - // CCLayerTreeHostClient implementation - virtual void willBeginFrame() OVERRIDE { m_client->willBeginFrame(); } - virtual void didBeginFrame() OVERRIDE { m_client->didBeginFrame(); } - virtual void updateAnimations(double monotonicFrameBeginTime) OVERRIDE { m_client->updateAnimations(monotonicFrameBeginTime); } - virtual void layout() OVERRIDE { m_client->layout(); } - virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) OVERRIDE { m_client->applyScrollAndScale(scrollDelta, pageScale); } - virtual PassOwnPtr<WebCompositorOutputSurface> createOutputSurface() OVERRIDE - { - WebCompositorOutputSurface* outputSurface = m_client->createOutputSurface(); - if (outputSurface) { - m_usingRealOutputSurface = true; - return adoptPtr(outputSurface); - } - - // Temporarily, if the output surface can't be created, create a WebGraphicsContext3D - // directly. This allows bootstrapping the output surface system while downstream - // users of the API still use the old approach. - WebGraphicsContext3D* context = m_client->createContext3D(); - if (!context) - return nullptr; - - m_usingRealOutputSurface = false; - return adoptPtr(new WebGraphicsContextToOutputSurfaceAdapter(adoptPtr(context))); - } - - virtual void didRecreateOutputSurface(bool success) OVERRIDE - { - if (m_usingRealOutputSurface) { - m_client->didRecreateOutputSurface(success); - return; - } - m_client->didRebindGraphicsContext(success); - } - virtual void willCommit() OVERRIDE { m_client->willCommit(); } - virtual void didCommit() OVERRIDE { m_client->didCommit(); } - virtual void didCommitAndDrawFrame() OVERRIDE { m_client->didCommitAndDrawFrame(); } - virtual void didCompleteSwapBuffers() OVERRIDE { m_client->didCompleteSwapBuffers(); } - virtual void scheduleComposite() OVERRIDE { m_client->scheduleComposite(); } - -private: - WebLayerTreeViewClient* m_client; - bool m_usingRealOutputSurface; -}; - -PassOwnPtr<WebLayerTreeViewImpl> WebLayerTreeViewImpl::create(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings) -{ - OwnPtr<WebLayerTreeViewImpl> impl = adoptPtr(new WebLayerTreeViewImpl(client, settings)); - if (!impl->layerTreeHost()) - return nullptr; - impl->layerTreeHost()->setRootLayer(static_cast<const WebLayerImpl*>(&root)->layer()); - return impl.release(); -} - -WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client, const WebLayerTreeView::Settings& settings) - : m_clientAdapter(adoptPtr(new WebLayerTreeViewClientAdapter(client))) - , m_layerTreeHost(CCLayerTreeHost::create(m_clientAdapter.get(), settings)) +WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client) + : m_client(client) { } @@ -157,4 +62,221 @@ WebLayerTreeViewImpl::~WebLayerTreeViewImpl() { } +bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSettings) +{ + CCLayerTreeSettings settings; + settings.acceleratePainting = webSettings.acceleratePainting; + settings.showFPSCounter = webSettings.showFPSCounter; + settings.showPlatformLayerTree = webSettings.showPlatformLayerTree; + settings.showPaintRects = webSettings.showPaintRects; + settings.renderVSyncEnabled = webSettings.renderVSyncEnabled; + settings.refreshRate = webSettings.refreshRate; + settings.defaultTileSize = webSettings.defaultTileSize; + settings.maxUntiledLayerSize = webSettings.maxUntiledLayerSize; + m_layerTreeHost = CCLayerTreeHost::create(this, settings); + if (!m_layerTreeHost) + return false; + return true; +} + +void WebLayerTreeViewImpl::setSurfaceReady() +{ + m_layerTreeHost->setSurfaceReady(); +} + +void WebLayerTreeViewImpl::setRootLayer(const WebLayer& root) +{ + m_layerTreeHost->setRootLayer(static_cast<const WebLayerImpl*>(&root)->layer()); +} + +void WebLayerTreeViewImpl::clearRootLayer() +{ + m_layerTreeHost->setRootLayer(PassRefPtr<LayerChromium>()); +} + +void WebLayerTreeViewImpl::setViewportSize(const WebSize& layoutViewportSize, const WebSize& deviceViewportSize) +{ + if (!deviceViewportSize.isEmpty()) + m_layerTreeHost->setViewportSize(layoutViewportSize, deviceViewportSize); + else + m_layerTreeHost->setViewportSize(layoutViewportSize, layoutViewportSize); +} + +WebSize WebLayerTreeViewImpl::layoutViewportSize() const +{ + return WebSize(m_layerTreeHost->layoutViewportSize()); +} + +WebSize WebLayerTreeViewImpl::deviceViewportSize() const +{ + return WebSize(m_layerTreeHost->deviceViewportSize()); +} + +void WebLayerTreeViewImpl::setDeviceScaleFactor(const float deviceScaleFactor) +{ + m_layerTreeHost->setDeviceScaleFactor(deviceScaleFactor); +} + +float WebLayerTreeViewImpl::deviceScaleFactor() const +{ + return m_layerTreeHost->deviceScaleFactor(); +} + +void WebLayerTreeViewImpl::setBackgroundColor(WebColor color) +{ + m_layerTreeHost->setBackgroundColor(color); +} + +void WebLayerTreeViewImpl::setHasTransparentBackground(bool transparent) +{ + m_layerTreeHost->setHasTransparentBackground(transparent); +} + +void WebLayerTreeViewImpl::setVisible(bool visible) +{ + m_layerTreeHost->setVisible(visible); +} + +void WebLayerTreeViewImpl::setPageScaleFactorAndLimits(float pageScaleFactor, float minimum, float maximum) +{ + m_layerTreeHost->setPageScaleFactorAndLimits(pageScaleFactor, minimum, maximum); +} + +void WebLayerTreeViewImpl::startPageScaleAnimation(const WebPoint& scroll, bool useAnchor, float newPageScale, double durationSec) +{ + m_layerTreeHost->startPageScaleAnimation(IntSize(scroll.x, scroll.y), useAnchor, newPageScale, durationSec); +} + +void WebLayerTreeViewImpl::setNeedsAnimate() +{ + m_layerTreeHost->setNeedsAnimate(); +} + +void WebLayerTreeViewImpl::setNeedsRedraw() +{ + m_layerTreeHost->setNeedsRedraw(); +} + +bool WebLayerTreeViewImpl::commitRequested() const +{ + return m_layerTreeHost->commitRequested(); +} + +void WebLayerTreeViewImpl::composite() +{ + if (CCProxy::hasImplThread()) + m_layerTreeHost->setNeedsCommit(); + else + m_layerTreeHost->composite(); +} + +void WebLayerTreeViewImpl::updateAnimations(double frameBeginTime) +{ + m_layerTreeHost->updateAnimations(frameBeginTime); +} + +bool WebLayerTreeViewImpl::compositeAndReadback(void *pixels, const WebRect& rect) +{ + return m_layerTreeHost->compositeAndReadback(pixels, rect); +} + +void WebLayerTreeViewImpl::finishAllRendering() +{ + m_layerTreeHost->finishAllRendering(); +} + +void WebLayerTreeViewImpl::renderingStats(WebRenderingStats& stats) const +{ + CCRenderingStats ccStats; + m_layerTreeHost->renderingStats(ccStats); + + stats.numAnimationFrames = ccStats.numAnimationFrames; + stats.numFramesSentToScreen = ccStats.numFramesSentToScreen; + stats.droppedFrameCount = ccStats.droppedFrameCount; + stats.totalPaintTimeInSeconds = ccStats.totalPaintTimeInSeconds; + stats.totalRasterizeTimeInSeconds = ccStats.totalRasterizeTimeInSeconds; +} + +void WebLayerTreeViewImpl::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectTable[128], int fontHeight) +{ + IntRect asciiToRectTable[128]; + for (int i = 0; i < 128; ++i) + asciiToRectTable[i] = asciiToWebRectTable[i]; + OwnPtr<CCFontAtlas> fontAtlas = CCFontAtlas::create(bitmap, asciiToRectTable, fontHeight); + m_layerTreeHost->setFontAtlas(fontAtlas.release()); +} + +void WebLayerTreeViewImpl::loseCompositorContext(int numTimes) +{ + m_layerTreeHost->loseContext(numTimes); +} + +void WebLayerTreeViewImpl::willBeginFrame() +{ + m_client->willBeginFrame(); +} + +void WebLayerTreeViewImpl::didBeginFrame() +{ + m_client->didBeginFrame(); +} + +void WebLayerTreeViewImpl::animate(double monotonicFrameBeginTime) +{ + m_client->updateAnimations(monotonicFrameBeginTime); +} + +void WebLayerTreeViewImpl::layout() +{ + m_client->layout(); +} + +void WebLayerTreeViewImpl::applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) +{ + m_client->applyScrollAndScale(scrollDelta, pageScale); +} + +PassOwnPtr<WebCompositorOutputSurface> WebLayerTreeViewImpl::createOutputSurface() +{ + return adoptPtr(m_client->createOutputSurface()); +} + +void WebLayerTreeViewImpl::didRecreateOutputSurface(bool success) +{ + m_client->didRecreateOutputSurface(success); +} + +PassOwnPtr<CCInputHandler> WebLayerTreeViewImpl::createInputHandler() +{ + OwnPtr<WebInputHandler> handler = adoptPtr(m_client->createInputHandler()); + if (handler) + return WebToCCInputHandlerAdapter::create(handler.release()); + return nullptr; +} + +void WebLayerTreeViewImpl::willCommit() +{ + m_client->willCommit(); +} + +void WebLayerTreeViewImpl::didCommit() +{ + m_client->didCommit(); +} + +void WebLayerTreeViewImpl::didCommitAndDrawFrame() +{ + m_client->didCommitAndDrawFrame(); +} + +void WebLayerTreeViewImpl::didCompleteSwapBuffers() +{ + m_client->didCompleteSwapBuffers(); +} + +void WebLayerTreeViewImpl::scheduleComposite() +{ + m_client->scheduleComposite(); +} + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h index 3bc43410d..a1dbd7404 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h +++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h @@ -26,6 +26,7 @@ #ifndef WebLayerTreeViewImpl_h #define WebLayerTreeViewImpl_h +#include "CCLayerTreeHostClient.h" #include <public/WebLayerTreeView.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -39,17 +40,55 @@ class WebLayer; class WebLayerTreeViewClient; class WebLayerTreeViewClientAdapter; -class WebLayerTreeViewImpl { +class WebLayerTreeViewImpl : public WebLayerTreeView, public WebCore::CCLayerTreeHostClient { public: - static PassOwnPtr<WebLayerTreeViewImpl> create(WebLayerTreeViewClient*, const WebLayer& root, const WebLayerTreeView::Settings&); + explicit WebLayerTreeViewImpl(WebLayerTreeViewClient*); virtual ~WebLayerTreeViewImpl(); - WebCore::CCLayerTreeHost* layerTreeHost() { return m_layerTreeHost.get(); } + bool initialize(const Settings&); -private: - WebLayerTreeViewImpl(WebLayerTreeViewClient*, const WebLayerTreeView::Settings&); + // WebLayerTreeView implementation. + virtual void setSurfaceReady() OVERRIDE; + virtual void setRootLayer(const WebLayer&) OVERRIDE; + virtual void clearRootLayer() OVERRIDE; + virtual void setViewportSize(const WebSize& layoutViewportSize, const WebSize& deviceViewportSize = WebSize()) OVERRIDE; + virtual WebSize layoutViewportSize() const OVERRIDE; + virtual WebSize deviceViewportSize() const OVERRIDE; + virtual void setDeviceScaleFactor(float) OVERRIDE; + virtual float deviceScaleFactor() const OVERRIDE; + virtual void setBackgroundColor(WebColor) OVERRIDE; + virtual void setHasTransparentBackground(bool) OVERRIDE; + virtual void setVisible(bool) OVERRIDE; + virtual void setPageScaleFactorAndLimits(float pageScaleFactor, float minimum, float maximum) OVERRIDE; + virtual void startPageScaleAnimation(const WebPoint& destination, bool useAnchor, float newPageScale, double durationSec) OVERRIDE; + virtual void setNeedsAnimate() OVERRIDE; + virtual void setNeedsRedraw() OVERRIDE; + virtual bool commitRequested() const OVERRIDE; + virtual void composite() OVERRIDE; + virtual void updateAnimations(double frameBeginTime) OVERRIDE; + virtual bool compositeAndReadback(void *pixels, const WebRect&) OVERRIDE; + virtual void finishAllRendering() OVERRIDE; + virtual void renderingStats(WebRenderingStats&) const OVERRIDE; + virtual void setFontAtlas(SkBitmap, WebRect asciiToRectTable[128], int fontHeight) OVERRIDE; + virtual void loseCompositorContext(int numTimes) OVERRIDE; + + // WebCore::CCLayerTreeHostClient implementation. + virtual void willBeginFrame() OVERRIDE; + virtual void didBeginFrame() OVERRIDE; + virtual void animate(double monotonicFrameBeginTime) OVERRIDE; + virtual void layout() OVERRIDE; + virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) OVERRIDE; + virtual PassOwnPtr<WebCompositorOutputSurface> createOutputSurface() OVERRIDE; + virtual void didRecreateOutputSurface(bool success) OVERRIDE; + virtual PassOwnPtr<WebCore::CCInputHandler> createInputHandler() OVERRIDE; + virtual void willCommit() OVERRIDE; + virtual void didCommit() OVERRIDE; + virtual void didCommitAndDrawFrame() OVERRIDE; + virtual void didCompleteSwapBuffers() OVERRIDE; + virtual void scheduleComposite() OVERRIDE; - OwnPtr<WebLayerTreeViewClientAdapter> m_clientAdapter; +private: + WebLayerTreeViewClient* m_client; OwnPtr<WebCore::CCLayerTreeHost> m_layerTreeHost; }; diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index 72e871637..e570dca5a 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -12,6 +12,7 @@ #include "AudioSourceProviderClient.h" #include "Frame.h" #include "GraphicsContext.h" +#include "GraphicsLayerChromium.h" #include "HTMLMediaElement.h" #include "IntSize.h" #include "KURL.h" @@ -29,11 +30,13 @@ #include <public/Platform.h> #include <public/WebCString.h> #include <public/WebCanvas.h> +#include <public/WebCompositorSupport.h> #include <public/WebMimeRegistry.h> #include <public/WebRect.h> #include <public/WebSize.h> #include <public/WebString.h> #include <public/WebURL.h> +#include <public/WebVideoLayer.h> #if USE(ACCELERATED_COMPOSITING) #include "RenderLayerCompositor.h" @@ -97,6 +100,10 @@ WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl() #endif if (m_helperPlugin) closeHelperPlugin(); +#if USE(ACCELERATED_COMPOSITING) + if (m_videoLayer) + GraphicsLayerChromium::unregisterContentsLayer(m_videoLayer->layer()); +#endif } void WebMediaPlayerClientImpl::networkStateChanged() @@ -111,8 +118,10 @@ void WebMediaPlayerClientImpl::readyStateChanged() m_mediaPlayer->readyStateChanged(); #if USE(ACCELERATED_COMPOSITING) if (hasVideo() && supportsAcceleratedRendering() && !m_videoLayer) { - m_videoLayer = adoptPtr(WebVideoLayer::create(this)); + m_videoLayer = adoptPtr(Platform::current()->compositorSupport()->createVideoLayer(this)); + m_videoLayer->layer()->setOpaque(m_opaque); + GraphicsLayerChromium::registerContentsLayer(m_videoLayer->layer()); } #endif } @@ -431,6 +440,12 @@ bool WebMediaPlayerClientImpl::sourceAbort(const String& id) return m_webMediaPlayer->sourceAbort(id); } +void WebMediaPlayerClientImpl::sourceSetDuration(double duration) +{ + if (m_webMediaPlayer) + m_webMediaPlayer->sourceSetDuration(duration); +} + void WebMediaPlayerClientImpl::sourceEndOfStream(WebCore::MediaPlayer::EndOfStreamStatus status) { if (m_webMediaPlayer) diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h index 329fd9ec0..dd170e57c 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h @@ -39,7 +39,6 @@ #include "WebMediaPlayerClient.h" #include "WebStreamTextureClient.h" #include <public/WebVideoFrameProvider.h> -#include <public/WebVideoLayer.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -50,6 +49,7 @@ namespace WebKit { class WebHelperPluginImpl; class WebAudioSourceProvider; class WebMediaPlayer; +class WebVideoLayer; // This class serves as a bridge between WebCore::MediaPlayer and // WebKit::WebMediaPlayer. @@ -163,6 +163,7 @@ public: virtual WTF::PassRefPtr<WebCore::TimeRanges> sourceBuffered(const String&); virtual bool sourceAppend(const String&, const unsigned char* data, unsigned length); virtual bool sourceAbort(const String&); + virtual void sourceSetDuration(double); virtual void sourceEndOfStream(WebCore::MediaPlayer::EndOfStreamStatus); virtual bool sourceSetTimestampOffset(const String&, double offset); #endif diff --git a/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp b/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp index dd4b15ebd..793ca8b83 100644 --- a/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp @@ -75,6 +75,8 @@ // override the incorrect base URL and make sure we alway load correct local // saved resource files. +#define WTF_DEPRECATED_STRING_OPERATORS + #include "config.h" #include "WebPageSerializerImpl.h" diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp index 75a97e0f6..524ba80f8 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -51,6 +51,7 @@ #include "FrameView.h" #include "GestureEvent.h" #include "GraphicsContext.h" +#include "GraphicsLayerChromium.h" #include "HitTestResult.h" #include "HostWindow.h" #include "HTMLFormElement.h" @@ -71,6 +72,8 @@ #include "WheelEvent.h" #include <public/Platform.h> #include <public/WebClipboard.h> +#include <public/WebCompositorSupport.h> +#include <public/WebExternalTextureLayer.h> #include <public/WebRect.h> #include <public/WebString.h> #include <public/WebURL.h> @@ -368,8 +371,10 @@ void WebPluginContainerImpl::setBackingTextureId(unsigned textureId) ASSERT(!m_ioSurfaceLayer); - if (!m_textureLayer) - m_textureLayer = adoptPtr(WebExternalTextureLayer::create()); + if (!m_textureLayer) { + m_textureLayer = adoptPtr(Platform::current()->compositorSupport()->createExternalTextureLayer()); + GraphicsLayerChromium::registerContentsLayer(m_textureLayer->layer()); + } m_textureLayer->setTextureId(textureId); // If anyone of the IDs is zero we need to switch between hardware @@ -392,8 +397,10 @@ void WebPluginContainerImpl::setBackingIOSurfaceId(int width, ASSERT(!m_textureLayer); - if (!m_ioSurfaceLayer) - m_ioSurfaceLayer = adoptPtr(WebIOSurfaceLayer::create()); + if (!m_ioSurfaceLayer) { + m_ioSurfaceLayer = adoptPtr(Platform::current()->compositorSupport()->createIOSurfaceLayer()); + GraphicsLayerChromium::registerContentsLayer(m_ioSurfaceLayer->layer()); + } m_ioSurfaceLayer->setIOSurfaceProperties(ioSurfaceId, WebSize(width, height)); // If anyone of the IDs is zero we need to switch between hardware @@ -500,7 +507,7 @@ bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect) LayoutPoint center = documentRect.center(); // Make the rect we're checking (the point surrounded by padding rects) contained inside the requested rect. (Note that -1/2 is 0.) LayoutSize padding((documentRect.width() - 1) / 2, (documentRect.height() - 1) / 2); - HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(center, false, false, DontHitTestScrollbars, HitTestRequest::ReadOnly | HitTestRequest::Active, padding); + HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(center, HitTestRequest::ReadOnly | HitTestRequest::Active, padding); const HitTestResult::NodeSet& nodes = result.rectBasedTestResult(); if (nodes.size() != 1) return false; @@ -627,6 +634,13 @@ WebPluginContainerImpl::WebPluginContainerImpl(WebCore::HTMLPlugInElement* eleme WebPluginContainerImpl::~WebPluginContainerImpl() { +#if USE(ACCELERATED_COMPOSITING) + if (m_textureLayer) + GraphicsLayerChromium::unregisterContentsLayer(m_textureLayer->layer()); + if (m_ioSurfaceLayer) + GraphicsLayerChromium::unregisterContentsLayer(m_ioSurfaceLayer->layer()); +#endif + if (m_isAcceptingTouchEvents) m_element->document()->didRemoveTouchEventHandler(); diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.h b/Source/WebKit/chromium/src/WebPluginContainerImpl.h index 998be6e41..e203a7370 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.h +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.h @@ -35,7 +35,6 @@ #include "WebPluginContainer.h" #include "Widget.h" -#include <public/WebExternalTextureLayer.h> #include <public/WebIOSurfaceLayer.h> #include <wtf/OwnPtr.h> #include <wtf/PassRefPtr.h> @@ -67,6 +66,7 @@ struct WebPrintParams; class ScrollbarGroup; class WebPlugin; class WebPluginLoadObserver; +class WebExternalTextureLayer; class WebPluginContainerImpl : public WebCore::PluginViewBase, public WebPluginContainer { public: diff --git a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp index 8bc880c75..bbd71bc82 100644 --- a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp +++ b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp @@ -204,14 +204,13 @@ bool WebRuntimeFeatures::isWebAudioEnabled() #endif } -void WebRuntimeFeatures::enablePushState(bool enable) +void WebRuntimeFeatures::enablePushState(bool) { - RuntimeEnabledFeatures::setPushStateEnabled(enable); } bool WebRuntimeFeatures::isPushStateEnabled(bool enable) { - return RuntimeEnabledFeatures::pushStateEnabled(); + return true; } void WebRuntimeFeatures::enableTouch(bool enable) diff --git a/Source/WebKit/chromium/src/WebScrollbarImpl.cpp b/Source/WebKit/chromium/src/WebScrollbarImpl.cpp deleted file mode 100644 index 73b92697e..000000000 --- a/Source/WebKit/chromium/src/WebScrollbarImpl.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE 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 "WebScrollbarImpl.h" - -#include "IntRect.h" -#include "Scrollbar.h" - -namespace WebKit { - -PassOwnPtr<WebScrollbar> WebScrollbar::create(WebCore::Scrollbar* scrollbar) -{ - return adoptPtr(new WebScrollbarImpl(scrollbar)); -} - -WebScrollbarImpl::WebScrollbarImpl(WebCore::Scrollbar* scrollbar) - : m_scrollbar(scrollbar) -{ -} - -bool WebScrollbarImpl::isOverlay() const -{ - return m_scrollbar->isOverlayScrollbar(); -} - -int WebScrollbarImpl::value() const -{ - return m_scrollbar->value(); -} - -WebPoint WebScrollbarImpl::location() const -{ - return m_scrollbar->location(); -} - -WebSize WebScrollbarImpl::size() const -{ - return m_scrollbar->size(); -} - -bool WebScrollbarImpl::enabled() const -{ - return m_scrollbar->enabled(); -} - -int WebScrollbarImpl::maximum() const -{ - return m_scrollbar->maximum(); -} - -int WebScrollbarImpl::totalSize() const -{ - return m_scrollbar->totalSize(); -} - -bool WebScrollbarImpl::isScrollViewScrollbar() const -{ - return m_scrollbar->isScrollViewScrollbar(); -} - -bool WebScrollbarImpl::isScrollableAreaActive() const -{ - return m_scrollbar->isScrollableAreaActive(); -} - -void WebScrollbarImpl::getTickmarks(WebVector<WebRect>& webTickmarks) const -{ - Vector<WebCore::IntRect> tickmarks; - m_scrollbar->getTickmarks(tickmarks); - - WebVector<WebRect> result(tickmarks.size()); - for (size_t i = 0; i < tickmarks.size(); ++i) - result[i] = tickmarks[i]; - - webTickmarks.swap(result); -} - -WebScrollbar::ScrollbarControlSize WebScrollbarImpl::controlSize() const -{ - return static_cast<WebScrollbar::ScrollbarControlSize>(m_scrollbar->controlSize()); -} - -WebScrollbar::ScrollbarPart WebScrollbarImpl::pressedPart() const -{ - return static_cast<WebScrollbar::ScrollbarPart>(m_scrollbar->pressedPart()); -} - -WebScrollbar::ScrollbarPart WebScrollbarImpl::hoveredPart() const -{ - return static_cast<WebScrollbar::ScrollbarPart>(m_scrollbar->hoveredPart()); -} - -WebScrollbar::ScrollbarOverlayStyle WebScrollbarImpl::scrollbarOverlayStyle() const -{ - return static_cast<WebScrollbar::ScrollbarOverlayStyle>(m_scrollbar->scrollbarOverlayStyle()); -} - -WebScrollbar::Orientation WebScrollbarImpl::orientation() const -{ - return static_cast<WebScrollbar::Orientation>(m_scrollbar->orientation()); -} - -bool WebScrollbarImpl::isCustomScrollbar() const -{ - return m_scrollbar->isCustomScrollbar(); -} - -} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp b/Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp index ec6e9895d..44f6ea3c5 100644 --- a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp @@ -29,19 +29,18 @@ #include "ScrollbarLayerChromium.h" #include "WebLayerImpl.h" -using WebCore::Scrollbar; using WebCore::ScrollbarLayerChromium; namespace WebKit { -WebScrollbarLayer* WebScrollbarLayer::create(WebCore::Scrollbar* scrollbar, WebScrollbarThemePainter painter, PassOwnPtr<WebScrollbarThemeGeometry> geometry) +WebScrollbarLayer* WebScrollbarLayer::create(WebScrollbar* scrollbar, WebScrollbarThemePainter painter, WebScrollbarThemeGeometry* geometry) { - return new WebScrollbarLayerImpl(ScrollbarLayerChromium::create(WebScrollbar::create(scrollbar), painter, geometry, 0)); + return new WebScrollbarLayerImpl(scrollbar, painter, geometry); } -WebScrollbarLayerImpl::WebScrollbarLayerImpl(PassRefPtr<WebCore::ScrollbarLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +WebScrollbarLayerImpl::WebScrollbarLayerImpl(WebScrollbar* scrollbar, WebScrollbarThemePainter painter, WebScrollbarThemeGeometry* geometry) + : m_layer(adoptPtr(new WebLayerImpl(ScrollbarLayerChromium::create(adoptPtr(scrollbar), painter, adoptPtr(geometry), 0)))) { } diff --git a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h b/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h index 720f79c55..a85b28e67 100644 --- a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h +++ b/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h @@ -28,18 +28,13 @@ #include <public/WebScrollbarLayer.h> #include <wtf/OwnPtr.h> -#include <wtf/PassRefPtr.h> - -namespace WebCore { -class ScrollbarLayerChromium; -} namespace WebKit { class WebLayerImpl; class WebScrollbarLayerImpl : public WebScrollbarLayer { public: - explicit WebScrollbarLayerImpl(PassRefPtr<WebCore::ScrollbarLayerChromium>); + WebScrollbarLayerImpl(WebScrollbar*, WebScrollbarThemePainter, WebScrollbarThemeGeometry*); virtual ~WebScrollbarLayerImpl(); // WebScrollbarLayer implementation. diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp index eb4b7bb76..5026ee94b 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp @@ -53,6 +53,7 @@ WebSettingsImpl::WebSettingsImpl(Settings* settings) , m_renderVSyncEnabled(true) , m_viewportEnabled(false) , m_applyDefaultDeviceScaleFactorInCompositor(false) + , m_gestureTapHighlightEnabled(true) , m_defaultTileSize(WebSize(256, 256)) , m_maxUntiledLayerSize(WebSize(512, 512)) { @@ -636,4 +637,9 @@ void WebSettingsImpl::setCookieEnabled(bool enabled) m_settings->setCookieEnabled(enabled); } +void WebSettingsImpl::setGestureTapHighlightEnabled(bool enableHighlight) +{ + m_gestureTapHighlightEnabled = enableHighlight; +} + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index 7bc8a649a..6cee2af23 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -95,6 +95,7 @@ public: virtual void setForceCompositingMode(bool); virtual void setFrameFlatteningEnabled(bool); virtual void setFullScreenEnabled(bool); + virtual void setGestureTapHighlightEnabled(bool); virtual void setHyperlinkAuditingEnabled(bool); virtual void setImagesEnabled(bool); virtual void setInteractiveFormValidationEnabled(bool); @@ -157,6 +158,7 @@ public: bool showPaintRects() const { return m_showPaintRects; } bool renderVSyncEnabled() const { return m_renderVSyncEnabled; } bool applyDefaultDeviceScaleFactorInCompositor() const { return m_applyDefaultDeviceScaleFactorInCompositor; } + bool gestureTapHighlightEnabled() { return m_gestureTapHighlightEnabled; } WebSize defaultTileSize() const { return m_defaultTileSize; } WebSize maxUntiledLayerSize() const { return m_maxUntiledLayerSize; } @@ -168,6 +170,7 @@ private: bool m_renderVSyncEnabled; bool m_viewportEnabled; bool m_applyDefaultDeviceScaleFactorInCompositor; + bool m_gestureTapHighlightEnabled; WebSize m_defaultTileSize; WebSize m_maxUntiledLayerSize; }; diff --git a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp index 94404262c..5a5231fce 100644 --- a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp @@ -35,11 +35,11 @@ namespace WebKit { WebSolidColorLayer* WebSolidColorLayer::create() { - return new WebSolidColorLayerImpl(SolidColorLayerChromium::create()); + return new WebSolidColorLayerImpl(); } -WebSolidColorLayerImpl::WebSolidColorLayerImpl(PassRefPtr<SolidColorLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +WebSolidColorLayerImpl::WebSolidColorLayerImpl() + : m_layer(adoptPtr(new WebLayerImpl(SolidColorLayerChromium::create()))) { m_layer->layer()->setIsDrawable(true); } diff --git a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h index 7742ba492..f6e46e3ec 100644 --- a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h +++ b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h @@ -28,18 +28,13 @@ #include <public/WebSolidColorLayer.h> #include <wtf/OwnPtr.h> -#include <wtf/PassRefPtr.h> - -namespace WebCore { -class SolidColorLayerChromium; -} namespace WebKit { class WebLayerImpl; class WebSolidColorLayerImpl : public WebSolidColorLayer { public: - explicit WebSolidColorLayerImpl(PassRefPtr<WebCore::SolidColorLayerChromium>); + WebSolidColorLayerImpl(); virtual ~WebSolidColorLayerImpl(); // WebSolidColorLayer implementation. diff --git a/Source/WebKit/chromium/src/WebToCCInputHandlerAdapter.cpp b/Source/WebKit/chromium/src/WebToCCInputHandlerAdapter.cpp new file mode 100644 index 000000000..79049c97a --- /dev/null +++ b/Source/WebKit/chromium/src/WebToCCInputHandlerAdapter.cpp @@ -0,0 +1,128 @@ +/* + * 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 "WebToCCInputHandlerAdapter.h" + +#include <public/WebInputHandlerClient.h> + +#define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \ + COMPILE_ASSERT(int(WebKit::webkit_name) == int(WebCore::webcore_name), mismatching_enums) + +COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusOnMainThread, CCInputHandlerClient::ScrollOnMainThread); +COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusStarted, CCInputHandlerClient::ScrollStarted); +COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusIgnored, CCInputHandlerClient::ScrollIgnored); +COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeGesture, CCInputHandlerClient::Gesture); +COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeWheel, CCInputHandlerClient::Wheel); + +namespace WebKit { + +PassOwnPtr<WebToCCInputHandlerAdapter> WebToCCInputHandlerAdapter::create(PassOwnPtr<WebInputHandler> handler) +{ + return adoptPtr(new WebToCCInputHandlerAdapter(handler)); +} + +WebToCCInputHandlerAdapter::WebToCCInputHandlerAdapter(PassOwnPtr<WebInputHandler> handler) + : m_handler(handler) +{ +} + +WebToCCInputHandlerAdapter::~WebToCCInputHandlerAdapter() +{ +} + +class WebToCCInputHandlerAdapter::ClientAdapter : public WebInputHandlerClient { +public: + ClientAdapter(WebCore::CCInputHandlerClient* client) + : m_client(client) + { + } + + virtual ~ClientAdapter() + { + } + + virtual ScrollStatus scrollBegin(WebPoint point, ScrollInputType type) OVERRIDE + { + return static_cast<WebInputHandlerClient::ScrollStatus>(m_client->scrollBegin(point, static_cast<WebCore::CCInputHandlerClient::ScrollInputType>(type))); + } + + virtual void scrollBy(WebPoint point, WebSize offset) OVERRIDE + { + m_client->scrollBy(point, offset); + } + + virtual void scrollEnd() OVERRIDE + { + m_client->scrollEnd(); + } + + virtual void pinchGestureBegin() OVERRIDE + { + m_client->pinchGestureBegin(); + } + + virtual void pinchGestureUpdate(float magnifyDelta, WebPoint anchor) OVERRIDE + { + m_client->pinchGestureUpdate(magnifyDelta, anchor); + } + + virtual void pinchGestureEnd() OVERRIDE + { + m_client->pinchGestureEnd(); + } + + virtual void startPageScaleAnimation(WebSize targetPosition, + bool anchorPoint, + float pageScale, + double startTime, + double duration) OVERRIDE + { + m_client->startPageScaleAnimation(targetPosition, anchorPoint, pageScale, startTime, duration); + } + + virtual void scheduleAnimation() OVERRIDE + { + m_client->scheduleAnimation(); + } + +private: + WebCore::CCInputHandlerClient* m_client; +}; + + +void WebToCCInputHandlerAdapter::bindToClient(WebCore::CCInputHandlerClient* client) +{ + m_clientAdapter = adoptPtr(new ClientAdapter(client)); + m_handler->bindToClient(m_clientAdapter.get()); +} + +void WebToCCInputHandlerAdapter::animate(double monotonicTime) +{ + m_handler->animate(monotonicTime); +} + +} + diff --git a/Source/WebKit/chromium/src/WebScrollbarImpl.h b/Source/WebKit/chromium/src/WebToCCInputHandlerAdapter.h index 5c9231aaa..889553559 100644 --- a/Source/WebKit/chromium/src/WebScrollbarImpl.h +++ b/Source/WebKit/chromium/src/WebToCCInputHandlerAdapter.h @@ -22,43 +22,33 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebScrollbarImpl_h -#define WebScrollbarImpl_h +#ifndef WebToCCInputHandlerAdapter_h +#define WebToCCInputHandlerAdapter_h -#include <public/WebScrollbar.h> - -namespace WebCore { -class Scrollbar; -} +#include "CCInputHandler.h" +#include <public/WebInputHandler.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> namespace WebKit { -class WebScrollbarImpl : public WebScrollbar { +class WebToCCInputHandlerAdapter : public WebCore::CCInputHandler { public: - WebScrollbarImpl(WebCore::Scrollbar*); + static PassOwnPtr<WebToCCInputHandlerAdapter> create(PassOwnPtr<WebInputHandler>); + virtual ~WebToCCInputHandlerAdapter(); - // Implement WebKit::WebScrollbar methods - virtual bool isOverlay() const OVERRIDE; - virtual int value() const OVERRIDE; - virtual WebPoint location() const OVERRIDE; - virtual WebSize size() const OVERRIDE; - virtual bool enabled() const OVERRIDE; - virtual int maximum() const OVERRIDE; - virtual int totalSize() const OVERRIDE; - virtual bool isScrollViewScrollbar() const OVERRIDE; - virtual bool isScrollableAreaActive() const OVERRIDE; - virtual void getTickmarks(WebVector<WebRect>& tickmarks) const OVERRIDE; - virtual ScrollbarControlSize controlSize() const OVERRIDE; - virtual ScrollbarPart pressedPart() const OVERRIDE; - virtual ScrollbarPart hoveredPart() const OVERRIDE; - virtual ScrollbarOverlayStyle scrollbarOverlayStyle() const OVERRIDE; - virtual Orientation orientation() const OVERRIDE; - virtual bool isCustomScrollbar() const OVERRIDE; + // WebCore::CCInputHandler implementation. + virtual void bindToClient(WebCore::CCInputHandlerClient*) OVERRIDE; + virtual void animate(double monotonicTime) OVERRIDE; private: - RefPtr<WebCore::Scrollbar> m_scrollbar; + explicit WebToCCInputHandlerAdapter(PassOwnPtr<WebInputHandler>); + + class ClientAdapter; + OwnPtr<ClientAdapter> m_clientAdapter; + OwnPtr<WebInputHandler> m_handler; }; -} // namespace WebKit +} -#endif +#endif // WebToCCInputHandlerAdapter_h diff --git a/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.cpp b/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.cpp index 201042e95..69a12e8a9 100644 --- a/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.cpp +++ b/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.cpp @@ -36,11 +36,11 @@ namespace WebKit { WebTransformAnimationCurve* WebTransformAnimationCurve::create() { - return new WebTransformAnimationCurveImpl(WebCore::CCKeyframedTransformAnimationCurve::create()); + return new WebTransformAnimationCurveImpl(); } -WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl(PassOwnPtr<WebCore::CCKeyframedTransformAnimationCurve> curve) - : m_curve(curve) +WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl() + : m_curve(WebCore::CCKeyframedTransformAnimationCurve::create()) { } diff --git a/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.h b/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.h index 45a03ef06..bc9a9345a 100644 --- a/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.h +++ b/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.h @@ -38,7 +38,7 @@ namespace WebKit { class WebTransformAnimationCurveImpl : public WebTransformAnimationCurve { public: - explicit WebTransformAnimationCurveImpl(PassOwnPtr<WebCore::CCKeyframedTransformAnimationCurve>); + WebTransformAnimationCurveImpl(); virtual ~WebTransformAnimationCurveImpl(); // WebAnimationCurve implementation. diff --git a/Source/WebKit/chromium/src/WebVideoLayerImpl.cpp b/Source/WebKit/chromium/src/WebVideoLayerImpl.cpp index 5bfed6742..a8fdb4b4f 100644 --- a/Source/WebKit/chromium/src/WebVideoLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebVideoLayerImpl.cpp @@ -33,11 +33,11 @@ namespace WebKit { WebVideoLayer* WebVideoLayer::create(WebVideoFrameProvider* provider) { - return new WebVideoLayerImpl(WebCore::VideoLayerChromium::create(provider)); + return new WebVideoLayerImpl(provider); } -WebVideoLayerImpl::WebVideoLayerImpl(PassRefPtr<WebCore::VideoLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +WebVideoLayerImpl::WebVideoLayerImpl(WebVideoFrameProvider* provider) + : m_layer(adoptPtr(new WebLayerImpl(WebCore::VideoLayerChromium::create(provider)))) { } diff --git a/Source/WebKit/chromium/src/WebVideoLayerImpl.h b/Source/WebKit/chromium/src/WebVideoLayerImpl.h index 287e4b5e2..664935baf 100644 --- a/Source/WebKit/chromium/src/WebVideoLayerImpl.h +++ b/Source/WebKit/chromium/src/WebVideoLayerImpl.h @@ -28,16 +28,12 @@ #include <public/WebVideoLayer.h> -namespace WebCore { -class VideoLayerChromium; -} - namespace WebKit { class WebLayerImpl; class WebVideoLayerImpl : public WebVideoLayer { public: - explicit WebVideoLayerImpl(PassRefPtr<WebCore::VideoLayerChromium>); + explicit WebVideoLayerImpl(WebVideoFrameProvider*); virtual ~WebVideoLayerImpl(); // WebVideoLayer implementation. diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index c6f9f7e09..be474d8fa 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -119,13 +119,12 @@ #include "TextFieldDecoratorImpl.h" #include "TextIterator.h" #include "Timer.h" -#include "TouchpadFlingPlatformGestureCurve.h" #include "TraceEvent.h" #include "UserGestureIndicator.h" #include "WebAccessibilityObject.h" #include "WebActiveWheelFlingParameters.h" #include "WebAutofillClient.h" -#include "WebCompositorImpl.h" +#include "WebCompositorInputHandlerImpl.h" #include "WebDevToolsAgentImpl.h" #include "WebDevToolsAgentPrivate.h" #include "WebFrameImpl.h" @@ -145,13 +144,12 @@ #include "WebRuntimeFeatures.h" #include "WebSettingsImpl.h" #include "WebTextInputInfo.h" -#include "WebTouchCandidatesInfo.h" #include "WebViewClient.h" #include "WheelEvent.h" #include "painting/GraphicsContextBuilder.h" #include <public/Platform.h> -#include <public/WebCompositor.h> #include <public/WebCompositorOutputSurface.h> +#include <public/WebCompositorSupport.h> #include <public/WebDragData.h> #include <public/WebFloatPoint.h> #include <public/WebGraphicsContext3D.h> @@ -169,7 +167,9 @@ #include <wtf/Uint8ClampedArray.h> #if ENABLE(GESTURE_EVENTS) +#include "PlatformGestureCurveFactory.h" #include "PlatformGestureEvent.h" +#include "TouchDisambiguation.h" #endif #if OS(WINDOWS) @@ -416,6 +416,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) , m_recreatingGraphicsContext(false) , m_compositorSurfaceReady(false) , m_deviceScaleInCompositor(1) + , m_inputHandlerIdentifier(-1) #endif #if ENABLE(INPUT_SPEECH) , m_speechInputClient(SpeechInputClientImpl::create(client)) @@ -432,8 +433,8 @@ WebViewImpl::WebViewImpl(WebViewClient* client) #if ENABLE(MEDIA_STREAM) , m_userMediaClientImpl(this) #endif -#if ENABLE(REGISTER_PROTOCOL_HANDLER) - , m_registerProtocolHandlerClient(RegisterProtocolHandlerClientImpl::create(this)) +#if ENABLE(NAVIGATOR_CONTENT_UTILS) + , m_navigatorContentUtilsClient(NavigatorContentUtilsClientImpl::create(this)) #endif , m_flingModifier(0) { @@ -464,8 +465,8 @@ WebViewImpl::WebViewImpl(WebViewClient* client) #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) provideNotification(m_page.get(), notificationPresenterImpl()); #endif -#if ENABLE(REGISTER_PROTOCOL_HANDLER) - provideRegisterProtocolHandlerTo(m_page.get(), m_registerProtocolHandlerClient.get()); +#if ENABLE(NAVIGATOR_CONTENT_UTILS) + provideNavigatorContentUtilsTo(m_page.get(), m_navigatorContentUtilsClient.get()); #endif provideContextFeaturesTo(m_page.get(), m_featureSwitchClient.get()); @@ -638,17 +639,13 @@ void WebViewImpl::handleMouseUp(Frame& mainFrame, const WebMouseEvent& event) FrameView* view = m_page->mainFrame()->view(); IntPoint clickPoint(m_lastMouseDownPoint.x, m_lastMouseDownPoint.y); IntPoint contentPoint = view->windowToContents(clickPoint); - HitTestResult hitTestResult = focused->eventHandler()->hitTestResultAtPoint(contentPoint, false, false, ShouldHitTestScrollbars); + HitTestResult hitTestResult = focused->eventHandler()->hitTestResultAtPoint(contentPoint, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::TestChildFrameScrollBars); // We don't want to send a paste when middle clicking a scroll bar or a // link (which will navigate later in the code). The main scrollbars // have to be handled separately. if (!hitTestResult.scrollbar() && !hitTestResult.isLiveLink() && focused && !view->scrollbarAtPoint(clickPoint)) { Editor* editor = focused->editor(); - Pasteboard* pasteboard = Pasteboard::generalPasteboard(); - bool oldSelectionMode = pasteboard->isSelectionMode(); - pasteboard->setSelectionMode(true); - editor->command(AtomicString("Paste")).execute(); - pasteboard->setSelectionMode(oldSelectionMode); + editor->command(AtomicString("PasteGlobalSelection")).execute(); } } #endif @@ -688,11 +685,13 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) { switch (event.type) { case WebInputEvent::GestureFlingStart: { + m_client->cancelScheduledContentIntents(); m_lastWheelPosition = WebPoint(event.x, event.y); m_lastWheelGlobalPosition = WebPoint(event.globalX, event.globalY); m_flingModifier = event.modifiers; // FIXME: Make the curve parametrizable from the browser. - m_gestureAnimation = ActivePlatformGestureAnimation::create(TouchpadFlingPlatformGestureCurve::create(FloatPoint(event.deltaX, event.deltaY)), this); + OwnPtr<PlatformGestureCurve> flingCurve = PlatformGestureCurveFactory::get()->createCurve(event.data.flingStart.sourceDevice, FloatPoint(event.data.flingStart.velocityX, event.data.flingStart.velocityY)); + m_gestureAnimation = ActivePlatformGestureAnimation::create(flingCurve.release(), this); scheduleAnimation(); return true; } @@ -703,12 +702,28 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) } return false; case WebInputEvent::GestureTap: { - PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); + m_client->cancelScheduledContentIntents(); + if (detectContentOnTouch(WebPoint(event.x, event.y), event.type)) + return true; + RefPtr<WebCore::PopupContainer> selectPopup; selectPopup = m_selectPopup; hideSelectPopup(); ASSERT(!m_selectPopup); + + if (event.data.tap.width > 0) { + IntRect boundingBox(event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2, event.data.tap.width, event.data.tap.height); + Vector<IntRect> goodTargets; + findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), pageScaleFactor(), goodTargets); + // FIXME: replace touch adjustment code when numberOfGoodTargets == 1? + // Single candidate case is currently handled by: https://bugs.webkit.org/show_bug.cgi?id=85101 + if (goodTargets.size() >= 2 && m_client && m_client->didTapMultipleTargets(event, goodTargets)) + return true; + } + + PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); bool gestureHandled = mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent); + if (m_selectPopup && m_selectPopup == selectPopup) { // That tap triggered a select popup which is the same as the one that // was showing before the tap. It means the user tapped the select @@ -716,6 +731,7 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) // immediately reopened the select popup. It needs to be closed. hideSelectPopup(); } + return gestureHandled; } case WebInputEvent::GestureTwoFingerTap: @@ -723,6 +739,10 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) if (!mainFrameImpl() || !mainFrameImpl()->frameView()) return false; + m_client->cancelScheduledContentIntents(); + if (detectContentOnTouch(WebPoint(event.x, event.y), event.type)) + return true; + m_page->contextMenuController()->clearContextMenu(); m_contextMenuAllowed = true; PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); @@ -731,18 +751,21 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) return handled; } case WebInputEvent::GestureTapDown: { + m_client->cancelScheduledContentIntents(); // Queue a highlight animation, then hand off to regular handler. #if OS(LINUX) - enableTouchHighlight(IntPoint(event.x, event.y)); + if (settingsImpl()->gestureTapHighlightEnabled()) + enableTouchHighlight(IntPoint(event.x, event.y)); #endif PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); return mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent); } + case WebInputEvent::GestureDoubleTap: case WebInputEvent::GestureScrollBegin: + case WebInputEvent::GesturePinchBegin: + m_client->cancelScheduledContentIntents(); case WebInputEvent::GestureScrollEnd: case WebInputEvent::GestureScrollUpdate: - case WebInputEvent::GestureDoubleTap: - case WebInputEvent::GesturePinchBegin: case WebInputEvent::GesturePinchEnd: case WebInputEvent::GesturePinchUpdate: { PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); @@ -761,20 +784,20 @@ void WebViewImpl::transferActiveWheelFlingAnimation(const WebActiveWheelFlingPar m_lastWheelPosition = parameters.point; m_lastWheelGlobalPosition = parameters.globalPoint; m_flingModifier = parameters.modifiers; - OwnPtr<PlatformGestureCurve> curve = TouchpadFlingPlatformGestureCurve::create(parameters.delta, IntPoint(parameters.cumulativeScroll)); + OwnPtr<PlatformGestureCurve> curve = PlatformGestureCurveFactory::get()->createCurve(parameters.sourceDevice, parameters.delta, IntPoint(parameters.cumulativeScroll)); m_gestureAnimation = ActivePlatformGestureAnimation::create(curve.release(), this, parameters.startTime); scheduleAnimation(); } void WebViewImpl::renderingStats(WebRenderingStats& stats) const { - if (!m_layerTreeView.isNull()) - m_layerTreeView.renderingStats(stats); + if (m_layerTreeView) + m_layerTreeView->renderingStats(stats); } void WebViewImpl::startPageScaleAnimation(const IntPoint& targetPosition, bool useAnchor, float newScale, double durationInSeconds) { - if (m_layerTreeView.isNull()) + if (!m_layerTreeView) return; IntPoint clampedPoint = targetPosition; @@ -786,7 +809,7 @@ void WebViewImpl::startPageScaleAnimation(const IntPoint& targetPosition, bool u return; } - m_layerTreeView.startPageScaleAnimation(targetPosition, useAnchor, newScale, durationInSeconds); + m_layerTreeView->startPageScaleAnimation(targetPosition, useAnchor, newScale, durationInSeconds); } #endif @@ -795,17 +818,6 @@ WebViewBenchmarkSupport* WebViewImpl::benchmarkSupport() return &m_benchmarkSupport; } -WebVector<WebFloatQuad> WebViewImpl::getTouchHighlightQuads(const WebPoint& point, - int padding, - WebTouchCandidatesInfo& outTouchInfo, - WebColor& outTapHighlightColor) -{ - // FIXME: Upstream this function from the chromium-android branch. - notImplemented(); - - return WebVector<WebFloatQuad>(); -} - bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event) { ASSERT((event.type == WebInputEvent::RawKeyDown) @@ -992,9 +1004,8 @@ WebRect WebViewImpl::computeBlockBounds(const WebRect& rect, AutoZoomType zoomTy // Use the rect-based hit test to find the node. IntPoint point = mainFrameImpl()->frameView()->windowToContents(IntPoint(rect.x, rect.y)); - HitTestResult result = mainFrameImpl()->frame()->eventHandler()->hitTestResultAtPoint(point, - false, zoomType == FindInPage, DontHitTestScrollbars, HitTestRequest::Active | HitTestRequest::ReadOnly, - IntSize(rect.width, rect.height)); + HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active | ((zoomType == FindInPage) ? HitTestRequest::IgnoreClipping : 0); + HitTestResult result = mainFrameImpl()->frame()->eventHandler()->hitTestResultAtPoint(point, hitType, IntSize(rect.width, rect.height)); Node* node = result.innerNonSharedNode(); if (!node) @@ -1006,7 +1017,7 @@ WebRect WebViewImpl::computeBlockBounds(const WebRect& rect, AutoZoomType zoomTy // Return the bounding box in the window coordinate system. if (node) { - IntRect rect = node->Node::getPixelSnappedRect(); + IntRect rect = node->Node::pixelSnappedBoundingBox(); Frame* frame = node->document()->frame(); return frame->view()->contentsToWindow(rect); } @@ -1128,8 +1139,7 @@ void WebViewImpl::computeScaleAndScrollForHitRect(const WebRect& hitRect, AutoZo static bool highlightConditions(Node* node) { - return node->isLink() - || node->supportsFocus() + return node->supportsFocus() || node->hasEventListeners(eventNames().clickEvent) || node->hasEventListeners(eventNames().mousedownEvent) || node->hasEventListeners(eventNames().mouseupEvent); @@ -1150,11 +1160,20 @@ Node* WebViewImpl::bestTouchLinkNode(IntPoint touchEventLocation) while (bestTouchNode && !highlightConditions(bestTouchNode)) bestTouchNode = bestTouchNode->parentNode(); + // If the document has click handlers installed, we don't want to default to applying the highlight to the entire RenderView, or the + // entire body. Also, if the node has non-auto Z-index, we cannot be sure of it's ordering with respect to other possible target nodes. + RenderObject* touchNodeRenderer = bestTouchNode ? bestTouchNode->renderer() : 0; + if (bestTouchNode && (!touchNodeRenderer || touchNodeRenderer->isRenderView() || touchNodeRenderer->isBody() || !touchNodeRenderer->style()->hasAutoZIndex())) + return 0; + return bestTouchNode; } void WebViewImpl::enableTouchHighlight(IntPoint touchEventLocation) { + // Always clear any existing highlight when this is invoked, even if we don't get a new target to highlight. + m_linkHighlight.clear(); + Node* touchNode = bestTouchLinkNode(touchEventLocation); if (!touchNode || !touchNode->renderer() || !touchNode->renderer()->enclosingLayer()) @@ -1167,7 +1186,6 @@ void WebViewImpl::enableTouchHighlight(IntPoint touchEventLocation) if (!highlightColor.alpha()) return; - // This will clear any highlight currently being displayed. m_linkHighlight = LinkHighlight::create(touchNode, this); m_linkHighlight->startHighlightAnimation(); } @@ -1650,8 +1668,8 @@ void WebViewImpl::updateBatteryStatus(const WebBatteryStatus& status) void WebViewImpl::setCompositorSurfaceReady() { m_compositorSurfaceReady = true; - if (!m_layerTreeView.isNull()) - m_layerTreeView.setSurfaceReady(); + if (m_layerTreeView) + m_layerTreeView->setSurfaceReady(); } void WebViewImpl::animate(double) @@ -1663,7 +1681,7 @@ void WebViewImpl::animate(double) // In composited mode, we always go through the compositor so it can apply // appropriate flow-control mechanisms. if (isAcceleratedCompositingActive()) - m_layerTreeView.updateAnimations(monotonicFrameBeginTime); + m_layerTreeView->updateAnimations(monotonicFrameBeginTime); else #endif updateAnimations(monotonicFrameBeginTime); @@ -1717,7 +1735,7 @@ void WebViewImpl::layout() #if USE(ACCELERATED_COMPOSITING) void WebViewImpl::doPixelReadbackToCanvas(WebCanvas* canvas, const IntRect& rect) { - ASSERT(!m_layerTreeView.isNull()); + ASSERT(m_layerTreeView); PlatformContextSkia context(canvas); @@ -1731,7 +1749,7 @@ void WebViewImpl::doPixelReadbackToCanvas(WebCanvas* canvas, const IntRect& rect OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(rect.size())); RefPtr<Uint8ClampedArray> pixelArray(Uint8ClampedArray::createUninitialized(rect.width() * rect.height() * 4)); if (imageBuffer && pixelArray) { - m_layerTreeView.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)); @@ -1759,7 +1777,7 @@ void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect, PaintOptions opt if (canvas) { // Clip rect to the confines of the rootLayerTexture. IntRect resizeRect(rect); - resizeRect.intersect(IntRect(IntPoint(0, 0), m_layerTreeView.deviceViewportSize())); + resizeRect.intersect(IntRect(IntPoint(0, 0), m_layerTreeView->deviceViewportSize())); doPixelReadbackToCanvas(canvas, resizeRect); } #endif @@ -1798,8 +1816,8 @@ void WebViewImpl::themeChanged() void WebViewImpl::composite(bool) { #if USE(ACCELERATED_COMPOSITING) - if (WebCompositor::threadingEnabled()) - m_layerTreeView.setNeedsRedraw(); + if (Platform::current()->compositorSupport()->isThreadingEnabled()) + m_layerTreeView->setNeedsRedraw(); else { ASSERT(isAcceleratedCompositingActive()); if (!page()) @@ -1808,7 +1826,7 @@ void WebViewImpl::composite(bool) if (m_pageOverlays) m_pageOverlays->update(); - m_layerTreeView.composite(); + m_layerTreeView->composite(); } #endif } @@ -1816,16 +1834,16 @@ void WebViewImpl::composite(bool) void WebViewImpl::setNeedsRedraw() { #if USE(ACCELERATED_COMPOSITING) - if (!m_layerTreeView.isNull() && isAcceleratedCompositingActive()) - m_layerTreeView.setNeedsRedraw(); + if (m_layerTreeView && isAcceleratedCompositingActive()) + m_layerTreeView->setNeedsRedraw(); #endif } bool WebViewImpl::isInputThrottled() const { #if USE(ACCELERATED_COMPOSITING) - if (!m_layerTreeView.isNull() && isAcceleratedCompositingActive()) - return m_layerTreeView.commitRequested(); + if (m_layerTreeView && isAcceleratedCompositingActive()) + return m_layerTreeView->commitRequested(); #endif return false; } @@ -1833,8 +1851,8 @@ bool WebViewImpl::isInputThrottled() const void WebViewImpl::loseCompositorContext(int numTimes) { #if USE(ACCELERATED_COMPOSITING) - if (!m_layerTreeView.isNull()) - m_layerTreeView.loseCompositorContext(numTimes); + if (m_layerTreeView) + m_layerTreeView->loseCompositorContext(numTimes); #endif } @@ -2761,9 +2779,9 @@ void WebViewImpl::setDeviceScaleFactor(float scaleFactor) page()->setDeviceScaleFactor(scaleFactor); - if (!m_layerTreeView.isNull() && m_webSettings->applyDefaultDeviceScaleFactorInCompositor()) { + if (m_layerTreeView && m_webSettings->applyDefaultDeviceScaleFactorInCompositor()) { m_deviceScaleInCompositor = page()->deviceScaleFactor(); - m_layerTreeView.setDeviceScaleFactor(m_deviceScaleInCompositor); + m_layerTreeView->setDeviceScaleFactor(m_deviceScaleInCompositor); } if (m_deviceScaleInCompositor != 1) { // Don't allow page scaling when compositor scaling is being used, @@ -2858,8 +2876,8 @@ bool WebViewImpl::computePageScaleFactorLimits() float clampedScale = clampPageScaleFactorToLimits(pageScaleFactor()); #if USE(ACCELERATED_COMPOSITING) - if (!m_layerTreeView.isNull()) - m_layerTreeView.setPageScaleFactorAndLimits(clampedScale, m_minimumPageScaleFactor, m_maximumPageScaleFactor); + if (m_layerTreeView) + m_layerTreeView->setPageScaleFactorAndLimits(clampedScale, m_minimumPageScaleFactor, m_maximumPageScaleFactor); #endif if (clampedScale != pageScaleFactor()) { setPageScaleFactorPreservingScrollOffset(clampedScale); @@ -3290,7 +3308,7 @@ void WebViewImpl::applyAutofillSuggestions( refreshAutofillPopup(); } else { m_autofillPopupShowing = true; - m_autofillPopup->showInRect(focusedNode->getPixelSnappedRect(), focusedNode->ownerDocument()->view(), 0); + m_autofillPopup->showInRect(focusedNode->pixelSnappedBoundingBox(), focusedNode->ownerDocument()->view(), 0); } } @@ -3334,8 +3352,8 @@ void WebViewImpl::setIsTransparent(bool isTransparent) if (m_nonCompositedContentHost) m_nonCompositedContentHost->setOpaque(!isTransparent); - if (!m_layerTreeView.isNull()) - m_layerTreeView.setHasTransparentBackground(isTransparent); + if (m_layerTreeView) + m_layerTreeView->setHasTransparentBackground(isTransparent); } bool WebViewImpl::isTransparent() const @@ -3390,7 +3408,7 @@ void WebView::addUserScript(const WebString& sourceCode, patterns->append(patternsIn[i]); PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName); - RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::create()); + RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::createUninitializedWorld()); pageGroup->addUserScriptToWorld(world.get(), sourceCode, WebURL(), patterns.release(), nullptr, static_cast<UserScriptInjectionTime>(injectAt), static_cast<UserContentInjectedFrames>(injectIn)); @@ -3406,7 +3424,7 @@ void WebView::addUserStyleSheet(const WebString& sourceCode, patterns->append(patternsIn[i]); PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName); - RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::create()); + RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::createUninitializedWorld()); // FIXME: Current callers always want the level to be "author". It probably makes sense to let // callers specify this though, since in other cases the caller will probably want "user" level. @@ -3438,6 +3456,8 @@ void WebViewImpl::didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPa if (*isNewNavigation && !isNavigationWithinPage) m_pageScaleFactorIsSet = false; + // Make sure link highlight from previous page is cleared. + m_linkHighlight.clear(); m_gestureAnimation.clear(); resetSavedScrollAndScaleState(); } @@ -3596,7 +3616,7 @@ void WebViewImpl::refreshAutofillPopup() return; } - WebRect newWidgetRect = m_autofillPopup->refresh(focusedWebCoreNode()->getPixelSnappedRect()); + WebRect newWidgetRect = m_autofillPopup->refresh(focusedWebCoreNode()->pixelSnappedBoundingBox()); // Let's resize the backing window if necessary. WebPopupMenuImpl* popupMenu = static_cast<WebPopupMenuImpl*>(m_autofillPopup->client()); if (popupMenu && popupMenu->client()->windowRect() != newWidgetRect) @@ -3655,8 +3675,12 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) m_nonCompositedContentHost->setScrollLayer(scrollLayer); } - if (!m_layerTreeView.isNull()) - m_layerTreeView.setRootLayer(m_rootLayer); + if (m_layerTreeView) { + if (m_rootLayer) + m_layerTreeView->setRootLayer(*m_rootLayer); + else + m_layerTreeView->clearRootLayer(); + } IntRect damagedRect(0, 0, m_size.width, m_size.height); if (!m_isAcceleratedCompositingActive) @@ -3665,7 +3689,7 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) void WebViewImpl::scheduleCompositingLayerSync() { - m_layerTreeView.setNeedsRedraw(); + m_layerTreeView->setNeedsRedraw(); } void WebViewImpl::scrollRootLayerRect(const IntSize&, const IntRect&) @@ -3675,7 +3699,7 @@ void WebViewImpl::scrollRootLayerRect(const IntSize&, const IntRect&) void WebViewImpl::invalidateRootLayerRect(const IntRect& rect) { - ASSERT(!m_layerTreeView.isNull()); + ASSERT(m_layerTreeView); if (!page()) return; @@ -3696,7 +3720,7 @@ void WebViewImpl::setBackgroundColor(const WebCore::Color& color) WebCore::Color documentBackgroundColor = color.isValid() ? color : WebCore::Color::white; WebColor webDocumentBackgroundColor = documentBackgroundColor.rgb(); m_nonCompositedContentHost->setBackgroundColor(documentBackgroundColor); - m_layerTreeView.setBackgroundColor(webDocumentBackgroundColor); + m_layerTreeView->setBackgroundColor(webDocumentBackgroundColor); } WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer() @@ -3708,9 +3732,9 @@ WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer() void WebViewImpl::scheduleAnimation() { if (isAcceleratedCompositingActive()) { - if (WebCompositor::threadingEnabled()) { - ASSERT(!m_layerTreeView.isNull()); - m_layerTreeView.setNeedsAnimate(); + if (Platform::current()->compositorSupport()->isThreadingEnabled()) { + ASSERT(m_layerTreeView); + m_layerTreeView->setNeedsAnimate(); } else m_client->scheduleAnimation(); } else @@ -3744,14 +3768,14 @@ 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_layerTreeView.isNull()) - m_layerTreeView.finishAllRendering(); + if (m_layerTreeView) + m_layerTreeView->finishAllRendering(); m_client->didDeactivateCompositor(); - } else if (!m_layerTreeView.isNull()) { + } else if (m_layerTreeView) { m_isAcceleratedCompositingActive = true; updateLayerTreeViewport(); - m_client->didActivateCompositor(m_layerTreeView.compositorIdentifier()); + m_client->didActivateCompositor(m_inputHandlerIdentifier); } else { TRACE_EVENT0("webkit", "WebViewImpl::setIsAcceleratedCompositingActive(true)"); @@ -3769,8 +3793,8 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->showDebugBorders()); m_nonCompositedContentHost->setOpaque(!isTransparent()); - m_layerTreeView.initialize(this, *m_rootLayer, layerTreeViewSettings); - if (!m_layerTreeView.isNull()) { + m_layerTreeView = adoptPtr(Platform::current()->compositorSupport()->createLayerTreeView(this, *m_rootLayer, layerTreeViewSettings)); + if (m_layerTreeView) { if (m_webSettings->applyDefaultDeviceScaleFactorInCompositor() && page()->deviceScaleFactor() != 1) { ASSERT(page()->deviceScaleFactor()); @@ -3779,13 +3803,13 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) } bool visible = page()->visibilityState() == PageVisibilityStateVisible; - m_layerTreeView.setVisible(visible); - m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor); + m_layerTreeView->setVisible(visible); + m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor); if (m_compositorSurfaceReady) - m_layerTreeView.setSurfaceReady(); - m_layerTreeView.setHasTransparentBackground(isTransparent()); + m_layerTreeView->setSurfaceReady(); + m_layerTreeView->setHasTransparentBackground(isTransparent()); updateLayerTreeViewport(); - m_client->didActivateCompositor(m_layerTreeView.compositorIdentifier()); + m_client->didActivateCompositor(m_inputHandlerIdentifier); m_isAcceleratedCompositingActive = true; m_compositorCreationFailed = false; if (m_pageOverlays) @@ -3797,7 +3821,7 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) WebRect asciiToRectTable[128]; int fontHeight; SkBitmap bitmap = WebCore::CompositorHUDFontAtlas::generateFontAtlas(asciiToRectTable, fontHeight); - m_layerTreeView.setFontAtlas(bitmap, asciiToRectTable, fontHeight); + m_layerTreeView->setFontAtlas(bitmap, asciiToRectTable, fontHeight); } } else { m_nonCompositedContentHost.clear(); @@ -3871,6 +3895,13 @@ WebCompositorOutputSurface* WebViewImpl::createOutputSurface() return m_client->createOutputSurface(); } +WebInputHandler* WebViewImpl::createInputHandler() +{ + WebCompositorInputHandlerImpl* handler = new WebCompositorInputHandlerImpl(); + m_inputHandlerIdentifier = handler->identifier(); + return handler; +} + void WebViewImpl::applyScrollAndScale(const WebSize& scrollDelta, float pageScaleDelta) { if (!mainFrameImpl() || !mainFrameImpl()->frameView()) @@ -3941,29 +3972,29 @@ void WebViewImpl::didRecreateOutputSurface(bool success) void WebViewImpl::scheduleComposite() { - ASSERT(!WebCompositor::threadingEnabled()); + ASSERT(!Platform::current()->compositorSupport()->isThreadingEnabled()); m_client->scheduleComposite(); } void WebViewImpl::updateLayerTreeViewport() { - if (!page() || !m_nonCompositedContentHost || m_layerTreeView.isNull()) + if (!page() || !m_nonCompositedContentHost || !m_layerTreeView) return; FrameView* view = page()->mainFrame()->view(); IntRect visibleRect = view->visibleContentRect(true /* include scrollbars */); IntPoint scroll(view->scrollX(), view->scrollY()); - // This part of the deviceScale will be used to scale the contents of - // the NCCH's GraphicsLayer. - float deviceScale = m_deviceScaleInCompositor; - m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll, view->scrollOrigin(), deviceScale); + m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll, view->scrollOrigin()); IntSize layoutViewportSize = size(); IntSize deviceViewportSize = size(); - deviceViewportSize.scale(deviceScale); - m_layerTreeView.setViewportSize(layoutViewportSize, deviceViewportSize); - m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor); + + // This part of the deviceScale will be used to scale the contents of + // the NCCH's GraphicsLayer. + deviceViewportSize.scale(m_deviceScaleInCompositor); + m_layerTreeView->setViewportSize(layoutViewportSize, deviceViewportSize); + m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor); } WebGraphicsContext3D* WebViewImpl::sharedGraphicsContext3D() @@ -3982,7 +4013,10 @@ void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex) bool WebViewImpl::detectContentOnTouch(const WebPoint& position, WebInputEvent::Type touchType) { - ASSERT(touchType == WebInputEvent::GestureTap || touchType == WebInputEvent::GestureLongPress); + ASSERT(touchType == WebInputEvent::GestureTap + || touchType == WebInputEvent::GestureTwoFingerTap + || touchType == WebInputEvent::GestureLongPress); + HitTestResult touchHit = hitTestResultForWindowPos(position); if (touchHit.isContentEditable()) @@ -3992,13 +4026,20 @@ bool WebViewImpl::detectContentOnTouch(const WebPoint& position, WebInputEvent:: if (!node || !node->isTextNode()) return false; - // FIXME: Should we not detect content intents in nodes that have event listeners? + // Ignore when tapping on links or nodes listening to click events, unless the click event is on the + // body element, in which case it's unlikely that the original node itself was intended to be clickable. + for (; node && !node->hasTagName(HTMLNames::bodyTag); node = node->parentNode()) { + if (node->isLink() || (touchType == WebInputEvent::GestureTap + && (node->willRespondToTouchEvents() || node->willRespondToMouseClickEvents()))) { + return false; + } + } WebContentDetectionResult content = m_client->detectContentAround(touchHit); if (!content.isValid()) return false; - if (touchType == WebInputEvent::GestureLongPress) { + if (touchType != WebInputEvent::GestureTap) { // Select the detected content as a block. focusedFrame()->selectRange(content.range()); return true; @@ -4022,9 +4063,9 @@ void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, #endif #if USE(ACCELERATED_COMPOSITING) - if (!m_layerTreeView.isNull()) { + if (m_layerTreeView) { bool visible = visibilityState == WebPageVisibilityStateVisible; - m_layerTreeView.setVisible(visible); + m_layerTreeView->setVisible(visible); } #endif } diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index 206cf4572..ce5657a2b 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -52,7 +52,6 @@ #include "WebViewBenchmarkSupportImpl.h" #include <public/WebFloatQuad.h> #include <public/WebLayer.h> -#include <public/WebLayerTreeView.h> #include <public/WebLayerTreeViewClient.h> #include <public/WebPoint.h> #include <public/WebRect.h> @@ -95,7 +94,6 @@ class DeviceOrientationClientProxy; class DragScrollTimer; class GeolocationClientProxy; class LinkHighlight; -class WebHelperPluginImpl; class NonCompositedContentHost; class PrerendererClientImpl; class SpeechInputClientImpl; @@ -107,15 +105,17 @@ class WebDevToolsAgentClient; class WebDevToolsAgentPrivate; class WebFrameImpl; class WebGestureEvent; -class WebPagePopupImpl; -class WebPrerendererClient; -class WebViewBenchmarkSupport; +class WebHelperPluginImpl; class WebImage; class WebKeyboardEvent; +class WebLayerTreeView; class WebMouseEvent; class WebMouseWheelEvent; +class WebPagePopupImpl; +class WebPrerendererClient; class WebSettingsImpl; class WebTouchEvent; +class WebViewBenchmarkSupport; class WebViewImpl : public WebView , public WebLayerTreeViewClient @@ -305,11 +305,6 @@ public: virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&); virtual WebViewBenchmarkSupport* benchmarkSupport(); - virtual WebVector<WebFloatQuad> getTouchHighlightQuads(const WebPoint&, - int padding, - WebTouchCandidatesInfo& outTouchInfo, - WebColor& outTapHighlightColor); - // WebLayerTreeViewClient virtual void willBeginFrame(); virtual void didBeginFrame(); @@ -319,6 +314,7 @@ public: virtual void didRebindGraphicsContext(bool success) OVERRIDE; virtual WebCompositorOutputSurface* createOutputSurface() OVERRIDE; virtual void didRecreateOutputSurface(bool success) OVERRIDE; + virtual WebInputHandler* createInputHandler() OVERRIDE; virtual void willCommit(); virtual void didCommit(); virtual void didCommitAndDrawFrame(); @@ -824,7 +820,7 @@ private: #if USE(ACCELERATED_COMPOSITING) WebCore::IntRect m_rootLayerScrollDamage; OwnPtr<NonCompositedContentHost> m_nonCompositedContentHost; - WebLayerTreeView m_layerTreeView; + OwnPtr<WebLayerTreeView> m_layerTreeView; WebLayer* m_rootLayer; WebCore::GraphicsLayer* m_rootGraphicsLayer; bool m_isAcceleratedCompositingActive; @@ -833,6 +829,7 @@ private: bool m_recreatingGraphicsContext; bool m_compositorSurfaceReady; float m_deviceScaleInCompositor; + int m_inputHandlerIdentifier; #endif static const WebInputEvent* m_currentInputEvent; @@ -854,8 +851,8 @@ private: #if ENABLE(MEDIA_STREAM) UserMediaClientImpl m_userMediaClientImpl; #endif -#if ENABLE(REGISTER_PROTOCOL_HANDLER) - OwnPtr<RegisterProtocolHandlerClientImpl> m_registerProtocolHandlerClient; +#if ENABLE(NAVIGATOR_CONTENT_UTILS) + OwnPtr<NavigatorContentUtilsClientImpl> m_navigatorContentUtilsClient; #endif OwnPtr<WebCore::ActivePlatformGestureAnimation> m_gestureAnimation; WebPoint m_lastWheelPosition; diff --git a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h index fa70dd261..5c0a59084 100644 --- a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h +++ b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h @@ -33,7 +33,6 @@ #if ENABLE(FILE_SYSTEM) && ENABLE(WORKERS) -#include "PlatformString.h" #include "ScriptExecutionContext.h" #include "WebFileError.h" #include "platform/WebVector.h" @@ -41,6 +40,7 @@ #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/Threading.h> +#include <wtf/text/WTFString.h> namespace WebCore { class WorkerLoaderProxy; diff --git a/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp b/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp index fb723223b..9bc70faca 100644 --- a/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp +++ b/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp @@ -50,7 +50,9 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(WebInputEvent::Type type, result.type = type; result.modifiers = modifiers; result.timeStampSeconds = timeStampSeconds; - result.windowsKeyCode = WebCore::windowsKeyCodeForKeyEvent(keycode); + int windowsKeyCode = WebCore::windowsKeyCodeForKeyEvent(keycode); + result.windowsKeyCode = WebKeyboardEvent::windowsKeyCodeWithoutLocation(windowsKeyCode); + result.modifiers |= WebKeyboardEvent::locationModifiersFromWindowsKeyCode(windowsKeyCode); result.nativeKeyCode = keycode; result.unmodifiedText[0] = unicodeCharacter; if (result.windowsKeyCode == WebCore::VKEY_RETURN) { diff --git a/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp b/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp index 43c238a69..207d34f01 100644 --- a/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp +++ b/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp @@ -383,7 +383,9 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(const GdkEventKey* event) // The key code tells us which physical key was pressed (for example, the // A key went down or up). It does not determine whether A should be lower // or upper case. This is what text does, which should be the keyval. - result.windowsKeyCode = gdkEventToWindowsKeyCode(event); + int windowsKeyCode = gdkEventToWindowsKeyCode(event); + result.windowsKeyCode = WebKeyboardEvent::windowsKeyCodeWithoutLocation(windowsKeyCode); + result.modifiers |= WebKeyboardEvent::locationModifiersFromWindowsKeyCode(windowsKeyCode); result.nativeKeyCode = event->hardware_keycode; if (result.windowsKeyCode == WebCore::VKEY_RETURN) diff --git a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm index babb1f6cc..b3a22fee1 100644 --- a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm +++ b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm @@ -606,7 +606,9 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(NSEvent* event) if (([event type] != NSFlagsChanged) && [event isARepeat]) result.modifiers |= WebInputEvent::IsAutoRepeat; - result.windowsKeyCode = windowsKeyCodeForKeyEvent(event); + int windowsKeyCode = windowsKeyCodeForKeyEvent(event); + result.windowsKeyCode = WebKeyboardEvent::windowsKeyCodeWithoutLocation(windowsKeyCode); + result.modifiers |= WebKeyboardEvent::locationModifiersFromWindowsKeyCode(windowsKeyCode); result.nativeKeyCode = [event keyCode]; NSString* textStr = textFromEvent(event); diff --git a/Source/WebKit/chromium/src/win/WebInputEventFactory.cpp b/Source/WebKit/chromium/src/win/WebInputEventFactory.cpp index 9da4b4a27..a177ea244 100644 --- a/Source/WebKit/chromium/src/win/WebInputEventFactory.cpp +++ b/Source/WebKit/chromium/src/win/WebInputEventFactory.cpp @@ -42,12 +42,18 @@ static const unsigned long defaultScrollCharsPerWheelDelta = 1; // WebKeyboardEvent ----------------------------------------------------------- -static bool isKeyPad(WPARAM wparam, LPARAM lparam) +static bool isKeyDown(WPARAM wparam) { - bool keypad = false; + return GetKeyState(wparam) & 0x8000; +} + +static int getLocationModifier(WPARAM wparam, LPARAM lparam) +{ + int modifier = 0; switch (wparam) { case VK_RETURN: - keypad = (lparam >> 16) & KF_EXTENDED; + if ((lparam >> 16) & KF_EXTENDED) + modifier = WebInputEvent::IsKeyPad; break; case VK_INSERT: case VK_DELETE: @@ -59,7 +65,8 @@ static bool isKeyPad(WPARAM wparam, LPARAM lparam) case VK_DOWN: case VK_LEFT: case VK_RIGHT: - keypad = !((lparam >> 16) & KF_EXTENDED); + if (!((lparam >> 16) & KF_EXTENDED)) + modifier = WebInputEvent::IsKeyPad; break; case VK_NUMLOCK: case VK_NUMPAD0: @@ -78,12 +85,39 @@ static bool isKeyPad(WPARAM wparam, LPARAM lparam) case VK_ADD: case VK_DECIMAL: case VK_CLEAR: - keypad = true; + modifier = WebInputEvent::IsKeyPad; + break; + case VK_SHIFT: + if (isKeyDown(VK_LSHIFT)) + modifier = WebInputEvent::IsLeft; + else if (isKeyDown(VK_RSHIFT)) + modifier = WebInputEvent::IsRight; + break; + case VK_CONTROL: + if (isKeyDown(VK_LCONTROL)) + modifier = WebInputEvent::IsLeft; + else if (isKeyDown(VK_RCONTROL)) + modifier = WebInputEvent::IsRight; + break; + case VK_MENU: + if (isKeyDown(VK_LMENU)) + modifier = WebInputEvent::IsLeft; + else if (isKeyDown(VK_RMENU)) + modifier = WebInputEvent::IsRight; + break; + case VK_LWIN: + modifier = WebInputEvent::IsLeft; + break; + case VK_RWIN: + modifier = WebInputEvent::IsRight; break; - default: - keypad = false; } - return keypad; + + ASSERT(!modifier + || modifier == WebInputEvent::IsKeyPad + || modifier == WebInputEvent::IsLeft + || modifier == WebInputEvent::IsRight); + return modifier; } // Loads the state for toggle keys into the event. @@ -153,8 +187,8 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(HWND hwnd, UINT message, if (LOWORD(lparam) > 1) result.modifiers |= WebInputEvent::IsAutoRepeat; - if (isKeyPad(wparam, lparam)) - result.modifiers |= WebInputEvent::IsKeyPad; + + result.modifiers |= getLocationModifier(wparam, lparam); SetToggleKeyState(&result); return result; diff --git a/Source/WebKit/chromium/tests/AnimationTranslationUtilTest.cpp b/Source/WebKit/chromium/tests/AnimationTranslationUtilTest.cpp index 70da65ef6..7b184fa34 100644 --- a/Source/WebKit/chromium/tests/AnimationTranslationUtilTest.cpp +++ b/Source/WebKit/chromium/tests/AnimationTranslationUtilTest.cpp @@ -31,6 +31,7 @@ #include "IntSize.h" #include "Matrix3DTransformOperation.h" #include "RotateTransformOperation.h" +#include "ScaleTransformOperation.h" #include "TransformOperations.h" #include "TranslateTransformOperation.h" #include <gtest/gtest.h> @@ -45,7 +46,7 @@ namespace { bool animationCanBeTranslated(const KeyframeValueList& values, Animation* animation) { IntSize boxSize; - return createWebAnimation(values, animation, 0, 0, 0, boxSize); + return createWebAnimation(values, animation, 0, 0, boxSize); } TEST(AnimationTranslationUtilTest, createOpacityAnimation) @@ -96,7 +97,7 @@ TEST(AnimationTranslationUtilTest, createTransformAnimationWithBigRotation) RefPtr<Animation> animation = Animation::create(); animation->setDuration(duration); - EXPECT_FALSE(animationCanBeTranslated(values, animation.get())); + EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); } TEST(AnimationTranslationUtilTest, createTransformAnimationWithBigRotationAndEmptyTransformOperationList) @@ -114,7 +115,7 @@ TEST(AnimationTranslationUtilTest, createTransformAnimationWithBigRotationAndEmp RefPtr<Animation> animation = Animation::create(); animation->setDuration(duration); - EXPECT_FALSE(animationCanBeTranslated(values, animation.get())); + EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); } TEST(AnimationTranslationUtilTest, createTransformAnimationWithRotationInvolvingNegativeAngles) @@ -155,7 +156,7 @@ TEST(AnimationTranslationUtilTest, createTransformAnimationWithSmallRotationInvo EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); } -TEST(AnimationTranslationUtilTest, createTransformAnimationWithSingularMatrix) +TEST(AnimationTranslationUtilTest, createTransformAnimationWithNonDecomposableMatrix) { const double duration = 1; WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); @@ -177,6 +178,25 @@ TEST(AnimationTranslationUtilTest, createTransformAnimationWithSingularMatrix) EXPECT_FALSE(animationCanBeTranslated(values, animation.get())); } +TEST(AnimationTranslationUtilTest, createTransformAnimationWithNonInvertibleTransform) +{ + const double duration = 1; + WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); + + TransformOperations operations1; + operations1.operations().append(ScaleTransformOperation::create(1, 1, 1, TransformOperation::SCALE_3D)); + values.insert(new TransformAnimationValue(0, &operations1)); + + TransformOperations operations2; + operations2.operations().append(ScaleTransformOperation::create(1, 0, 1, TransformOperation::SCALE_3D)); + values.insert(new TransformAnimationValue(duration, &operations2)); + + RefPtr<Animation> animation = Animation::create(); + animation->setDuration(duration); + + EXPECT_TRUE(animationCanBeTranslated(values, animation.get())); +} + TEST(AnimationTranslationUtilTest, createReversedAnimation) { const double duration = 1; diff --git a/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp b/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp index 76d1c0a3e..bb2141197 100644 --- a/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp @@ -85,6 +85,16 @@ FakeFloatAnimationCurve::~FakeFloatAnimationCurve() { } +double FakeFloatAnimationCurve::duration() const +{ + return 1; +} + +float FakeFloatAnimationCurve::getValue(double now) const +{ + return 0; +} + PassOwnPtr<WebCore::CCAnimationCurve> FakeFloatAnimationCurve::clone() const { return adoptPtr(new FakeFloatAnimationCurve); @@ -99,6 +109,11 @@ FakeTransformTransition::~FakeTransformTransition() { } +double FakeTransformTransition::duration() const +{ + return m_duration; +} + WebKit::WebTransformationMatrix FakeTransformTransition::getValue(double time) const { return WebKit::WebTransformationMatrix(); @@ -121,6 +136,11 @@ FakeFloatTransition::~FakeFloatTransition() { } +double FakeFloatTransition::duration() const +{ + return m_duration; +} + float FakeFloatTransition::getValue(double time) const { time /= m_duration; @@ -138,6 +158,31 @@ FakeLayerAnimationControllerClient::~FakeLayerAnimationControllerClient() { } +int FakeLayerAnimationControllerClient::id() const +{ + return 0; +} + +void FakeLayerAnimationControllerClient::setOpacityFromAnimation(float opacity) +{ + m_opacity = opacity; +} + +float FakeLayerAnimationControllerClient::opacity() const +{ + return m_opacity; +} + +void FakeLayerAnimationControllerClient::setTransformFromAnimation(const WebKit::WebTransformationMatrix& transform) +{ + m_transform = transform; +} + +const WebKit::WebTransformationMatrix& FakeLayerAnimationControllerClient::transform() const +{ + return m_transform; +} + PassOwnPtr<WebCore::CCAnimationCurve> FakeFloatTransition::clone() const { return adoptPtr(new FakeFloatTransition(*this)); diff --git a/Source/WebKit/chromium/tests/CCAnimationTestCommon.h b/Source/WebKit/chromium/tests/CCAnimationTestCommon.h index 71b0add26..900a4e9a1 100644 --- a/Source/WebKit/chromium/tests/CCAnimationTestCommon.h +++ b/Source/WebKit/chromium/tests/CCAnimationTestCommon.h @@ -44,8 +44,8 @@ public: FakeFloatAnimationCurve(); virtual ~FakeFloatAnimationCurve(); - virtual double duration() const OVERRIDE { return 1; } - virtual float getValue(double now) const OVERRIDE { return 0; } + virtual double duration() const OVERRIDE; + virtual float getValue(double now) const OVERRIDE; virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const OVERRIDE; }; @@ -54,7 +54,7 @@ public: FakeTransformTransition(double duration); virtual ~FakeTransformTransition(); - virtual double duration() const OVERRIDE { return m_duration; } + virtual double duration() const OVERRIDE; virtual WebKit::WebTransformationMatrix getValue(double time) const OVERRIDE; virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const OVERRIDE; @@ -68,7 +68,7 @@ public: FakeFloatTransition(double duration, float from, float to); virtual ~FakeFloatTransition(); - virtual double duration() const OVERRIDE { return m_duration; } + virtual double duration() const OVERRIDE; virtual float getValue(double time) const OVERRIDE; virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const OVERRIDE; @@ -85,11 +85,11 @@ public: virtual ~FakeLayerAnimationControllerClient(); // CCLayerAnimationControllerClient implementation - virtual int id() const OVERRIDE { return 0; } - virtual void setOpacityFromAnimation(float opacity) OVERRIDE { m_opacity = opacity; } - virtual float opacity() const OVERRIDE { return m_opacity; } - virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix& transform) OVERRIDE { m_transform = transform; } - virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE { return m_transform; } + virtual int id() const OVERRIDE; + virtual void setOpacityFromAnimation(float) OVERRIDE; + virtual float opacity() const OVERRIDE; + virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix&) OVERRIDE; + virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE; private: float m_opacity; diff --git a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp index f9eecdb75..e50a1f70a 100644 --- a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp @@ -26,10 +26,10 @@ #include "CCDamageTracker.h" +#include "CCGeometryTestUtils.h" #include "CCLayerImpl.h" #include "CCLayerSorter.h" #include "CCLayerTreeHostCommon.h" -#include "CCLayerTreeTestCommon.h" #include "CCMathUtil.h" #include "CCSingleThreadProxy.h" #include <gtest/gtest.h> diff --git a/Source/WebKit/chromium/tests/CCDrawQuadTest.cpp b/Source/WebKit/chromium/tests/CCDrawQuadTest.cpp new file mode 100644 index 000000000..3c5c384f8 --- /dev/null +++ b/Source/WebKit/chromium/tests/CCDrawQuadTest.cpp @@ -0,0 +1,332 @@ +/* + * 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 "CCDrawQuad.h" + +#include "CCCheckerboardDrawQuad.h" +#include "CCDebugBorderDrawQuad.h" +#include "CCGeometryTestUtils.h" +#include "CCIOSurfaceDrawQuad.h" +#include "CCRenderPassDrawQuad.h" +#include "CCSolidColorDrawQuad.h" +#include "CCStreamVideoDrawQuad.h" +#include "CCTextureDrawQuad.h" +#include "CCTileDrawQuad.h" +#include "CCYUVVideoDrawQuad.h" +#include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> + +using WebKit::WebTransformationMatrix; + +using namespace WebCore; + +namespace { + +TEST(CCDrawQuadTest, copySharedQuadState) +{ + WebTransformationMatrix quadTransform(1, 0.5, 0, 1, 0.5, 0); + IntRect visibleContentRect(10, 12, 14, 16); + IntRect clippedRectInTarget(19, 21, 23, 25); + float opacity = 0.25; + bool opaque = true; + int id = 3; + + OwnPtr<CCSharedQuadState> state(CCSharedQuadState::create(quadTransform, visibleContentRect, clippedRectInTarget, opacity, opaque)); + state->id = id; + + OwnPtr<CCSharedQuadState> copy(state->copy()); + EXPECT_EQ(id, copy->id); + EXPECT_EQ(quadTransform, copy->quadTransform); + EXPECT_RECT_EQ(visibleContentRect, copy->visibleContentRect); + EXPECT_RECT_EQ(clippedRectInTarget, copy->clippedRectInTarget); + EXPECT_EQ(opacity, copy->opacity); + EXPECT_EQ(opaque, copy->opaque); +} + +PassOwnPtr<CCSharedQuadState> createSharedQuadState() +{ + WebTransformationMatrix quadTransform(1, 0.5, 0, 1, 0.5, 0); + IntRect visibleContentRect(10, 12, 14, 16); + IntRect clippedRectInTarget(19, 21, 23, 25); + float opacity = 1; + bool opaque = false; + int id = 3; + + OwnPtr<CCSharedQuadState> state(CCSharedQuadState::create(quadTransform, visibleContentRect, clippedRectInTarget, opacity, opaque)); + state->id = id; + return state.release(); +} + +void compareDrawQuad(CCDrawQuad* quad, CCDrawQuad* copy, CCSharedQuadState* copySharedState) +{ + EXPECT_EQ(quad->size(), copy->size()); + EXPECT_EQ(quad->material(), copy->material()); + EXPECT_EQ(quad->isDebugQuad(), copy->isDebugQuad()); + EXPECT_RECT_EQ(quad->quadRect(), copy->quadRect()); + EXPECT_RECT_EQ(quad->quadVisibleRect(), copy->quadVisibleRect()); + EXPECT_EQ(quad->opaqueRect(), copy->opaqueRect()); + EXPECT_EQ(quad->needsBlending(), copy->needsBlending()); + + EXPECT_EQ(copySharedState, copy->sharedQuadState()); + EXPECT_EQ(copySharedState->id, copy->sharedQuadStateId()); + + EXPECT_EQ(quad->sharedQuadStateId(), quad->sharedQuadState()->id); + EXPECT_EQ(copy->sharedQuadStateId(), copy->sharedQuadState()->id); +} + +#define CREATE_SHARED_STATE() \ + OwnPtr<CCSharedQuadState> sharedState(createSharedQuadState()); \ + OwnPtr<CCSharedQuadState> copySharedState(sharedState->copy()); \ + copySharedState->id = 5; + +#define QUAD_DATA \ + IntRect quadRect(30, 40, 50, 60); \ + IntRect quadVisibleRect(40, 50, 30, 20); \ + +#define SETUP_AND_COPY_QUAD(Type, quad) \ + quad->setQuadVisibleRect(quadVisibleRect); \ + OwnPtr<CCDrawQuad> copy(quad->copy(copySharedState.get())); \ + compareDrawQuad(quad.get(), copy.get(), copySharedState.get()); \ + const Type* copyQuad = Type::materialCast(copy.get()); + +#define SETUP_AND_COPY_QUAD_1(Type, quad, a) \ + quad->setQuadVisibleRect(quadVisibleRect); \ + OwnPtr<CCDrawQuad> copy(quad->copy(copySharedState.get(), a)); \ + compareDrawQuad(quad.get(), copy.get(), copySharedState.get()); \ + const Type* copyQuad = Type::materialCast(copy.get()); + +#define CREATE_QUAD_0(Type) \ + QUAD_DATA \ + OwnPtr<Type> quad(Type::create(sharedState.get(), quadRect)); \ + SETUP_AND_COPY_QUAD(Type, quad); \ + UNUSED_PARAM(copyQuad); + +#define CREATE_QUAD_1(Type, a) \ + QUAD_DATA \ + OwnPtr<Type> quad(Type::create(sharedState.get(), quadRect, a)); \ + SETUP_AND_COPY_QUAD(Type, quad); + +#define CREATE_QUAD_2(Type, a, b) \ + QUAD_DATA \ + OwnPtr<Type> quad(Type::create(sharedState.get(), quadRect, a, b)); \ + SETUP_AND_COPY_QUAD(Type, quad); + +#define CREATE_QUAD_3(Type, a, b, c) \ + QUAD_DATA \ + OwnPtr<Type> quad(Type::create(sharedState.get(), quadRect, a, b, c)); \ + SETUP_AND_COPY_QUAD(Type, quad); + +#define CREATE_QUAD_4(Type, a, b, c, d) \ + QUAD_DATA \ + OwnPtr<Type> quad(Type::create(sharedState.get(), quadRect, a, b, c, d)); \ + SETUP_AND_COPY_QUAD(Type, quad); + +#define CREATE_QUAD_5(Type, a, b, c, d, e) \ + QUAD_DATA \ + OwnPtr<Type> quad(Type::create(sharedState.get(), quadRect, a, b, c, d, e)); \ + SETUP_AND_COPY_QUAD(Type, quad); + +#define CREATE_QUAD_6(Type, a, b, c, d, e, f) \ + QUAD_DATA \ + OwnPtr<Type> quad(Type::create(sharedState.get(), quadRect, a, b, c, d, e, f)); \ + SETUP_AND_COPY_QUAD(Type, quad); + +#define CREATE_QUAD_7(Type, a, b, c, d, e, f, g) \ + QUAD_DATA \ + OwnPtr<Type> quad(Type::create(sharedState.get(), quadRect, a, b, c, d, e, f, g)); \ + SETUP_AND_COPY_QUAD(Type, quad); + +#define CREATE_QUAD_8(Type, a, b, c, d, e, f, g, h) \ + QUAD_DATA \ + OwnPtr<Type> quad(Type::create(sharedState.get(), quadRect, a, b, c, d, e, f, g, h)); \ + SETUP_AND_COPY_QUAD(Type, quad); + +#define CREATE_QUAD_8_1(Type, a, b, c, d, e, f, g, h, copyA) \ + QUAD_DATA \ + OwnPtr<Type> quad(Type::create(sharedState.get(), quadRect, a, b, c, d, e, f, g, h)); \ + SETUP_AND_COPY_QUAD_1(Type, quad, copyA); + +#define CREATE_QUAD_9(Type, a, b, c, d, e, f, g, h, i) \ + QUAD_DATA \ + OwnPtr<Type> quad(Type::create(sharedState.get(), quadRect, a, b, c, d, e, f, g, h, i)); \ + SETUP_AND_COPY_QUAD(Type, quad); + +#define CREATE_QUAD_10(Type, a, b, c, d, e, f, g, h, i, j) \ + QUAD_DATA \ + OwnPtr<Type> quad(Type::create(sharedState.get(), quadRect, a, b, c, d, e, f, g, h, i, j)); \ + SETUP_AND_COPY_QUAD(Type, quad); + +TEST(CCDrawQuadTest, copyCheckerboardDrawQuad) +{ + CREATE_SHARED_STATE(); + CREATE_QUAD_0(CCCheckerboardDrawQuad); +} + +TEST(CCDrawQuadTest, copyDebugBorderDrawQuad) +{ + SkColor color = 0xfabb0011; + int width = 99; + CREATE_SHARED_STATE(); + CREATE_QUAD_2(CCDebugBorderDrawQuad, color, width); + EXPECT_EQ(color, copyQuad->color()); + EXPECT_EQ(width, copyQuad->width()); +} + +TEST(CCDrawQuadTest, copyIOSurfaceDrawQuad) +{ + IntSize size(58, 95); + unsigned textureId = 72; + CCIOSurfaceDrawQuad::Orientation orientation = CCIOSurfaceDrawQuad::Unflipped; + + CREATE_SHARED_STATE(); + CREATE_QUAD_3(CCIOSurfaceDrawQuad, size, textureId, orientation); + EXPECT_EQ(size, copyQuad->ioSurfaceSize()); + EXPECT_EQ(textureId, copyQuad->ioSurfaceTextureId()); + EXPECT_EQ(orientation, copyQuad->orientation()); +} + +TEST(CCDrawQuadTest, copyRenderPassDrawQuad) +{ + CCRenderPass::Id renderPassId(22, 64); + bool isReplica = true; + CCResourceProvider::ResourceId maskResourceId = 78; + IntRect contentsChangedSinceLastFrame(42, 11, 74, 24); + float maskTexCoordScaleX = 33; + float maskTexCoordScaleY = 19; + float maskTexCoordOffsetX = -45; + float maskTexCoordOffsetY = -21; + + CCRenderPass::Id copiedRenderPassId(235, 11); + + CREATE_SHARED_STATE(); + CREATE_QUAD_8_1(CCRenderPassDrawQuad, renderPassId, isReplica, maskResourceId, contentsChangedSinceLastFrame, maskTexCoordScaleX, maskTexCoordScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY, copiedRenderPassId); + EXPECT_EQ(copiedRenderPassId, copyQuad->renderPassId()); + EXPECT_EQ(isReplica, copyQuad->isReplica()); + EXPECT_EQ(maskResourceId, copyQuad->maskResourceId()); + EXPECT_RECT_EQ(contentsChangedSinceLastFrame, copyQuad->contentsChangedSinceLastFrame()); + EXPECT_EQ(maskTexCoordScaleX, copyQuad->maskTexCoordScaleX()); + EXPECT_EQ(maskTexCoordScaleY, copyQuad->maskTexCoordScaleY()); + EXPECT_EQ(maskTexCoordOffsetX, copyQuad->maskTexCoordOffsetX()); + EXPECT_EQ(maskTexCoordOffsetY, copyQuad->maskTexCoordOffsetY()); +} + +TEST(CCDrawQuadTest, copySolidColorDrawQuad) +{ + SkColor color = 0x49494949; + + CREATE_SHARED_STATE(); + CREATE_QUAD_1(CCSolidColorDrawQuad, color); + EXPECT_EQ(color, copyQuad->color()); +} + +TEST(CCDrawQuadTest, copyStreamVideoDrawQuad) +{ + unsigned textureId = 64; + WebTransformationMatrix matrix(0.5, 1, 0.25, 0.75, 0, 1); + + CREATE_SHARED_STATE(); + CREATE_QUAD_2(CCStreamVideoDrawQuad, textureId, matrix); + EXPECT_EQ(textureId, copyQuad->textureId()); + EXPECT_EQ(matrix, copyQuad->matrix()); +} + +TEST(CCDrawQuadTest, copyTextureDrawQuad) +{ + unsigned resourceId = 82; + bool premultipliedAlpha = true; + FloatRect uvRect(0.5, 224, -51, 36); + bool flipped = true; + + CREATE_SHARED_STATE(); + CREATE_QUAD_4(CCTextureDrawQuad, resourceId, premultipliedAlpha, uvRect, flipped); + EXPECT_EQ(resourceId, copyQuad->resourceId()); + EXPECT_EQ(premultipliedAlpha, copyQuad->premultipliedAlpha()); + EXPECT_EQ(uvRect, copyQuad->uvRect()); + EXPECT_EQ(flipped, copyQuad->flipped()); +} + +TEST(CCDrawQuadTest, copyTileDrawQuad) +{ + IntRect opaqueRect(33, 44, 22, 33); + unsigned resourceId = 104; + IntPoint textureOffset(-31, 47); + IntSize textureSize(85, 32); + GC3Dint textureFilter = 82; + bool swizzleContents = true; + bool leftEdgeAA = true; + bool topEdgeAA = true; + bool rightEdgeAA = false; + bool bottomEdgeAA = true; + + CREATE_SHARED_STATE(); + CREATE_QUAD_10(CCTileDrawQuad, opaqueRect, resourceId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA); + EXPECT_RECT_EQ(opaqueRect, copyQuad->opaqueRect()); + EXPECT_EQ(resourceId, copyQuad->resourceId()); + EXPECT_EQ(textureOffset, copyQuad->textureOffset()); + EXPECT_EQ(textureSize, copyQuad->textureSize()); + EXPECT_EQ(textureFilter, copyQuad->textureFilter()); + EXPECT_EQ(swizzleContents, copyQuad->swizzleContents()); + EXPECT_EQ(leftEdgeAA, copyQuad->leftEdgeAA()); + EXPECT_EQ(topEdgeAA, copyQuad->topEdgeAA()); + EXPECT_EQ(rightEdgeAA, copyQuad->rightEdgeAA()); + EXPECT_EQ(bottomEdgeAA, copyQuad->bottomEdgeAA()); +} + +TEST(CCDrawQuadTest, copyYUVVideoDrawQuad) +{ + CCVideoLayerImpl::FramePlane yPlane; + yPlane.resourceId = 45; + yPlane.size = IntSize(34, 23); + yPlane.format = 8; + yPlane.visibleSize = IntSize(623, 235); + CCVideoLayerImpl::FramePlane uPlane; + uPlane.resourceId = 532; + uPlane.size = IntSize(134, 16); + uPlane.format = 2; + uPlane.visibleSize = IntSize(126, 27); + CCVideoLayerImpl::FramePlane vPlane; + vPlane.resourceId = 4; + vPlane.size = IntSize(456, 486); + vPlane.format = 46; + vPlane.visibleSize = IntSize(19, 45); + + CREATE_SHARED_STATE(); + CREATE_QUAD_3(CCYUVVideoDrawQuad, yPlane, uPlane, vPlane); + EXPECT_EQ(yPlane.resourceId, copyQuad->yPlane().resourceId); + EXPECT_EQ(yPlane.size, copyQuad->yPlane().size); + EXPECT_EQ(yPlane.format, copyQuad->yPlane().format); + EXPECT_EQ(yPlane.visibleSize, copyQuad->yPlane().visibleSize); + EXPECT_EQ(uPlane.resourceId, copyQuad->uPlane().resourceId); + EXPECT_EQ(uPlane.size, copyQuad->uPlane().size); + EXPECT_EQ(uPlane.format, copyQuad->uPlane().format); + EXPECT_EQ(uPlane.visibleSize, copyQuad->uPlane().visibleSize); + EXPECT_EQ(vPlane.resourceId, copyQuad->vPlane().resourceId); + EXPECT_EQ(vPlane.size, copyQuad->vPlane().size); + EXPECT_EQ(vPlane.format, copyQuad->vPlane().format); + EXPECT_EQ(vPlane.visibleSize, copyQuad->vPlane().visibleSize); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/CCGeometryTestUtils.cpp b/Source/WebKit/chromium/tests/CCGeometryTestUtils.cpp new file mode 100644 index 000000000..a17fc643f --- /dev/null +++ b/Source/WebKit/chromium/tests/CCGeometryTestUtils.cpp @@ -0,0 +1,56 @@ +/* + * 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 "CCGeometryTestUtils.h" + +#include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> + +namespace WebKitTests { + +void ExpectTransformationMatrixEq(const WebKit::WebTransformationMatrix& expected, + const WebKit::WebTransformationMatrix& actual) +{ + EXPECT_FLOAT_EQ((expected).m11(), (actual).m11()); + EXPECT_FLOAT_EQ((expected).m12(), (actual).m12()); + EXPECT_FLOAT_EQ((expected).m13(), (actual).m13()); + EXPECT_FLOAT_EQ((expected).m14(), (actual).m14()); + EXPECT_FLOAT_EQ((expected).m21(), (actual).m21()); + EXPECT_FLOAT_EQ((expected).m22(), (actual).m22()); + EXPECT_FLOAT_EQ((expected).m23(), (actual).m23()); + EXPECT_FLOAT_EQ((expected).m24(), (actual).m24()); + EXPECT_FLOAT_EQ((expected).m31(), (actual).m31()); + EXPECT_FLOAT_EQ((expected).m32(), (actual).m32()); + EXPECT_FLOAT_EQ((expected).m33(), (actual).m33()); + EXPECT_FLOAT_EQ((expected).m34(), (actual).m34()); + EXPECT_FLOAT_EQ((expected).m41(), (actual).m41()); + EXPECT_FLOAT_EQ((expected).m42(), (actual).m42()); + EXPECT_FLOAT_EQ((expected).m43(), (actual).m43()); + EXPECT_FLOAT_EQ((expected).m44(), (actual).m44()); +} + +} // namespace WebKitTests + diff --git a/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h b/Source/WebKit/chromium/tests/CCGeometryTestUtils.h index 7f7e20279..6dea70918 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h +++ b/Source/WebKit/chromium/tests/CCGeometryTestUtils.h @@ -22,10 +22,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef CCLayerTreeTestCommon_h -#define CCLayerTreeTestCommon_h +#ifndef CCGeometryTestUtils_h +#define CCGeometryTestUtils_h -#include <public/WebTransformationMatrix.h> +namespace WebKit { +class WebTransformationMatrix; +} namespace WebKitTests { @@ -36,7 +38,7 @@ namespace WebKitTests { EXPECT_FLOAT_EQ((expected).size().width(), (actual).size().width()); \ EXPECT_FLOAT_EQ((expected).size().height(), (actual).size().height()) -#define EXPECT_INT_RECT_EQ(expected, actual) \ +#define EXPECT_RECT_EQ(expected, actual) \ EXPECT_EQ((expected).location().x(), (actual).location().x()); \ EXPECT_EQ((expected).location().y(), (actual).location().y()); \ EXPECT_EQ((expected).size().width(), (actual).size().width()); \ @@ -46,8 +48,8 @@ namespace WebKitTests { // in bulk, it causes a significant slow-down in compilation time. This problem // exists with both gcc and clang, and bugs have been filed at // http://llvm.org/bugs/show_bug.cgi?id=13651 and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54337 -void ExpectTransformationMatrixEq(WebKit::WebTransformationMatrix expected, - WebKit::WebTransformationMatrix actual); +void ExpectTransformationMatrixEq(const WebKit::WebTransformationMatrix& expected, + const WebKit::WebTransformationMatrix& actual); #define EXPECT_TRANSFORMATION_MATRIX_EQ(expected, actual) \ { \ @@ -55,6 +57,6 @@ void ExpectTransformationMatrixEq(WebKit::WebTransformationMatrix expected, WebKitTests::ExpectTransformationMatrixEq(expected, actual); \ } -} // namespace +} // namespace WebKitTests -#endif // CCLayerTreeTestCommon_h +#endif // CCGeometryTestUtils_h diff --git a/Source/WebKit/chromium/tests/CCHeadsUpDisplayTest.cpp b/Source/WebKit/chromium/tests/CCHeadsUpDisplayTest.cpp new file mode 100644 index 000000000..63616b35a --- /dev/null +++ b/Source/WebKit/chromium/tests/CCHeadsUpDisplayTest.cpp @@ -0,0 +1,130 @@ +/* + * 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 "CCLayerTreeHost.h" +#include "CCThreadedTest.h" +#include "HeadsUpDisplayLayerChromium.h" +#include "LayerChromium.h" + +using namespace WebCore; +using namespace WebKitTests; + +namespace { + +class CCHeadsUpDisplayTest : public CCThreadedTest { +protected: + virtual void initializeSettings(CCLayerTreeSettings& settings) OVERRIDE + { + // Enable the HUD without requiring text. + settings.showPropertyChangedRects = true; + } +}; + +class DrawsContentLayerChromium : public LayerChromium { +public: + static PassRefPtr<DrawsContentLayerChromium> create() { return adoptRef(new DrawsContentLayerChromium()); } + virtual bool drawsContent() const OVERRIDE { return true; } + +private: + DrawsContentLayerChromium() : LayerChromium() { } +}; + +class CCHudWithRootLayerChange : public CCHeadsUpDisplayTest { +public: + CCHudWithRootLayerChange() + : m_rootLayer1(DrawsContentLayerChromium::create()) + , m_rootLayer2(DrawsContentLayerChromium::create()) + , m_numCommits(0) + { + } + + virtual void beginTest() OVERRIDE + { + m_rootLayer1->setBounds(IntSize(30, 30)); + m_rootLayer2->setBounds(IntSize(30, 30)); + + postSetNeedsCommitToMainThread(); + } + + virtual void didCommit() OVERRIDE + { + ++m_numCommits; + + ASSERT_TRUE(m_layerTreeHost->hudLayer()); + + switch (m_numCommits) { + case 1: + // Change directly to a new root layer. + m_layerTreeHost->setRootLayer(m_rootLayer1); + break; + case 2: + EXPECT_EQ(m_rootLayer1.get(), m_layerTreeHost->hudLayer()->parent()); + // Unset the root layer. + m_layerTreeHost->setRootLayer(0); + break; + case 3: + EXPECT_EQ(0, m_layerTreeHost->hudLayer()->parent()); + // Change back to the previous root layer. + m_layerTreeHost->setRootLayer(m_rootLayer1); + break; + case 4: + EXPECT_EQ(m_rootLayer1.get(), m_layerTreeHost->hudLayer()->parent()); + // Unset the root layer. + m_layerTreeHost->setRootLayer(0); + break; + case 5: + EXPECT_EQ(0, m_layerTreeHost->hudLayer()->parent()); + // Change to a new root layer from a null root. + m_layerTreeHost->setRootLayer(m_rootLayer2); + break; + case 6: + EXPECT_EQ(m_rootLayer2.get(), m_layerTreeHost->hudLayer()->parent()); + // Change directly back to the last root layer/ + m_layerTreeHost->setRootLayer(m_rootLayer1); + break; + case 7: + EXPECT_EQ(m_rootLayer1.get(), m_layerTreeHost->hudLayer()->parent()); + endTest(); + break; + } + } + + virtual void afterTest() OVERRIDE + { + } + +private: + RefPtr<DrawsContentLayerChromium> m_rootLayer1; + RefPtr<DrawsContentLayerChromium> m_rootLayer2; + int m_numCommits; +}; + +TEST_F(CCHudWithRootLayerChange, runMultiThread) +{ + runTest(true); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp index 0b5aa6be6..3d008ce13 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp @@ -27,15 +27,16 @@ #include "CCLayerTreeHostCommon.h" #include "CCAnimationTestCommon.h" +#include "CCGeometryTestUtils.h" #include "CCLayerAnimationController.h" #include "CCLayerImpl.h" #include "CCLayerSorter.h" -#include "CCLayerTreeTestCommon.h" #include "CCMathUtil.h" #include "CCProxy.h" #include "CCSingleThreadProxy.h" #include "CCThread.h" #include "ContentLayerChromium.h" +#include "ContentLayerChromiumClient.h" #include "LayerChromium.h" #include <gmock/gmock.h> @@ -46,27 +47,6 @@ using namespace WebCore; using namespace WebKitTests; using WebKit::WebTransformationMatrix; -void WebKitTests::ExpectTransformationMatrixEq(WebTransformationMatrix expected, - WebTransformationMatrix actual) -{ - EXPECT_FLOAT_EQ((expected).m11(), (actual).m11()); - EXPECT_FLOAT_EQ((expected).m12(), (actual).m12()); - EXPECT_FLOAT_EQ((expected).m13(), (actual).m13()); - EXPECT_FLOAT_EQ((expected).m14(), (actual).m14()); - EXPECT_FLOAT_EQ((expected).m21(), (actual).m21()); - EXPECT_FLOAT_EQ((expected).m22(), (actual).m22()); - EXPECT_FLOAT_EQ((expected).m23(), (actual).m23()); - EXPECT_FLOAT_EQ((expected).m24(), (actual).m24()); - EXPECT_FLOAT_EQ((expected).m31(), (actual).m31()); - EXPECT_FLOAT_EQ((expected).m32(), (actual).m32()); - EXPECT_FLOAT_EQ((expected).m33(), (actual).m33()); - EXPECT_FLOAT_EQ((expected).m34(), (actual).m34()); - EXPECT_FLOAT_EQ((expected).m41(), (actual).m41()); - EXPECT_FLOAT_EQ((expected).m42(), (actual).m42()); - EXPECT_FLOAT_EQ((expected).m43(), (actual).m43()); - EXPECT_FLOAT_EQ((expected).m44(), (actual).m44()); -} - namespace { template<typename LayerType> @@ -672,6 +652,7 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClipp setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint(30, 30), IntSize(10, 10), false); parent->addChild(renderSurface1); + parent->setMasksToBounds(true); renderSurface1->addChild(child); renderSurface1->setForceRenderSurface(true); @@ -1477,9 +1458,9 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableContentRectForLayers) CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); - EXPECT_INT_RECT_EQ(IntRect(IntPoint(5, 5), IntSize(10, 10)), grandChild1->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(IntPoint(5, 5), IntSize(10, 10)), grandChild1->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawableContentRect()); EXPECT_TRUE(grandChild4->drawableContentRect().isEmpty()); } @@ -1549,9 +1530,9 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) EXPECT_FALSE(grandChild4->renderSurface()); // Because grandChild4 is entirely clipped, it is expected to not have a renderSurface. // Surfaces are clipped by their parent, but un-affected by the owning layer's masksToBounds. - EXPECT_INT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild1->renderSurface()->clipRect()); - EXPECT_INT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild2->renderSurface()->clipRect()); - EXPECT_INT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild3->renderSurface()->clipRect()); + EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild1->renderSurface()->clipRect()); + EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild2->renderSurface()->clipRect()); + EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild3->renderSurface()->clipRect()); } TEST(CCLayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy) @@ -1706,7 +1687,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForIdentityTransform) IntRect layerContentRect = IntRect(IntPoint(10, 10), IntSize(30, 30)); IntRect expected = IntRect(IntPoint(10, 10), IntSize(30, 30)); IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); // Case 2: Layer is outside the surface rect. layerContentRect = IntRect(IntPoint(120, 120), IntSize(30, 30)); @@ -1717,7 +1698,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForIdentityTransform) layerContentRect = IntRect(IntPoint(80, 80), IntSize(30, 30)); expected = IntRect(IntPoint(80, 80), IntSize(20, 20)); actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); } TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForTranslations) @@ -1733,7 +1714,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForTranslations) layerToSurfaceTransform.translate(10, 10); IntRect expected = IntRect(IntPoint(0, 0), IntSize(30, 30)); IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); // Case 2: Layer is outside the surface rect. layerToSurfaceTransform.makeIdentity(); @@ -1746,7 +1727,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForTranslations) layerToSurfaceTransform.translate(80, 80); expected = IntRect(IntPoint(0, 0), IntSize(20, 20)); actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); } TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor2DRotations) @@ -1764,7 +1745,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor2DRotations) layerToSurfaceTransform.rotate(45); IntRect expected = IntRect(IntPoint(0, 0), IntSize(30, 30)); IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); // Case 2: Layer is outside the surface rect. layerToSurfaceTransform.makeIdentity(); @@ -1782,7 +1763,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor2DRotations) layerToSurfaceTransform.rotate(45); expected = IntRect(IntPoint(0, 0), IntSize(30, 30)); actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); // Case 4: The layer is rotated about its top-left corner, and translated upwards. In // surface space, the layer is oriented diagonally, with only the top corner @@ -1794,7 +1775,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor2DRotations) layerToSurfaceTransform.rotate(45); expected = IntRect(IntPoint(15, 0), IntSize(15, 30)); // right half of layer bounds. actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); } TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform) @@ -1810,7 +1791,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform) layerToSurfaceTransform.rotate3d(0, 45, 0); IntRect expected = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); // Case 2: Orthographic projection of a layer rotated about y-axis by 45 degrees, but // shifted to the side so only the right-half the layer would be visible on @@ -1821,7 +1802,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform) layerToSurfaceTransform.rotate3d(0, 45, 0); // rotates about the left edge of the layer expected = IntRect(IntPoint(50, 0), IntSize(50, 100)); // right half of the layer. actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); } TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform) @@ -1848,7 +1829,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform) IntRect expected = IntRect(IntPoint(-50, -50), IntSize(200, 200)); IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); // Case 2: same projection as before, except that the layer is also translated to the // side, so that only the right half of the layer should be visible. @@ -1861,7 +1842,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform) layerToSurfaceTransform.translate3d(-200, 0, 0); expected = IntRect(IntPoint(50, -50), IntSize(100, 200)); // The right half of the layer's bounding rect. actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); } TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBehindSurface) @@ -1884,7 +1865,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBe IntRect expected = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); } TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW) @@ -1950,7 +1931,313 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForPerspectiveUnprojection) // that the entire layer should still be considered visible. IntRect expected = IntRect(IntPoint(-10, -10), IntSize(20, 20)); IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); +} + +TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSimpleLayers) +{ + RefPtr<LayerChromium> root = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> child1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> child2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> child3 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + root->addChild(child1); + root->addChild(child2); + root->addChild(child3); + + WebTransformationMatrix identityMatrix; + setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); + setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(50, 50), false); + setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false); + setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false); + + executeCalculateDrawTransformsAndVisibility(root.get()); + + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); + + // Layers that do not draw content should have empty visibleContentRects. + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); + + // layer visibleContentRects are clipped by their targetSurface + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), child2->visibleContentRect()); + EXPECT_TRUE(child3->visibleContentRect().isEmpty()); + + // layer drawableContentRects are not clipped. + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); +} + +TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersClippedByLayer) +{ + RefPtr<LayerChromium> root = LayerChromium::create(); + RefPtr<LayerChromium> child = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> grandChild1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> grandChild2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> grandChild3 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + root->addChild(child); + child->addChild(grandChild1); + child->addChild(grandChild2); + child->addChild(grandChild3); + + WebTransformationMatrix identityMatrix; + setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); + setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); + setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false); + setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false); + setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false); + + child->setMasksToBounds(true); + executeCalculateDrawTransformsAndVisibility(root.get()); + + ASSERT_FALSE(child->renderSurface()); + + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); + + // Layers that do not draw content should have empty visibleContentRects. + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), child->visibleContentRect()); + + // All grandchild visibleContentRects should be clipped by child. + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), grandChild1->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), grandChild2->visibleContentRect()); + EXPECT_TRUE(grandChild3->visibleContentRect().isEmpty()); + + // All grandchild drawableContentRects should also be clipped by child. + EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), grandChild1->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(75, 75, 25, 25), grandChild2->drawableContentRect()); + EXPECT_TRUE(grandChild3->drawableContentRect().isEmpty()); +} + +TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInUnclippedRenderSurface) +{ + RefPtr<LayerChromium> root = LayerChromium::create(); + RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> child1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> child2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> child3 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + root->addChild(renderSurface1); + renderSurface1->addChild(child1); + renderSurface1->addChild(child2); + renderSurface1->addChild(child3); + + WebTransformationMatrix identityMatrix; + setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); + setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false); + setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false); + setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false); + setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false); + + renderSurface1->setForceRenderSurface(true); + executeCalculateDrawTransformsAndVisibility(root.get()); + + ASSERT_TRUE(renderSurface1->renderSurface()); + + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); + + // Layers that do not draw content should have empty visibleContentRects. + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); + + // An unclipped surface grows its drawableContentRect to include all drawable regions of the subtree. + EXPECT_RECT_EQ(IntRect(5, 5, 170, 170), renderSurface1->renderSurface()->drawableContentRect()); + + // All layers that draw content into the unclipped surface are also unclipped. + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child2->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child3->visibleContentRect()); + + EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); +} + +TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInClippedRenderSurface) +{ + RefPtr<LayerChromium> root = LayerChromium::create(); + RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> child1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> child2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> child3 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + root->addChild(renderSurface1); + renderSurface1->addChild(child1); + renderSurface1->addChild(child2); + renderSurface1->addChild(child3); + + WebTransformationMatrix identityMatrix; + setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); + setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false); + setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false); + setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false); + setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false); + + root->setMasksToBounds(true); + renderSurface1->setForceRenderSurface(true); + executeCalculateDrawTransformsAndVisibility(root.get()); + + ASSERT_TRUE(renderSurface1->renderSurface()); + + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); + + // Layers that do not draw content should have empty visibleContentRects. + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); + + // A clipped surface grows its drawableContentRect to include all drawable regions of the subtree, + // but also gets clamped by the ancestor's clip. + EXPECT_RECT_EQ(IntRect(5, 5, 95, 95), renderSurface1->renderSurface()->drawableContentRect()); + + // All layers that draw content into the surface have their visibleContentRect clipped by the surface clipRect. + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), child2->visibleContentRect()); + EXPECT_TRUE(child3->visibleContentRect().isEmpty()); + + // But the drawableContentRects are unclipped. + EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); +} + +TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSurfaceHierarchy) +{ + // Check that clipping does not propagate down surfaces. + RefPtr<LayerChromium> root = LayerChromium::create(); + RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(); + RefPtr<LayerChromium> renderSurface2 = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> child1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> child2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> child3 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + root->addChild(renderSurface1); + renderSurface1->addChild(renderSurface2); + renderSurface2->addChild(child1); + renderSurface2->addChild(child2); + renderSurface2->addChild(child3); + + WebTransformationMatrix identityMatrix; + setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); + setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false); + setLayerPropertiesForTesting(renderSurface2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(7, 13), false); + setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false); + setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false); + setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false); + + root->setMasksToBounds(true); + renderSurface1->setForceRenderSurface(true); + renderSurface2->setForceRenderSurface(true); + executeCalculateDrawTransformsAndVisibility(root.get()); + + ASSERT_TRUE(renderSurface1->renderSurface()); + ASSERT_TRUE(renderSurface2->renderSurface()); + + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); + + // Layers that do not draw content should have empty visibleContentRects. + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface2->visibleContentRect()); + + // A clipped surface grows its drawableContentRect to include all drawable regions of the subtree, + // but also gets clamped by the ancestor's clip. + EXPECT_RECT_EQ(IntRect(5, 5, 95, 95), renderSurface1->renderSurface()->drawableContentRect()); + + // renderSurface1 lives in the "unclipped universe" of renderSurface1, and is only + // implicitly clipped by renderSurface1's contentRect. So, renderSurface2 grows to + // enclose all drawable content of its subtree. + EXPECT_RECT_EQ(IntRect(5, 5, 170, 170), renderSurface2->renderSurface()->drawableContentRect()); + + // All layers that draw content into renderSurface2 think they are unclipped. + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child2->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child3->visibleContentRect()); + + // drawableContentRects are also unclipped. + EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); +} + +TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransformOnUnclippedSurface) +{ + // Layers that have non-axis aligned bounds (due to transforms) have an expanded, + // axis-aligned drawableContentRect and visibleContentRect. + + RefPtr<LayerChromium> root = LayerChromium::create(); + RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> child1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + root->addChild(renderSurface1); + renderSurface1->addChild(child1); + + WebTransformationMatrix identityMatrix; + WebTransformationMatrix childRotation; + childRotation.rotate(45); + setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); + setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false); + setLayerPropertiesForTesting(child1.get(), childRotation, identityMatrix, FloatPoint(0.5, 0.5), FloatPoint(25, 25), IntSize(50, 50), false); + + renderSurface1->setForceRenderSurface(true); + executeCalculateDrawTransformsAndVisibility(root.get()); + + ASSERT_TRUE(renderSurface1->renderSurface()); + + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); + + // Layers that do not draw content should have empty visibleContentRects. + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); + + // The unclipped surface grows its drawableContentRect to include all drawable regions of the subtree. + int diagonalRadius = ceil(sqrt(2.0) * 25); + IntRect expectedSurfaceDrawableContent = IntRect(50 - diagonalRadius, 50 - diagonalRadius, diagonalRadius * 2, diagonalRadius * 2); + EXPECT_RECT_EQ(expectedSurfaceDrawableContent, renderSurface1->renderSurface()->drawableContentRect()); + + // All layers that draw content into the unclipped surface are also unclipped. + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); + EXPECT_RECT_EQ(expectedSurfaceDrawableContent, child1->drawableContentRect()); +} + +TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransformOnClippedSurface) +{ + // Layers that have non-axis aligned bounds (due to transforms) have an expanded, + // axis-aligned drawableContentRect and visibleContentRect. + + RefPtr<LayerChromium> root = LayerChromium::create(); + RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> child1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + root->addChild(renderSurface1); + renderSurface1->addChild(child1); + + WebTransformationMatrix identityMatrix; + WebTransformationMatrix childRotation; + childRotation.rotate(45); + setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(50, 50), false); + setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false); + setLayerPropertiesForTesting(child1.get(), childRotation, identityMatrix, FloatPoint(0.5, 0.5), FloatPoint(25, 25), IntSize(50, 50), false); + + root->setMasksToBounds(true); + renderSurface1->setForceRenderSurface(true); + executeCalculateDrawTransformsAndVisibility(root.get()); + + ASSERT_TRUE(renderSurface1->renderSurface()); + + // The clipped surface clamps the drawableContentRect that encloses the rotated layer. + int diagonalRadius = ceil(sqrt(2.0) * 25); + IntRect unclippedSurfaceContent = IntRect(50 - diagonalRadius, 50 - diagonalRadius, diagonalRadius * 2, diagonalRadius * 2); + IntRect expectedSurfaceDrawableContent = intersection(unclippedSurfaceContent, IntRect(0, 0, 50, 50)); + EXPECT_RECT_EQ(expectedSurfaceDrawableContent, renderSurface1->renderSurface()->drawableContentRect()); + + // On the clipped surface, only a quarter of the child1 is visible, but when rotating + // it back to child1's content space, the actual enclosing rect ends up covering the + // full left half of child1. + EXPECT_RECT_EQ(IntRect(0, 0, 26, 50), child1->visibleContentRect()); + + // The child's drawableContentRect is unclipped. + EXPECT_RECT_EQ(unclippedSurfaceContent, child1->drawableContentRect()); } TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) @@ -2593,7 +2880,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents // Sanity check the scenario we just created. // The visibleContentRect for testLayer is actually 100x100, even though its layout size is 50x50, positioned at 25x25. CCLayerImpl* testLayer = root->children()[0].get(); - EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), testLayer->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), testLayer->visibleContentRect()); ASSERT_EQ(1u, renderSurfaceLayerList.size()); ASSERT_EQ(1u, root->renderSurface()->layerList().size()); @@ -3073,14 +3360,14 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) EXPECT_EQ(4, resultLayer->id()); } -class MockContentLayerDelegate : public ContentLayerDelegate { +class MockContentLayerChromiumClient : public ContentLayerChromiumClient { public: - MockContentLayerDelegate() { } - virtual ~MockContentLayerDelegate() { } + MockContentLayerChromiumClient() { } + virtual ~MockContentLayerChromiumClient() { } virtual void paintContents(SkCanvas*, const IntRect& clip, FloatRect& opaque) OVERRIDE { } }; -PassRefPtr<ContentLayerChromium> createDrawableContentLayerChromium(ContentLayerDelegate* delegate) +PassRefPtr<ContentLayerChromium> createDrawableContentLayerChromium(ContentLayerChromiumClient* delegate) { RefPtr<ContentLayerChromium> toReturn = ContentLayerChromium::create(delegate); toReturn->setIsDrawable(true); @@ -3090,7 +3377,7 @@ PassRefPtr<ContentLayerChromium> createDrawableContentLayerChromium(ContentLayer TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI) { // Verify draw and screen space transforms of layers not in a surface. - MockContentLayerDelegate delegate; + MockContentLayerChromiumClient delegate; WebTransformationMatrix identityMatrix; RefPtr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&delegate); @@ -3162,7 +3449,7 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI) TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) { - MockContentLayerDelegate delegate; + MockContentLayerChromiumClient delegate; WebTransformationMatrix identityMatrix; RefPtr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&delegate); @@ -3214,7 +3501,7 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) WebTransformationMatrix expectedDuplicateChildDrawTransform = child->drawTransform(); EXPECT_TRANSFORMATION_MATRIX_EQ(child->drawTransform(), duplicateChildNonOwner->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(child->screenSpaceTransform(), duplicateChildNonOwner->screenSpaceTransform()); - EXPECT_INT_RECT_EQ(child->drawableContentRect(), duplicateChildNonOwner->drawableContentRect()); + EXPECT_RECT_EQ(child->drawableContentRect(), duplicateChildNonOwner->drawableContentRect()); EXPECT_EQ(child->contentBounds(), duplicateChildNonOwner->contentBounds()); WebTransformationMatrix expectedRenderSurfaceDrawTransform; diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp index a715f5b9a..d7e955783 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp @@ -27,15 +27,16 @@ #include "CCLayerTreeHostImpl.h" #include "CCAnimationTestCommon.h" +#include "CCGeometryTestUtils.h" #include "CCHeadsUpDisplayLayerImpl.h" #include "CCIOSurfaceLayerImpl.h" #include "CCLayerImpl.h" #include "CCLayerTestCommon.h" #include "CCLayerTilingData.h" -#include "CCLayerTreeTestCommon.h" -#include "CCQuadCuller.h" +#include "CCQuadSink.h" #include "CCRenderPassDrawQuad.h" #include "CCRendererGL.h" +#include "CCScrollbarGeometryFixedThumb.h" #include "CCScrollbarLayerImpl.h" #include "CCSettings.h" #include "CCSingleThreadProxy.h" @@ -69,7 +70,8 @@ namespace { class CCLayerTreeHostImplTest : public testing::Test, public CCLayerTreeHostImplClient { public: CCLayerTreeHostImplTest() - : m_didRequestCommit(false) + : m_onCanDrawStateChangedCalled(false) + , m_didRequestCommit(false) , m_didRequestRedraw(false) { CCLayerTreeSettings settings; @@ -83,6 +85,7 @@ public: virtual void didLoseContextOnImplThread() OVERRIDE { } virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } virtual void onVSyncParametersChanged(double, double) OVERRIDE { } + virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawStateChangedCalled = true; } virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = true; } virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = true; } virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE { } @@ -184,6 +187,7 @@ protected: DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked; OwnPtr<CCLayerTreeHostImpl> m_hostImpl; + bool m_onCanDrawStateChangedCalled; bool m_didRequestCommit; bool m_didRequestRedraw; CCScopedSettings m_scopedSettings; @@ -194,6 +198,53 @@ public: virtual bool makeContextCurrent() { return false; } }; +TEST_F(CCLayerTreeHostImplTest, notifyIfCanDrawChanged) +{ + // Note: It is not possible to disable the renderer once it has been set, + // so we do not need to test that disabling the renderer notifies us + // that canDraw changed. + EXPECT_FALSE(m_hostImpl->canDraw()); + m_onCanDrawStateChangedCalled = false; + + setupScrollAndContentsLayers(IntSize(100, 100)); + EXPECT_TRUE(m_hostImpl->canDraw()); + EXPECT_TRUE(m_onCanDrawStateChangedCalled); + m_onCanDrawStateChangedCalled = false; + + // Toggle the root layer to make sure it toggles canDraw + m_hostImpl->setRootLayer(adoptPtr<CCLayerImpl>(0)); + EXPECT_FALSE(m_hostImpl->canDraw()); + EXPECT_TRUE(m_onCanDrawStateChangedCalled); + m_onCanDrawStateChangedCalled = false; + + setupScrollAndContentsLayers(IntSize(100, 100)); + EXPECT_TRUE(m_hostImpl->canDraw()); + EXPECT_TRUE(m_onCanDrawStateChangedCalled); + m_onCanDrawStateChangedCalled = false; + + // Toggle the device viewport size to make sure it toggles canDraw. + m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(0, 0)); + EXPECT_FALSE(m_hostImpl->canDraw()); + EXPECT_TRUE(m_onCanDrawStateChangedCalled); + m_onCanDrawStateChangedCalled = false; + + m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); + EXPECT_TRUE(m_hostImpl->canDraw()); + EXPECT_TRUE(m_onCanDrawStateChangedCalled); + m_onCanDrawStateChangedCalled = false; + + // Toggle contents textures purged to make sure it toggles canDraw + m_hostImpl->releaseContentsTextures(); + EXPECT_FALSE(m_hostImpl->canDraw()); + EXPECT_TRUE(m_onCanDrawStateChangedCalled); + m_onCanDrawStateChangedCalled = false; + + m_hostImpl->resetContentsTexturesPurged(); + EXPECT_TRUE(m_hostImpl->canDraw()); + EXPECT_TRUE(m_onCanDrawStateChangedCalled); + m_onCanDrawStateChangedCalled = false; +} + TEST_F(CCLayerTreeHostImplTest, scrollDeltaNoLayers) { ASSERT_FALSE(m_hostImpl->rootLayer()); @@ -399,6 +450,24 @@ TEST_F(CCLayerTreeHostImplTest, nonFastScrollableRegionWithOffset) EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(10, 10), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollOnMainThread); } +TEST_F(CCLayerTreeHostImplTest, maxScrollPositionChangedByDeviceScaleFactor) +{ + setupScrollAndContentsLayers(IntSize(100, 100)); + + float deviceScaleFactor = 2; + IntSize layoutViewport(25, 25); + IntSize deviceViewport(layoutViewport); + deviceViewport.scale(deviceScaleFactor); + m_hostImpl->setViewportSize(layoutViewport, deviceViewport); + m_hostImpl->setDeviceScaleFactor(deviceScaleFactor); + EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollPosition(), IntSize(25, 25)); + + deviceScaleFactor = 1; + m_hostImpl->setViewportSize(layoutViewport, layoutViewport); + m_hostImpl->setDeviceScaleFactor(deviceScaleFactor); + EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollPosition(), IntSize(75, 75)); +} + TEST_F(CCLayerTreeHostImplTest, pinchGesture) { setupScrollAndContentsLayers(IntSize(100, 100)); @@ -1345,7 +1414,7 @@ class BlendStateCheckLayer : public CCLayerImpl { public: static PassOwnPtr<BlendStateCheckLayer> create(int id, CCResourceProvider* resourceProvider) { return adoptPtr(new BlendStateCheckLayer(id, resourceProvider)); } - virtual void appendQuads(CCQuadSink& quadSink, bool&) OVERRIDE + virtual void appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData) OVERRIDE { m_quadsAppended = true; @@ -1360,7 +1429,7 @@ public: testBlendingDrawQuad->setQuadVisibleRect(m_quadVisibleRect); EXPECT_EQ(m_blend, testBlendingDrawQuad->needsBlending()); EXPECT_EQ(m_hasRenderSurface, !!renderSurface()); - quadSink.append(testBlendingDrawQuad.release()); + quadSink.append(testBlendingDrawQuad.release(), appendQuadsData); } void setExpectation(bool blend, bool hasRenderSurface) @@ -1879,14 +1948,14 @@ class FakeLayerWithQuads : public CCLayerImpl { public: static PassOwnPtr<FakeLayerWithQuads> create(int id) { return adoptPtr(new FakeLayerWithQuads(id)); } - virtual void appendQuads(CCQuadSink& quadSink, bool&) OVERRIDE + virtual void appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData) OVERRIDE { CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); SkColor gray = SkColorSetRGB(100, 100, 100); IntRect quadRect(IntPoint(0, 0), contentBounds()); OwnPtr<CCDrawQuad> myQuad = CCSolidColorDrawQuad::create(sharedQuadState, quadRect, gray); - quadSink.append(myQuad.release()); + quadSink.append(myQuad.release(), appendQuadsData); } private: @@ -2416,7 +2485,7 @@ public: IntSize size(10, 10); GC3Denum format = GraphicsContext3D::RGBA; CCResourceProvider::TextureUsageHint hint = CCResourceProvider::TextureUsageAny; - setScrollbarGeometry(FakeWebScrollbarThemeGeometryNonEmpty::create()); + setScrollbarGeometry(CCScrollbarGeometryFixedThumb::create(FakeWebScrollbarThemeGeometryNonEmpty::create())); setBackTrackResourceId(provider->createResource(pool, size, format, hint)); setForeTrackResourceId(provider->createResource(pool, size, format, hint)); @@ -2801,7 +2870,7 @@ TEST_F(CCLayerTreeHostImplTest, textureCachingWithClipping) EXPECT_LT(quadVisibleRect.width(), 100); // Verify that the render surface texture is *not* clipped. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), frame.renderPasses[0]->outputRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), frame.renderPasses[0]->outputRect()); EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); @@ -3406,13 +3475,14 @@ TEST_F(CCLayerTreeHostImplTest, textureCachingWithScissor) grandChild->setDrawsContent(true); CCTiledLayerImpl* childPtr = child.get(); + CCRenderPass::Id childPassId(childPtr->id(), 0); child->addChild(grandChild.release()); root->addChild(child.release()); myHostImpl->setRootLayer(root.release()); myHostImpl->setViewportSize(rootRect.size(), rootRect.size()); - EXPECT_FALSE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(childPtr->id())); + EXPECT_FALSE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(childPassId)); { CCLayerTreeHostImpl::FrameData frame; @@ -3422,7 +3492,7 @@ TEST_F(CCLayerTreeHostImplTest, textureCachingWithScissor) } // We should have cached textures for surface 2. - EXPECT_TRUE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(childPtr->id())); + EXPECT_TRUE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(childPassId)); { CCLayerTreeHostImpl::FrameData frame; @@ -3432,7 +3502,7 @@ TEST_F(CCLayerTreeHostImplTest, textureCachingWithScissor) } // We should still have cached textures for surface 2 after drawing with no damage. - EXPECT_TRUE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(childPtr->id())); + EXPECT_TRUE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(childPassId)); // Damage a single tile of surface 2. childPtr->setUpdateRect(IntRect(10, 10, 10, 10)); @@ -3445,7 +3515,7 @@ TEST_F(CCLayerTreeHostImplTest, textureCachingWithScissor) } // We should have a cached texture for surface 2 again even though it was damaged. - EXPECT_TRUE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(childPtr->id())); + EXPECT_TRUE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(childPassId)); } TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) @@ -3807,18 +3877,18 @@ struct RenderPassCacheEntry { }; struct RenderPassRemovalTestData : public CCLayerTreeHostImpl::FrameData { - std::map<char, RenderPassCacheEntry> renderPassCache; + std::map<CCRenderPass::Id, RenderPassCacheEntry> renderPassCache; OwnPtr<CCSharedQuadState> sharedQuadState; }; class CCTestRenderPass: public CCRenderPass { public: - static PassOwnPtr<CCRenderPass> create(int id, IntRect outputRect, const WebTransformationMatrix& rootTransform) { return adoptPtr(new CCTestRenderPass(id, outputRect, rootTransform)); } + static PassOwnPtr<CCRenderPass> create(CCRenderPass::Id id, IntRect outputRect, const WebTransformationMatrix& rootTransform) { return adoptPtr(new CCTestRenderPass(id, outputRect, rootTransform)); } void appendQuad(PassOwnPtr<CCDrawQuad> quad) { m_quadList.append(quad); } protected: - CCTestRenderPass(int id, IntRect outputRect, const WebTransformationMatrix& rootTransform) : CCRenderPass(id, outputRect, rootTransform) { } + CCTestRenderPass(CCRenderPass::Id id, IntRect outputRect, const WebTransformationMatrix& rootTransform) : CCRenderPass(id, outputRect, rootTransform) { } }; class CCTestRenderer : public CCRendererGL, public CCRendererClient { @@ -3833,9 +3903,9 @@ public: } void clearCachedTextures() { m_textures.clear(); } - void setHaveCachedResourcesForRenderPassId(int id) { m_textures.add(id); } + void setHaveCachedResourcesForRenderPassId(CCRenderPass::Id id) { m_textures.add(id); } - virtual bool haveCachedResourcesForRenderPassId(int id) const OVERRIDE { return m_textures.contains(id); } + virtual bool haveCachedResourcesForRenderPassId(CCRenderPass::Id id) const OVERRIDE { return m_textures.contains(id); } // CCRendererClient implementation. virtual const IntSize& deviceViewportSize() const OVERRIDE { return m_viewportSize; } @@ -3852,7 +3922,7 @@ protected: private: CCLayerTreeSettings m_settings; IntSize m_viewportSize; - HashSet<int> m_textures; + HashSet<CCRenderPass::Id> m_textures; }; static void configureRenderPassTestData(const char* testScript, RenderPassRemovalTestData& testData, CCTestRenderer* renderer) @@ -3865,13 +3935,18 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova const char* currentChar = testScript; // Pre-create root pass - char rootRenderPassId = testScript[0]; + CCRenderPass::Id rootRenderPassId = CCRenderPass::Id(testScript[0], testScript[1]); OwnPtr<CCRenderPass> rootRenderPass = CCTestRenderPass::create(rootRenderPassId, IntRect(), WebTransformationMatrix()); - testData.renderPassCache.insert(std::pair<char, RenderPassCacheEntry>(rootRenderPassId, RenderPassCacheEntry(rootRenderPass.release()))); + testData.renderPassCache.insert(std::pair<CCRenderPass::Id, RenderPassCacheEntry>(rootRenderPassId, RenderPassCacheEntry(rootRenderPass.release()))); while (*currentChar) { - char renderPassId = currentChar[0]; + int layerId = *currentChar; + currentChar++; + ASSERT_TRUE(currentChar); + int index = *currentChar; currentChar++; + CCRenderPass::Id renderPassId = CCRenderPass::Id(layerId, index); + OwnPtr<CCRenderPass> renderPass; bool isReplica = false; @@ -3890,9 +3965,13 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova currentChar++; } else if ((*currentChar >= 'A') && (*currentChar <= 'Z')) { // RenderPass draw quad - char newRenderPassId = *currentChar; - ASSERT_NE(rootRenderPassId, newRenderPassId); + int layerId = *currentChar; + currentChar++; + ASSERT_TRUE(currentChar); + int index = *currentChar; currentChar++; + CCRenderPass::Id newRenderPassId = CCRenderPass::Id(layerId, index); + ASSERT_NE(rootRenderPassId, newRenderPassId); bool hasTexture = false; bool contentsChanged = true; @@ -3918,7 +3997,7 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova renderer->setHaveCachedResourcesForRenderPassId(newRenderPassId); OwnPtr<CCRenderPass> renderPass = CCTestRenderPass::create(newRenderPassId, IntRect(), WebTransformationMatrix()); - testData.renderPassCache.insert(std::pair<char, RenderPassCacheEntry>(newRenderPassId, RenderPassCacheEntry(renderPass.release()))); + testData.renderPassCache.insert(std::pair<CCRenderPass::Id, RenderPassCacheEntry>(newRenderPassId, RenderPassCacheEntry(renderPass.release()))); } IntRect quadRect = IntRect(0, 0, 1, 1); @@ -3939,7 +4018,9 @@ void dumpRenderPassTestData(const RenderPassRemovalTestData& testData, char* buf char* pos = buffer; for (CCRenderPassList::const_reverse_iterator it = testData.renderPasses.rbegin(); it != testData.renderPasses.rend(); ++it) { const CCRenderPass* currentPass = *it; - *pos = currentPass->id(); + *pos = currentPass->id().layerId; + pos++; + *pos = currentPass->id().index; pos++; CCQuadList::const_iterator quadListIterator = currentPass->quadList().begin(); @@ -3951,7 +4032,9 @@ void dumpRenderPassTestData(const RenderPassRemovalTestData& testData, char* buf pos++; break; case CCDrawQuad::RenderPass: - *pos = CCRenderPassDrawQuad::materialCast(currentQuad)->renderPassId(); + *pos = CCRenderPassDrawQuad::materialCast(currentQuad)->renderPassId().layerId; + pos++; + *pos = CCRenderPassDrawQuad::materialCast(currentQuad)->renderPassId().index; pos++; break; default: @@ -3995,115 +4078,115 @@ TestCase removeRenderPassesCases[] = { { "Single root pass", - "Rssss\n", - "Rssss\n" + "R0ssss\n", + "R0ssss\n" }, { "Single pass - no quads", - "R\n", - "R\n" + "R0\n", + "R0\n" }, { "Two passes, no removal", - "RssssAsss\n" - "Assss\n", - "RssssAsss\n" - "Assss\n" + "R0ssssA0sss\n" + "A0ssss\n", + "R0ssssA0sss\n" + "A0ssss\n" }, { "Two passes, remove last", - "RssssA[ct]sss\n" - "Assss\n", - "RssssAsss\n" + "R0ssssA0[ct]sss\n" + "A0ssss\n", + "R0ssssA0sss\n" }, { "Have texture but contents changed - leave pass", - "RssssA[t]sss\n" - "Assss\n", - "RssssAsss\n" - "Assss\n" + "R0ssssA0[t]sss\n" + "A0ssss\n", + "R0ssssA0sss\n" + "A0ssss\n" }, { "Contents didn't change but no texture - leave pass", - "RssssA[c]sss\n" - "Assss\n", - "RssssAsss\n" - "Assss\n" + "R0ssssA0[c]sss\n" + "A0ssss\n", + "R0ssssA0sss\n" + "A0ssss\n" }, { "Replica: two quads reference the same pass; remove", - "RssssA[ct]A[ct]sss\n" - "Assss\n", - "RssssAAsss\n" + "R0ssssA0[ct]A0[ct]sss\n" + "A0ssss\n", + "R0ssssA0A0sss\n" }, { "Replica: two quads reference the same pass; leave", - "RssssA[c]A[c]sss\n" - "Assss\n", - "RssssAAsss\n" - "Assss\n", + "R0ssssA0[c]A0[c]sss\n" + "A0ssss\n", + "R0ssssA0A0sss\n" + "A0ssss\n", }, { "Many passes, remove all", - "RssssA[ct]sss\n" - "AsssB[ct]C[ct]s\n" - "BsssD[ct]ssE[ct]F[ct]\n" - "Essssss\n" - "CG[ct]\n" - "Dsssssss\n" - "Fsssssss\n" - "Gsss\n", - - "RssssAsss\n" + "R0ssssA0[ct]sss\n" + "A0sssB0[ct]C0[ct]s\n" + "B0sssD0[ct]ssE0[ct]F0[ct]\n" + "E0ssssss\n" + "C0G0[ct]\n" + "D0sssssss\n" + "F0sssssss\n" + "G0sss\n", + + "R0ssssA0sss\n" }, { "Deep recursion, remove all", - "RsssssA[ct]ssss\n" - "AssssBsss\n" - "BC\n" - "CD\n" - "DE\n" - "EF\n" - "FG\n" - "GH\n" - "HsssIsss\n" - "IJ\n" - "Jssss\n", + "R0sssssA0[ct]ssss\n" + "A0ssssB0sss\n" + "B0C0\n" + "C0D0\n" + "D0E0\n" + "E0F0\n" + "F0G0\n" + "G0H0\n" + "H0sssI0sss\n" + "I0J0\n" + "J0ssss\n", - "RsssssAssss\n" + "R0sssssA0ssss\n" }, { "Wide recursion, remove all", - "RA[ct]B[ct]C[ct]D[ct]E[ct]F[ct]G[ct]H[ct]I[ct]J[ct]\n" - "As\n" - "Bs\n" - "Cssss\n" - "Dssss\n" - "Es\n" - "F\n" - "Gs\n" - "Hs\n" - "Is\n" - "Jssss\n", + "R0A0[ct]B0[ct]C0[ct]D0[ct]E0[ct]F0[ct]G0[ct]H0[ct]I0[ct]J0[ct]\n" + "A0s\n" + "B0s\n" + "C0ssss\n" + "D0ssss\n" + "E0s\n" + "F0\n" + "G0s\n" + "H0s\n" + "I0s\n" + "J0ssss\n", - "RABCDEFGHIJ\n" + "R0A0B0C0D0E0F0G0H0I0J0\n" }, { "Remove passes regardless of cache state", - "RssssA[ct]sss\n" - "AsssBCs\n" - "BsssD[c]ssE[t]F\n" - "Essssss\n" - "CG\n" - "Dsssssss\n" - "Fsssssss\n" - "Gsss\n", - - "RssssAsss\n" + "R0ssssA0[ct]sss\n" + "A0sssB0C0s\n" + "B0sssD0[c]ssE0[t]F0\n" + "E0ssssss\n" + "C0G0\n" + "D0sssssss\n" + "F0sssssss\n" + "G0sss\n", + + "R0ssssA0sss\n" }, { "Leave some passes, remove others", - "RssssA[c]sss\n" - "AsssB[t]C[ct]s\n" - "BsssD[c]ss\n" - "CG\n" - "Dsssssss\n" - "Gsss\n", - - "RssssAsss\n" - "AsssBCs\n" - "BsssDss\n" - "Dsssssss\n" + "R0ssssA0[c]sss\n" + "A0sssB0[t]C0[ct]s\n" + "B0sssD0[c]ss\n" + "C0G0\n" + "D0sssssss\n" + "G0sss\n", + + "R0ssssA0sss\n" + "A0sssB0C0s\n" + "B0sssD0ss\n" + "D0sssssss\n" }, { 0, 0, 0 } diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp index c026bd4f5..9ce449504 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp @@ -26,6 +26,7 @@ #include "CCLayerTreeHost.h" +#include "CCGeometryTestUtils.h" #include "CCGraphicsContext.h" #include "CCLayerTreeHostImpl.h" #include "CCOcclusionTrackerTestCommon.h" @@ -35,23 +36,19 @@ #include "CCThreadedTest.h" #include "CCTimingFunction.h" #include "ContentLayerChromium.h" +#include "ContentLayerChromiumClient.h" +#include "Extensions3DChromium.h" +#include "FakeWebCompositorOutputSurface.h" #include <gmock/gmock.h> -#include <gtest/gtest.h> #include <public/Platform.h> -#include <public/WebThread.h> +#include <public/WebLayerScrollClient.h> +#include <public/WebSize.h> #include <wtf/MainThread.h> #include <wtf/OwnArrayPtr.h> using namespace WebCore; using namespace WebKit; using namespace WebKitTests; -using namespace WTF; - -#define EXPECT_EQ_RECT(a, b) \ - EXPECT_EQ(a.x(), b.x()); \ - EXPECT_EQ(a.y(), b.y()); \ - EXPECT_EQ(a.width(), b.width()); \ - EXPECT_EQ(a.height(), b.height()); namespace { @@ -518,6 +515,63 @@ TEST_F(CCLayerTreeHostTestAbortFrameWhenInvisible, runMultiThread) runTest(true); } +// Makes sure that setNedsAnimate does not cause the commitRequested() state to be set. +class CCLayerTreeHostTestSetNeedsAnimateShouldNotSetCommitRequested : public CCLayerTreeHostTest { +public: + CCLayerTreeHostTestSetNeedsAnimateShouldNotSetCommitRequested() + : m_numCommits(0) + { + } + + virtual void beginTest() OVERRIDE + { + // The tests start up with a commit pending because we give them a root layer. + // We need to wait for the commit to happen before doing anything. + EXPECT_TRUE(m_layerTreeHost->commitRequested()); + } + + virtual void animate(double monotonicTime) OVERRIDE + { + // We skip the first commit becasue its the commit that populates the + // impl thread with a tree. + if (!m_numCommits) + return; + + m_layerTreeHost->setNeedsAnimate(); + // Right now, commitRequested is going to be true, because during + // beginFrame, we force commitRequested to true to prevent requests from + // hitting the impl thread. But, when the next didCommit happens, we should + // verify that commitRequested has gone back to false. + } + virtual void didCommit() OVERRIDE + { + if (!m_numCommits) { + EXPECT_FALSE(m_layerTreeHost->commitRequested()); + m_layerTreeHost->setNeedsAnimate(); + EXPECT_FALSE(m_layerTreeHost->commitRequested()); + m_numCommits++; + } + + // Verifies that the setNeedsAnimate we made in ::animate did not + // trigger commitRequested. + EXPECT_FALSE(m_layerTreeHost->commitRequested()); + endTest(); + } + + virtual void afterTest() OVERRIDE + { + } + +private: + int m_numCommits; +}; + +TEST_F(CCLayerTreeHostTestSetNeedsAnimateShouldNotSetCommitRequested, runMultiThread) +{ + runTest(true); +} + + // Trigger a frame with setNeedsCommit. Then, inside the resulting animate // callback, requet another frame using setNeedsAnimate. End the test when @@ -536,7 +590,7 @@ public: postSetNeedsAnimateToMainThread(); } - virtual void updateAnimations(double) OVERRIDE + virtual void animate(double) OVERRIDE { if (!m_numAnimates) { m_layerTreeHost->setNeedsAnimate(); @@ -912,7 +966,7 @@ private: int m_scrolls; }; -TEST_F(CCLayerTreeHostTestScrollSimple, DISABLED_runMultiThread) +TEST_F(CCLayerTreeHostTestScrollSimple, runMultiThread) { runTest(true); } @@ -1133,7 +1187,7 @@ TEST_F(CCLayerTreeHostTestSetVisible, runMultiThread) runTest(true); } -class TestOpacityChangeLayerDelegate : public ContentLayerDelegate { +class TestOpacityChangeLayerDelegate : public ContentLayerChromiumClient { public: TestOpacityChangeLayerDelegate(CCLayerTreeHostTest* test) : m_test(test) @@ -1152,7 +1206,7 @@ private: class ContentLayerChromiumWithUpdateTracking : public ContentLayerChromium { public: - static PassRefPtr<ContentLayerChromiumWithUpdateTracking> create(ContentLayerDelegate *delegate) { return adoptRef(new ContentLayerChromiumWithUpdateTracking(delegate)); } + static PassRefPtr<ContentLayerChromiumWithUpdateTracking> create(ContentLayerChromiumClient* client) { return adoptRef(new ContentLayerChromiumWithUpdateTracking(client)); } int paintContentsCount() { return m_paintContentsCount; } void resetPaintContentsCount() { m_paintContentsCount = 0; } @@ -1164,8 +1218,8 @@ public: } private: - explicit ContentLayerChromiumWithUpdateTracking(ContentLayerDelegate* delegate) - : ContentLayerChromium(delegate) + explicit ContentLayerChromiumWithUpdateTracking(ContentLayerChromiumClient* client) + : ContentLayerChromium(client) , m_paintContentsCount(0) { setAnchorPoint(FloatPoint(0, 0)); @@ -1217,7 +1271,7 @@ TEST_F(CCLayerTreeHostTestOpacityChange, runMultiThread) runTest(true); } -class MockContentLayerDelegate : public ContentLayerDelegate { +class MockContentLayerChromiumClient : public ContentLayerChromiumClient { public: bool drawsContent() const { return true; } MOCK_CONST_METHOD0(preserves3D, bool()); @@ -1225,12 +1279,23 @@ public: void notifySyncRequired() { } }; +class NoScaleContentLayerChromium : public ContentLayerChromium { +public: + static PassRefPtr<NoScaleContentLayerChromium> create(ContentLayerChromiumClient* client) { return adoptRef(new NoScaleContentLayerChromium(client)); } + + virtual bool needsContentsScale() const OVERRIDE { return false; } + +private: + explicit NoScaleContentLayerChromium(ContentLayerChromiumClient* client) + : ContentLayerChromium(client) { } +}; + class CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers : public CCLayerTreeHostTest { public: CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() - : m_rootLayer(ContentLayerChromium::create(&m_delegate)) - , m_childLayer(ContentLayerChromium::create(&m_delegate)) + : m_rootLayer(NoScaleContentLayerChromium::create(&m_client)) + , m_childLayer(ContentLayerChromium::create(&m_client)) { } @@ -1289,7 +1354,12 @@ public: ASSERT_EQ(2u, root->renderSurface()->layerList().size()); // The root render surface is the size of the viewport. - EXPECT_EQ_RECT(IntRect(0, 0, 60, 60), root->renderSurface()->contentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 60, 60), root->renderSurface()->contentRect()); + + // The content bounds of the child should be scaled. + IntSize childBoundsScaled = child->bounds(); + childBoundsScaled.scale(1.5); + EXPECT_EQ(childBoundsScaled, child->contentBounds()); WebTransformationMatrix scaleTransform; scaleTransform.scale(impl->deviceScaleFactor()); @@ -1301,11 +1371,10 @@ public: EXPECT_EQ(rootDrawTransform, root->drawTransform()); EXPECT_EQ(rootScreenSpaceTransform, root->screenSpaceTransform()); - // The child is at position 2,2, so translate by 2,2 before applying the scale by 2x. - WebTransformationMatrix childScreenSpaceTransform = scaleTransform; - childScreenSpaceTransform.translate(2, 2); - WebTransformationMatrix childDrawTransform = scaleTransform; - childDrawTransform.translate(2, 2); + // The child is at position 2,2, which is transformed to 3,3 after the scale + WebTransformationMatrix childScreenSpaceTransform; + childScreenSpaceTransform.translate(3, 3); + WebTransformationMatrix childDrawTransform = childScreenSpaceTransform; EXPECT_EQ(childDrawTransform, child->drawTransform()); EXPECT_EQ(childScreenSpaceTransform, child->screenSpaceTransform()); @@ -1320,8 +1389,8 @@ public: } private: - MockContentLayerDelegate m_delegate; - RefPtr<ContentLayerChromium> m_rootLayer; + MockContentLayerChromiumClient m_client; + RefPtr<NoScaleContentLayerChromium> m_rootLayer; RefPtr<ContentLayerChromium> m_childLayer; }; @@ -1334,7 +1403,7 @@ TEST_F(CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers, runMultiThre class CCLayerTreeHostTestAtomicCommit : public CCLayerTreeHostTest { public: CCLayerTreeHostTestAtomicCommit() - : m_layer(ContentLayerChromiumWithUpdateTracking::create(&m_delegate)) + : m_layer(ContentLayerChromiumWithUpdateTracking::create(&m_client)) { // Make sure partial texture updates are turned off. m_settings.maxPartialTextureUpdates = 0; @@ -1408,7 +1477,7 @@ public: } private: - MockContentLayerDelegate m_delegate; + MockContentLayerChromiumClient m_client; RefPtr<ContentLayerChromiumWithUpdateTracking> m_layer; }; @@ -1432,8 +1501,8 @@ static void setLayerPropertiesForTesting(LayerChromium* layer, LayerChromium* pa class CCLayerTreeHostTestAtomicCommitWithPartialUpdate : public CCLayerTreeHostTest { public: CCLayerTreeHostTestAtomicCommitWithPartialUpdate() - : m_parent(ContentLayerChromiumWithUpdateTracking::create(&m_delegate)) - , m_child(ContentLayerChromiumWithUpdateTracking::create(&m_delegate)) + : m_parent(ContentLayerChromiumWithUpdateTracking::create(&m_client)) + , m_child(ContentLayerChromiumWithUpdateTracking::create(&m_client)) , m_numCommits(0) { // Allow one partial texture update. @@ -1555,7 +1624,7 @@ public: } private: - MockContentLayerDelegate m_delegate; + MockContentLayerChromiumClient m_client; RefPtr<ContentLayerChromiumWithUpdateTracking> m_parent; RefPtr<ContentLayerChromiumWithUpdateTracking> m_child; int m_numCommits; @@ -1629,11 +1698,11 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); // If the child layer is opaque, then it adds to the occlusion seen by the rootLayer. @@ -1646,11 +1715,11 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 170, 170), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); // Add a second child to the root layer and the regions should merge @@ -1664,13 +1733,13 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 170, 170), child2->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), child2->occludedScreenSpace().bounds()); EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 20, 170, 180), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 20, 170, 180), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size()); // Move the second child to be sure. @@ -1684,13 +1753,13 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 170, 170), child2->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), child2->occludedScreenSpace().bounds()); EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 30, 190, 170), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 30, 190, 170), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size()); // If the child layer has a mask on it, then it shouldn't contribute to occlusion on stuff below it @@ -1706,13 +1775,13 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); // If the child layer with a mask is below child2, then child2 should contribute to occlusion on everything, and child shouldn't contribute to the rootLayer @@ -1728,13 +1797,13 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); // If the child layer has a non-opaque drawOpacity, then it shouldn't contribute to occlusion on stuff below it @@ -1751,13 +1820,13 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); // If the child layer with non-opaque drawOpacity is below child2, then child2 should contribute to occlusion on everything, and child shouldn't contribute to the rootLayer @@ -1774,13 +1843,13 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); // Kill the layerTreeHost immediately. @@ -1837,13 +1906,13 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); // If the child layer has a filter that moves pixels/changes alpha, and is below child2, then child should not inherit occlusion from outside its subtree, @@ -1864,13 +1933,13 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); // Kill the layerTreeHost immediately. @@ -1929,7 +1998,7 @@ public: for (int i = 0; i < numSurfaces-1; ++i) { IntRect expectedOcclusion(i+1, i+1, 200-i-1, 200-i-1); - EXPECT_EQ_RECT(expectedOcclusion, layers[i]->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(expectedOcclusion, layers[i]->occludedScreenSpace().bounds()); EXPECT_EQ(1u, layers[i]->occludedScreenSpace().rects().size()); } @@ -2160,7 +2229,7 @@ private: SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestLayerAddedWithAnimation) -class CCLayerTreeHostTestScrollChildLayer : public CCLayerTreeHostTest, public LayerChromiumScrollDelegate { +class CCLayerTreeHostTestScrollChildLayer : public CCLayerTreeHostTest, public WebLayerScrollClient { public: CCLayerTreeHostTestScrollChildLayer() : m_scrollAmount(2, 1) @@ -2183,7 +2252,7 @@ public: m_rootScrollLayer->setMaxScrollPosition(IntSize(100, 100)); m_layerTreeHost->rootLayer()->addChild(m_rootScrollLayer); m_childLayer = ContentLayerChromium::create(&m_mockDelegate); - m_childLayer->setLayerScrollDelegate(this); + m_childLayer->setLayerScrollClient(this); m_childLayer->setBounds(IntSize(50, 50)); m_childLayer->setIsDrawable(true); m_childLayer->setScrollable(true); @@ -2196,9 +2265,9 @@ public: postSetNeedsCommitToMainThread(); } - virtual void didScroll(const IntSize& scrollDelta) OVERRIDE + virtual void didScroll() OVERRIDE { - m_reportedScrollAmount = scrollDelta; + m_finalScrollPosition = m_childLayer->scrollPosition(); } virtual void applyScrollAndScale(const IntSize& scrollDelta, float) OVERRIDE @@ -2228,13 +2297,13 @@ public: virtual void afterTest() OVERRIDE { - EXPECT_EQ(m_scrollAmount, m_reportedScrollAmount); + EXPECT_EQ(IntPoint(m_scrollAmount), m_finalScrollPosition); } private: const IntSize m_scrollAmount; - IntSize m_reportedScrollAmount; - MockContentLayerDelegate m_mockDelegate; + IntPoint m_finalScrollPosition; + MockContentLayerChromiumClient m_mockDelegate; RefPtr<LayerChromium> m_childLayer; RefPtr<LayerChromium> m_rootScrollLayer; }; @@ -2300,8 +2369,8 @@ public: virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* hostImpl) OVERRIDE { CCRenderer* renderer = hostImpl->renderer(); - unsigned surface1RenderPassId = hostImpl->rootLayer()->children()[0]->id(); - unsigned surface2RenderPassId = hostImpl->rootLayer()->children()[0]->children()[0]->id(); + CCRenderPass::Id surface1RenderPassId = hostImpl->rootLayer()->children()[0]->renderSurface()->renderPassId(); + CCRenderPass::Id surface2RenderPassId = hostImpl->rootLayer()->children()[0]->children()[0]->renderSurface()->renderPassId(); switch (hostImpl->sourceFrameNumber()) { case 0: @@ -2336,7 +2405,7 @@ public: } private: - MockContentLayerDelegate m_mockDelegate; + MockContentLayerChromiumClient m_mockDelegate; RefPtr<ContentLayerChromiumWithUpdateTracking> m_rootLayer; RefPtr<ContentLayerChromiumWithUpdateTracking> m_surfaceLayer1; RefPtr<ContentLayerChromiumWithUpdateTracking> m_replicaLayer1; @@ -2408,11 +2477,13 @@ public: return adoptPtr(new EvictionTestLayerImpl(id)); } virtual ~EvictionTestLayerImpl() { } - virtual void appendQuads(CCQuadSink&, bool& hadMissingTiles) OVERRIDE + + virtual void appendQuads(CCQuadSink& quadSink, CCAppendQuadsData&) OVERRIDE { ASSERT_TRUE(m_hasTexture); ASSERT_NE(0u, layerTreeHostImpl()->resourceProvider()->numResources()); } + void setHasTexture(bool hasTexture) { m_hasTexture = hasTexture; } private: @@ -2582,7 +2653,7 @@ public: } private: - MockContentLayerDelegate m_delegate; + MockContentLayerChromiumClient m_client; RefPtr<EvictionTestLayer> m_layer; CCLayerTreeHostImpl* m_implForEvictTextures; int m_numCommits; @@ -2678,7 +2749,7 @@ public: } private: - MockContentLayerDelegate m_delegate; + MockContentLayerChromiumClient m_client; RefPtr<EvictionTestLayer> m_layer; CCLayerTreeHostImpl* m_implForEvictTextures; int m_numCommits; @@ -2686,4 +2757,263 @@ private: SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestLostContextAfterEvictTextures) +class CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext : public WebKit::CompositorFakeWebGraphicsContext3D { +public: + static PassOwnPtr<CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext> create(Attributes attrs) + { + return adoptPtr(new CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext(attrs)); + } + + virtual void setContextLostCallback(WebGraphicsContextLostCallback* callback) { m_contextLostCallback = callback; } + virtual bool isContextLost() { return m_isContextLost; } + + virtual void beginQueryEXT(GC3Denum, WebGLId) { } + virtual void endQueryEXT(GC3Denum) + { + // Lose context. + if (!m_isContextLost) { + m_contextLostCallback->onContextLost(); + m_isContextLost = true; + } + } + virtual void getQueryObjectuivEXT(WebGLId, GC3Denum pname, GC3Duint* params) + { + // Context is lost. Result will never be available. + if (pname == Extensions3DChromium::QUERY_RESULT_AVAILABLE_EXT) + *params = 0; + } + +private: + explicit CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext(Attributes attrs) + : CompositorFakeWebGraphicsContext3D(attrs) + , m_contextLostCallback(0) + , m_isContextLost(false) { } + + WebGraphicsContextLostCallback* m_contextLostCallback; + bool m_isContextLost; +}; + +class CCLayerTreeHostTestLostContextWhileUpdatingResources : public CCLayerTreeHostTest { +public: + CCLayerTreeHostTestLostContextWhileUpdatingResources() + : m_parent(ContentLayerChromiumWithUpdateTracking::create(&m_client)) + , m_numChildren(50) + { + for (int i = 0; i < m_numChildren; i++) + m_children.append(ContentLayerChromiumWithUpdateTracking::create(&m_client)); + } + + virtual PassOwnPtr<WebKit::WebCompositorOutputSurface> createOutputSurface() + { + return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::create(WebGraphicsContext3D::Attributes())); + } + + virtual void beginTest() + { + m_layerTreeHost->setRootLayer(m_parent); + m_layerTreeHost->setViewportSize(IntSize(m_numChildren, 1), IntSize(m_numChildren, 1)); + + WebTransformationMatrix identityMatrix; + setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(m_numChildren, 1), true); + for (int i = 0; i < m_numChildren; i++) + setLayerPropertiesForTesting(m_children[i].get(), m_parent.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(i, 0), IntSize(1, 1), false); + + postSetNeedsCommitToMainThread(); + } + + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) + { + endTest(); + } + + virtual void layout() + { + m_parent->setNeedsDisplay(); + for (int i = 0; i < m_numChildren; i++) + m_children[i]->setNeedsDisplay(); + } + + virtual void afterTest() + { + } + +private: + MockContentLayerChromiumClient m_client; + RefPtr<ContentLayerChromiumWithUpdateTracking> m_parent; + int m_numChildren; + Vector<RefPtr<ContentLayerChromiumWithUpdateTracking> > m_children; +}; + +TEST_F(CCLayerTreeHostTestLostContextWhileUpdatingResources, runMultiThread) +{ + runTest(true); +} + +class CCLayerTreeHostTestContinuousCommit : public CCLayerTreeHostTest { +public: + CCLayerTreeHostTestContinuousCommit() + : m_numCommitComplete(0) + , m_numDrawLayers(0) + { + } + + virtual void beginTest() OVERRIDE + { + m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10)); + m_layerTreeHost->rootLayer()->setBounds(IntSize(10, 10)); + + postSetNeedsCommitToMainThread(); + } + + virtual void didCommit() OVERRIDE + { + postSetNeedsCommitToMainThread(); + } + + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE + { + if (m_numDrawLayers == 1) + m_numCommitComplete++; + } + + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + { + m_numDrawLayers++; + if (m_numDrawLayers == 2) + endTest(); + } + + virtual void afterTest() OVERRIDE + { + // Check that we didn't commit twice between first and second draw. + EXPECT_EQ(1, m_numCommitComplete); + } + +private: + int m_numCommitComplete; + int m_numDrawLayers; +}; + +TEST_F(CCLayerTreeHostTestContinuousCommit, runMultiThread) +{ + runTest(true); +} + +class CCLayerTreeHostTestContinuousInvalidate : public CCLayerTreeHostTest { +public: + CCLayerTreeHostTestContinuousInvalidate() + : m_numCommitComplete(0) + , m_numDrawLayers(0) + { + } + + virtual void beginTest() OVERRIDE + { + m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10)); + m_layerTreeHost->rootLayer()->setBounds(IntSize(10, 10)); + + m_contentLayer = ContentLayerChromium::create(&m_mockDelegate); + m_contentLayer->setBounds(IntSize(10, 10)); + m_contentLayer->setPosition(FloatPoint(0, 0)); + m_contentLayer->setAnchorPoint(FloatPoint(0, 0)); + m_contentLayer->setIsDrawable(true); + m_layerTreeHost->rootLayer()->addChild(m_contentLayer); + + postSetNeedsCommitToMainThread(); + } + + virtual void didCommit() OVERRIDE + { + m_contentLayer->setNeedsDisplay(); + } + + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE + { + if (m_numDrawLayers == 1) + m_numCommitComplete++; + } + + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + { + m_numDrawLayers++; + if (m_numDrawLayers == 2) + endTest(); + } + + virtual void afterTest() OVERRIDE + { + // Check that we didn't commit twice between first and second draw. + EXPECT_EQ(1, m_numCommitComplete); + + // Clear layer references so CCLayerTreeHost dies. + m_contentLayer.clear(); + } + +private: + MockContentLayerChromiumClient m_mockDelegate; + RefPtr<LayerChromium> m_contentLayer; + int m_numCommitComplete; + int m_numDrawLayers; +}; + +TEST_F(CCLayerTreeHostTestContinuousInvalidate, runMultiThread) +{ + runTest(true); +} + +class CCLayerTreeHostTestContinuousAnimate : public CCLayerTreeHostTest { +public: + CCLayerTreeHostTestContinuousAnimate() + : m_numCommitComplete(0) + , m_numDrawLayers(0) + { + } + + virtual void beginTest() OVERRIDE + { + m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10)); + m_layerTreeHost->rootLayer()->setBounds(IntSize(10, 10)); + + postSetNeedsCommitToMainThread(); + } + + virtual void animate(double) OVERRIDE + { + m_layerTreeHost->setNeedsAnimate(); + } + + virtual void layout() OVERRIDE + { + m_layerTreeHost->rootLayer()->setNeedsDisplay(); + } + + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) OVERRIDE + { + if (m_numDrawLayers == 1) + m_numCommitComplete++; + } + + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE + { + m_numDrawLayers++; + if (m_numDrawLayers == 2) + endTest(); + } + + virtual void afterTest() OVERRIDE + { + // Check that we didn't commit twice between first and second draw. + EXPECT_EQ(1, m_numCommitComplete); + } + +private: + int m_numCommitComplete; + int m_numDrawLayers; +}; + +TEST_F(CCLayerTreeHostTestContinuousAnimate, runMultiThread) +{ + runTest(true); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/CCMathUtilTest.cpp b/Source/WebKit/chromium/tests/CCMathUtilTest.cpp index 416e1b56d..553f7a647 100644 --- a/Source/WebKit/chromium/tests/CCMathUtilTest.cpp +++ b/Source/WebKit/chromium/tests/CCMathUtilTest.cpp @@ -26,7 +26,7 @@ #include "CCMathUtil.h" -#include "CCLayerTreeTestCommon.h" +#include "CCGeometryTestUtils.h" #include "FloatRect.h" #include <gmock/gmock.h> #include <gtest/gtest.h> diff --git a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp index 4e5f9dc88..560784ba3 100644 --- a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp @@ -27,10 +27,10 @@ #include "CCOcclusionTracker.h" #include "CCAnimationTestCommon.h" +#include "CCGeometryTestUtils.h" #include "CCLayerAnimationController.h" #include "CCLayerImpl.h" #include "CCLayerTreeHostCommon.h" -#include "CCLayerTreeTestCommon.h" #include "CCMathUtil.h" #include "CCOcclusionTrackerTestCommon.h" #include "CCOverdrawMetrics.h" @@ -446,9 +446,9 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); @@ -466,14 +466,14 @@ protected: occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70)).isEmpty()); - EXPECT_INT_RECT_EQ(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70))); + EXPECT_RECT_EQ(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70))); + EXPECT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70))); + EXPECT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); + EXPECT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70))); + EXPECT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70))); + EXPECT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70))); + EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70))); + EXPECT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70))); } }; @@ -499,9 +499,9 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); @@ -519,14 +519,14 @@ protected: occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70)).isEmpty()); - EXPECT_INT_RECT_EQ(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70))); + EXPECT_RECT_EQ(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70))); + EXPECT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70))); + EXPECT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); + EXPECT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70))); + EXPECT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70))); + EXPECT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70))); + EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70))); + EXPECT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70))); } }; @@ -550,9 +550,9 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(50, 50, 50, 50))); @@ -570,25 +570,25 @@ protected: occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 50, 50, 50)).isEmpty()); - EXPECT_INT_RECT_EQ(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(51, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(100, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(51, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(50, 100, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(49, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); + EXPECT_RECT_EQ(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50))); + EXPECT_RECT_EQ(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50))); + EXPECT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50))); + EXPECT_RECT_EQ(IntRect(51, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50))); + EXPECT_RECT_EQ(IntRect(100, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50, 50))); + EXPECT_RECT_EQ(IntRect(51, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50, 50))); + EXPECT_RECT_EQ(IntRect(50, 100, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50, 50))); + EXPECT_RECT_EQ(IntRect(49, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); occlusion.useDefaultLayerClipRect(); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 50, 50, 50)).isEmpty()); - EXPECT_INT_RECT_EQ(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(51, 49, 49, 1), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50))); + EXPECT_RECT_EQ(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50))); + EXPECT_RECT_EQ(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50))); + EXPECT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50))); + EXPECT_RECT_EQ(IntRect(51, 49, 49, 1), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50))); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50, 50)).isEmpty()); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50, 50)).isEmpty()); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50, 50)).isEmpty()); - EXPECT_INT_RECT_EQ(IntRect(49, 51, 1, 49), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); + EXPECT_RECT_EQ(IntRect(49, 51, 1, 49), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); } }; @@ -606,6 +606,7 @@ protected: childTransform.translate(-250, -250); typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); + parent->setMasksToBounds(true); typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500)); child->setMasksToBounds(true); typename Types::ContentLayerType* layer = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); @@ -617,17 +618,17 @@ protected: this->visitLayer(layer, occlusion); this->enterContributingSurface(child, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60))); @@ -685,6 +686,7 @@ protected: childTransform.translate(-250, -250); typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); + parent->setMasksToBounds(true); typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500)); child->setMasksToBounds(true); typename Types::ContentLayerType* layer = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); @@ -698,36 +700,36 @@ protected: this->visitLayer(child2, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(layer, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->enterContributingSurface(child, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // Occlusion in |child2| should get merged with the |child| surface we are leaving now. this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(90, 30, 10, 10), occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70))); + EXPECT_RECT_EQ(IntRect(90, 30, 10, 10), occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70))); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 60, 10))); EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 60, 10))); @@ -740,21 +742,21 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60))); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 60, 10)).isEmpty()); - EXPECT_INT_RECT_EQ(IntRect(29, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 60, 10))); - EXPECT_INT_RECT_EQ(IntRect(30, 29, 60, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 60, 10))); - EXPECT_INT_RECT_EQ(IntRect(90, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 60, 10))); + EXPECT_RECT_EQ(IntRect(29, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 60, 10))); + EXPECT_RECT_EQ(IntRect(30, 29, 60, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 60, 10))); + EXPECT_RECT_EQ(IntRect(90, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 60, 10))); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 31, 60, 10)).isEmpty()); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 40, 70, 60)).isEmpty()); - EXPECT_INT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); + EXPECT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); // This rect is mostly occluded by |child2|. - EXPECT_INT_RECT_EQ(IntRect(90, 39, 10, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60))); + EXPECT_RECT_EQ(IntRect(90, 39, 10, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60))); // This rect extends past top/right ends of |child2|. - EXPECT_INT_RECT_EQ(IntRect(30, 29, 70, 11), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); + EXPECT_RECT_EQ(IntRect(30, 29, 70, 11), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); // This rect extends past left/right ends of |child2|. - EXPECT_INT_RECT_EQ(IntRect(20, 39, 80, 60), occlusion.unoccludedContentRect(parent, IntRect(20, 39, 80, 60))); - EXPECT_INT_RECT_EQ(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60))); - EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60))); + EXPECT_RECT_EQ(IntRect(20, 39, 80, 60), occlusion.unoccludedContentRect(parent, IntRect(20, 39, 80, 60))); + EXPECT_RECT_EQ(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60))); + EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60))); /* Justification for the above occlusion from |layer|: 100 @@ -812,9 +814,9 @@ protected: this->visitLayer(layer, occlusion); this->enterContributingSurface(child, occlusion); - EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(clippedLayerInChild, occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(clippedLayerInChild, occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child, clippedLayerInChild)); @@ -839,13 +841,13 @@ protected: this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(75, 55, 1, 1))); - EXPECT_INT_RECT_EQ(IntRect(75, 55, 1, 1), occlusion.unoccludedContentRect(parent, IntRect(75, 55, 1, 1))); + EXPECT_RECT_EQ(IntRect(75, 55, 1, 1), occlusion.unoccludedContentRect(parent, IntRect(75, 55, 1, 1))); } }; @@ -862,6 +864,7 @@ protected: childTransform.translate(-250, -250); typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); + parent->setMasksToBounds(true); typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500)); child->setMasksToBounds(true); typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); @@ -875,9 +878,9 @@ protected: this->visitLayer(layer1, occlusion); this->enterContributingSurface(child, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child, IntRect(10, 430, 60, 70))); @@ -887,17 +890,17 @@ protected: EXPECT_FALSE(occlusion.occluded(child, IntRect(10, 431, 60, 70))); EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(10, 430, 60, 70)).isEmpty()); - EXPECT_INT_RECT_EQ(IntRect(9, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 70))); - EXPECT_INT_RECT_EQ(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 429, 60, 70))); - EXPECT_INT_RECT_EQ(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(11, 430, 60, 70))); - EXPECT_INT_RECT_EQ(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 431, 60, 70))); + EXPECT_RECT_EQ(IntRect(9, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 70))); + EXPECT_RECT_EQ(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 429, 60, 70))); + EXPECT_RECT_EQ(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(11, 430, 60, 70))); + EXPECT_RECT_EQ(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 431, 60, 70))); this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60))); @@ -905,10 +908,10 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60))); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 40, 70, 60)).isEmpty()); - EXPECT_INT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); - EXPECT_INT_RECT_EQ(IntRect(30, 39, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60))); - EXPECT_INT_RECT_EQ(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60))); - EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60))); + EXPECT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); + EXPECT_RECT_EQ(IntRect(30, 39, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60))); + EXPECT_RECT_EQ(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60))); + EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60))); /* Justification for the above occlusion from |layer1| and |layer2|: @@ -950,6 +953,7 @@ protected: childTransform.translate(-250, -250); typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); + parent->setMasksToBounds(true); typename Types::LayerType* child1 = this->createSurface(parent, childTransform, FloatPoint(30, 30), IntSize(10, 10)); typename Types::LayerType* child2 = this->createSurface(parent, childTransform, FloatPoint(20, 40), IntSize(10, 10)); typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child1, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); @@ -962,9 +966,9 @@ protected: this->visitLayer(layer2, occlusion); this->enterContributingSurface(child2, occlusion); - EXPECT_INT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 80))); @@ -982,15 +986,15 @@ protected: occlusion.setLayerClipRect(IntRect(-20, -20, 1000, 1000)); // There is nothing above child2's surface in the z-order. - EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2, false, IntRect(-10, 420, 70, 80))); + EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2, false, IntRect(-10, 420, 70, 80))); this->leaveContributingSurface(child2, occlusion); this->visitLayer(layer1, occlusion); this->enterContributingSurface(child1, occlusion); - EXPECT_INT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(-10, 430, 80, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(-10, 430, 80, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child1, IntRect(-10, 430, 80, 70))); @@ -1000,14 +1004,14 @@ protected: EXPECT_FALSE(occlusion.occluded(child1, IntRect(-10, 430, 80, 71))); // child2's contents will occlude child1 below it. - EXPECT_INT_RECT_EQ(IntRect(-10, 430, 10, 70), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(-10, 430, 80, 70))); + EXPECT_RECT_EQ(IntRect(-10, 430, 10, 70), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(-10, 430, 80, 70))); this->leaveContributingSurface(child1, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(20, 20, 80, 80))); @@ -1064,6 +1068,7 @@ protected: child2Transform.translate(-250, -250); typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); + parent->setMasksToBounds(true); typename Types::LayerType* child1 = this->createSurface(parent, child1Transform, FloatPoint(30, 20), IntSize(10, 10)); typename Types::LayerType* child2 = this->createDrawingSurface(parent, child2Transform, FloatPoint(20, 40), IntSize(10, 10), false); typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child1, this->identityMatrix, FloatPoint(-10, -20), IntSize(510, 510), true); @@ -1076,9 +1081,9 @@ protected: this->visitLayer(layer2, occlusion); this->enterLayer(child2, occlusion); - EXPECT_INT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 80))); @@ -1091,15 +1096,15 @@ protected: this->enterContributingSurface(child2, occlusion); // There is nothing above child2's surface in the z-order. - EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2, false, IntRect(-10, 420, 70, 80))); + EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2, false, IntRect(-10, 420, 70, 80))); this->leaveContributingSurface(child2, occlusion); this->visitLayer(layer1, occlusion); this->enterContributingSurface(child1, occlusion); - EXPECT_INT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child1, IntRect(420, -20, 80, 90))); @@ -1109,16 +1114,16 @@ protected: EXPECT_FALSE(occlusion.occluded(child1, IntRect(421, -20, 80, 90))); // child2's contents will occlude child1 below it. - EXPECT_INT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(420, -20, 80, 90))); - EXPECT_INT_RECT_EQ(IntRect(490, -10, 10, 80), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(420, -10, 80, 90))); - EXPECT_INT_RECT_EQ(IntRect(420, -20, 70, 10), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(420, -20, 70, 90))); + EXPECT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(420, -20, 80, 90))); + EXPECT_RECT_EQ(IntRect(490, -10, 10, 80), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(420, -10, 80, 90))); + EXPECT_RECT_EQ(IntRect(420, -20, 70, 10), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(420, -20, 70, 90))); this->leaveContributingSurface(child1, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(10, 20, 90, 80))); @@ -1166,6 +1171,7 @@ protected: layerTransform.translate(-250, -250); typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); + parent->setMasksToBounds(true); typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); typename Types::ContentLayerType* opacityLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); @@ -1203,16 +1209,16 @@ protected: this->visitLayer(opaqueLayer, occlusion); this->enterContributingSurface(opaqueLayer, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 430, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 430, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // And it gets translated to the parent surface. this->leaveContributingSurface(opaqueLayer, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // The blur layer needs to throw away any occlusion from outside its subtree. @@ -1229,9 +1235,9 @@ protected: // But the opaque layer's occlusion is preserved on the parent. this->leaveContributingSurface(blurLayer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1253,16 +1259,16 @@ protected: this->visitLayer(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitContributingSurface(surface, occlusion); this->enterLayer(parent, occlusion); // The surface and replica should both be occluding the parent. - EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1275,6 +1281,7 @@ protected: void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 170)); + parent->setMasksToBounds(true); typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), IntSize()); this->calcDrawEtc(parent); @@ -1284,16 +1291,16 @@ protected: this->visitLayer(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitContributingSurface(surface, occlusion); this->enterLayer(parent, occlusion); // The surface and replica should both be occluding the parent. - EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 100, 100, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1316,16 +1323,16 @@ protected: this->visitLayer(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitContributingSurface(surface, occlusion); this->enterLayer(parent, occlusion); // The replica should not be occluding the parent, since it has a mask applied to it. - EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1370,7 +1377,7 @@ protected: EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -1414,7 +1421,7 @@ protected: EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -1531,11 +1538,11 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); - EXPECT_INT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100))); - EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100))); - EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100))); + EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100))); + EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100))); + EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100))); + EXPECT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100))); } }; @@ -1574,11 +1581,11 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); - EXPECT_INT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100))); - EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100))); - EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100))); + EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100))); + EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100))); + EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100))); + EXPECT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100))); } }; @@ -1747,7 +1754,7 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(100, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(100, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); @@ -1763,7 +1770,7 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(120, 120, 180, 180), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(120, 120, 180, 180), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); @@ -1779,7 +1786,7 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(250, 250, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(250, 250, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); @@ -1808,7 +1815,7 @@ protected: this->enterLayer(layer, occlusion); // The layer is rotated in 3d but without preserving 3d, so it only gets resized. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); + EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); } }; @@ -1873,7 +1880,7 @@ protected: TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); this->enterLayer(layer, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); + EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); } }; @@ -1955,6 +1962,7 @@ protected: transform.translate(-50, -50); typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); + parent->setMasksToBounds(true); typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, transform, FloatPoint(0, 0), IntSize(100, 100), true); parent->setPreserves3D(true); layer->setPreserves3D(true); @@ -1966,9 +1974,9 @@ protected: // Ensure that those pixels don't occlude things outside the clipRect. this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); } }; @@ -2002,27 +2010,27 @@ protected: this->visitLayer(topmost, occlusion); this->enterLayer(parent2, occlusion); // This occlusion will affect all surfaces. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent2, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent2, IntRect(0, 0, 300, 300))); this->leaveLayer(parent2, occlusion); this->visitLayer(surfaceChild2, occlusion); this->enterLayer(surfaceChild, occlusion); - EXPECT_INT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); this->leaveLayer(surfaceChild, occlusion); this->enterLayer(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); this->leaveLayer(surface, occlusion); this->enterContributingSurface(surface, occlusion); // Occlusion within the surface is lost when leaving the animating surface. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); this->leaveContributingSurface(surface, occlusion); this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); // Occlusion is not added for the animating |layer|. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -2054,27 +2062,27 @@ protected: this->visitLayer(topmost, occlusion); this->enterLayer(parent2, occlusion); // This occlusion will affect all surfaces. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); this->leaveLayer(parent2, occlusion); this->visitLayer(surfaceChild2, occlusion); this->enterLayer(surfaceChild, occlusion); - EXPECT_INT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); this->leaveLayer(surfaceChild, occlusion); this->enterLayer(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); this->leaveLayer(surface, occlusion); this->enterContributingSurface(surface, occlusion); // Occlusion within the surface is lost when leaving the animating surface. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); this->leaveContributingSurface(surface, occlusion); this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); // Occlusion is not added for the animating |layer|. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -2112,7 +2120,7 @@ protected: this->visitLayer(surface2, occlusion); this->enterContributingSurface(surface2, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); this->leaveContributingSurface(surface2, occlusion); @@ -2120,53 +2128,53 @@ protected: // surfaceChild2 is moving in screen space but not relative to its target, so occlusion should happen in its target space only. // It also means that things occluding in screen space (e.g. surface2) cannot occlude this layer. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild2, IntRect(0, 0, 100, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild2, IntRect(0, 0, 100, 300))); EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 50, 300))); this->leaveLayer(surfaceChild2, occlusion); this->enterLayer(surfaceChild, occlusion); EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 100, 300))); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); // The surfaceChild is occluded by the surfaceChild2, but is moving relative its target and the screen, so it // can't be occluded. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 200, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 200, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 200, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 200, 300))); EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 50, 300))); this->leaveLayer(surfaceChild, occlusion); this->enterLayer(surface, occlusion); // The surfaceChild is moving in screen space but not relative to its target, so occlusion should happen in its target space only. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); this->leaveLayer(surface, occlusion); // The surface's owning layer is moving in screen space but not relative to its target, so occlusion should happen in its target space only. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); this->enterContributingSurface(surface, occlusion); // The contributing |surface| is animating so it can't be occluded. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); this->leaveContributingSurface(surface, occlusion); this->enterLayer(layer, occlusion); // The |surface| is moving in the screen and in its target, so all occlusion within the surface is lost when leaving it. - EXPECT_INT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); this->leaveLayer(layer, occlusion); this->enterLayer(parent, occlusion); // The |layer| is animating in the screen and in its target, so no occlusion is added. - EXPECT_INT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -2194,9 +2202,9 @@ protected: this->visitLayer(surface2, occlusion); this->visitContributingSurface(surface2, occlusion); - EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // Clear any stored occlusion. @@ -2206,9 +2214,9 @@ protected: this->visitLayer(surface, occlusion); this->visitContributingSurface(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2221,6 +2229,7 @@ protected: void runMyTest() { typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); + parent->setMasksToBounds(true); typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(500, 300), false); surface->setOpaqueContentsRect(IntRect(0, 0, 400, 200)); this->calcDrawEtc(parent); @@ -2230,9 +2239,9 @@ protected: this->visitLayer(surface, occlusion); this->visitContributingSurface(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2256,22 +2265,22 @@ protected: // |topmost| occludes the replica, but not the surface itself. this->visitLayer(topmost, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->enterContributingSurface(surface, occlusion); // Surface is not occluded so it shouldn't think it is. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); } }; @@ -2294,23 +2303,23 @@ protected: // |topmost| occludes the surface, but not the entire surface's replica. this->visitLayer(topmost, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->enterContributingSurface(surface, occlusion); // Surface is occluded, but only the top 10px of the replica. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(0, 10, 100, 90), occlusion.unoccludedContributingSurfaceContentRect(surface, true, IntRect(0, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(0, 10, 100, 90), occlusion.unoccludedContributingSurfaceContentRect(surface, true, IntRect(0, 0, 100, 100))); } }; @@ -2335,23 +2344,23 @@ protected: this->visitLayer(overReplica, occlusion); this->visitLayer(overSurface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->enterContributingSurface(surface, occlusion); // Surface and replica are occluded different amounts. - EXPECT_INT_RECT_EQ(IntRect(40, 0, 60, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(50, 0, 50, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, true, IntRect(0, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(40, 0, 60, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(50, 0, 50, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, true, IntRect(0, 0, 100, 100))); } }; @@ -2375,18 +2384,18 @@ protected: // |topmost| occludes everything partially so we know occlusion is happening at all. this->visitLayer(topmost, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surfaceChild, occlusion); // surfaceChild increases the occlusion in the screen by a narrow sliver. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); // In its own surface, surfaceChild is at 0,0 as is its occlusion. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // The root layer always has a clipRect. So the parent of |surface| has a clipRect. However, the owning layer for |surface| does not @@ -2396,20 +2405,20 @@ protected: this->enterContributingSurface(surfaceChild, occlusion); // The surfaceChild's parent does not have a clipRect as it owns a render surface. Make sure the unoccluded rect // does not get clipped away inappropriately. - EXPECT_INT_RECT_EQ(IntRect(0, 40, 100, 10), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild, false, IntRect(0, 0, 100, 50))); + EXPECT_RECT_EQ(IntRect(0, 40, 100, 10), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild, false, IntRect(0, 0, 100, 50))); this->leaveContributingSurface(surfaceChild, occlusion); // When the surfaceChild's occlusion is transformed up to its parent, make sure it is not clipped away inappropriately also. this->enterLayer(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 10, 100, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 10, 100, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->leaveLayer(surface, occlusion); this->enterContributingSurface(surface, occlusion); // The surface's parent does have a clipRect as it is the root layer. - EXPECT_INT_RECT_EQ(IntRect(0, 50, 100, 50), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(0, 50, 100, 50), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); } }; @@ -2435,7 +2444,7 @@ protected: // The root layer always has a clipRect. So the parent of |surface| has a clipRect giving the surface itself a clipRect. this->enterContributingSurface(surface, occlusion); // Make sure the parent's clipRect clips the unoccluded region of the child surface. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 300))); } this->resetLayerIterator(); { @@ -2447,7 +2456,7 @@ protected: // The root layer always has a clipRect. So the parent of |surface| has a clipRect giving the surface itself a clipRect. this->enterContributingSurface(surface, occlusion); // Make sure the viewport rect clips the unoccluded region of the child surface. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 300))); } } }; @@ -2462,6 +2471,7 @@ protected: // This test verifies that the surface cliprect does not end up empty and clip away the entire unoccluded rect. typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(80, 200)); + parent->setMasksToBounds(true); typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); typename Types::LayerType* surfaceChild = this->createDrawingSurface(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), false); typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true); @@ -2473,17 +2483,17 @@ protected: // |topmost| occludes everything partially so we know occlusion is happening at all. this->visitLayer(topmost, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // surfaceChild is not opaque and does not occlude, so we have a non-empty unoccluded area on surface. this->visitLayer(surfaceChild, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); // The root layer always has a clipRect. So the parent of |surface| has a clipRect. However, the owning layer for |surface| does not @@ -2492,13 +2502,13 @@ protected: this->enterContributingSurface(surfaceChild, occlusion); // The surfaceChild's parent does not have a clipRect as it owns a render surface. - EXPECT_INT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild, false, IntRect(0, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild, false, IntRect(0, 0, 100, 100))); this->leaveContributingSurface(surfaceChild, occlusion); this->visitLayer(surface, occlusion); this->enterContributingSurface(surface, occlusion); // The surface's parent does have a clipRect as it is the root layer. - EXPECT_INT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); } }; @@ -2546,28 +2556,28 @@ protected: this->visitLayer(occludingLayer2, occlusion); this->visitLayer(occludingLayer1, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); // Everything outside the surface/replica is occluded but the surface/replica itself is not. this->enterLayer(filteredSurface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 100, 100))); - - EXPECT_INT_RECT_EQ(IntRect(300 + 1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 1, 0, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(300 + 0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, 1, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(300 + 0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 - 1, 0, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(300 + 0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, -1, 100, 100))); + EXPECT_RECT_EQ(IntRect(1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 100, 100))); + EXPECT_RECT_EQ(IntRect(0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 100, 100))); + + EXPECT_RECT_EQ(IntRect(300 + 1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 1, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(300 + 0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, 1, 100, 100))); + EXPECT_RECT_EQ(IntRect(300 + 0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 - 1, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(300 + 0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, -1, 100, 100))); this->leaveLayer(filteredSurface, occlusion); // The filtered layer/replica does not occlude. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); // The surface has a background blur, so it needs pixels that are currently considered occluded in order to be drawn. So the pixels @@ -2575,9 +2585,9 @@ protected: this->visitContributingSurface(filteredSurface, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); IntRect outsetRect; @@ -2586,44 +2596,44 @@ protected: // Nothing in the blur outsets for the filteredSurface is occluded. outsetRect = IntRect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); testRect = outsetRect; - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); // Stuff outside the blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); // Nothing in the blur outsets for the filteredSurface's replica is occluded. outsetRect = IntRect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); testRect = outsetRect; - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); // Stuff outside the blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); } }; @@ -2661,9 +2671,9 @@ protected: occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); this->visitLayer(occludingLayerAbove, occlusion); - EXPECT_INT_RECT_EQ(IntRect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(100, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(100, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(filteredSurface2, occlusion); @@ -2676,7 +2686,7 @@ protected: // Test expectations in the target. IntRect expectedOcclusion = IntRect(100 + outsetRight * 2, 100 + outsetBottom * 2, 50 - (outsetLeft + outsetRight) * 2, 50 - (outsetTop + outsetBottom) * 2); - EXPECT_INT_RECT_EQ(expectedOcclusion, occlusion.occlusionInTargetSurface().rects()[0]); + EXPECT_RECT_EQ(expectedOcclusion, occlusion.occlusionInTargetSurface().rects()[0]); // Test expectations in the screen. Take the ceiling of half of the outsets. outsetTop = (outsetTop + 1) / 2; @@ -2685,7 +2695,7 @@ protected: outsetLeft = (outsetLeft + 1) / 2; expectedOcclusion = IntRect(100 / 2 + outsetRight * 2, 100 / 2 + outsetBottom * 2, 50 / 2 - (outsetLeft + outsetRight) * 2, 50 /2 - (outsetTop + outsetBottom) * 2); - EXPECT_INT_RECT_EQ(expectedOcclusion, occlusion.occlusionInScreenSpace().rects()[0]); + EXPECT_RECT_EQ(expectedOcclusion, occlusion.occlusionInScreenSpace().rects()[0]); } }; @@ -2732,28 +2742,28 @@ protected: this->visitLayer(occludingLayer2, occlusion); this->visitLayer(occludingLayer1, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); // Everything outside the surface/replica is occluded but the surface/replica itself is not. this->enterLayer(filteredSurface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 50, 50))); - - EXPECT_INT_RECT_EQ(IntRect(150 + 1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 1, 0, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(150 + 0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, 1, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(150 + 0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 - 1, 0, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(150 + 0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, -1, 50, 50))); + EXPECT_RECT_EQ(IntRect(1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 50, 50))); + EXPECT_RECT_EQ(IntRect(0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 50, 50))); + EXPECT_RECT_EQ(IntRect(0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 50, 50))); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 50, 50))); + + EXPECT_RECT_EQ(IntRect(150 + 1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 1, 0, 50, 50))); + EXPECT_RECT_EQ(IntRect(150 + 0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, 1, 50, 50))); + EXPECT_RECT_EQ(IntRect(150 + 0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 - 1, 0, 50, 50))); + EXPECT_RECT_EQ(IntRect(150 + 0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, -1, 50, 50))); this->leaveLayer(filteredSurface, occlusion); // The filtered layer/replica does not occlude. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); // The surface has a background blur, so it needs pixels that are currently considered occluded in order to be drawn. So the pixels @@ -2761,7 +2771,7 @@ protected: this->visitContributingSurface(filteredSurface, occlusion); this->enterContributingSurface(clippingSurface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); IntRect outsetRect; @@ -2772,45 +2782,45 @@ protected: outsetRect = IntRect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); clippedOutsetRect = intersection(outsetRect, IntRect(0 - outsetLeft, 0 - outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBottom)); testRect = outsetRect; - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); // Stuff outside the (clipped) blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); // Nothing in the (clipped) blur outsets for the filteredSurface's replica is occluded. outsetRect = IntRect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); clippedOutsetRect = intersection(outsetRect, IntRect(0 - outsetLeft, 0 - outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBottom)); testRect = outsetRect; - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); // Stuff outside the (clipped) blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); } }; @@ -2856,9 +2866,9 @@ protected: IntRect occlusionBehindReplica = IntRect(210, 60, 30, 30); IntRect expectedOpaqueBounds = unionRect(occlusionBehindSurface, occlusionBehindReplica); - EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2904,9 +2914,9 @@ protected: IntRect occlusionAboveReplica = IntRect(200, 50, 50, 50); IntRect expectedOpaqueBounds = unionRect(occlusionAboveSurface, occlusionAboveReplica); - EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -3005,17 +3015,17 @@ protected: // The small layer is not tracked because it is too small. this->visitLayer(small, occlusion); - EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); // The large layer is tracked as it is large enough. this->visitLayer(large, occlusion); - EXPECT_INT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; diff --git a/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp b/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp index 4bcaccdc3..9076d34d4 100644 --- a/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp +++ b/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp @@ -31,6 +31,7 @@ #include "CCTexture.h" #include "CCTiledLayerTestCommon.h" #include "FakeCCGraphicsContext.h" +#include "WebCompositorInitializer.h" #include <gtest/gtest.h> using namespace WebCore; @@ -44,6 +45,7 @@ public: CCPrioritizedTextureTest() : m_textureSize(256, 256) , m_textureFormat(GraphicsContext3D::RGBA) + , m_compositorInitializer(0) , m_context(WebKit::createFakeCCGraphicsContext()) { DebugScopedSetImplThread implThread; @@ -68,12 +70,12 @@ public: bool validateTexture(OwnPtr<CCPrioritizedTexture>& texture, bool requestLate) { - DebugScopedSetImplThread implThread; #if !ASSERT_DISABLED texture->textureManager()->assertInvariants(); #endif if (requestLate) texture->requestLate(); + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; bool success = texture->canAcquireBackingTexture(); if (success) texture->acquireBackingTexture(resourceProvider()); @@ -88,6 +90,7 @@ public: protected: const IntSize m_textureSize; const GC3Denum m_textureFormat; + WebCompositorInitializer m_compositorInitializer; OwnPtr<CCGraphicsContext> m_context; OwnPtr<CCResourceProvider> m_resourceProvider; }; @@ -128,7 +131,7 @@ TEST_F(CCPrioritizedTextureTest, requestTextureExceedingMaxLimit) EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->memoryAboveCutoffBytes()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider()); } @@ -149,7 +152,7 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) for (size_t i = 0; i < maxTextures; ++i) validateTexture(textures[i], false); { - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->reduceMemory(resourceProvider()); } @@ -162,7 +165,7 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) for (size_t i = 0; i < maxTextures; ++i) EXPECT_EQ(validateTexture(textures[i], false), i < 5); { - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->reduceMemory(resourceProvider()); } @@ -175,14 +178,14 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) for (size_t i = 0; i < maxTextures; ++i) EXPECT_EQ(validateTexture(textures[i], false), i < 4); { - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->reduceMemory(resourceProvider()); } EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider()); } @@ -242,7 +245,7 @@ TEST_F(CCPrioritizedTextureTest, textureManagerPartialUpdateTextures) EXPECT_FALSE(textures[2]->haveBackingTexture()); EXPECT_FALSE(textures[3]->haveBackingTexture()); - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider()); } @@ -282,7 +285,7 @@ TEST_F(CCPrioritizedTextureTest, textureManagerPrioritiesAreEqual) EXPECT_EQ(texturesMemorySize(8), textureManager->memoryAboveCutoffBytes()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider()); } @@ -302,7 +305,7 @@ TEST_F(CCPrioritizedTextureTest, textureManagerDestroyedFirst) EXPECT_TRUE(texture->haveBackingTexture()); { - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider()); } textureManager.clear(); @@ -330,7 +333,7 @@ TEST_F(CCPrioritizedTextureTest, textureMovedToNewManager) texture->setTextureManager(0); { - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManagerOne->clearAllMemory(resourceProvider()); } textureManagerOne.clear(); @@ -346,7 +349,7 @@ TEST_F(CCPrioritizedTextureTest, textureMovedToNewManager) EXPECT_TRUE(texture->canAcquireBackingTexture()); EXPECT_TRUE(texture->haveBackingTexture()); - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManagerTwo->clearAllMemory(resourceProvider()); } @@ -392,7 +395,7 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootS EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTextures()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider()); } @@ -429,7 +432,7 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLa EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTextures()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider()); } @@ -469,7 +472,7 @@ TEST_F(CCPrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAva EXPECT_EQ(texturesMemorySize(2), textureManager->memoryForSelfManagedTextures()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider()); } diff --git a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp index 2c5e8859c..b8dc30f72 100644 --- a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp +++ b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp @@ -26,6 +26,7 @@ #include "CCQuadCuller.h" +#include "CCAppendQuadsData.h" #include "CCLayerTilingData.h" #include "CCMathUtil.h" #include "CCOcclusionTracker.h" @@ -100,8 +101,8 @@ static void appendQuads(CCQuadList& quadList, CCSharedQuadStateList& sharedState { occlusionTracker.enterLayer(it); CCQuadCuller quadCuller(quadList, sharedStateList, layer, &occlusionTracker, false, false); - bool hadMissingTiles = false; - layer->appendQuads(quadCuller, hadMissingTiles); + CCAppendQuadsData data; + layer->appendQuads(quadCuller, data); occlusionTracker.leaveLayer(it); ++it; } diff --git a/Source/WebKit/chromium/tests/CCRenderPassTest.cpp b/Source/WebKit/chromium/tests/CCRenderPassTest.cpp new file mode 100644 index 000000000..8f63ad326 --- /dev/null +++ b/Source/WebKit/chromium/tests/CCRenderPassTest.cpp @@ -0,0 +1,107 @@ +/* + * 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 "CCRenderPass.h" + +#include "CCCheckerboardDrawQuad.h" +#include "CCGeometryTestUtils.h" +#include <gtest/gtest.h> +#include <public/WebFilterOperations.h> +#include <public/WebTransformationMatrix.h> + +using WebKit::WebFilterOperation; +using WebKit::WebFilterOperations; +using WebKit::WebTransformationMatrix; + +using namespace WebCore; + +namespace { + +class CCTestRenderPass : public CCRenderPass { +public: + CCQuadList& quadList() { return m_quadList; } + CCSharedQuadStateList& sharedQuadStateList() { return m_sharedQuadStateList; } +}; + +struct CCRenderPassSize { + // If you add a new field to this class, make sure to add it to the copy() tests. + CCRenderPass::Id m_id; + CCQuadList m_quadList; + CCSharedQuadStateList m_sharedQuadStateList; + WebKit::WebTransformationMatrix m_transformToRootTarget; + IntRect m_outputRect; + FloatRect m_damageRect; + bool m_hasTransparentBackground; + bool m_hasOcclusionFromOutsideTargetSurface; + WebKit::WebFilterOperations m_filters; + WebKit::WebFilterOperations m_backgroundFilters; +}; + +TEST(CCRenderPassTest, copyShouldBeIdenticalExceptIdAndQuads) +{ + CCRenderPass::Id id(3, 2); + IntRect outputRect(45, 22, 120, 13); + WebTransformationMatrix transformToRoot(1, 0.5, 0.5, -0.5, -1, 0); + + OwnPtr<CCRenderPass> pass(CCRenderPass::create(id, outputRect, transformToRoot)); + + IntRect damageRect(56, 123, 19, 43); + bool hasTransparentBackground = true; + bool hasOcclusionFromOutsideTargetSurface = true; + WebFilterOperations filters; + WebFilterOperations backgroundFilters; + + filters.append(WebFilterOperation::createGrayscaleFilter(0.2f)); + backgroundFilters.append(WebFilterOperation::createInvertFilter(0.2f)); + + pass->setDamageRect(damageRect); + pass->setHasTransparentBackground(hasTransparentBackground); + pass->setHasOcclusionFromOutsideTargetSurface(hasOcclusionFromOutsideTargetSurface); + pass->setFilters(filters); + pass->setBackgroundFilters(backgroundFilters); + + // Stick a quad in the pass, this should not get copied. + CCTestRenderPass* testPass = static_cast<CCTestRenderPass*>(pass.get()); + testPass->sharedQuadStateList().append(CCSharedQuadState::create(WebTransformationMatrix(), IntRect(), IntRect(), 1, false)); + testPass->quadList().append(CCCheckerboardDrawQuad::create(testPass->sharedQuadStateList().last().get(), IntRect())); + + CCRenderPass::Id newId(63, 4); + + OwnPtr<CCRenderPass> copy(pass->copy(newId)); + EXPECT_EQ(newId, copy->id()); + EXPECT_RECT_EQ(pass->outputRect(), copy->outputRect()); + EXPECT_EQ(pass->transformToRootTarget(), copy->transformToRootTarget()); + EXPECT_RECT_EQ(pass->damageRect(), copy->damageRect()); + EXPECT_EQ(pass->hasTransparentBackground(), copy->hasTransparentBackground()); + EXPECT_EQ(pass->hasOcclusionFromOutsideTargetSurface(), copy->hasOcclusionFromOutsideTargetSurface()); + EXPECT_EQ(pass->filters(), copy->filters()); + EXPECT_EQ(pass->backgroundFilters(), copy->backgroundFilters()); + EXPECT_EQ(0u, copy->quadList().size()); + + EXPECT_EQ(sizeof(CCRenderPassSize), sizeof(CCRenderPass)); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp index 05d716641..d66b8c951 100644 --- a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp +++ b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp @@ -26,7 +26,9 @@ #include "CCRenderSurface.h" +#include "CCAppendQuadsData.h" #include "CCLayerImpl.h" +#include "CCRenderPassSink.h" #include "CCSharedQuadState.h" #include "CCSingleThreadProxy.h" #include "MockCCQuadCuller.h" @@ -119,9 +121,10 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) CCQuadList quadList; CCSharedQuadStateList sharedStateList; MockCCQuadCuller mockQuadCuller(quadList, sharedStateList); + CCAppendQuadsData appendQuadsData; bool forReplica = false; - renderSurface->appendQuads(mockQuadCuller, forReplica, 1); + renderSurface->appendQuads(mockQuadCuller, appendQuadsData, forReplica, CCRenderPass::Id(2, 0)); ASSERT_EQ(1u, sharedStateList.size()); CCSharedQuadState* sharedQuadState = sharedStateList[0].get(); @@ -133,4 +136,49 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) EXPECT_FALSE(sharedQuadState->opaque); } +class TestCCRenderPassSink : public CCRenderPassSink { +public: + virtual void appendRenderPass(PassOwnPtr<CCRenderPass> renderPass) OVERRIDE { m_renderPasses.append(renderPass); } + + const Vector<OwnPtr<CCRenderPass> >& renderPasses() const { return m_renderPasses; } + +private: + Vector<OwnPtr<CCRenderPass> > m_renderPasses; + +}; + +TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectRenderPass) +{ + // This will fake that we are on the correct thread for testing purposes. + DebugScopedSetImplThread setImplThread; + + OwnPtr<CCLayerImpl> rootLayer = CCLayerImpl::create(1); + + OwnPtr<CCLayerImpl> owningLayer = CCLayerImpl::create(2); + owningLayer->createRenderSurface(); + ASSERT_TRUE(owningLayer->renderSurface()); + owningLayer->setRenderTarget(owningLayer.get()); + CCRenderSurface* renderSurface = owningLayer->renderSurface(); + + rootLayer->addChild(owningLayer.release()); + + IntRect contentRect = IntRect(IntPoint::zero(), IntSize(50, 50)); + WebTransformationMatrix origin; + origin.translate(30, 40); + + renderSurface->setScreenSpaceTransform(origin); + renderSurface->setContentRect(contentRect); + + TestCCRenderPassSink passSink; + + renderSurface->appendRenderPasses(passSink); + + ASSERT_EQ(1u, passSink.renderPasses().size()); + CCRenderPass* pass = passSink.renderPasses()[0].get(); + + EXPECT_EQ(CCRenderPass::Id(2, 0), pass->id()); + EXPECT_EQ(contentRect, pass->outputRect()); + EXPECT_EQ(origin, pass->transformToRootTarget()); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/CCRendererGLTest.cpp b/Source/WebKit/chromium/tests/CCRendererGLTest.cpp index 2f3fd6a08..75e653d6f 100644 --- a/Source/WebKit/chromium/tests/CCRendererGLTest.cpp +++ b/Source/WebKit/chromium/tests/CCRendererGLTest.cpp @@ -33,9 +33,9 @@ #include "FakeWebCompositorOutputSurface.h" #include "FakeWebGraphicsContext3D.h" #include "GraphicsContext3D.h" +#include "WebCompositorInitializer.h" #include <gmock/gmock.h> #include <gtest/gtest.h> -#include <public/WebCompositor.h> #include <public/WebTransformationMatrix.h> using namespace WebCore; @@ -80,9 +80,11 @@ public: , m_rootLayer(CCLayerImpl::create(1)) , m_memoryAllocationLimitBytes(CCPrioritizedTextureManager::defaultMemoryAllocationLimit()) { - OwnPtr<CCRenderPass> rootRenderPass = CCRenderPass::create(m_rootLayer->id(), IntRect(), WebTransformationMatrix()); + m_rootLayer->createRenderSurface(); + CCRenderPass::Id renderPassId = m_rootLayer->renderSurface()->renderPassId(); + OwnPtr<CCRenderPass> rootRenderPass = CCRenderPass::create(renderPassId, IntRect(), WebTransformationMatrix()); m_renderPassesInDrawOrder.append(rootRenderPass.get()); - m_renderPasses.set(m_rootLayer->id(), rootRenderPass.release()); + m_renderPasses.set(renderPassId, rootRenderPass.release()); } // CCRendererClient methods. @@ -128,6 +130,7 @@ protected: CCRendererGLTest() : m_suggestHaveBackbufferYes(1, true) , m_suggestHaveBackbufferNo(1, false) + , m_compositorInitializer(0) , m_context(FakeWebCompositorOutputSurface::create(adoptPtr(new FrameCountingMemoryAllocationSettingContext()))) , m_resourceProvider(CCResourceProvider::create(m_context.get())) , m_renderer(&m_mockClient, m_resourceProvider.get()) @@ -136,15 +139,9 @@ protected: virtual void SetUp() { - WebKit::WebCompositor::initialize(0); m_renderer.initialize(); } - virtual void TearDown() - { - WebKit::WebCompositor::shutdown(); - } - void swapBuffers() { m_renderer.swapBuffers(); @@ -155,6 +152,7 @@ protected: WebGraphicsMemoryAllocation m_suggestHaveBackbufferYes; WebGraphicsMemoryAllocation m_suggestHaveBackbufferNo; + WebCompositorInitializer m_compositorInitializer; OwnPtr<CCGraphicsContext> m_context; FakeCCRendererClient m_mockClient; OwnPtr<CCResourceProvider> m_resourceProvider; diff --git a/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp b/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp index 563c2c04c..7454c9eda 100644 --- a/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp +++ b/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp @@ -136,6 +136,7 @@ TEST(CCSchedulerStateMachineTest, TestNextActionBeginsFrameIfNeeded) TEST(CCSchedulerStateMachineTest, TestSetForcedRedrawDoesNotSetsNormalRedraw) { CCSchedulerStateMachine state; + state.setCanDraw(true); state.setNeedsForcedRedraw(); EXPECT_FALSE(state.redrawPending()); EXPECT_TRUE(state.vsyncCallbackNeeded()); @@ -146,6 +147,7 @@ TEST(CCSchedulerStateMachineTest, TestFailedDrawSetsNeedsCommitAndDoesNotDrawAga CCSchedulerStateMachine state; state.setCanBeginFrame(true); state.setVisible(true); + state.setCanDraw(true); state.setNeedsRedraw(); EXPECT_TRUE(state.redrawPending()); EXPECT_TRUE(state.vsyncCallbackNeeded()); @@ -171,6 +173,7 @@ TEST(CCSchedulerStateMachineTest, TestSetNeedsRedrawDuringFailedDrawDoesNotRemov CCSchedulerStateMachine state; state.setCanBeginFrame(true); state.setVisible(true); + state.setCanDraw(true); state.setNeedsRedraw(); EXPECT_TRUE(state.redrawPending()); EXPECT_TRUE(state.vsyncCallbackNeeded()); @@ -199,6 +202,7 @@ TEST(CCSchedulerStateMachineTest, TestCommitAfterFailedDrawAllowsDrawInSameFrame CCSchedulerStateMachine state; state.setCanBeginFrame(true); state.setVisible(true); + state.setCanDraw(true); // Start a commit. state.setNeedsCommit(); @@ -239,6 +243,7 @@ TEST(CCSchedulerStateMachineTest, TestCommitAfterFailedAndSuccessfulDrawDoesNotA CCSchedulerStateMachine state; state.setCanBeginFrame(true); state.setVisible(true); + state.setCanDraw(true); // Start a commit. state.setNeedsCommit(); @@ -290,6 +295,7 @@ TEST(CCSchedulerStateMachineTest, TestFailedDrawsWillEventuallyForceADrawAfterTh CCSchedulerStateMachine state; state.setCanBeginFrame(true); state.setVisible(true); + state.setCanDraw(true); state.setMaximumNumberOfFailedDrawsBeforeDrawIsForced(1); // Start a commit. @@ -332,6 +338,7 @@ TEST(CCSchedulerStateMachineTest, TestFailedDrawIsRetriedNextVSync) CCSchedulerStateMachine state; state.setCanBeginFrame(true); state.setVisible(true); + state.setCanDraw(true); // Start a draw. state.setNeedsRedraw(); @@ -361,6 +368,7 @@ TEST(CCSchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) { CCSchedulerStateMachine state; state.setVisible(true); + state.setCanDraw(true); state.setNeedsRedraw(); EXPECT_TRUE(state.vsyncCallbackNeeded()); state.didEnterVSync(); @@ -413,6 +421,7 @@ TEST(CCSchedulerStateMachineTest, TestNextActionDrawsOnVSync) for (size_t i = 0; i < numCommitStates; ++i) { for (unsigned j = 0; j < 2; ++j) { StateMachine state; + state.setCanDraw(true); state.setCommitState(allCommitStates[i]); bool forcedDraw = j; if (!forcedDraw) { @@ -525,6 +534,28 @@ TEST(CCSchedulerStateMachineTest, TestCanRedrawWithWaitingForFirstDrawMakesProgr EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); } +TEST(CCSchedulerStateMachineTest, TestVsyncCallbackNeededOnCanDrawAndResourceUpdates) +{ + StateMachine state; + state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW); + state.setCanBeginFrame(true); + state.setNeedsCommit(true); + state.setNeedsRedraw(true); + state.setUpdateMoreResourcesPending(false); + state.setVisible(true); + state.setCanDraw(false); + EXPECT_FALSE(state.vsyncCallbackNeeded()); + + state.setUpdateMoreResourcesPending(true); + EXPECT_TRUE(state.vsyncCallbackNeeded()); + + state.setUpdateMoreResourcesPending(false); + EXPECT_FALSE(state.vsyncCallbackNeeded()); + + state.setCanDraw(true); + EXPECT_TRUE(state.vsyncCallbackNeeded()); +} + TEST(CCSchedulerStateMachineTest, TestUpdates_NoRedraw_OneRoundOfUpdates) { StateMachine state; @@ -532,6 +563,7 @@ TEST(CCSchedulerStateMachineTest, TestUpdates_NoRedraw_OneRoundOfUpdates) state.setNeedsRedraw(false); state.setUpdateMoreResourcesPending(false); state.setVisible(true); + state.setCanDraw(true); // Verify we begin update, both for vsync and not vsync. EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_UPDATE_MORE_RESOURCES, state.nextAction()); @@ -560,6 +592,7 @@ TEST(CCSchedulerStateMachineTest, TestUpdates_NoRedraw_TwoRoundsOfUpdates) state.setNeedsRedraw(false); state.setUpdateMoreResourcesPending(false); state.setVisible(true); + state.setCanDraw(true); // Verify the update begins, both for vsync and not vsync. state.didEnterVSync(); @@ -599,6 +632,7 @@ TEST(CCSchedulerStateMachineTest, TestUpdates_NoRedraw_TwoRoundsOfUpdates) TEST(CCSchedulerStateMachineTest, TestVSyncNeededWhenUpdatesPendingButInvisible) { StateMachine state; + state.setCanDraw(true); state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_UPDATING_RESOURCES); state.setNeedsRedraw(false); state.setVisible(false); @@ -616,6 +650,7 @@ TEST(CCSchedulerStateMachineTest, TestUpdates_WithRedraw_OneRoundOfUpdates) state.setNeedsRedraw(true); state.setUpdateMoreResourcesPending(false); state.setVisible(true); + state.setCanDraw(true); EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_UPDATE_MORE_RESOURCES, state.nextAction()); // Begin an update. @@ -663,6 +698,7 @@ TEST(CCSchedulerStateMachineTest, TestSetNeedsCommitIsNotLost) state.setCanBeginFrame(true); state.setNeedsCommit(true); state.setVisible(true); + state.setCanDraw(true); // Begin the frame. EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); @@ -705,6 +741,7 @@ TEST(CCSchedulerStateMachineTest, TestFullCycle) StateMachine state; state.setCanBeginFrame(true); state.setVisible(true); + state.setCanDraw(true); // Start clean and set commit. state.setNeedsCommit(true); @@ -729,7 +766,7 @@ TEST(CCSchedulerStateMachineTest, TestFullCycle) // Commit. state.updateState(CCSchedulerStateMachine::ACTION_COMMIT); - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState()); + EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState()); EXPECT_TRUE(state.needsRedraw()); // Expect to do nothing until vsync. @@ -753,6 +790,7 @@ TEST(CCSchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween) StateMachine state; state.setCanBeginFrame(true); state.setVisible(true); + state.setCanDraw(true); // Start clean and set commit. state.setNeedsCommit(true); @@ -812,6 +850,7 @@ TEST(CCSchedulerStateMachineTest, TestGoesInvisibleBeforeBeginFrameCompletes) StateMachine state; state.setCanBeginFrame(true); state.setVisible(true); + state.setCanDraw(true); // Start clean and set commit. state.setNeedsCommit(true); @@ -830,6 +869,19 @@ TEST(CCSchedulerStateMachineTest, TestGoesInvisibleBeforeBeginFrameCompletes) // We should now be back in the idle state as if we didn't start a frame at all. EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState()); EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + + // Become visible again + state.setVisible(true); + + // We should be beginning a frame now + EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState()); + EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); + + // Begin the frame + state.updateState(state.nextAction()); + + // We should be starting the commit now + EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.commitState()); } TEST(CCSchedulerStateMachineTest, TestContextLostWhenCompletelyIdle) @@ -837,6 +889,7 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhenCompletelyIdle) StateMachine state; state.setCanBeginFrame(true); state.setVisible(true); + state.setCanDraw(true); state.didLoseContext(); @@ -859,6 +912,7 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhenIdleAndCommitRequestedWhile StateMachine state; state.setCanBeginFrame(true); state.setVisible(true); + state.setCanDraw(true); state.didLoseContext(); @@ -895,6 +949,7 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgress) StateMachine state; state.setCanBeginFrame(true); state.setVisible(true); + state.setCanDraw(true); // Get a commit in flight. state.setNeedsCommit(true); @@ -924,6 +979,11 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgress) 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_IF_POSSIBLE, 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()); @@ -936,6 +996,7 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgressAndAnother StateMachine state; state.setCanBeginFrame(true); state.setVisible(true); + state.setCanDraw(true); // Get a commit in flight. state.setNeedsCommit(true); @@ -953,9 +1014,6 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgressAndAnother 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()); @@ -986,6 +1044,7 @@ TEST(CCSchedulerStateMachineTest, TestFinishAllRenderingWhileContextLost) { StateMachine state; state.setVisible(true); + state.setCanDraw(true); // Cause a lost context lost. state.didLoseContext(); @@ -1024,6 +1083,7 @@ TEST(CCSchedulerStateMachineTest, TestBeginFrameWhenCanBeginFrameFalseAndForceCo { StateMachine state; state.setVisible(true); + state.setCanDraw(true); state.setNeedsCommit(true); state.setNeedsForcedCommit(true); EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); @@ -1046,7 +1106,7 @@ TEST(CCSchedulerStateMachineTest, TestBeginFrameWhenCommitInProgress) EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction()); state.updateState(state.nextAction()); - EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState()); + EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState()); EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); } @@ -1056,6 +1116,7 @@ TEST(CCSchedulerStateMachineTest, TestBeginFrameWhenContextLost) StateMachine state; state.setCanBeginFrame(true); state.setVisible(true); + state.setCanDraw(true); state.setNeedsCommit(true); state.setNeedsForcedCommit(true); state.didLoseContext(); diff --git a/Source/WebKit/chromium/tests/CCSchedulerTest.cpp b/Source/WebKit/chromium/tests/CCSchedulerTest.cpp index 93ff66ea2..eb933f92f 100644 --- a/Source/WebKit/chromium/tests/CCSchedulerTest.cpp +++ b/Source/WebKit/chromium/tests/CCSchedulerTest.cpp @@ -44,14 +44,12 @@ public: { m_actions.clear(); m_hasMoreResourceUpdates = false; - m_canDraw = true; m_drawWillHappen = true; m_swapWillHappenIfDrawHappens = true; m_numDraws = 0; } void setHasMoreResourceUpdates(bool b) { m_hasMoreResourceUpdates = b; } - void setCanDraw(bool b) { m_canDraw = b; } int numDraws() const { return m_numDraws; } int numActions() const { return static_cast<int>(m_actions.size()); } @@ -65,8 +63,8 @@ public: return false; } - virtual bool canDraw() OVERRIDE { return m_canDraw; } virtual bool hasMoreResourceUpdates() const OVERRIDE { return m_hasMoreResourceUpdates; } + virtual void scheduledActionBeginFrame() OVERRIDE { m_actions.push_back("scheduledActionBeginFrame"); } virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE { @@ -91,7 +89,6 @@ public: protected: bool m_hasMoreResourceUpdates; - bool m_canDraw; bool m_drawWillHappen; bool m_swapWillHappenIfDrawHappens; int m_numDraws; @@ -105,6 +102,7 @@ TEST(CCSchedulerTest, RequestCommit) OwnPtr<CCScheduler> scheduler = CCScheduler::create(&client, adoptPtr(new CCFrameRateController(timeSource))); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); + scheduler->setCanDraw(true); // SetNeedsCommit should begin the frame. scheduler->setNeedsCommit(); @@ -139,6 +137,7 @@ TEST(CCSchedulerTest, RequestCommitAfterBeginFrame) OwnPtr<CCScheduler> scheduler = CCScheduler::create(&client, adoptPtr(new CCFrameRateController(timeSource))); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); + scheduler->setCanDraw(true); // SetNedsCommit should begin the frame. scheduler->setNeedsCommit(); @@ -172,6 +171,7 @@ TEST(CCSchedulerTest, TextureAcquisitionCollision) OwnPtr<CCScheduler> scheduler = CCScheduler::create(&client, adoptPtr(new CCFrameRateController(timeSource))); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); + scheduler->setCanDraw(true); scheduler->setNeedsCommit(); scheduler->setMainThreadNeedsLayerTextures(); @@ -210,6 +210,7 @@ TEST(CCSchedulerTest, VisibilitySwitchWithTextureAcquisition) OwnPtr<CCScheduler> scheduler = CCScheduler::create(&client, adoptPtr(new CCFrameRateController(timeSource))); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); + scheduler->setCanDraw(true); scheduler->setNeedsCommit(); scheduler->beginFrameComplete(); @@ -273,6 +274,7 @@ TEST(CCSchedulerTest, RequestRedrawInsideDraw) client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); + scheduler->setCanDraw(true); scheduler->setNeedsRedraw(); EXPECT_TRUE(scheduler->redrawPending()); @@ -299,6 +301,7 @@ TEST(CCSchedulerTest, RequestRedrawInsideFailedDraw) client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); + scheduler->setCanDraw(true); client.setDrawWillHappen(false); scheduler->setNeedsRedraw(); @@ -371,6 +374,7 @@ TEST(CCSchedulerTest, RequestCommitInsideDraw) client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); + scheduler->setCanDraw(true); scheduler->setNeedsRedraw(); EXPECT_TRUE(scheduler->redrawPending()); @@ -398,6 +402,7 @@ TEST(CCSchedulerTest, RequestCommitInsideFailedDraw) client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); + scheduler->setCanDraw(true); client.setDrawWillHappen(false); scheduler->setNeedsRedraw(); @@ -440,6 +445,7 @@ TEST(CCSchedulerTest, NoBeginFrameWhenDrawFails) client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); + scheduler->setCanDraw(true); EXPECT_EQ(0, controllerPtr->numFramesPending()); diff --git a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp index 220189b41..b330abcaa 100644 --- a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp @@ -26,6 +26,7 @@ #include "CCSolidColorLayerImpl.h" +#include "CCAppendQuadsData.h" #include "CCLayerTestCommon.h" #include "CCSingleThreadProxy.h" #include "CCSolidColorDrawQuad.h" @@ -53,8 +54,8 @@ TEST(CCSolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap) layer->createRenderSurface(); layer->setRenderTarget(layer.get()); - bool hadMissingTiles = false; - layer->appendQuads(quadCuller, hadMissingTiles); + CCAppendQuadsData data; + layer->appendQuads(quadCuller, data); verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleContentRect); } @@ -77,8 +78,8 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) layer->createRenderSurface(); layer->setRenderTarget(layer.get()); - bool hadMissingTiles = false; - layer->appendQuads(quadCuller, hadMissingTiles); + CCAppendQuadsData data; + layer->appendQuads(quadCuller, data); ASSERT_EQ(quadCuller.quadList().size(), 1U); EXPECT_EQ(CCSolidColorDrawQuad::materialCast(quadCuller.quadList()[0].get())->color(), testColor); @@ -102,8 +103,8 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad) layer->createRenderSurface(); layer->setRenderTarget(layer.get()); - bool hadMissingTiles = false; - layer->appendQuads(quadCuller, hadMissingTiles); + CCAppendQuadsData data; + layer->appendQuads(quadCuller, data); ASSERT_EQ(quadCuller.quadList().size(), 1U); EXPECT_EQ(opacity, CCSolidColorDrawQuad::materialCast(quadCuller.quadList()[0].get())->opacity()); diff --git a/Source/WebKit/chromium/tests/CCTextureUpdateControllerTest.cpp b/Source/WebKit/chromium/tests/CCTextureUpdateControllerTest.cpp index 11659f6f5..baf63c2e7 100644 --- a/Source/WebKit/chromium/tests/CCTextureUpdateControllerTest.cpp +++ b/Source/WebKit/chromium/tests/CCTextureUpdateControllerTest.cpp @@ -31,8 +31,8 @@ #include "CCTiledLayerTestCommon.h" #include "FakeWebCompositorOutputSurface.h" #include "FakeWebGraphicsContext3D.h" +#include "WebCompositorInitializer.h" #include <gtest/gtest.h> -#include <public/WebCompositor.h> #include <public/WebThread.h> #include <wtf/RefPtr.h> @@ -95,21 +95,23 @@ public: class CCTextureUpdateControllerTest : public Test { public: CCTextureUpdateControllerTest() - : m_queue(adoptPtr(new CCTextureUpdateQueue)) - , m_uploader(this) - , m_fullUploadCountExpected(0) - , m_partialCountExpected(0) - , m_totalUploadCountExpected(0) - , m_maxUploadCountPerUpdate(0) - , m_numBeginUploads(0) - , m_numEndUploads(0) - , m_numConsecutiveFlushes(0) - , m_numDanglingUploads(0) - , m_numTotalUploads(0) - , m_numTotalFlushes(0) - , m_numPreviousUploads(0) - , m_numPreviousFlushes(0) - { } + : m_queue(adoptPtr(new CCTextureUpdateQueue)) + , m_uploader(this) + , m_compositorInitializer(m_thread.get()) + , m_fullUploadCountExpected(0) + , m_partialCountExpected(0) + , m_totalUploadCountExpected(0) + , m_maxUploadCountPerUpdate(0) + , m_numBeginUploads(0) + , m_numEndUploads(0) + , m_numConsecutiveFlushes(0) + , m_numDanglingUploads(0) + , m_numTotalUploads(0) + , m_numTotalFlushes(0) + , m_numPreviousUploads(0) + , m_numPreviousFlushes(0) + { + } public: void onFlush() @@ -170,19 +172,11 @@ public: protected: virtual void SetUp() { - OwnPtr<WebThread> thread; - WebCompositor::initialize(thread.get()); - m_context = FakeWebCompositorOutputSurface::create(adoptPtr(new WebGraphicsContext3DForUploadTest(this))); DebugScopedSetImplThread implThread; m_resourceProvider = CCResourceProvider::create(m_context.get()); } - virtual void TearDown() - { - WebCompositor::shutdown(); - } - void appendFullUploadsToUpdateQueue(int count) { m_fullUploadCountExpected += count; @@ -218,6 +212,9 @@ protected: TextureForUploadTest m_texture; FakeTextureCopier m_copier; TextureUploaderForUploadTest m_uploader; + OwnPtr<WebThread> m_thread; + WebCompositorInitializer m_compositorInitializer; + // Properties / expectations of this test int m_fullUploadCountExpected; diff --git a/Source/WebKit/chromium/tests/CCThreadedTest.cpp b/Source/WebKit/chromium/tests/CCThreadedTest.cpp index cde88f8e6..a74e8e03a 100644 --- a/Source/WebKit/chromium/tests/CCThreadedTest.cpp +++ b/Source/WebKit/chromium/tests/CCThreadedTest.cpp @@ -28,6 +28,7 @@ #include "CCActiveAnimation.h" #include "CCAnimationTestCommon.h" +#include "CCInputHandler.h" #include "CCLayerAnimationController.h" #include "CCLayerImpl.h" #include "CCLayerTreeHostImpl.h" @@ -44,7 +45,7 @@ #include "LayerChromium.h" #include <gmock/gmock.h> #include <public/Platform.h> -#include <public/WebCompositor.h> +#include <public/WebCompositorSupport.h> #include <public/WebFilterOperation.h> #include <public/WebFilterOperations.h> #include <public/WebThread.h> @@ -56,7 +57,6 @@ using namespace WebCore; using namespace WebKit; -using namespace WTF; namespace WebKitTests { @@ -208,9 +208,9 @@ public: { } - virtual void updateAnimations(double monotonicTime) OVERRIDE + virtual void animate(double monotonicTime) OVERRIDE { - m_testHooks->updateAnimations(monotonicTime); + m_testHooks->animate(monotonicTime); } virtual void layout() OVERRIDE @@ -228,6 +228,16 @@ public: return m_testHooks->createOutputSurface(); } + virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE + { + m_testHooks->didRecreateOutputSurface(succeeded); + } + + virtual PassOwnPtr<CCInputHandler> createInputHandler() OVERRIDE + { + return nullptr; + } + virtual void willCommit() OVERRIDE { } @@ -246,11 +256,6 @@ public: { } - virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE - { - m_testHooks->didRecreateOutputSurface(succeeded); - } - virtual void scheduleComposite() OVERRIDE { m_testHooks->scheduleComposite(); @@ -601,17 +606,19 @@ void CCThreadedTest::dispatchDidAddAnimation(void* self) void CCThreadedTest::runTest(bool threaded) { // For these tests, we will enable threaded animations. - WebCompositor::setAcceleratedAnimationEnabled(true); + Platform::current()->compositorSupport()->setAcceleratedAnimationEnabled(true); if (threaded) { m_webThread = adoptPtr(WebKit::Platform::current()->createThread("CCThreadedTest")); - WebCompositor::initialize(m_webThread.get()); + Platform::current()->compositorSupport()->initialize(m_webThread.get()); } else - WebCompositor::initialize(0); + Platform::current()->compositorSupport()->initialize(0); ASSERT(CCProxy::isMainThread()); m_mainThreadProxy = CCScopedThreadProxy::create(CCProxy::mainThread()); + initializeSettings(m_settings); + m_beginTask = new BeginTask(this); WebKit::Platform::current()->currentThread()->postDelayedTask(m_beginTask, 0); // postDelayedTask takes ownership of the task m_timeoutTask = new TimeoutTask(this); @@ -632,11 +639,11 @@ void CCThreadedTest::runTest(bool threaded) m_client.clear(); if (m_timedOut) { FAIL() << "Test timed out"; - WebCompositor::shutdown(); + Platform::current()->compositorSupport()->shutdown(); return; } afterTest(); - WebCompositor::shutdown(); + Platform::current()->compositorSupport()->shutdown(); } } // namespace WebKitTests diff --git a/Source/WebKit/chromium/tests/CCThreadedTest.h b/Source/WebKit/chromium/tests/CCThreadedTest.h index 0f87de1f5..305c39293 100644 --- a/Source/WebKit/chromium/tests/CCThreadedTest.h +++ b/Source/WebKit/chromium/tests/CCThreadedTest.h @@ -31,6 +31,7 @@ #include "CompositorFakeWebGraphicsContext3D.h" #include <gtest/gtest.h> #include <public/WebAnimationDelegate.h> +#include <public/WebThread.h> namespace WebCore { class CCLayerImpl; @@ -40,10 +41,6 @@ class CCLayerTreeHostImpl; class GraphicsContext3D; } -namespace WebKit { -class WebThread; -} - namespace WebKitTests { // Used by test stubs to notify the test when something interesting happens. @@ -56,7 +53,7 @@ public: virtual void animateLayers(WebCore::CCLayerTreeHostImpl*, double monotonicTime) { } virtual void willAnimateLayers(WebCore::CCLayerTreeHostImpl*, double monotonicTime) { } virtual void applyScrollAndScale(const WebCore::IntSize&, float) { } - virtual void updateAnimations(double monotonicTime) { } + virtual void animate(double monotonicTime) { } virtual void layout() { } virtual void didRecreateOutputSurface(bool succeeded) { } virtual void didAddAnimation() { } @@ -117,6 +114,8 @@ public: protected: CCThreadedTest(); + virtual void initializeSettings(WebCore::CCLayerTreeSettings&) { } + virtual void scheduleComposite(); static void onEndTest(void* self); diff --git a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp index 8b4bd20e8..c49e12c2e 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp @@ -26,6 +26,7 @@ #include "CCTiledLayerImpl.h" +#include "CCAppendQuadsData.h" #include "CCLayerTestCommon.h" #include "CCLayerTilingData.h" #include "CCSingleThreadProxy.h" @@ -76,8 +77,8 @@ TEST(CCTiledLayerImplTest, emptyQuadList) { OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); MockCCQuadCuller quadCuller; - bool hadMissingTiles = false; - layer->appendQuads(quadCuller, hadMissingTiles); + CCAppendQuadsData data; + layer->appendQuads(quadCuller, data); const unsigned numTiles = numTilesX * numTilesY; EXPECT_EQ(quadCuller.quadList().size(), numTiles); } @@ -88,8 +89,8 @@ TEST(CCTiledLayerImplTest, emptyQuadList) layer->setVisibleContentRect(IntRect()); MockCCQuadCuller quadCuller; - bool hadMissingTiles = false; - layer->appendQuads(quadCuller, hadMissingTiles); + CCAppendQuadsData data; + layer->appendQuads(quadCuller, data); EXPECT_EQ(quadCuller.quadList().size(), 0u); } @@ -101,8 +102,8 @@ TEST(CCTiledLayerImplTest, emptyQuadList) layer->setVisibleContentRect(outsideBounds); MockCCQuadCuller quadCuller; - bool hadMissingTiles = false; - layer->appendQuads(quadCuller, hadMissingTiles); + CCAppendQuadsData data; + layer->appendQuads(quadCuller, data); EXPECT_EQ(quadCuller.quadList().size(), 0u); } @@ -112,8 +113,8 @@ TEST(CCTiledLayerImplTest, emptyQuadList) layer->setSkipsDraw(true); MockCCQuadCuller quadCuller; - bool hadMissingTiles = false; - layer->appendQuads(quadCuller, hadMissingTiles); + CCAppendQuadsData data; + layer->appendQuads(quadCuller, data); EXPECT_EQ(quadCuller.quadList().size(), 0u); } } @@ -132,10 +133,10 @@ TEST(CCTiledLayerImplTest, checkerboarding) // No checkerboarding { MockCCQuadCuller quadCuller; - bool hadMissingTiles = false; - layer->appendQuads(quadCuller, hadMissingTiles); + CCAppendQuadsData data; + layer->appendQuads(quadCuller, data); EXPECT_EQ(quadCuller.quadList().size(), 4u); - EXPECT_FALSE(hadMissingTiles); + EXPECT_FALSE(data.hadMissingTiles); for (size_t i = 0; i < quadCuller.quadList().size(); ++i) EXPECT_EQ(quadCuller.quadList()[i]->material(), CCDrawQuad::TiledContent); @@ -148,9 +149,9 @@ TEST(CCTiledLayerImplTest, checkerboarding) // All checkerboarding { MockCCQuadCuller quadCuller; - bool hadMissingTiles = false; - layer->appendQuads(quadCuller, hadMissingTiles); - EXPECT_TRUE(hadMissingTiles); + CCAppendQuadsData data; + layer->appendQuads(quadCuller, data); + EXPECT_TRUE(data.hadMissingTiles); EXPECT_EQ(quadCuller.quadList().size(), 4u); for (size_t i = 0; i < quadCuller.quadList().size(); ++i) EXPECT_NE(quadCuller.quadList()[i]->material(), CCDrawQuad::TiledContent); @@ -164,8 +165,8 @@ static void getQuads(CCQuadList& quads, CCSharedQuadStateList& sharedStates, Int layer->setBounds(layerSize); MockCCQuadCuller quadCuller(quads, sharedStates); - bool hadMissingTiles = false; - layer->appendQuads(quadCuller, hadMissingTiles); + CCAppendQuadsData data; + layer->appendQuads(quadCuller, data); } // Test with both border texels and without. diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp index dcaae59ce..ed416f238 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp @@ -85,6 +85,11 @@ PassOwnPtr<LayerTextureUpdater::Texture> FakeLayerTextureUpdater::createTexture( return adoptPtr(new Texture(this, CCPrioritizedTexture::create(manager))); } +LayerTextureUpdater::SampledTexelFormat FakeLayerTextureUpdater::sampledTexelFormat(GC3Denum) +{ + return SampledTexelFormatRGBA; +} + FakeCCTiledLayerImpl::FakeCCTiledLayerImpl(int id) : CCTiledLayerImpl(id) { @@ -105,6 +110,11 @@ FakeTiledLayerChromium::FakeTiledLayerChromium(CCPrioritizedTextureManager* text setIsDrawable(true); // So that we don't get false positives if any of these tests expect to return false from drawsContent() for other reasons. } +FakeTiledLayerWithScaledBounds::FakeTiledLayerWithScaledBounds(CCPrioritizedTextureManager* textureManager) + : FakeTiledLayerChromium(textureManager) +{ +} + FakeTiledLayerChromium::~FakeTiledLayerChromium() { } @@ -132,9 +142,29 @@ void FakeTiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& ca } } -FakeTiledLayerWithScaledBounds::FakeTiledLayerWithScaledBounds(CCPrioritizedTextureManager* textureManager) - : FakeTiledLayerChromium(textureManager) +WebCore::CCPrioritizedTextureManager* FakeTiledLayerChromium::textureManager() const +{ + return m_textureManager; +} + +WebCore::LayerTextureUpdater* FakeTiledLayerChromium::textureUpdater() const +{ + return m_fakeTextureUpdater.get(); +} + +WebCore::IntSize FakeTiledLayerWithScaledBounds::contentBounds() const +{ + return m_forcedContentBounds; +} + +bool FakeTextureUploader::isBusy() +{ + return false; +} + +void FakeTextureUploader::uploadTexture(WebCore::CCResourceProvider* resourceProvider, Parameters upload) { + upload.texture->updateRect(resourceProvider, upload.sourceRect, upload.destOffset); } } // namespace diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h index 3adb4bf17..486f6c022 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h @@ -60,7 +60,7 @@ public: virtual ~FakeLayerTextureUpdater(); virtual PassOwnPtr<WebCore::LayerTextureUpdater::Texture> createTexture(WebCore::CCPrioritizedTextureManager*) OVERRIDE; - virtual SampledTexelFormat sampledTexelFormat(GC3Denum) OVERRIDE { return SampledTexelFormatRGBA; } + virtual SampledTexelFormat sampledTexelFormat(GC3Denum) OVERRIDE; virtual void prepareToUpdate(const WebCore::IntRect& contentRect, const WebCore::IntSize&, float, float, WebCore::IntRect& resultingOpaqueRect, WebCore::CCRenderingStats&) OVERRIDE; // Sets the rect to invalidate during the next call to prepareToUpdate(). After the next @@ -122,12 +122,12 @@ public: virtual void setTexturePriorities(const WebCore::CCPriorityCalculator&) OVERRIDE; - virtual WebCore::CCPrioritizedTextureManager* textureManager() const OVERRIDE { return m_textureManager; } + virtual WebCore::CCPrioritizedTextureManager* textureManager() const OVERRIDE; FakeLayerTextureUpdater* fakeLayerTextureUpdater() { return m_fakeTextureUpdater.get(); } WebCore::FloatRect updateRect() { return m_updateRect; } protected: - virtual WebCore::LayerTextureUpdater* textureUpdater() const OVERRIDE { return m_fakeTextureUpdater.get(); } + virtual WebCore::LayerTextureUpdater* textureUpdater() const OVERRIDE; virtual void createTextureUpdaterIfNeeded() OVERRIDE { } private: @@ -141,7 +141,7 @@ public: explicit FakeTiledLayerWithScaledBounds(WebCore::CCPrioritizedTextureManager*); void setContentBounds(const WebCore::IntSize& contentBounds) { m_forcedContentBounds = contentBounds; } - virtual WebCore::IntSize contentBounds() const OVERRIDE { return m_forcedContentBounds; } + virtual WebCore::IntSize contentBounds() const OVERRIDE; protected: WebCore::IntSize m_forcedContentBounds; @@ -149,16 +149,16 @@ protected: class FakeTextureCopier : public WebCore::TextureCopier { public: - virtual void copyTexture(Parameters) { } - virtual void flush() { } + virtual void copyTexture(Parameters) OVERRIDE { } + virtual void flush() OVERRIDE { } }; class FakeTextureUploader : public WebCore::TextureUploader { public: - virtual bool isBusy() { return false; } - virtual void beginUploads() { } - virtual void endUploads() { } - virtual void uploadTexture(WebCore::CCResourceProvider* resourceProvider, Parameters upload) { upload.texture->updateRect(resourceProvider, upload.sourceRect, upload.destOffset); } + virtual bool isBusy() OVERRIDE; + virtual void beginUploads() OVERRIDE { } + virtual void endUploads() OVERRIDE { } + virtual void uploadTexture(WebCore::CCResourceProvider*, Parameters upload) OVERRIDE; }; } diff --git a/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp b/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp index 6972424b0..26bdd4f11 100644 --- a/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp +++ b/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp @@ -30,8 +30,8 @@ #include "FakeWebGraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" #include "ImageBuffer.h" +#include "WebCompositorInitializer.h" #include <public/Platform.h> -#include <public/WebCompositor.h> #include <public/WebThread.h> #include <gmock/gmock.h> @@ -81,7 +81,7 @@ protected: OwnPtr<WebThread> thread; if (threadMode == Threaded) thread = adoptPtr(WebKit::Platform::current()->createThread("Canvas2DLayerBridgeTest")); - WebCompositor::initialize(thread.get()); + WebKitTests::WebCompositorInitializer initializer(thread.get()); WebGLId backTextureId = 1; WebGLId frontTextureId = 1; @@ -109,8 +109,6 @@ protected: EXPECT_CALL(mainMock, flush()); } bridge.clear(); - - WebCompositor::shutdown(); } }; diff --git a/Source/WebKit/chromium/tests/Canvas2DLayerManagerTest.cpp b/Source/WebKit/chromium/tests/Canvas2DLayerManagerTest.cpp new file mode 100644 index 000000000..f9a136c35 --- /dev/null +++ b/Source/WebKit/chromium/tests/Canvas2DLayerManagerTest.cpp @@ -0,0 +1,156 @@ +/* + * 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 "Canvas2DLayerManager.h" + +#include "FakeWebGraphicsContext3D.h" +#include "GraphicsContext3DPrivate.h" +#include <gmock/gmock.h> +#include <gtest/gtest.h> + +using namespace WebCore; +using testing::InSequence; +using testing::Return; +using testing::Test; + + +class FakeCanvas2DLayerBridge : public Canvas2DLayerBridge { +public: + FakeCanvas2DLayerBridge() + : Canvas2DLayerBridge(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new WebKit::FakeWebGraphicsContext3D)), IntSize(1, 1), Deferred, 0) + , m_freeableBytes(0) + , m_freeMemoryIfPossibleCount(0) + , m_flushCount(0) + { + } + + void fakeFreeableBytes(size_t size) + { + m_freeableBytes = size; + } + + virtual size_t freeMemoryIfPossible(size_t size) OVERRIDE + { + m_freeMemoryIfPossibleCount++; + size_t bytesFreed = size < m_freeableBytes ? size : m_freeableBytes; + m_freeableBytes -= bytesFreed; + if (bytesFreed) + Canvas2DLayerManager::get().layerAllocatedStorageChanged(this, -((intptr_t)bytesFreed)); + m_bytesAllocated -= bytesFreed; + return bytesFreed; + } + + virtual void flush() OVERRIDE + { + m_flushCount++; + } + +public: + size_t m_freeableBytes; + int m_freeMemoryIfPossibleCount; + int m_flushCount; +}; + +class Canvas2DLayerManagerTest : public Test { +protected: + void storageAllocationTrackingTest() + { + Canvas2DLayerManager& manager = Canvas2DLayerManager::get(); + manager.init(10, 10); + { + FakeCanvas2DLayerBridge layer1; + EXPECT_EQ((size_t)0, manager.m_bytesAllocated); + layer1.storageAllocatedForRecordingChanged(1); + EXPECT_EQ((size_t)1, manager.m_bytesAllocated); + // Test allocation increase + layer1.storageAllocatedForRecordingChanged(2); + EXPECT_EQ((size_t)2, manager.m_bytesAllocated); + // Test allocation decrease + layer1.storageAllocatedForRecordingChanged(1); + EXPECT_EQ((size_t)1, manager.m_bytesAllocated); + { + FakeCanvas2DLayerBridge layer2; + EXPECT_EQ((size_t)1, manager.m_bytesAllocated); + // verify multi-layer allocation tracking + layer2.storageAllocatedForRecordingChanged(2); + EXPECT_EQ((size_t)3, manager.m_bytesAllocated); + } + // Verify tracking after destruction + EXPECT_EQ((size_t)1, manager.m_bytesAllocated); + } + } + + void evictionTest() + { + Canvas2DLayerManager& manager = Canvas2DLayerManager::get(); + manager.init(10, 5); + FakeCanvas2DLayerBridge layer; + layer.fakeFreeableBytes(10); + layer.storageAllocatedForRecordingChanged(8); // under the max + EXPECT_EQ(0, layer.m_freeMemoryIfPossibleCount); + layer.storageAllocatedForRecordingChanged(12); // over the max + EXPECT_EQ(1, layer.m_freeMemoryIfPossibleCount); + EXPECT_EQ((size_t)3, layer.m_freeableBytes); + EXPECT_EQ(0, layer.m_flushCount); // eviction succeeded without triggering a flush + EXPECT_EQ((size_t)5, layer.bytesAllocated()); + } + + void flushEvictionTest() + { + Canvas2DLayerManager& manager = Canvas2DLayerManager::get(); + manager.init(10, 5); + FakeCanvas2DLayerBridge layer; + layer.fakeFreeableBytes(1); // Not enough freeable bytes, will cause aggressive eviction by flushing + layer.storageAllocatedForRecordingChanged(8); // under the max + EXPECT_EQ(0, layer.m_freeMemoryIfPossibleCount); + layer.storageAllocatedForRecordingChanged(12); // over the max + EXPECT_EQ(2, layer.m_freeMemoryIfPossibleCount); // Two tries, one before flush, one after flush + EXPECT_EQ((size_t)0, layer.m_freeableBytes); + EXPECT_EQ(1, layer.m_flushCount); // flush was attempted + EXPECT_EQ((size_t)11, layer.bytesAllocated()); // flush drops the layer from manager's tracking list + EXPECT_FALSE(manager.isInList(&layer)); + } +}; + +namespace { + +TEST_F(Canvas2DLayerManagerTest, testStorageAllocationTracking) +{ + storageAllocationTrackingTest(); +} + +TEST_F(Canvas2DLayerManagerTest, testEviction) +{ + evictionTest(); +} + +TEST_F(Canvas2DLayerManagerTest, testFlushEviction) +{ + flushEvictionTest(); +} + +} // namespace + diff --git a/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp index fd35e2224..483579fe0 100644 --- a/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp @@ -27,10 +27,9 @@ #include "ContentLayerChromium.h" #include "BitmapCanvasLayerTextureUpdater.h" -#include "CCLayerTreeTestCommon.h" +#include "CCGeometryTestUtils.h" #include "CCRenderingStats.h" -#include "GraphicsContext.h" -#include "OpaqueRectTrackingContentLayerDelegate.h" +#include "ContentLayerChromiumClient.h" #include "skia/ext/platform_canvas.h" #include <gtest/gtest.h> #include <public/WebFloatRect.h> @@ -43,49 +42,20 @@ using namespace WebKit; namespace { -class OpaqueRectDrawingGraphicsContextPainter : public GraphicsContextPainter { +class MockContentLayerChromiumClient : public ContentLayerChromiumClient { public: - explicit OpaqueRectDrawingGraphicsContextPainter(const IntRect& opaqueRect, const IntRect& contentRect) - : m_opaqueRect(opaqueRect) - , m_contentRect(contentRect) + explicit MockContentLayerChromiumClient(IntRect opaqueLayerRect) + : m_opaqueLayerRect(opaqueLayerRect) { } - virtual ~OpaqueRectDrawingGraphicsContextPainter() + virtual void paintContents(SkCanvas*, const IntRect&, FloatRect& opaque) OVERRIDE { - } - - virtual void paint(GraphicsContext& context, const IntRect& clip) OVERRIDE - { - Color alpha(0, 0, 0, 0); - context.fillRect(m_contentRect, alpha, ColorSpaceDeviceRGB); - - Color white(255, 255, 255, 255); - context.fillRect(m_opaqueRect, white, ColorSpaceDeviceRGB); - } - -private: - IntRect m_opaqueRect; - IntRect m_contentRect; -}; - -class MockContentLayerDelegate : public ContentLayerDelegate { -public: - explicit MockContentLayerDelegate(OpaqueRectTrackingContentLayerDelegate* client) - : m_client(client) - { - } - - virtual void paintContents(SkCanvas* canvas, const IntRect& clip, FloatRect& opaque) OVERRIDE - { - WebFloatRect resultingOpaqueRect(opaque.x(), opaque.y(), opaque.width(), opaque.height()); - WebRect webClipRect(clip.x(), clip.y(), clip.width(), clip.height()); - m_client->paintContents(canvas, webClipRect, resultingOpaqueRect); - opaque = FloatRect(resultingOpaqueRect.x, resultingOpaqueRect.y, resultingOpaqueRect.width, resultingOpaqueRect.height); + opaque = FloatRect(m_opaqueLayerRect); } private: - OpaqueRectTrackingContentLayerDelegate* m_client; + IntRect m_opaqueLayerRect; }; TEST(ContentLayerChromiumTest, ContentLayerPainterWithDeviceScale) @@ -96,16 +66,14 @@ TEST(ContentLayerChromiumTest, ContentLayerPainterWithDeviceScale) IntRect opaqueRectInContentSpace = opaqueRectInLayerSpace; opaqueRectInContentSpace.scale(contentsScale); OwnPtr<SkCanvas> canvas = adoptPtr(skia::CreateBitmapCanvas(contentRect.width(), contentRect.height(), false)); - OpaqueRectDrawingGraphicsContextPainter painter(opaqueRectInLayerSpace, contentRect); - OpaqueRectTrackingContentLayerDelegate opaqueRectTrackingContentLayerDelegate(&painter); - MockContentLayerDelegate delegate(&opaqueRectTrackingContentLayerDelegate); - RefPtr<BitmapCanvasLayerTextureUpdater> updater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(&delegate)); + MockContentLayerChromiumClient client(opaqueRectInLayerSpace); + RefPtr<BitmapCanvasLayerTextureUpdater> updater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(&client)); IntRect resultingOpaqueRect; CCRenderingStats stats; updater->prepareToUpdate(contentRect, IntSize(256, 256), contentsScale, contentsScale, resultingOpaqueRect, stats); - EXPECT_INT_RECT_EQ(opaqueRectInContentSpace, resultingOpaqueRect); + EXPECT_RECT_EQ(opaqueRectInContentSpace, resultingOpaqueRect); } } // namespace diff --git a/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h b/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h index b87305afe..dc5b02763 100755 --- a/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h +++ b/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h @@ -27,6 +27,7 @@ #include "config.h" +#include "CCInputHandler.h" #include "CCLayerTreeHost.h" #include "CompositorFakeWebGraphicsContext3D.h" #include "FakeWebCompositorOutputSurface.h" @@ -37,7 +38,7 @@ class FakeCCLayerTreeHostClient : public CCLayerTreeHostClient { public: virtual void willBeginFrame() OVERRIDE { } virtual void didBeginFrame() OVERRIDE { } - virtual void updateAnimations(double monotonicFrameBeginTime) OVERRIDE { } + virtual void animate(double monotonicFrameBeginTime) OVERRIDE { } virtual void layout() OVERRIDE { } virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) OVERRIDE { } @@ -47,6 +48,7 @@ public: return WebKit::FakeWebCompositorOutputSurface::create(WebKit::CompositorFakeWebGraphicsContext3D::create(attrs)); } virtual void didRecreateOutputSurface(bool success) OVERRIDE { } + virtual PassOwnPtr<CCInputHandler> createInputHandler() OVERRIDE { return nullptr; } virtual void willCommit() OVERRIDE { } virtual void didCommit() OVERRIDE { } virtual void didCommitAndDrawFrame() OVERRIDE { } diff --git a/Source/WebKit/chromium/tests/FakeWebCompositorOutputSurface.h b/Source/WebKit/chromium/tests/FakeWebCompositorOutputSurface.h index c20c9f991..1d93b6b6e 100644 --- a/Source/WebKit/chromium/tests/FakeWebCompositorOutputSurface.h +++ b/Source/WebKit/chromium/tests/FakeWebCompositorOutputSurface.h @@ -28,6 +28,8 @@ #include <public/WebCompositorOutputSurface.h> #include <public/WebGraphicsContext3D.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> namespace WebKit { diff --git a/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp index c0a9cf2ef..cff826eed 100644 --- a/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp @@ -33,10 +33,12 @@ #include "GraphicsLayer.h" #include "Matrix3DTransformOperation.h" #include "RotateTransformOperation.h" +#include "ScrollableArea.h" #include "TranslateTransformOperation.h" #include "WebLayerTreeViewTestCommon.h" #include <gtest/gtest.h> -#include <public/WebCompositor.h> +#include <public/Platform.h> +#include <public/WebCompositorSupport.h> #include <public/WebFloatAnimationCurve.h> #include <public/WebGraphicsContext3D.h> #include <public/WebLayerTreeView.h> @@ -62,19 +64,19 @@ public: GraphicsLayerChromiumTest() { // For these tests, we will enable threaded animations. - WebCompositor::setAcceleratedAnimationEnabled(true); - WebCompositor::initialize(0); + Platform::current()->compositorSupport()->setAcceleratedAnimationEnabled(true); + Platform::current()->compositorSupport()->initialize(0); m_graphicsLayer = static_pointer_cast<GraphicsLayerChromium>(GraphicsLayer::create(&m_client)); m_platformLayer = m_graphicsLayer->platformLayer(); - m_layerTreeView.initialize(&m_layerTreeViewClient, *m_platformLayer, WebLayerTreeView::Settings()); - m_layerTreeView.setViewportSize(WebSize(1, 1), WebSize(1, 1)); + m_layerTreeView = adoptPtr(Platform::current()->compositorSupport()->createLayerTreeView(&m_layerTreeViewClient, *m_platformLayer, WebLayerTreeView::Settings())); + m_layerTreeView->setViewportSize(WebSize(1, 1), WebSize(1, 1)); } virtual ~GraphicsLayerChromiumTest() { m_graphicsLayer.clear(); - m_layerTreeView.reset(); - WebCompositor::shutdown(); + m_layerTreeView.clear(); + Platform::current()->compositorSupport()->shutdown(); } protected: @@ -88,7 +90,7 @@ protected: private: MockWebLayerTreeViewClient m_layerTreeViewClient; - WebLayerTreeView m_layerTreeView; + OwnPtr<WebLayerTreeView> m_layerTreeView; MockGraphicsLayerClient m_client; }; @@ -96,9 +98,10 @@ TEST_F(GraphicsLayerChromiumTest, updateLayerPreserves3DWithAnimations) { ASSERT_FALSE(m_platformLayer->hasActiveAnimation()); - OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(Platform::current()->compositorSupport()->createFloatAnimationCurve()); curve->add(WebFloatKeyframe(0.0, 0.0)); - OwnPtr<WebAnimation> floatAnimation(adoptPtr(WebAnimation::create(*curve, 1, 1, WebAnimation::TargetPropertyOpacity))); + OwnPtr<WebAnimation> floatAnimation(adoptPtr(Platform::current()->compositorSupport()->createAnimation(*curve, WebAnimation::TargetPropertyOpacity))); + int animationId = floatAnimation->id(); ASSERT_TRUE(m_platformLayer->addAnimation(floatAnimation.get())); ASSERT_TRUE(m_platformLayer->hasActiveAnimation()); @@ -109,7 +112,7 @@ TEST_F(GraphicsLayerChromiumTest, updateLayerPreserves3DWithAnimations) ASSERT_TRUE(m_platformLayer); ASSERT_TRUE(m_platformLayer->hasActiveAnimation()); - m_platformLayer->removeAnimation(1); + m_platformLayer->removeAnimation(animationId); ASSERT_FALSE(m_platformLayer->hasActiveAnimation()); m_graphicsLayer->setPreserves3D(false); @@ -120,9 +123,38 @@ TEST_F(GraphicsLayerChromiumTest, updateLayerPreserves3DWithAnimations) ASSERT_FALSE(m_platformLayer->hasActiveAnimation()); } -TEST_F(GraphicsLayerChromiumTest, shouldStartWithCorrectContentsScale) +class FakeScrollableArea : public ScrollableArea { +public: + virtual bool isActive() const OVERRIDE { return false; } + virtual int scrollSize(ScrollbarOrientation) const OVERRIDE { return 100; } + virtual int scrollPosition(Scrollbar*) const OVERRIDE { return 0; } + virtual bool isScrollCornerVisible() const OVERRIDE { return false; } + virtual IntRect scrollCornerRect() const OVERRIDE { return IntRect(); } + virtual int visibleWidth() const OVERRIDE { return 10; } + virtual int visibleHeight() const OVERRIDE { return 10; } + virtual IntSize contentsSize() const OVERRIDE { return IntSize(100, 100); } + virtual bool isOnActivePage() const OVERRIDE { return false; } + virtual ScrollableArea* enclosingScrollableArea() const OVERRIDE { return 0; } + virtual IntRect scrollableAreaBoundingBox() const OVERRIDE { return IntRect(); } + virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE { } + virtual void invalidateScrollCornerRect(const IntRect&) OVERRIDE { } + + virtual void setScrollOffset(const IntPoint& scrollOffset) OVERRIDE { m_scrollPosition = scrollOffset; } + virtual IntPoint scrollPosition() const OVERRIDE { return m_scrollPosition; } + +private: + IntPoint m_scrollPosition; +}; + +TEST_F(GraphicsLayerChromiumTest, applyScrollToScrollableArea) { - EXPECT_EQ(2, m_graphicsLayer->contentsScale()); + FakeScrollableArea scrollableArea; + m_graphicsLayer->setScrollableArea(&scrollableArea); + + WebPoint scrollPosition(7, 9); + m_platformLayer->setScrollPosition(scrollPosition); + + EXPECT_EQ(scrollPosition, WebPoint(scrollableArea.scrollPosition())); } } // namespace diff --git a/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp b/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp index ead7f9bb9..1fa2c262d 100644 --- a/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp +++ b/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp @@ -57,12 +57,12 @@ TEST(IDBDatabaseBackendTest, BackingStoreRetention) EXPECT_GT(backingStore->refCount(), 1); const bool autoIncrement = false; - RefPtr<IDBObjectStoreBackendImpl> store = IDBObjectStoreBackendImpl::create(db.get(), "store", String("keyPath"), autoIncrement); + RefPtr<IDBObjectStoreBackendImpl> store = IDBObjectStoreBackendImpl::create(db.get(), "store", IDBKeyPath("keyPath"), autoIncrement); EXPECT_GT(backingStore->refCount(), 1); const bool unique = false; const bool multiEntry = false; - RefPtr<IDBIndexBackendImpl> index = IDBIndexBackendImpl::create(db.get(), store.get(), "index", String("keyPath"), unique, multiEntry); + RefPtr<IDBIndexBackendImpl> index = IDBIndexBackendImpl::create(db.get(), store.get(), "index", IDBKeyPath("keyPath"), unique, multiEntry); EXPECT_GT(backingStore->refCount(), 1); db.clear(); diff --git a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp index 0e6eb0eb4..a17b076f3 100644 --- a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp @@ -26,15 +26,15 @@ #include "LayerChromium.h" +#include "CCGeometryTestUtils.h" #include "CCLayerImpl.h" #include "CCLayerTreeHost.h" -#include "CCLayerTreeTestCommon.h" #include "CCSingleThreadProxy.h" #include "FakeCCLayerTreeHostClient.h" #include "LayerPainterChromium.h" +#include "WebCompositorInitializer.h" #include <gmock/gmock.h> #include <gtest/gtest.h> -#include <public/WebCompositor.h> #include <public/WebTransformationMatrix.h> using namespace WebCore; @@ -74,11 +74,15 @@ public: class LayerChromiumTest : public testing::Test { +public: + LayerChromiumTest() + : m_compositorInitializer(0) + { + } + protected: virtual void SetUp() { - // Initialize without threading support. - WebKit::WebCompositor::initialize(0); m_layerTreeHost = adoptPtr(new MockCCLayerTreeHost); } @@ -96,7 +100,6 @@ protected: m_layerTreeHost->setRootLayer(0); m_layerTreeHost.clear(); - WebKit::WebCompositor::shutdown(); } void verifyTestTreeInitialState() const @@ -149,6 +152,7 @@ protected: OwnPtr<MockCCLayerTreeHost> m_layerTreeHost; RefPtr<LayerChromium> m_parent, m_child1, m_child2, m_child3, m_grandChild1, m_grandChild2, m_grandChild3; + WebCompositorInitializer m_compositorInitializer; }; TEST_F(LayerChromiumTest, basicCreateAndDestroy) @@ -635,7 +639,7 @@ void assertLayerTreeHostMatchesForSubtree(LayerChromium* layer, CCLayerTreeHost* TEST(LayerChromiumLayerTreeHostTest, enteringTree) { - WebKit::WebCompositor::initialize(0); + WebCompositorInitializer compositorInitializer(0); RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> mask = LayerChromium::create(); @@ -662,12 +666,11 @@ TEST(LayerChromiumLayerTreeHostTest, enteringTree) assertLayerTreeHostMatchesForSubtree(parent.get(), 0); layerTreeHost.clear(); - WebKit::WebCompositor::shutdown(); } TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree) { - WebKit::WebCompositor::initialize(0); + WebCompositorInitializer compositorInitializer(0); RefPtr<LayerChromium> parent = LayerChromium::create(); OwnPtr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create()); @@ -693,12 +696,11 @@ TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree) layerTreeHost->setRootLayer(0); layerTreeHost.clear(); - WebKit::WebCompositor::shutdown(); } TEST(LayerChromiumLayerTreeHostTest, changeHost) { - WebKit::WebCompositor::initialize(0); + WebCompositorInitializer compositorInitializer(0); RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> mask = LayerChromium::create(); @@ -726,12 +728,11 @@ TEST(LayerChromiumLayerTreeHostTest, changeHost) secondLayerTreeHost->setRootLayer(0); firstLayerTreeHost.clear(); secondLayerTreeHost.clear(); - WebKit::WebCompositor::shutdown(); } TEST(LayerChromiumLayerTreeHostTest, changeHostInSubtree) { - WebKit::WebCompositor::initialize(0); + WebCompositorInitializer compositorInitializer(0); RefPtr<LayerChromium> firstParent = LayerChromium::create(); RefPtr<LayerChromium> firstChild = LayerChromium::create(); RefPtr<LayerChromium> secondParent = LayerChromium::create(); @@ -763,12 +764,11 @@ TEST(LayerChromiumLayerTreeHostTest, changeHostInSubtree) secondLayerTreeHost->setRootLayer(0); firstLayerTreeHost.clear(); secondLayerTreeHost.clear(); - WebKit::WebCompositor::shutdown(); } TEST(LayerChromiumLayerTreeHostTest, replaceMaskAndReplicaLayer) { - WebKit::WebCompositor::initialize(0); + WebCompositorInitializer compositorInitializer(0); RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> mask = LayerChromium::create(); RefPtr<LayerChromium> replica = LayerChromium::create(); @@ -800,19 +800,17 @@ TEST(LayerChromiumLayerTreeHostTest, replaceMaskAndReplicaLayer) // Test over, cleanup time. layerTreeHost->setRootLayer(0); layerTreeHost.clear(); - WebKit::WebCompositor::shutdown(); } TEST(LayerChromiumLayerTreeHostTest, destroyHostWithNonNullRootLayer) { - WebKit::WebCompositor::initialize(0); + WebCompositorInitializer compositorInitializer(0); RefPtr<LayerChromium> root = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); root->addChild(child); OwnPtr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create()); layerTreeHost->setRootLayer(root); layerTreeHost.clear(); - WebKit::WebCompositor::shutdown(); } class MockLayerChromium : public LayerChromium { diff --git a/Source/WebKit/chromium/tests/LinkHighlightTest.cpp b/Source/WebKit/chromium/tests/LinkHighlightTest.cpp index 64830ef22..eafe2307f 100644 --- a/Source/WebKit/chromium/tests/LinkHighlightTest.cpp +++ b/Source/WebKit/chromium/tests/LinkHighlightTest.cpp @@ -30,10 +30,10 @@ #include "IntRect.h" #include "Node.h" #include "URLTestHelpers.h" +#include "WebCompositorInitializer.h" #include "WebFrame.h" #include "WebViewImpl.h" #include <gtest/gtest.h> -#include <public/WebCompositor.h> #include <public/WebContentLayer.h> #include <public/WebFloatPoint.h> #include <public/WebSize.h> @@ -47,7 +47,7 @@ namespace { #if ENABLE(GESTURE_EVENTS) TEST(LinkHighlightTest, verifyWebViewImplIntegration) { - WebCompositor::initialize(0); + WebKitTests::WebCompositorInitializer compositorInitializer(0); const std::string baseURL("http://www.test.com/"); const std::string fileName("test_touch_link_highlight.html"); @@ -82,7 +82,6 @@ TEST(LinkHighlightTest, verifyWebViewImplIntegration) ASSERT_TRUE(webViewImpl->linkHighlight()); webViewImpl->close(); - WebCompositor::shutdown(); } #endif diff --git a/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp b/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp index b5b50bf7d..51b200ade 100644 --- a/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp +++ b/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp @@ -32,6 +32,7 @@ #include "DataRef.h" #include "MemoryInstrumentationImpl.h" +#include "WebCoreMemoryInstrumentation.h" #include <gtest/gtest.h> @@ -58,7 +59,7 @@ public: virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { - MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM); + MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); info.addMember(m_notInstrumented); } NotInstrumented* m_notInstrumented; @@ -122,7 +123,7 @@ public: virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { - MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM); + MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); info.addMember(m_notInstrumented); } NotInstrumented* m_notInstrumented; @@ -155,7 +156,7 @@ public: virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { - MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS); + MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); Instrumented::reportMemoryUsage(memoryObjectInfo); info.addMember(m_notInstrumentedOwnPtr); } @@ -172,27 +173,27 @@ TEST(MemoryInstrumentationTest, ownPtrNotInstrumented) EXPECT_EQ(2, visitedObjects.size()); } -class InstrumentedOther { +class InstrumentedUndefined { public: - InstrumentedOther() : m_data(0) { } + InstrumentedUndefined() : m_data(0) { } void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { - MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::Other); + MemoryClassInfo info(memoryObjectInfo, this, GenericMemoryTypes::Undefined); } int m_data; }; class InstrumentedDOM { public: - InstrumentedDOM() : m_instrumentedOther(adoptPtr(new InstrumentedOther)) { } + InstrumentedDOM() : m_instrumentedUndefined(adoptPtr(new InstrumentedUndefined)) { } void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { - MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM); - info.addInstrumentedMember(m_instrumentedOther); + MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); + info.addInstrumentedMember(m_instrumentedUndefined); } - OwnPtr<InstrumentedOther> m_instrumentedOther; + OwnPtr<InstrumentedUndefined> m_instrumentedUndefined; }; TEST(MemoryInstrumentationTest, ownerTypePropagation) @@ -201,8 +202,8 @@ TEST(MemoryInstrumentationTest, ownerTypePropagation) MemoryInstrumentationImpl impl(visitedObjects); OwnPtr<InstrumentedDOM> instrumentedDOM(adoptPtr(new InstrumentedDOM)); impl.addRootObject(instrumentedDOM); - EXPECT_EQ(sizeof(InstrumentedDOM) + sizeof(InstrumentedOther), impl.reportedSizeForAllTypes()); - EXPECT_EQ(sizeof(InstrumentedDOM) + sizeof(InstrumentedOther), impl.totalSize(MemoryInstrumentation::DOM)); + EXPECT_EQ(sizeof(InstrumentedDOM) + sizeof(InstrumentedUndefined), impl.reportedSizeForAllTypes()); + EXPECT_EQ(sizeof(InstrumentedDOM) + sizeof(InstrumentedUndefined), impl.totalSize(WebCoreMemoryTypes::DOM)); EXPECT_EQ(2, visitedObjects.size()); } @@ -210,7 +211,7 @@ class NonVirtualInstrumented { public: void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { - MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM); + MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); info.addInstrumentedMember(m_instrumented); } @@ -227,32 +228,26 @@ TEST(MemoryInstrumentationTest, visitFirstMemberInNonVirtualClass) EXPECT_EQ(2, visitedObjects.size()); } -TEST(MemoryInstrumentationTest, visitStrings) -{ - { - VisitedObjects visitedObjects; - MemoryInstrumentationImpl impl(visitedObjects); - String string("string"); - impl.addRootObject(string); - EXPECT_EQ(string.impl()->sizeInBytes(), impl.reportedSizeForAllTypes()); - EXPECT_EQ(2, visitedObjects.size()); - } - { - VisitedObjects visitedObjects; - MemoryInstrumentationImpl impl(visitedObjects); - String string("string"); - impl.addRootObject(&string); - EXPECT_EQ(string.impl()->sizeInBytes() + sizeof(String), impl.reportedSizeForAllTypes()); - EXPECT_EQ(2, visitedObjects.size()); - } +class StringOwnerInstrumented { +public: + StringOwnerInstrumented() : m_name("string") { } + void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { - VisitedObjects visitedObjects; - MemoryInstrumentationImpl impl(visitedObjects); - AtomicString string("string"); - impl.addRootObject(&string); - EXPECT_EQ(string.impl()->sizeInBytes() + sizeof(AtomicString), impl.reportedSizeForAllTypes()); - EXPECT_EQ(2, visitedObjects.size()); + MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); + info.addInstrumentedMember(m_name); } + + String m_name; +}; + +TEST(MemoryInstrumentationTest, visitStrings) +{ + VisitedObjects visitedObjects; + MemoryInstrumentationImpl impl(visitedObjects); + StringOwnerInstrumented stringOwnerInstrumented; + impl.addRootObject(stringOwnerInstrumented); + EXPECT_EQ(stringOwnerInstrumented.m_name.impl()->sizeInBytes(), impl.reportedSizeForAllTypes()); + EXPECT_EQ(2, visitedObjects.size()); } } // namespace diff --git a/Source/WebKit/chromium/tests/MockCCQuadCuller.h b/Source/WebKit/chromium/tests/MockCCQuadCuller.h index 59a0073ce..1833f349e 100644 --- a/Source/WebKit/chromium/tests/MockCCQuadCuller.h +++ b/Source/WebKit/chromium/tests/MockCCQuadCuller.h @@ -44,7 +44,7 @@ public: , m_activeSharedQuadStateList(externalSharedQuadStateList) { } - virtual bool append(WTF::PassOwnPtr<CCDrawQuad> newQuad) OVERRIDE + virtual bool append(PassOwnPtr<CCDrawQuad> newQuad, CCAppendQuadsData&) OVERRIDE { OwnPtr<CCDrawQuad> drawQuad = newQuad; if (!drawQuad->quadRect().isEmpty()) { diff --git a/Source/WebKit/chromium/tests/PlatformGestureCurveTest.cpp b/Source/WebKit/chromium/tests/PlatformGestureCurveTest.cpp index 4f0a2276f..9bda21764 100644 --- a/Source/WebKit/chromium/tests/PlatformGestureCurveTest.cpp +++ b/Source/WebKit/chromium/tests/PlatformGestureCurveTest.cpp @@ -28,10 +28,8 @@ #include "PlatformGestureCurve.h" #include "ActivePlatformGestureAnimation.h" -#include "CCActiveGestureAnimation.h" -#include "CCGestureCurve.h" #include "PlatformGestureCurveTarget.h" -#include "TouchpadFlingPlatformGestureCurve.h" +#include "TouchFlingPlatformGestureCurve.h" #include "WheelFlingPlatformGestureCurve.h" #include <gtest/gtest.h> #include <wtf/OwnPtr.h> @@ -101,7 +99,7 @@ TEST(PlatformGestureCurve, flingCurveTouch) { double initialVelocity = 5000; MockPlatformGestureCurveTarget target; - OwnPtr<ActivePlatformGestureAnimation> animation = ActivePlatformGestureAnimation::create(TouchpadFlingPlatformGestureCurve::create(FloatPoint(initialVelocity, 0)), &target); + OwnPtr<ActivePlatformGestureAnimation> animation = ActivePlatformGestureAnimation::create(TouchFlingPlatformGestureCurve::createForTouchPad(FloatPoint(initialVelocity, 0)), &target); // Note: the expectations below are dependent on the value of sigma hard-coded in the curve parameters. // If the parameters change, then the tests values/expectations will need to be updated. diff --git a/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp index 6242043b3..c6efbb5bf 100644 --- a/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp @@ -30,8 +30,6 @@ #include "CCScrollbarLayerImpl.h" #include "CCSingleThreadProxy.h" #include "FakeWebScrollbarThemeGeometry.h" -#include "Scrollbar.h" -#include "Settings.h" #include "TreeSynchronizer.h" #include <gtest/gtest.h> #include <public/WebScrollbar.h> @@ -42,68 +40,37 @@ using namespace WebCore; namespace { -class MockScrollbar : public Scrollbar { +class FakeWebScrollbar : public WebKit::WebScrollbar { 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 windowPoint; } - - 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) { } - - virtual bool isOverlayScrollbar() const { return false; } - - MockScrollbar() : Scrollbar(0, HorizontalScrollbar, RegularScrollbar) { } - virtual ~MockScrollbar() { } + static PassOwnPtr<FakeWebScrollbar> create() { return adoptPtr(new FakeWebScrollbar()); } + + // WebScrollbar implementation + virtual bool isOverlay() const OVERRIDE { return false; } + virtual int value() const OVERRIDE { return 0; } + virtual WebKit::WebPoint location() const OVERRIDE { return WebKit::WebPoint(); } + virtual WebKit::WebSize size() const OVERRIDE { return WebKit::WebSize(); } + virtual bool enabled() const OVERRIDE { return true; } + virtual int maximum() const OVERRIDE { return 0; } + virtual int totalSize() const OVERRIDE { return 0; } + virtual bool isScrollViewScrollbar() const OVERRIDE { return false; } + virtual bool isScrollableAreaActive() const OVERRIDE { return true; } + virtual void getTickmarks(WebKit::WebVector<WebKit::WebRect>&) const OVERRIDE { } + virtual ScrollbarControlSize controlSize() const OVERRIDE { return WebScrollbar::RegularScrollbar; } + virtual ScrollbarPart pressedPart() const OVERRIDE { return WebScrollbar::NoPart; } + virtual ScrollbarPart hoveredPart() const OVERRIDE { return WebScrollbar::NoPart; } + virtual ScrollbarOverlayStyle scrollbarOverlayStyle() const OVERRIDE { return WebScrollbar::ScrollbarOverlayStyleDefault; } + virtual bool isCustomScrollbar() const OVERRIDE { return false; } + virtual Orientation orientation() const OVERRIDE { return WebScrollbar::Horizontal; } }; TEST(ScrollbarLayerChromiumTest, resolveScrollLayerPointer) { DebugScopedSetImplThread impl; - RefPtr<MockScrollbar> mockScrollbar = adoptRef(new MockScrollbar); - WebKit::WebScrollbarThemePainter painter(0, mockScrollbar.get()); + WebKit::WebScrollbarThemePainter painter; - Settings::setMockScrollbarsEnabled(true); { - OwnPtr<WebKit::WebScrollbar> scrollbar = WebKit::WebScrollbar::create(mockScrollbar.get()); + OwnPtr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create()); RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create(); RefPtr<LayerChromium> child1 = LayerChromium::create(); RefPtr<LayerChromium> child2 = ScrollbarLayerChromium::create(scrollbar.release(), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), child1->id()); @@ -120,7 +87,7 @@ TEST(ScrollbarLayerChromiumTest, resolveScrollLayerPointer) } { // another traverse order - OwnPtr<WebKit::WebScrollbar> scrollbar = WebKit::WebScrollbar::create(mockScrollbar.get()); + OwnPtr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create()); RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create(); RefPtr<LayerChromium> child2 = LayerChromium::create(); RefPtr<LayerChromium> child1 = ScrollbarLayerChromium::create(scrollbar.release(), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), child2->id()); @@ -141,12 +108,9 @@ TEST(ScrollbarLayerChromiumTest, scrollOffsetSynchronization) { DebugScopedSetImplThread impl; - RefPtr<MockScrollbar> mockScrollbar = adoptRef(new MockScrollbar); - WebKit::WebScrollbarThemePainter painter(0, mockScrollbar.get()); - - Settings::setMockScrollbarsEnabled(true); + WebKit::WebScrollbarThemePainter painter; - OwnPtr<WebKit::WebScrollbar> scrollbar = WebKit::WebScrollbar::create(mockScrollbar.get()); + OwnPtr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create()); RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create(); RefPtr<LayerChromium> contentLayer = LayerChromium::create(); RefPtr<LayerChromium> scrollbarLayer = ScrollbarLayerChromium::create(scrollbar.release(), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), layerTreeRoot->id()); diff --git a/Source/WebKit/chromium/tests/TextureCopierTest.cpp b/Source/WebKit/chromium/tests/TextureCopierTest.cpp index 432dd7c4a..c4bf63703 100644 --- a/Source/WebKit/chromium/tests/TextureCopierTest.cpp +++ b/Source/WebKit/chromium/tests/TextureCopierTest.cpp @@ -27,7 +27,7 @@ #include "TextureCopier.h" #include "FakeWebGraphicsContext3D.h" - +#include "GraphicsContext3D.h" #include <gmock/gmock.h> #include <gtest/gtest.h> #include <wtf/RefPtr.h> @@ -41,14 +41,13 @@ using testing::_; class MockContext : public FakeWebGraphicsContext3D { public: MOCK_METHOD2(bindFramebuffer, void(WGC3Denum, WebGLId)); - MOCK_METHOD3(texParameteri, void(GC3Denum target, GC3Denum pname, GC3Dint param)); + MOCK_METHOD3(texParameteri, void(WGC3Denum target, WGC3Denum pname, WGC3Dint param)); - MOCK_METHOD3(drawArrays, void(GC3Denum mode, GC3Dint first, GC3Dsizei count)); + MOCK_METHOD3(drawArrays, void(WGC3Denum mode, WGC3Dint first, WGC3Dsizei count)); }; TEST(TextureCopierTest, testDrawArraysCopy) { - GraphicsContext3D::Attributes attrs; OwnPtr<MockContext> mockContext = adoptPtr(new MockContext); { diff --git a/Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp index a4830e53f..72e0206ad 100644 --- a/Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp @@ -28,9 +28,9 @@ #include "CCLayerTreeHost.h" #include "FakeCCLayerTreeHostClient.h" +#include "WebCompositorInitializer.h" #include <gmock/gmock.h> #include <gtest/gtest.h> -#include <public/WebCompositor.h> using namespace WebCore; using ::testing::Mock; @@ -56,11 +56,15 @@ private: class TextureLayerChromiumTest : public testing::Test { +public: + TextureLayerChromiumTest() + : m_compositorInitializer(0) + { + } + protected: virtual void SetUp() { - // Initialize without threading support. - WebKit::WebCompositor::initialize(0); m_layerTreeHost = adoptPtr(new MockCCLayerTreeHost); } @@ -71,10 +75,11 @@ protected: m_layerTreeHost->setRootLayer(0); m_layerTreeHost.clear(); - WebKit::WebCompositor::shutdown(); } OwnPtr<MockCCLayerTreeHost> m_layerTreeHost; +private: + WebKitTests::WebCompositorInitializer m_compositorInitializer; }; TEST_F(TextureLayerChromiumTest, syncImplWhenChangingTextureId) diff --git a/Source/WebKit/chromium/tests/ThrottledTextureUploaderTest.cpp b/Source/WebKit/chromium/tests/ThrottledTextureUploaderTest.cpp index 3660c9412..8937f14ad 100644 --- a/Source/WebKit/chromium/tests/ThrottledTextureUploaderTest.cpp +++ b/Source/WebKit/chromium/tests/ThrottledTextureUploaderTest.cpp @@ -28,6 +28,7 @@ #include "Extensions3DChromium.h" #include "FakeWebGraphicsContext3D.h" +#include "GraphicsContext3D.h" #include <gmock/gmock.h> #include <gtest/gtest.h> @@ -64,7 +65,6 @@ private: TEST(ThrottledTextureUploaderTest, IsBusy) { - GraphicsContext3D::Attributes attrs; OwnPtr<FakeWebGraphicsContext3DWithQueryTesting> fakeContext(adoptPtr(new FakeWebGraphicsContext3DWithQueryTesting)); OwnPtr<ThrottledTextureUploader> uploader = ThrottledTextureUploader::create(fakeContext.get(), 2); diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index 00ee28a68..85821a8b3 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -28,7 +28,7 @@ #include "BitmapCanvasLayerTextureUpdater.h" #include "CCAnimationTestCommon.h" -#include "CCLayerTreeTestCommon.h" +#include "CCGeometryTestUtils.h" #include "CCOverdrawMetrics.h" #include "CCRenderingStats.h" #include "CCSingleThreadProxy.h" // For DebugScopedSetImplThread @@ -37,8 +37,8 @@ #include "FakeCCGraphicsContext.h" #include "FakeCCLayerTreeHostClient.h" #include "LayerPainterChromium.h" +#include "WebCompositorInitializer.h" #include <gtest/gtest.h> -#include <public/WebCompositor.h> #include <public/WebTransformationMatrix.h> using namespace WebCore; @@ -46,12 +46,6 @@ using namespace WebKitTests; using namespace WTF; using WebKit::WebTransformationMatrix; -#define EXPECT_EQ_RECT(a, b) \ - EXPECT_EQ(a.x(), b.x()); \ - EXPECT_EQ(a.y(), b.y()); \ - EXPECT_EQ(a.width(), b.width()); \ - EXPECT_EQ(a.height(), b.height()); - namespace { class TestCCOcclusionTracker : public CCOcclusionTracker { @@ -76,29 +70,72 @@ private: class TiledLayerChromiumTest : public testing::Test { public: TiledLayerChromiumTest() - : m_context(WebKit::createFakeCCGraphicsContext()) + : m_compositorInitializer(0) + , m_context(WebKit::createFakeCCGraphicsContext()) , m_textureManager(CCPrioritizedTextureManager::create(60*1024*1024, 1024, CCRenderer::ContentPool)) , m_occlusion(0) { - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; m_resourceProvider = CCResourceProvider::create(m_context.get()); } virtual ~TiledLayerChromiumTest() { - DebugScopedSetImplThread implThread; + textureManagerClearAllMemory(m_textureManager.get(), m_resourceProvider.get()); + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; m_resourceProvider.clear(); } + // Helper classes and functions that set the current thread to be the impl thread + // before doing the action that they wrap. + class ScopedFakeCCTiledLayerImpl { + public: + ScopedFakeCCTiledLayerImpl(int id) + { + DebugScopedSetImplThread implThread; + m_layerImpl = new FakeCCTiledLayerImpl(id); + } + ~ScopedFakeCCTiledLayerImpl() + { + DebugScopedSetImplThread implThread; + delete m_layerImpl; + } + FakeCCTiledLayerImpl* get() + { + return m_layerImpl; + } + FakeCCTiledLayerImpl* operator->() + { + return m_layerImpl; + } + private: + FakeCCTiledLayerImpl* m_layerImpl; + }; + void textureManagerClearAllMemory(CCPrioritizedTextureManager* textureManager, CCResourceProvider* resourceProvider) + { + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; + textureManager->clearAllMemory(resourceProvider); + } void updateTextures(int count = 500) { + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; CCTextureUpdateController::updateTextures(m_resourceProvider.get(), &m_copier, &m_uploader, &m_queue, count); } + void layerPushPropertiesTo(FakeTiledLayerChromium* layer, FakeCCTiledLayerImpl* layerImpl) + { + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; + layer->pushPropertiesTo(layerImpl); + } + void layerUpdate(FakeTiledLayerChromium* layer, TestCCOcclusionTracker* occluded) + { + DebugScopedSetMainThread mainThread; + layer->update(m_queue, occluded, m_stats); + } bool updateAndPush(FakeTiledLayerChromium* layer1, - CCLayerImpl* layerImpl1, + FakeCCTiledLayerImpl* layerImpl1, FakeTiledLayerChromium* layer2 = 0, - CCLayerImpl* layerImpl2 = 0) + FakeCCTiledLayerImpl* layerImpl2 = 0) { // Get textures m_textureManager->clearPriorities(); @@ -123,14 +160,15 @@ public: // Update textures and push. updateTextures(); if (layer1) - layer1->pushPropertiesTo(layerImpl1); + layerPushPropertiesTo(layer1, layerImpl1); if (layer2) - layer2->pushPropertiesTo(layerImpl2); + layerPushPropertiesTo(layer2, layerImpl2); return needsUpdate; } public: + WebKitTests::WebCompositorInitializer m_compositorInitializer; OwnPtr<CCGraphicsContext> m_context; OwnPtr<CCResourceProvider> m_resourceProvider; CCTextureUpdateQueue m_queue; @@ -145,8 +183,7 @@ public: TEST_F(TiledLayerChromiumTest, pushDirtyTiles) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); @@ -172,8 +209,7 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles) TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); TestCCOcclusionTracker occluded; m_occlusion = &occluded; @@ -209,8 +245,7 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) TEST_F(TiledLayerChromiumTest, pushDeletedTiles) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); @@ -223,11 +258,11 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); m_textureManager->clearPriorities(); - m_textureManager->clearAllMemory(m_resourceProvider.get()); + textureManagerClearAllMemory(m_textureManager.get(), m_resourceProvider.get()); m_textureManager->setMaxMemoryLimitBytes(4*1024*1024); // This should drop the tiles on the impl thread. - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); // We should now have no textures on the impl thread. EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); @@ -245,8 +280,7 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); // The tile size is 100x100. Setup 5x5 tiles with one visible tile in the center. // This paints 1 visible of the 25 invalid tiles. @@ -283,11 +317,10 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) { // Start with 2mb of memory, but the test is going to try to use just more than 1mb, so we reduce to 1mb later. m_textureManager->setMaxMemoryLimitBytes(2 * 1024 * 1024); - DebugScopedSetImplThread implThread; RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - OwnPtr<FakeCCTiledLayerImpl> layerImpl1(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl1(1); RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - OwnPtr<FakeCCTiledLayerImpl> layerImpl2(adoptPtr(new FakeCCTiledLayerImpl(2))); + ScopedFakeCCTiledLayerImpl layerImpl2(2); // For this test we have two layers. layer1 exhausts most texture memory, leaving room for 2 more tiles from // layer2, but not all three tiles. First we paint layer1, and one tile from layer2. Then when we idle paint @@ -337,8 +370,7 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); TestCCOcclusionTracker occluded; m_occlusion = &occluded; @@ -357,8 +389,7 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); // The tile size is 100x100, so this invalidates and then paints two tiles. // However, during the paint, we invalidate one of the tiles. This should @@ -377,9 +408,8 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) { RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layer1Impl(adoptPtr(new FakeCCTiledLayerImpl(1))); - OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2))); + ScopedFakeCCTiledLayerImpl layer1Impl(1); + ScopedFakeCCTiledLayerImpl layer2Impl(2); // Invalidate a tile on layer1, during update of layer 2. layer2->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get()); @@ -401,9 +431,8 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLay { RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layer1Impl(adoptPtr(new FakeCCTiledLayerImpl(1))); - OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2))); + ScopedFakeCCTiledLayerImpl layer1Impl(1); + ScopedFakeCCTiledLayerImpl layer2Impl(2); layer1->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get()); layer1->setBounds(IntSize(100, 200)); @@ -424,7 +453,6 @@ TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately) { // Create a CCLayerTreeHost that has the right viewportsize, // so the layer is considered small enough. - WebKit::WebCompositor::initialize(0); FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCLayerTreeSettings()); @@ -442,10 +470,9 @@ TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately) layerWidth *= 2; m_textureManager->setMaxMemoryLimitBytes(memoryForLayer); - DebugScopedSetImplThread implThread; RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); // Full size layer with half being visible. IntSize contentBounds(layerWidth, layerHeight); @@ -465,7 +492,7 @@ TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately) m_textureManager->prioritizeTextures(); layer->update(m_queue, 0, m_stats); updateTextures(); - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); // We should have all the tiles for the small animated layer. // We should still have the visible tiles when we didn't @@ -483,14 +510,12 @@ TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately) } } ccLayerTreeHost.clear(); - WebKit::WebCompositor::shutdown(); } TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); // We have enough memory for only the visible rect, so we will run out of memory in first idle paint. int memoryLimit = 4 * 100 * 100; // 1 tiles, 4 bytes per pixel. @@ -513,8 +538,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); bool animating[2] = {false, true}; for (int i = 0; i < 2; i++) { @@ -541,8 +565,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer) TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); // Alternate between not visible and visible. IntRect v(0, 0, 100, 100); @@ -572,8 +595,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers) TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); @@ -608,7 +630,6 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) // The updateRect (that indicates what was actually painted) should be in // layer space, not the content space. RefPtr<FakeTiledLayerWithScaledBounds> layer = adoptRef(new FakeTiledLayerWithScaledBounds(m_textureManager.get())); - DebugScopedSetImplThread implThread; IntRect layerBounds(0, 0, 300, 200); IntRect contentBounds(0, 0, 200, 250); @@ -647,8 +668,7 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); // Create a layer with one tile. layer->setBounds(IntSize(100, 100)); @@ -663,7 +683,7 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) m_textureManager->prioritizeTextures(); layer->update(m_queue, 0, m_stats); updateTextures(); - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); EXPECT_FALSE(layerImpl->hasTileAt(0, 1)); EXPECT_FALSE(layerImpl->hasTileAt(1, 0)); @@ -680,7 +700,7 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) m_textureManager->prioritizeTextures(); layer->update(m_queue, 0, m_stats); updateTextures(); - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); EXPECT_TRUE(layerImpl->hasTileAt(1, 0)); @@ -692,7 +712,7 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) layer->setTexturePriorities(m_priorityCalculator); m_textureManager->prioritizeTextures(); - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); EXPECT_FALSE(layerImpl->hasTileAt(0, 1)); EXPECT_FALSE(layerImpl->hasTileAt(1, 0)); @@ -701,8 +721,6 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset) { - // Initialize without threading support. - WebKit::WebCompositor::initialize(0); FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCLayerTreeSettings()); ASSERT_TRUE(ccLayerTreeHost->initializeRendererIfNeeded()); @@ -744,10 +762,9 @@ TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset) ccLayerTreeHost->updateLayers(m_queue, memoryLimit); EXPECT_FALSE(rootLayer->skipsDraw()); - ccLayerTreeHost->contentsTextureManager()->clearAllMemory(m_resourceProvider.get()); + textureManagerClearAllMemory(ccLayerTreeHost->contentsTextureManager(), m_resourceProvider.get()); ccLayerTreeHost->setRootLayer(0); ccLayerTreeHost.clear(); - WebKit::WebCompositor::shutdown(); } TEST_F(TiledLayerChromiumTest, resizeToSmaller) @@ -783,9 +800,6 @@ TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash) TEST_F(TiledLayerChromiumTest, partialUpdates) { - // Initialize without threading support. - WebKit::WebCompositor::initialize(0); - CCLayerTreeSettings settings; settings.maxPartialTextureUpdates = 4; @@ -809,8 +823,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) // Full update of all 6 tiles. ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); { - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); updateTextures(4); EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); EXPECT_TRUE(m_queue.hasMoreUpdates()); @@ -819,7 +832,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount()); EXPECT_FALSE(m_queue.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); } ccLayerTreeHost->commitComplete(); @@ -827,8 +840,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) layer->invalidateContentRect(IntRect(0, 0, 300, 150)); ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); { - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); updateTextures(4); EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount()); EXPECT_TRUE(m_queue.hasMoreUpdates()); @@ -837,15 +849,14 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount()); EXPECT_FALSE(m_queue.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); } ccLayerTreeHost->commitComplete(); // Partial update of 6 tiles. layer->invalidateContentRect(IntRect(50, 50, 200, 100)); { - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); updateTextures(4); EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount()); @@ -855,24 +866,22 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); EXPECT_FALSE(m_queue.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); } ccLayerTreeHost->commitComplete(); // Checkerboard all tiles. layer->invalidateContentRect(IntRect(0, 0, 300, 200)); { - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); - layer->pushPropertiesTo(layerImpl.get()); + ScopedFakeCCTiledLayerImpl layerImpl(1); + layerPushPropertiesTo(layer.get(), layerImpl.get()); } ccLayerTreeHost->commitComplete(); // Partial update of 6 checkerboard tiles. layer->invalidateContentRect(IntRect(50, 50, 200, 100)); { - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); updateTextures(4); EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); @@ -882,31 +891,26 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount()); EXPECT_FALSE(m_queue.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); } ccLayerTreeHost->commitComplete(); // Partial update of 4 tiles. layer->invalidateContentRect(IntRect(50, 50, 100, 100)); { - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); updateTextures(4); EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); EXPECT_FALSE(m_queue.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); } ccLayerTreeHost->commitComplete(); - { - DebugScopedSetImplThread implThread; - ccLayerTreeHost->contentsTextureManager()->clearAllMemory(m_resourceProvider.get()); - } + textureManagerClearAllMemory(ccLayerTreeHost->contentsTextureManager(), m_resourceProvider.get()); ccLayerTreeHost->setRootLayer(0); ccLayerTreeHost.clear(); - WebKit::WebCompositor::shutdown(); } TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion) @@ -1051,7 +1055,6 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) layer->update(m_queue, &occluded, m_stats); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); { - DebugScopedSetImplThread implThread; updateTextures(); } @@ -1178,7 +1181,6 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); TestCCOcclusionTracker occluded; - DebugScopedSetImplThread implThread; // The tile size is 100x100, so this invalidates and then paints two tiles in various ways. @@ -1215,7 +1217,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) layer->update(m_queue, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); - EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); + EXPECT_RECT_EQ(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); EXPECT_EQ(1u, opaqueContents.rects().size()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2, 1); @@ -1228,7 +1230,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) layer->update(m_queue, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); - EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); + EXPECT_RECT_EQ(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); EXPECT_EQ(1u, opaqueContents.rects().size()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2, 1); @@ -1243,7 +1245,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) layer->update(m_queue, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); - EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); + EXPECT_RECT_EQ(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); EXPECT_EQ(1u, opaqueContents.rects().size()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2 + 1, 1); @@ -1258,7 +1260,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) layer->update(m_queue, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); - EXPECT_EQ_RECT(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds()); + EXPECT_RECT_EQ(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds()); EXPECT_EQ(1u, opaqueContents.rects().size()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2 + 1 + 1, 1); @@ -1271,7 +1273,6 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); TestCCOcclusionTracker occluded; - DebugScopedSetImplThread implThread; // The tile size is 100x100, so this invalidates and then paints two tiles in various ways. @@ -1322,9 +1323,6 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) { - // Initialize without threading support. - WebKit::WebCompositor::initialize(0); - // Tile size is 100x100. IntRect rootRect(0, 0, 300, 200); IntRect childRect(0, 0, 300, 100); @@ -1373,7 +1371,6 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child2->invalidateContentRect(child2Rect); ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); { - DebugScopedSetImplThread implThread; updateTextures(1000); EXPECT_EQ(6, root->fakeLayerTextureUpdater()->updateCount()); EXPECT_EQ(3, child->fakeLayerTextureUpdater()->updateCount()); @@ -1384,12 +1381,12 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child->fakeLayerTextureUpdater()->clearUpdateCount(); child2->fakeLayerTextureUpdater()->clearUpdateCount(); - OwnPtr<FakeCCTiledLayerImpl> rootImpl(adoptPtr(new FakeCCTiledLayerImpl(root->id()))); - OwnPtr<FakeCCTiledLayerImpl> childImpl(adoptPtr(new FakeCCTiledLayerImpl(child->id()))); - OwnPtr<FakeCCTiledLayerImpl> child2Impl(adoptPtr(new FakeCCTiledLayerImpl(child2->id()))); - root->pushPropertiesTo(rootImpl.get()); - child->pushPropertiesTo(childImpl.get()); - child2->pushPropertiesTo(child2Impl.get()); + ScopedFakeCCTiledLayerImpl rootImpl(root->id()); + ScopedFakeCCTiledLayerImpl childImpl(child->id()); + ScopedFakeCCTiledLayerImpl child2Impl(child2->id()); + layerPushPropertiesTo(root.get(), rootImpl.get()); + layerPushPropertiesTo(child.get(), childImpl.get()); + layerPushPropertiesTo(child2.get(), child2Impl.get()); for (unsigned i = 0; i < 3; ++i) { for (unsigned j = 0; j < 2; ++j) @@ -1408,7 +1405,6 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child2->invalidateContentRect(child2Rect); ccLayerTreeHost->updateLayers(m_queue, (3 * 2 + 3 * 1) * (100 * 100) * 4); { - DebugScopedSetImplThread implThread; updateTextures(1000); EXPECT_EQ(6, root->fakeLayerTextureUpdater()->updateCount()); EXPECT_EQ(0, child->fakeLayerTextureUpdater()->updateCount()); @@ -1419,12 +1415,12 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child->fakeLayerTextureUpdater()->clearUpdateCount(); child2->fakeLayerTextureUpdater()->clearUpdateCount(); - OwnPtr<FakeCCTiledLayerImpl> rootImpl(adoptPtr(new FakeCCTiledLayerImpl(root->id()))); - OwnPtr<FakeCCTiledLayerImpl> childImpl(adoptPtr(new FakeCCTiledLayerImpl(child->id()))); - OwnPtr<FakeCCTiledLayerImpl> child2Impl(adoptPtr(new FakeCCTiledLayerImpl(child2->id()))); - root->pushPropertiesTo(rootImpl.get()); - child->pushPropertiesTo(childImpl.get()); - child2->pushPropertiesTo(child2Impl.get()); + ScopedFakeCCTiledLayerImpl rootImpl(root->id()); + ScopedFakeCCTiledLayerImpl childImpl(child->id()); + ScopedFakeCCTiledLayerImpl child2Impl(child2->id()); + layerPushPropertiesTo(root.get(), rootImpl.get()); + layerPushPropertiesTo(child.get(), childImpl.get()); + layerPushPropertiesTo(child2.get(), child2Impl.get()); for (unsigned i = 0; i < 3; ++i) { for (unsigned j = 0; j < 2; ++j) @@ -1444,7 +1440,6 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child2->invalidateContentRect(child2Rect); ccLayerTreeHost->updateLayers(m_queue, (3 * 1) * (100 * 100) * 4); { - DebugScopedSetImplThread implThread; updateTextures(1000); EXPECT_EQ(0, root->fakeLayerTextureUpdater()->updateCount()); EXPECT_EQ(0, child->fakeLayerTextureUpdater()->updateCount()); @@ -1455,12 +1450,12 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child->fakeLayerTextureUpdater()->clearUpdateCount(); child2->fakeLayerTextureUpdater()->clearUpdateCount(); - OwnPtr<FakeCCTiledLayerImpl> rootImpl(adoptPtr(new FakeCCTiledLayerImpl(root->id()))); - OwnPtr<FakeCCTiledLayerImpl> childImpl(adoptPtr(new FakeCCTiledLayerImpl(child->id()))); - OwnPtr<FakeCCTiledLayerImpl> child2Impl(adoptPtr(new FakeCCTiledLayerImpl(child2->id()))); - root->pushPropertiesTo(rootImpl.get()); - child->pushPropertiesTo(childImpl.get()); - child2->pushPropertiesTo(child2Impl.get()); + ScopedFakeCCTiledLayerImpl rootImpl(root->id()); + ScopedFakeCCTiledLayerImpl childImpl(child->id()); + ScopedFakeCCTiledLayerImpl child2Impl(child2->id()); + layerPushPropertiesTo(root.get(), rootImpl.get()); + layerPushPropertiesTo(child.get(), childImpl.get()); + layerPushPropertiesTo(child2.get(), child2Impl.get()); for (unsigned i = 0; i < 3; ++i) { for (unsigned j = 0; j < 2; ++j) @@ -1471,13 +1466,9 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca } ccLayerTreeHost->commitComplete(); - { - DebugScopedSetImplThread implThread; - ccLayerTreeHost->contentsTextureManager()->clearAllMemory(m_resourceProvider.get()); - } + textureManagerClearAllMemory(ccLayerTreeHost->contentsTextureManager(), m_resourceProvider.get()); ccLayerTreeHost->setRootLayer(0); ccLayerTreeHost.clear(); - WebKit::WebCompositor::shutdown(); } class TrackingLayerPainter : public LayerPainterChromium { @@ -1540,18 +1531,14 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) layer->update(m_queue, 0, m_stats); layer->trackingLayerPainter()->resetPaintedRect(); - EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); - - { - DebugScopedSetImplThread implThread; - updateTextures(); - } + EXPECT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); + updateTextures(); // Invalidate the entire layer in content space. When painting, the rect given to webkit should match the layer's bounds. layer->invalidateContentRect(contentRect); layer->update(m_queue, 0, m_stats); - EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); + EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation) @@ -1574,18 +1561,14 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvali layer->update(m_queue, 0, m_stats); layer->trackingLayerPainter()->resetPaintedRect(); - EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); - - { - DebugScopedSetImplThread implThread; - updateTextures(); - } + EXPECT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); + updateTextures(); // Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds. layer->setNeedsDisplayRect(layerRect); layer->update(m_queue, 0, m_stats); - EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); + EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } } // namespace diff --git a/Source/WebKit/chromium/tests/UniscribeHelperTest.cpp b/Source/WebKit/chromium/tests/UniscribeHelperTest.cpp index ec88f4332..fa965e936 100644 --- a/Source/WebKit/chromium/tests/UniscribeHelperTest.cpp +++ b/Source/WebKit/chromium/tests/UniscribeHelperTest.cpp @@ -32,8 +32,8 @@ #include <gtest/gtest.h> -#include "PlatformString.h" #include "UniscribeHelper.h" +#include <wtf/text/WTFString.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/public/WebTouchCandidatesInfo.h b/Source/WebKit/chromium/tests/WebCompositorInitializer.h index 65d4024a2..d0893aecd 100644 --- a/Source/WebKit/chromium/public/WebTouchCandidatesInfo.h +++ b/Source/WebKit/chromium/tests/WebCompositorInitializer.h @@ -4,51 +4,51 @@ * 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 + * 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 OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * 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. + * 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 WebTouchCandidatesInfo_h -#define WebTouchCandidatesInfo_h +#ifndef WebCompositorInitializer_h +#define WebCompositorInitializer_h -#include "platform/WebRect.h" +#include <public/Platform.h> +#include <public/WebCompositorSupport.h> +#include <wtf/Noncopyable.h> namespace WebKit { +class WebThread; +} -struct WebTouchCandidatesInfo { - // The number of possible touch receivers from the last touch. - int numberOfCandidates; - - // The bounds of the possible touch candidates. This will enclose the - // rects of any possible touch candidates for a press. - WebRect unitedBounds; +namespace WebKitTests { - // The smallest dimension (either width or height) of any of the - // available touch targets. - int smallestDimension; +class WebCompositorInitializer { + WTF_MAKE_NONCOPYABLE(WebCompositorInitializer); +public: + explicit WebCompositorInitializer(WebKit::WebThread* thread) + { + WebKit::Platform::current()->compositorSupport()->initialize(thread); + } - WebTouchCandidatesInfo() - : numberOfCandidates(0) - , smallestDimension(0) + ~WebCompositorInitializer() { + WebKit::Platform::current()->compositorSupport()->shutdown(); } }; -} // namespace WebKit +} -#endif +#endif // WebCompositorInitializer_h diff --git a/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp b/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp index 8313b0f5b..88927a988 100644 --- a/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp +++ b/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp @@ -27,51 +27,48 @@ #include "WebCompositorInputHandlerImpl.h" -#include "CCActiveGestureAnimation.h" -#include "CCInputHandler.h" -#include "CCSingleThreadProxy.h" +#include "WebCompositorInitializer.h" #include "WebCompositorInputHandlerClient.h" #include "WebInputEvent.h" +#include <gmock/gmock.h> +#include <gtest/gtest.h> #include <public/WebCompositor.h> #include <public/WebFloatPoint.h> +#include <public/WebInputHandler.h> +#include <public/WebInputHandlerClient.h> #include <public/WebPoint.h> - -#include <gmock/gmock.h> -#include <gtest/gtest.h> #include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> using namespace WebKit; namespace { -class MockCCInputHandlerClient : public WebCore::CCInputHandlerClient { - WTF_MAKE_NONCOPYABLE(MockCCInputHandlerClient); +class MockWebInputHandlerClient : public WebInputHandlerClient { + WTF_MAKE_NONCOPYABLE(MockWebInputHandlerClient); public: - MockCCInputHandlerClient() + MockWebInputHandlerClient() { } - virtual ~MockCCInputHandlerClient() { } + virtual ~MockWebInputHandlerClient() { } MOCK_METHOD0(pinchGestureBegin, void()); - MOCK_METHOD2(pinchGestureUpdate, void(float magnifyDelta, const WebCore::IntPoint& anchor)); + MOCK_METHOD2(pinchGestureUpdate, void(float magnifyDelta, WebPoint anchor)); MOCK_METHOD0(pinchGestureEnd, void()); MOCK_METHOD0(scheduleAnimation, void()); - MOCK_METHOD2(scrollBegin, ScrollStatus(const WebCore::IntPoint&, WebCore::CCInputHandlerClient::ScrollInputType)); - MOCK_METHOD2(scrollBy, void(const WebCore::IntPoint&, const WebCore::IntSize&)); + MOCK_METHOD2(scrollBegin, ScrollStatus(WebPoint, WebInputHandlerClient::ScrollInputType)); + MOCK_METHOD2(scrollBy, void(WebPoint, WebSize)); MOCK_METHOD0(scrollEnd, void()); private: - virtual void startPageScaleAnimation(const WebCore::IntSize& targetPosition, + virtual void startPageScaleAnimation(WebSize targetPosition, bool anchorPoint, float pageScale, double startTimeMs, double durationMs) OVERRIDE { } - - virtual WebCore::CCActiveGestureAnimation* activeGestureAnimation() OVERRIDE { return 0; } - virtual void setActiveGestureAnimation(PassOwnPtr<WebCore::CCActiveGestureAnimation>) OVERRIDE { } }; class MockWebCompositorInputHandlerClient : public WebCompositorInputHandlerClient { @@ -91,51 +88,14 @@ public: }; -TEST(WebCompositorInputHandlerImpl, fromIdentifier) -{ - WebCompositor::initialize(0); - WebCore::DebugScopedSetImplThread alwaysImplThread; - - // Before creating any WebCompositorInputHandlers, lookups for any value should fail and not crash. - EXPECT_EQ(0, WebCompositorInputHandler::fromIdentifier(2)); - EXPECT_EQ(0, WebCompositorInputHandler::fromIdentifier(0)); - EXPECT_EQ(0, WebCompositorInputHandler::fromIdentifier(-1)); - - int compositorIdentifier = -1; - { - OwnPtr<WebCompositorInputHandlerImpl> inputHandler = WebCompositorInputHandlerImpl::create(0); - compositorIdentifier = inputHandler->identifier(); - // The compositor we just created should be locatable. - EXPECT_EQ(inputHandler.get(), WebCompositorInputHandler::fromIdentifier(compositorIdentifier)); - - // But nothing else. - EXPECT_EQ(0, WebCompositorInputHandler::fromIdentifier(inputHandler->identifier() + 10)); - } - - // After the compositor is destroyed, its entry should be removed from the map. - EXPECT_EQ(0, WebCompositorInputHandler::fromIdentifier(compositorIdentifier)); - WebCompositor::shutdown(); -} - -class WebCompositorInitializer { -public: - WebCompositorInitializer() - { - WebCompositor::initialize(0); - } - - ~WebCompositorInitializer() - { - WebCompositor::shutdown(); - } -}; - class WebCompositorInputHandlerImplTest : public testing::Test { public: WebCompositorInputHandlerImplTest() - : m_expectedDisposition(DidHandle) + : m_initializer(0) + , m_expectedDisposition(DidHandle) { - m_inputHandler = WebCompositorInputHandlerImpl::create(&m_mockCCInputHandlerClient); + m_inputHandler = adoptPtr(new WebCompositorInputHandlerImpl); + m_inputHandler->bindToClient(&m_mockInputHandlerClient); m_inputHandler->setClient(&m_mockClient); } @@ -149,7 +109,7 @@ public: // out of gmock is the line number that set the expectation. #define VERIFY_AND_RESET_MOCKS() do \ { \ - testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient); \ + testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient); \ testing::Mock::VerifyAndClearExpectations(&m_mockClient); \ switch (m_expectedDisposition) { \ case DidHandle: \ @@ -173,12 +133,11 @@ public: } while (0) protected: - MockCCInputHandlerClient m_mockCCInputHandlerClient; + MockWebInputHandlerClient m_mockInputHandlerClient; OwnPtr<WebCompositorInputHandlerImpl> m_inputHandler; MockWebCompositorInputHandlerClient m_mockClient; WebGestureEvent gesture; - WebCore::DebugScopedSetImplThread alwaysImplThread; - WebCompositorInitializer initializer; + WebKitTests::WebCompositorInitializer m_initializer; enum ExpectedDisposition { DidHandle, DidNotHandle, DropEvent }; ExpectedDisposition m_expectedDisposition; @@ -191,8 +150,8 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureScrollStarted) m_expectedDisposition = DidHandle; VERIFY_AND_RESET_MOCKS(); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) - .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted)); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)) + .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusStarted)); gesture.type = WebInputEvent::GestureScrollBegin; m_inputHandler->handleInputEvent(gesture); @@ -200,15 +159,15 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureScrollStarted) VERIFY_AND_RESET_MOCKS(); gesture.type = WebInputEvent::GestureScrollUpdate; - gesture.deltaY = -40; // -Y means scroll down - i.e. in the +Y direction. - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_, testing::Property(&WebCore::IntSize::height, testing::Gt(0)))); + gesture.data.scrollUpdate.deltaY = -40; // -Y means scroll down - i.e. in the +Y direction. + EXPECT_CALL(m_mockInputHandlerClient, scrollBy(testing::_, testing::Field(&WebSize::height, testing::Gt(0)))); m_inputHandler->handleInputEvent(gesture); VERIFY_AND_RESET_MOCKS(); gesture.type = WebInputEvent::GestureScrollEnd; - gesture.deltaY = 0; - EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()); + gesture.data.scrollUpdate.deltaY = 0; + EXPECT_CALL(m_mockInputHandlerClient, scrollEnd()); m_inputHandler->handleInputEvent(gesture); } @@ -218,8 +177,8 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureScrollOnMainThread) m_expectedDisposition = DidNotHandle; VERIFY_AND_RESET_MOCKS(); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(::testing::_, ::testing::_)) - .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollOnMainThread)); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(::testing::_, ::testing::_)) + .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusOnMainThread)); gesture.type = WebInputEvent::GestureScrollBegin; m_inputHandler->handleInputEvent(gesture); @@ -227,13 +186,13 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureScrollOnMainThread) VERIFY_AND_RESET_MOCKS(); gesture.type = WebInputEvent::GestureScrollUpdate; - gesture.deltaY = 40; + gesture.data.scrollUpdate.deltaY = 40; m_inputHandler->handleInputEvent(gesture); VERIFY_AND_RESET_MOCKS(); gesture.type = WebInputEvent::GestureScrollEnd; - gesture.deltaY = 0; + gesture.data.scrollUpdate.deltaY = 0; m_inputHandler->handleInputEvent(gesture); } @@ -246,8 +205,8 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureScrollIgnored) m_expectedDisposition = DropEvent; VERIFY_AND_RESET_MOCKS(); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) - .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollIgnored)); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)) + .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusIgnored)); gesture.type = WebInputEvent::GestureScrollBegin; m_inputHandler->handleInputEvent(gesture); @@ -260,31 +219,31 @@ TEST_F(WebCompositorInputHandlerImplTest, gesturePinch) VERIFY_AND_RESET_MOCKS(); gesture.type = WebInputEvent::GesturePinchBegin; - EXPECT_CALL(m_mockCCInputHandlerClient, pinchGestureBegin()); + EXPECT_CALL(m_mockInputHandlerClient, pinchGestureBegin()); m_inputHandler->handleInputEvent(gesture); VERIFY_AND_RESET_MOCKS(); gesture.type = WebInputEvent::GesturePinchUpdate; - gesture.deltaX = 1.5; + gesture.data.pinchUpdate.scale = 1.5; gesture.x = 7; gesture.y = 13; - EXPECT_CALL(m_mockCCInputHandlerClient, pinchGestureUpdate(1.5, WebCore::IntPoint(7, 13))); + EXPECT_CALL(m_mockInputHandlerClient, pinchGestureUpdate(1.5, WebPoint(7, 13))); m_inputHandler->handleInputEvent(gesture); VERIFY_AND_RESET_MOCKS(); gesture.type = WebInputEvent::GesturePinchUpdate; - gesture.deltaX = 0.5; + gesture.data.pinchUpdate.scale = 0.5; gesture.x = 9; gesture.y = 6; - EXPECT_CALL(m_mockCCInputHandlerClient, pinchGestureUpdate(.5, WebCore::IntPoint(9, 6))); + EXPECT_CALL(m_mockInputHandlerClient, pinchGestureUpdate(.5, WebPoint(9, 6))); m_inputHandler->handleInputEvent(gesture); VERIFY_AND_RESET_MOCKS(); gesture.type = WebInputEvent::GesturePinchEnd; - EXPECT_CALL(m_mockCCInputHandlerClient, pinchGestureEnd()); + EXPECT_CALL(m_mockInputHandlerClient, pinchGestureEnd()); m_inputHandler->handleInputEvent(gesture); } @@ -294,12 +253,12 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingStarted) m_expectedDisposition = DidHandle; VERIFY_AND_RESET_MOCKS(); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) - .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted)); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)) + .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusStarted)); gesture.type = WebInputEvent::GestureFlingStart; - gesture.deltaX = 10; - EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); + gesture.data.flingStart.velocityX = 10; + EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation()); m_inputHandler->handleInputEvent(gesture); VERIFY_AND_RESET_MOCKS(); @@ -315,8 +274,8 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingFailed) m_expectedDisposition = DidNotHandle; VERIFY_AND_RESET_MOCKS(); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) - .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollOnMainThread)); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)) + .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusOnMainThread)); gesture.type = WebInputEvent::GestureFlingStart; m_inputHandler->handleInputEvent(gesture); @@ -333,8 +292,8 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingIgnored) m_expectedDisposition = DidNotHandle; VERIFY_AND_RESET_MOCKS(); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) - .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollIgnored)); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)) + .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusIgnored)); gesture.type = WebInputEvent::GestureFlingStart; m_inputHandler->handleInputEvent(gesture); @@ -359,47 +318,47 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingAnimates) WebPoint flingPoint = WebPoint(7, 13); WebPoint flingGlobalPoint = WebPoint(17, 23); int modifiers = 7; - gesture.deltaX = flingDelta.x; - gesture.deltaY = flingDelta.y; + gesture.data.flingStart.velocityX = flingDelta.x; + gesture.data.flingStart.velocityY = flingDelta.y; gesture.x = flingPoint.x; gesture.y = flingPoint.y; gesture.globalX = flingGlobalPoint.x; gesture.globalY = flingGlobalPoint.y; gesture.modifiers = modifiers; - EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) - .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted)); + EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation()); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)) + .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusStarted)); m_inputHandler->handleInputEvent(gesture); - testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient); + testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient); // The first animate call should let us pick up an animation start time, but we // shouldn't actually move anywhere just yet. The first frame after the fling start // will typically include the last scroll from the gesture that lead to the scroll // (either wheel or gesture scroll), so there should be no visible hitch. - EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)).Times(0); + EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation()); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)).Times(0); m_inputHandler->animate(10); - testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient); + testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient); // The second call should start scrolling in the -X direction. - EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) - .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted)); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_, testing::Property(&WebCore::IntSize::width, testing::Lt(0)))); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()); + EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation()); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)) + .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusStarted)); + EXPECT_CALL(m_mockInputHandlerClient, scrollBy(testing::_, testing::Field(&WebSize::width, testing::Lt(0)))); + EXPECT_CALL(m_mockInputHandlerClient, scrollEnd()); m_inputHandler->animate(10.1); - testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient); + testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient); // Let's say on the third call we hit a non-scrollable region. We should abort the fling and not scroll. // We also should pass the current fling parameters out to the client so the rest of the fling can be // transferred to the main thread. - EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) - .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollOnMainThread)); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_, testing::_)).Times(0); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()).Times(0); + EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation()); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)) + .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusOnMainThread)); + EXPECT_CALL(m_mockInputHandlerClient, scrollBy(testing::_, testing::_)).Times(0); + EXPECT_CALL(m_mockInputHandlerClient, scrollEnd()).Times(0); // Expected wheel fling animation parameters: // *) flingDelta and flingPoint should match the original GestureFlingStart event @@ -415,13 +374,13 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingAnimates) testing::Field(&WebSize::width, testing::Gt(0)))))); m_inputHandler->animate(10.2); - testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient); + testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient); testing::Mock::VerifyAndClearExpectations(&m_mockClient); // Since we've aborted the fling, the next animation should be a no-op and should not result in another // frame being requested. - EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()).Times(0); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)).Times(0); + EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation()).Times(0); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)).Times(0); m_inputHandler->animate(10.3); // Since we've transferred the fling to the main thread, we need to pass the next GestureFlingCancel to the main @@ -443,45 +402,45 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingTransferResets) WebPoint flingPoint = WebPoint(7, 13); WebPoint flingGlobalPoint = WebPoint(17, 23); int modifiers = 1; - gesture.deltaX = flingDelta.x; - gesture.deltaY = flingDelta.y; + gesture.data.flingStart.velocityX = flingDelta.x; + gesture.data.flingStart.velocityY = flingDelta.y; gesture.x = flingPoint.x; gesture.y = flingPoint.y; gesture.globalX = flingGlobalPoint.x; gesture.globalY = flingGlobalPoint.y; gesture.modifiers = modifiers; - EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) - .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted)); + EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation()); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)) + .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusStarted)); m_inputHandler->handleInputEvent(gesture); - testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient); + testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient); // Start the fling animation at time 10. This shouldn't actually scroll, just establish a start time. - EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)).Times(0); + EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation()); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)).Times(0); m_inputHandler->animate(10); - testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient); + testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient); // The second call should start scrolling in the -X direction. - EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) - .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted)); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_, testing::Property(&WebCore::IntSize::width, testing::Lt(0)))); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()); + EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation()); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)) + .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusStarted)); + EXPECT_CALL(m_mockInputHandlerClient, scrollBy(testing::_, testing::Field(&WebSize::width, testing::Lt(0)))); + EXPECT_CALL(m_mockInputHandlerClient, scrollEnd()); m_inputHandler->animate(10.1); - testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient); + testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient); // Let's say on the third call we hit a non-scrollable region. We should abort the fling and not scroll. // We also should pass the current fling parameters out to the client so the rest of the fling can be // transferred to the main thread. - EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) - .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollOnMainThread)); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_, testing::_)).Times(0); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()).Times(0); + EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation()); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)) + .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusOnMainThread)); + EXPECT_CALL(m_mockInputHandlerClient, scrollBy(testing::_, testing::_)).Times(0); + EXPECT_CALL(m_mockInputHandlerClient, scrollEnd()).Times(0); // Expected wheel fling animation parameters: // *) flingDelta and flingPoint should match the original GestureFlingStart event @@ -497,16 +456,16 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingTransferResets) testing::Field(&WebSize::width, testing::Gt(0)))))); m_inputHandler->animate(10.2); - testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient); + testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient); testing::Mock::VerifyAndClearExpectations(&m_mockClient); // Since we've aborted the fling, the next animation should be a no-op and should not result in another // frame being requested. - EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()).Times(0); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)).Times(0); + EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation()).Times(0); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)).Times(0); m_inputHandler->animate(10.3); - testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient); + testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient); // Since we've transferred the fling to the main thread, we need to pass the next GestureFlingCancel to the main // thread as well. @@ -522,43 +481,43 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingTransferResets) flingPoint = WebPoint(95, 87); flingGlobalPoint = WebPoint(32, 71); modifiers = 2; - gesture.deltaX = flingDelta.x; - gesture.deltaY = flingDelta.y; + gesture.data.flingStart.velocityX = flingDelta.x; + gesture.data.flingStart.velocityY = flingDelta.y; gesture.x = flingPoint.x; gesture.y = flingPoint.y; gesture.globalX = flingGlobalPoint.x; gesture.globalY = flingGlobalPoint.y; gesture.modifiers = modifiers; - EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) - .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted)); + EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation()); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)) + .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusStarted)); m_inputHandler->handleInputEvent(gesture); - testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient); + testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient); // Start the second fling animation at time 30. - EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)).Times(0); + EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation()); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)).Times(0); m_inputHandler->animate(30); - testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient); + testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient); // Tick the second fling once normally. - EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) - .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted)); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_, testing::Property(&WebCore::IntSize::height, testing::Gt(0)))); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()); + EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation()); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)) + .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusStarted)); + EXPECT_CALL(m_mockInputHandlerClient, scrollBy(testing::_, testing::Field(&WebSize::height, testing::Gt(0)))); + EXPECT_CALL(m_mockInputHandlerClient, scrollEnd()); m_inputHandler->animate(30.1); - testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient); + testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient); // Then abort the second fling. - EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) - .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollOnMainThread)); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_, testing::_)).Times(0); - EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()).Times(0); + EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation()); + EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_)) + .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusOnMainThread)); + EXPECT_CALL(m_mockInputHandlerClient, scrollBy(testing::_, testing::_)).Times(0); + EXPECT_CALL(m_mockInputHandlerClient, scrollEnd()).Times(0); // We should get parameters from the second fling, nothing from the first fling should "leak". EXPECT_CALL(m_mockClient, transferActiveWheelFlingAnimation(testing::AllOf( @@ -573,3 +532,4 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingTransferResets) } } + diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp index 03c201e16..4328a0e4a 100644 --- a/Source/WebKit/chromium/tests/WebFrameTest.cpp +++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp @@ -45,6 +45,7 @@ #include "WebFormElement.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" +#include "WebHistoryItem.h" #include "WebRange.h" #include "WebScriptSource.h" #include "WebSearchableFormData.h" @@ -54,6 +55,7 @@ #include "WebViewClient.h" #include "WebViewImpl.h" #include "platform/WebFloatRect.h" +#include "platform/WebURLResponse.h" #include "v8.h" #include <gtest/gtest.h> #include <webkit/support/webkit_support.h> @@ -988,10 +990,11 @@ TEST_F(WebFrameTest, FindInPageMatchRects) webView->close(); } -static WebView* selectRangeTestCreateWebView(const std::string& url) +static WebView* createWebViewForTextSelection(const std::string& url) { WebView* webView = FrameTestHelpers::createWebViewAndLoad(url, true); webView->settings()->setDefaultFontSize(12); + webView->enableFixedLayoutMode(false); webView->resize(WebSize(640, 480)); return webView; } @@ -1010,6 +1013,11 @@ static WebPoint bottomRightMinusOne(const WebRect& rect) return WebPoint(rect.x + rect.width - 1, rect.y + rect.height - 1); } +static WebRect elementBounds(WebFrame* frame, const WebString& id) +{ + return frame->document().getElementById(id).boundsInViewportSpace(); +} + static std::string selectionAsString(WebFrame* frame) { return std::string(frame->selectionAsText().utf8().data()); @@ -1027,7 +1035,7 @@ TEST_F(WebFrameTest, SelectRange) registerMockedHttpURLLoad("select_range_iframe.html"); registerMockedHttpURLLoad("select_range_editable.html"); - webView = selectRangeTestCreateWebView(m_baseURL + "select_range_basic.html"); + webView = createWebViewForTextSelection(m_baseURL + "select_range_basic.html"); frame = webView->mainFrame(); EXPECT_EQ("Some test text for testing.", selectionAsString(frame)); webView->selectionBounds(startWebRect, endWebRect); @@ -1037,7 +1045,7 @@ TEST_F(WebFrameTest, SelectRange) EXPECT_EQ("Some test text for testing.", selectionAsString(frame)); webView->close(); - webView = selectRangeTestCreateWebView(m_baseURL + "select_range_scroll.html"); + webView = createWebViewForTextSelection(m_baseURL + "select_range_scroll.html"); frame = webView->mainFrame(); EXPECT_EQ("Some offscreen test text for testing.", selectionAsString(frame)); webView->selectionBounds(startWebRect, endWebRect); @@ -1047,7 +1055,7 @@ TEST_F(WebFrameTest, SelectRange) EXPECT_EQ("Some offscreen test text for testing.", selectionAsString(frame)); webView->close(); - webView = selectRangeTestCreateWebView(m_baseURL + "select_range_iframe.html"); + webView = createWebViewForTextSelection(m_baseURL + "select_range_iframe.html"); frame = webView->mainFrame(); WebFrame* subframe = frame->findChildByExpression(WebString::fromUTF8("/html/body/iframe")); EXPECT_EQ("Some test text for testing.", selectionAsString(subframe)); @@ -1060,7 +1068,7 @@ TEST_F(WebFrameTest, SelectRange) // Select the middle of an editable element, then try to extend the selection to the top of the document. // The selection range should be clipped to the bounds of the editable element. - webView = selectRangeTestCreateWebView(m_baseURL + "select_range_editable.html"); + webView = createWebViewForTextSelection(m_baseURL + "select_range_editable.html"); frame = webView->mainFrame(); EXPECT_EQ("This text is initially selected.", selectionAsString(frame)); webView->selectionBounds(startWebRect, endWebRect); @@ -1069,7 +1077,7 @@ TEST_F(WebFrameTest, SelectRange) webView->close(); // As above, but extending the selection to the bottom of the document. - webView = selectRangeTestCreateWebView(m_baseURL + "select_range_editable.html"); + webView = createWebViewForTextSelection(m_baseURL + "select_range_editable.html"); frame = webView->mainFrame(); EXPECT_EQ("This text is initially selected.", selectionAsString(frame)); webView->selectionBounds(startWebRect, endWebRect); @@ -1078,4 +1086,302 @@ TEST_F(WebFrameTest, SelectRange) webView->close(); } +TEST_F(WebFrameTest, MoveSelectionStart) +{ + registerMockedHttpURLLoad("text_selection.html"); + WebView* webView = createWebViewForTextSelection(m_baseURL + "text_selection.html"); + WebFrame* frame = webView->mainFrame(); + + // moveSelectionStart() always returns false if there's no selection. + EXPECT_FALSE(frame->moveSelectionStart(topLeft(elementBounds(frame, "header_1")), false)); + EXPECT_FALSE(frame->moveSelectionStart(topLeft(elementBounds(frame, "header_1")), true)); + + frame->executeScript(WebScriptSource("selectElement('header_1');")); + EXPECT_EQ("Header 1.", selectionAsString(frame)); + EXPECT_TRUE(frame->moveSelectionEnd(bottomRightMinusOne(elementBounds(frame, "header_2")), false)); + EXPECT_EQ("Header 1. Header 2.", selectionAsString(frame)); + + // Select second span. We can move the start to include the first span. + frame->executeScript(WebScriptSource("selectElement('header_2');")); + EXPECT_EQ("Header 2.", selectionAsString(frame)); + EXPECT_TRUE(frame->moveSelectionStart(topLeft(elementBounds(frame, "header_1")), false)); + EXPECT_EQ("Header 1. Header 2.", selectionAsString(frame)); + + // If allowCollapsedSelection=false we can't move the selection start beyond the current end. + // We end up with a single character selected. + frame->executeScript(WebScriptSource("selectElement('header_1');")); + EXPECT_EQ("Header 1.", selectionAsString(frame)); + EXPECT_TRUE(frame->moveSelectionStart(bottomRightMinusOne(elementBounds(frame, "header_1")), false)); + EXPECT_EQ(".", selectionAsString(frame)); + + // If allowCollapsedSelection=true we can move the start and end together. + frame->executeScript(WebScriptSource("selectElement('header_1');")); + EXPECT_EQ("Header 1.", selectionAsString(frame)); + EXPECT_TRUE(frame->moveSelectionStart(bottomRightMinusOne(elementBounds(frame, "header_1")), true)); + EXPECT_EQ("", selectionAsString(frame)); + // Selection is a caret, not empty. + EXPECT_FALSE(frame->selectionRange().isNull()); + EXPECT_TRUE(frame->moveSelectionStart(topLeft(elementBounds(frame, "header_1")), true)); + EXPECT_EQ("Header 1.", selectionAsString(frame)); + + // If allowCollapsedSelection=true we can move the start across the end. + frame->executeScript(WebScriptSource("selectElement('header_1');")); + EXPECT_EQ("Header 1.", selectionAsString(frame)); + EXPECT_TRUE(frame->moveSelectionStart(bottomRightMinusOne(elementBounds(frame, "header_2")), true)); + EXPECT_EQ(" Header 2.", selectionAsString(frame)); + + // Can't extend the selection part-way into an editable element. + frame->executeScript(WebScriptSource("selectElement('footer_2');")); + EXPECT_EQ("Footer 2.", selectionAsString(frame)); + EXPECT_TRUE(frame->moveSelectionStart(topLeft(elementBounds(frame, "editable_2")), true)); + EXPECT_EQ(" [ Footer 1. Footer 2.", selectionAsString(frame)); + + // Can extend the selection completely across editable elements. + frame->executeScript(WebScriptSource("selectElement('footer_2');")); + EXPECT_EQ("Footer 2.", selectionAsString(frame)); + EXPECT_TRUE(frame->moveSelectionStart(topLeft(elementBounds(frame, "header_2")), true)); + EXPECT_EQ("Header 2. ] [ Editable 1. Editable 2. ] [ Footer 1. Footer 2.", selectionAsString(frame)); + + // If the selection is editable text, we can't extend it into non-editable text. + frame->executeScript(WebScriptSource("selectElement('editable_2');")); + EXPECT_EQ("Editable 2.", selectionAsString(frame)); + EXPECT_TRUE(frame->moveSelectionStart(topLeft(elementBounds(frame, "header_2")), true)); + EXPECT_EQ("[ Editable 1. Editable 2.", selectionAsString(frame)); + + webView->close(); +} + +TEST_F(WebFrameTest, MoveSelectionEnd) +{ + registerMockedHttpURLLoad("text_selection.html"); + WebView* webView = createWebViewForTextSelection(m_baseURL + "text_selection.html"); + WebFrame* frame = webView->mainFrame(); + + // moveSelectionEnd() always returns false if there's no selection. + EXPECT_FALSE(frame->moveSelectionEnd(topLeft(elementBounds(frame, "header_1")), false)); + EXPECT_FALSE(frame->moveSelectionEnd(topLeft(elementBounds(frame, "header_1")), true)); + + // Select first span. We can move the end to include the second span. + frame->executeScript(WebScriptSource("selectElement('header_1');")); + EXPECT_EQ("Header 1.", selectionAsString(frame)); + EXPECT_TRUE(frame->moveSelectionEnd(bottomRightMinusOne(elementBounds(frame, "header_2")), false)); + EXPECT_EQ("Header 1. Header 2.", selectionAsString(frame)); + + // If allowCollapsedSelection=false we can't move the selection end beyond the current start. + // We end up with a single character selected. + frame->executeScript(WebScriptSource("selectElement('header_2');")); + EXPECT_EQ("Header 2.", selectionAsString(frame)); + EXPECT_TRUE(frame->moveSelectionEnd(topLeft(elementBounds(frame, "header_2")), false)); + EXPECT_EQ("H", selectionAsString(frame)); + + // If allowCollapsedSelection=true we can move the start and end together. + frame->executeScript(WebScriptSource("selectElement('header_2');")); + EXPECT_EQ("Header 2.", selectionAsString(frame)); + EXPECT_TRUE(frame->moveSelectionEnd(topLeft(elementBounds(frame, "header_2")), true)); + EXPECT_EQ("", selectionAsString(frame)); + // Selection is a caret, not empty. + EXPECT_FALSE(frame->selectionRange().isNull()); + EXPECT_TRUE(frame->moveSelectionEnd(bottomRightMinusOne(elementBounds(frame, "header_2")), true)); + EXPECT_EQ("Header 2.", selectionAsString(frame)); + + // If allowCollapsedSelection=true we can move the end across the start. + frame->executeScript(WebScriptSource("selectElement('header_2');")); + EXPECT_EQ("Header 2.", selectionAsString(frame)); + EXPECT_TRUE(frame->moveSelectionEnd(topLeft(elementBounds(frame, "header_1")), true)); + EXPECT_EQ("Header 1. ", selectionAsString(frame)); + + // Can't extend the selection part-way into an editable element. + frame->executeScript(WebScriptSource("selectElement('header_1');")); + EXPECT_EQ("Header 1.", selectionAsString(frame)); + EXPECT_TRUE(frame->moveSelectionEnd(bottomRightMinusOne(elementBounds(frame, "editable_1")), true)); + EXPECT_EQ("Header 1. Header 2. ] ", selectionAsString(frame)); + + // Can extend the selection completely across editable elements. + frame->executeScript(WebScriptSource("selectElement('header_1');")); + EXPECT_EQ("Header 1.", selectionAsString(frame)); + EXPECT_TRUE(frame->moveSelectionEnd(bottomRightMinusOne(elementBounds(frame, "footer_1")), true)); + EXPECT_EQ("Header 1. Header 2. ] [ Editable 1. Editable 2. ] [ Footer 1.", selectionAsString(frame)); + + // If the selection is editable text, we can't extend it into non-editable text. + frame->executeScript(WebScriptSource("selectElement('editable_1');")); + EXPECT_EQ("Editable 1.", selectionAsString(frame)); + EXPECT_TRUE(frame->moveSelectionEnd(bottomRightMinusOne(elementBounds(frame, "footer_1")), true)); + EXPECT_EQ("Editable 1. Editable 2. ]", selectionAsString(frame)); + + webView->close(); +} + +TEST_F(WebFrameTest, MoveCaret) +{ + registerMockedHttpURLLoad("text_selection.html"); + WebView* webView = createWebViewForTextSelection(m_baseURL + "text_selection.html"); + WebFrame* frame = webView->mainFrame(); + + // moveCaret() returns false if there's no selection, or if it isn't editable. + EXPECT_FALSE(frame->moveCaret(topLeft(elementBounds(frame, "editable")))); + frame->executeScript(WebScriptSource("selectElement('header_1');")); + EXPECT_EQ("Header 1.", selectionAsString(frame)); + EXPECT_FALSE(frame->moveCaret(topLeft(elementBounds(frame, "editable")))); + + // Select the editable text span. Now moveCaret() works. + frame->executeScript(WebScriptSource("selectElement('editable_1');")); + EXPECT_EQ("Editable 1.", selectionAsString(frame)); + + EXPECT_TRUE(frame->moveCaret(topLeft(elementBounds(frame, "editable_1")))); + EXPECT_EQ("", selectionAsString(frame)); + EXPECT_FALSE(frame->selectionRange().isNull()); + EXPECT_TRUE(frame->moveSelectionEnd(bottomRightMinusOne(elementBounds(frame, "editable_1")), false)); + EXPECT_EQ("Editable 1.", selectionAsString(frame)); + + EXPECT_TRUE(frame->moveCaret(bottomRightMinusOne(elementBounds(frame, "editable_2")))); + EXPECT_EQ("", selectionAsString(frame)); + EXPECT_FALSE(frame->selectionRange().isNull()); + EXPECT_TRUE(frame->moveSelectionStart(topLeft(elementBounds(frame, "editable_2")), false)); + EXPECT_EQ("Editable 2.", selectionAsString(frame)); + + // Caret is pinned at the start of the editable region. + EXPECT_TRUE(frame->moveCaret(topLeft(elementBounds(frame, "header_1")))); + EXPECT_EQ("", selectionAsString(frame)); + EXPECT_FALSE(frame->selectionRange().isNull()); + EXPECT_TRUE(frame->moveSelectionEnd(bottomRightMinusOne(elementBounds(frame, "editable_1")), false)); + EXPECT_EQ("[ Editable 1.", selectionAsString(frame)); + + // Caret is pinned at the end of the editable region. + EXPECT_TRUE(frame->moveCaret(bottomRightMinusOne(elementBounds(frame, "footer_2")))); + EXPECT_EQ("", selectionAsString(frame)); + EXPECT_FALSE(frame->selectionRange().isNull()); + EXPECT_TRUE(frame->moveSelectionStart(topLeft(elementBounds(frame, "editable_2")), false)); + EXPECT_EQ("Editable 2. ]", selectionAsString(frame)); + + webView->close(); +} + +class DisambiguationPopupTestWebViewClient : public WebViewClient { +public: + virtual bool didTapMultipleTargets(const WebGestureEvent&, const WebVector<WebRect>& targetRects) OVERRIDE + { + EXPECT_GE(targetRects.size(), 2u); + m_triggered = true; + return true; + } + + bool triggered() const { return m_triggered; } + void resetTriggered() { m_triggered = false; } + bool m_triggered; +}; + +static WebGestureEvent fatTap(int x, int y) +{ + WebGestureEvent event; + event.type = WebInputEvent::GestureTap; + event.x = x; + event.y = y; + event.data.tap.width = 50; + event.data.tap.height = 50; + return event; +} + +TEST_F(WebFrameTest, DisambiguationPopupTest) +{ + registerMockedHttpURLLoad("disambiguation_popup.html"); + + DisambiguationPopupTestWebViewClient client; + + // Make sure we initialize to minimum scale, even if the window size + // only becomes available after the load begins. + WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "disambiguation_popup.html", true, 0, &client)); + webViewImpl->resize(WebSize(1000, 1000)); + webViewImpl->layout(); + + client.resetTriggered(); + webViewImpl->handleInputEvent(fatTap(0, 0)); + EXPECT_FALSE(client.triggered()); + + client.resetTriggered(); + webViewImpl->handleInputEvent(fatTap(200, 115)); + EXPECT_FALSE(client.triggered()); + + for (int i = 0; i <= 46; i++) { + client.resetTriggered(); + webViewImpl->handleInputEvent(fatTap(120, 230 + i * 5)); + + int j = i % 10; + if (j >= 7 && j <= 9) + EXPECT_TRUE(client.triggered()); + else + EXPECT_FALSE(client.triggered()); + } + + for (int i = 0; i <= 46; i++) { + client.resetTriggered(); + webViewImpl->handleInputEvent(fatTap(10 + i * 5, 590)); + + int j = i % 10; + if (j >= 7 && j <= 9) + EXPECT_TRUE(client.triggered()); + else + EXPECT_FALSE(client.triggered()); + } + +} + +class TestSubstituteDataWebFrameClient : public WebFrameClient { +public: + TestSubstituteDataWebFrameClient() + : m_commitCalled(false) + { + } + + virtual void didFailProvisionalLoad(WebFrame* frame, const WebURLError& error) + { + frame->loadHTMLString("This should appear", toKURL("data:text/html,chromewebdata"), error.unreachableURL, true); + webkit_support::RunAllPendingMessages(); + } + + virtual void didCommitProvisionalLoad(WebFrame* frame, bool) + { + if (frame->dataSource()->response().url() != WebURL(URLTestHelpers::toKURL("about:blank"))) + m_commitCalled = true; + } + + bool commitCalled() const { return m_commitCalled; } + +private: + bool m_commitCalled; +}; + +TEST_F(WebFrameTest, ReplaceNavigationAfterHistoryNavigation) +{ + TestSubstituteDataWebFrameClient webFrameClient; + + WebView* webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true, &webFrameClient); + webkit_support::RunAllPendingMessages(); + WebFrame* frame = webView->mainFrame(); + + // Load a url as a history navigation that will return an error. TestSubstituteDataWebFrameClient + // will start a SubstituteData load in response to the load failure, which should get fully committed. + // Due to https://bugs.webkit.org/show_bug.cgi?id=91685, FrameLoader::didReceiveData() wasn't getting + // called in this case, which resulted in the SubstituteData document not getting displayed. + WebURLError error; + error.reason = 1337; + error.domain = "WebFrameTest"; + std::string errorURL = "http://0.0.0.0"; + WebURLResponse response; + response.initialize(); + response.setURL(URLTestHelpers::toKURL(errorURL)); + response.setMIMEType("text/html"); + response.setHTTPStatusCode(500); + WebHistoryItem errorHistoryItem; + errorHistoryItem.initialize(); + errorHistoryItem.setURLString(WebString::fromUTF8(errorURL.c_str(), errorURL.length())); + errorHistoryItem.setOriginalURLString(WebString::fromUTF8(errorURL.c_str(), errorURL.length())); + webkit_support::RegisterMockedErrorURL(URLTestHelpers::toKURL(errorURL), response, error); + frame->loadHistoryItem(errorHistoryItem); + webkit_support::ServeAsynchronousMockedRequests(); + + WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); + EXPECT_EQ("This should appear", std::string(text.utf8().data())); + EXPECT_TRUE(webFrameClient.commitCalled()); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/WebInputEventConversionTest.cpp b/Source/WebKit/chromium/tests/WebInputEventConversionTest.cpp new file mode 100644 index 000000000..1df76dc7c --- /dev/null +++ b/Source/WebKit/chromium/tests/WebInputEventConversionTest.cpp @@ -0,0 +1,75 @@ +/* + * 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 "WebInputEventConversion.h" + +#include "KeyboardEvent.h" +#include <gtest/gtest.h> + +using WebKit::WebInputEvent; +using WebKit::WebKeyboardEvent; +using WebKit::WebKeyboardEventBuilder; + +namespace { + +PassRefPtr<WebCore::KeyboardEvent> createKeyboardEventWithLocation(WebCore::KeyboardEvent::KeyLocationCode location) +{ + return WebCore::KeyboardEvent::create("keydown", true, true, 0, "", location, false, false, false, false, false); +} + +int getModifiersForKeyLocationCode(WebCore::KeyboardEvent::KeyLocationCode location) +{ + RefPtr<WebCore::KeyboardEvent> event = createKeyboardEventWithLocation(location); + WebKit::WebKeyboardEventBuilder convertedEvent(*event); + return convertedEvent.modifiers; +} + +TEST(WebInputEventConversionTest, WebKeyboardEventBuilder) +{ + // Test key location conversion. + int modifiers = getModifiersForKeyLocationCode(WebCore::KeyboardEvent::DOM_KEY_LOCATION_STANDARD); + EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEvent::IsLeft || modifiers & WebInputEvent::IsRight); + + modifiers = getModifiersForKeyLocationCode(WebCore::KeyboardEvent::DOM_KEY_LOCATION_LEFT); + EXPECT_TRUE(modifiers & WebInputEvent::IsLeft); + EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEvent::IsRight); + + modifiers = getModifiersForKeyLocationCode(WebCore::KeyboardEvent::DOM_KEY_LOCATION_RIGHT); + EXPECT_TRUE(modifiers & WebInputEvent::IsRight); + EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEvent::IsLeft); + + modifiers = getModifiersForKeyLocationCode(WebCore::KeyboardEvent::DOM_KEY_LOCATION_NUMPAD); + EXPECT_TRUE(modifiers & WebInputEvent::IsKeyPad); + EXPECT_FALSE(modifiers & WebInputEvent::IsLeft || modifiers & WebInputEvent::IsRight); +} + +} // anonymous namespace diff --git a/Source/WebKit/chromium/tests/WebLayerTest.cpp b/Source/WebKit/chromium/tests/WebLayerTest.cpp index 9b8e58ca1..eb544b29f 100644 --- a/Source/WebKit/chromium/tests/WebLayerTest.cpp +++ b/Source/WebKit/chromium/tests/WebLayerTest.cpp @@ -26,17 +26,20 @@ #include <public/WebLayer.h> #include "CompositorFakeWebGraphicsContext3D.h" +#include "WebCompositorInitializer.h" #include "WebLayerImpl.h" -#include <public/WebCompositor.h> +#include "WebLayerTreeViewTestCommon.h" #include <public/WebContentLayer.h> #include <public/WebContentLayerClient.h> #include <public/WebExternalTextureLayer.h> #include <public/WebFloatPoint.h> #include <public/WebFloatRect.h> +#include <public/WebLayerScrollClient.h> #include <public/WebLayerTreeView.h> #include <public/WebLayerTreeViewClient.h> #include <public/WebRect.h> #include <public/WebSize.h> +#include <public/WebSolidColorLayer.h> #include <gmock/gmock.h> @@ -49,23 +52,6 @@ using testing::_; namespace { -class MockWebLayerTreeViewClient : public WebLayerTreeViewClient { -public: - MOCK_METHOD0(scheduleComposite, void()); - - virtual void updateAnimations(double frameBeginTime) { } - virtual void didBeginFrame() { } - virtual void layout() { } - virtual void applyScrollAndScale(const WebSize& scrollDelta, float scaleFactor) { } - virtual WebGraphicsContext3D* createContext3D() { return CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()).leakPtr(); } - virtual void didRebindGraphicsContext(bool success) { } - virtual WebCompositorOutputSurface* createOutputSurface() { return 0; } - virtual void didRecreateOutputSurface(bool success) { } - virtual void willCommit() { } - virtual void didCommitAndDrawFrame() { } - virtual void didCompleteSwapBuffers() { } -}; - class MockWebContentLayerClient : public WebContentLayerClient { public: MOCK_METHOD3(paintContents, void(WebCanvas*, const WebRect& clip, WebFloatRect& opaque)); @@ -73,13 +59,16 @@ public: class WebLayerTest : public Test { public: + WebLayerTest() + : m_compositorInitializer(0) + { + } + virtual void SetUp() { - // Initialize without threading support. - WebKit::WebCompositor::initialize(0); m_rootLayer = adoptPtr(WebLayer::create()); EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); - EXPECT_TRUE(m_view.initialize(&m_client, *m_rootLayer, WebLayerTreeView::Settings())); + EXPECT_TRUE(m_view = adoptPtr(WebLayerTreeView::create(&m_client, *m_rootLayer, WebLayerTreeView::Settings()))); Mock::VerifyAndClearExpectations(&m_client); } @@ -87,16 +76,15 @@ public: { // We may get any number of scheduleComposite calls during shutdown. EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); - m_view.setRootLayer(0); m_rootLayer.clear(); - m_view.reset(); - WebKit::WebCompositor::shutdown(); + m_view.clear(); } protected: + WebKitTests::WebCompositorInitializer m_compositorInitializer; MockWebLayerTreeViewClient m_client; OwnPtr<WebLayer> m_rootLayer; - WebLayerTreeView m_view; + OwnPtr<WebLayerTreeView> m_view; }; // Tests that the client gets called to ask for a composite if we change the @@ -156,7 +144,7 @@ TEST_F(WebLayerTest, Client) EXPECT_EQ(point, layer->position()); // Texture layer. - EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); + EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); OwnPtr<WebExternalTextureLayer> textureLayer = adoptPtr(WebExternalTextureLayer::create()); m_rootLayer->addChild(textureLayer->layer()); Mock::VerifyAndClearExpectations(&m_client); @@ -187,6 +175,37 @@ TEST_F(WebLayerTest, Client) contentLayer->layer()->setDrawsContent(false); Mock::VerifyAndClearExpectations(&m_client); EXPECT_FALSE(contentLayer->layer()->drawsContent()); + + // Solid color layer. + EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); + OwnPtr<WebSolidColorLayer> solidColorLayer = adoptPtr(WebSolidColorLayer::create()); + m_rootLayer->addChild(solidColorLayer->layer()); + Mock::VerifyAndClearExpectations(&m_client); + +} + +class MockScrollClient : public WebLayerScrollClient { +public: + MOCK_METHOD0(didScroll, void()); +}; + +TEST_F(WebLayerTest, notifyScrollClient) +{ + MockScrollClient scrollClient; + + EXPECT_CALL(scrollClient, didScroll()).Times(0); + m_rootLayer->setScrollClient(&scrollClient); + Mock::VerifyAndClearExpectations(&scrollClient); + + EXPECT_CALL(scrollClient, didScroll()).Times(1); + m_rootLayer->setScrollPosition(WebPoint(14, 19)); + Mock::VerifyAndClearExpectations(&scrollClient); + + EXPECT_CALL(scrollClient, didScroll()).Times(0); + m_rootLayer->setScrollPosition(WebPoint(14, 19)); + Mock::VerifyAndClearExpectations(&scrollClient); + + m_rootLayer->setScrollClient(0); } } diff --git a/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp b/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp index 1c1602c23..c136e01be 100644 --- a/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp +++ b/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp @@ -31,10 +31,12 @@ #include "WebLayerTreeViewTestCommon.h" #include <gmock/gmock.h> #include <public/Platform.h> -#include <public/WebCompositor.h> +#include <public/WebCompositorSupport.h> #include <public/WebLayer.h> #include <public/WebLayerTreeViewClient.h> #include <public/WebThread.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> using namespace WebKit; using testing::Mock; @@ -61,35 +63,34 @@ public: { initializeCompositor(); m_rootLayer = adoptPtr(WebLayer::create()); - EXPECT_TRUE(m_view.initialize(client(), *m_rootLayer, WebLayerTreeView::Settings())); - m_view.setSurfaceReady(); + ASSERT_TRUE(m_view = adoptPtr(WebLayerTreeView::create(client(), *m_rootLayer, WebLayerTreeView::Settings()))); + m_view->setSurfaceReady(); } virtual void TearDown() { Mock::VerifyAndClearExpectations(client()); - m_view.setRootLayer(0); m_rootLayer.clear(); - m_view.reset(); - WebKit::WebCompositor::shutdown(); + m_view.clear(); + WebKit::Platform::current()->compositorSupport()->shutdown(); } protected: OwnPtr<WebLayer> m_rootLayer; - WebLayerTreeView m_view; + OwnPtr<WebLayerTreeView> m_view; }; class WebLayerTreeViewSingleThreadTest : public WebLayerTreeViewTestBase { protected: void composite() { - m_view.composite(); + m_view->composite(); } virtual void initializeCompositor() OVERRIDE { - WebKit::WebCompositor::initialize(0); + WebKit::Platform::current()->compositorSupport()->initialize(0); } virtual WebLayerTreeViewClient* client() OVERRIDE @@ -157,18 +158,18 @@ protected: void composite() { - m_view.setNeedsRedraw(); + m_view->setNeedsRedraw(); RefPtr<CancelableTaskWrapper> timeoutTask = adoptRef(new CancelableTaskWrapper(adoptPtr(new TimeoutTask()))); WebKit::Platform::current()->currentThread()->postDelayedTask(timeoutTask->createTask(), 5000); WebKit::Platform::current()->currentThread()->enterRunLoop(); timeoutTask->cancel(); - m_view.finishAllRendering(); + m_view->finishAllRendering(); } virtual void initializeCompositor() OVERRIDE { m_webThread = adoptPtr(WebKit::Platform::current()->createThread("WebLayerTreeViewTest")); - WebCompositor::initialize(m_webThread.get()); + WebKit::Platform::current()->compositorSupport()->initialize(m_webThread.get()); } virtual WebLayerTreeViewClient* client() OVERRIDE diff --git a/Source/WebKit/chromium/tests/WebLayerTreeViewTestCommon.h b/Source/WebKit/chromium/tests/WebLayerTreeViewTestCommon.h index e2a62b6a3..48071f951 100644 --- a/Source/WebKit/chromium/tests/WebLayerTreeViewTestCommon.h +++ b/Source/WebKit/chromium/tests/WebLayerTreeViewTestCommon.h @@ -34,7 +34,7 @@ namespace WebKit { class MockWebLayerTreeViewClient : public WebLayerTreeViewClient { public: - virtual void scheduleComposite() OVERRIDE { } + MOCK_METHOD0(scheduleComposite, void()); virtual void updateAnimations(double frameBeginTime) OVERRIDE { } MOCK_METHOD0(willBeginFrame, void()); MOCK_METHOD0(didBeginFrame, void()); diff --git a/Source/WebKit/chromium/tests/WebTransformOperationsTest.cpp b/Source/WebKit/chromium/tests/WebTransformOperationsTest.cpp index deaf7ad74..d54db214d 100644 --- a/Source/WebKit/chromium/tests/WebTransformOperationsTest.cpp +++ b/Source/WebKit/chromium/tests/WebTransformOperationsTest.cpp @@ -26,15 +26,14 @@ #include <public/WebTransformOperations.h> -#include <public/WebTransformationMatrix.h> - -#include "CCLayerTreeTestCommon.h" - +#include "CCGeometryTestUtils.h" #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> +using namespace std; using namespace WebKit; TEST(WebTransformOperationTest, transformTypesAreUnique) @@ -42,19 +41,19 @@ TEST(WebTransformOperationTest, transformTypesAreUnique) Vector<OwnPtr<WebTransformOperations> > transforms; WebTransformOperations* toAdd = new WebTransformOperations(); - toAdd->appendTranslate(0, 0, 0); + toAdd->appendTranslate(1, 0, 0); transforms.append(adoptPtr(toAdd)); toAdd = new WebTransformOperations(); - toAdd->appendRotate(0, 0, 1, 0); + toAdd->appendRotate(0, 0, 1, 2); transforms.append(adoptPtr(toAdd)); toAdd = new WebTransformOperations(); - toAdd->appendScale(1, 1, 1); + toAdd->appendScale(2, 2, 2); transforms.append(adoptPtr(toAdd)); toAdd = new WebTransformOperations(); - toAdd->appendSkew(0, 0); + toAdd->appendSkew(1, 0); transforms.append(adoptPtr(toAdd)); toAdd = new WebTransformOperations(); @@ -72,19 +71,19 @@ TEST(WebTransformOperationTest, transformTypesAreUnique) TEST(WebTransformOperationTest, matchTypesSameLength) { WebTransformOperations translates; - translates.appendTranslate(0, 0, 0); - translates.appendTranslate(0, 0, 0); - translates.appendTranslate(0, 0, 0); + translates.appendTranslate(1, 0, 0); + translates.appendTranslate(1, 0, 0); + translates.appendTranslate(1, 0, 0); WebTransformOperations skews; - skews.appendSkew(0, 0); - skews.appendSkew(0, 0); - skews.appendSkew(0, 0); + skews.appendSkew(0, 2); + skews.appendSkew(0, 2); + skews.appendSkew(0, 2); WebTransformOperations translates2; - translates2.appendTranslate(0, 0, 0); - translates2.appendTranslate(0, 0, 0); - translates2.appendTranslate(0, 0, 0); + translates2.appendTranslate(0, 2, 0); + translates2.appendTranslate(0, 2, 0); + translates2.appendTranslate(0, 2, 0); WebTransformOperations translates3 = translates2; @@ -96,22 +95,84 @@ TEST(WebTransformOperationTest, matchTypesSameLength) TEST(WebTransformOperationTest, matchTypesDifferentLength) { WebTransformOperations translates; - translates.appendTranslate(0, 0, 0); - translates.appendTranslate(0, 0, 0); - translates.appendTranslate(0, 0, 0); + translates.appendTranslate(1, 0, 0); + translates.appendTranslate(1, 0, 0); + translates.appendTranslate(1, 0, 0); WebTransformOperations skews; - skews.appendSkew(0, 0); - skews.appendSkew(0, 0); + skews.appendSkew(2, 0); + skews.appendSkew(2, 0); WebTransformOperations translates2; - translates2.appendTranslate(0, 0, 0); - translates2.appendTranslate(0, 0, 0); + translates2.appendTranslate(0, 2, 0); + translates2.appendTranslate(0, 2, 0); EXPECT_FALSE(translates.matchesTypes(skews)); EXPECT_FALSE(translates.matchesTypes(translates2)); } +void getIdentityOperations(Vector<OwnPtr<WebTransformOperations> >* operations) +{ + WebTransformOperations* toAdd = new WebTransformOperations(); + operations->append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendTranslate(0, 0, 0); + operations->append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendTranslate(0, 0, 0); + toAdd->appendTranslate(0, 0, 0); + operations->append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendScale(1, 1, 1); + operations->append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendScale(1, 1, 1); + toAdd->appendScale(1, 1, 1); + operations->append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendSkew(0, 0); + operations->append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendSkew(0, 0); + toAdd->appendSkew(0, 0); + operations->append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendRotate(0, 0, 1, 0); + operations->append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendRotate(0, 0, 1, 0); + toAdd->appendRotate(0, 0, 1, 0); + operations->append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendMatrix(WebTransformationMatrix()); + operations->append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendMatrix(WebTransformationMatrix()); + toAdd->appendMatrix(WebTransformationMatrix()); + operations->append(adoptPtr(toAdd)); +} + +TEST(WebTransformOperationTest, identityAlwaysMatches) +{ + Vector<OwnPtr<WebTransformOperations> > operations; + getIdentityOperations(&operations); + + for (size_t i = 0; i < operations.size(); ++i) { + for (size_t j = 0; j < operations.size(); ++j) + EXPECT_TRUE(operations[i]->matchesTypes(*operations[j])); + } +} + TEST(WebTransformOperationTest, applyTranslate) { double x = 1; @@ -339,3 +400,238 @@ TEST(WebTransformOperationTest, blendWhenTypesDoNotMatch) EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom, progress)); } + +TEST(WebTransformOperationTest, largeRotationsWithSameAxis) +{ + WebTransformOperations operationsFrom; + operationsFrom.appendRotate(0, 0, 1, 0); + + WebTransformOperations operationsTo; + operationsTo.appendRotate(0, 0, 2, 360); + + double progress = 0.5; + + WebTransformationMatrix expected; + expected.rotate3d(0, 0, 1, 180); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom, progress)); +} + +TEST(WebTransformOperationTest, largeRotationsWithSameAxisInDifferentDirection) +{ + WebTransformOperations operationsFrom; + operationsFrom.appendRotate(0, 0, 1, 180); + + WebTransformOperations operationsTo; + operationsTo.appendRotate(0, 0, -1, 180); + + double progress = 0.5; + + WebTransformationMatrix expected; + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom, progress)); +} + +TEST(WebTransformOperationTest, largeRotationsWithDifferentAxes) +{ + WebTransformOperations operationsFrom; + operationsFrom.appendRotate(0, 0, 1, 180); + + WebTransformOperations operationsTo; + operationsTo.appendRotate(0, 1, 0, 180); + + double progress = 0.5; + WebTransformationMatrix matrixFrom; + matrixFrom.rotate3d(0, 0, 1, 180); + + WebTransformationMatrix matrixTo; + matrixTo.rotate3d(0, 1, 0, 180); + + WebTransformationMatrix expected = matrixTo; + expected.blend(matrixFrom, progress); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom, progress)); +} + +TEST(WebTransformOperationTest, blendRotationFromIdentity) +{ + Vector<OwnPtr<WebTransformOperations> > identityOperations; + getIdentityOperations(&identityOperations); + + for (size_t i = 0; i < identityOperations.size(); ++i) { + WebTransformOperations operations; + operations.appendRotate(0, 0, 1, 360); + + double progress = 0.5; + + WebTransformationMatrix expected; + expected.rotate3d(0, 0, 1, 180); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.blend(*identityOperations[i], progress)); + } +} + +TEST(WebTransformOperationTest, blendTranslationFromIdentity) +{ + Vector<OwnPtr<WebTransformOperations> > identityOperations; + getIdentityOperations(&identityOperations); + + for (size_t i = 0; i < identityOperations.size(); ++i) { + WebTransformOperations operations; + operations.appendTranslate(2, 2, 2); + + double progress = 0.5; + + WebTransformationMatrix expected; + expected.translate3d(1, 1, 1); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.blend(*identityOperations[i], progress)); + } +} + +TEST(WebTransformOperationTest, blendScaleFromIdentity) +{ + Vector<OwnPtr<WebTransformOperations> > identityOperations; + getIdentityOperations(&identityOperations); + + for (size_t i = 0; i < identityOperations.size(); ++i) { + WebTransformOperations operations; + operations.appendScale(3, 3, 3); + + double progress = 0.5; + + WebTransformationMatrix expected; + expected.scale3d(2, 2, 2); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.blend(*identityOperations[i], progress)); + } +} + +TEST(WebTransformOperationTest, blendSkewFromIdentity) +{ + Vector<OwnPtr<WebTransformOperations> > identityOperations; + getIdentityOperations(&identityOperations); + + for (size_t i = 0; i < identityOperations.size(); ++i) { + WebTransformOperations operations; + operations.appendSkew(2, 2); + + double progress = 0.5; + + WebTransformationMatrix expected; + expected.skewX(1); + expected.skewY(1); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.blend(*identityOperations[i], progress)); + } +} + +TEST(WebTransformOperationTest, blendPerspectiveFromIdentity) +{ + Vector<OwnPtr<WebTransformOperations> > identityOperations; + getIdentityOperations(&identityOperations); + + for (size_t i = 0; i < identityOperations.size(); ++i) { + WebTransformOperations operations; + operations.appendPerspective(1000); + + double progress = 0.5; + + WebTransformationMatrix expected; + expected.applyPerspective(500 + 0.5 * numeric_limits<double>::max()); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.blend(*identityOperations[i], progress)); + } +} + +TEST(WebTransformOperationTest, blendRotationToIdentity) +{ + Vector<OwnPtr<WebTransformOperations> > identityOperations; + getIdentityOperations(&identityOperations); + + for (size_t i = 0; i < identityOperations.size(); ++i) { + WebTransformOperations operations; + operations.appendRotate(0, 0, 1, 360); + + double progress = 0.5; + + WebTransformationMatrix expected; + expected.rotate3d(0, 0, 1, 180); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(operations, progress)); + } +} + +TEST(WebTransformOperationTest, blendTranslationToIdentity) +{ + Vector<OwnPtr<WebTransformOperations> > identityOperations; + getIdentityOperations(&identityOperations); + + for (size_t i = 0; i < identityOperations.size(); ++i) { + WebTransformOperations operations; + operations.appendTranslate(2, 2, 2); + + double progress = 0.5; + + WebTransformationMatrix expected; + expected.translate3d(1, 1, 1); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(operations, progress)); + } +} + +TEST(WebTransformOperationTest, blendScaleToIdentity) +{ + Vector<OwnPtr<WebTransformOperations> > identityOperations; + getIdentityOperations(&identityOperations); + + for (size_t i = 0; i < identityOperations.size(); ++i) { + WebTransformOperations operations; + operations.appendScale(3, 3, 3); + + double progress = 0.5; + + WebTransformationMatrix expected; + expected.scale3d(2, 2, 2); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(operations, progress)); + } +} + +TEST(WebTransformOperationTest, blendSkewToIdentity) +{ + Vector<OwnPtr<WebTransformOperations> > identityOperations; + getIdentityOperations(&identityOperations); + + for (size_t i = 0; i < identityOperations.size(); ++i) { + WebTransformOperations operations; + operations.appendSkew(2, 2); + + double progress = 0.5; + + WebTransformationMatrix expected; + expected.skewX(1); + expected.skewY(1); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(operations, progress)); + } +} + +TEST(WebTransformOperationTest, blendPerspectiveToIdentity) +{ + Vector<OwnPtr<WebTransformOperations> > identityOperations; + getIdentityOperations(&identityOperations); + + for (size_t i = 0; i < identityOperations.size(); ++i) { + WebTransformOperations operations; + operations.appendPerspective(1000); + + double progress = 0.5; + + WebTransformationMatrix expected; + expected.applyPerspective(500 + 0.5 * numeric_limits<double>::max()); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(operations, progress)); + } +} + diff --git a/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp b/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp index eb442f4e3..a587e4a37 100644 --- a/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp +++ b/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp @@ -26,7 +26,7 @@ #include <public/WebTransformationMatrix.h> -#include "CCLayerTreeTestCommon.h" +#include "CCGeometryTestUtils.h" #include <gtest/gtest.h> #include <wtf/MathExtras.h> diff --git a/Source/WebKit/chromium/tests/WebViewTest.cpp b/Source/WebKit/chromium/tests/WebViewTest.cpp index 46c96310d..4e2553a36 100644 --- a/Source/WebKit/chromium/tests/WebViewTest.cpp +++ b/Source/WebKit/chromium/tests/WebViewTest.cpp @@ -32,14 +32,18 @@ #include "WebView.h" #include "Document.h" +#include "Element.h" #include "FrameTestHelpers.h" #include "FrameView.h" #include "HTMLDocument.h" #include "URLTestHelpers.h" +#include "WebContentDetectionResult.h" #include "WebDocument.h" +#include "WebElement.h" #include "WebFrame.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" +#include "WebInputEvent.h" #include "platform/WebSize.h" #include "WebViewClient.h" #include "WebViewImpl.h" @@ -218,7 +222,7 @@ void WebViewTest::testAutoResize(const WebSize& minAutoResize, const WebSize& ma webView->close(); } -TEST_F(WebViewTest, AutoResizeMinimumSize) +TEST_F(WebViewTest, DISABLED_AutoResizeMinimumSize) { WebSize minAutoResize(91, 56); WebSize maxAutoResize(403, 302); @@ -418,4 +422,132 @@ TEST_F(WebViewTest, SetCompositionFromExistingText) webView->close(); } +class ContentDetectorClient : public WebViewClient { +public: + ContentDetectorClient() { reset(); } + + virtual WebContentDetectionResult detectContentAround(const WebHitTestResult& hitTest) OVERRIDE + { + m_contentDetectionRequested = true; + return m_contentDetectionResult; + } + + virtual void scheduleContentIntent(const WebURL& url) OVERRIDE + { + m_scheduledIntentURL = url; + } + + virtual void cancelScheduledContentIntents() OVERRIDE + { + m_pendingIntentsCancelled = true; + } + + void reset() + { + m_contentDetectionRequested = false; + m_pendingIntentsCancelled = false; + m_scheduledIntentURL = WebURL(); + m_contentDetectionResult = WebContentDetectionResult(); + } + + bool contentDetectionRequested() const { return m_contentDetectionRequested; } + bool pendingIntentsCancelled() const { return m_pendingIntentsCancelled; } + const WebURL& scheduledIntentURL() const { return m_scheduledIntentURL; } + void setContentDetectionResult(const WebContentDetectionResult& result) { m_contentDetectionResult = result; } + +private: + bool m_contentDetectionRequested; + bool m_pendingIntentsCancelled; + WebURL m_scheduledIntentURL; + WebContentDetectionResult m_contentDetectionResult; +}; + +static bool tapElementById(WebView* webView, WebInputEvent::Type type, const WebString& id) +{ + ASSERT(webView); + RefPtr<WebCore::Element> element = static_cast<PassRefPtr<WebCore::Element> >(webView->mainFrame()->document().getElementById(id)); + if (!element) + return false; + + element->scrollIntoViewIfNeeded(); + WebCore::IntPoint center = element->screenRect().center(); + + WebGestureEvent event; + event.type = type; + event.x = center.x(); + event.y = center.y(); + + webView->handleInputEvent(event); + webkit_support::RunAllPendingMessages(); + return true; +} + +TEST_F(WebViewTest, DetectContentAroundPosition) +{ + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("content_listeners.html")); + + ContentDetectorClient client; + WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "content_listeners.html", true, 0, &client); + webView->resize(WebSize(500, 300)); + webView->layout(); + webkit_support::RunAllPendingMessages(); + + WebString clickListener = WebString::fromUTF8("clickListener"); + WebString touchstartListener = WebString::fromUTF8("touchstartListener"); + WebString mousedownListener = WebString::fromUTF8("mousedownListener"); + WebString noListener = WebString::fromUTF8("noListener"); + WebString link = WebString::fromUTF8("link"); + + // Ensure content detection is not requested for nodes listening to click, + // mouse or touch events when we do simple taps. + EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, clickListener)); + EXPECT_FALSE(client.contentDetectionRequested()); + client.reset(); + + EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, touchstartListener)); + EXPECT_FALSE(client.contentDetectionRequested()); + client.reset(); + + EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, mousedownListener)); + EXPECT_FALSE(client.contentDetectionRequested()); + client.reset(); + + // Content detection should still work on click, mouse and touch event listeners for long taps + // as long as we're not tapping on links. + EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, clickListener)); + EXPECT_TRUE(client.contentDetectionRequested()); + client.reset(); + + EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, touchstartListener)); + EXPECT_TRUE(client.contentDetectionRequested()); + client.reset(); + + EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, mousedownListener)); + EXPECT_TRUE(client.contentDetectionRequested()); + client.reset(); + + EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, link)); + EXPECT_FALSE(client.contentDetectionRequested()); + client.reset(); + + // Content detection should work normally without these event listeners. + // The click listener in the body should be ignored as a special case. + EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, noListener)); + EXPECT_TRUE(client.contentDetectionRequested()); + EXPECT_FALSE(client.scheduledIntentURL().isValid()); + + WebURL intentURL = toKURL(m_baseURL); + client.setContentDetectionResult(WebContentDetectionResult(WebRange(), WebString(), intentURL)); + EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, noListener)); + EXPECT_TRUE(client.scheduledIntentURL() == intentURL); + + // Tapping elsewhere should cancel the scheduled intent. + WebGestureEvent event; + event.type = WebInputEvent::GestureTap; + webView->handleInputEvent(event); + webkit_support::RunAllPendingMessages(); + EXPECT_TRUE(client.pendingIntentsCancelled()); + webView->close(); +} + } diff --git a/Source/WebKit/chromium/tests/data/content_listeners.html b/Source/WebKit/chromium/tests/data/content_listeners.html new file mode 100644 index 000000000..ff924c883 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/content_listeners.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> +<head> +<style> +span { + font-size: 300%; +} +</style> +<script> +function listener() { +} +</script> +</head> +<body onclick="listener()"> +<span id="clickListener" onclick="listener()"> +This has a click listener. +</span></br> +<span id="touchstartListener" ontouchstart="listener()"> +This has a touchstart listener. +</span></br> +<span id="mousedownListener" onmousedown="listener()"> +This has a mousedown listener. +</span></br> +<span id="noListener"> +This has no specific listener (the body listener should be ignored). +</span></br> +<a href="http://www.test.com/" id="link"> +This has no specific listener, but it's a link. +</a></br> +</body> +</html> diff --git a/Source/WebKit/chromium/tests/data/disambiguation_popup.html b/Source/WebKit/chromium/tests/data/disambiguation_popup.html new file mode 100644 index 000000000..b1af285ce --- /dev/null +++ b/Source/WebKit/chromium/tests/data/disambiguation_popup.html @@ -0,0 +1,30 @@ +<html> +<head> +<title>Disambiguation Popup Test</title> +<style type="text/css"> +.horizontal-link { + display:block; + width:200px; + height:30px; + margin:20px; + background-color:#ccccff; +} +.vertical-link { + display:inline-block; + width:30px; + height:200px; + margin:10px; + background-color:#ccccff; +} +</style> +</head> +<body style="margin:0px;"> +<a href="#" class="horizontal-link" style="margin:100px">Link</a> +<a href="#" class="horizontal-link">Link 1</a> +<a href="#" class="horizontal-link">Link 2</a> +<a href="#" class="horizontal-link">Link 3</a> +<a href="#" class="horizontal-link">Link 4</a> +<a href="#" class="horizontal-link">Link 5</a> +<a href="#" class="vertical-link">Link 1</a><a href="#" class="vertical-link">Link 2</a><a href="#" class="vertical-link">Link 3</a><a href="#" class="vertical-link">Link 4</a><a href="#" class="vertical-link">Link 5</a> +</body> +</html> diff --git a/Source/WebKit/chromium/tests/data/test_touch_link_highlight.html b/Source/WebKit/chromium/tests/data/test_touch_link_highlight.html index 89bd15fb0..2394b2624 100644 --- a/Source/WebKit/chromium/tests/data/test_touch_link_highlight.html +++ b/Source/WebKit/chromium/tests/data/test_touch_link_highlight.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <body> - <a href="http://www.test.com" style="position: absolute; left: 20px; top: 20px; width: 200px; -webkit-transform:translateZ(0)">A link to highlight</a> - <div style="background-color: white; position: absolute; left: 20px; top: 40px; width: 200px; height: 30px"> + <a href="http://www.test.com" style="position: absolute; left: 20px; top: 20px; width: 200px;">A link to highlight</a> + <div style="background-color: white; position: absolute; left: 20px; top: 40px; width: 200px; height: 30px; -webkit-transform:translateZ(0);"> <p id="innerDiv">Not a link to click.</p> </div> <div style="background-color: white; position: absolute; left: 20px; top: 100px; width: 200px; height: 100px; overflow-y: scroll; overflow-x : scroll;"> diff --git a/Source/WebKit/chromium/tests/data/text_selection.html b/Source/WebKit/chromium/tests/data/text_selection.html new file mode 100644 index 000000000..f605e9a54 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/text_selection.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> +<body> + +<span id="header">[ +<span id="header_1">Header 1.</span> +<span id="header_2">Header 2.</span> +]</span> + +<span id="editable" contenteditable="true">[ +<span id="editable_1">Editable 1.</span> +<span id="editable_2">Editable 2.</span> +]</span> + +<span id="footer">[ +<span id="footer_1">Footer 1.</span> +<span id="footer_2">Footer 2.</span> +]</span> + +<script> +function selectElement(id) { + var element = document.getElementById(id); + var range = document.createRange(); + range.selectNode(document.getElementById(id)); + window.getSelection().removeAllRanges(); + window.getSelection().addRange(range); +} +</script> +</body> +</html> + |