diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-01 10:36:58 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-01 10:36:58 +0200 |
commit | b1e9e47fa11f608ae16bc07f97a2acf95bf80272 (patch) | |
tree | c88c45e80c9c44506e7cdf9a3bb39ebf82a8cd5b /Source/WebKit/chromium | |
parent | be01689f43cf6882cf670d33df49ead1f570c53a (diff) | |
download | qtwebkit-b1e9e47fa11f608ae16bc07f97a2acf95bf80272.tar.gz |
Imported WebKit commit 499c84c99aa98e9870fa7eaa57db476c6d160d46 (http://svn.webkit.org/repository/webkit/trunk@119200)
Weekly update :). Particularly relevant changes for Qt are the use of the WebCore image decoders and direct usage
of libpng/libjpeg if available in the system.
Diffstat (limited to 'Source/WebKit/chromium')
62 files changed, 3245 insertions, 842 deletions
diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index 2baa8ecc1..09ed0651b 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,790 @@ +2012-05-31 Hajime Morrita <morrita@chromium.org> + + REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac + https://bugs.webkit.org/show_bug.cgi?id=86859 + + Removed a port specific fix which was introduced at r117572. + + Reviewed by Ryosuke Niwa. + + * src/EditorClientImpl.cpp: + (WebKit::EditorClientImpl::frameWillDetachPage): + (WebKit::EditorClientImpl::requestCheckingOfString): + * src/EditorClientImpl.h: + (WebCore): + (EditorClientImpl): + * src/WebTextCheckingCompletionImpl.cpp: + (WebKit::WebTextCheckingCompletionImpl::didFinishCheckingText): + (WebKit::WebTextCheckingCompletionImpl::didCancelCheckingText): + * src/WebTextCheckingCompletionImpl.h: + (WebKit::WebTextCheckingCompletionImpl::WebTextCheckingCompletionImpl): + (WebTextCheckingCompletionImpl): + +2012-05-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r119146. + http://trac.webkit.org/changeset/119146 + https://bugs.webkit.org/show_bug.cgi?id=88035 + + android breakage fixed in http://crrev.com/139945 (Requested + by fischman on #webkit). + + * public/WebMediaPlayer.h: + (WebMediaPlayer): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::didLoadingProgress): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + +2012-05-31 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Migrate to WebTransformationMatrix + https://bugs.webkit.org/show_bug.cgi?id=87788 + + Reviewed by James Robinson. + + * src/WebLayer.cpp: + (WebKit::WebLayer::setSublayerTransform): + (WebKit::WebLayer::setTransform): + * tests/CCAnimationTestCommon.cpp: + (WebKitTests::FakeTransformTransition::getValue): + * tests/CCAnimationTestCommon.h: + * tests/CCDamageTrackerTest.cpp: + (WebKitTests::executeCalculateDrawTransformsAndVisibility): + (WebKitTests::TEST_F): + * tests/CCKeyframedAnimationCurveTest.cpp: + * tests/CCLayerAnimationControllerTest.cpp: + * tests/CCLayerImplTest.cpp: + (WebCore::TEST): + * tests/CCLayerIteratorTest.cpp: + * tests/CCLayerSorterTest.cpp: + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers::commitCompleteOnCCThread): + (WTF::setLayerPropertiesForTesting): + (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::beginTest): + (WTF::setTestLayerPropertiesForTesting): + (WTF::CCLayerTreeHostTestLayerOcclusion::beginTest): + (WTF::CCLayerTreeHostTestLayerOcclusionWithFilters::beginTest): + (WTF::CCLayerTreeHostTestManySurfaces::beginTest): + * tests/CCLayerTreeTestCommon.h: + (WebKitTests): + * tests/CCMathUtilTest.cpp: + * tests/CCOcclusionTrackerTest.cpp: + (WebKitTests::CCOcclusionTrackerTest::createRoot): + (WebKitTests::CCOcclusionTrackerTest::createLayer): + (WebKitTests::CCOcclusionTrackerTest::createSurface): + (WebKitTests::CCOcclusionTrackerTest::createDrawingLayer): + (WebKitTests::CCOcclusionTrackerTest::createReplicaLayer): + (WebKitTests::CCOcclusionTrackerTest::createDrawingSurface): + (CCOcclusionTrackerTest): + (WebKitTests::CCOcclusionTrackerTest::setBaseProperties): + (WebKitTests::CCOcclusionTrackerTest::setProperties): + (WebKitTests::CCOcclusionTrackerTestRotatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestTranslatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestChildInRotatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceRotatedOffAxis::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren::runMyTest): + (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest): + (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest): + (WebKitTests::CCOcclusionTrackerTestFilters::runMyTest): + (WebKitTests::CCOcclusionTrackerTest3dTransform::runMyTest): + (WebKitTests::CCOcclusionTrackerTestPerspectiveTransform::runMyTest): + (WebKitTests::CCOcclusionTrackerTestPerspectiveTransformBehindCamera::runMyTest): + (WebKitTests::CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude::runMyTest): + (WebKitTests::CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter::runMyTest): + (WebKitTests::CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded::runMyTest): + (WebKitTests::CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded::runMyTest): + * tests/CCQuadCullerTest.cpp: + * tests/CCRenderSurfaceTest.cpp: + * tests/FloatQuadTest.cpp: + * tests/LayerChromiumTest.cpp: + * tests/LinkHighlightTest.cpp: + * tests/TiledLayerChromiumTest.cpp: + * tests/WebTransformationMatrixTest.cpp: + (WebKit::TEST): + (WebKit): + +2012-05-31 Ian Vollick <vollick@chromium.org> + + [chromium] Single thread proxy should not tick animations unless the layer renderer has been initialized + https://bugs.webkit.org/show_bug.cgi?id=87873 + + Reviewed by James Robinson. + + When the layer renderer fails to initialize, be sure to stop the animation timer. + + * tests/CCLayerTreeHostTest.cpp: + (CompositorFakeWebGraphicsContext3DWithTextureTracking): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::create): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::createTexture): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::deleteTexture): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::bindTexture): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::numTextures): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::texture): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::resetTextures): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::numUsedTextures): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::usedTexture): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::resetUsedTextures): + (WTF::CompositorFakeWebGraphicsContext3DWithTextureTracking::CompositorFakeWebGraphicsContext3DWithTextureTracking): + (WTF): + (WTF::TestHooks::didRecreateContext): + (TestHooks): + (WTF::TestHooks::createContext): + (CCLayerTreeHostTest): + (WTF::CCLayerTreeHostTest::clearEndTestTask): + (WTF::CCLayerTreeHostTest::CCLayerTreeHostTest): + (EndTestTask): + (WTF::CCLayerTreeHostTest::EndTestTask::EndTestTask): + (WTF::CCLayerTreeHostTest::EndTestTask::~EndTestTask): + (WTF::CCLayerTreeHostTest::EndTestTask::clearTest): + (WTF::CCLayerTreeHostTest::EndTestTask::run): + (WTF::CCLayerTreeHostTest::runTest): + (WTF::CCLayerTreeHostTest::endTestAfterDelay): + (FakeWebGraphicsContext3DMakeCurrentFails): + (WTF::FakeWebGraphicsContext3DMakeCurrentFails::makeContextCurrent): + (CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation): + (WTF::CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation::CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation): + (WTF::CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation::beginTest): + (WTF::CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation::animateLayers): + (WTF::CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation::didRecreateContext): + (WTF::CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation::afterTest): + (WTF::TEST_F): + +2012-05-15 Brett Wilson <brettw@chromium.org> + + Hook up GTK IsKeyPad flag for keyboard events, and preserve this flag + on all platforms when converting back to a WebKeyboardEvent. + + https://bugs.webkit.org/show_bug.cgi?id=86514 + + Reviewed by Dimitri Glazkov. + + * src/WebInputEventConversion.cpp: + (WebKit::WebKeyboardEventBuilder::WebKeyboardEventBuilder): + * src/gtk/WebInputEventFactory.cpp: + (WebKit::WebInputEventFactory::keyboardEvent): + * tests/WebInputEventFactoryTestGtk.cpp: + +2012-05-31 Alec Flett <alecflett@chromium.org> + + IndexedDB: Implement IDBTransaction.error and IDBRequest.error + https://bugs.webkit.org/show_bug.cgi?id=87865 + + Reviewed by Tony Chang. + + IDBDatabaseError now honors IDB-specific DOMException codes, + so make sure that's how they are passed to/from chromium. + + * src/WebIDBDatabaseError.cpp: + (WebKit::WebIDBDatabaseError::assign): + +2012-05-31 James Robinson <jamesr@chromium.org> + + [chromium] Assertion failures during compositor startup in lost context situations + https://bugs.webkit.org/show_bug.cgi?id=87912 + + Reviewed by Adrienne Walker. + + Adds a unit test verifying that even if we lose our context during or before initialization we get through the + rest of the path without failing ASSERT()s. + + * tests/LayerRendererChromiumTest.cpp: + (LoseContextOnFirstGetContext): + (LoseContextOnFirstGetContext::LoseContextOnFirstGetContext): + (TEST): + +2012-05-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r119125. + http://trac.webkit.org/changeset/119125 + https://bugs.webkit.org/show_bug.cgi?id=88007 + + Will break android build if rolled (Requested by rafaelw_ on + #webkit). + + * public/WebMediaPlayer.h: + (WebMediaPlayer): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::bytesLoaded): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + +2012-05-31 Dana Jansens <danakj@chromium.org> + + [chromium] Move drawing code for RenderSurfaces into LayerRendererChromium + https://bugs.webkit.org/show_bug.cgi?id=87877 + + Reviewed by James Robinson. + + * tests/CCRenderSurfaceTest.cpp: + (WebCore::TEST): + +2012-05-31 Ami Fischman <fischman@chromium.org> + + Replace WebMediaPlayer::bytesLoaded() with an explicit didLoadingProgress() + https://bugs.webkit.org/show_bug.cgi?id=86113 + + Reviewed by Eric Carlson. + + * public/WebMediaPlayer.h: + (WebMediaPlayer): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::didLoadingProgress): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + +2012-05-31 Ian Vollick <vollick@chromium.org> + + [chromium] create WebTransformOperation interface for chromium platform + https://bugs.webkit.org/show_bug.cgi?id=87510 + + Reviewed by James Robinson. + + * WebKit.gypi: + * tests/WebTransformOperationsTest.cpp: Added. + (TEST): + (checkProgress): + +2012-05-31 Alexander Pavlov <apavlov@chromium.org> + + Web Inspector: [Chromium] Cannot bring Inspector to front when paused on breakpoint + https://bugs.webkit.org/show_bug.cgi?id=87871 + + Reviewed by Yury Semikhatsky. + + When input events handling is suppressed (due to the JS being paused on a breakpoint), we should report + these events as NOT handled by the WebKit, so that the browser can handle them appropriately + (on MacOS, switching between the application windows is done through the default key event handler, so if you run + event.preventDefault() for all keydown events in a handler, the Chromium window switch will not occur on Cmd+`). + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleInputEvent): + +2012-05-31 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-05-30 Peter Beverloo <peter@chromium.org> + + [Chromium] Automatically install 64-bit linker for Android + https://bugs.webkit.org/show_bug.cgi?id=79780 + + Reviewed by Adam Barth. + + Change the Android-specific dependencies to inherit their revision from + Chromium's DEPS file, like many other dependencies do, solving the + versioning problem that we're running in to right now. These are listed + in Chromium's main DEPS file starting Chromium r139529. + + * DEPS: + +2012-05-31 Yoshifumi Inoue <yosin@chromium.org> + + Build fix for Chromium Linux (Tests) after r119073. + + * tests/DecimalTest.cpp: + (TEST_F): + +2012-05-31 Yoshifumi Inoue <yosin@chromium.org> + + [Platform] Introduce Decimal class for Number/Range input type. + https://bugs.webkit.org/show_bug.cgi?id=87360 + + Reviewed by Kent Tamura. + + This patch added unit test for Decimal class. + + * WebKit.gypi: + * tests/DecimalTest.cpp: Added. + (WebCore): + (WebCore::operator<<): Output Decimal for unit test debugging + (DecimalStepRange): + (DecimalStepRange::DecimalStepRange): + (DecimalStepRange::clampValue): + (DecimalTest): + (DecimalTest::encode): + (DecimalTest::fromString): + (DecimalTest::stepDown): + (DecimalTest::stepUp): + (TEST_F): + +2012-05-30 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: add MemoryUsageSupport::processMemorySizesInBytes + https://bugs.webkit.org/show_bug.cgi?id=87830 + + Reviewed by James Robinson. + + * public/platform/WebKitPlatformSupport.h: pulled getProcessMemorySize up + to the Source/Platform/chromium/public/Platform.h + * src/PlatformSupport.cpp: + +2012-05-31 Kent Tamura <tkent@chromium.org> + + Unreviewed, rolling out r119062 and r119064. + http://trac.webkit.org/changeset/119062 + http://trac.webkit.org/changeset/119064 + https://bugs.webkit.org/show_bug.cgi?id=87360 + + Broke build on Lion, SnowLoepard, Chromium Windows, and + Chromium Linux 32 + + * WebKit.gypi: + * tests/DecimalTest.cpp: Removed. + +2012-05-30 Yoshifumi Inoue <yosin@chromium.org> + + [Platform] Introduce Decimal class for Number/Range input type. + https://bugs.webkit.org/show_bug.cgi?id=87360 + + Reviewed by Kent Tamura. + + This patch added unit test for Decimal class. + + * WebKit.gypi: + * tests/DecimalTest.cpp: Added. + (WebCore): + (WebCore::operator<<): Output Decimal for unit test debugging + (DecimalStepRange): + (DecimalStepRange::DecimalStepRange): + (DecimalStepRange::clampValue): + (DecimalTest): + (DecimalTest::encode): + (DecimalTest::fromString): + (DecimalTest::stepDown): + (DecimalTest::stepUp): + (TEST_F): + +2012-05-30 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Fix min/max bounds error in CCMathUtil.cpp + https://bugs.webkit.org/show_bug.cgi?id=87915 + + Reviewed by James Robinson. + + * tests/CCMathUtilTest.cpp: + (WebCore::TEST): + (WebCore): + +2012-05-30 Ami Fischman <fischman@chromium.org> + + Roll chromium DEPS from r139300 to r139542. Unreviewed. + https://bugs.webkit.org/show_bug.cgi?id=87868 + + * DEPS: + +2012-05-30 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Call fileUtilities methods directly + https://bugs.webkit.org/show_bug.cgi?id=87852 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * src/PlatformSupport.cpp: + (WebCore): + +2012-05-30 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r118986. + http://trac.webkit.org/changeset/118986 + https://bugs.webkit.org/show_bug.cgi?id=87914 + + Caused several IndexedDB browser_test failures on Chromium + canary builders (Requested by rafaelw_ on #webkit). + + * src/WebIDBDatabaseError.cpp: + (WebKit::WebIDBDatabaseError::assign): + +2012-05-30 Dominic Mazzoni <dmazzoni@google.com> + + AX: Chromium WebAccessibilityObject should check if an AccessibilityObject is detached + https://bugs.webkit.org/show_bug.cgi?id=87778 + + Reviewed by Adam Barth. + + Pretty simple - all places that previously just checked for null + now also check if the wrapped AccessibilityObject is detached. + + * public/WebAccessibilityObject.h: + (WebAccessibilityObject): + * src/WebAccessibilityObject.cpp: + (WebKit::WebAccessibilityObject::isDetached): + (WebKit): + (WebKit::WebAccessibilityObject::axID): + (WebKit::WebAccessibilityObject::accessibilityDescription): + (WebKit::WebAccessibilityObject::actionVerb): + (WebKit::WebAccessibilityObject::canSetFocusAttribute): + (WebKit::WebAccessibilityObject::canSetValueAttribute): + (WebKit::WebAccessibilityObject::isValid): + (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::setFocused): + (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::hasComputedStyle): + (WebKit::WebAccessibilityObject::computedStyleDisplay): + (WebKit::WebAccessibilityObject::accessibilityIsIgnored): + (WebKit::WebAccessibilityObject::lineBreaks): + (WebKit::WebAccessibilityObject::columnCount): + (WebKit::WebAccessibilityObject::rowCount): + +2012-05-30 Shawn Singh <shawnsingh@chromium.org> + + Simplify TransformationMatrix rotation code to improve precision + https://bugs.webkit.org/show_bug.cgi?id=86666 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostCommonTest.cpp: + (WebKitTests::TEST): + * tests/WebTransformationMatrixTest.cpp: + (WebKit::TEST): + (WebKit): + +2012-05-30 Alec Flett <alecflett@chromium.org> + + IndexedDB: Implement IDBTransaction.error and IDBRequest.error + https://bugs.webkit.org/show_bug.cgi?id=87865 + + Reviewed by Tony Chang. + + IDBDatabaseError now honors IDB-specific DOMException codes, + so make sure that's how they are passed to/from chromium. + + * src/WebIDBDatabaseError.cpp: + (WebKit::WebIDBDatabaseError::assign): + +2012-05-30 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Merge shared code in CCOcclusionTrackerTest + https://bugs.webkit.org/show_bug.cgi?id=87798 + + Reviewed by Adrienne Walker. + + This patch simple uses a different existing macro function so that + the same thing doesn't exist in multiple places, and so that the + naming is more consistent with gtest's conventions. + + * tests/CCOcclusionTrackerTest.cpp: + (WebKitTests::CCOcclusionTrackerTestIdentityTransforms::runMyTest): + (WebKitTests::CCOcclusionTrackerTestRotatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestTranslatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestChildInRotatedChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceRotatedOffAxis::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren::runMyTest): + (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest): + (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest): + (WebKitTests::CCOcclusionTrackerTestFilters::runMyTest): + (WebKitTests::CCOcclusionTrackerTestReplicaDoesOcclude::runMyTest): + (WebKitTests::CCOcclusionTrackerTestReplicaWithClipping::runMyTest): + (WebKitTests::CCOcclusionTrackerTestReplicaWithMask::runMyTest): + (WebKitTests::CCOcclusionTrackerTestLayerScissorRectOutsideChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestScreenScissorRectOutsideChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestLayerScissorRectPartlyOverChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestScreenScissorRectPartlyOverChild::runMyTest): + (WebKitTests::CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty::runMyTest): + (WebKitTests::CCOcclusionTrackerTest3dTransform::runMyTest): + (WebKitTests::CCOcclusionTrackerTestPerspectiveTransform::runMyTest): + (WebKitTests::CCOcclusionTrackerTestAnimationOpacity1OnMainThread::runMyTest): + (WebKitTests::CCOcclusionTrackerTestAnimationOpacity0OnMainThread::runMyTest): + (WebKitTests::CCOcclusionTrackerTestAnimationTranslateOnMainThread::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping::runMyTest): + (WebKitTests::CCOcclusionTrackerTestReplicaOccluded::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceAndReplicaOccludedDifferently::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceChildOfSurface::runMyTest): + (WebKitTests::CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceChildOfClippingSurface::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter::runMyTest): + (WebKitTests::CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter::runMyTest): + (WebKitTests::CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded::runMyTest): + (WebKitTests::CCOcclusionTrackerTestMinimumTrackingSize::runMyTest): + +2012-05-30 Tony Chang <tony@chromium.org> + + [chromium] port webframe_unittest.cc to webkit_unit_tests + https://bugs.webkit.org/show_bug.cgi?id=87796 + + Reviewed by James Robinson. + + Move WebFrameTest.GetContentAsPlainText and WebFrameTest.GetFullHtmlOfPage to webkit_unit_tests. + + * tests/WebFrameTest.cpp: + (WebKit::TEST_F): + (WebKit): Add tests. + +2012-05-30 Jochen Eisinger <jochen@chromium.org> + + Match Firefox restrictions to window.blur and window.focus + https://bugs.webkit.org/show_bug.cgi?id=86969 + + Reviewed by Adam Barth. + + Allow window.focus() during the dispatch of the click event on + notifications. + + * src/WebNotification.cpp: + (WebKit::WebNotification::dispatchClickEvent): + +2012-05-29 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Move fileExists to Platform.h + https://bugs.webkit.org/show_bug.cgi?id=87531 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * src/PlatformSupport.cpp: + (WebCore): + +2012-05-29 Alec Flett <alecflett@chromium.org> + + IndexedDB: Align codes and names for IDB-specific and DOM-specific errors/exceptions + https://bugs.webkit.org/show_bug.cgi?id=87276 + + Reviewed by Tony Chang. + + * public/WebIDBDatabaseException.h: + * src/AssertMatchingEnums.cpp: + +2012-05-29 Rafael Weinstein <rafaelw@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-05-29 Dana Jansens <danakj@chromium.org> + + [chromium] Unoccluded area in surfaces should always be clipped to the rootScissorRect + https://bugs.webkit.org/show_bug.cgi?id=87677 + + Reviewed by Adrienne Walker. + + * tests/CCOcclusionTrackerTest.cpp: + (CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor): + (WebKitTests::CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor::runMyTest): + (WebKitTests): + +2012-05-29 David Barr <davidbarr@chromium.org> + + Introduce ENABLE_CSS_IMAGE_RESOLUTION compile flag + https://bugs.webkit.org/show_bug.cgi?id=87685 + + Reviewed by Eric Seidel. + + Add a configuration option for CSS image-resolution support, disabling it by default. + + * features.gypi: + +2012-05-29 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-05-29 Hironori Bono <hbono@chromium.org> + + Use WebSpellCheckClient::spellcheck to retrieve suggestions. + https://bugs.webkit.org/show_bug.cgi?id=87690 + + Reviewed by Hajime Morita. + + This change uses WebSpellCheckClient::spellcheck as a fallback method to + retrieve suggestions when a marker does not have any suggestions. (It consumes + lots of CPU power to get suggestions for misspelled word, i.e. Chromium cannot + afford to attach suggestions to all spelling markers.) + + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): Retrieve suggestions if markers do not have any. + +2012-05-28 Takashi Toyoshima <toyoshim@chromium.org> + + [WebSocket] Receiving reserved close codes, 1005, 1006, and 1015 must appear as code=1006 and wasClean=false + https://bugs.webkit.org/show_bug.cgi?id=87084 + + Reviewed by Kent Tamura. + + Update close event codes corresponding to WebSocketChannel::CloseEventCode. + + * public/WebSocket.h: Update on newly defined close event codes + +2012-05-28 MORITA Hajime <morrita@google.com> + + Rename FrameLoaderClient::shadowDOMAllowed() to allowShadowDOM() + https://bugs.webkit.org/show_bug.cgi?id=87101 + + Reviewed by Kentaro Hara. + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::allowShadowDOM): + * src/FrameLoaderClientImpl.h: + (FrameLoaderClientImpl): + +2012-05-28 Rob Flack <flackr@chromium.org> + + [chromium] Only increase size of Combo Box Options when displayed on touch screen + https://bugs.webkit.org/show_bug.cgi?id=85921 + + Reviewed by Adam Barth. + + Adds a flag to set whether the current device is a touch screen, independent of whether touch events are supported and use this for the combo box sizing. + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::defaultDeviceScaleFactor): + (WebKit): + (WebKit::WebSettingsImpl::setDeviceSupportsTouch): + (WebKit::WebSettingsImpl::deviceSupportsTouch): + * src/WebSettingsImpl.h: + (WebSettingsImpl): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::applyAutofillSuggestions): + * tests/PopupMenuTest.cpp: + (WebKit::SelectPopupMenuTest::SetUp): + (WebKit::SelectPopupMenuTest::TearDown): + (SelectPopupMenuTest): + (WebKit::TEST_F): + +2012-05-25 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled + https://bugs.webkit.org/show_bug.cgi?id=42328 + + Reviewed by Eric Seidel. + + Removed private APIs that were only being used by DRT. + + * public/WebDevToolsAgent.h: + (WebDevToolsAgent): + * src/WebDevToolsAgentImpl.cpp: + * src/WebDevToolsAgentImpl.h: + (WebDevToolsAgentImpl): + +2012-05-28 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-05-28 Peter Beverloo <peter@chromium.org> + + [Chromium] Build fix for the Android bot, set CXX_target at gyp generation-time + https://bugs.webkit.org/show_bug.cgi?id=87649 + + Unreviewed build fix. + + Chromium Android builds were broken because v8 tried to compile files + for target with the "-m32" flag. This was caused by a v8 check falling + back to using "which g++" to find the right compiler, whereas it should + have used the $CXX_target environment variable. This isn't being set + for Android builds. + + * gyp_webkit: Set the CXX_target environment variable. Annotate the fix + with a FIXME comment too. + +2012-05-28 Keishi Hattori <keishi@webkit.org> + + Expose value localization function of HTMLInputElement + https://bugs.webkit.org/show_bug.cgi?id=84356 + + Reviewed by Kent Tamura. + + * public/WebInputElement.h: + (WebInputElement): + * src/WebInputElement.cpp: + (WebKit::WebInputElement::localizeValue): + (WebKit): + +2012-05-28 MORITA Hajime <morrita@google.com> + + Unreviewed Mac Chromium build fix. + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::allowStyleScoped): + +2012-05-28 MORITA Hajime <morrita@google.com> + + https://bugs.webkit.org/show_bug.cgi?id=87609 + [Chromium] FrameLoaderClient::allowStyleScoped() should be implemented interms of WebPermissionClient + + Reviewed by Kent Tamura. + + Added allowStyleScoped() implementation which is essentially same as shadowDOMAllowed(). + + * src/FrameLoaderClientImpl.cpp: + * src/FrameLoaderClientImpl.h: + (FrameLoaderClientImpl): + 2012-05-25 Ryosuke Niwa <rniwa@webkit.org> Roll chromium DEPS from r139156 to r139184. diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index e12c78f59..67371f99f 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': '139184' + 'chromium_rev': '139747' } deps = { @@ -167,10 +167,12 @@ deps_os = { From('chromium_deps', 'src/third_party/openssl'), }, 'android': { - 'third_party/freetype': - 'https://git.chromium.org/chromium/src/third_party/freetype.git', 'tools/android': - Var('chromium_svn')+'/tools/android@'+Var('chromium_rev'), + Var('chromium_svn') + '/tools/android@' + Var('chromium_rev'), + 'third_party/freetype': + From('chromium_deps', 'src/third_party/freetype'), + 'third_party/aosp': + From('chromium_deps', 'src/third_party/aosp'), }, } diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index 1a688bbcc..1c11f2d79 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -95,6 +95,7 @@ 'tests/ClipboardChromiumTest.cpp', 'tests/CompositorFakeGraphicsContext3D.h', 'tests/CompositorFakeWebGraphicsContext3D.h', + 'tests/DecimalTest.cpp', 'tests/DragImageTest.cpp', 'tests/DrawingBufferChromiumTest.cpp', 'tests/EventListenerTest.cpp', @@ -152,6 +153,7 @@ 'tests/WebSocketDeflaterTest.cpp', 'tests/WebSocketExtensionDispatcherTest.cpp', 'tests/WebTransformationMatrixTest.cpp', + 'tests/WebTransformOperationsTest.cpp', 'tests/WebURLRequestTest.cpp', 'tests/WebURLResponseTest.cpp', 'tests/WebViewTest.cpp', diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index a0d6329c6..f773cc4bc 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -41,6 +41,7 @@ 'ENABLE_CSS_EXCLUSIONS=1', 'ENABLE_CSS_FILTERS=1', 'ENABLE_CSS_IMAGE_SET=1', + 'ENABLE_CSS_IMAGE_RESOLUTION=0', 'ENABLE_CSS_REGIONS=1', 'ENABLE_CSS_SHADERS=1', 'ENABLE_CSS_VARIABLES=0', diff --git a/Source/WebKit/chromium/gyp_webkit b/Source/WebKit/chromium/gyp_webkit index 36f0f431b..fb720d97a 100755 --- a/Source/WebKit/chromium/gyp_webkit +++ b/Source/WebKit/chromium/gyp_webkit @@ -87,6 +87,9 @@ if __name__ == '__main__': envsetup_location = os.path.join(chrome_src, 'build', 'android', 'envsetup.sh') exit(subprocess.call(['bash', '-c', 'source %s && python gyp_webkit --no-envsetup-recursion %s' % (envsetup_location, ' '.join(args))])) else: + # FIXME: v8 requires the CXX_target variable to determine whether -m32 should be + # set. The current Android build set-up is not sustainable and breaks too often. + os.environ['CXX_target'] = glob.glob('%s/*-g++' % os.environ.get('ANDROID_TOOLCHAIN'))[0] args.remove('--no-envsetup-recursion') # Add includes. diff --git a/Source/WebKit/chromium/public/WebAccessibilityObject.h b/Source/WebKit/chromium/public/WebAccessibilityObject.h index c52b830a9..029f43872 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(); } + WEBKIT_EXPORT bool isDetached() const; // Static methods for enabling accessibility. WEBKIT_EXPORT static void enableAccessibility(); diff --git a/Source/WebKit/chromium/public/WebDevToolsAgent.h b/Source/WebKit/chromium/public/WebDevToolsAgent.h index 0a66db362..9f1d53f1b 100644 --- a/Source/WebKit/chromium/public/WebDevToolsAgent.h +++ b/Source/WebKit/chromium/public/WebDevToolsAgent.h @@ -68,7 +68,6 @@ public: // Exposed for LayoutTestController. virtual void evaluateInWebInspector(long callId, const WebString& script) = 0; - virtual void setJavaScriptProfilingEnabled(bool) = 0; class MessageDescriptor { public: diff --git a/Source/WebKit/chromium/public/WebIDBDatabaseException.h b/Source/WebKit/chromium/public/WebIDBDatabaseException.h index 81b838667..b0e63d426 100644 --- a/Source/WebKit/chromium/public/WebIDBDatabaseException.h +++ b/Source/WebKit/chromium/public/WebIDBDatabaseException.h @@ -35,7 +35,7 @@ namespace WebKit { enum WebIDBDatabaseException { WebIDBDatabaseExceptionDataError = 1205, - WebIDBDatabaseExceptionQuotaError = 1211, + WebIDBDatabaseExceptionQuotaError = 1218, }; } // namespace WebKit diff --git a/Source/WebKit/chromium/public/WebInputElement.h b/Source/WebKit/chromium/public/WebInputElement.h index 913740d66..fbc350012 100644 --- a/Source/WebKit/chromium/public/WebInputElement.h +++ b/Source/WebKit/chromium/public/WebInputElement.h @@ -96,6 +96,9 @@ namespace WebKit { WEBKIT_EXPORT WebNodeCollection dataListOptions() const; + // Return the localized value for this input type. + WEBKIT_EXPORT WebString localizeValue(const WebString&) const; + WEBKIT_EXPORT bool isSpeechInputEnabled() const; WEBKIT_EXPORT SpeechInputState getSpeechInputState() const; WEBKIT_EXPORT void startSpeechInput(); diff --git a/Source/WebKit/chromium/public/WebMediaPlayer.h b/Source/WebKit/chromium/public/WebMediaPlayer.h index 3312f5f21..444a2cc90 100644 --- a/Source/WebKit/chromium/public/WebMediaPlayer.h +++ b/Source/WebKit/chromium/public/WebMediaPlayer.h @@ -144,7 +144,7 @@ public: virtual NetworkState networkState() const = 0; virtual ReadyState readyState() const = 0; - virtual unsigned long long bytesLoaded() const = 0; + virtual bool didLoadingProgress() const = 0; virtual unsigned long long totalBytes() const = 0; virtual bool hasSingleSecurityOrigin() const = 0; diff --git a/Source/WebKit/chromium/public/WebSettings.h b/Source/WebKit/chromium/public/WebSettings.h index d9016847a..ccf3303c7 100644 --- a/Source/WebKit/chromium/public/WebSettings.h +++ b/Source/WebKit/chromium/public/WebSettings.h @@ -67,6 +67,7 @@ public: virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool) = 0; virtual void setFontBoostingEnabled(bool) = 0; virtual void setDefaultTextEncodingName(const WebString&) = 0; + virtual void setDeviceSupportsTouch(bool) = 0; virtual void setJavaScriptEnabled(bool) = 0; virtual void setWebSecurityEnabled(bool) = 0; virtual void setJavaScriptCanOpenWindowsAutomatically(bool) = 0; diff --git a/Source/WebKit/chromium/public/WebSocket.h b/Source/WebKit/chromium/public/WebSocket.h index f2a140cfa..e3db32427 100644 --- a/Source/WebKit/chromium/public/WebSocket.h +++ b/Source/WebKit/chromium/public/WebSocket.h @@ -55,7 +55,12 @@ public: CloseEventCodeFrameTooLarge = 1004, CloseEventCodeNoStatusRcvd = 1005, CloseEventCodeAbnormalClosure = 1006, - CloseEventCodeInvalidUTF8 = 1007, + CloseEventCodeInvalidFramePayloadData = 1007, + CloseEventCodePolicyViolation = 1008, + CloseEventCodeMessageTooBig = 1009, + CloseEventCodeMandatoryExt = 1010, + CloseEventCodeInternalError = 1011, + CloseEventCodeTLSHandshake = 1015, CloseEventCodeMinimumUserDefined = 3000, CloseEventCodeMaximumUserDefined = 4999 }; diff --git a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h index 908152149..f69c62ff2 100644 --- a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h +++ b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h @@ -115,11 +115,6 @@ public: virtual WebSharedWorkerRepository* sharedWorkerRepository() { return 0; } - // Returns private and shared usage, in bytes. Private bytes is the amount of - // memory currently allocated to this process that cannot be shared. Returns - // false on platform specific error conditions. - virtual bool getProcessMemorySize(size_t* privateBytes, size_t* sharedBytes) { return false; } - protected: ~WebKitPlatformSupport() { } }; diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index 375428923..94985b20c 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -458,7 +458,7 @@ COMPILE_ASSERT_MATCHING_ENUM(WebView::UserStyleInjectInExistingDocuments, Inject COMPILE_ASSERT_MATCHING_ENUM(WebView::UserStyleInjectInSubsequentDocuments, InjectInSubsequentDocuments); COMPILE_ASSERT_MATCHING_ENUM(WebIDBDatabaseExceptionDataError, IDBDatabaseException::DATA_ERR); -COMPILE_ASSERT_MATCHING_ENUM(WebIDBDatabaseExceptionQuotaError, IDBDatabaseException::QUOTA_ERR); +COMPILE_ASSERT_MATCHING_ENUM(WebIDBDatabaseExceptionQuotaError, IDBDatabaseException::IDB_QUOTA_EXCEEDED_ERR); #if ENABLE(INDEXED_DATABASE) COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::InvalidType, IDBKey::InvalidType); diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp index 5871f44e1..d400e7c2b 100644 --- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -290,8 +290,13 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( suggestions.append(descriptions); } } - data.dictionarySuggestions = suggestions; data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame); + if (!suggestions.isEmpty()) + data.dictionarySuggestions = suggestions; + else if (m_webView->spellCheckClient()) { + int misspelledOffset, misspelledLength; + m_webView->spellCheckClient()->spellCheck(data.misspelledWord, misspelledOffset, misspelledLength, &data.dictionarySuggestions); + } } } } else if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) { diff --git a/Source/WebKit/chromium/src/EditorClientImpl.cpp b/Source/WebKit/chromium/src/EditorClientImpl.cpp index c004c3fc3..417fe9429 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.cpp +++ b/Source/WebKit/chromium/src/EditorClientImpl.cpp @@ -90,17 +90,6 @@ void EditorClientImpl::pageDestroyed() void EditorClientImpl::frameWillDetachPage(WebCore::Frame* frame) { - HashSet<WebTextCheckingCompletionImpl*> validRequests; - - for (HashSet<WebTextCheckingCompletionImpl*>::iterator i = m_pendingTextChecks.begin(); - i != m_pendingTextChecks.end(); ++i) { - if (frame->editor()->spellChecker() == (*i)->spellChecker()) - (*i)->invalidate(); - else - validRequests.add(*i); - } - - m_pendingTextChecks.swap(validRequests); } bool EditorClientImpl::shouldShowDeleteInterface(HTMLElement* elem) @@ -752,19 +741,12 @@ void EditorClientImpl::checkSpellingOfString(const UChar* text, int length, *misspellingLength = spellLength; } -void EditorClientImpl::requestCheckingOfString(SpellChecker* sender, const WebCore::TextCheckingRequest& request) +void EditorClientImpl::requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest> request) { - if (!m_webView->spellCheckClient()) - return; - - WebTextCheckingCompletionImpl* completion = new WebTextCheckingCompletionImpl(request.sequence(), sender, this); - m_pendingTextChecks.add(completion); - m_webView->spellCheckClient()->requestCheckingOfText(request.text(), completion); -} - -void EditorClientImpl::didCheckString(WebTextCheckingCompletionImpl* completion) -{ - m_pendingTextChecks.remove(completion); + if (m_webView->spellCheckClient()) { + String text = request->text(); + m_webView->spellCheckClient()->requestCheckingOfText(text, new WebTextCheckingCompletionImpl(request)); + } } String EditorClientImpl::getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord) diff --git a/Source/WebKit/chromium/src/EditorClientImpl.h b/Source/WebKit/chromium/src/EditorClientImpl.h index 47e8c508f..3ee9ebaaa 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.h +++ b/Source/WebKit/chromium/src/EditorClientImpl.h @@ -40,7 +40,6 @@ namespace WebCore { class Frame; class HTMLInputElement; -class SpellChecker; } namespace WebKit { @@ -113,12 +112,10 @@ public: virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses); virtual void willSetInputMethodState(); virtual void setInputMethodState(bool enabled); - virtual void requestCheckingOfString(WebCore::SpellChecker*, const WebCore::TextCheckingRequest&); + virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>); virtual WebCore::TextCheckerClient* textChecker() { return this; } - void didCheckString(WebTextCheckingCompletionImpl*); - private: void modifySelection(WebCore::Frame*, WebCore::KeyboardEvent*); @@ -146,8 +143,6 @@ private: SpellCheckForcedOff }; int m_spellCheckThisFieldStatus; - - WTF::HashSet<WebTextCheckingCompletionImpl*> m_pendingTextChecks; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp index c42979ca3..de3f22789 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -239,7 +239,16 @@ bool FrameLoaderClientImpl::allowRunningInsecureContent(bool enabledPerSettings, return enabledPerSettings; } -bool FrameLoaderClientImpl::shadowDOMAllowed(bool enabledAsRuntimeFeature) +bool FrameLoaderClientImpl::allowShadowDOM(bool enabledAsRuntimeFeature) +{ + WebViewImpl* webview = m_webFrame->viewImpl(); + if (webview && webview->permissionClient()) + return webview->permissionClient()->allowWebComponents(m_webFrame, enabledAsRuntimeFeature); + + return enabledAsRuntimeFeature; +} + +bool FrameLoaderClientImpl::allowStyleScoped(bool enabledAsRuntimeFeature) { WebViewImpl* webview = m_webFrame->viewImpl(); if (webview && webview->permissionClient()) diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h index f798ac2ef..236a01b65 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -199,7 +199,8 @@ public: virtual bool allowImage(bool enabledPerSettings, const WebCore::KURL& imageURL); virtual bool allowDisplayingInsecureContent(bool enabledPerSettings, WebCore::SecurityOrigin*, const WebCore::KURL&); virtual bool allowRunningInsecureContent(bool enabledPerSettings, WebCore::SecurityOrigin*, const WebCore::KURL&); - virtual bool shadowDOMAllowed(bool enabledAsRuntimeFeature) OVERRIDE; + virtual bool allowShadowDOM(bool enabledAsRuntimeFeature) OVERRIDE; + virtual bool allowStyleScoped(bool enabledAsRuntimeFeature) OVERRIDE; virtual void didNotAllowScript(); virtual void didNotAllowPlugins(); diff --git a/Source/WebKit/chromium/src/PlatformSupport.cpp b/Source/WebKit/chromium/src/PlatformSupport.cpp index 7cc7f5a6e..b6266fea1 100644 --- a/Source/WebKit/chromium/src/PlatformSupport.cpp +++ b/Source/WebKit/chromium/src/PlatformSupport.cpp @@ -302,92 +302,6 @@ bool PlatformSupport::cookiesEnabled(const Document* document) // File ------------------------------------------------------------------------ -bool PlatformSupport::fileExists(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->fileExists(path); -} - -bool PlatformSupport::deleteFile(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->deleteFile(path); -} - -bool PlatformSupport::deleteEmptyDirectory(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->deleteEmptyDirectory(path); -} - -bool PlatformSupport::getFileMetadata(const String& path, FileMetadata& result) -{ - WebFileInfo webFileInfo; - if (!webKitPlatformSupport()->fileUtilities()->getFileInfo(path, webFileInfo)) - return false; - result.modificationTime = webFileInfo.modificationTime; - result.length = webFileInfo.length; - result.type = static_cast<FileMetadata::Type>(webFileInfo.type); - return true; -} - -String PlatformSupport::directoryName(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->directoryName(path); -} - -String PlatformSupport::pathByAppendingComponent(const String& path, const String& component) -{ - return WebKit::Platform::current()->fileUtilities()->pathByAppendingComponent(path, component); -} - -bool PlatformSupport::makeAllDirectories(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->makeAllDirectories(path); -} - -String PlatformSupport::getAbsolutePath(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->getAbsolutePath(path); -} - -bool PlatformSupport::isDirectory(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->isDirectory(path); -} - -KURL PlatformSupport::filePathToURL(const String& path) -{ - return WebKit::Platform::current()->fileUtilities()->filePathToURL(path); -} - -PlatformFileHandle PlatformSupport::openFile(const String& path, FileOpenMode mode) -{ - return WebKit::Platform::current()->fileUtilities()->openFile(path, mode); -} - -void PlatformSupport::closeFile(PlatformFileHandle& handle) -{ - WebKit::Platform::current()->fileUtilities()->closeFile(handle); -} - -long long PlatformSupport::seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) -{ - return WebKit::Platform::current()->fileUtilities()->seekFile(handle, offset, origin); -} - -bool PlatformSupport::truncateFile(PlatformFileHandle handle, long long offset) -{ - return WebKit::Platform::current()->fileUtilities()->truncateFile(handle, offset); -} - -int PlatformSupport::readFromFile(PlatformFileHandle handle, char* data, int length) -{ - return WebKit::Platform::current()->fileUtilities()->readFromFile(handle, data, length); -} - -int PlatformSupport::writeToFile(PlatformFileHandle handle, const char* data, int length) -{ - return WebKit::Platform::current()->fileUtilities()->writeToFile(handle, data, length); -} - #if ENABLE(FILE_SYSTEM) PassOwnPtr<AsyncFileSystem> PlatformSupport::createAsyncFileSystem() { @@ -836,11 +750,6 @@ void PlatformSupport::notifyJSOutOfMemory(Frame* frame) webFrame->client()->didExhaustMemoryAvailableForScript(webFrame); } -bool PlatformSupport::getProcessMemorySize(size_t* privateBytes, size_t* sharedBytes) -{ - return webKitPlatformSupport()->getProcessMemorySize(privateBytes, sharedBytes); -} - int PlatformSupport::screenHorizontalDPI(Widget* widget) { WebWidgetClient* client = toWebWidgetClient(widget); diff --git a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp index f556dbdf4..1eb69d28f 100644 --- a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp +++ b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp @@ -82,9 +82,17 @@ bool WebAccessibilityObject::accessibilityEnabled() return AXObjectCache::accessibilityEnabled(); } -int WebAccessibilityObject::axID() const +bool WebAccessibilityObject::isDetached() const { if (m_private.isNull()) + return true; + + return m_private->isDetached(); +} + +int WebAccessibilityObject::axID() const +{ + if (isDetached()) return -1; m_private->updateBackingStore(); @@ -93,7 +101,7 @@ int WebAccessibilityObject::axID() const WebString WebAccessibilityObject::accessibilityDescription() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -102,7 +110,7 @@ WebString WebAccessibilityObject::accessibilityDescription() const WebString WebAccessibilityObject::actionVerb() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -111,7 +119,7 @@ WebString WebAccessibilityObject::actionVerb() const bool WebAccessibilityObject::canSetFocusAttribute() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -120,7 +128,7 @@ bool WebAccessibilityObject::canSetFocusAttribute() const bool WebAccessibilityObject::canSetValueAttribute() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -129,7 +137,7 @@ bool WebAccessibilityObject::canSetValueAttribute() const bool WebAccessibilityObject::isValid() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -138,7 +146,7 @@ bool WebAccessibilityObject::isValid() const unsigned WebAccessibilityObject::childCount() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -147,7 +155,7 @@ unsigned WebAccessibilityObject::childCount() const WebAccessibilityObject WebAccessibilityObject::childAt(unsigned index) const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -159,7 +167,7 @@ WebAccessibilityObject WebAccessibilityObject::childAt(unsigned index) const WebAccessibilityObject WebAccessibilityObject::firstChild() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -168,7 +176,7 @@ WebAccessibilityObject WebAccessibilityObject::firstChild() const WebAccessibilityObject WebAccessibilityObject::focusedChild() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -181,7 +189,7 @@ WebAccessibilityObject WebAccessibilityObject::focusedChild() const WebAccessibilityObject WebAccessibilityObject::lastChild() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -191,7 +199,7 @@ WebAccessibilityObject WebAccessibilityObject::lastChild() const WebAccessibilityObject WebAccessibilityObject::nextSibling() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -200,7 +208,7 @@ WebAccessibilityObject WebAccessibilityObject::nextSibling() const WebAccessibilityObject WebAccessibilityObject::parentObject() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -210,7 +218,7 @@ WebAccessibilityObject WebAccessibilityObject::parentObject() const WebAccessibilityObject WebAccessibilityObject::previousSibling() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -219,7 +227,7 @@ WebAccessibilityObject WebAccessibilityObject::previousSibling() const bool WebAccessibilityObject::canSetSelectedAttribute() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -228,7 +236,7 @@ bool WebAccessibilityObject::canSetSelectedAttribute() const bool WebAccessibilityObject::isAnchor() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -237,7 +245,7 @@ bool WebAccessibilityObject::isAnchor() const bool WebAccessibilityObject::isAriaReadOnly() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -246,7 +254,7 @@ bool WebAccessibilityObject::isAriaReadOnly() const bool WebAccessibilityObject::isButtonStateMixed() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -255,7 +263,7 @@ bool WebAccessibilityObject::isButtonStateMixed() const bool WebAccessibilityObject::isChecked() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -264,7 +272,7 @@ bool WebAccessibilityObject::isChecked() const bool WebAccessibilityObject::isCollapsed() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -273,7 +281,7 @@ bool WebAccessibilityObject::isCollapsed() const bool WebAccessibilityObject::isControl() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -282,7 +290,7 @@ bool WebAccessibilityObject::isControl() const bool WebAccessibilityObject::isEnabled() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -291,7 +299,7 @@ bool WebAccessibilityObject::isEnabled() const bool WebAccessibilityObject::isFocused() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -300,7 +308,7 @@ bool WebAccessibilityObject::isFocused() const bool WebAccessibilityObject::isHovered() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -309,7 +317,7 @@ bool WebAccessibilityObject::isHovered() const bool WebAccessibilityObject::isIndeterminate() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -318,7 +326,7 @@ bool WebAccessibilityObject::isIndeterminate() const bool WebAccessibilityObject::isLinked() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -327,7 +335,7 @@ bool WebAccessibilityObject::isLinked() const bool WebAccessibilityObject::isLoaded() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -336,7 +344,7 @@ bool WebAccessibilityObject::isLoaded() const bool WebAccessibilityObject::isMultiSelectable() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -345,7 +353,7 @@ bool WebAccessibilityObject::isMultiSelectable() const bool WebAccessibilityObject::isOffScreen() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -354,7 +362,7 @@ bool WebAccessibilityObject::isOffScreen() const bool WebAccessibilityObject::isPasswordField() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -363,7 +371,7 @@ bool WebAccessibilityObject::isPasswordField() const bool WebAccessibilityObject::isPressed() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -372,7 +380,7 @@ bool WebAccessibilityObject::isPressed() const bool WebAccessibilityObject::isReadOnly() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -381,7 +389,7 @@ bool WebAccessibilityObject::isReadOnly() const bool WebAccessibilityObject::isRequired() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -390,7 +398,7 @@ bool WebAccessibilityObject::isRequired() const bool WebAccessibilityObject::isSelected() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -399,7 +407,7 @@ bool WebAccessibilityObject::isSelected() const bool WebAccessibilityObject::isSelectedOptionActive() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -408,7 +416,7 @@ bool WebAccessibilityObject::isSelectedOptionActive() const bool WebAccessibilityObject::isVertical() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -417,7 +425,7 @@ bool WebAccessibilityObject::isVertical() const bool WebAccessibilityObject::isVisible() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -426,7 +434,7 @@ bool WebAccessibilityObject::isVisible() const bool WebAccessibilityObject::isVisited() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -435,7 +443,7 @@ bool WebAccessibilityObject::isVisited() const WebString WebAccessibilityObject::accessKey() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -444,7 +452,7 @@ WebString WebAccessibilityObject::accessKey() const bool WebAccessibilityObject::ariaHasPopup() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -453,7 +461,7 @@ bool WebAccessibilityObject::ariaHasPopup() const bool WebAccessibilityObject::ariaLiveRegionAtomic() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -462,7 +470,7 @@ bool WebAccessibilityObject::ariaLiveRegionAtomic() const bool WebAccessibilityObject::ariaLiveRegionBusy() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -471,7 +479,7 @@ bool WebAccessibilityObject::ariaLiveRegionBusy() const WebString WebAccessibilityObject::ariaLiveRegionRelevant() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -480,7 +488,7 @@ WebString WebAccessibilityObject::ariaLiveRegionRelevant() const WebString WebAccessibilityObject::ariaLiveRegionStatus() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -489,7 +497,7 @@ WebString WebAccessibilityObject::ariaLiveRegionStatus() const WebRect WebAccessibilityObject::boundingBoxRect() const { - if (m_private.isNull()) + if (isDetached()) return WebRect(); m_private->updateBackingStore(); @@ -498,7 +506,7 @@ WebRect WebAccessibilityObject::boundingBoxRect() const double WebAccessibilityObject::estimatedLoadingProgress() const { - if (m_private.isNull()) + if (isDetached()) return 0.0; m_private->updateBackingStore(); @@ -507,7 +515,7 @@ double WebAccessibilityObject::estimatedLoadingProgress() const WebString WebAccessibilityObject::helpText() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -516,7 +524,7 @@ WebString WebAccessibilityObject::helpText() const int WebAccessibilityObject::headingLevel() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -525,7 +533,7 @@ int WebAccessibilityObject::headingLevel() const int WebAccessibilityObject::hierarchicalLevel() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -534,7 +542,7 @@ int WebAccessibilityObject::hierarchicalLevel() const WebAccessibilityObject WebAccessibilityObject::hitTest(const WebPoint& point) const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -552,7 +560,7 @@ WebAccessibilityObject WebAccessibilityObject::hitTest(const WebPoint& point) co WebString WebAccessibilityObject::keyboardShortcut() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -581,7 +589,7 @@ WebString WebAccessibilityObject::keyboardShortcut() const bool WebAccessibilityObject::performDefaultAction() const { - if (m_private.isNull()) + if (isDetached()) return false; UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); @@ -592,7 +600,7 @@ bool WebAccessibilityObject::performDefaultAction() const WebAccessibilityRole WebAccessibilityObject::roleValue() const { - if (m_private.isNull()) + if (isDetached()) return WebKit::WebAccessibilityRoleUnknown; m_private->updateBackingStore(); @@ -601,7 +609,7 @@ WebAccessibilityRole WebAccessibilityObject::roleValue() const unsigned WebAccessibilityObject::selectionEnd() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -610,7 +618,7 @@ unsigned WebAccessibilityObject::selectionEnd() const unsigned WebAccessibilityObject::selectionStart() const { - if (m_private.isNull()) + if (isDetached()) return 0; m_private->updateBackingStore(); @@ -619,13 +627,13 @@ unsigned WebAccessibilityObject::selectionStart() const void WebAccessibilityObject::setFocused(bool on) const { - if (!m_private.isNull()) + if (!isDetached()) m_private->setFocused(on); } WebString WebAccessibilityObject::stringValue() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -634,7 +642,7 @@ WebString WebAccessibilityObject::stringValue() const WebString WebAccessibilityObject::title() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -643,7 +651,7 @@ WebString WebAccessibilityObject::title() const WebAccessibilityObject WebAccessibilityObject::titleUIElement() const { - if (m_private.isNull()) + if (isDetached()) return WebAccessibilityObject(); m_private->updateBackingStore(); @@ -652,7 +660,7 @@ WebAccessibilityObject WebAccessibilityObject::titleUIElement() const WebURL WebAccessibilityObject::url() const { - if (m_private.isNull()) + if (isDetached()) return WebURL(); m_private->updateBackingStore(); @@ -661,7 +669,7 @@ WebURL WebAccessibilityObject::url() const WebString WebAccessibilityObject::valueDescription() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); m_private->updateBackingStore(); @@ -670,7 +678,7 @@ WebString WebAccessibilityObject::valueDescription() const float WebAccessibilityObject::valueForRange() const { - if (m_private.isNull()) + if (isDetached()) return 0.0; m_private->updateBackingStore(); @@ -679,7 +687,7 @@ float WebAccessibilityObject::valueForRange() const float WebAccessibilityObject::maxValueForRange() const { - if (m_private.isNull()) + if (isDetached()) return 0.0; m_private->updateBackingStore(); @@ -688,7 +696,7 @@ float WebAccessibilityObject::maxValueForRange() const float WebAccessibilityObject::minValueForRange() const { - if (m_private.isNull()) + if (isDetached()) return 0.0; m_private->updateBackingStore(); @@ -697,7 +705,7 @@ float WebAccessibilityObject::minValueForRange() const WebNode WebAccessibilityObject::node() const { - if (m_private.isNull()) + if (isDetached()) return WebNode(); m_private->updateBackingStore(); @@ -711,7 +719,7 @@ WebNode WebAccessibilityObject::node() const WebDocument WebAccessibilityObject::document() const { - if (m_private.isNull()) + if (isDetached()) return WebDocument(); m_private->updateBackingStore(); @@ -725,7 +733,7 @@ WebDocument WebAccessibilityObject::document() const bool WebAccessibilityObject::hasComputedStyle() const { - if (m_private.isNull()) + if (isDetached()) return false; Document* document = m_private->document(); @@ -741,7 +749,7 @@ bool WebAccessibilityObject::hasComputedStyle() const WebString WebAccessibilityObject::computedStyleDisplay() const { - if (m_private.isNull()) + if (isDetached()) return WebString(); Document* document = m_private->document(); @@ -761,7 +769,7 @@ WebString WebAccessibilityObject::computedStyleDisplay() const bool WebAccessibilityObject::accessibilityIsIgnored() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -770,7 +778,7 @@ bool WebAccessibilityObject::accessibilityIsIgnored() const bool WebAccessibilityObject::lineBreaks(WebVector<int>& result) const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -794,7 +802,7 @@ bool WebAccessibilityObject::lineBreaks(WebVector<int>& result) const unsigned WebAccessibilityObject::columnCount() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); @@ -806,7 +814,7 @@ unsigned WebAccessibilityObject::columnCount() const unsigned WebAccessibilityObject::rowCount() const { - if (m_private.isNull()) + if (isDetached()) return false; m_private->updateBackingStore(); diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index d39ff8af9..6f72f13fd 100644 --- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -560,15 +560,6 @@ void WebDevToolsAgentImpl::evaluateInWebInspector(long callId, const WebString& ic->evaluateForTestInFrontend(callId, script); } -void WebDevToolsAgentImpl::setJavaScriptProfilingEnabled(bool enabled) -{ - InspectorController* ic = inspectorController(); - if (enabled) - ic->enableProfiler(); - else - ic->disableProfiler(); -} - WebString WebDevToolsAgent::inspectorProtocolVersion() { return WebCore::inspectorProtocolVersion(); diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h index 1c8e025e8..edbee1471 100644 --- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h +++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h @@ -84,7 +84,6 @@ public: virtual void dispatchOnInspectorBackend(const WebString& message); virtual void inspectElementAt(const WebPoint& point); virtual void evaluateInWebInspector(long callId, const WebString& script); - virtual void setJavaScriptProfilingEnabled(bool); virtual void setProcessId(long); // InspectorClient implementation. diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseError.cpp b/Source/WebKit/chromium/src/WebIDBDatabaseError.cpp index c454b485d..ea580b4dc 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseError.cpp +++ b/Source/WebKit/chromium/src/WebIDBDatabaseError.cpp @@ -47,7 +47,7 @@ void WebIDBDatabaseError::assign(const WebIDBDatabaseError& value) void WebIDBDatabaseError::assign(unsigned short code, const WebString& message) { - m_private = IDBDatabaseError::createWithoutOffset(code, message); + m_private = IDBDatabaseError::create(code, message); } void WebIDBDatabaseError::reset() @@ -57,7 +57,7 @@ void WebIDBDatabaseError::reset() unsigned short WebIDBDatabaseError::code() const { - return m_private->code(); + return m_private->idbCode(); } WebString WebIDBDatabaseError::message() const diff --git a/Source/WebKit/chromium/src/WebInputElement.cpp b/Source/WebKit/chromium/src/WebInputElement.cpp index c58e90704..c1453de66 100644 --- a/Source/WebKit/chromium/src/WebInputElement.cpp +++ b/Source/WebKit/chromium/src/WebInputElement.cpp @@ -183,6 +183,11 @@ WebNodeCollection WebInputElement::dataListOptions() const return WebNodeCollection(); } +WebString WebInputElement::localizeValue(const WebString& proposedValue) const +{ + return constUnwrap<HTMLInputElement>()->localizeValue(proposedValue); +} + bool WebInputElement::isSpeechInputEnabled() const { #if ENABLE(INPUT_SPEECH) diff --git a/Source/WebKit/chromium/src/WebInputEventConversion.cpp b/Source/WebKit/chromium/src/WebInputEventConversion.cpp index a45cae102..58df5093b 100644 --- a/Source/WebKit/chromium/src/WebInputEventConversion.cpp +++ b/Source/WebKit/chromium/src/WebInputEventConversion.cpp @@ -441,7 +441,11 @@ WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) type = WebInputEvent::Char; else return; // Skip all other keyboard events. + modifiers = getWebInputModifiers(event); + if (event.keyLocation() & KeyboardEvent::DOM_KEY_LOCATION_NUMPAD) + modifiers |= WebInputEvent::IsKeyPad; + timeStampSeconds = event.timeStamp() / millisPerSecond; windowsKeyCode = event.keyCode(); diff --git a/Source/WebKit/chromium/src/WebLayer.cpp b/Source/WebKit/chromium/src/WebLayer.cpp index bd022b724..6b1029814 100644 --- a/Source/WebKit/chromium/src/WebLayer.cpp +++ b/Source/WebKit/chromium/src/WebLayer.cpp @@ -38,20 +38,21 @@ #include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { -TransformationMatrix transformationMatrixFromSkMatrix44(const SkMatrix44& matrix) +WebTransformationMatrix transformationMatrixFromSkMatrix44(const SkMatrix44& matrix) { double data[16]; matrix.asColMajord(data); - return TransformationMatrix(data[0], data[1], data[2], data[3], - data[4], data[5], data[6], data[7], - data[8], data[9], data[10], data[11], - data[12], data[13], data[14], data[15]); + return WebTransformationMatrix(data[0], data[1], data[2], data[3], + data[4], data[5], data[6], data[7], + data[8], data[9], data[10], data[11], + data[12], data[13], data[14], data[15]); } -SkMatrix44 skMatrix44FromTransformationMatrix(const TransformationMatrix& matrix) +SkMatrix44 skMatrix44FromTransformationMatrix(const WebTransformationMatrix& matrix) { SkMatrix44 skMatrix; skMatrix.set(0, 0, SkDoubleToMScalar(matrix.m11())); @@ -231,7 +232,7 @@ void WebLayer::setSublayerTransform(const SkMatrix44& matrix) void WebLayer::setSublayerTransform(const WebTransformationMatrix& matrix) { - m_private->setSublayerTransform(matrix.toWebCoreTransform()); + m_private->setSublayerTransform(matrix); } SkMatrix44 WebLayer::sublayerTransform() const @@ -246,7 +247,7 @@ void WebLayer::setTransform(const SkMatrix44& matrix) void WebLayer::setTransform(const WebTransformationMatrix& matrix) { - m_private->setTransform(matrix.toWebCoreTransform()); + m_private->setTransform(matrix); } SkMatrix44 WebLayer::transform() const diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index 2411d9c79..44e51cd87 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -593,11 +593,9 @@ unsigned WebMediaPlayerClientImpl::totalBytes() const return 0; } -unsigned WebMediaPlayerClientImpl::bytesLoaded() const +bool WebMediaPlayerClientImpl::didLoadingProgress() const { - if (m_webMediaPlayer) - return static_cast<unsigned>(m_webMediaPlayer->bytesLoaded()); - return 0; + return m_webMediaPlayer && m_webMediaPlayer->didLoadingProgress(); } void WebMediaPlayerClientImpl::setSize(const IntSize& size) diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h index 72170f750..0888d5eee 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h @@ -122,7 +122,7 @@ public: virtual int dataRate() const; virtual bool totalBytesKnown() const; virtual unsigned totalBytes() const; - virtual unsigned bytesLoaded() const; + virtual bool didLoadingProgress() const; virtual void setSize(const WebCore::IntSize&); virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); virtual void paintCurrentFrameInContext(WebCore::GraphicsContext*, const WebCore::IntRect&); diff --git a/Source/WebKit/chromium/src/WebNotification.cpp b/Source/WebKit/chromium/src/WebNotification.cpp index f6e981d3c..54209fd97 100644 --- a/Source/WebKit/chromium/src/WebNotification.cpp +++ b/Source/WebKit/chromium/src/WebNotification.cpp @@ -36,6 +36,7 @@ #include "Event.h" #include "Notification.h" #include "UserGestureIndicator.h" +#include "WindowFocusAllowedIndicator.h" #include "platform/WebString.h" #include "WebTextDirection.h" @@ -136,8 +137,8 @@ void WebNotification::dispatchCloseEvent(bool /* byUser */) void WebNotification::dispatchClickEvent() { - // Make sure clicks on notifications are treated as user gestures. UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); + WindowFocusAllowedIndicator windowFocusAllowed; dispatchEvent(eventNames().clickEvent); } diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp index ffb8c9bfe..c51fffbf7 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp @@ -118,6 +118,21 @@ void WebSettingsImpl::setDefaultDeviceScaleFactor(int defaultDeviceScaleFactor) m_settings->setDefaultDeviceScaleFactor(defaultDeviceScaleFactor); } +int WebSettingsImpl::defaultDeviceScaleFactor() +{ + return m_settings->defaultDeviceScaleFactor(); +} + +void WebSettingsImpl::setDeviceSupportsTouch(bool deviceSupportsTouch) +{ + m_settings->setDeviceSupportsTouch(deviceSupportsTouch); +} + +bool WebSettingsImpl::deviceSupportsTouch() +{ + return m_settings->deviceSupportsTouch(); +} + void WebSettingsImpl::setApplyDefaultDeviceScaleFactorInCompositor(bool applyDefaultDeviceScaleFactorInCompositor) { m_applyDefaultDeviceScaleFactorInCompositor = applyDefaultDeviceScaleFactorInCompositor; diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index 033784039..c28908441 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -55,9 +55,12 @@ public: virtual void setMinimumFontSize(int); virtual void setMinimumLogicalFontSize(int); virtual void setDefaultDeviceScaleFactor(int); + virtual int defaultDeviceScaleFactor(); virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool); virtual void setFontBoostingEnabled(bool); virtual void setDefaultTextEncodingName(const WebString&); + virtual void setDeviceSupportsTouch(bool); + virtual bool deviceSupportsTouch(); virtual void setJavaScriptEnabled(bool); virtual void setWebSecurityEnabled(bool); virtual void setJavaScriptCanOpenWindowsAutomatically(bool); diff --git a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp index d7a9be01c..b81ea578b 100644 --- a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp +++ b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp @@ -52,28 +52,14 @@ static Vector<TextCheckingResult> toCoreResults(const WebVector<WebTextCheckingR void WebTextCheckingCompletionImpl::didFinishCheckingText(const WebVector<WebTextCheckingResult>& results) { - if (m_spellChecker) { - m_spellChecker->didCheckSucceeded(m_identifier, toCoreResults(results)); - m_editorClient->didCheckString(this); - } - + m_request->didSucceed(toCoreResults(results)); delete this; } void WebTextCheckingCompletionImpl::didCancelCheckingText() { - if (m_spellChecker) { - m_spellChecker->didCheckCanceled(m_identifier); - m_editorClient->didCheckString(this); - } - + m_request->didCancel(); delete this; } -void WebTextCheckingCompletionImpl::invalidate() -{ - m_spellChecker = 0; - m_editorClient = 0; -} - } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h index 06e34addc..cd114132e 100644 --- a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h +++ b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h @@ -31,11 +31,9 @@ #ifndef WebTextCheckingCompletionImpl_h #define WebTextCheckingCompletionImpl_h +#include "TextChecking.h" #include "WebTextCheckingCompletion.h" - -namespace WebCore { -class SpellChecker; -} +#include <wtf/RefPtr.h> namespace WebKit { @@ -43,25 +41,18 @@ class EditorClientImpl; class WebTextCheckingCompletionImpl : public WebTextCheckingCompletion { public: - WebTextCheckingCompletionImpl(int identifier, WebCore::SpellChecker* spellchecker, EditorClientImpl* editorClient) - : m_identifier(identifier) - , m_spellChecker(spellchecker) - , m_editorClient(editorClient) + explicit WebTextCheckingCompletionImpl(WTF::PassRefPtr<WebCore::TextCheckingRequest> request) + : m_request(request) { } - virtual void didFinishCheckingText(const WebVector<WebTextCheckingResult>&); - virtual void didCancelCheckingText(); - - void invalidate(); - WebCore::SpellChecker* spellChecker() const { return m_spellChecker; } + virtual void didFinishCheckingText(const WebVector<WebTextCheckingResult>&) OVERRIDE; + virtual void didCancelCheckingText() OVERRIDE; private: virtual ~WebTextCheckingCompletionImpl() { } - int m_identifier; - WebCore::SpellChecker* m_spellChecker; - EditorClientImpl* m_editorClient; + WTF::RefPtr<WebCore::TextCheckingRequest> m_request; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index a8931b120..dacfa152e 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -1678,8 +1678,9 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) if (m_doingDragAndDrop) return true; + // Report the event to be NOT processed by WebKit, so that the browser can handle it appropriately. if (m_ignoreInputEvents) - return true; + return false; m_currentInputEvent = &inputEvent; @@ -2955,10 +2956,10 @@ void WebViewImpl::applyAutofillSuggestions( if (!m_autofillPopup) { PopupContainerSettings popupSettings = autofillPopupSettings; - popupSettings.defaultDeviceScaleFactor = - m_page->settings()->defaultDeviceScaleFactor(); + popupSettings.defaultDeviceScaleFactor = settingsImpl()->defaultDeviceScaleFactor(); if (!popupSettings.defaultDeviceScaleFactor) popupSettings.defaultDeviceScaleFactor = 1; + popupSettings.deviceSupportsTouch = settingsImpl()->deviceSupportsTouch(); m_autofillPopup = PopupContainer::create(m_autofillPopupClient.get(), PopupContainer::Suggestion, popupSettings); diff --git a/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp b/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp index b82ea52b3..72db521d5 100644 --- a/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp +++ b/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp @@ -79,6 +79,12 @@ void resetClickCountState() gLastClickButton = WebKit::WebMouseEvent::ButtonNone; } +bool isKeyPadKeyval(guint keyval) +{ + // Keypad keyvals all fall into one range. + return keyval >= GDK_KP_Space && keyval <= GDK_KP_9; +} + } // namespace namespace WebKit { @@ -365,7 +371,9 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(const GdkEventKey* event) result.setKeyIdentifierFromWindowsKeyCode(); - // FIXME: Do we need to set IsAutoRepeat or IsKeyPad? + // FIXME: Do we need to set IsAutoRepeat? + if (isKeyPadKeyval(event->keyval)) + result.modifiers |= WebInputEvent::IsKeyPad; return result; } diff --git a/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp b/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp index 36f79818e..0e8c1a401 100644 --- a/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp @@ -99,9 +99,9 @@ FakeTransformTransition::~FakeTransformTransition() { } -WebCore::TransformationMatrix FakeTransformTransition::getValue(double time, const WebCore::IntSize& size) const +WebKit::WebTransformationMatrix FakeTransformTransition::getValue(double time, const WebCore::IntSize& size) const { - return WebCore::TransformationMatrix(); + return WebKit::WebTransformationMatrix(); } PassOwnPtr<WebCore::CCAnimationCurve> FakeTransformTransition::clone() const diff --git a/Source/WebKit/chromium/tests/CCAnimationTestCommon.h b/Source/WebKit/chromium/tests/CCAnimationTestCommon.h index 776b75c8d..4384117d3 100644 --- a/Source/WebKit/chromium/tests/CCAnimationTestCommon.h +++ b/Source/WebKit/chromium/tests/CCAnimationTestCommon.h @@ -25,6 +25,7 @@ #ifndef CCAnimationTestCommon_h #define CCAnimationTestCommon_h +#include "IntSize.h" #include "cc/CCAnimationCurve.h" #include "cc/CCLayerAnimationController.h" @@ -53,7 +54,7 @@ public: virtual ~FakeTransformTransition(); virtual double duration() const OVERRIDE { return m_duration; } - virtual WebCore::TransformationMatrix getValue(double time, const WebCore::IntSize&) const OVERRIDE; + virtual WebKit::WebTransformationMatrix getValue(double time, const WebCore::IntSize&) const OVERRIDE; virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const OVERRIDE; @@ -86,13 +87,13 @@ public: 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 WebCore::TransformationMatrix& transform) OVERRIDE { m_transform = transform; } - virtual const WebCore::TransformationMatrix& transform() const OVERRIDE { return m_transform; } + virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix& transform) OVERRIDE { m_transform = transform; } + virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE { return m_transform; } virtual const WebCore::IntSize& bounds() const OVERRIDE { return m_bounds; } private: float m_opacity; - WebCore::TransformationMatrix m_transform; + WebKit::WebTransformationMatrix m_transform; WebCore::IntSize m_bounds; }; diff --git a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp index bbea971dd..56d85fafa 100644 --- a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp @@ -46,7 +46,7 @@ namespace { void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* root, Vector<CCLayerImpl*>& renderSurfaceLayerList) { CCLayerSorter layerSorter; - TransformationMatrix identityMatrix; + WebTransformationMatrix identityMatrix; Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; @@ -291,7 +291,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForTransformedLayer) OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); CCLayerImpl* child = root->children()[0].get(); - TransformationMatrix rotation; + WebTransformationMatrix rotation; rotation.rotate(45); // Note carefully, the anchor is actually part of layer->position(). By setting anchor @@ -332,7 +332,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForPerspectiveClippedLayer) OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); CCLayerImpl* child = root->children()[0].get(); - TransformationMatrix transform; + WebTransformationMatrix transform; transform.applyPerspective(1); transform.translate3d(-150, -50, 0); transform.rotate3d(0, 45, 0); @@ -789,7 +789,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica) OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(7); grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint::zero()); - TransformationMatrix reflection; + WebTransformationMatrix reflection; reflection.scale3d(-1.0, 1.0, 1.0); grandChild1Replica->setTransform(reflection); grandChild1->setReplicaLayer(grandChild1Replica.release()); @@ -928,7 +928,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6); grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint::zero()); - TransformationMatrix reflection; + WebTransformationMatrix reflection; reflection.scale3d(-1.0, 1.0, 1.0); grandChild1Replica->setTransform(reflection); grandChild1->setReplicaLayer(grandChild1Replica.release()); @@ -988,7 +988,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6); grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint::zero()); // note, this is not the anchor being tested. - TransformationMatrix reflection; + WebTransformationMatrix reflection; reflection.scale3d(-1.0, 1.0, 1.0); grandChild1Replica->setTransform(reflection); grandChild1->setReplicaLayer(grandChild1Replica.release()); diff --git a/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp b/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp index 15b554a06..ad1ae74ca 100644 --- a/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp +++ b/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp @@ -31,18 +31,18 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> #include <wtf/OwnPtr.h> #include <wtf/Vector.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { -void expectTranslateX(double translateX, const TransformationMatrix& matrix) +void expectTranslateX(double translateX, const WebTransformationMatrix& matrix) { - TransformationMatrix::DecomposedType decomposedType; - matrix.decompose(decomposedType); - EXPECT_FLOAT_EQ(translateX, decomposedType.translateX); + EXPECT_FLOAT_EQ(translateX, matrix.m41()); } // Tests that a float animation with one keyframe works as expected. @@ -191,10 +191,8 @@ TEST(CCKeyframedAnimationCurveTest, RepeatedTransformKeyTimes) expectTranslateX(4, curve->getValue(0.5, layerSize)); // There is a discontinuity at 1. Any value between 4 and 6 is valid. - TransformationMatrix value = curve->getValue(1, layerSize); - TransformationMatrix::DecomposedType decomposedType; - value.decompose(decomposedType); - EXPECT_TRUE(decomposedType.translateX >= 4 && decomposedType.translateX <= 6); + WebTransformationMatrix value = curve->getValue(1, layerSize); + EXPECT_TRUE(value.m41() >= 4 && value.m41() <= 6); expectTranslateX(6, curve->getValue(1.5, layerSize)); expectTranslateX(6, curve->getValue(2, layerSize)); diff --git a/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp b/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp index 827194bbc..dbed02c74 100644 --- a/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp @@ -35,18 +35,18 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> #include <wtf/Vector.h> using namespace WebCore; using namespace WebKitTests; +using WebKit::WebTransformationMatrix; namespace { -void expectTranslateX(double translateX, const TransformationMatrix& matrix) +void expectTranslateX(double translateX, const WebTransformationMatrix& matrix) { - TransformationMatrix::DecomposedType decomposedType; - matrix.decompose(decomposedType); - EXPECT_FLOAT_EQ(translateX, decomposedType.translateX); + EXPECT_FLOAT_EQ(translateX, matrix.m41()); } PassOwnPtr<CCActiveAnimation> createActiveAnimation(PassOwnPtr<CCAnimationCurve> curve, int id, CCActiveAnimation::TargetProperty property) diff --git a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp index f5259e1cf..827c9adaa 100644 --- a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp @@ -86,7 +86,7 @@ TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly) IntRect arbitraryIntRect = IntRect(arbitraryIntPoint, arbitraryIntSize); FloatRect arbitraryFloatRect = FloatRect(arbitraryFloatPoint, FloatSize(1.234f, 5.678f)); Color arbitraryColor = Color(10, 20, 30); - TransformationMatrix arbitraryTransform; + WebTransformationMatrix arbitraryTransform; arbitraryTransform.scale3d(0.1, 0.2, 0.3); WebFilterOperations arbitraryFilters; arbitraryFilters.append(WebFilterOperation::createOpacityFilter(0.5)); diff --git a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp index f5eae7f84..105c7186e 100644 --- a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp @@ -30,8 +30,10 @@ #include "cc/CCLayerTreeHostCommon.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; using ::testing::Mock; using ::testing::_; using ::testing::AtLeast; @@ -139,7 +141,7 @@ TEST(CCLayerIteratorTest, simpleTree) Vector<RefPtr<LayerChromium> > layerList; renderSurfaceLayerList.append(rootLayer.get()); CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer.get(), rootLayer.get(), - TransformationMatrix(), TransformationMatrix(), + WebTransformationMatrix(), WebTransformationMatrix(), renderSurfaceLayerList, layerList, 256); @@ -186,7 +188,7 @@ TEST(CCLayerIteratorTest, complexTree) Vector<RefPtr<LayerChromium> > layerList; renderSurfaceLayerList.append(rootLayer.get()); CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer.get(), rootLayer.get(), - TransformationMatrix(), TransformationMatrix(), + WebTransformationMatrix(), WebTransformationMatrix(), renderSurfaceLayerList, layerList, 256); @@ -245,7 +247,7 @@ TEST(CCLayerIteratorTest, complexTreeMultiSurface) Vector<RefPtr<LayerChromium> > layerList; renderSurfaceLayerList.append(rootLayer.get()); CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer.get(), rootLayer.get(), - TransformationMatrix(), TransformationMatrix(), + WebTransformationMatrix(), WebTransformationMatrix(), renderSurfaceLayerList, layerList, 256); diff --git a/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp b/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp index 65db549ba..d231e1259 100644 --- a/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp @@ -30,8 +30,10 @@ #include "cc/CCMathUtil.h" #include "cc/CCSingleThreadProxy.h" #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { @@ -46,11 +48,11 @@ TEST(CCLayerSorterTest, BasicOverlap) float weight = 0; // Trivial test, with one layer directly obscuring the other. - TransformationMatrix neg4Translate; + WebTransformationMatrix neg4Translate; neg4Translate.translate3d(0, 0, -4); CCLayerSorter::LayerShape front(2, 2, neg4Translate); - TransformationMatrix neg5Translate; + WebTransformationMatrix neg5Translate; neg5Translate.translate3d(0, 0, -5); CCLayerSorter::LayerShape back(2, 2, neg5Translate); @@ -63,7 +65,7 @@ TEST(CCLayerSorterTest, BasicOverlap) EXPECT_EQ(1, weight); // One layer translated off to the right. No overlap should be detected. - TransformationMatrix rightTranslate; + WebTransformationMatrix rightTranslate; rightTranslate.translate3d(10, 0, -5); CCLayerSorter::LayerShape backRight(2, 2, rightTranslate); overlapResult = CCLayerSorter::checkOverlap(&front, &backRight, zThreshold, weight); @@ -80,14 +82,15 @@ TEST(CCLayerSorterTest, RightAngleOverlap) const float zThreshold = 0.1f; float weight = 0; - TransformationMatrix perspectiveMatrix; + WebTransformationMatrix perspectiveMatrix; perspectiveMatrix.applyPerspective(1000); // Two layers forming a right angle with a perspective viewing transform. - TransformationMatrix leftFaceMatrix; - leftFaceMatrix.rotate3d(0, 1, 0, -90).translateRight3d(-1, 0, -5); + WebTransformationMatrix leftFaceMatrix; + leftFaceMatrix.rotate3d(0, 1, 0, -90); + leftFaceMatrix.translateRight3d(-1, 0, -5); CCLayerSorter::LayerShape leftFace(2, 2, perspectiveMatrix * leftFaceMatrix); - TransformationMatrix frontFaceMatrix; + WebTransformationMatrix frontFaceMatrix; frontFaceMatrix.translate3d(0, 0, -4); CCLayerSorter::LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix); @@ -101,17 +104,18 @@ TEST(CCLayerSorterTest, IntersectingLayerOverlap) const float zThreshold = 0.1f; float weight = 0; - TransformationMatrix perspectiveMatrix; + WebTransformationMatrix perspectiveMatrix; perspectiveMatrix.applyPerspective(1000); // Intersecting layers. An explicit order will be returned based on relative z // values at the overlapping features but the weight returned should be zero. - TransformationMatrix frontFaceMatrix; + WebTransformationMatrix frontFaceMatrix; frontFaceMatrix.translate3d(0, 0, -4); CCLayerSorter::LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix); - TransformationMatrix throughMatrix; - throughMatrix.rotate3d(0, 1, 0, 45).translateRight3d(0, 0, -4); + WebTransformationMatrix throughMatrix; + throughMatrix.rotate3d(0, 1, 0, 45); + throughMatrix.translateRight3d(0, 0, -4); CCLayerSorter::LayerShape rotatedFace(2, 2, perspectiveMatrix * throughMatrix); overlapResult = CCLayerSorter::checkOverlap(&frontFace, &rotatedFace, zThreshold, weight); EXPECT_NE(CCLayerSorter::None, overlapResult); @@ -136,15 +140,15 @@ TEST(CCLayerSorterTest, LayersAtAngleOverlap) // C is in front of A and behind B (not what you'd expect by comparing centers). // A and B don't overlap, so they're incomparable. - TransformationMatrix transformA; + WebTransformationMatrix transformA; transformA.translate3d(-6, 0, 1); CCLayerSorter::LayerShape layerA(8, 20, transformA); - TransformationMatrix transformB; + WebTransformationMatrix transformB; transformB.translate3d(6, 0, -1); CCLayerSorter::LayerShape layerB(8, 20, transformB); - TransformationMatrix transformC; + WebTransformationMatrix transformC; transformC.rotate3d(0, 1, 0, 40); CCLayerSorter::LayerShape layerC(8, 20, transformC); @@ -167,10 +171,10 @@ TEST(CCLayerSorterTest, LayersUnderPathologicalPerspectiveTransform) // where w < 0. If the code uses the invalid value, it will think that a layer has // different bounds than it really does, which can cause things to sort incorrectly. - TransformationMatrix perspectiveMatrix; + WebTransformationMatrix perspectiveMatrix; perspectiveMatrix.applyPerspective(1); - TransformationMatrix transformA; + WebTransformationMatrix transformA; transformA.translate3d(-15, 0, -2); CCLayerSorter::LayerShape layerA(10, 10, perspectiveMatrix * transformA); @@ -178,7 +182,7 @@ TEST(CCLayerSorterTest, LayersUnderPathologicalPerspectiveTransform) // visible on the left half of the projection plane, in front of layerA. When it is // not clipped, its bounds will actually incorrectly appear much smaller and the // correct sorting dependency will not be found. - TransformationMatrix transformB; + WebTransformationMatrix transformB; transformB.translate3d(0, 0, 0.7); transformB.rotate3d(0, 45, 0); CCLayerSorter::LayerShape layerB(10, 10, perspectiveMatrix * transformB); @@ -216,9 +220,9 @@ TEST(CCLayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) OwnPtr<CCLayerImpl> layer4 = CCLayerImpl::create(4); OwnPtr<CCLayerImpl> layer5 = CCLayerImpl::create(5); - TransformationMatrix BehindMatrix; + WebTransformationMatrix BehindMatrix; BehindMatrix.translate3d(0, 0, 2); - TransformationMatrix FrontMatrix; + WebTransformationMatrix FrontMatrix; FrontMatrix.translate3d(0, 0, 1); layer1->setBounds(IntSize(10, 10)); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp index 17e570199..fce9046c7 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp @@ -29,20 +29,21 @@ #include "CCAnimationTestCommon.h" #include "CCLayerTreeTestCommon.h" #include "LayerChromium.h" -#include "TransformationMatrix.h" #include "TranslateTransformOperation.h" #include "cc/CCLayerAnimationController.h" #include "cc/CCMathUtil.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; using namespace WebKitTests; +using WebKit::WebTransformationMatrix; namespace { -void setLayerPropertiesForTesting(LayerChromium* layer, const TransformationMatrix& transform, const TransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D) +void setLayerPropertiesForTesting(LayerChromium* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D) { layer->setTransform(transform); layer->setSublayerTransform(sublayerTransform); @@ -54,16 +55,16 @@ void setLayerPropertiesForTesting(LayerChromium* layer, const TransformationMatr void executeCalculateDrawTransformsAndVisibility(LayerChromium* rootLayer) { - TransformationMatrix identityMatrix; + WebTransformationMatrix identityMatrix; Vector<RefPtr<LayerChromium> > dummyRenderSurfaceLayerList; Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer, rootLayer, identityMatrix, identityMatrix, dummyRenderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); } -TransformationMatrix remove3DComponentOfMatrix(const TransformationMatrix& mat) +WebTransformationMatrix remove3DComponentOfMatrix(const WebTransformationMatrix& mat) { - TransformationMatrix ret = mat; + WebTransformationMatrix ret = mat; ret.setM13(0); ret.setM23(0); ret.setM31(0); @@ -98,7 +99,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForNoOpLayer) parent->addChild(child); child->addChild(grandChild); - TransformationMatrix identityMatrix; + WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(0, 0), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(0, 0), false); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(0, 0), false); @@ -120,12 +121,12 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) // value of LayerChromium::position() changes if the anchor changes, even though the layer is not actually located in a // different position. When we initialize layers for testing here, we need to initialize that unintutive position value. - TransformationMatrix identityMatrix; + WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> layer = LayerChromium::create(); layer->createRenderSurface(); // Case 1: setting the sublayer transform should not affect this layer's draw transform or screen-space transform. - TransformationMatrix arbitraryTranslation; + WebTransformationMatrix arbitraryTranslation; arbitraryTranslation.translate(10.0, 20.0); setLayerPropertiesForTesting(layer.get(), identityMatrix, arbitraryTranslation, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(0, 0), false); executeCalculateDrawTransformsAndVisibility(layer.get()); @@ -134,7 +135,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) // Case 2: setting the bounds of the layer should result in a draw transform that translates to half the width and height. // The screen-space transform should remain as the identity, because it does not deal with transforming to/from the center of the layer. - TransformationMatrix translationToCenter; + WebTransformationMatrix translationToCenter; translationToCenter.translate(5.0, 6.0); setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); @@ -148,7 +149,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform()); // Case 4: A change in "actual" position affects both the draw transform and screen space transform. - TransformationMatrix positionTransform; + WebTransformationMatrix positionTransform; positionTransform.translate(0.0, 1.2); setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 4.2f), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); @@ -157,7 +158,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) // Case 5: In the correct sequence of transforms, the layer transform should pre-multiply the translationToCenter. This is easily tested by // using a scale transform, because scale and translation are not commutative. - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.scale3d(2.0, 2.0, 1.0); setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); @@ -165,9 +166,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform, layer->screenSpaceTransform()); // Case 6: The layer transform should occur with respect to the anchor point. - TransformationMatrix translationToAnchor; + WebTransformationMatrix translationToAnchor; translationToAnchor.translate(5.0, 0.0); - TransformationMatrix expectedResult = translationToAnchor * layerTransform * translationToAnchor.inverse(); + WebTransformationMatrix expectedResult = translationToAnchor * layerTransform * translationToAnchor.inverse(); setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5f, 0.0f), FloatPoint(5.0f, 0.0f), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult * translationToCenter, layer->drawTransform()); @@ -185,7 +186,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) { - TransformationMatrix identityMatrix; + WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild = LayerChromium::create(); @@ -194,7 +195,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) child->addChild(grandChild); // Case 1: parent's anchorPoint should not affect child or grandChild. - TransformationMatrix childTranslationToCenter, grandChildTranslationToCenter; + WebTransformationMatrix childTranslationToCenter, grandChildTranslationToCenter; childTranslationToCenter.translate(8.0, 9.0); grandChildTranslationToCenter.translate(38.0, 39.0); setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 3.0f), IntSize(10, 12), false); @@ -207,7 +208,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->screenSpaceTransform()); // Case 2: parent's position affects child and grandChild. - TransformationMatrix parentPositionTransform; + WebTransformationMatrix parentPositionTransform; parentPositionTransform.translate(0.0, 1.2); setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 4.2f), IntSize(10, 12), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(16, 18), false); @@ -219,11 +220,11 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, grandChild->screenSpaceTransform()); // Case 3: parent's local transform affects child and grandchild - TransformationMatrix parentLayerTransform; + WebTransformationMatrix parentLayerTransform; parentLayerTransform.scale3d(2.0, 2.0, 1.0); - TransformationMatrix parentTranslationToAnchor; + WebTransformationMatrix parentTranslationToAnchor; parentTranslationToAnchor.translate(2.5, 3.0); - TransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse(); + WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse(); setLayerPropertiesForTesting(parent.get(), parentLayerTransform, identityMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 3.0f), IntSize(10, 12), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(16, 18), false); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(76, 78), false); @@ -237,14 +238,14 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) // scaling is used here again so that the correct sequence of transforms is properly tested. // Note that preserves3D is false, but the sublayer matrix should retain its 3D properties when given to child. // But then, the child also does not preserve3D. When it gives its hierarchy to the grandChild, it should be flattened to 2D. - TransformationMatrix parentSublayerMatrix; + WebTransformationMatrix parentSublayerMatrix; parentSublayerMatrix.scale3d(10.0, 10.0, 3.3); - TransformationMatrix parentTranslationToCenter; + WebTransformationMatrix parentTranslationToCenter; parentTranslationToCenter.translate(5.0, 6.0); // Sublayer matrix is applied to the center of the parent layer. parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse(); - TransformationMatrix flattenedCompositeTransform = remove3DComponentOfMatrix(parentCompositeTransform); + WebTransformationMatrix flattenedCompositeTransform = remove3DComponentOfMatrix(parentCompositeTransform); setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 3.0f), IntSize(10, 12), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(16, 18), false); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(76, 78), false); @@ -278,18 +279,18 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) // Child is set up so that a new render surface should be created. child->setOpacity(0.5f); - TransformationMatrix identityMatrix; - TransformationMatrix parentLayerTransform; + WebTransformationMatrix identityMatrix; + WebTransformationMatrix parentLayerTransform; parentLayerTransform.scale3d(2.0, 2.0, 1.0); - TransformationMatrix parentTranslationToAnchor; + WebTransformationMatrix parentTranslationToAnchor; parentTranslationToAnchor.translate(2.5, 3.0); - TransformationMatrix parentSublayerMatrix; + WebTransformationMatrix parentSublayerMatrix; parentSublayerMatrix.scale3d(10.0, 10.0, 3.3); - TransformationMatrix parentTranslationToCenter; + WebTransformationMatrix parentTranslationToCenter; parentTranslationToCenter.translate(5.0, 6.0); - TransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() + WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse(); - TransformationMatrix childTranslationToCenter; + WebTransformationMatrix childTranslationToCenter; childTranslationToCenter.translate(8.0, 9.0); // Child's render surface should not exist yet. @@ -331,22 +332,22 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForReplica) // Child is set up so that a new render surface should be created. child->setOpacity(0.5f); - TransformationMatrix identityMatrix; - TransformationMatrix parentLayerTransform; + WebTransformationMatrix identityMatrix; + WebTransformationMatrix parentLayerTransform; parentLayerTransform.scale3d(2.0, 2.0, 1.0); - TransformationMatrix parentTranslationToAnchor; + WebTransformationMatrix parentTranslationToAnchor; parentTranslationToAnchor.translate(2.5, 3.0); - TransformationMatrix parentSublayerMatrix; + WebTransformationMatrix parentSublayerMatrix; parentSublayerMatrix.scale3d(10.0, 10.0, 3.3); - TransformationMatrix parentTranslationToCenter; + WebTransformationMatrix parentTranslationToCenter; parentTranslationToCenter.translate(5.0, 6.0); - TransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() + WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse(); - TransformationMatrix childTranslationToCenter; + WebTransformationMatrix childTranslationToCenter; childTranslationToCenter.translate(8.0, 9.0); - TransformationMatrix replicaLayerTransform; + WebTransformationMatrix replicaLayerTransform; replicaLayerTransform.scale3d(3.0, 3.0, 1.0); - TransformationMatrix replicaCompositeTransform = parentCompositeTransform * replicaLayerTransform; + WebTransformationMatrix replicaCompositeTransform = parentCompositeTransform * replicaLayerTransform; // Child's render surface should not exist yet. ASSERT_FALSE(child->renderSurface()); @@ -408,20 +409,20 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) // // x component tests that layerTransform and sublayerTransform are done in the right order (translation and scale are noncommutative). // y component has a translation by 1.0 for every ancestor, which indicates the "depth" of the layer in the hierarchy. - TransformationMatrix translationToAnchor; + WebTransformationMatrix translationToAnchor; translationToAnchor.translate(2.5, 0.0); - TransformationMatrix translationToCenter; + WebTransformationMatrix translationToCenter; translationToCenter.translate(5.0, 5.0); - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.translate(1.0, 1.0); - TransformationMatrix sublayerTransform; + WebTransformationMatrix sublayerTransform; sublayerTransform.scale3d(10.0, 1.0, 1.0); - TransformationMatrix replicaLayerTransform; + WebTransformationMatrix replicaLayerTransform; replicaLayerTransform.scale3d(-2.0, 5.0, 1.0); - TransformationMatrix A = translationToAnchor * layerTransform * translationToAnchor.inverse(); - TransformationMatrix B = translationToCenter * sublayerTransform * translationToCenter.inverse(); - TransformationMatrix R = A * translationToAnchor * replicaLayerTransform * translationToAnchor.inverse(); + WebTransformationMatrix A = translationToAnchor * layerTransform * translationToAnchor.inverse(); + WebTransformationMatrix B = translationToCenter * sublayerTransform * translationToCenter.inverse(); + WebTransformationMatrix R = A * translationToAnchor * replicaLayerTransform * translationToAnchor.inverse(); setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false); @@ -531,7 +532,7 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForClipLayer) RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); renderSurface1->setOpacity(0.9f); - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint(30, 30), IntSize(10, 10), false); @@ -560,7 +561,7 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); renderSurface1->setOpacity(0); - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); @@ -588,7 +589,7 @@ TEST(CCLayerTreeHostCommonTest, verifyForceRenderSurface) RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); renderSurface1->setForceRenderSurface(true); - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); @@ -628,7 +629,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces) // clipRect, and they should never get scheduled on the list of renderSurfaces. // - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild = LayerChromium::create(); @@ -677,7 +678,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfacesCrashRepro) // This is a similar situation as verifyClipRectCullsRenderSurfaces, except that // it reproduces a crash bug http://code.google.com/p/chromium/issues/detail?id=106734. - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild = LayerChromium::create(); @@ -749,7 +750,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) // this clipping should be avoided and we should keep the grandChild // in the renderSurfaceLayerList. - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild = LayerChromium::create(); @@ -813,7 +814,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToLayers) // grandChild4 - outside parent's clipRect, and masksToBounds; the clipRect should be empty. // - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild1 = LayerChromium::create(); @@ -871,7 +872,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) // have a clipRect of their own layer bounds, however, if masksToBounds was true. // - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild1 = LayerChromium::create(); @@ -972,9 +973,9 @@ TEST(CCLayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy) // Also put an animated opacity on a layer without descendants. addOpacityTransitionToController(*grandChildOfRoot->layerAnimationController(), 10, 1, 0, false); - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.translate(1.0, 1.0); - TransformationMatrix sublayerTransform; + WebTransformationMatrix sublayerTransform; sublayerTransform.scale3d(10.0, 1.0, 1.0); // In combination with descendantDrawsContent and masksToBounds, an animated transform forces the layer to have a new renderSurface. @@ -1089,7 +1090,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForIdentityTransform) // Test the calculateVisibleRect() function works correctly for identity transforms. IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // Case 1: Layer is contained within the surface. IntRect layerContentRect = IntRect(IntPoint(10, 10), IntSize(30, 30)); @@ -1115,7 +1116,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForTranslations) IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(30, 30)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // Case 1: Layer is contained within the surface. layerToSurfaceTransform.makeIdentity(); @@ -1145,7 +1146,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor2DRotations) IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(30, 30)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // Case 1: Layer is contained within the surface. layerToSurfaceTransform.makeIdentity(); @@ -1192,7 +1193,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform) IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // Case 1: Orthographic projection of a layer rotated about y-axis by 45 degrees, should be fully contained in the renderSurface. layerToSurfaceTransform.makeIdentity(); @@ -1220,7 +1221,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform) IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(-50, -50), IntSize(200, 200)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // Case 1: Even though the layer is twice as large as the surface, due to perspective // foreshortening, the layer will fit fully in the surface when its translated @@ -1262,7 +1263,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBe IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(100, 100)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // This sequence of transforms effectively rotates the layer about the y-axis at the // center of the layer. @@ -1286,7 +1287,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW) IntRect targetSurfaceRect = IntRect(IntPoint(-50, -50), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(-10, -1), IntSize(20, 2)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; // The layer is positioned so that the right half of the layer should be in front of // the camera, while the other half is behind the surface's projection plane. The @@ -1294,7 +1295,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW) // center of the layer. layerToSurfaceTransform.makeIdentity(); layerToSurfaceTransform.applyPerspective(1); - layerToSurfaceTransform.translate3d(-1, 0, 1); + layerToSurfaceTransform.translate3d(-2, 0, 1); layerToSurfaceTransform.rotate3d(0, 45, 0); // Sanity check that this transform does indeed cause w < 0 when applying the @@ -1320,7 +1321,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForPerspectiveUnprojection) // This sequence of transforms causes one corner of the layer to protrude across the w = 0 plane, and should be clipped. IntRect targetSurfaceRect = IntRect(IntPoint(-50, -50), IntSize(100, 100)); IntRect layerContentRect = IntRect(IntPoint(-10, -10), IntSize(20, 20)); - TransformationMatrix layerToSurfaceTransform; + WebTransformationMatrix layerToSurfaceTransform; layerToSurfaceTransform.makeIdentity(); layerToSurfaceTransform.applyPerspective(1); layerToSurfaceTransform.translate3d(0, 0, -5); @@ -1348,7 +1349,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) // that 3d transforms still apply in this case, but they are "flattened" to each // parent layer according to current W3C spec. - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); @@ -1379,7 +1380,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) frontFacingChildOfBackFacingSurface->setDoubleSided(false); backFacingChildOfBackFacingSurface->setDoubleSided(false); - TransformationMatrix backfaceMatrix; + WebTransformationMatrix backfaceMatrix; backfaceMatrix.translate(50, 50); backfaceMatrix.rotate3d(0, 1, 0, 180); backfaceMatrix.translate(-50, -50); @@ -1446,7 +1447,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d) { // Verify the behavior of back-face culling when preserves-3d transform style is used. - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); @@ -1479,7 +1480,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d) frontFacingChildOfBackFacingSurface->setDoubleSided(false); backFacingChildOfBackFacingSurface->setDoubleSided(false); - TransformationMatrix backfaceMatrix; + WebTransformationMatrix backfaceMatrix; backfaceMatrix.translate(50, 50); backfaceMatrix.rotate3d(0, 1, 0, 180); backfaceMatrix.translate(-50, -50); @@ -1549,7 +1550,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) // treated as "unknown" so we can not be sure that their back face is really showing. // - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> animatingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); @@ -1571,7 +1572,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) childOfAnimatingSurface->setDoubleSided(false); animatingChild->setDoubleSided(false); - TransformationMatrix backfaceMatrix; + WebTransformationMatrix backfaceMatrix; backfaceMatrix.translate(50, 50); backfaceMatrix.rotate3d(0, 1, 0, 180); backfaceMatrix.translate(-50, -50); @@ -1634,7 +1635,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin // Verify the behavior of back-face culling for a renderSurface that is created // when it flattens its subtree, and its parent has preserves-3d. - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> backFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); @@ -1651,7 +1652,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin frontFacingSurface->setDoubleSided(false); backFacingSurface->setDoubleSided(false); - TransformationMatrix backfaceMatrix; + WebTransformationMatrix backfaceMatrix; backfaceMatrix.translate(50, 50); backfaceMatrix.rotate3d(0, 1, 0, 180); backfaceMatrix.translate(-50, -50); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp index 1275ec854..b996006ae 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp @@ -32,6 +32,7 @@ #include "CCTiledLayerTestCommon.h" #include "CompositorFakeWebGraphicsContext3D.h" #include "ContentLayerChromium.h" +#include "FakeWebGraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" #include "LayerChromium.h" #include "TextureManager.h" @@ -43,6 +44,7 @@ #include "cc/CCLayerImpl.h" #include "cc/CCLayerTreeHostImpl.h" #include "cc/CCScopedThreadProxy.h" +#include "cc/CCSingleThreadProxy.h" #include "cc/CCTextureUpdater.h" #include "cc/CCThreadTask.h" #include "cc/CCTimingFunction.h" @@ -71,6 +73,52 @@ using namespace WTF; namespace { +class CompositorFakeWebGraphicsContext3DWithTextureTracking : public CompositorFakeWebGraphicsContext3D { +public: + static PassOwnPtr<CompositorFakeWebGraphicsContext3DWithTextureTracking> create(Attributes attrs) + { + return adoptPtr(new CompositorFakeWebGraphicsContext3DWithTextureTracking(attrs)); + } + + virtual WebGLId createTexture() + { + WebGLId texture = m_textures.size() + 1; + m_textures.append(texture); + return texture; + } + + virtual void deleteTexture(WebGLId texture) + { + for (size_t i = 0; i < m_textures.size(); i++) { + if (m_textures[i] == texture) { + m_textures.remove(i); + break; + } + } + } + + virtual void bindTexture(WGC3Denum /* target */, WebGLId texture) + { + m_usedTextures.add(texture); + } + + int numTextures() const { return static_cast<int>(m_textures.size()); } + int texture(int i) const { return m_textures[i]; } + void resetTextures() { m_textures.clear(); } + + int numUsedTextures() const { return static_cast<int>(m_usedTextures.size()); } + bool usedTexture(int texture) const { return m_usedTextures.find(texture) != m_usedTextures.end(); } + void resetUsedTextures() { m_usedTextures.clear(); } + +private: + explicit CompositorFakeWebGraphicsContext3DWithTextureTracking(Attributes attrs) : CompositorFakeWebGraphicsContext3D(attrs) + { + } + + Vector<WebGLId> m_textures; + HashSet<WebGLId, DefaultHash<WebGLId>::Hash, UnsignedWithZeroKeyHashTraits<WebGLId> > m_usedTextures; +}; + // Used by test stubs to notify the test when something interesting happens. class TestHooks : public CCLayerAnimationDelegate { public: @@ -83,7 +131,7 @@ public: virtual void applyScrollAndScale(const IntSize&, float) { } virtual void updateAnimations(double monotonicTime) { } virtual void layout() { } - virtual void didRecreateContext(bool succeded) { } + virtual void didRecreateContext(bool succeeded) { } virtual void didCommit() { } virtual void didCommitAndDrawFrame() { } virtual void scheduleComposite() { } @@ -91,6 +139,16 @@ public: // Implementation of CCLayerAnimationDelegate virtual void notifyAnimationStarted(double time) { } virtual void notifyAnimationFinished(double time) { } + + virtual PassRefPtr<GraphicsContext3D> createContext() + { + GraphicsContext3D::Attributes attrs; + WebGraphicsContext3D::Attributes webAttrs; + webAttrs.alpha = attrs.alpha; + + OwnPtr<WebGraphicsContext3D> webContext = CompositorFakeWebGraphicsContext3DWithTextureTracking::create(webAttrs); + return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow); + } }; // Adapts CCLayerTreeHostImpl for test. Runs real code, then invokes test hooks. @@ -206,52 +264,6 @@ private: bool m_didAddAnimationWasCalled; }; -class CompositorFakeWebGraphicsContext3DWithTextureTracking : public CompositorFakeWebGraphicsContext3D { -public: - static PassOwnPtr<CompositorFakeWebGraphicsContext3DWithTextureTracking> create(Attributes attrs) - { - return adoptPtr(new CompositorFakeWebGraphicsContext3DWithTextureTracking(attrs)); - } - - virtual WebGLId createTexture() - { - WebGLId texture = m_textures.size() + 1; - m_textures.append(texture); - return texture; - } - - virtual void deleteTexture(WebGLId texture) - { - for (size_t i = 0; i < m_textures.size(); i++) { - if (m_textures[i] == texture) { - m_textures.remove(i); - break; - } - } - } - - virtual void bindTexture(WGC3Denum /* target */, WebGLId texture) - { - m_usedTextures.add(texture); - } - - int numTextures() const { return static_cast<int>(m_textures.size()); } - int texture(int i) const { return m_textures[i]; } - void resetTextures() { m_textures.clear(); } - - int numUsedTextures() const { return static_cast<int>(m_usedTextures.size()); } - bool usedTexture(int texture) const { return m_usedTextures.find(texture) != m_usedTextures.end(); } - void resetUsedTextures() { m_usedTextures.clear(); } - -private: - explicit CompositorFakeWebGraphicsContext3DWithTextureTracking(Attributes attrs) : CompositorFakeWebGraphicsContext3D(attrs) - { - } - - Vector<WebGLId> m_textures; - HashSet<WebGLId, DefaultHash<WebGLId>::Hash, UnsignedWithZeroKeyHashTraits<WebGLId> > m_usedTextures; -}; - // Implementation of CCLayerTreeHost callback interface. class MockLayerTreeHostClient : public CCLayerTreeHostClient { public: @@ -285,12 +297,7 @@ public: virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE { - GraphicsContext3D::Attributes attrs; - WebGraphicsContext3D::Attributes webAttrs; - webAttrs.alpha = attrs.alpha; - - OwnPtr<WebGraphicsContext3D> webContext = CompositorFakeWebGraphicsContext3DWithTextureTracking::create(webAttrs); - return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow); + return m_testHooks->createContext(); } virtual void willCommit() OVERRIDE @@ -343,6 +350,7 @@ public: virtual void beginTest() = 0; void endTest(); + void endTestAfterDelay(int delayMilliseconds); void postSetNeedsAnimateToMainThread() { @@ -395,6 +403,11 @@ public: m_timeoutTask = 0; } + void clearEndTestTask() + { + m_endTestTask = 0; + } + CCLayerTreeHost* layerTreeHost() { return m_layerTreeHost.get(); } @@ -406,6 +419,7 @@ protected: , m_finished(false) , m_scheduled(false) , m_started(false) + , m_endTestTask(0) { } void doBeginTest(); @@ -597,6 +611,34 @@ protected: CCLayerTreeHostTest* m_test; }; + class EndTestTask : public WebThread::Task { + public: + explicit EndTestTask(CCLayerTreeHostTest* test) + : m_test(test) + { + } + + virtual ~EndTestTask() + { + if (m_test) + m_test->clearEndTestTask(); + } + + void clearTest() + { + m_test = 0; + } + + virtual void run() + { + if (m_test) + m_test->endTest(); + } + + private: + CCLayerTreeHostTest* m_test; + }; + virtual void runTest(bool threaded) { if (threaded) { @@ -621,6 +663,9 @@ protected: if (m_timeoutTask) m_timeoutTask->clearTest(); + if (m_endTestTask) + m_endTestTask->clearTest(); + ASSERT_FALSE(m_layerTreeHost.get()); m_client.clear(); if (m_timedOut) { @@ -648,6 +693,7 @@ private: RefPtr<CCScopedThreadProxy> m_mainThreadProxy; TimeoutTask* m_timeoutTask; BeginTask* m_beginTask; + EndTestTask* m_endTestTask; }; void CCLayerTreeHostTest::doBeginTest() @@ -686,6 +732,17 @@ void CCLayerTreeHostTest::endTest() } } +void CCLayerTreeHostTest::endTestAfterDelay(int delayMilliseconds) +{ + // If we are called from the CCThread, re-call endTest on the main thread. + if (!isMainThread()) + m_mainThreadProxy->postTask(createCCThreadTask(this, &CCLayerTreeHostTest::endTestAfterDelay, delayMilliseconds)); + else { + m_endTestTask = new EndTestTask(this); + WebKit::Platform::current()->currentThread()->postDelayedTask(m_endTestTask, delayMilliseconds); + } +} + class CCLayerTreeHostTestThreadOnly : public CCLayerTreeHostTest { public: void runTestThreaded() @@ -1389,6 +1446,56 @@ private: SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestSynchronizeAnimationStartTimes) +class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D { +public: + virtual bool makeContextCurrent() { return false; } +}; + +// Ensures that we do not animate +class CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation : public CCLayerTreeHostTest { +public: + CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation() + { + } + + virtual void beginTest() + { + // This will cause the animation timer to be set which will fire in + // CCSingleThreadProxy::animationTimerDelay() seconds. + postAddAnimationToMainThread(); + } + + virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) + { + ASSERT_NOT_REACHED(); + } + + virtual void didRecreateContext(bool succeeded) + { + EXPECT_FALSE(succeeded); + + // Make sure we wait CCSingleThreadProxy::animationTimerDelay() seconds + // (use ceil just to be sure). If the timer was not disabled, we will + // attempt to call CCSingleThreadProxy::compositeImmediately and the + // test will fail. + endTestAfterDelay(ceil(CCSingleThreadProxy::animationTimerDelay() * 1000)); + } + + virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE + { + return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow); + } + + virtual void afterTest() + { + } +}; + +TEST_F(CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation, runSingleThread) +{ + runTest(false); +} + // Ensures that main thread animations have their start times synchronized with impl thread animations. class CCLayerTreeHostTestAnimationFinishedEvents : public CCLayerTreeHostTestThreadOnly { public: @@ -1985,21 +2092,21 @@ public: // The root render surface is the size of the viewport. EXPECT_EQ_RECT(IntRect(0, 0, 60, 60), root->renderSurface()->contentRect()); - TransformationMatrix scaleTransform; + WebTransformationMatrix scaleTransform; scaleTransform.scale(impl->settings().deviceScaleFactor); // The root layer is scaled by 2x. - TransformationMatrix rootScreenSpaceTransform = scaleTransform; - TransformationMatrix rootDrawTransform = scaleTransform; + WebTransformationMatrix rootScreenSpaceTransform = scaleTransform; + WebTransformationMatrix rootDrawTransform = scaleTransform; rootDrawTransform.translate(root->bounds().width() * 0.5, root->bounds().height() * 0.5); 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. - TransformationMatrix childScreenSpaceTransform = scaleTransform; + WebTransformationMatrix childScreenSpaceTransform = scaleTransform; childScreenSpaceTransform.translate(2, 2); - TransformationMatrix childDrawTransform = scaleTransform; + WebTransformationMatrix childDrawTransform = scaleTransform; childDrawTransform.translate(2, 2); childDrawTransform.translate(child->bounds().width() * 0.5, child->bounds().height() * 0.5); @@ -2113,7 +2220,7 @@ TEST_F(CCLayerTreeHostTestAtomicCommit, runMultiThread) runTest(true); } -static void setLayerPropertiesForTesting(LayerChromium* layer, LayerChromium* parent, const TransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque) +static void setLayerPropertiesForTesting(LayerChromium* layer, LayerChromium* parent, const WebTransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque) { layer->removeAllChildren(); if (parent) @@ -2141,7 +2248,7 @@ public: m_layerTreeHost->setRootLayer(m_parent); m_layerTreeHost->setViewportSize(IntSize(10, 20)); - TransformationMatrix identityMatrix; + WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 20), true); setLayerPropertiesForTesting(m_child.get(), m_parent.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 10), IntSize(10, 10), false); @@ -2301,7 +2408,7 @@ private: Region m_occludedScreenSpace; }; -static void setTestLayerPropertiesForTesting(TestLayerChromium* layer, LayerChromium* parent, const TransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque) +static void setTestLayerPropertiesForTesting(TestLayerChromium* layer, LayerChromium* parent, const WebTransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque) { setLayerPropertiesForTesting(layer, parent, transform, anchor, position, bounds, opaque); layer->clearOccludedScreenSpace(); @@ -2319,8 +2426,8 @@ public: RefPtr<TestLayerChromium> grandChild = TestLayerChromium::create(); RefPtr<TestLayerChromium> mask = TestLayerChromium::create(); - TransformationMatrix identityMatrix; - TransformationMatrix childTransform; + WebTransformationMatrix identityMatrix; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(90); childTransform.translate(-250, -250); @@ -2521,8 +2628,8 @@ public: RefPtr<TestLayerChromium> grandChild = TestLayerChromium::create(); RefPtr<TestLayerChromium> mask = TestLayerChromium::create(); - TransformationMatrix identityMatrix; - TransformationMatrix childTransform; + WebTransformationMatrix identityMatrix; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(90); childTransform.translate(-250, -250); @@ -2607,7 +2714,7 @@ public: { // We create enough RenderSurfaces that it will trigger Vector reallocation while computing occlusion. Region occluded; - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; Vector<RefPtr<TestLayerChromium> > layers; Vector<RefPtr<TestLayerChromium> > children; int numSurfaces = 20; diff --git a/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h b/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h index 75e487a4a..5c01c8049 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h +++ b/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h @@ -41,7 +41,7 @@ namespace WebKitTests { EXPECT_EQ((expected).size().height(), (actual).size().height()) // This is a macro instead of a function so that we get useful line numbers where a test failed. -// Even though TransformationMatrix values are double precision, there are many other floating-point values used that affect +// Even though WebTransformationMatrix values are double precision, there are many other floating-point values used that affect // the transforms, and so we only expect them to be accurate up to floating-point precision. #define EXPECT_TRANSFORMATION_MATRIX_EQ(expected, actual) \ EXPECT_FLOAT_EQ((expected).m11(), (actual).m11()); \ diff --git a/Source/WebKit/chromium/tests/CCMathUtilTest.cpp b/Source/WebKit/chromium/tests/CCMathUtilTest.cpp index 3909677a5..44a68b9eb 100644 --- a/Source/WebKit/chromium/tests/CCMathUtilTest.cpp +++ b/Source/WebKit/chromium/tests/CCMathUtilTest.cpp @@ -26,18 +26,20 @@ #include "cc/CCMathUtil.h" -#include "TransformationMatrix.h" - +#include "CCLayerTreeTestCommon.h" +#include "FloatRect.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { TEST(CCMathUtilTest, verifyBackfaceVisibilityBasicCases) { - TransformationMatrix transform; + WebTransformationMatrix transform; transform.makeIdentity(); EXPECT_FALSE(transform.isBackFaceVisible()); @@ -58,7 +60,7 @@ TEST(CCMathUtilTest, verifyBackfaceVisibilityBasicCases) TEST(CCMathUtilTest, verifyBackfaceVisibilityForPerspective) { - TransformationMatrix layerSpaceToProjectionPlane; + WebTransformationMatrix layerSpaceToProjectionPlane; // This tests if isBackFaceVisible works properly under perspective transforms. // Specifically, layers that may have their back face visible in orthographic @@ -104,7 +106,7 @@ TEST(CCMathUtilTest, verifyProjectionOfPerpendicularPlane) // In this case, the m33() element of the transform becomes zero, which could cause a // divide-by-zero when projecting points/quads. - TransformationMatrix transform; + WebTransformationMatrix transform; transform.makeIdentity(); transform.setM33(0); @@ -116,4 +118,38 @@ TEST(CCMathUtilTest, verifyProjectionOfPerpendicularPlane) EXPECT_TRUE(projectedRect.isEmpty()); } +TEST(CCMathUtilTest, verifyEnclosingClippedRectUsesCorrectInitialBounds) +{ + HomogeneousCoordinate h1(-100, -100, 0, 1); + HomogeneousCoordinate h2(-10, -10, 0, 1); + HomogeneousCoordinate h3(10, 10, 0, -1); + HomogeneousCoordinate h4(100, 100, 0, -1); + + // The bounds of the enclosing clipped rect should be -100 to -10 for both x and y. + // However, if there is a bug where the initial xmin/xmax/ymin/ymax are initialized to + // numeric_limits<float>::min() (which is zero, not -flt_max) then the enclosing + // clipped rect will be computed incorrectly. + FloatRect result = CCMathUtil::computeEnclosingClippedRect(h1, h2, h3, h4); + + EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(-100, -100), FloatSize(90, 90)), result); +} + +TEST(CCMathUtilTest, verifyEnclosingRectOfVerticesUsesCorrectInitialBounds) +{ + FloatPoint vertices[3]; + int numVertices = 3; + + vertices[0] = FloatPoint(-10, -100); + vertices[1] = FloatPoint(-100, -10); + vertices[2] = FloatPoint(-30, -30); + + // The bounds of the enclosing rect should be -100 to -10 for both x and y. However, + // if there is a bug where the initial xmin/xmax/ymin/ymax are initialized to + // numeric_limits<float>::min() (which is zero, not -flt_max) then the enclosing + // clipped rect will be computed incorrectly. + FloatRect result = CCMathUtil::computeEnclosingRectOfVertices(vertices, numVertices); + + EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(-100, -100), FloatSize(90, 90)), result); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp index 976dc3f29..80317a008 100644 --- a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp @@ -27,30 +27,26 @@ #include "cc/CCOcclusionTracker.h" #include "CCAnimationTestCommon.h" +#include "CCLayerTreeTestCommon.h" #include "CCOcclusionTrackerTestCommon.h" #include "LayerChromium.h" #include "Region.h" -#include "TransformationMatrix.h" #include "TranslateTransformOperation.h" #include "cc/CCLayerAnimationController.h" #include "cc/CCLayerImpl.h" #include "cc/CCLayerTreeHostCommon.h" +#include "cc/CCMathUtil.h" #include "cc/CCSingleThreadProxy.h" #include <gmock/gmock.h> #include <gtest/gtest.h> #include <public/WebFilterOperation.h> #include <public/WebFilterOperations.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; using namespace WebKit; using namespace WebKitTests; -#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 TestContentLayerChromium : public LayerChromium { @@ -177,7 +173,7 @@ protected: CCLayerTreeHost::setNeedsFilterContext(false); } - typename Types::ContentLayerType* createRoot(const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + typename Types::ContentLayerType* createRoot(const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { typename Types::ContentLayerPtrType layer(Types::createContentLayer()); typename Types::ContentLayerType* layerPtr = layer.get(); @@ -188,7 +184,7 @@ protected: return layerPtr; } - typename Types::LayerType* createLayer(typename Types::LayerType* parent, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + typename Types::LayerType* createLayer(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { typename Types::LayerPtrType layer(Types::createLayer()); typename Types::LayerType* layerPtr = layer.get(); @@ -197,7 +193,7 @@ protected: return layerPtr; } - typename Types::LayerType* createSurface(typename Types::LayerType* parent, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + typename Types::LayerType* createSurface(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { typename Types::LayerType* layer = createLayer(parent, transform, position, bounds); WebFilterOperations filters; @@ -206,7 +202,7 @@ protected: return layer; } - typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerType* parent, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque) + typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque) { typename Types::ContentLayerPtrType layer(Types::createContentLayer()); typename Types::ContentLayerType* layerPtr = layer.get(); @@ -226,7 +222,7 @@ protected: return layerPtr; } - typename Types::LayerType* createReplicaLayer(typename Types::LayerType* owningLayer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + typename Types::LayerType* createReplicaLayer(typename Types::LayerType* owningLayer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { typename Types::ContentLayerPtrType layer(Types::createContentLayer()); typename Types::ContentLayerType* layerPtr = layer.get(); @@ -244,7 +240,7 @@ protected: return layerPtr; } - typename Types::ContentLayerType* createDrawingSurface(typename Types::LayerType* parent, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque) + typename Types::ContentLayerType* createDrawingSurface(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque) { typename Types::ContentLayerType* layer = createDrawingLayer(parent, transform, position, bounds, opaque); WebFilterOperations filters; @@ -336,24 +332,24 @@ protected: m_layerIterator = m_layerIteratorBegin; } - const TransformationMatrix identityMatrix; + const WebTransformationMatrix identityMatrix; private: - void setBaseProperties(typename Types::LayerType* layer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + void setBaseProperties(typename Types::LayerType* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { layer->setTransform(transform); - layer->setSublayerTransform(TransformationMatrix()); + layer->setSublayerTransform(WebTransformationMatrix()); layer->setAnchorPoint(FloatPoint(0, 0)); layer->setPosition(position); layer->setBounds(bounds); } - void setProperties(LayerChromium* layer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + void setProperties(LayerChromium* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { setBaseProperties(layer, transform, position, bounds); } - void setProperties(CCLayerImpl* layer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) + void setProperties(CCLayerImpl* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds) { setBaseProperties(layer, transform, position, bounds); @@ -449,9 +445,9 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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))); @@ -469,14 +465,14 @@ protected: occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70)).isEmpty()); - EXPECT_EQ_RECT(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70))); - EXPECT_EQ_RECT(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70))); - EXPECT_EQ_RECT(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); - EXPECT_EQ_RECT(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70))); - EXPECT_EQ_RECT(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70))); - EXPECT_EQ_RECT(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70))); - EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70))); - EXPECT_EQ_RECT(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70))); + 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))); } }; @@ -487,7 +483,7 @@ class CCOcclusionTrackerTestRotatedChild : public CCOcclusionTrackerTest<Types, protected: void runMyTest() { - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.translate(250, 250); layerTransform.rotate(90); layerTransform.translate(-250, -250); @@ -502,9 +498,9 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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))); @@ -522,14 +518,14 @@ protected: occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70)).isEmpty()); - EXPECT_EQ_RECT(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70))); - EXPECT_EQ_RECT(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70))); - EXPECT_EQ_RECT(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); - EXPECT_EQ_RECT(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70))); - EXPECT_EQ_RECT(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70))); - EXPECT_EQ_RECT(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70))); - EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70))); - EXPECT_EQ_RECT(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70))); + 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))); } }; @@ -540,7 +536,7 @@ class CCOcclusionTrackerTestTranslatedChild : public CCOcclusionTrackerTest<Type protected: void runMyTest() { - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.translate(20, 20); typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); @@ -553,9 +549,9 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(50, 50, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(50, 50, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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))); @@ -573,25 +569,25 @@ protected: occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 50, 50, 50)).isEmpty()); - EXPECT_EQ_RECT(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50))); - EXPECT_EQ_RECT(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50))); - EXPECT_EQ_RECT(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50))); - EXPECT_EQ_RECT(IntRect(51, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50))); - EXPECT_EQ_RECT(IntRect(100, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50, 50))); - EXPECT_EQ_RECT(IntRect(51, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50, 50))); - EXPECT_EQ_RECT(IntRect(50, 100, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50, 50))); - EXPECT_EQ_RECT(IntRect(49, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); + 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))); occlusion.useDefaultLayerScissorRect(); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 50, 50, 50)).isEmpty()); - EXPECT_EQ_RECT(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50))); - EXPECT_EQ_RECT(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50))); - EXPECT_EQ_RECT(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50))); - EXPECT_EQ_RECT(IntRect(51, 49, 49, 1), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50))); + 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_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_EQ_RECT(IntRect(49, 51, 1, 49), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); + EXPECT_INT_RECT_EQ(IntRect(49, 51, 1, 49), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); } }; @@ -603,7 +599,7 @@ class CCOcclusionTrackerTestChildInRotatedChild : public CCOcclusionTrackerTest< protected: void runMyTest() { - TransformationMatrix childTransform; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(90); childTransform.translate(-250, -250); @@ -620,9 +616,9 @@ protected: this->visitLayer(layer, occlusion); this->enterContributingSurface(child, occlusion); - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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))); @@ -642,9 +638,9 @@ protected: this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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))); @@ -696,7 +692,7 @@ class CCOcclusionTrackerTestVisitTargetTwoTimes : public CCOcclusionTrackerTest< protected: void runMyTest() { - TransformationMatrix childTransform; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(90); childTransform.translate(-250, -250); @@ -715,16 +711,16 @@ protected: this->visitLayer(child2, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 60, 20), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 60, 20), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(layer, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->enterContributingSurface(child, occlusion); @@ -745,18 +741,18 @@ protected: EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(10, 430, 60, 70)).isEmpty()); // This is the little piece not occluded by child2 - EXPECT_EQ_RECT(IntRect(9, 430, 1, 10), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(9, 430, 1, 10), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 70))); // This extends past both sides of child2, so it will be the original rect. - EXPECT_EQ_RECT(IntRect(9, 430, 60, 80), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 80))); + EXPECT_INT_RECT_EQ(IntRect(9, 430, 60, 80), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 80))); // This extends past two adjacent sides of child2, and should included the unoccluded parts of each side. // This also demonstrates that the rect can be arbitrary and does not get clipped to the layer's visibleLayerRect(). - EXPECT_EQ_RECT(IntRect(-10, 430, 20, 70), occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(-10, 430, 20, 70), occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 70))); // This extends past three adjacent sides of child2, so it should contain the unoccluded parts of each side. The left // and bottom edges are completely unoccluded for some row/column so we get back the original query rect. - EXPECT_EQ_RECT(IntRect(-10, 430, 60, 80), occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 80))); - EXPECT_EQ_RECT(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 429, 60, 70))); - EXPECT_EQ_RECT(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(11, 430, 60, 70))); - EXPECT_EQ_RECT(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 431, 60, 70))); + EXPECT_INT_RECT_EQ(IntRect(-10, 430, 60, 80), occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 80))); + 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))); occlusion.useDefaultLayerScissorRect(); EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(10, 430, 60, 70)).isEmpty()); @@ -773,13 +769,13 @@ protected: this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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_EQ_RECT(IntRect(90, 30, 10, 10), occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70))); + EXPECT_INT_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))); @@ -792,21 +788,21 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60))); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 60, 10)).isEmpty()); - EXPECT_EQ_RECT(IntRect(29, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 60, 10))); - EXPECT_EQ_RECT(IntRect(30, 29, 60, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 60, 10))); - EXPECT_EQ_RECT(IntRect(90, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 60, 10))); + 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_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 31, 60, 10)).isEmpty()); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 40, 70, 60)).isEmpty()); - EXPECT_EQ_RECT(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); + EXPECT_INT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); // This rect is mostly occluded by |child2|. - EXPECT_EQ_RECT(IntRect(90, 39, 10, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60))); + EXPECT_INT_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_EQ_RECT(IntRect(30, 29, 70, 11), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); + EXPECT_INT_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_EQ_RECT(IntRect(20, 39, 80, 60), occlusion.unoccludedContentRect(parent, IntRect(20, 39, 80, 60))); - EXPECT_EQ_RECT(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60))); - EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60))); + 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))); /* Justification for the above occlusion from |layer|: 100 @@ -842,12 +838,12 @@ class CCOcclusionTrackerTestSurfaceRotatedOffAxis : public CCOcclusionTrackerTes protected: void runMyTest() { - TransformationMatrix childTransform; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(95); childTransform.translate(-250, -250); - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.translate(10, 10); typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100)); @@ -859,14 +855,14 @@ protected: TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); - IntRect clippedLayerInChild = layerTransform.mapRect(layer->visibleLayerRect()); + IntRect clippedLayerInChild = CCMathUtil::mapClippedRect(layerTransform, layer->visibleLayerRect()); this->visitLayer(layer, occlusion); this->enterContributingSurface(child, occlusion); - EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(clippedLayerInChild, occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(clippedLayerInChild, occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child, clippedLayerInChild)); @@ -891,13 +887,13 @@ protected: this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(75, 55, 1, 1))); - EXPECT_EQ_RECT(IntRect(75, 55, 1, 1), occlusion.unoccludedContentRect(parent, IntRect(75, 55, 1, 1))); + EXPECT_INT_RECT_EQ(IntRect(75, 55, 1, 1), occlusion.unoccludedContentRect(parent, IntRect(75, 55, 1, 1))); } }; @@ -908,7 +904,7 @@ class CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public CCOcclusionTra protected: void runMyTest() { - TransformationMatrix childTransform; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(90); childTransform.translate(-250, -250); @@ -927,9 +923,9 @@ protected: this->visitLayer(layer1, occlusion); this->enterContributingSurface(child, occlusion); - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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))); @@ -939,17 +935,17 @@ protected: EXPECT_FALSE(occlusion.occluded(child, IntRect(10, 431, 60, 70))); EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(10, 430, 60, 70)).isEmpty()); - EXPECT_EQ_RECT(IntRect(9, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 70))); - EXPECT_EQ_RECT(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 429, 60, 70))); - EXPECT_EQ_RECT(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(11, 430, 60, 70))); - EXPECT_EQ_RECT(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 431, 60, 70))); + 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))); this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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))); @@ -957,10 +953,10 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60))); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 40, 70, 60)).isEmpty()); - EXPECT_EQ_RECT(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); - EXPECT_EQ_RECT(IntRect(30, 39, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60))); - EXPECT_EQ_RECT(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60))); - EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60))); + 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))); /* Justification for the above occlusion from |layer1| and |layer2|: @@ -996,7 +992,7 @@ class CCOcclusionTrackerTestOverlappingSurfaceSiblings : public CCOcclusionTrack protected: void runMyTest() { - TransformationMatrix childTransform; + WebTransformationMatrix childTransform; childTransform.translate(250, 250); childTransform.rotate(90); childTransform.translate(-250, -250); @@ -1014,9 +1010,9 @@ protected: this->visitLayer(layer2, occlusion); this->enterContributingSurface(child2, occlusion); - EXPECT_EQ_RECT(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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))); @@ -1034,15 +1030,15 @@ protected: occlusion.setLayerScissorRect(IntRect(-20, -20, 1000, 1000)); // There is nothing above child2's surface in the z-order. - EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2->renderSurface(), false, IntRect(-10, 420, 70, 80))); + EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2->renderSurface(), false, IntRect(-10, 420, 70, 80))); this->leaveContributingSurface(child2, occlusion); this->visitLayer(layer1, occlusion); this->enterContributingSurface(child1, occlusion); - EXPECT_EQ_RECT(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(-10, 430, 80, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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))); @@ -1052,14 +1048,14 @@ protected: EXPECT_FALSE(occlusion.occluded(child1, IntRect(-10, 430, 80, 71))); // child2's contents will occlude child1 below it. - EXPECT_EQ_RECT(IntRect(-10, 430, 10, 70), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(-10, 430, 80, 70))); + EXPECT_INT_RECT_EQ(IntRect(-10, 430, 10, 70), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(-10, 430, 80, 70))); this->leaveContributingSurface(child1, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(20, 20, 80, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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))); @@ -1105,12 +1101,12 @@ class CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms : public protected: void runMyTest() { - TransformationMatrix child1Transform; + WebTransformationMatrix child1Transform; child1Transform.translate(250, 250); child1Transform.rotate(-90); child1Transform.translate(-250, -250); - TransformationMatrix child2Transform; + WebTransformationMatrix child2Transform; child2Transform.translate(250, 250); child2Transform.rotate(90); child2Transform.translate(-250, -250); @@ -1128,9 +1124,9 @@ protected: this->visitLayer(layer2, occlusion); this->enterLayer(child2, occlusion); - EXPECT_EQ_RECT(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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))); @@ -1143,15 +1139,15 @@ protected: this->enterContributingSurface(child2, occlusion); // There is nothing above child2's surface in the z-order. - EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2->renderSurface(), false, IntRect(-10, 420, 70, 80))); + EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2->renderSurface(), false, IntRect(-10, 420, 70, 80))); this->leaveContributingSurface(child2, occlusion); this->visitLayer(layer1, occlusion); this->enterContributingSurface(child1, occlusion); - EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(420, -20, 80, 90), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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))); @@ -1161,16 +1157,16 @@ protected: EXPECT_FALSE(occlusion.occluded(child1, IntRect(421, -20, 80, 90))); // child2's contents will occlude child1 below it. - EXPECT_EQ_RECT(IntRect(420, -20, 80, 90), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -20, 80, 90))); - EXPECT_EQ_RECT(IntRect(490, -10, 10, 80), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -10, 80, 90))); - EXPECT_EQ_RECT(IntRect(420, -20, 70, 10), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -20, 70, 90))); + EXPECT_INT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -20, 80, 90))); + EXPECT_INT_RECT_EQ(IntRect(490, -10, 10, 80), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -10, 80, 90))); + EXPECT_INT_RECT_EQ(IntRect(420, -20, 70, 10), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -20, 70, 90))); this->leaveContributingSurface(child1, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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))); @@ -1212,7 +1208,7 @@ class CCOcclusionTrackerTestFilters : public CCOcclusionTrackerTest<Types, opaqu protected: void runMyTest() { - TransformationMatrix layerTransform; + WebTransformationMatrix layerTransform; layerTransform.translate(250, 250); layerTransform.rotate(90); layerTransform.translate(-250, -250); @@ -1255,16 +1251,16 @@ protected: this->visitLayer(opaqueLayer, occlusion); this->enterContributingSurface(opaqueLayer, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 430, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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. @@ -1281,9 +1277,9 @@ protected: // But the opaque layer's occlusion is preserved on the parent. this->leaveContributingSurface(blurLayer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1305,16 +1301,16 @@ protected: this->visitLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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_EQ_RECT(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1336,16 +1332,16 @@ protected: this->visitLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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_EQ_RECT(IntRect(0, 100, 100, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1368,16 +1364,16 @@ protected: this->visitLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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_EQ_RECT(IntRect(0, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1422,7 +1418,7 @@ protected: EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_EQ_RECT(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -1466,7 +1462,7 @@ protected: EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_EQ_RECT(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -1583,11 +1579,11 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); - EXPECT_EQ_RECT(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100))); - EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100))); - EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100))); - EXPECT_EQ_RECT(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 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))); } }; @@ -1626,11 +1622,11 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); - EXPECT_EQ_RECT(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100))); - EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100))); - EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100))); - EXPECT_EQ_RECT(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 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))); } }; @@ -1799,7 +1795,7 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(100, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_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))); @@ -1815,7 +1811,7 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(120, 120, 180, 180), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_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))); @@ -1831,7 +1827,7 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(250, 250, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_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))); @@ -1848,7 +1844,7 @@ class CCOcclusionTrackerTest3dTransform : public CCOcclusionTrackerTest<Types, o protected: void runMyTest() { - TransformationMatrix transform; + WebTransformationMatrix transform; transform.rotate3d(0, 30, 0); typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300)); @@ -1860,7 +1856,7 @@ protected: this->enterLayer(layer, occlusion); // The layer is rotated in 3d but without preserving 3d, so it only gets resized. - EXPECT_EQ_RECT(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); } }; @@ -1871,7 +1867,7 @@ class CCOcclusionTrackerTestPerspectiveTransform : public CCOcclusionTrackerTest protected: void runMyTest() { - TransformationMatrix transform; + WebTransformationMatrix transform; transform.translate(150, 150); transform.applyPerspective(400); transform.rotate3d(1, 0, 0, -30); @@ -1887,7 +1883,7 @@ protected: TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); this->enterLayer(layer, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); } }; @@ -1899,7 +1895,7 @@ protected: void runMyTest() { // This test is based on the platform/chromium/compositing/3d-corners.html layout test. - TransformationMatrix transform; + WebTransformationMatrix transform; transform.translate(250, 50); transform.applyPerspective(10); transform.translate(-250, -50); @@ -1930,7 +1926,7 @@ class CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public CCOcclusion protected: void runMyTest() { - TransformationMatrix transform; + WebTransformationMatrix transform; transform.translate(50, 50); transform.applyPerspective(100); transform.translate3d(0, 0, 110); @@ -1959,7 +1955,7 @@ class CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect : public CCOcclusio protected: void runMyTest() { - TransformationMatrix transform; + WebTransformationMatrix transform; transform.translate(50, 50); transform.applyPerspective(100); transform.translate3d(0, 0, 99); @@ -2012,27 +2008,27 @@ protected: this->visitLayer(topmost, occlusion); this->enterLayer(parent2, occlusion); // This occlusion will affect all surfaces. - EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent2, IntRect(0, 0, 300, 300))); + EXPECT_INT_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_EQ_RECT(IntRect(100, 0, 150, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(100, 0, 150, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); this->leaveLayer(surfaceChild, occlusion); this->enterLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_INT_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_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), 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_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -2064,27 +2060,27 @@ protected: this->visitLayer(topmost, occlusion); this->enterLayer(parent2, occlusion); // This occlusion will affect all surfaces. - EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_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_EQ_RECT(IntRect(100, 0, 150, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(100, 0, 150, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); this->leaveLayer(surfaceChild, occlusion); this->enterLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_INT_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_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), 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_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -2122,7 +2118,7 @@ protected: this->visitLayer(surface2, occlusion); this->enterContributingSurface(surface2, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); this->leaveContributingSurface(surface2, occlusion); @@ -2130,53 +2126,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_EQ_RECT(IntRect(0, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild2, IntRect(0, 0, 100, 300))); + EXPECT_INT_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_EQ_RECT(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); - EXPECT_EQ_RECT(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_INT_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_EQ_RECT(IntRect(0, 0, 200, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 200, 300))); + EXPECT_INT_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_EQ_RECT(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); - EXPECT_EQ_RECT(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_INT_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_EQ_RECT(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 300), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_INT_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_EQ_RECT(IntRect(0, 0, 300, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), 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_EQ_RECT(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_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_EQ_RECT(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_INT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -2187,7 +2183,7 @@ class CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent : public CCOcclus protected: void runMyTest() { - TransformationMatrix surfaceTransform; + WebTransformationMatrix surfaceTransform; surfaceTransform.translate(300, 300); surfaceTransform.scale(2); surfaceTransform.translate(-150, -150); @@ -2204,9 +2200,9 @@ protected: this->visitLayer(surface2, occlusion); this->visitContributingSurface(surface2, occlusion); - EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // Clear any stored occlusion. @@ -2216,9 +2212,9 @@ protected: this->visitLayer(surface, occlusion); this->visitContributingSurface(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 400, 400), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2240,9 +2236,9 @@ protected: this->visitLayer(surface, occlusion); this->visitContributingSurface(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2266,22 +2262,22 @@ protected: // |topmost| occludes the replica, but not the surface itself. this->visitLayer(topmost, occlusion); - EXPECT_EQ_RECT(IntRect(0, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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_EQ_RECT(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); } }; @@ -2304,23 +2300,23 @@ protected: // |topmost| occludes the surface, but not the entire surface's replica. this->visitLayer(topmost, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 110), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); - EXPECT_EQ_RECT(IntRect(0, 10, 100, 90), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), true, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 10, 100, 90), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), true, IntRect(0, 0, 100, 100))); } }; @@ -2345,23 +2341,23 @@ protected: this->visitLayer(overReplica, occlusion); this->visitLayer(overSurface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 200), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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_EQ_RECT(IntRect(40, 0, 60, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); - EXPECT_EQ_RECT(IntRect(50, 0, 50, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), true, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(40, 0, 60, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(50, 0, 50, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), true, IntRect(0, 0, 100, 100))); } }; @@ -2385,18 +2381,18 @@ protected: // |topmost| occludes everything partially so we know occlusion is happening at all. this->visitLayer(topmost, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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_EQ_RECT(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_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_EQ_RECT(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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 @@ -2406,26 +2402,65 @@ 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_EQ_RECT(IntRect(0, 40, 100, 10), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild->renderSurface(), false, IntRect(0, 0, 100, 50))); + EXPECT_INT_RECT_EQ(IntRect(0, 40, 100, 10), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild->renderSurface(), 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_EQ_RECT(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 10, 100, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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_EQ_RECT(IntRect(0, 50, 100, 50), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 50, 100, 50), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); } }; ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceChildOfSurface); template<class Types, bool opaqueLayers> +class CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor : public CCOcclusionTrackerTest<Types, opaqueLayers> { +protected: + void runMyTest() + { + // This test verifies that the top-most surface is considered occluded outside of its scissor rect and outside the screen's scissor rect. + + typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200)); + typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); + this->calcDrawEtc(parent); + + { + // Make a screen scissor rect that is larger than the root layer's. + TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + + this->visitLayer(surface, occlusion); + + // 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->renderSurface(), false, IntRect(0, 0, 100, 300))); + } + this->resetLayerIterator(); + { + // Make a screen scissor rect that is smaller than the root layer's. + TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 100, 100)); + + this->visitLayer(surface, occlusion); + + // 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 screen scissor rect clips the unoccluded region of the child surface. + EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 300))); + } + } +}; + +ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTopmostSurfaceIsClippedToScissor); + +template<class Types, bool opaqueLayers> class CCOcclusionTrackerTestSurfaceChildOfClippingSurface : public CCOcclusionTrackerTest<Types, opaqueLayers> { protected: void runMyTest() @@ -2444,17 +2479,17 @@ protected: // |topmost| occludes everything partially so we know occlusion is happening at all. this->visitLayer(topmost, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 80, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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_EQ_RECT(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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 @@ -2463,13 +2498,13 @@ protected: this->enterContributingSurface(surfaceChild, occlusion); // The surfaceChild's parent does not have a clipRect as it owns a render surface. - EXPECT_EQ_RECT(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild->renderSurface(), false, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild->renderSurface(), 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_EQ_RECT(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); + EXPECT_INT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100))); } }; @@ -2480,7 +2515,7 @@ class CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter : public protected: void runMyTest() { - TransformationMatrix scaleByHalf; + WebTransformationMatrix scaleByHalf; scaleByHalf.scale(0.5); // Make a surface and its replica, each 50x50, that are completely surrounded by opaque layers which are above them in the z-order. @@ -2517,28 +2552,28 @@ protected: this->visitLayer(occludingLayer2, occlusion); this->visitLayer(occludingLayer1, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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_EQ_RECT(IntRect(1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 100, 100))); - EXPECT_EQ_RECT(IntRect(0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 100, 100))); - EXPECT_EQ_RECT(IntRect(0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 100, 100))); - EXPECT_EQ_RECT(IntRect(0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 100, 100))); - - EXPECT_EQ_RECT(IntRect(300 + 1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 1, 0, 100, 100))); - EXPECT_EQ_RECT(IntRect(300 + 0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, 1, 100, 100))); - EXPECT_EQ_RECT(IntRect(300 + 0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 - 1, 0, 100, 100))); - EXPECT_EQ_RECT(IntRect(300 + 0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, -1, 100, 100))); + 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))); this->leaveLayer(filteredSurface, occlusion); // The filtered layer/replica does not occlude. - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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 @@ -2546,9 +2581,9 @@ protected: this->visitContributingSurface(filteredSurface, occlusion); this->enterLayer(parent, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); IntRect outsetRect; @@ -2557,44 +2592,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_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); // Stuff outside the blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_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_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); // Stuff outside the blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); } }; @@ -2605,7 +2640,7 @@ class CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public CC protected: void runMyTest() { - TransformationMatrix scaleByHalf; + WebTransformationMatrix scaleByHalf; scaleByHalf.scale(0.5); // Makes two surfaces that completely cover |parent|. The occlusion both above and below the filters will be reduced by each of them. @@ -2632,9 +2667,9 @@ protected: occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); this->visitLayer(occludingLayerAbove, occlusion); - EXPECT_EQ_RECT(IntRect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(100, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(100, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(filteredSurface2, occlusion); @@ -2647,7 +2682,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_EQ_RECT(expectedOcclusion, occlusion.occlusionInTargetSurface().rects()[0]); + EXPECT_INT_RECT_EQ(expectedOcclusion, occlusion.occlusionInTargetSurface().rects()[0]); // Test expectations in the screen. Take the ceiling of half of the outsets. outsetTop = (outsetTop + 1) / 2; @@ -2656,7 +2691,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_EQ_RECT(expectedOcclusion, occlusion.occlusionInScreenSpace().rects()[0]); + EXPECT_INT_RECT_EQ(expectedOcclusion, occlusion.occlusionInScreenSpace().rects()[0]); } }; @@ -2703,28 +2738,28 @@ protected: this->visitLayer(occludingLayer2, occlusion); this->visitLayer(occludingLayer1, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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_EQ_RECT(IntRect(1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 50, 50))); - EXPECT_EQ_RECT(IntRect(0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 50, 50))); - EXPECT_EQ_RECT(IntRect(0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 50, 50))); - EXPECT_EQ_RECT(IntRect(0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 50, 50))); - - EXPECT_EQ_RECT(IntRect(150 + 1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 1, 0, 50, 50))); - EXPECT_EQ_RECT(IntRect(150 + 0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, 1, 50, 50))); - EXPECT_EQ_RECT(IntRect(150 + 0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 - 1, 0, 50, 50))); - EXPECT_EQ_RECT(IntRect(150 + 0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, -1, 50, 50))); + 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))); this->leaveLayer(filteredSurface, occlusion); // The filtered layer/replica does not occlude. - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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 @@ -2732,7 +2767,7 @@ protected: this->visitContributingSurface(filteredSurface, occlusion); this->enterContributingSurface(clippingSurface, occlusion); - EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); IntRect outsetRect; @@ -2743,45 +2778,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_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); // Stuff outside the (clipped) blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_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_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); // Stuff outside the (clipped) blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); } }; @@ -2792,7 +2827,7 @@ class CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter : public CC protected: void runMyTest() { - TransformationMatrix scaleByHalf; + WebTransformationMatrix scaleByHalf; scaleByHalf.scale(0.5); // Make a surface and its replica, each 50x50, with a smaller 30x30 layer centered below each. @@ -2827,9 +2862,9 @@ protected: IntRect occlusionBehindReplica = IntRect(210, 60, 30, 30); IntRect expectedOpaqueBounds = unionRect(occlusionBehindSurface, occlusionBehindReplica); - EXPECT_EQ_RECT(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2841,7 +2876,7 @@ class CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : pu protected: void runMyTest() { - TransformationMatrix scaleByHalf; + WebTransformationMatrix scaleByHalf; scaleByHalf.scale(0.5); // Make a surface and its replica, each 50x50, that are completely occluded by opaque layers which are above them in the z-order. @@ -2875,9 +2910,9 @@ protected: IntRect occlusionAboveReplica = IntRect(200, 50, 50, 50); IntRect expectedOpaqueBounds = unionRect(occlusionAboveSurface, occlusionAboveReplica); - EXPECT_EQ_RECT(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2889,7 +2924,7 @@ class CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOcclud protected: void runMyTest() { - TransformationMatrix scaleByHalf; + WebTransformationMatrix scaleByHalf; scaleByHalf.scale(0.5); // Make a surface and its replica, each 50x50, that are partially occluded by opaque layers which are above them in the z-order. @@ -2976,17 +3011,17 @@ protected: // The small layer is not tracked because it is too small. this->visitLayer(small, occlusion); - EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_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_EQ_RECT(IntRect(IntPoint(), trackingSize), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_INT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(IntPoint(), trackingSize), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_INT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; diff --git a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp index 634a25c7a..1a119d708 100644 --- a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp +++ b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp @@ -33,8 +33,10 @@ #include "cc/CCTileDrawQuad.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { @@ -55,7 +57,7 @@ private: typedef CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType; -static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const TransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, Vector<CCLayerImpl*>& surfaceLayerList) +static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const WebTransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, Vector<CCLayerImpl*>& surfaceLayerList) { OwnPtr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(0); OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::NoBorderTexels); @@ -105,7 +107,7 @@ static void appendQuads(CCQuadList& quadList, Vector<OwnPtr<CCSharedQuadState> > CCQuadList quadList; \ Vector<OwnPtr<CCSharedQuadState> > sharedStateList; \ Vector<CCLayerImpl*> renderSurfaceLayerList; \ - TransformationMatrix childTransform; \ + WebTransformationMatrix childTransform; \ IntSize rootSize = IntSize(300, 300); \ IntRect rootRect = IntRect(IntPoint(), rootSize); \ IntSize childSize = IntSize(200, 200); \ @@ -115,8 +117,8 @@ TEST(CCQuadCullerTest, verifyNoCulling) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, false, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, false, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -132,8 +134,8 @@ TEST(CCQuadCullerTest, verifyCullChildLinesUpTopLeft) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -149,7 +151,7 @@ TEST(CCQuadCullerTest, verifyCullWhenChildOpacityNotOne) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 0.9f, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -166,7 +168,7 @@ TEST(CCQuadCullerTest, verifyCullWhenChildOpaqueFlagFalse) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -185,7 +187,7 @@ TEST(CCQuadCullerTest, verifyCullCenterTileOnly) childTransform.translate(50, 50); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -222,7 +224,7 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize1) // Make the root layer's quad have extent (99.1, 99.1) -> (200.9, 200.9) to make // sure it doesn't get culled due to transform rounding. - TransformationMatrix rootTransform; + WebTransformationMatrix rootTransform; rootTransform.translate(99.1, 99.1); rootTransform.scale(1.018); @@ -251,7 +253,7 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize2) childTransform.translate(100.1, 100.1); childTransform.scale(0.982); - TransformationMatrix rootTransform; + WebTransformationMatrix rootTransform; rootTransform.translate(100, 100); rootRect = childRect = IntRect(0, 0, 100, 100); @@ -276,7 +278,7 @@ TEST(CCQuadCullerTest, verifyCullChildLinesUpBottomRight) childTransform.translate(100, 100); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -295,7 +297,7 @@ TEST(CCQuadCullerTest, verifyCullSubRegion) childTransform.translate(50, 50); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, childOpaqueRect, renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); @@ -315,7 +317,7 @@ TEST(CCQuadCullerTest, verifyCullSubRegion2) childTransform.translate(50, 10); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() * 3 / 4); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, childOpaqueRect, renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); @@ -335,7 +337,7 @@ TEST(CCQuadCullerTest, verifyCullSubRegionCheckOvercull) childTransform.translate(50, 49); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, childOpaqueRect, renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); @@ -356,7 +358,7 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude) // Use a small rotation so as to not disturb the geometry significantly. childTransform.rotate(1); - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -379,11 +381,11 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsSafelyCulled) DECLARE_AND_INITIALIZE_TEST_QUADS // Use a small rotation so as to not disturb the geometry significantly. - TransformationMatrix parentTransform; + WebTransformationMatrix parentTransform; parentTransform.rotate(1); OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, parentTransform, rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -399,8 +401,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverTile) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(200, 100, 100, 100)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -416,8 +418,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverCulledTile) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(100, 100, 100, 100)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -433,8 +435,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverPartialTiles) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -450,8 +452,8 @@ TEST(CCQuadCullerTest, verifyCullOutsideScissorOverNoTiles) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(500, 500, 100, 100)); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); @@ -467,8 +469,8 @@ TEST(CCQuadCullerTest, verifyWithoutMetrics) { DECLARE_AND_INITIALIZE_TEST_QUADS - OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); - OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList); + OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList); TestCCOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200), false); CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); diff --git a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp index 7dac005d2..5cbe7fc54 100644 --- a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp +++ b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp @@ -26,14 +26,15 @@ #include "cc/CCRenderSurface.h" -#include "TransformationMatrix.h" #include "cc/CCLayerImpl.h" #include "cc/CCSharedQuadState.h" #include "cc/CCSingleThreadProxy.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { @@ -77,7 +78,7 @@ TEST(CCRenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setContentRect(testRect)); OwnPtr<CCLayerImpl> dummyMask = CCLayerImpl::create(1); - TransformationMatrix dummyMatrix; + WebTransformationMatrix dummyMatrix; dummyMatrix.translate(1.0, 2.0); // The rest of the surface properties are either internal and should not cause change, @@ -86,9 +87,7 @@ TEST(CCRenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setDrawTransform(dummyMatrix)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setReplicaDrawTransform(dummyMatrix)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setOriginTransform(dummyMatrix)); - EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setSkipsDraw(true)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->clearLayerList()); - EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setMaskLayer(dummyMask.get())); } TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) @@ -103,8 +102,8 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) IntRect contentRect = IntRect(IntPoint::zero(), IntSize(50, 50)); IntRect clipRect = IntRect(IntPoint(5, 5), IntSize(40, 40)); - TransformationMatrix draw; - TransformationMatrix origin; + WebTransformationMatrix draw; + WebTransformationMatrix origin; draw.translate(30, 40); diff --git a/Source/WebKit/chromium/tests/DecimalTest.cpp b/Source/WebKit/chromium/tests/DecimalTest.cpp new file mode 100644 index 000000000..db69edd38 --- /dev/null +++ b/Source/WebKit/chromium/tests/DecimalTest.cpp @@ -0,0 +1,971 @@ +/* + * 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 "Decimal.h" + +#include <gtest/gtest.h> +#include <wtf/MathExtras.h> +#include <wtf/text/CString.h> + +namespace WebCore { + +std::ostream& operator<<(std::ostream& os, const Decimal& decimal) +{ + Decimal::EncodedData data = decimal.value(); + return os + << "encode(" << String::number(data.coefficient()).ascii().data() + << ", " << String::number(data.exponent()).ascii().data() + << ", " << (data.sign() == Decimal::Negative ? "Negative" : "Positive") + << ")=" << decimal.toString().ascii().data(); +} + +} // namespace WebCore + +using namespace WebCore; + +// Simulate WebCore/html/StepRange +class DecimalStepRange { +public: + Decimal maximum; + Decimal minimum; + Decimal step; + + DecimalStepRange(const Decimal& minimum, const Decimal& maximum, const Decimal& step) + : maximum(maximum) + , minimum(minimum) + , step(step) + { + } + + Decimal clampValue(Decimal value) const + { + const Decimal result = minimum + ((value - minimum) / step).round() * step; + ASSERT(result.isFinite()); + return result > maximum ? result - step : result; + } +}; + +class DecimalTest : public ::testing::Test { +protected: + typedef Decimal::Sign Sign; + protected: static const Sign Positive = Decimal::Positive; + protected: static const Sign Negative = Decimal::Negative; + + Decimal encode(uint64_t coefficient, int exponent, Sign sign) + { + return Decimal(sign, exponent, coefficient); + } + + protected: Decimal fromString(const String& string) + { + return Decimal::fromString(string); + } + + protected: String stepDown(const String& minimum, const String& maximum, const String& step, const String& valueString, int numberOfStepTimes) + { + DecimalStepRange stepRange(fromString(minimum), fromString(maximum), fromString(step)); + Decimal value = fromString(valueString); + for (int i = 0; i < numberOfStepTimes; ++i) { + value -= stepRange.step; + value = stepRange.clampValue(value); + } + return value.toString(); + } + + protected: String stepUp(const String& minimum, const String& maximum, const String& step, const String& valueString, int numberOfStepTimes) + { + DecimalStepRange stepRange(fromString(minimum), fromString(maximum), fromString(step)); + Decimal value = fromString(valueString); + for (int i = 0; i < numberOfStepTimes; ++i) { + value += stepRange.step; + value = stepRange.clampValue(value); + } + return value.toString(); + } +}; + +TEST_F(DecimalTest, Abs) +{ + EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Positive).abs()); + EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Negative).abs()); + + EXPECT_EQ(encode(0, 10, Positive), encode(0, 10, Positive).abs()); + EXPECT_EQ(encode(0, 10, Positive), encode(0, 10, Negative).abs()); + + EXPECT_EQ(encode(0, -10, Positive), encode(0, -10, Positive).abs()); + EXPECT_EQ(encode(0, -10, Positive), encode(0, -10, Negative).abs()); + + EXPECT_EQ(encode(1, 0, Positive), encode(1, 0, Positive).abs()); + EXPECT_EQ(encode(1, 0, Positive), encode(1, 0, Negative).abs()); + + EXPECT_EQ(encode(1, 10, Positive), encode(1, 10, Positive).abs()); + EXPECT_EQ(encode(1, 10, Positive), encode(1, 10, Negative).abs()); + + EXPECT_EQ(encode(1, -10, Positive), encode(1, -10, Positive).abs()); + EXPECT_EQ(encode(1, -10, Positive), encode(1, -10, Negative).abs()); +} + +TEST_F(DecimalTest, AbsBigExponent) +{ + EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).abs()); + EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Negative).abs()); +} + +TEST_F(DecimalTest, AbsSmallExponent) +{ + EXPECT_EQ(encode(1, -1000, Positive), encode(1, -1000, Positive).abs()); + EXPECT_EQ(encode(1, -1000, Positive), encode(1, -1000, Negative).abs()); +} + +TEST_F(DecimalTest, AbsSpecialValues) +{ + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).abs()); + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Negative).abs()); + EXPECT_EQ(Decimal::nan(), Decimal::nan().abs()); +} + +TEST_F(DecimalTest, Add) +{ + EXPECT_EQ(encode(0, 0, Positive), Decimal(0) + Decimal(0)); + EXPECT_EQ(Decimal(1), Decimal(2) + Decimal(-1)); + EXPECT_EQ(Decimal(1), Decimal(-1) + Decimal(2)); + EXPECT_EQ(encode(100, 0, Positive), Decimal(99) + Decimal(1)); + EXPECT_EQ(encode(100, 0, Negative), Decimal(-50) + Decimal(-50)); + EXPECT_EQ(encode(UINT64_C(1000000000000000), 35, Positive), encode(1, 50, Positive) + Decimal(1)); + EXPECT_EQ(encode(UINT64_C(1000000000000000), 35, Positive), Decimal(1) + encode(1, 50, Positive)); + EXPECT_EQ(encode(UINT64_C(10000000001), 0, Positive), encode(1, 10, Positive) + Decimal(1)); + EXPECT_EQ(encode(UINT64_C(10000000001), 0, Positive), Decimal(1) + encode(1, 10, Positive)); + EXPECT_EQ(encode(1, 0, Positive), encode(1, -1022, Positive) + encode(1, 0, Positive)); + EXPECT_EQ(encode(2, -1022, Positive), encode(1, -1022, Positive) + encode(1, -1022, Positive)); +} + +TEST_F(DecimalTest, AddBigExponent) +{ + EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) + encode(1, 0, Positive)); + EXPECT_EQ(encode(2, 1022, Positive), encode(1, 1022, Positive) + encode(1, 1022, Positive)); + EXPECT_EQ(Decimal::infinity(Positive), encode(std::numeric_limits<uint64_t>::max(), 1022, Positive) + encode(1, 0, Positive)); + EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) + encode(1, -1000, Positive)); +} + +TEST_F(DecimalTest, AddSmallExponent) +{ + EXPECT_EQ(encode(1, 0, Positive), encode(1, -1022, Positive) + encode(1, 0, Positive)); + EXPECT_EQ(encode(2, -1022, Positive), encode(1, -1022, Positive) + encode(1, -1022, Positive)); +} + +TEST_F(DecimalTest, AddSpecialValues) +{ + const Decimal Infinity(Decimal::infinity(Positive)); + const Decimal MinusInfinity(Decimal::infinity(Negative)); + const Decimal NaN(Decimal::nan()); + const Decimal Ten(10); + + EXPECT_EQ(Infinity, Infinity + Infinity); + EXPECT_EQ(NaN, Infinity + MinusInfinity); + EXPECT_EQ(NaN, MinusInfinity + Infinity); + EXPECT_EQ(MinusInfinity, MinusInfinity + MinusInfinity); + + EXPECT_EQ(Infinity, Infinity + Ten); + EXPECT_EQ(Infinity, Ten + Infinity); + EXPECT_EQ(MinusInfinity, MinusInfinity + Ten); + EXPECT_EQ(MinusInfinity, Ten + MinusInfinity); + + EXPECT_EQ(NaN, NaN + NaN); + EXPECT_EQ(NaN, NaN + Ten); + EXPECT_EQ(NaN, Ten + NaN); + + EXPECT_EQ(NaN, NaN - Infinity); + EXPECT_EQ(NaN, NaN - MinusInfinity); + EXPECT_EQ(NaN, Infinity - NaN); + EXPECT_EQ(NaN, MinusInfinity - NaN); +} + +TEST_F(DecimalTest, Ceiling) +{ + EXPECT_EQ(Decimal(1), Decimal(1).ceiling()); + EXPECT_EQ(Decimal(2), encode(11, -1, Positive).ceiling()); + EXPECT_EQ(Decimal(2), encode(13, -1, Positive).ceiling()); + EXPECT_EQ(Decimal(2), encode(15, -1, Positive).ceiling()); + EXPECT_EQ(Decimal(2), encode(19, -1, Positive).ceiling()); + + EXPECT_EQ(Decimal(-1), Decimal(-1).ceiling()); + EXPECT_EQ(Decimal(-1), encode(11, -1, Negative).ceiling()); + EXPECT_EQ(Decimal(-1), encode(13, -1, Negative).ceiling()); + EXPECT_EQ(Decimal(-1), encode(15, -1, Negative).ceiling()); + EXPECT_EQ(Decimal(-1), encode(19, -1, Negative).ceiling()); +} + +TEST_F(DecimalTest, CeilingBigExponent) +{ + EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).ceiling()); + EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).ceiling()); +} + +TEST_F(DecimalTest, CeilingSmallExponent) +{ + EXPECT_EQ(encode(0, 0, Positive), encode(1, -1000, Positive).ceiling()); + EXPECT_EQ(encode(0, 0, Negative), encode(1, -1000, Negative).ceiling()); +} + +TEST_F(DecimalTest, CeilingSpecialValues) +{ + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).ceiling()); + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).ceiling()); + EXPECT_EQ(Decimal::nan(), Decimal::nan().ceiling()); +} + +TEST_F(DecimalTest, Compare) +{ + EXPECT_TRUE(Decimal(0) == Decimal(0)); + EXPECT_TRUE(Decimal(0) != Decimal(1)); + EXPECT_TRUE(Decimal(0) < Decimal(1)); + EXPECT_TRUE(Decimal(0) <= Decimal(0)); + EXPECT_TRUE(Decimal(0) > Decimal(-1)); + EXPECT_TRUE(Decimal(0) >= Decimal(0)); + + EXPECT_FALSE(Decimal(1) == Decimal(2)); + EXPECT_FALSE(Decimal(1) != Decimal(1)); + EXPECT_FALSE(Decimal(1) < Decimal(0)); + EXPECT_FALSE(Decimal(1) <= Decimal(0)); + EXPECT_FALSE(Decimal(1) > Decimal(2)); + EXPECT_FALSE(Decimal(1) >= Decimal(2)); +} + +TEST_F(DecimalTest, CompareBigExponent) +{ + EXPECT_TRUE(encode(1, 1000, Positive) == encode(1, 1000, Positive)); + EXPECT_FALSE(encode(1, 1000, Positive) != encode(1, 1000, Positive)); + EXPECT_FALSE(encode(1, 1000, Positive) < encode(1, 1000, Positive)); + EXPECT_TRUE(encode(1, 1000, Positive) <= encode(1, 1000, Positive)); + EXPECT_FALSE(encode(1, 1000, Positive) > encode(1, 1000, Positive)); + EXPECT_TRUE(encode(1, 1000, Positive) >= encode(1, 1000, Positive)); + + EXPECT_TRUE(encode(1, 1000, Negative) == encode(1, 1000, Negative)); + EXPECT_FALSE(encode(1, 1000, Negative) != encode(1, 1000, Negative)); + EXPECT_FALSE(encode(1, 1000, Negative) < encode(1, 1000, Negative)); + EXPECT_TRUE(encode(1, 1000, Negative) <= encode(1, 1000, Negative)); + EXPECT_FALSE(encode(1, 1000, Negative) > encode(1, 1000, Negative)); + EXPECT_TRUE(encode(1, 1000, Negative) >= encode(1, 1000, Negative)); + + EXPECT_FALSE(encode(2, 1000, Positive) == encode(1, 1000, Positive)); + EXPECT_TRUE(encode(2, 1000, Positive) != encode(1, 1000, Positive)); + EXPECT_FALSE(encode(2, 1000, Positive) < encode(1, 1000, Positive)); + EXPECT_FALSE(encode(2, 1000, Positive) <= encode(1, 1000, Positive)); + EXPECT_TRUE(encode(2, 1000, Positive) > encode(1, 1000, Positive)); + EXPECT_TRUE(encode(2, 1000, Positive) >= encode(1, 1000, Positive)); + + EXPECT_FALSE(encode(2, 1000, Negative) == encode(1, 1000, Negative)); + EXPECT_TRUE(encode(2, 1000, Negative) != encode(1, 1000, Negative)); + EXPECT_TRUE(encode(2, 1000, Negative) < encode(1, 1000, Negative)); + EXPECT_TRUE(encode(2, 1000, Negative) <= encode(1, 1000, Negative)); + EXPECT_FALSE(encode(2, 1000, Negative) > encode(1, 1000, Negative)); + EXPECT_FALSE(encode(2, 1000, Negative) >= encode(1, 1000, Negative)); +} + +TEST_F(DecimalTest, CompareSmallExponent) +{ + EXPECT_TRUE(encode(1, -1000, Positive) == encode(1, -1000, Positive)); + EXPECT_FALSE(encode(1, -1000, Positive) != encode(1, -1000, Positive)); + EXPECT_FALSE(encode(1, -1000, Positive) < encode(1, -1000, Positive)); + EXPECT_TRUE(encode(1, -1000, Positive) <= encode(1, -1000, Positive)); + EXPECT_FALSE(encode(1, -1000, Positive) > encode(1, -1000, Positive)); + EXPECT_TRUE(encode(1, -1000, Positive) >= encode(1, -1000, Positive)); + + EXPECT_TRUE(encode(1, -1000, Negative) == encode(1, -1000, Negative)); + EXPECT_FALSE(encode(1, -1000, Negative) != encode(1, -1000, Negative)); + EXPECT_FALSE(encode(1, -1000, Negative) < encode(1, -1000, Negative)); + EXPECT_TRUE(encode(1, -1000, Negative) <= encode(1, -1000, Negative)); + EXPECT_FALSE(encode(1, -1000, Negative) > encode(1, -1000, Negative)); + EXPECT_TRUE(encode(1, -1000, Negative) >= encode(1, -1000, Negative)); + + EXPECT_FALSE(encode(2, -1000, Positive) == encode(1, -1000, Positive)); + EXPECT_TRUE(encode(2, -1000, Positive) != encode(1, -1000, Positive)); + EXPECT_FALSE(encode(2, -1000, Positive) < encode(1, -1000, Positive)); + EXPECT_FALSE(encode(2, -1000, Positive) <= encode(1, -1000, Positive)); + EXPECT_TRUE(encode(2, -1000, Positive) > encode(1, -1000, Positive)); + EXPECT_TRUE(encode(2, -1000, Positive) >= encode(1, -1000, Positive)); + + EXPECT_FALSE(encode(2, -1000, Negative) == encode(1, -1000, Negative)); + EXPECT_TRUE(encode(2, -1000, Negative) != encode(1, -1000, Negative)); + EXPECT_TRUE(encode(2, -1000, Negative) < encode(1, -1000, Negative)); + EXPECT_TRUE(encode(2, -1000, Negative) <= encode(1, -1000, Negative)); + EXPECT_FALSE(encode(2, -1000, Negative) > encode(1, -1000, Negative)); + EXPECT_FALSE(encode(2, -1000, Negative) >= encode(1, -1000, Negative)); +} + +TEST_F(DecimalTest, CompareSpecialValues) +{ + const Decimal Infinity(Decimal::infinity(Positive)); + const Decimal MinusInfinity(Decimal::infinity(Negative)); + const Decimal NaN(Decimal::nan()); + const Decimal Zero(Decimal::zero(Positive)); + const Decimal MinusZero(Decimal::zero(Negative)); + const Decimal Ten(10); + + EXPECT_TRUE(Zero == Zero); + EXPECT_FALSE(Zero != Zero); + EXPECT_FALSE(Zero < Zero); + EXPECT_TRUE(Zero <= Zero); + EXPECT_FALSE(Zero > Zero); + EXPECT_TRUE(Zero >= Zero); + + EXPECT_TRUE(Zero == MinusZero); + EXPECT_FALSE(Zero != MinusZero); + EXPECT_FALSE(Zero < MinusZero); + EXPECT_TRUE(Zero <= MinusZero); + EXPECT_FALSE(Zero > MinusZero); + EXPECT_TRUE(Zero >= MinusZero); + + EXPECT_TRUE(MinusZero == Zero); + EXPECT_FALSE(MinusZero != Zero); + EXPECT_FALSE(MinusZero < Zero); + EXPECT_TRUE(MinusZero <= Zero); + EXPECT_FALSE(MinusZero > Zero); + EXPECT_TRUE(MinusZero >= Zero); + + EXPECT_TRUE(MinusZero == MinusZero); + EXPECT_FALSE(MinusZero != MinusZero); + EXPECT_FALSE(MinusZero < MinusZero); + EXPECT_TRUE(MinusZero <= MinusZero); + EXPECT_FALSE(MinusZero > MinusZero); + EXPECT_TRUE(MinusZero >= MinusZero); + + EXPECT_TRUE(Infinity == Infinity); + EXPECT_FALSE(Infinity != Infinity); + EXPECT_FALSE(Infinity < Infinity); + EXPECT_TRUE(Infinity <= Infinity); + EXPECT_FALSE(Infinity > Infinity); + EXPECT_TRUE(Infinity >= Infinity); + + EXPECT_FALSE(Infinity == Ten); + EXPECT_TRUE(Infinity != Ten); + EXPECT_FALSE(Infinity < Ten); + EXPECT_FALSE(Infinity <= Ten); + EXPECT_TRUE(Infinity > Ten); + EXPECT_TRUE(Infinity >= Ten); + + EXPECT_FALSE(Infinity == MinusInfinity); + EXPECT_TRUE(Infinity != MinusInfinity); + EXPECT_FALSE(Infinity < MinusInfinity); + EXPECT_FALSE(Infinity <= MinusInfinity); + EXPECT_TRUE(Infinity > MinusInfinity); + EXPECT_TRUE(Infinity >= MinusInfinity); + + EXPECT_FALSE(Infinity == NaN); + EXPECT_FALSE(Infinity != NaN); + EXPECT_FALSE(Infinity < NaN); + EXPECT_FALSE(Infinity <= NaN); + EXPECT_FALSE(Infinity > NaN); + EXPECT_FALSE(Infinity >= NaN); + + EXPECT_FALSE(MinusInfinity == Infinity); + EXPECT_TRUE(MinusInfinity != Infinity); + EXPECT_TRUE(MinusInfinity < Infinity); + EXPECT_TRUE(MinusInfinity <= Infinity); + EXPECT_FALSE(MinusInfinity > Infinity); + EXPECT_FALSE(MinusInfinity >= Infinity); + + EXPECT_FALSE(MinusInfinity == Ten); + EXPECT_TRUE(MinusInfinity != Ten); + EXPECT_TRUE(MinusInfinity < Ten); + EXPECT_TRUE(MinusInfinity <= Ten); + EXPECT_FALSE(MinusInfinity > Ten); + EXPECT_FALSE(MinusInfinity >= Ten); + + EXPECT_TRUE(MinusInfinity == MinusInfinity); + EXPECT_FALSE(MinusInfinity != MinusInfinity); + EXPECT_FALSE(MinusInfinity < MinusInfinity); + EXPECT_TRUE(MinusInfinity <= MinusInfinity); + EXPECT_FALSE(MinusInfinity > MinusInfinity); + EXPECT_TRUE(MinusInfinity >= MinusInfinity); + + EXPECT_FALSE(MinusInfinity == NaN); + EXPECT_FALSE(MinusInfinity != NaN); + EXPECT_FALSE(MinusInfinity < NaN); + EXPECT_FALSE(MinusInfinity <= NaN); + EXPECT_FALSE(MinusInfinity > NaN); + EXPECT_FALSE(MinusInfinity >= NaN); + + EXPECT_FALSE(NaN == Infinity); + EXPECT_FALSE(NaN != Infinity); + EXPECT_FALSE(NaN < Infinity); + EXPECT_FALSE(NaN <= Infinity); + EXPECT_FALSE(NaN > Infinity); + EXPECT_FALSE(NaN >= Infinity); + + EXPECT_FALSE(NaN == Ten); + EXPECT_FALSE(NaN != Ten); + EXPECT_FALSE(NaN < Ten); + EXPECT_FALSE(NaN <= Ten); + EXPECT_FALSE(NaN > Ten); + EXPECT_FALSE(NaN >= Ten); + + EXPECT_FALSE(NaN == MinusInfinity); + EXPECT_FALSE(NaN != MinusInfinity); + EXPECT_FALSE(NaN < MinusInfinity); + EXPECT_FALSE(NaN <= MinusInfinity); + EXPECT_FALSE(NaN > MinusInfinity); + EXPECT_FALSE(NaN >= MinusInfinity); + + EXPECT_TRUE(NaN == NaN); + EXPECT_FALSE(NaN != NaN); + EXPECT_FALSE(NaN < NaN); + EXPECT_TRUE(NaN <= NaN); + EXPECT_FALSE(NaN > NaN); + EXPECT_TRUE(NaN >= NaN); +} + +TEST_F(DecimalTest, Division) +{ + EXPECT_EQ(encode(0, 0, Positive), Decimal(0) / Decimal(1)); + EXPECT_EQ(encode(2, 0, Negative), Decimal(2) / Decimal(-1)); + EXPECT_EQ(encode(5, -1, Negative), Decimal(-1) / Decimal(2)); + EXPECT_EQ(encode(99, 0, Positive), Decimal(99) / Decimal(1)); + EXPECT_EQ(Decimal(1), Decimal(-50) / Decimal(-50)); + EXPECT_EQ(encode(UINT64_C(3333333333333333), -16, Positive), Decimal(1) / Decimal(3)); + EXPECT_EQ(encode(UINT64_C(12345678901234), -1, Positive), encode(UINT64_C(12345678901234), 0, Positive) / Decimal(10)); +} + +TEST_F(DecimalTest, DivisionBigExponent) +{ + EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) / encode(1, 0, Positive)); + EXPECT_EQ(encode(1, 0, Positive), encode(1, 1022, Positive) / encode(1, 1022, Positive)); + EXPECT_EQ(Decimal::infinity(Positive), encode(1, 1022, Positive) / encode(1, -1000, Positive)); +} + +TEST_F(DecimalTest, DivisionSmallExponent) +{ + EXPECT_EQ(encode(1, -1022, Positive), encode(1, -1022, Positive) / encode(1, 0, Positive)); + EXPECT_EQ(encode(1, 0, Positive), encode(1, -1022, Positive) / encode(1, -1022, Positive)); +} + +TEST_F(DecimalTest, DivisionSpecialValues) +{ + const Decimal Infinity(Decimal::infinity(Positive)); + const Decimal MinusInfinity(Decimal::infinity(Negative)); + const Decimal NaN(Decimal::nan()); + const Decimal Zero(Decimal::zero(Positive)); + const Decimal MinusZero(Decimal::zero(Negative)); + const Decimal Ten(10); + const Decimal MinusTen(-10); + + EXPECT_EQ(NaN, Zero / Zero); + EXPECT_EQ(NaN, Zero / MinusZero); + EXPECT_EQ(NaN, MinusZero / Zero); + EXPECT_EQ(NaN, MinusZero / MinusZero); + + EXPECT_EQ(Infinity, Ten / Zero); + EXPECT_EQ(MinusInfinity, Ten / MinusZero); + EXPECT_EQ(MinusInfinity, MinusTen / Zero); + EXPECT_EQ(Infinity, MinusTen / MinusZero); + + EXPECT_EQ(Infinity, Infinity / Zero); + EXPECT_EQ(MinusInfinity, Infinity / MinusZero); + EXPECT_EQ(MinusInfinity, MinusInfinity / Zero); + EXPECT_EQ(Infinity, MinusInfinity / MinusZero); + + EXPECT_EQ(NaN, Infinity / Infinity); + EXPECT_EQ(NaN, Infinity / MinusInfinity); + EXPECT_EQ(NaN, MinusInfinity / Infinity); + EXPECT_EQ(NaN, MinusInfinity / MinusInfinity); + + EXPECT_EQ(Zero, Ten / Infinity); + EXPECT_EQ(MinusZero, Ten / MinusInfinity); + EXPECT_EQ(MinusZero, MinusTen / Infinity); + EXPECT_EQ(Zero, MinusTen / MinusInfinity); + + EXPECT_EQ(NaN, NaN / NaN); + EXPECT_EQ(NaN, NaN / Ten); + EXPECT_EQ(NaN, Ten / NaN); + + EXPECT_EQ(NaN, NaN / Infinity); + EXPECT_EQ(NaN, NaN / MinusInfinity); + EXPECT_EQ(NaN, Infinity / NaN); + EXPECT_EQ(NaN, MinusInfinity / NaN); +} + +TEST_F(DecimalTest, EncodedData) +{ + EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Positive)); + EXPECT_EQ(encode(0, 0, Negative), encode(0, 0, Negative)); + EXPECT_EQ(Decimal(1), Decimal(1)); + EXPECT_EQ(encode(1, 0, Negative), encode(1, 0, Negative)); + EXPECT_EQ(Decimal::infinity(Positive), encode(1, 2000, Positive)); + EXPECT_EQ(Decimal::zero(Positive), encode(1, -2000, Positive)); +} + +TEST_F(DecimalTest, Floor) +{ + EXPECT_EQ(Decimal(1), Decimal(1).floor()); + EXPECT_EQ(Decimal(1), encode(11, -1, Positive).floor()); + EXPECT_EQ(Decimal(1), encode(13, -1, Positive).floor()); + EXPECT_EQ(Decimal(1), encode(15, -1, Positive).floor()); + EXPECT_EQ(Decimal(1), encode(19, -1, Positive).floor()); + + EXPECT_EQ(Decimal(-1), Decimal(-1).floor()); + EXPECT_EQ(Decimal(-2), encode(11, -1, Negative).floor()); + EXPECT_EQ(Decimal(-2), encode(13, -1, Negative).floor()); + EXPECT_EQ(Decimal(-2), encode(15, -1, Negative).floor()); + EXPECT_EQ(Decimal(-2), encode(19, -1, Negative).floor()); +} + +TEST_F(DecimalTest, FloorBigExponent) +{ + EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).floor()); + EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).floor()); +} + +TEST_F(DecimalTest, FloorSmallExponent) +{ + EXPECT_EQ(encode(0, 0, Positive), encode(1, -1000, Positive).floor()); + EXPECT_EQ(encode(0, 0, Negative), encode(1, -1000, Negative).floor()); +} + +TEST_F(DecimalTest, FloorSpecialValues) +{ + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).floor()); + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).floor()); + EXPECT_EQ(Decimal::nan(), Decimal::nan().floor()); +} + +TEST_F(DecimalTest, FromInt32) +{ + EXPECT_EQ(encode(0, 0, Positive), Decimal(0)); + EXPECT_EQ(encode(1, 0, Positive), Decimal(1)); + EXPECT_EQ(encode(1, 0, Negative), Decimal(-1)); + EXPECT_EQ(encode(100, 0, Positive), Decimal(100)); + EXPECT_EQ(encode(100, 0, Negative), Decimal(-100)); + EXPECT_EQ(encode(0x7FFFFFFF, 0, Positive), Decimal(std::numeric_limits<int32_t>::max())); + EXPECT_EQ(encode(0x80000000u, 0, Negative), Decimal(std::numeric_limits<int32_t>::min())); +} + +TEST_F(DecimalTest, FromString) +{ + EXPECT_EQ(encode(0, 0, Positive), fromString("0")); + EXPECT_EQ(encode(0, 0, Negative), fromString("-0")); + EXPECT_EQ(Decimal(1), fromString("1")); + EXPECT_EQ(encode(1, 0, Negative), fromString("-1")); + EXPECT_EQ(Decimal(1), fromString("01")); + EXPECT_EQ(encode(3, 0, Positive), fromString("+3")); + EXPECT_EQ(encode(0, 3, Positive), fromString("0E3")); + EXPECT_EQ(encode(5, -1, Positive), fromString(".5")); + EXPECT_EQ(encode(100, 0, Positive), fromString("100")); + EXPECT_EQ(encode(100, 0, Negative), fromString("-100")); + EXPECT_EQ(encode(123, -2, Positive), fromString("1.23")); + EXPECT_EQ(encode(123, -2, Negative), fromString("-1.23")); + EXPECT_EQ(encode(123, 8, Positive), fromString("1.23E10")); + EXPECT_EQ(encode(123, 8, Negative), fromString("-1.23E10")); + EXPECT_EQ(encode(123, 8, Positive), fromString("1.23E+10")); + EXPECT_EQ(encode(123, 8, Negative), fromString("-1.23E+10")); + EXPECT_EQ(encode(123, -12, Positive), fromString("1.23E-10")); + EXPECT_EQ(encode(123, -12, Negative), fromString("-1.23E-10")); + EXPECT_EQ(encode(5, -7, Positive), fromString("0.0000005")); + EXPECT_EQ(encode(0, 0, Positive), fromString("0e9999")); + EXPECT_EQ(encode(123, -3, Positive), fromString("0.123")); + EXPECT_EQ(encode(0, -2, Positive), fromString("00.00")); + EXPECT_EQ(encode(1, 2, Positive), fromString("1E2")); + EXPECT_EQ(Decimal::infinity(Positive), fromString("1E20000")); + EXPECT_EQ(Decimal::zero(Positive), fromString("1E-20000")); + EXPECT_EQ(encode(1000, 1023, Positive), fromString("1E1026")); + EXPECT_EQ(Decimal::zero(Positive), fromString("1E-1026")); + EXPECT_EQ(Decimal::infinity(Positive), fromString("1234567890E1036")); + + // 2^1024 + const uint64_t leadingDigitsOf2PowerOf1024 = UINT64_C(17976931348623159); + EXPECT_EQ(encode(leadingDigitsOf2PowerOf1024, 292, Positive), fromString("179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216")); +} + +// These strings are look like proper number, but we don't accept them. +TEST_F(DecimalTest, FromStringLikeNumber) +{ + EXPECT_EQ(Decimal::nan(), fromString(" 123 ")); + EXPECT_EQ(Decimal::nan(), fromString("1,234")); +} + +// fromString doesn't support infinity and NaN. +TEST_F(DecimalTest, FromStringSpecialValues) +{ + EXPECT_EQ(Decimal::nan(), fromString("INF")); + EXPECT_EQ(Decimal::nan(), fromString("Infinity")); + EXPECT_EQ(Decimal::nan(), fromString("infinity")); + EXPECT_EQ(Decimal::nan(), fromString("+Infinity")); + EXPECT_EQ(Decimal::nan(), fromString("+infinity")); + EXPECT_EQ(Decimal::nan(), fromString("-Infinity")); + EXPECT_EQ(Decimal::nan(), fromString("-infinity")); + EXPECT_EQ(Decimal::nan(), fromString("NaN")); + EXPECT_EQ(Decimal::nan(), fromString("nan")); + EXPECT_EQ(Decimal::nan(), fromString("+NaN")); + EXPECT_EQ(Decimal::nan(), fromString("+nan")); + EXPECT_EQ(Decimal::nan(), fromString("-NaN")); + EXPECT_EQ(Decimal::nan(), fromString("-nan")); +} + +TEST_F(DecimalTest, fromStringTruncated) +{ + EXPECT_EQ(Decimal::nan(), fromString("x")); + EXPECT_EQ(Decimal::nan(), fromString("0.")); + EXPECT_EQ(Decimal::nan(), fromString("1x")); + + EXPECT_EQ(Decimal::nan(), fromString("1Ex")); + EXPECT_EQ(Decimal::nan(), fromString("1E2x")); + EXPECT_EQ(Decimal::nan(), fromString("1E+x")); +} + +TEST_F(DecimalTest, Multiplication) +{ + EXPECT_EQ(encode(0, 0, Positive), Decimal(0) * Decimal(0)); + EXPECT_EQ(encode(2, 0, Negative), Decimal(2) * Decimal(-1)); + EXPECT_EQ(encode(2, 0, Negative), Decimal(-1) * Decimal(2)); + EXPECT_EQ(encode(99, 0, Positive), Decimal(99) * Decimal(1)); + EXPECT_EQ(encode(2500, 0, Positive), Decimal(-50) * Decimal(-50)); +} + +TEST_F(DecimalTest, MultiplicationBigExponent) +{ + EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) * encode(1, 0, Positive)); + EXPECT_EQ(Decimal::infinity(Positive), encode(1, 1022, Positive) * encode(1, 1022, Positive)); + EXPECT_EQ(encode(1, 22, Positive), encode(1, 1022, Positive) * encode(1, -1000, Positive)); +} + +TEST_F(DecimalTest, MultiplicationSmallExponent) +{ + EXPECT_EQ(encode(1, -1022, Positive), encode(1, -1022, Positive) * encode(1, 0, Positive)); + EXPECT_EQ(encode(0, 0, Positive), encode(1, -1022, Positive) * encode(1, -1022, Positive)); +} + +TEST_F(DecimalTest, MultiplicationSpecialValues) +{ + const Decimal Infinity(Decimal::infinity(Positive)); + const Decimal MinusInfinity(Decimal::infinity(Negative)); + const Decimal NaN(Decimal::nan()); + const Decimal Ten(10); + const Decimal MinusTen(-10); + const Decimal Zero(Decimal::zero(Positive)); + const Decimal MinusZero(Decimal::zero(Negative)); + + EXPECT_EQ(Infinity, Infinity * Infinity); + EXPECT_EQ(MinusInfinity, Infinity * MinusInfinity); + EXPECT_EQ(MinusInfinity, MinusInfinity * Infinity); + EXPECT_EQ(Infinity, MinusInfinity * MinusInfinity); + + EXPECT_EQ(NaN, Infinity * Zero); + EXPECT_EQ(NaN, Zero * MinusInfinity); + EXPECT_EQ(NaN, MinusInfinity * Zero); + EXPECT_EQ(NaN, MinusInfinity * Zero); + + EXPECT_EQ(NaN, Infinity * MinusZero); + EXPECT_EQ(NaN, MinusZero * MinusInfinity); + EXPECT_EQ(NaN, MinusInfinity * MinusZero); + EXPECT_EQ(NaN, MinusInfinity * MinusZero); + + EXPECT_EQ(Infinity, Infinity * Ten); + EXPECT_EQ(Infinity, Ten * Infinity); + EXPECT_EQ(MinusInfinity, MinusInfinity * Ten); + EXPECT_EQ(MinusInfinity, Ten * MinusInfinity); + + EXPECT_EQ(MinusInfinity, Infinity * MinusTen); + EXPECT_EQ(MinusInfinity, MinusTen * Infinity); + EXPECT_EQ(Infinity, MinusInfinity * MinusTen); + EXPECT_EQ(Infinity, MinusTen * MinusInfinity); + + EXPECT_EQ(NaN, NaN * NaN); + EXPECT_EQ(NaN, NaN * Ten); + EXPECT_EQ(NaN, Ten * NaN); + + EXPECT_EQ(NaN, NaN * Infinity); + EXPECT_EQ(NaN, NaN * MinusInfinity); + EXPECT_EQ(NaN, Infinity * NaN); + EXPECT_EQ(NaN, MinusInfinity * NaN); +} + +TEST_F(DecimalTest, Negate) +{ + EXPECT_EQ(encode(0, 0, Negative), -encode(0, 0, Positive)); + EXPECT_EQ(encode(0, 0, Positive), -encode(0, 0, Negative)); + + EXPECT_EQ(encode(0, 10, Negative), -encode(0, 10, Positive)); + EXPECT_EQ(encode(0, 10, Positive), -encode(0, 10, Negative)); + + EXPECT_EQ(encode(0, -10, Negative), -encode(0, -10, Positive)); + EXPECT_EQ(encode(0, -10, Positive), -encode(0, -10, Negative)); + + EXPECT_EQ(encode(1, 0, Negative), -encode(1, 0, Positive)); + EXPECT_EQ(encode(1, 0, Positive), -encode(1, 0, Negative)); + + EXPECT_EQ(encode(1, 10, Negative), -encode(1, 10, Positive)); + EXPECT_EQ(encode(1, 10, Positive), -encode(1, 10, Negative)); + + EXPECT_EQ(encode(1, -10, Negative), -encode(1, -10, Positive)); + EXPECT_EQ(encode(1, -10, Positive), -encode(1, -10, Negative)); +} + +TEST_F(DecimalTest, NegateBigExponent) +{ + EXPECT_EQ(encode(1, 1000, Negative), -encode(1, 1000, Positive)); + EXPECT_EQ(encode(1, 1000, Positive), -encode(1, 1000, Negative)); +} + +TEST_F(DecimalTest, NegateSmallExponent) +{ + EXPECT_EQ(encode(1, -1000, Negative), -encode(1, -1000, Positive)); + EXPECT_EQ(encode(1, -1000, Positive), -encode(1, -1000, Negative)); +} + +TEST_F(DecimalTest, NegateSpecialValues) +{ + EXPECT_EQ(Decimal::infinity(Negative), -Decimal::infinity(Positive)); + EXPECT_EQ(Decimal::infinity(Positive), -Decimal::infinity(Negative)); + EXPECT_EQ(Decimal::nan(), -Decimal::nan()); +} + +TEST_F(DecimalTest, Predicates) +{ + EXPECT_TRUE(Decimal::zero(Positive).isFinite()); + EXPECT_TRUE(Decimal::zero(Positive).isPositive()); + EXPECT_FALSE(Decimal::zero(Positive).isNegative()); + EXPECT_FALSE(Decimal::zero(Positive).isSpecial()); + EXPECT_TRUE(Decimal::zero(Positive).isZero()); + + EXPECT_TRUE(Decimal::zero(Negative).isFinite()); + EXPECT_FALSE(Decimal::zero(Negative).isPositive()); + EXPECT_TRUE(Decimal::zero(Negative).isNegative()); + EXPECT_FALSE(Decimal::zero(Negative).isSpecial()); + EXPECT_TRUE(Decimal::zero(Negative).isZero()); + + EXPECT_TRUE(Decimal(123).isFinite()); + EXPECT_TRUE(Decimal(123).isPositive()); + EXPECT_FALSE(Decimal(123).isNegative()); + EXPECT_FALSE(Decimal(123).isSpecial()); + EXPECT_FALSE(Decimal(123).isZero()); + + EXPECT_TRUE(Decimal(-123).isFinite()); + EXPECT_FALSE(Decimal(-123).isPositive()); + EXPECT_TRUE(Decimal(-123).isNegative()); + EXPECT_FALSE(Decimal(-123).isSpecial()); + EXPECT_FALSE(Decimal(-123).isZero()); +} + +TEST_F(DecimalTest, PredicatesSpecialValues) +{ + EXPECT_FALSE(Decimal::infinity(Positive).isFinite()); + EXPECT_TRUE(Decimal::infinity(Positive).isPositive()); + EXPECT_FALSE(Decimal::infinity(Positive).isNegative()); + EXPECT_TRUE(Decimal::infinity(Positive).isSpecial()); + EXPECT_FALSE(Decimal::infinity(Positive).isZero()); + + EXPECT_FALSE(Decimal::infinity(Negative).isFinite()); + EXPECT_FALSE(Decimal::infinity(Negative).isPositive()); + EXPECT_TRUE(Decimal::infinity(Negative).isNegative()); + EXPECT_TRUE(Decimal::infinity(Negative).isSpecial()); + EXPECT_FALSE(Decimal::infinity(Negative).isZero()); + + EXPECT_FALSE(Decimal::nan().isFinite()); + EXPECT_TRUE(Decimal::nan().isSpecial()); + EXPECT_FALSE(Decimal::nan().isZero()); +} + +// LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer +TEST_F(DecimalTest, RealWorldExampleNumberStepUpStepDownFromRenderer) +{ + EXPECT_EQ(String("10"), stepDown("0", "100", "10", "19", 1)); + EXPECT_EQ(String("90"), stepUp("0", "99", "10", "89", 1)); + EXPECT_EQ(String("1"), stepUp("0", "1", "0.33333333333333333", "0", 3)); // step=1/3 + EXPECT_EQ(String("0.01"), stepUp("0", "0.01", "0.0033333333333333333", "0", 3)); // step=1/300 + EXPECT_EQ(String("1"), stepUp("0", "1", "0.003921568627450980", "0", 255)); // step=1/255 + EXPECT_EQ(String("1"), stepUp("0", "1", "0.1", "0", 10)); +} + +TEST_F(DecimalTest, RealWorldExampleNumberStepUpStepDownFromRendererRounding) +{ + EXPECT_EQ(String("5.015"), stepUp("0", "100", "0.005", "5.005", 2)); + EXPECT_EQ(String("5.06"), stepUp("0", "100", "0.005", "5.005", 11)); + EXPECT_EQ(String("5.065"), stepUp("0", "100", "0.005", "5.005", 12)); + + EXPECT_EQ(String("5.015"), stepUp("4", "9", "0.005", "5.005", 2)); + EXPECT_EQ(String("5.06"), stepUp("4", "9", "0.005", "5.005", 11)); + EXPECT_EQ(String("5.065"), stepUp("4", "9", "0.005", "5.005", 12)); +} + +TEST_F(DecimalTest, RealWorldExampleRangeStepUpStepDown) +{ + EXPECT_EQ(String("1e+38"), stepUp("0", "1E38", "1", "1E38", 9)); + EXPECT_EQ(String("1e+38"), stepDown("0", "1E38", "1", "1E38", 9)); +} + +TEST_F(DecimalTest, Remainder) +{ + EXPECT_EQ(encode(9, -1, Negative), encode(21, -1, Positive).remainder(3)); + EXPECT_EQ(Decimal(1), Decimal(10).remainder(3)); + EXPECT_EQ(encode(1, 0, Negative), Decimal(-10).remainder(3)); + EXPECT_EQ(encode(2, -1, Positive), encode(102, -1, Positive).remainder(1)); + EXPECT_EQ(encode(1, -1, Positive), Decimal(10).remainder(encode(3, -1, Positive))); + EXPECT_EQ(encode(3, -1, Negative), encode(36, -1, Positive).remainder(encode(13, -1, Positive))); + EXPECT_EQ(encode(1, 87, Positive), (encode(1234, 100, Positive).remainder(Decimal(3)))); +} + +TEST_F(DecimalTest, RemainderBigExponent) +{ + EXPECT_EQ(encode(0, 1022, Positive), encode(1, 1022, Positive).remainder(encode(1, 0, Positive))); + EXPECT_EQ(encode(0, 1022, Positive), encode(1, 1022, Positive).remainder(encode(1, 1022, Positive))); + EXPECT_EQ(Decimal::infinity(Positive), encode(1, 1022, Positive).remainder(encode(1, -1000, Positive))); +} + +TEST_F(DecimalTest, RemainderSmallExponent) +{ + EXPECT_EQ(encode(1, -1022, Positive), encode(1, -1022, Positive).remainder(encode(1, 0, Positive))); + EXPECT_EQ(encode(0, -1022, Positive), encode(1, -1022, Positive).remainder(encode(1, -1022, Positive))); +} + +TEST_F(DecimalTest, RemainderSpecialValues) +{ + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).remainder(1)); + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).remainder(1)); + EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(1)); + + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Positive).remainder(-1)); + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Negative).remainder(-1)); + EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(-1)); + + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).remainder(3)); + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).remainder(3)); + EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(3)); + + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Positive).remainder(-1)); + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Negative).remainder(-1)); + EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(-1)); + + EXPECT_EQ(Decimal::nan(), Decimal(1).remainder(Decimal::infinity(Positive))); + EXPECT_EQ(Decimal::nan(), Decimal(1).remainder(Decimal::infinity(Negative))); + EXPECT_EQ(Decimal::nan(), Decimal(1).remainder(Decimal::nan())); +} + +TEST_F(DecimalTest, Round) +{ + EXPECT_EQ(Decimal(1), (Decimal(9) / Decimal(10)).round()); + EXPECT_EQ(Decimal(25), (Decimal(5) / fromString("0.200")).round()); + EXPECT_EQ(Decimal(3), (Decimal(5) / Decimal(2)).round()); + EXPECT_EQ(Decimal(1), (Decimal(2) / Decimal(3)).round()); + EXPECT_EQ(Decimal(3), (Decimal(10) / Decimal(3)).round()); + EXPECT_EQ(Decimal(3), (Decimal(1) / fromString("0.3")).round()); + EXPECT_EQ(Decimal(10), (Decimal(1) / fromString("0.1")).round()); + EXPECT_EQ(Decimal(5), (Decimal(1) / fromString("0.2")).round()); + EXPECT_EQ(Decimal(10), (fromString("10.2") / 1).round()); + EXPECT_EQ(encode(1234, 100, Positive), encode(1234, 100, Positive).round()); +} + +TEST_F(DecimalTest, RoundSpecialValues) +{ + EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).round()); + EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).round()); + EXPECT_EQ(Decimal::nan(), Decimal::nan().round()); +} + +TEST_F(DecimalTest, Subtract) +{ + EXPECT_EQ(encode(0, 0, Positive), Decimal(0) - Decimal(0)); + EXPECT_EQ(encode(3, 0, Positive), Decimal(2) - Decimal(-1)); + EXPECT_EQ(encode(3, 0, Negative), Decimal(-1) - Decimal(2)); + EXPECT_EQ(encode(98, 0, Positive), Decimal(99) - Decimal(1)); + EXPECT_EQ(encode(0, 0, Positive), Decimal(-50) - Decimal(-50)); + EXPECT_EQ(encode(UINT64_C(1000000000000000), 35, Positive), encode(1, 50, Positive) - Decimal(1)); + EXPECT_EQ(encode(UINT64_C(1000000000000000), 35, Negative), Decimal(1) - encode(1, 50, Positive)); +} + +TEST_F(DecimalTest, SubtractBigExponent) +{ + EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) - encode(1, 0, Positive)); + EXPECT_EQ(encode(0, 0, Positive), encode(1, 1022, Positive) - encode(1, 1022, Positive)); + EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) + encode(1, -1000, Positive)); +} + +TEST_F(DecimalTest, SubtractSmallExponent) +{ + EXPECT_EQ(encode(UINT64_C(10000000000000000), -16, Negative), encode(1, -1022, Positive) - encode(1, 0, Positive)); + EXPECT_EQ(encode(0, 0, Positive), encode(1, -1022, Positive) - encode(1, -1022, Positive)); +} + +TEST_F(DecimalTest, SubtractSpecialValues) +{ + const Decimal Infinity(Decimal::infinity(Positive)); + const Decimal MinusInfinity(Decimal::infinity(Negative)); + const Decimal NaN(Decimal::nan()); + const Decimal Ten(10); + + EXPECT_EQ(NaN, Infinity - Infinity); + EXPECT_EQ(Infinity, Infinity - MinusInfinity); + EXPECT_EQ(MinusInfinity, MinusInfinity - Infinity); + EXPECT_EQ(NaN, MinusInfinity - MinusInfinity); + + EXPECT_EQ(Infinity, Infinity - Ten); + EXPECT_EQ(MinusInfinity, Ten - Infinity); + EXPECT_EQ(MinusInfinity, MinusInfinity - Ten); + EXPECT_EQ(Infinity, Ten - MinusInfinity); + + EXPECT_EQ(NaN, NaN - NaN); + EXPECT_EQ(NaN, NaN - Ten); + EXPECT_EQ(NaN, Ten - NaN); + + EXPECT_EQ(NaN, NaN - Infinity); + EXPECT_EQ(NaN, NaN - MinusInfinity); + EXPECT_EQ(NaN, Infinity - NaN); + EXPECT_EQ(NaN, MinusInfinity - NaN); +} + +TEST_F(DecimalTest, ToString) +{ + EXPECT_EQ(String("0"), Decimal::zero(Positive).toString()); + EXPECT_EQ(String("-0"), Decimal::zero(Negative).toString()); + EXPECT_EQ(String("1"), Decimal(1).toString()); + EXPECT_EQ(String("-1"), Decimal(-1).toString()); + EXPECT_EQ(String("1234567"), Decimal(1234567).toString()); + EXPECT_EQ(String("-1234567"), Decimal(-1234567).toString()); + EXPECT_EQ(String("0.5"), encode(5, -1, Positive).toString()); + EXPECT_EQ(String("-0.5"), encode(5, -1, Negative).toString()); + EXPECT_EQ(String("12.345"), encode(12345, -3, Positive).toString()); + EXPECT_EQ(String("-12.345"), encode(12345, -3, Negative).toString()); + EXPECT_EQ(String("0.12345"), encode(12345, -5, Positive).toString()); + EXPECT_EQ(String("-0.12345"), encode(12345, -5, Negative).toString()); + EXPECT_EQ(String("50"), encode(50, 0, Positive).toString()); + EXPECT_EQ(String("-50"), encode(50, 0, Negative).toString()); + EXPECT_EQ(String("5e+1"), encode(5, 1, Positive).toString()); + EXPECT_EQ(String("-5e+1"), encode(5, 1, Negative).toString()); + EXPECT_EQ(String("5.678e+103"), encode(5678, 100, Positive).toString()); + EXPECT_EQ(String("-5.678e+103"), encode(5678, 100, Negative).toString()); + EXPECT_EQ(String("5.678e-97"), encode(5678, -100, Positive).toString()); + EXPECT_EQ(String("-5.678e-97"), encode(5678, -100, Negative).toString()); +} + +TEST_F(DecimalTest, ToStringSpecialValues) +{ + EXPECT_EQ(String("Infinity"), Decimal::infinity(Positive).toString()); + EXPECT_EQ(String("-Infinity"), Decimal::infinity(Negative).toString()); + EXPECT_EQ(String("NaN"), Decimal::nan().toString()); +} diff --git a/Source/WebKit/chromium/tests/FloatQuadTest.cpp b/Source/WebKit/chromium/tests/FloatQuadTest.cpp index 6c7091ca4..3e2f9bce6 100644 --- a/Source/WebKit/chromium/tests/FloatQuadTest.cpp +++ b/Source/WebKit/chromium/tests/FloatQuadTest.cpp @@ -25,20 +25,20 @@ #include "config.h" +#include "cc/CCMathUtil.h" #include "FloatQuad.h" - -#include "TransformationMatrix.h" - #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { TEST(FloatQuadTest, IsRectilinearTest) { const int numRectilinear = 8; - TransformationMatrix rectilinearTrans[numRectilinear]; + WebTransformationMatrix rectilinearTrans[numRectilinear]; rectilinearTrans[1].rotate(90); rectilinearTrans[2].rotate(180); rectilinearTrans[3].rotate(270); @@ -50,12 +50,14 @@ TEST(FloatQuadTest, IsRectilinearTest) rectilinearTrans[7].rotate(180); for (int i = 0; i < numRectilinear; ++i) { - FloatQuad quad = rectilinearTrans[i].mapQuad(FloatRect(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f)); + bool clipped = false; + FloatQuad quad = CCMathUtil::mapQuad(rectilinearTrans[i], FloatRect(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f), clipped); + ASSERT_TRUE(!clipped); EXPECT_TRUE(quad.isRectilinear()); } const int numNonRectilinear = 10; - TransformationMatrix nonRectilinearTrans[numNonRectilinear]; + WebTransformationMatrix nonRectilinearTrans[numNonRectilinear]; nonRectilinearTrans[0].rotate(359.999); nonRectilinearTrans[1].rotate(0.0000001); nonRectilinearTrans[2].rotate(89.999999); @@ -68,7 +70,9 @@ TEST(FloatQuadTest, IsRectilinearTest) nonRectilinearTrans[9].skewY(0.00001); for (int i = 0; i < numNonRectilinear; ++i) { - FloatQuad quad = nonRectilinearTrans[i].mapQuad(FloatRect(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f)); + bool clipped = false; + FloatQuad quad = CCMathUtil::mapQuad(nonRectilinearTrans[i], FloatRect(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f), clipped); + ASSERT_TRUE(!clipped); EXPECT_FALSE(quad.isRectilinear()); } } diff --git a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp index 491d48db5..8213dd812 100644 --- a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp @@ -36,9 +36,11 @@ #include "cc/CCSingleThreadProxy.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; using namespace WebKitTests; +using WebKit::WebTransformationMatrix; using ::testing::Mock; using ::testing::_; using ::testing::AtLeast; @@ -496,8 +498,8 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawOpacity(0.5f)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setClipRect(IntRect(3, 3, 8, 8))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setTargetRenderSurface(0)); - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawTransform(TransformationMatrix())); - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setScreenSpaceTransform(TransformationMatrix())); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawTransform(WebTransformationMatrix())); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setScreenSpaceTransform(WebTransformationMatrix())); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawableContentRect(IntRect(4, 5, 6, 7))); EXPECT_FALSE(testLayer->needsDisplay()); @@ -512,13 +514,13 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setOpaque(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setPosition(FloatPoint(4.0f, 9.0f))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setReplicaLayer(dummyLayer.get())); - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setSublayerTransform(TransformationMatrix(0, 0, 0, 0, 0, 0))); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setSublayerTransform(WebTransformationMatrix(0, 0, 0, 0, 0, 0))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setScrollable(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setShouldScrollOnMainThread(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setNonFastScrollableRegion(Region(IntRect(1, 1, 2, 2)))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setHaveWheelEventHandlers(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setScrollPosition(IntPoint(10, 10))); - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setTransform(TransformationMatrix(0, 0, 0, 0, 0, 0))); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setTransform(WebTransformationMatrix(0, 0, 0, 0, 0, 0))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setDoubleSided(false)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setDebugName("Test Layer")); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setDrawCheckerboardForMissingTiles(!testLayer->drawCheckerboardForMissingTiles())); diff --git a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp index 8445feba7..4ed35986c 100644 --- a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp @@ -275,3 +275,44 @@ TEST(LayerRendererChromiumTest2, initializationDoesNotMakeSynchronousCalls) EXPECT_TRUE(layerRendererChromium.initialize()); } + +class LoseContextOnFirstGetContext : public FakeWebGraphicsContext3D { +public: + LoseContextOnFirstGetContext() + : m_contextLost(false) + { + } + + virtual bool makeContextCurrent() OVERRIDE + { + return !m_contextLost; + } + + virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value) OVERRIDE + { + m_contextLost = true; + *value = 0; + } + + virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value) OVERRIDE + { + m_contextLost = true; + *value = 0; + } + + virtual WGC3Denum getGraphicsResetStatusARB() OVERRIDE + { + return m_contextLost ? 1 : 0; + } + +private: + bool m_contextLost; +}; + +TEST(LayerRendererChromiumTest2, initializationWithQuicklyLostContextDoesNotAssert) +{ + FakeLayerRendererChromiumClient mockClient; + FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new LoseContextOnFirstGetContext), GraphicsContext3D::RenderDirectlyToHostWindow)); + + layerRendererChromium.initialize(); +} diff --git a/Source/WebKit/chromium/tests/LinkHighlightTest.cpp b/Source/WebKit/chromium/tests/LinkHighlightTest.cpp index edcfd4a63..be467a0d5 100644 --- a/Source/WebKit/chromium/tests/LinkHighlightTest.cpp +++ b/Source/WebKit/chromium/tests/LinkHighlightTest.cpp @@ -31,11 +31,12 @@ #include "GraphicsLayerClient.h" #include "IntRect.h" #include "Path.h" -#include "TransformationMatrix.h" #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> #include <wtf/PassOwnPtr.h> using namespace WebCore; +using WebKit::WebTransformationMatrix; namespace { @@ -63,11 +64,10 @@ TEST(LinkHighlightTest, verifyLinkHighlightLayer) EXPECT_TRUE(contentLayer->transform().isIdentityOrTranslation()); EXPECT_TRUE(contentLayer->transform().isIntegerTranslation()); - TransformationMatrix::DecomposedType decomposition; - EXPECT_TRUE(contentLayer->transform().decompose(decomposition)); - - FloatPoint expectedTranslation(pathBoundingRect.x() + pathBoundingRect.width() / 2, pathBoundingRect.y() + pathBoundingRect.height() / 2); - EXPECT_EQ(FloatPoint(decomposition.translateX, decomposition.translateY), expectedTranslation); + float expectedXTranslation = pathBoundingRect.x() + pathBoundingRect.width() / 2; + float expectedYTranslation = pathBoundingRect.y() + pathBoundingRect.height() / 2; + EXPECT_FLOAT_EQ(expectedXTranslation, contentLayer->transform().m41()); + EXPECT_FLOAT_EQ(expectedYTranslation, contentLayer->transform().m42()); } TEST(LinkHighlightTest, verifyGraphicsLayerChromiumEmbedding) diff --git a/Source/WebKit/chromium/tests/PopupMenuTest.cpp b/Source/WebKit/chromium/tests/PopupMenuTest.cpp index 1db65ec6e..7acb31149 100644 --- a/Source/WebKit/chromium/tests/PopupMenuTest.cpp +++ b/Source/WebKit/chromium/tests/PopupMenuTest.cpp @@ -182,10 +182,6 @@ public: protected: virtual void SetUp() { - // When touch is enabled, padding is added to option elements - // In these tests, we'll assume touch is disabled. - m_touchWasEnabled = RuntimeEnabledFeatures::touchEnabled(); - RuntimeEnabledFeatures::setTouchEnabled(false); m_webView = static_cast<WebViewImpl*>(WebView::create(&m_webviewClient)); m_webView->initializeMainFrame(&m_webFrameClient); m_popupMenu = adoptRef(new PopupMenuChromium(&m_popupMenuClient)); @@ -196,7 +192,6 @@ protected: m_popupMenu = 0; m_webView->close(); webkit_support::UnregisterAllMockedURLs(); - RuntimeEnabledFeatures::setTouchEnabled(m_touchWasEnabled); } // Returns true if there currently is a select popup in the WebView. @@ -284,7 +279,6 @@ protected: TestWebFrameClient m_webFrameClient; TestPopupMenuClient m_popupMenuClient; RefPtr<PopupMenu> m_popupMenu; - bool m_touchWasEnabled; std::string baseURL; }; @@ -360,8 +354,9 @@ TEST_F(SelectPopupMenuTest, ClickItem) { showPopup(); - // Y of 18 to be on the item at index 1 (12 font plus border and more to be safe). - IntPoint row1Point(2, 18); + int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); + // menuItemHeight * 1.5 means the Y position on the item at index 1. + IntPoint row1Point(2, menuItemHeight * 1.5); // Simulate a click down/up on the first item. simulateLeftMouseDownEvent(row1Point); simulateLeftMouseUpEvent(row1Point); @@ -377,8 +372,9 @@ TEST_F(SelectPopupMenuTest, MouseOverItemClickOutside) { showPopup(); - // Y of 18 to be on the item at index 1 (12 font plus border and more to be safe). - IntPoint row1Point(2, 18); + int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); + // menuItemHeight * 1.5 means the Y position on the item at index 1. + IntPoint row1Point(2, menuItemHeight * 1.5); // Simulate the mouse moving over the first item. PlatformMouseEvent mouseEvent(row1Point, row1Point, NoButton, PlatformEvent::MouseMoved, 1, false, false, false, false, 0); @@ -421,9 +417,9 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) showPopup(); - int menuHeight = m_webView->selectPopup()->menuItemHeight(); - // menuHeight * 0.5 means the Y position on the item at index 0. - IntPoint row1Point(2, menuHeight * 0.5); + int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); + // menuItemHeight * 0.5 means the Y position on the item at index 0. + IntPoint row1Point(2, menuItemHeight * 0.5); simulateLeftMouseDownEvent(row1Point); simulateLeftMouseUpEvent(row1Point); @@ -437,8 +433,8 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) m_popupMenuClient.setDisabledIndex(1); showPopup(); - // menuHeight * 1.5 means the Y position on the item at index 1. - row1Point.setY(menuHeight * 1.5); + // menuItemHeight * 1.5 means the Y position on the item at index 1. + row1Point.setY(menuItemHeight * 1.5); simulateLeftMouseDownEvent(row1Point); simulateLeftMouseUpEvent(row1Point); @@ -446,8 +442,8 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) EXPECT_STREQ("upclick", std::string(element.innerText().utf8()).c_str()); showPopup(); - // menuHeight * 2.5 means the Y position on the item at index 2. - row1Point.setY(menuHeight * 2.5); + // menuItemHeight * 2.5 means the Y position on the item at index 2. + row1Point.setY(menuItemHeight * 2.5); simulateLeftMouseDownEvent(row1Point); simulateLeftMouseUpEvent(row1Point); @@ -488,9 +484,9 @@ TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnChange) showPopup(); - int menuHeight = m_webView->selectPopup()->menuItemHeight(); - // menuHeight * 1.5 means the Y position on the item at index 1. - IntPoint row1Point(2, menuHeight * 1.5); + int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); + // menuItemHeight * 1.5 means the Y position on the item at index 1. + IntPoint row1Point(2, menuItemHeight * 1.5); simulateLeftMouseDownEvent(row1Point); simulateLeftMouseUpEvent(row1Point); @@ -510,9 +506,9 @@ TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnClick) showPopup(); - int menuHeight = m_webView->selectPopup()->menuItemHeight(); - // menuHeight * 1.5 means the Y position on the item at index 1. - IntPoint row1Point(2, menuHeight * 1.5); + int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); + // menuItemHeight * 1.5 means the Y position on the item at index 1. + IntPoint row1Point(2, menuItemHeight * 1.5); simulateLeftMouseDownEvent(row1Point); simulateLeftMouseUpEvent(row1Point); diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index c9125a852..80b099f19 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -33,10 +33,12 @@ #include "WebCompositor.h" #include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> using namespace WebCore; using namespace WebKitTests; using namespace WTF; +using WebKit::WebTransformationMatrix; #define EXPECT_EQ_RECT(a, b) \ EXPECT_EQ(a.x(), b.x()); \ @@ -109,7 +111,7 @@ TEST(TiledLayerChromiumTest, pushOccludedDirtyTiles) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); layer->invalidateRect(IntRect(0, 0, 100, 200)); layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), &occluded); @@ -327,7 +329,7 @@ TEST(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) occluded.setOcclusion(IntRect(0, 0, 100, 100)); layer->setBounds(IntSize(100, 100)); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleLayerRect(IntRect(0, 0, 100, 100)); layer->invalidateRect(IntRect(0, 0, 100, 100)); layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), &occluded); @@ -1018,7 +1020,7 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusion) // The tile size is 100x100. layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); @@ -1063,7 +1065,7 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) // The tile size is 100x100. layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); // The partially occluded tiles (by the 150 occlusion height) are visible beyond the occlusion, so not culled. occluded.setOcclusion(IntRect(200, 200, 300, 150)); @@ -1114,7 +1116,7 @@ TEST(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) // The tile size is 100x100. layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); layer->setVisibleLayerRect(IntRect(0, 0, 600, 600)); @@ -1149,10 +1151,10 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) // This makes sure the painting works when the occluded region (in screen space) // is transformed differently than the layer. layer->setBounds(IntSize(600, 600)); - TransformationMatrix screenTransform; + WebTransformationMatrix screenTransform; screenTransform.scale(0.5); layer->setScreenSpaceTransform(screenTransform); - layer->setDrawTransform(screenTransform * TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(screenTransform * WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(100, 100, 150, 50)); layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); @@ -1179,7 +1181,7 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) // pixels, which means none should be occluded. layer->setContentsScale(0.5); layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); @@ -1212,10 +1214,10 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); // This makes sure content scaling and transforms work together. - TransformationMatrix screenTransform; + WebTransformationMatrix screenTransform; screenTransform.scale(0.5); layer->setScreenSpaceTransform(screenTransform); - layer->setDrawTransform(screenTransform * TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(screenTransform * WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(100, 100, 150, 100)); layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); @@ -1244,7 +1246,7 @@ TEST(TiledLayerChromiumTest, visibleContentOpaqueRegion) IntRect visibleBounds = IntRect(0, 0, 100, 150); layer->setBounds(contentBounds.size()); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleLayerRect(visibleBounds); layer->setDrawOpacity(1); @@ -1338,7 +1340,7 @@ TEST(TiledLayerChromiumTest, pixelsPaintedMetrics) IntRect visibleBounds = IntRect(0, 0, 100, 300); layer->setBounds(contentBounds.size()); - layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleLayerRect(visibleBounds); layer->setDrawOpacity(1); diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp index a6ab77fc1..4aa905c78 100644 --- a/Source/WebKit/chromium/tests/WebFrameTest.cpp +++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp @@ -643,4 +643,85 @@ TEST_F(WebFrameTest, FindInPage) webView->close(); } +TEST_F(WebFrameTest, GetContentAsPlainText) +{ + WebView* webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true); + // We set the size because it impacts line wrapping, which changes the + // resulting text value. + webView->resize(WebSize(640, 480)); + WebFrame* frame = webView->mainFrame(); + + // Generate a simple test case. + const char simpleSource[] = "<div>Foo bar</div><div></div>baz"; + GURL testURL("about:blank"); + frame->loadHTMLString(simpleSource, testURL); + webkit_support::RunAllPendingMessages(); + + // Make sure it comes out OK. + const std::string expected("Foo bar\nbaz"); + WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); + EXPECT_EQ(expected, std::string(text.utf8())); + + // Try reading the same one with clipping of the text. + const int length = 5; + text = frame->contentAsText(length); + EXPECT_EQ(expected.substr(0, length), std::string(text.utf8())); + + // Now do a new test with a subframe. + const char outerFrameSource[] = "Hello<iframe></iframe> world"; + frame->loadHTMLString(outerFrameSource, testURL); + webkit_support::RunAllPendingMessages(); + + // Load something into the subframe. + WebFrame* subframe = frame->findChildByExpression(WebString::fromUTF8("/html/body/iframe")); + ASSERT_TRUE(subframe); + subframe->loadHTMLString("sub<p>text", testURL); + webkit_support::RunAllPendingMessages(); + + text = frame->contentAsText(std::numeric_limits<size_t>::max()); + EXPECT_EQ("Hello world\n\nsub\ntext", std::string(text.utf8())); + + // Get the frame text where the subframe separator falls on the boundary of + // what we'll take. There used to be a crash in this case. + text = frame->contentAsText(12); + EXPECT_EQ("Hello world", std::string(text.utf8())); + + webView->close(); +} + +TEST_F(WebFrameTest, GetFullHtmlOfPage) +{ + WebView* webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true); + WebFrame* frame = webView->mainFrame(); + + // Generate a simple test case. + const char simpleSource[] = "<p>Hello</p><p>World</p>"; + GURL testURL("about:blank"); + frame->loadHTMLString(simpleSource, testURL); + webkit_support::RunAllPendingMessages(); + + WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); + EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8())); + + const std::string html = frame->contentAsMarkup().utf8(); + + // Load again with the output html. + frame->loadHTMLString(html, testURL); + webkit_support::RunAllPendingMessages(); + + EXPECT_EQ(html, std::string(frame->contentAsMarkup().utf8())); + + text = frame->contentAsText(std::numeric_limits<size_t>::max()); + EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8())); + + // Test selection check + EXPECT_FALSE(frame->hasSelection()); + frame->executeCommand(WebString::fromUTF8("SelectAll")); + EXPECT_TRUE(frame->hasSelection()); + frame->executeCommand(WebString::fromUTF8("Unselect")); + EXPECT_FALSE(frame->hasSelection()); + WebString selectionHtml = frame->selectionAsMarkup(); + EXPECT_TRUE(selectionHtml.isEmpty()); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/WebInputEventFactoryTestGtk.cpp b/Source/WebKit/chromium/tests/WebInputEventFactoryTestGtk.cpp index 64c63eae9..3792eaf79 100644 --- a/Source/WebKit/chromium/tests/WebInputEventFactoryTestGtk.cpp +++ b/Source/WebKit/chromium/tests/WebInputEventFactoryTestGtk.cpp @@ -31,11 +31,16 @@ #include "config.h" #include <gdk/gdk.h> +#include <gdk/gdkkeysyms.h> #include <gtest/gtest.h> +#include "KeyboardEvent.h" #include "WebInputEvent.h" +#include "WebInputEventConversion.h" #include "WebInputEventFactory.h" +using WebKit::WebInputEvent; +using WebKit::WebKeyboardEvent; using WebKit::WebMouseEvent; using WebKit::WebInputEventFactory; @@ -172,4 +177,27 @@ TEST(WebInputEventFactoryTest, MouseUpClickCount) EXPECT_EQ(0, mouseUpEvent.clickCount); } +TEST(WebInputEventFactoryTest, NumPadConversion) +{ + // Construct a GDK input event for the numpad "5" key. + char five[] = "5"; + GdkEventKey gdkEvent; + memset(&gdkEvent, 0, sizeof(GdkEventKey)); + gdkEvent.type = GDK_KEY_PRESS; + gdkEvent.keyval = GDK_KP_5; + gdkEvent.string = five; + + // Numpad flag should be set on the WebKeyboardEvent. + WebKeyboardEvent webEvent = WebInputEventFactory::keyboardEvent(&gdkEvent); + EXPECT_TRUE(webEvent.modifiers & WebInputEvent::IsKeyPad); + + // Round-trip through the WebCore KeyboardEvent class. + WebKit::PlatformKeyboardEventBuilder platformBuilder(webEvent); + RefPtr<WebCore::KeyboardEvent> keypress = WebCore::KeyboardEvent::create(platformBuilder, 0); + EXPECT_TRUE(keypress->keyLocation() == WebCore::KeyboardEvent::DOM_KEY_LOCATION_NUMPAD); + + WebKit::WebKeyboardEventBuilder builder(*keypress); + EXPECT_TRUE(builder.modifiers & WebInputEvent::IsKeyPad); +} + } // anonymous namespace diff --git a/Source/WebKit/chromium/tests/WebTransformOperationsTest.cpp b/Source/WebKit/chromium/tests/WebTransformOperationsTest.cpp new file mode 100644 index 000000000..deaf7ad74 --- /dev/null +++ b/Source/WebKit/chromium/tests/WebTransformOperationsTest.cpp @@ -0,0 +1,341 @@ +/* + * 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 <public/WebTransformOperations.h> + +#include <public/WebTransformationMatrix.h> + +#include "CCLayerTreeTestCommon.h" + +#include <gtest/gtest.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/Vector.h> + +using namespace WebKit; + +TEST(WebTransformOperationTest, transformTypesAreUnique) +{ + Vector<OwnPtr<WebTransformOperations> > transforms; + + WebTransformOperations* toAdd = new WebTransformOperations(); + toAdd->appendTranslate(0, 0, 0); + transforms.append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendRotate(0, 0, 1, 0); + transforms.append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendScale(1, 1, 1); + transforms.append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendSkew(0, 0); + transforms.append(adoptPtr(toAdd)); + + toAdd = new WebTransformOperations(); + toAdd->appendPerspective(800); + transforms.append(adoptPtr(toAdd)); + + for (size_t i = 0; i < transforms.size(); ++i) { + for (size_t j = 0; j < transforms.size(); ++j) { + bool matchesType = transforms[i]->matchesTypes(*transforms[j]); + EXPECT_TRUE((i == j && matchesType) || !matchesType); + } + } +} + +TEST(WebTransformOperationTest, matchTypesSameLength) +{ + WebTransformOperations translates; + translates.appendTranslate(0, 0, 0); + translates.appendTranslate(0, 0, 0); + translates.appendTranslate(0, 0, 0); + + WebTransformOperations skews; + skews.appendSkew(0, 0); + skews.appendSkew(0, 0); + skews.appendSkew(0, 0); + + WebTransformOperations translates2; + translates2.appendTranslate(0, 0, 0); + translates2.appendTranslate(0, 0, 0); + translates2.appendTranslate(0, 0, 0); + + WebTransformOperations translates3 = translates2; + + EXPECT_FALSE(translates.matchesTypes(skews)); + EXPECT_TRUE(translates.matchesTypes(translates2)); + EXPECT_TRUE(translates.matchesTypes(translates3)); +} + +TEST(WebTransformOperationTest, matchTypesDifferentLength) +{ + WebTransformOperations translates; + translates.appendTranslate(0, 0, 0); + translates.appendTranslate(0, 0, 0); + translates.appendTranslate(0, 0, 0); + + WebTransformOperations skews; + skews.appendSkew(0, 0); + skews.appendSkew(0, 0); + + WebTransformOperations translates2; + translates2.appendTranslate(0, 0, 0); + translates2.appendTranslate(0, 0, 0); + + EXPECT_FALSE(translates.matchesTypes(skews)); + EXPECT_FALSE(translates.matchesTypes(translates2)); +} + +TEST(WebTransformOperationTest, applyTranslate) +{ + double x = 1; + double y = 2; + double z = 3; + WebTransformOperations operations; + operations.appendTranslate(x, y, z); + WebTransformationMatrix expected; + expected.translate3d(x, y, z); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); +} + +TEST(WebTransformOperationTest, applyRotate) +{ + double x = 1; + double y = 2; + double z = 3; + double degrees = 80; + WebTransformOperations operations; + operations.appendRotate(x, y, z, degrees); + WebTransformationMatrix expected; + expected.rotate3d(x, y, z, degrees); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); +} + +TEST(WebTransformOperationTest, applyScale) +{ + double x = 1; + double y = 2; + double z = 3; + WebTransformOperations operations; + operations.appendScale(x, y, z); + WebTransformationMatrix expected; + expected.scale3d(x, y, z); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); +} + +TEST(WebTransformOperationTest, applySkew) +{ + double x = 1; + double y = 2; + WebTransformOperations operations; + operations.appendSkew(x, y); + WebTransformationMatrix expected; + expected.skewX(x); + expected.skewY(y); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); +} + +TEST(WebTransformOperationTest, applyPerspective) +{ + double depth = 800; + WebTransformOperations operations; + operations.appendPerspective(depth); + WebTransformationMatrix expected; + expected.applyPerspective(depth); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); +} + +TEST(WebTransformOperationTest, applyMatrix) +{ + double dx = 1; + double dy = 2; + double dz = 3; + WebTransformationMatrix expectedMatrix; + expectedMatrix.translate3d(dx, dy, dz); + WebTransformOperations matrixTransform; + matrixTransform.appendMatrix(expectedMatrix); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedMatrix, matrixTransform.apply()); +} + +TEST(WebTransformOperationTest, applyOrder) +{ + double sx = 2; + double sy = 4; + double sz = 8; + + double dx = 1; + double dy = 2; + double dz = 3; + + WebTransformOperations operations; + operations.appendScale(sx, sy, sz); + operations.appendTranslate(dx, dy, dz); + + WebTransformationMatrix expectedScaleMatrix; + expectedScaleMatrix.scale3d(sx, sy, sz); + + WebTransformationMatrix expectedTranslateMatrix; + expectedTranslateMatrix.translate3d(dx, dy, dz); + + WebTransformationMatrix expectedCombinedMatrix = expectedScaleMatrix; + expectedCombinedMatrix.multiply(expectedTranslateMatrix); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedCombinedMatrix, operations.apply()); +} + +TEST(WebTransformOperationTest, blendOrder) +{ + double sx1 = 2; + double sy1 = 4; + double sz1 = 8; + + double dx1 = 1; + double dy1 = 2; + double dz1 = 3; + + double sx2 = 4; + double sy2 = 8; + double sz2 = 16; + + double dx2 = 10; + double dy2 = 20; + double dz2 = 30; + + WebTransformOperations operationsFrom; + operationsFrom.appendScale(sx1, sy1, sz1); + operationsFrom.appendTranslate(dx1, dy1, dz1); + + WebTransformOperations operationsTo; + operationsTo.appendScale(sx2, sy2, sz2); + operationsTo.appendTranslate(dx2, dy2, dz2); + + WebTransformationMatrix scaleFrom; + scaleFrom.scale3d(sx1, sy1, sz1); + WebTransformationMatrix translateFrom; + translateFrom.translate3d(dx1, dy1, dz1); + + WebTransformationMatrix scaleTo; + scaleTo.scale3d(sx2, sy2, sz2); + WebTransformationMatrix translateTo; + translateTo.translate3d(dx2, dy2, dz2); + + double progress = 0.25; + + WebTransformationMatrix blendedScale = scaleTo; + blendedScale.blend(scaleFrom, progress); + + WebTransformationMatrix blendedTranslate = translateTo; + blendedTranslate.blend(translateFrom, progress); + + WebTransformationMatrix expected = blendedScale; + expected.multiply(blendedTranslate); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom, progress)); +} + +static void checkProgress(double progress, + const WebTransformationMatrix& fromMatrix, + const WebTransformationMatrix& toMatrix, + const WebTransformOperations& fromTransform, + const WebTransformOperations& toTransform) +{ + WebTransformationMatrix expectedMatrix = toMatrix; + expectedMatrix.blend(fromMatrix, progress); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedMatrix, toTransform.blend(fromTransform, progress)); +} + +TEST(WebTransformOperationTest, blendProgress) +{ + double sx = 2; + double sy = 4; + double sz = 8; + WebTransformOperations operationsFrom; + operationsFrom.appendScale(sx, sy, sz); + + WebTransformationMatrix matrixFrom; + matrixFrom.scale3d(sx, sy, sz); + + sx = 4; + sy = 8; + sz = 16; + WebTransformOperations operationsTo; + operationsTo.appendScale(sx, sy, sz); + + WebTransformationMatrix matrixTo; + matrixTo.scale3d(sx, sy, sz); + + checkProgress(-1, matrixFrom, matrixTo, operationsFrom, operationsTo); + checkProgress(0, matrixFrom, matrixTo, operationsFrom, operationsTo); + checkProgress(0.25, matrixFrom, matrixTo, operationsFrom, operationsTo); + checkProgress(0.5, matrixFrom, matrixTo, operationsFrom, operationsTo); + checkProgress(1, matrixFrom, matrixTo, operationsFrom, operationsTo); + checkProgress(2, matrixFrom, matrixTo, operationsFrom, operationsTo); +} + +TEST(WebTransformOperationTest, blendWhenTypesDoNotMatch) +{ + double sx1 = 2; + double sy1 = 4; + double sz1 = 8; + + double dx1 = 1; + double dy1 = 2; + double dz1 = 3; + + double sx2 = 4; + double sy2 = 8; + double sz2 = 16; + + double dx2 = 10; + double dy2 = 20; + double dz2 = 30; + + WebTransformOperations operationsFrom; + operationsFrom.appendScale(sx1, sy1, sz1); + operationsFrom.appendTranslate(dx1, dy1, dz1); + + WebTransformOperations operationsTo; + operationsTo.appendTranslate(dx2, dy2, dz2); + operationsTo.appendScale(sx2, sy2, sz2); + + WebTransformationMatrix from; + from.scale3d(sx1, sy1, sz1); + from.translate3d(dx1, dy1, dz1); + + WebTransformationMatrix to; + to.translate3d(dx2, dy2, dz2); + to.scale3d(sx2, sy2, sz2); + + double progress = 0.25; + + WebTransformationMatrix expected = to; + expected.blend(from, progress); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom, progress)); +} diff --git a/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp b/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp index 2888e0d7c..937cee202 100644 --- a/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp +++ b/Source/WebKit/chromium/tests/WebTransformationMatrixTest.cpp @@ -153,6 +153,15 @@ TEST(WebTransformationMatrixTest, verifyConstructorFor2dElements) EXPECT_ROW4_EQ(0, 0, 0, 1, A); } +TEST(WebTransformationMatrixTest, verifyConstructorForAllElements) +{ + WebTransformationMatrix A(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + EXPECT_ROW1_EQ(1, 5, 9, 13, A); + EXPECT_ROW2_EQ(2, 6, 10, 14, A); + EXPECT_ROW3_EQ(3, 7, 11, 15, A); + EXPECT_ROW4_EQ(4, 8, 12, 16, A); +} + TEST(WebTransformationMatrixTest, verifyCopyConstructor) { WebTransformationMatrix A; @@ -624,6 +633,38 @@ TEST(WebTransformationMatrixTest, verifyRotateAxisAngle3d) EXPECT_ROW4_EQ(0, 0, 0, 1, A); } +TEST(WebTransformationMatrixTest, verifyRotateAxisAngle3dForArbitraryAxis) +{ + // Check rotation about an arbitrary non-axis-aligned vector. + WebTransformationMatrix A; + A.rotate3d(1, 1, 1, 90); + EXPECT_ROW1_NEAR(0.3333333333333334258519187, + -0.2440169358562924717404030, + 0.9106836025229592124219380, + 0, A, ERROR_THRESHOLD); + EXPECT_ROW2_NEAR(0.9106836025229592124219380, + 0.3333333333333334258519187, + -0.2440169358562924717404030, + 0, A, ERROR_THRESHOLD); + EXPECT_ROW3_NEAR(-0.2440169358562924717404030, + 0.9106836025229592124219380, + 0.3333333333333334258519187, + 0, A, ERROR_THRESHOLD); + EXPECT_ROW4_EQ(0, 0, 0, 1, A); +} + +TEST(WebTransformationMatrixTest, verifyRotateAxisAngle3dForDegenerateAxis) +{ + // Check rotation about a degenerate zero vector. + // It is expected to default to rotation about the z-axis. + WebTransformationMatrix A; + A.rotate3d(0, 0, 0, 90); + EXPECT_ROW1_NEAR(0, -1, 0, 0, A, ERROR_THRESHOLD); + EXPECT_ROW2_NEAR(1, 0, 0, 0, A, ERROR_THRESHOLD); + EXPECT_ROW3_EQ(0, 0, 1, 0, A); + EXPECT_ROW4_EQ(0, 0, 0, 1, A); +} + TEST(WebTransformationMatrixTest, verifySkewX) { WebTransformationMatrix A; |