diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-03 09:55:33 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-03 09:55:33 +0100 |
commit | cd44dc59cdfc39534aef4d417e9f3c412e3be139 (patch) | |
tree | 8d89889ba95ed6ec9322e733846cc9cce9d7dff1 /Source/WebKit/chromium | |
parent | d11f84f5b5cdc0d92a08af01b13472fdd5f9acb9 (diff) | |
download | qtwebkit-cd44dc59cdfc39534aef4d417e9f3c412e3be139.tar.gz |
Imported WebKit commit fce473cb4d55aa9fe9d0b0322a2fffecb731b961 (http://svn.webkit.org/repository/webkit/trunk@106560)
Diffstat (limited to 'Source/WebKit/chromium')
158 files changed, 8251 insertions, 1770 deletions
diff --git a/Source/WebKit/chromium/All.gyp b/Source/WebKit/chromium/All.gyp index 7e9f0069a..1263c25c3 100644 --- a/Source/WebKit/chromium/All.gyp +++ b/Source/WebKit/chromium/All.gyp @@ -34,14 +34,15 @@ ], 'targets': [ { - # These two targets should be sufficient to cause everything + # These targets should be sufficient to cause everything # else to build (incl. webkit); if they aren't, we have our # dependencies wrong. 'target_name': 'all_webkit', 'type': 'none', 'dependencies': [ 'WebKitUnitTests.gyp:webkit_unit_tests', - 'Tools.gyp:DumpRenderTree', + '../../../Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp:DumpRenderTree', + '../../../Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp:TestWebKitAPI', ], } ], diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index d9cb1d2d0..c47d6aed7 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,2062 @@ +2012-02-02 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + Update enum name for HitTestRequest::RequestType + https://bugs.webkit.org/show_bug.cgi?id=77620 + + Reviewed by Kenneth Rohde Christiansen. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::visiblePositionForWindowPoint): + +2012-02-02 Kinuko Yasuda <kinuko@chromium.org> + + Cleanup: Move chrome-specific filesystem type handling code (for FileSystem API) under chromium directory (re-landing r105395) + https://bugs.webkit.org/show_bug.cgi?id=76551 + + * src/AssertMatchingEnums.cpp: Removed the matching assertion for AsyncFileSystem::External (as now we directly use WebFileSystem::TypeExternal). + * src/AsyncFileSystemChromium.cpp: + (WebCore::AsyncFileSystem::crackFileSystemURL): Added. + (WebCore::AsyncFileSystem::isValidType): Added. + (WebCore::AsyncFileSystemChromium::toURL): Added. + * src/AsyncFileSystemChromium.h: + (AsyncFileSystemChromium): + * src/WorkerAsyncFileSystemChromium.cpp: Made this subclass of AsyncFileSystemChromium (rather than that of AsyncFileSystem) + (WebCore::WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium): + * src/WorkerAsyncFileSystemChromium.h: + (WorkerAsyncFileSystemChromium): + +2012-02-01 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + Avoid creating NamedNodeMap unnecessarily + https://bugs.webkit.org/show_bug.cgi?id=77574 + + Reviewed by Ryosuke Niwa. + + * src/WebPageSerializerImpl.cpp: + (WebKit::WebPageSerializerImpl::openTagToString): use updatedAttributes(). + +2012-02-01 Justin Novosad <junov@chromium.org> + + [Chromium] Enable deferred canvas rendering in the skia port + https://bugs.webkit.org/show_bug.cgi?id=76732 + + Reviewed by Stephen White. + + Adding a new setting for enabling deferred 2d canvas rendering + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setDeferred2dCanvasEnabled): + (WebKit): + * src/WebSettingsImpl.h: + (WebSettingsImpl): + +2012-02-01 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r106382. + http://trac.webkit.org/changeset/106382 + https://bugs.webkit.org/show_bug.cgi?id=77571 + + Causing chromium crashes in PNGImageDecoder (Requested by + japhet on #webkit). + + * public/platform/WebKitPlatformSupport.h: + (WebKitPlatformSupport): + (WebKit::WebKitPlatformSupport::isTraceEventEnabled): + (WebKit::WebKitPlatformSupport::traceEventBegin): + (WebKit::WebKitPlatformSupport::traceEventEnd): + * src/PlatformSupport.cpp: + (WebCore::PlatformSupport::isTraceEventEnabled): + (WebCore): + (WebCore::PlatformSupport::traceEventBegin): + (WebCore::PlatformSupport::traceEventEnd): + +2012-02-01 Dirk Pranke <dpranke@chromium.org> + + TestWebKitAPI isn't being built on chromium bots any more + https://bugs.webkit.org/show_bug.cgi?id=77563 + + Reviewed by Dimitri Glazkov. + + I accidentally dropped it in the refactoring in r105449. + + * All.gyp: + +2012-02-01 Hans Wennborg <hans@chromium.org> + + Rename WebSpeechInputResult::set() to assign() + https://bugs.webkit.org/show_bug.cgi?id=77540 + + Reviewed by Darin Fisher. + + It was suggested in a previous code review + (https://bugs.webkit.org/show_bug.cgi?id=77083#c5) + that this function should be called assign(). + + * public/WebSpeechInputResult.h: + (WebSpeechInputResult): + (WebKit::WebSpeechInputResult::set): + * src/WebSpeechInputResult.cpp: + (WebKit::WebSpeechInputResult::assign): + +2012-02-01 Kent Tamura <tkent@chromium.org> + + [Chromium] Disable WebFrameTest.FindInPage + https://bugs.webkit.org/show_bug.cgi?id=77186 + + Disable it because PlatformContextSkiaTest.trackOpaqueOvalTest has + been failing since FindInPage test was committed. + + * tests/WebFrameTest.cpp: + (WebKit::TEST_F): + +2012-01-31 Ami Fischman <fischman@chromium.org> + + [chromium] enable -Wexit-time-destructors for webkit unit tests + https://bugs.webkit.org/show_bug.cgi?id=77300 + Fix the only extant violation (verified by building webkit_unit_tests in static build). + + Reviewed by Tony Chang. + + * WebKitUnitTests.gyp: + * tests/FrameTestHelpers.cpp: + (WebKit::FrameTestHelpers::defaultWebFrameClient): + (WebKit::FrameTestHelpers::defaultWebViewClient): + +2012-01-31 Nico Weber <thakis@chromium.org> + + [chromium] Expose windowResizerRectChanged() on WebWidget. + https://bugs.webkit.org/show_bug.cgi?id=77453 + + Needed for http://crbug.com/111266 + + Reviewed by Darin Fisher. + + * public/WebWidget.h: + (WebWidget): + (WebKit::WebWidget::didChangeWindowResizerRect): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::didChangeWindowResizerRect): + (WebKit): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-01-31 Nat Duca <nduca@chromium.org> + + [chromium] Import PaintAggregator + https://bugs.webkit.org/show_bug.cgi?id=53715 + + Reviewed by Darin Fisher. + + * WebKit.gyp: + * WebKit.gypi: + * src/painting/PaintAggregator.cpp: Added. + (WebKit::calculateArea): + (WebKit::subtractIntersection): + (WebKit::sharesEdge): + (WebKit::PaintAggregator::PendingUpdate::PendingUpdate): + (WebKit::PaintAggregator::PendingUpdate::~PendingUpdate): + (WebKit::PaintAggregator::PendingUpdate::calculateScrollDamage): + (WebKit::PaintAggregator::PendingUpdate::calculatePaintBounds): + (WebKit::PaintAggregator::hasPendingUpdate): + (WebKit::PaintAggregator::clearPendingUpdate): + (WebKit::PaintAggregator::popPendingUpdate): + (WebKit::PaintAggregator::invalidateRect): + (WebKit::PaintAggregator::scrollRect): + (WebKit::PaintAggregator::scrollPaintRect): + (WebKit::PaintAggregator::shouldInvalidateScrollRect): + (WebKit::PaintAggregator::invalidateScrollRect): + (WebKit::PaintAggregator::combinePaintRects): + * src/painting/PaintAggregator.h: Added. + * tests/PaintAggregatorTest.cpp: Added. + (WebKit::TEST): + +2012-01-31 Fady Samuel <fsamuel@chromium.org> + + [Chromium] ChromeClientImpl::dispatchViewportPropertiesDidChange is repeatedly called in Google News + https://bugs.webkit.org/show_bug.cgi?id=77429 + + Reviewed by Darin Fisher. + + m_webView->isPageScaleFactorSet() is tested in ChromeClientImpl::layoutUpdated, and it is never true, + because WebViewImpl::setPageScaleFactorPreservingScrollOffset is called repeatedly and exits early + and thus never calls WebViewImpl::setPageScaleFactor which sets the flag. + + The simplest solution is to simply get rid of the early return in + WebViewImpl::setPageScaleFactorPreservingScrollOffset. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::setPageScaleFactorPreservingScrollOffset): + +2012-01-31 Fady Samuel <fsamuel@chromium.org> + + [Chromium] Expose setLayoutFallbackWidth as a WebSetting + https://bugs.webkit.org/show_bug.cgi?id=77431 + + Reviewed by Darin Fisher. + + The layout fallback width is the default fixed layout width + set for desktop web pages that lack a viewport tag. This width + can vary from platform to platform and can depend on other factors, + and so it should be a setting exposed to Chromium. + + * public/WebSettings.h: + (): + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setLayoutFallbackWidth): + (WebKit): + * src/WebSettingsImpl.h: + (WebSettingsImpl): + +2012-01-31 Dana Jansens <danakj@chromium.org> + + [chromium] Compute occlusion during paint loop + https://bugs.webkit.org/show_bug.cgi?id=76858 + + Reviewed by James Robinson. + + * tests/CCLayerTreeHostCommonTest.cpp: + (WebCore::TEST): + (WebCore): + * tests/CCLayerTreeHostTest.cpp: + (WTF::ContentLayerChromiumWithUpdateTracking::paintContentsIfDirty): + (WTF): + (TestLayerChromium): + (WTF::TestLayerChromium::create): + (WTF::TestLayerChromium::paintContentsIfDirty): + (WTF::TestLayerChromium::drawsContent): + (WTF::TestLayerChromium::occludedScreenSpace): + (WTF::TestLayerChromium::clearOccludedScreenSpace): + (WTF::TestLayerChromium::TestLayerChromium): + (WTF::setLayerPropertiesForTesting): + (CCLayerTreeHostTestLayerOcclusion): + (WTF::CCLayerTreeHostTestLayerOcclusion::CCLayerTreeHostTestLayerOcclusion): + (WTF::CCLayerTreeHostTestLayerOcclusion::beginTest): + (WTF::CCLayerTreeHostTestLayerOcclusion::afterTest): + * tests/Canvas2DLayerChromiumTest.cpp: + (WebCore::Canvas2DLayerChromiumTest::fullLifecycleTest): + * tests/TiledLayerChromiumTest.cpp: + (WTF::FakeLayerTextureUpdater::setOpaquePaintRect): + (FakeLayerTextureUpdater): + (WTF::FakeTiledLayerChromium::paintContentsIfDirty): + (WTF::FakeLayerTextureUpdater::prepareToUpdate): + (WTF::TEST): + (WTF): + +2012-01-31 John Bates <jbates@google.com> + + [Chromium] Add chromium-style tracing support + https://bugs.webkit.org/show_bug.cgi?id=76885 + + Reviewed by Darin Fisher. + + This code enables WebKit trace events to pass through more data to the + chromium platform tracing API and generally to use the full tracing + API provided by chromium. + + * public/platform/WebKitPlatformSupport.h: + (WebKit::WebKitPlatformSupport::getTraceCategoryEnabledFlag): + (WebKit::WebKitPlatformSupport::addTraceEvent): + * src/PlatformSupport.cpp: + (WebCore::PlatformSupport::getTraceCategoryEnabledFlag): + (WebCore::PlatformSupport::addTraceEvent): + +2012-01-31 Antoine Labour <piman@chromium.org> + + Add back temporarily WebKitPlatformSupport::createGraphicsContext3D() to fix build + https://bugs.webkit.org/show_bug.cgi?id=77467 + + Rubber-stamped by Nate Chapin <japhet@chromium.org>. + + * public/platform/WebKitPlatformSupport.h: + (WebKitPlatformSupport): + (WebKit::WebKitPlatformSupport::createGraphicsContext3D): + +2012-01-31 Antoine Labour <piman@chromium.org> + + Merge WebGraphicsContext3D creation and initialization, and move it to + WebViewClient. + https://bugs.webkit.org/show_bug.cgi?id=76593 + + Reviewed by Darin Fisher. + + * public/WebViewClient.h: + (WebKit::WebViewClient::createGraphicsContext3D): + * public/platform/WebGraphicsContext3D.h: + (WebKit::WebGraphicsContext3D::initialize): + * public/platform/WebKitPlatformSupport.h: + * src/GraphicsContext3DChromium.cpp: + +2012-01-26 Hans Wennborg <hans@chromium.org> + + Speech Input: move MockSpeechInputClient into Chromium DumpRenderTree implementation + https://bugs.webkit.org/show_bug.cgi?id=77083 + + Reviewed by Darin Fisher. + + Remove the WebSpeechInputControllerMock interface and proxy + implementation. The mock is moving to the DumpRenderTree + implementation instead, which removes the need to expose this + interface in the WebKit API. + + Also add a proper copy constructor for WebSpeechInputResult. + The default one doesn't do a proper copy. + + * WebKit.gyp: + * public/WebSpeechInputControllerMock.h: Removed. + * public/WebSpeechInputResult.h: + (WebKit::WebSpeechInputResult::WebSpeechInputResult): + (WebSpeechInputResult): + * src/WebSpeechInputControllerMockImpl.cpp: Removed. + * src/WebSpeechInputControllerMockImpl.h: Removed. + * src/WebSpeechInputResult.cpp: + (WebKit::WebSpeechInputResult::set): + (WebKit): + +2012-01-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-01-30 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r106324. + http://trac.webkit.org/changeset/106324 + https://bugs.webkit.org/show_bug.cgi?id=77406 + + Broke CCLayerTreeHostTestLayerOcclusion.runMultiThread and + runSingleThread (Requested by yuzo1 on #webkit). + + * tests/CCLayerTreeHostCommonTest.cpp: + (WebCore): + * tests/CCLayerTreeHostTest.cpp: + (WTF::ContentLayerChromiumWithUpdateTracking::paintContentsIfDirty): + * tests/Canvas2DLayerChromiumTest.cpp: + (WebCore::Canvas2DLayerChromiumTest::fullLifecycleTest): + * tests/TiledLayerChromiumTest.cpp: + (FakeLayerTextureUpdater): + (WTF::FakeTiledLayerChromium::paintContentsIfDirty): + (WTF::FakeLayerTextureUpdater::prepareToUpdate): + +2012-01-30 Dana Jansens <danakj@chromium.org> + + [chromium] Compute occlusion during paint loop + https://bugs.webkit.org/show_bug.cgi?id=76858 + + Reviewed by James Robinson. + + * tests/CCLayerTreeHostCommonTest.cpp: + (WebCore::TEST): + (WebCore): + * tests/CCLayerTreeHostTest.cpp: + (WTF::ContentLayerChromiumWithUpdateTracking::paintContentsIfDirty): + (WTF): + (TestLayerChromium): + (WTF::TestLayerChromium::create): + (WTF::TestLayerChromium::paintContentsIfDirty): + (WTF::TestLayerChromium::drawsContent): + (WTF::TestLayerChromium::occludedScreenSpace): + (WTF::TestLayerChromium::clearOccludedScreenSpace): + (WTF::TestLayerChromium::TestLayerChromium): + (WTF::setLayerPropertiesForTesting): + (CCLayerTreeHostTestLayerOcclusion): + (WTF::CCLayerTreeHostTestLayerOcclusion::CCLayerTreeHostTestLayerOcclusion): + (WTF::CCLayerTreeHostTestLayerOcclusion::beginTest): + (WTF::CCLayerTreeHostTestLayerOcclusion::afterTest): + * tests/Canvas2DLayerChromiumTest.cpp: + (WebCore::Canvas2DLayerChromiumTest::fullLifecycleTest): + * tests/TiledLayerChromiumTest.cpp: + (WTF::FakeLayerTextureUpdater::setOpaquePaintRect): + (FakeLayerTextureUpdater): + (WTF::FakeTiledLayerChromium::paintContentsIfDirty): + (WTF::FakeLayerTextureUpdater::prepareToUpdate): + (WTF::TEST): + (WTF): + +2012-01-30 Gregg Tavares <gman@google.com> + + Add Plumming to get graphics error messages to JS Console + https://bugs.webkit.org/show_bug.cgi?id=77238 + + Reviewed by Kenneth Russell. + + * public/platform/WebGraphicsContext3D.h: + (WebGraphicsErrorMessageCallback): + (WebKit::WebGraphicsContext3D::WebGraphicsErrorMessageCallback::~WebGraphicsErrorMessageCallback): + (WebGraphicsContext3D): + (WebKit::WebGraphicsContext3D::setErrorMessageCallback): + * src/GraphicsContext3DChromium.cpp: + (WebCore::GraphicsContext3D::~GraphicsContext3D): + (WebCore): + (GraphicsErrorMessageCallbackAdapter): + (WebCore::GraphicsErrorMessageCallbackAdapter::~GraphicsErrorMessageCallbackAdapter): + (WebCore::GraphicsErrorMessageCallbackAdapter::GraphicsErrorMessageCallbackAdapter): + (WebCore::GraphicsErrorMessageCallbackAdapter::onErrorMessage): + (WebCore::GraphicsErrorMessageCallbackAdapter::create): + (WebCore::GraphicsContext3DPrivate::setErrorMessageCallback): + * src/GraphicsContext3DPrivate.h: + (WebCore): + (): + +2012-01-30 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r106259. + http://trac.webkit.org/changeset/106259 + https://bugs.webkit.org/show_bug.cgi?id=77395 + + Breaks shared builders as they also build webkittests with + -Wexit-time-destructors. (Requested by leviw on #webkit). + + * WebKitUnitTests.gyp: + +2012-01-30 Dana Jansens <danakj@chromium.org> + + [chromium] Use region reported painted opaque for draw culling + https://bugs.webkit.org/show_bug.cgi?id=76015 + + Reviewed by James Robinson. + + * tests/CCLayerTreeHostImplTest.cpp: + (WebKit::BlendStateCheckLayer::appendQuads): + (WebKit::BlendStateCheckLayer::setOpaqueColor): + (BlendStateCheckLayer): + (WebKit::BlendStateCheckLayer::BlendStateCheckLayer): + (WebKit::TEST_F): + * tests/CCQuadCullerTest.cpp: + (WebCore::MakeTileQuad): + (WebCore::setQuads): + (WebCore::TEST): + (WebCore): + * tests/CCTiledLayerImplTest.cpp: + (CCLayerTestCommon::createLayer): + (CCLayerTestCommon::TEST): + (CCLayerTestCommon::getQuads): + (CCLayerTestCommon::coverageVisibleRectOnTileBoundaries): + (CCLayerTestCommon::coverageVisibleRectIntersectsTiles): + (CCLayerTestCommon::coverageVisibleRectIntersectsBounds): + (CCLayerTestCommon): + +2012-01-30 Adrienne Walker <enne@google.com> + + [chromium] Always pre-reserve scrollbar and scroll corner textures + https://bugs.webkit.org/show_bug.cgi?id=77251 + + Reviewed by James Robinson. + + * src/NonCompositedContentHost.cpp: + (WebKit::reserveScrollbarLayers): + (WebKit): + (WebKit::NonCompositedContentHost::setViewport): + +2012-01-30 Ryosuke Niwa <rniwa@webkit.org> + + Roll Chromium DEPS from 119623 to 119700. + + * DEPS: + +2012-01-30 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=77263 + PlatformScreenMac should not rely on NSWindow for important bits of data + + Reviewed by Geoff Garen. + + These two functions now take a FrameView instead of a Widget. + * src/PlatformSupport.cpp: + (WebCore::PlatformSupport::screenRect): + (WebCore::PlatformSupport::screenAvailableRect): + +2012-01-30 Ami Fischman <fischman@chromium.org> + + [chromium] enable -Wexit-time-destructors for webkit unit tests + https://bugs.webkit.org/show_bug.cgi?id=77300 + + Reviewed by Tony Chang. + + * WebKitUnitTests.gyp: Enable clang check for exit time destructors. + +2012-01-30 Tommy Widenflycht <tommyw@google.com> + + [chromium] MediaStream API: Fix a few memory leaks + https://bugs.webkit.org/show_bug.cgi?id=77334 + + Reviewed by Darin Fisher. + + It seems that either the behaviour of WebPrivatePtr has changed or I misunderstood + something, but I fixed a memory leak in WebMediaStreamDescriptor and safeguarded + WebMediaStreamSource. + + * public/platform/WebMediaStreamDescriptor.h: + (WebKit::WebMediaStreamDescriptor::WebMediaStreamDescriptor): + * public/platform/WebMediaStreamSource.h: + (WebKit::WebMediaStreamSource::WebMediaStreamSource): + (WebKit::WebMediaStreamSource::operator=): + (WebMediaStreamSource): + * src/WebMediaStreamDescriptor.cpp: + (WebKit::WebMediaStreamDescriptor::assign): + * src/WebMediaStreamSource.cpp: + (WebKit::WebMediaStreamSource::assign): + (WebKit): + +2012-01-30 Jochen Eisinger <jochen@chromium.org> + + [chromium] remove exit time destructors from TextureManagerTest + https://bugs.webkit.org/show_bug.cgi?id=77333 + + Reviewed by Tony Gentilcore. + + Non-trivial, global objects require an at-exit time destructor which add + unnecessary complexity and delays to shutdown. + + * tests/FakeCCLayerTreeHostClient.h: added newline at EOF + * tests/TextureManagerTest.cpp: + (WTF::FakeTextureAllocator::~FakeTextureAllocator): + (TextureManagerTest): + (WTF::TextureManagerTest::TextureManagerTest): + (WTF::TextureManagerTest::~TextureManagerTest): + (WTF::TextureManagerTest::texturesMemorySize): + (WTF::TextureManagerTest::createTextureManager): + (WTF::TextureManagerTest::requestTexture): + (WTF::TEST_F): + +2012-01-30 Hans Wennborg <hans@chromium.org> + + Unreviewed, rolling out r106219. + http://trac.webkit.org/changeset/106219 + https://bugs.webkit.org/show_bug.cgi?id=77083 + + This broke Chromium's test_shell. + + * WebKit.gyp: + * public/WebSpeechInputControllerMock.h: Added. + (WebKit): + (WebSpeechInputControllerMock): + (WebKit::WebSpeechInputControllerMock::~WebSpeechInputControllerMock): + * public/WebSpeechInputResult.h: + (WebSpeechInputResult): + * src/WebSpeechInputControllerMockImpl.cpp: Added. + (WebKit): + (WebKit::WebSpeechInputControllerMock::create): + (WebKit::WebSpeechInputControllerMockImpl::WebSpeechInputControllerMockImpl): + (WebKit::WebSpeechInputControllerMockImpl::~WebSpeechInputControllerMockImpl): + (WebKit::WebSpeechInputControllerMockImpl::addMockRecognitionResult): + (WebKit::WebSpeechInputControllerMockImpl::clearResults): + (WebKit::WebSpeechInputControllerMockImpl::didCompleteRecording): + (WebKit::WebSpeechInputControllerMockImpl::didCompleteRecognition): + (WebKit::WebSpeechInputControllerMockImpl::setRecognitionResult): + (WebKit::WebSpeechInputControllerMockImpl::startRecognition): + (WebKit::WebSpeechInputControllerMockImpl::cancelRecognition): + (WebKit::WebSpeechInputControllerMockImpl::stopRecording): + * src/WebSpeechInputControllerMockImpl.h: Added. + (WebCore): + (WebKit): + (WebSpeechInputControllerMockImpl): + * src/WebSpeechInputResult.cpp: + +2012-01-26 Hans Wennborg <hans@chromium.org> + + Speech Input: move MockSpeechInputClient into Chromium DumpRenderTree implementation + https://bugs.webkit.org/show_bug.cgi?id=77083 + + Reviewed by Darin Fisher. + + Remove the WebSpeechInputControllerMock interface and proxy + implementation. The mock is moving to the DumpRenderTree + implementation instead, which removes the need to expose this + interface in the WebKit API. + + Also add a proper copy constructor for WebSpeechInputResult. + The default one doesn't do a proper copy. + + * WebKit.gyp: + * public/WebSpeechInputControllerMock.h: Removed. + * public/WebSpeechInputResult.h: + (WebKit::WebSpeechInputResult::WebSpeechInputResult): + (WebSpeechInputResult): + * src/WebSpeechInputControllerMockImpl.cpp: Removed. + * src/WebSpeechInputControllerMockImpl.h: Removed. + * src/WebSpeechInputResult.cpp: + (WebKit::WebSpeechInputResult::set): + (WebKit): + +2012-01-29 Kent Tamura <tkent@chromium.org> + + [Chromium] REGRESSION(r87067): WebFrame::setFindEndstateFocusAndSelection() + doesn't set the selection for <input> and <textarea> + https://bugs.webkit.org/show_bug.cgi?id=77186 + + Reviewed by Hajime Morita. + + When the find-in-page box is closed, WebFrame::stopFinding(false) is + called. It calls setFindEndstateFocusAndSelection(). Before r87067, + m_activeMatch was stored as the normal selection in <input> or + <textarea> by accident. r87067 stopped this accidental behavior. + + However the behavior of pre-r87067 is useful and we should support it + for contentEditable elements too. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::setFindEndstateFocusAndSelection): + - Add special handing for <input> and <textarea> to find a focusable parent. + - Sets the active match as the selection even if a focusable parent is found. + * tests/WebFrameTest.cpp: + (WebKit::TEST_F): Add tests for find() and stopFinding(). + * tests/data/find.html: Added. + +2012-01-29 Nico Weber <nicolasweber@gmx.de> + + [chromium/mac] Fix two-finger scrolling + https://bugs.webkit.org/show_bug.cgi?id=77316 + + http://trac.webkit.org/changeset/106021/trunk changed the phase enums + to match AppKit. This changes WebMouseWheelEvent accordingly. + + No tests, because DRT doesn't support synthetic scroll events with + event phases. + + Reviewed by Anders Carlsson. + + * public/WebInputEvent.h: + * src/mac/WebInputEventFactory.mm: + +2012-01-28 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-01-28 Nico Weber <thakis@chromium.org> + + [chromium] Add support for building standalone webkit/chromium checkouts with ninja. + https://bugs.webkit.org/show_bug.cgi?id=77243 + + Reviewed by Adam Barth. + + * gyp_webkit: + +2012-01-27 Jeff Timanus <twiz@chromium.org> + + [chromium] Increase the size of the Ganesh texture cache to prevent performance problems on advanced Canvas2D pages. + The cache was previously 50 MB; it is now 96 MB. + + Bug 76666 - Ganesh's Texture Cache is too small + https://bugs.webkit.org/show_bug.cgi?id=76666 + + Reviewed by Stephen White. + + * src/GraphicsContext3DChromium.cpp: + (WebCore::GraphicsContext3DPrivate::grContext): + +2012-01-27 Adrienne Walker <enne@google.com> + + [chromium] Don't ever skip drawing the non-composited content layer + https://bugs.webkit.org/show_bug.cgi?id=77236 + + Reviewed by James Robinson. + + This is a tiny fix. If the non-composited content layer never gets + painted, then the background color never gets set and it is just + opaque black. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): + +2012-01-27 Fady Samuel <fsamuel@chromium.org> + + Rename shouldLayoutFixedElementsRelativeToFrame and make it a setting + https://bugs.webkit.org/show_bug.cgi?id=76459 + + Reviewed by Darin Fisher. + + * public/WebSettings.h: + (): + * public/WebView.h: + (WebView): + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setFixedElementsLayoutRelativeToFrame): + (WebKit): + * src/WebSettingsImpl.h: + (WebSettingsImpl): + * src/WebViewImpl.cpp: + * src/WebViewImpl.h: + (WebViewImpl): + +2012-01-24 Vincent Scheib <scheib@chromium.org> + + Pointer Lock: Implement pointer interface + https://bugs.webkit.org/show_bug.cgi?id=75762 + + Add calls to the PointerLockController added in this patch to WebCore. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::close): + (WebKit::WebViewImpl::didAcquirePointerLock): + (WebKit::WebViewImpl::didNotAcquirePointerLock): + (WebKit::WebViewImpl::didLosePointerLock): + (WebKit::WebViewImpl::pointerLockMouseEvent): + +2012-01-26 Kent Tamura <tkent@chromium.org> + + [Chromium] Cleanup of WebPopupMenuImpl + https://bugs.webkit.org/show_bug.cgi?id=76441 + + Reviewed by Kentaro Hara. + + Removed WebPopupMenuImpl::invalidateContents() and scrollRectIntoView() + because they were removed from HostWindow in r58445 and r55864. They + were found by OVERRIDE. + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::popupOpened): Rename WebPopupMenuImpl::Init(). + * src/WebPopupMenuImpl.cpp: + (WebKit::WebPopupMenuImpl::WebPopupMenuImpl): Update a comment. + (WebKit::WebPopupMenuImpl::init): Renamed from Init(). Update a comment. + (WebKit::WebPopupMenuImpl::handleMouseMove): Prepend "handle" to the name. + (WebKit::WebPopupMenuImpl::handleMouseLeave): ditto. + (WebKit::WebPopupMenuImpl::handleMouseDown): ditto. + (WebKit::WebPopupMenuImpl::handleMouseUp): ditto. + (WebKit::WebPopupMenuImpl::handleMouseWheel): ditto. + (WebKit::WebPopupMenuImpl::handleGestureEvent): ditto. + (WebKit::WebPopupMenuImpl::handleTouchEvent): ditto. + (WebKit::WebPopupMenuImpl::handleKeyEvent): ditto. + (WebKit::WebPopupMenuImpl::close): Update a comment. + (WebKit::WebPopupMenuImpl::composite): Remove a unused argument name. + (WebKit::WebPopupMenuImpl::handleInputEvent): Update a comment. Update callsites for handle*(). + (WebKit::WebPopupMenuImpl::setFocus): Remove a unused argument name. + (WebKit::WebPopupMenuImpl::setComposition): ditto. + (WebKit::WebPopupMenuImpl::confirmComposition): ditto. + (WebKit::WebPopupMenuImpl::setTextDirection): ditto. + (WebKit::WebPopupMenuImpl::scroll): Unfold folded lines. + * src/WebPopupMenuImpl.h: + - Remove useless argument names. + - Add OVERRIDE. + +2012-01-26 W. James MacLean <wjmaclean@chromium.org> + + [chromium] Allow modification of size of partially occluded quads. + https://bugs.webkit.org/show_bug.cgi?id=76349 + + Reviewed by James Robinson. + + * tests/CCQuadCullerTest.cpp: + (WebCore::makeTileQuads) + (WebCore::setQuads): + (WebCore::TEST): + +2012-01-26 Michal Mocny <mmocny@google.com> + + [chromium] Revert changes which added setResourceUsageCHROMIUM gl extension since feature changed directions + https://bugs.webkit.org/show_bug.cgi?id=77120 + + Reviewed by Kenneth Russell. + + * public/platform/WebGraphicsContext3D.h: + (WebGraphicsContext3D): + * src/GraphicsContext3DChromium.cpp: + (WebCore): + * tests/FakeWebGraphicsContext3D.h: + (WebKit::FakeWebGraphicsContext3D::setVisibilityCHROMIUM): + +2012-01-26 Sadrul Habib Chowdhury <sadrul@chromium.org> + + Add GestureTapDown and GestureDoubleTap gesture types to WebGestureEvent. + https://bugs.webkit.org/show_bug.cgi?id=77140 + + Reviewed by Darin Fisher. + + * public/WebInputEvent.h: + (): + * src/WebInputEventConversion.cpp: + (WebKit::PlatformGestureEventBuilder::PlatformGestureEventBuilder): + * src/WebPopupMenuImpl.cpp: + (WebKit::WebPopupMenuImpl::handleInputEvent): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleInputEvent): + +2012-01-25 Cris Neckar <cdn@chromium.org> + + Add API to register schemes which can be sent simple CORS requests. + https://bugs.webkit.org/show_bug.cgi?id=77041 + + Reviewed by Alexey Proskuryakov. + + * public/WebSecurityPolicy.h: + (WebSecurityPolicy): + * src/WebSecurityPolicy.cpp: + (WebKit::WebSecurityPolicy::registerCORSEnabledScheme): + (WebKit): + +2012-01-10 James Robinson <jamesr@chromium.org> + + [chromium] Add enter/exitRunLoop to WebThread API + https://bugs.webkit.org/show_bug.cgi?id=76012 + + Reviewed by Darin Fisher. + + This adds those two APIs to WebKit::WebThread and converts CCLayerTreeHostTest over to use these APIs instead + of webkit_support. The immediate motivation is that we can't use webkit_support in webkit_unit_tests in the + component build. + + * WebKit.gyp: + * public/platform/WebThread.h: + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTest::onEndTest): + (WTF::CCLayerTreeHostTest::TimeoutTask::run): + (WTF::CCLayerTreeHostTest::BeginTask::BeginTask): + (WTF::CCLayerTreeHostTest::BeginTask::~BeginTask): + (WTF::CCLayerTreeHostTest::BeginTask::run): + (WTF::CCLayerTreeHostTest::runTest): + +2012-01-26 John Bates <jbates@google.com> + + Roll chromium_rev to 119248 + https://bugs.webkit.org/show_bug.cgi?id=77124 + + Reviewed by James Robinson. + + * DEPS: + +2012-01-25 Greg Billock <gbillock@google.com> + + Add IntentRequest include for FrameLoaderClientImpl. + https://bugs.webkit.org/show_bug.cgi?id=77039 + + Reviewed by Darin Fisher. + + * src/FrameLoaderClientImpl.cpp: + +2012-01-25 Daniel Cheng <dcheng@chromium.org> + + [chromium] Fix ClipboardChromium::validateFilename to actually operate on extensions + https://bugs.webkit.org/show_bug.cgi?id=76996 + + Reviewed by Tony Chang. + + * WebKit.gypi: + * tests/ClipboardChromiumTest.cpp: Added. + (WebCore): + (WebCore::TEST): + +2012-01-25 James Robinson <jamesr@chromium.org> + + [chromium] Rollout r100751, this mechanism does not work and is very slow + https://bugs.webkit.org/show_bug.cgi?id=77055 + + Unreviewed rollout of http://trac.webkit.org/changeset/100751. The refresh rate mechanism is not implemented, + but it still triggers a very slow codepath and triggers races on some platforms. + + * public/WebScreenInfo.h: + (WebScreenInfo): + (WebKit::WebScreenInfo::WebScreenInfo): + * src/PlatformSupport.cpp: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTest::runTest): + +2012-01-25 Eric Uhrhane <ericu@chromium.org> + + Add full support for filesystem URLs. + https://bugs.webkit.org/show_bug.cgi?id=75049 + + Reviewed by Adam Barth. + + No new tests; existing layout tests cover the basic functionality, and + the new functionality won't be there until Chromium adds it. This patch + merely enables that, without changing behavior. + + * tests/KURLTest.cpp: + TEST(KURLTest, Encode): Update expectation that '/' sails through unescaped. + +2012-01-25 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Need to distinguish key paths that don't yield value vs. yield invalid key + https://bugs.webkit.org/show_bug.cgi?id=76487 + + Added a NullType to represent a null IDBKey pointer. This is needed to distinguish the + cases in the spec where the key resolution algorithm returns no value (null) versus + returns a value but that value is not a valid key (invalid). + + Reviewed by Tony Chang. + + * public/WebIDBKey.h: + * src/WebIDBKey.cpp: + (WebKit::WebIDBKey::createNull): Added. + (WebKit::WebIDBKey::createFromValueAndKeyPath): Now returns null if value is null. + (WebKit::convertFromWebIDBKeyArray): Null keys should never exist within arrays. + (WebKit::WebIDBKey::assignInvalid): + (WebKit::WebIDBKey::assignNull): + (WebKit::WebIDBKey::type): + +2012-01-24 Vsevolod Vlasov <vsevik@chromium.org> + + Unreviewed chromium test fix. + + * src/js/Tests.js: + (.TestSuite.prototype._waitUntilScriptsAreParsed.waitForAllScripts): + (.TestSuite.prototype._waitUntilScriptsAreParsed): + +2012-01-24 Vangelis Kokkevis <vangelis@chromium.org> + + Adding a test to verify that m_skipsDraw gets reset between frames for + tiled layers. + https://bugs.webkit.org/show_bug.cgi?id=76735 + + Reviewed by James Robinson. + + * WebKit.gypi: + * tests/FakeCCLayerTreeHostClient.h: Added. + (WebCore::FakeCCLayerTreeHostClient::updateAnimations): + (WebCore::FakeCCLayerTreeHostClient::layout): + (WebCore::FakeCCLayerTreeHostClient::applyScrollAndScale): + (WebCore::FakeCCLayerTreeHostClient::createLayerTreeHostContext3D): + (WebCore::FakeCCLayerTreeHostClient::didRecreateGraphicsContext): + (WebCore::FakeCCLayerTreeHostClient::didCommitAndDrawFrame): + (WebCore::FakeCCLayerTreeHostClient::didCompleteSwapBuffers): + (WebCore::FakeCCLayerTreeHostClient::scheduleComposite): + * tests/LayerChromiumTest.cpp: + * tests/TiledLayerChromiumTest.cpp: + (WTF::FakeTiledLayerChromium::skipsDraw): + (WTF::FakeTiledLayerChromium::paintContentsIfDirty): + (WTF::TEST): + +2012-01-24 Dmitry Lomov <dslomov@google.com> + + Unreviewed: removing WebWorker.h again after r105684. + + * WebKit.gyp: + +2012-01-24 Tommy Widenflycht <tommyw@google.com> + + MediaStream API: Split the MediaStream track list into audio/video specific ones. + https://bugs.webkit.org/show_bug.cgi?id=76614 + + Reviewed by Darin Fisher. + + * public/WebUserMediaClient.h: + (WebKit::WebUserMediaClient::requestUserMedia): + * public/WebUserMediaRequest.h: + * public/platform/WebMediaStreamDescriptor.h: + * src/UserMediaClientImpl.cpp: + (WebKit::UserMediaClientImpl::requestUserMedia): + * src/UserMediaClientImpl.h: + * src/WebMediaStreamDescriptor.cpp: + (WebKit::WebMediaStreamDescriptor::sources): + (WebKit::WebMediaStreamDescriptor::audioSources): + (WebKit::WebMediaStreamDescriptor::videoSources): + (WebKit::WebMediaStreamDescriptor::initialize): + * src/WebUserMediaRequest.cpp: + (WebKit::WebUserMediaRequest::requestSucceeded): + +2012-01-23 Simon Fraser <simon.fraser@apple.com> + + Show layer borders for scrollbar layers + https://bugs.webkit.org/show_bug.cgi?id=76888 + + Reviewed by Beth Dakin. + + Update for new signature of GraphicsLayerClient::showDebugBorders() + and GraphicsLayerClient::showRepaintCounter(). + + * src/NonCompositedContentHost.cpp: + (WebKit::NonCompositedContentHost::showDebugBorders): + (WebKit::NonCompositedContentHost::showRepaintCounter): + * src/NonCompositedContentHost.h: + * src/PageOverlay.cpp: + (WebKit::OverlayGraphicsLayerClientImpl::showDebugBorders): + (WebKit::OverlayGraphicsLayerClientImpl::showRepaintCounter): + * tests/ImageLayerChromiumTest.cpp: + (WebCore::MockGraphicsLayerClient::showDebugBorders): + (WebCore::MockGraphicsLayerClient::showRepaintCounter): + +2012-01-24 Vincent Scheib <scheib@chromium.org> + + [Chromium] Add WebKit API for Pointer Lock + https://bugs.webkit.org/show_bug.cgi?id=76410 + + Reviewed by Darin Fisher. + + Breaking up https://bugs.webkit.org/show_bug.cgi?id=75762 + into a series of patches, this stubs out the API. + + * public/WebWidget.h: + (WebKit::WebWidget::didCompletePointerLock): + (WebKit::WebWidget::didNotCompletePointerLock): + (WebKit::WebWidget::didLosePointerLock): + * public/WebWidgetClient.h: + (WebKit::WebWidgetClient::requestPointerLock): + (WebKit::WebWidgetClient::requestPointerUnlock): + (WebKit::WebWidgetClient::isPointerLocked): + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::requestPointerLock): + (WebKit::ChromeClientImpl::requestPointerUnlock): + (WebKit::ChromeClientImpl::isPointerLocked): + * src/ChromeClientImpl.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleInputEvent): + (WebKit::WebViewImpl::didCompletePointerLock): + (WebKit::WebViewImpl::didNotCompletePointerLock): + (WebKit::WebViewImpl::didLosePointerLock): + (WebKit::WebViewImpl::requestPointerLock): + (WebKit::WebViewImpl::requestPointerUnlock): + (WebKit::WebViewImpl::isPointerLocked): + (WebKit::WebViewImpl::pointerLockMouseEvent): + * src/WebViewImpl.h: + +2012-01-23 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-01-23 Tom Sepez <tsepez@chromium.org> + + [chromium] Clean up old WebSharedWorker::startWorkerContext() method. + https://bugs.webkit.org/show_bug.cgi?id=76853 + + Reviewed by Darin Fisher. + + * public/WebSharedWorker.h: + * src/WebSharedWorkerImpl.cpp: + * src/WebSharedWorkerImpl.h: + +2012-01-23 Dmitry Lomov <dslomov@google.com> + + [Chromium] Implement layoutTestController.workerThreadCount in DRT + https://bugs.webkit.org/show_bug.cgi?id=74653. + Expose WebCore::WorkerThread::workerThreadCount() in API layer + for DumpRenderTree. + + Reviewed by Darin Fisher. + + * WebKit.gyp: + * public/WebWorkerInfo.h: Copied from Source/WebKit/chromium/public/WebCommonWorkerClient.h. + * src/WebWorkerInfo.cpp: Copied from Source/WebKit/chromium/public/WebCommonWorkerClient.h. + (WebKit::WebWorkerInfo::dedicatedWorkerCount): + +2012-01-23 Greg Billock <gbillock@google.com> + + Fine tune Web Intents Chromium API + https://bugs.webkit.org/show_bug.cgi?id=76754 + + Reviewed by Darin Fisher. + + * public/WebIntent.h: + * public/WebIntentServiceInfo.h: + * src/WebIntent.cpp: + * src/WebIntentServiceInfo.cpp: + (WebKit::WebIntentServiceInfo::WebIntentServiceInfo): + +2012-01-23 Shawn Singh <shawnsingh@chromium.org> + + [chromium] updateRect is incorrect when contentBounds != bounds + https://bugs.webkit.org/show_bug.cgi?id=72919 + + Reviewed by James Robinson. + + * tests/TiledLayerChromiumTest.cpp: + (WTF::FakeTiledLayerWithScaledBounds::FakeTiledLayerWithScaledBounds): + (WTF::FakeTiledLayerWithScaledBounds::setContentBounds): + (WTF::FakeTiledLayerWithScaledBounds::contentBounds): + (WTF::FakeTiledLayerWithScaledBounds::updateRect): + (WTF::TEST): + +2012-01-23 Takashi Toyoshima <toyoshim@chromium.org> + + [Chromium][WebSocket] Remove binary communication using WebData in WebKit API + https://bugs.webkit.org/show_bug.cgi?id=76608 + + Reviewed by Darin Fisher. + + * public/WebSocket.h: Remove BinaryTypeData definition and sendBinary(const WebData&). + * public/WebSocketClient.h: Remove didReceiveBinaryData(const WebData&). + * src/WebSocketImpl.cpp: Remove WebData related code and set default binary type as BinaryTypeBlob. + (WebKit::WebSocketImpl::WebSocketImpl): Remove sendBinary(const WebData&). + (WebKit::WebSocketImpl::didReceiveBinaryData): Remove WebData supporting code. + * src/WebSocketImpl.h: Remove sendBinary(const WebData&). + +2012-01-23 James Robinson <jamesr@chromium.org> + + [chromium] Add <(SHARED_INTERMEDIATE_DIR)/webkit to include path of targets that depend on WebKit API so they pick up the copied headers in an onion build + https://bugs.webkit.org/show_bug.cgi?id=76879 + + Reviewed by Dirk Pranke. + + * WebKit.gyp: + +2012-01-23 Stephen White <senorblanco@chromium.org> + + Unreviewed, rolling out r105640. + http://trac.webkit.org/changeset/105640 + https://bugs.webkit.org/show_bug.cgi?id=76849 + + Broke the chromium build. + + * DEPS: + +2012-01-23 Justin Novosad <junov@chromium.org> + + rolling chromium DEPS to r118713 + https://bugs.webkit.org/show_bug.cgi?id=76849 + + Reviewed by Stephen White. + + This is to pick up a change to skia build configuration + + * DEPS: + +2012-01-23 Xianzhu Wang <wangxianzhu@chromium.org> + + Basic enhancements to StringBuilder + https://bugs.webkit.org/show_bug.cgi?id=67081 + + This change is because we explicitly disallowed StringBuilder's + copy constructor and assignment operator. + + Reviewed by Darin Adler. + + No new tests. All layout tests and unit tests should run as before. + + * src/WebPageSerializerImpl.cpp: + (WebKit::WebPageSerializerImpl::encodeAndFlushBuffer): + +2012-01-23 W. James MacLean <wjmaclean@chromium.org> + + [chromium] Add WebSolidColorLayer interface to draw non-textured color layers from Aura. + https://bugs.webkit.org/show_bug.cgi?id=75732 + + Reviewed by James Robinson. + + * WebKit.gyp: + * WebKit.gypi: + * public/platform/WebSolidColorLayer.h: Added. + * src/WebSolidColorLayer.cpp: Added. + (WebKit::WebSolidColorLayer::create): + (WebKit::WebSolidColorLayer::WebSolidColorLayer): + (WebKit::WebSolidColorLayer::setBackgroundColor): + * src/WebSolidColorLayerImpl.cpp: Added. + (WebKit::WebSolidColorLayerImpl::create): + (WebKit::WebSolidColorLayerImpl::WebSolidColorLayerImpl): + (WebKit::WebSolidColorLayerImpl::~WebSolidColorLayerImpl): + * src/WebSolidColorLayerImpl.h: Added. + * tests/CCLayerTestCommon.cpp: Added. + (CCLayerTestCommon::completelyContains): + (CCLayerTestCommon::verifyQuadsExactlyCoverRect): + * tests/CCLayerTestCommon.h: Added. + * tests/CCSolidColorLayerImplTest.cpp: Added. + (CCLayerTestCommon::TEST): + * tests/CCTiledLayerImplTest.cpp: + +2012-01-20 Pavel Feldman <pfeldman@google.com> + + Web Inspector: PageAgent.open() dosen't belong to the protocol. + https://bugs.webkit.org/show_bug.cgi?id=74790 + + Reviewed by Yury Semikhatsky. + + * public/WebDevToolsFrontendClient.h: + (WebKit::WebDevToolsFrontendClient::openInNewTab): + * src/InspectorFrontendClientImpl.cpp: + (WebKit::InspectorFrontendClientImpl::openInNewTab): + (WebKit::InspectorFrontendClientImpl::saveAs): + * src/InspectorFrontendClientImpl.h: + +2012-01-21 David Reveman <reveman@chromium.org> + + [Chromium] Incremental texture updates are not atomic. + https://bugs.webkit.org/show_bug.cgi?id=72672 + + Reviewed by Adam Barth. + + Add CCLayerTreeHostTestAtomicCommit test that verifies atomicity + of commits. + + * tests/CCLayerTreeHostTest.cpp: + (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::MockLayerTreeHostClient::createLayerTreeHostContext3D): + (WTF::MockContentLayerDelegate::drawsContent): + (WTF::MockContentLayerDelegate::paintContents): + (WTF::MockContentLayerDelegate::notifySyncRequired): + (WTF::CCLayerTreeHostTestAtomicCommit::CCLayerTreeHostTestAtomicCommit): + (WTF::CCLayerTreeHostTestAtomicCommit::beginTest): + (WTF::CCLayerTreeHostTestAtomicCommit::commitCompleteOnCCThread): + (WTF::CCLayerTreeHostTestAtomicCommit::drawLayersOnCCThread): + (WTF::CCLayerTreeHostTestAtomicCommit::layout): + (WTF::CCLayerTreeHostTestAtomicCommit::afterTest): + (WTF::TEST_F): + * tests/CompositorFakeWebGraphicsContext3D.h: + +2012-01-21 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r105564. + http://trac.webkit.org/changeset/105564 + https://bugs.webkit.org/show_bug.cgi?id=76792 + + Does not compile on Chromium Mac (Requested by abarth on + #webkit). + + * tests/CCLayerTreeHostTest.cpp: + (WTF::MockLayerTreeHostClient::createLayerTreeHostContext3D): + * tests/CompositorFakeWebGraphicsContext3D.h: + +2012-01-20 Alexandre Elias <aelias@google.com> + + [chromium] Write unit tests for compositor-thread zooming + https://bugs.webkit.org/show_bug.cgi?id=71529 + + Reviewed by James Robinson. + + Add unit tests for pinch zoom and page scale animation. Includes + small cleanups in CCLayerTreeHostImpl for testability. + + * tests/CCLayerTreeHostImplTest.cpp: + (WebKit::CCLayerTreeHostImplTest::setupScrollAndContentsLayers): + (WebKit::TEST_F): + +2012-01-20 David Reveman <reveman@chromium.org> + + [Chromium] Incremental texture updates are not atomic. + https://bugs.webkit.org/show_bug.cgi?id=72672 + + Reviewed by James Robinson. + + Add CCLayerTreeHostTestAtomicCommit test that verifies atomicity + of commits. + + * tests/CCLayerTreeHostTest.cpp: + (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::MockLayerTreeHostClient::createLayerTreeHostContext3D): + (WTF::MockContentLayerDelegate::drawsContent): + (WTF::MockContentLayerDelegate::paintContents): + (WTF::MockContentLayerDelegate::notifySyncRequired): + (WTF::CCLayerTreeHostTestAtomicCommit::CCLayerTreeHostTestAtomicCommit): + (WTF::CCLayerTreeHostTestAtomicCommit::beginTest): + (WTF::CCLayerTreeHostTestAtomicCommit::commitCompleteOnCCThread): + (WTF::CCLayerTreeHostTestAtomicCommit::drawLayersOnCCThread): + (WTF::CCLayerTreeHostTestAtomicCommit::layout): + (WTF::CCLayerTreeHostTestAtomicCommit::afterTest): + (WTF::TEST_F): + * tests/CompositorFakeWebGraphicsContext3D.h: + +2012-01-20 Ami Fischman <fischman@chromium.org> + + Small cleanup of {get,put}CurrentFrame for WebMediaPlayerClientImpl/CCVideoLayerImpl. + https://bugs.webkit.org/show_bug.cgi?id=76332 + + Reviewed by James Robinson. + + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::getCurrentFrame): + (WebKit::WebMediaPlayerClientImpl::putCurrentFrame): + +2012-01-20 Ryosuke Niwa <rniwa@webkit.org> + + Roll Chromium DEPS from 118291 to 118493. + + * DEPS: + +2012-01-20 Ryosuke Niwa <rniwa@webkit.org> + + Revert r105545. Something got broken about gclient/gyp but I can't figure out what. + + * DEPS: + +2012-01-20 Ryosuke Niwa <rniwa@webkit.org> + + Roll Chromium DEPS from 118291 to 118530. + + * DEPS: + +2012-01-20 Sadrul Habib Chowdhury <sadrul@chromium.org> + + [chromium] Revert a couple of changes in fileapi/ that break tests in chromeos. + https://bugs.webkit.org/show_bug.cgi?id=76718 + + Reviewed by Darin Fisher. + + * public/platform/WebFileSystem.h: + * src/AssertMatchingEnums.cpp: + * src/AsyncFileSystemChromium.cpp: + * src/AsyncFileSystemChromium.h: + +2012-01-20 Fady Samuel <fsamuel@chromium.org> + + [Chromium] Do not recompute viewport on same page navigation + https://bugs.webkit.org/show_bug.cgi?id=75576 + + Reviewed by Darin Fisher. + + Added parameter isNavigationWithinPage to WebViewImpl::didCommitLoad + that indicates whether a same-page navigation has just occurred. + + The page scale factor flag is reset only on navigation to a new page. + If the flag is not set, viewport and page scale will be recomputed on + layoutUpdated. + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchDidNavigateWithinPage): + (WebKit::FrameLoaderClientImpl::dispatchDidCommitLoad): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::didCommitLoad): + (WebKit::WebViewImpl::observeNewNavigation): + * src/WebViewImpl.h: + +2012-01-20 Pavel Feldman <pfeldman@google.com> + + Web Inspector: [chromium] add WebDevToolsFrontendClient::openInNewTab for upcoming WebCore change. + https://bugs.webkit.org/show_bug.cgi?id=76698 + + Reviewed by Yury Semikhatsky. + + * public/WebDevToolsFrontendClient.h: + (WebKit::WebDevToolsFrontendClient::openInNewTab): + +2012-01-20 Hayato Ito <hayato@chromium.org> + + Add ShadowRoot.idl which is enabled by newly introduced SHADOW_DOM flag. + https://bugs.webkit.org/show_bug.cgi?id=76353 + + Reviewed by Hajime Morita. + + Add ShadowRoot.idl, which is enabled only on chromium port since this is + under development feature. + ShadowRoot.idl contains minimum API so that we can test it. + Other APIs should be added on other changes so that we can isolate issues. + + * features.gypi: + * public/WebRuntimeFeatures.h: + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enableShadowDOM): + (WebKit::WebRuntimeFeatures::isShadowDOMEnabled): + +2012-01-20 Shinya Kawanaka <shinyak@google.com> + + [chromium] Chromium should have EditorClientImpl::checkTextOfParagraph. + https://bugs.webkit.org/show_bug.cgi?id=74071 + + Reviewed by Darin Fisher. + + Spellchecker on Mac has more sophisticated interface for spellchecking (checkTextOfParagraph). + If the other ports have the same interface, code can be clearer and easy to extend. + This patch introduces such an interface. The implementation will be done not in WebKit but in Chromium. + + Also, currently WebKit::WebTextCheckingResult and WebCore::TextCheckingResult have different forms. + They should be corresponding apparently. This patch introduces such correspondence. + + * WebKit.gyp: + * public/WebSpellCheckClient.h: + (WebKit::WebSpellCheckClient::checkTextOfParagraph): + A new interface for spellchecking. + * public/WebTextCheckingResult.h: + (WebKit::WebTextCheckingResult::WebTextCheckingResult): + Changed so that WebTextCheckingResult corresponds to WebCore::TextCheckingResult. + * public/WebTextCheckingType.h: Copied from Source/WebKit/chromium/public/WebTextCheckingResult.h. + * src/AssertMatchingEnums.cpp: + * src/EditorClientImpl.cpp: + (WebKit::EditorClientImpl::checkTextOfParagraph): + * src/EditorClientImpl.h: + * src/WebTextCheckingResult.cpp: Copied from Source/WebKit/chromium/public/WebTextCheckingResult.h. + (WebKit::WebTextCheckingResult::operator TextCheckingResult): + +2012-01-20 Shinya Kawanaka <shinyak@google.com> + + [chromium] WebFrame should have an interface to invoke spellchecking in arbitrarily. + https://bugs.webkit.org/show_bug.cgi?id=73971 + + Reviewed by Darin Fisher. + + This interface is necessary to recheck spelling of an arbitrary element. + + * public/WebFrame.h: + * public/WebNode.h: + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::requestTextChecking): + Requests spellchecking for the element having current selection. + * src/WebFrameImpl.h: + * src/WebNode.cpp: + (WebKit::WebNode::rootEditableElement): + Takes a root editable element from Node. + +2012-01-19 Kinuko Yasuda <kinuko@chromium.org> + + Cleanup: make constant variable names in fileapi/ conform to WebKit's coding guideline + https://bugs.webkit.org/show_bug.cgi?id=76625 + + Reviewed by David Levin. + + Also removing (almost) duplicated implementation of AsyncFileSystem::crackFileSystem. + + * src/AsyncFileSystemChromium.cpp: + +2012-01-19 Alexandre Elias <aelias@google.com> + + [chromium] Draw gutter quads outside root content layer + https://bugs.webkit.org/show_bug.cgi?id=76328 + + Reviewed by James Robinson. + + Add new layer property "backgroundCoversViewport". If the content + layers don't fully cover the render surface, this code calculates the + difference between the root clip rect and the root content layer and + draws up to four background-color quads in exactly the area that would + be undrawn. + + Test: CCTiledLayerImplTest::backgroundCoversViewport + + * src/NonCompositedContentHost.cpp: + (WebKit::NonCompositedContentHost::NonCompositedContentHost): + * tests/CCLayerImplTest.cpp: + (WebCore::TEST): + * tests/CCTiledLayerImplTest.cpp: + (WebCore::TEST): + * tests/LayerChromiumTest.cpp: + +2012-01-19 Greg Billock <gbillock@google.com> + + Web Intents chromium API modifications to track IntentRequest invocation method + https://bugs.webkit.org/show_bug.cgi?id=76014 + + Reviewed by Darin Fisher. + + * public/WebFrameClient.h: + (WebKit::WebFrameClient::dispatchIntent): + * public/WebIntent.h: + * public/WebIntentRequest.h: Added. + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchIntent): + * src/FrameLoaderClientImpl.h: + * src/WebIntent.cpp: + * src/WebIntentRequest.cpp: Added. + +2012-01-19 Michal Mocny <mmocny@google.com> + + [chromium] Replace WGC3D visibility extension with resource_usage extension. [Part 1 of 3] + https://bugs.webkit.org/show_bug.cgi?id=76634 + + Reviewed by Kenneth Russell. + + * public/platform/WebGraphicsContext3D.h: + (WebKit::WebGraphicsContext3D::setVisibilityCHROMIUM): + (WebKit::WebGraphicsContext3D::setResourceUsageCHROMIUM): + * src/GraphicsContext3DChromium.cpp: + (WebCore::GraphicsContext3DPrivate::setVisibilityCHROMIUM): + * tests/FakeWebGraphicsContext3D.h: + (WebKit::FakeWebGraphicsContext3D::setResourceUsageCHROMIUM): + +2012-01-19 James Robinson <jamesr@chromium.org> + + [chromium] Remove CCLayerDelegate, add ContentLayerDelegate for painting + https://bugs.webkit.org/show_bug.cgi?id=76663 + + Reviewed by Kenneth Russell. + + * src/WebContentLayerImpl.cpp: + (WebKit::WebContentLayerImpl::~WebContentLayerImpl): + * src/WebContentLayerImpl.h: + * src/WebExternalTextureLayerImpl.cpp: + (WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl): + (WebKit::WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl): + * src/WebExternalTextureLayerImpl.h: + * src/WebLayerImpl.cpp: + (WebKit::WebLayerImpl::WebLayerImpl): + (WebKit::WebLayerImpl::~WebLayerImpl): + * src/WebLayerImpl.h: + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::readyStateChanged): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::WebPluginContainerImpl): + * tests/CCLayerIteratorTest.cpp: + * tests/CCLayerTreeHostCommonTest.cpp: + (WebCore::LayerChromiumWithForcedDrawsContent::LayerChromiumWithForcedDrawsContent): + (WebCore::TEST): + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTest::doBeginTest): + (WTF::ContentLayerChromiumWithUpdateTracking::create): + (WTF::ContentLayerChromiumWithUpdateTracking::ContentLayerChromiumWithUpdateTracking): + * tests/LayerChromiumTest.cpp: + * tests/TiledLayerChromiumTest.cpp: + (WTF::FakeTiledLayerChromium::FakeTiledLayerChromium): + * tests/TreeSynchronizerTest.cpp: + (WebCore::MockLayerChromium::MockLayerChromium): + (WebCore::TEST): + +2012-01-19 Dirk Pranke <dpranke@chromium.org> + + remove the duplicated build rules from WebKit.gyp, Tools.gyp + https://bugs.webkit.org/show_bug.cgi?id=73384 + + Reviewed by Tony Chang. + + This patch removes the no-longer-necessary conditional logic for + build_webkit_exes_from_webkit_gyp; we now always build the exes + from their own dedicated gyp files. + * WebKit.gyp: + * WebKitUnitTests.gyp: + * gyp_webkit: + +2012-01-19 Dirk Pranke <dpranke@chromium.org> + + Unreviewed, Roll DEPS to most recent LKGR (118291). + + * DEPS: + +2012-01-18 Jer Noble <jer.noble@apple.com> + + Make WebAudio API const-correct. + https://bugs.webkit.org/show_bug.cgi?id=76573 + + Reviewed by Daniel Bates. + + The following functions were modified to use the renamed mutableData() accessor: + * src/AudioDestinationChromium.cpp: + (WebCore::AudioDestinationChromium::FIFO::fillBuffer): + (WebCore::AudioDestinationChromium::FIFO::consume): + * src/WebAudioData.cpp: + (WebCore::WebAudioBus::channelData): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::AudioSourceProviderImpl::provideInput): + +2012-01-19 Joi Sigurdsson <joi@chromium.org> + + Enable use of precompiled headers in Chromium port on Windows. + + Bug 76381 - Use precompiled headers in Chromium port on Windows + https://bugs.webkit.org/show_bug.cgi?id=76381 + + Reviewed by Tony Chang. + + * WebKit.gyp: Include WinPrecompile.gypi. + * WinPrecompile.cpp: Added. + * WinPrecompile.gypi: Added. + * WinPrecompile.h: Added. + +2012-01-18 Kinuko Yasuda <kinuko@chromium.org> + + Cleanup: Move chrome-specific filesystem type handling code (for FileSystem API) under chromium directory + https://bugs.webkit.org/show_bug.cgi?id=76551 + + Reviewed by Darin Fisher. + + * src/AssertMatchingEnums.cpp: Removed matching assertion for TypeExternal as it's no longer defined separately. + * src/AsyncFileSystemChromium.cpp: Added crackFileSystemURL() and toURL() implementation that + handle chrome-specific filesystem type (EXTERNAL) as well as regular TEMPORARY/PERSISTENT types. + (WebCore::AsyncFileSystem::crackFileSystemURL): Added. + (WebCore::AsyncFileSystemChromium::toURL): Added. + * src/AsyncFileSystemChromium.h: + +2012-01-18 Tom Sepez <tsepez@chromium.org> + + Pass content-security-policy directive into shared workers. + https://bugs.webkit.org/show_bug.cgi?id=75660 + + Reviewed by Darin Fisher. + + * public/WebContentSecurityPolicy.h: Added. + * public/WebSharedWorker.h: + (WebKit::WebSharedWorker::startWorkerContext): + * src/AssertMatchingEnums.cpp: + * src/SharedWorkerRepository.cpp: + (WebCore::SharedWorkerScriptLoader::notifyFinished): + * src/WebSharedWorkerImpl.cpp: + (WebKit::WebSharedWorkerImpl::startWorkerContext): + * src/WebSharedWorkerImpl.h: + +2012-01-18 Ian Vollick <vollick@chromium.org> + + [chromium] Create a base-class CCAnimation to represent compositor animations + https://bugs.webkit.org/show_bug.cgi?id=73233 + + Reviewed by Kenneth Russell. + + * WebKit.gypi: + * tests/CCActiveAnimationTest.cpp: Added. + (WebCore::FakeFloatAnimation::duration): + (WebCore::FakeFloatAnimation::getValue): + (WebCore::createActiveAnimation): + (WebCore::TEST): + * tests/CCLayerAnimationControllerImplTest.cpp: Added. + (WebCore::FakeControllerClient::FakeControllerClient): + (WebCore::FakeControllerClient::~FakeControllerClient): + (WebCore::FakeControllerClient::opacity): + (WebCore::FakeControllerClient::setOpacity): + (WebCore::FakeControllerClient::transform): + (WebCore::FakeControllerClient::setTransform): + (WebCore::FakeControllerClient::animationControllerImplDidActivate): + (WebCore::FakeControllerClient::activeControllers): + (WebCore::FakeTransformTransition::FakeTransformTransition): + (WebCore::FakeTransformTransition::duration): + (WebCore::FakeTransformTransition::getValue): + (WebCore::FakeFloatTransition::FakeFloatTransition): + (WebCore::FakeFloatTransition::duration): + (WebCore::FakeFloatTransition::getValue): + (WebCore::TEST): + +2012-01-18 James Robinson <jamesr@chromium.org> + + Unreviewed, rolling out r105366. + http://trac.webkit.org/changeset/105366 + https://bugs.webkit.org/show_bug.cgi?id=76015 + + Breaks CCLayerTreeHostImplTest unit test + + * tests/CCQuadCullerTest.cpp: + (WebCore::TestDrawQuad::TestDrawQuad): + (WebCore::TestDrawQuad::create): + (WebCore::setQuads): + * tests/CCTiledLayerImplTest.cpp: + (WebCore::createLayer): + (WebCore::TEST): + (WebCore::getQuads): + (WebCore::coverageVisibleRectOnTileBoundaries): + (WebCore::coverageVisibleRectIntersectsTiles): + (WebCore::coverageVisibleRectIntersectsBounds): + +2012-01-18 Dana Jansens <danakj@chromium.org> + + [chromium] Use region reported painted opaque for draw culling + https://bugs.webkit.org/show_bug.cgi?id=76015 + + Reviewed by James Robinson. + + * tests/CCQuadCullerTest.cpp: + (WebCore::TestDrawQuad::TestDrawQuad): + (WebCore::TestDrawQuad::create): + (WebCore::setQuads): + (WebCore::TEST): + * tests/CCTiledLayerImplTest.cpp: + (WebCore::createLayer): + (WebCore::TEST): + (WebCore::getQuads): + (WebCore::coverageVisibleRectOnTileBoundaries): + (WebCore::coverageVisibleRectIntersectsTiles): + (WebCore::coverageVisibleRectIntersectsBounds): + +2012-01-18 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Fix InjectIDBKeyTest.SubProperty test failure + https://bugs.webkit.org/show_bug.cgi?id=76582 + + Correct the test, now that https://bugs.webkit.org/show_bug.cgi?id=76493 + changes the semantics so that intermediate objects are created if possible + to satisfy autoIncrement keypaths. + + Reviewed by James Robinson. + + * tests/IDBBindingUtilitiesTest.cpp: + (WebCore::TEST): + +2012-01-18 Dirk Pranke <dpranke@chromium.org> + + [chromium] move Tools.gyp, switch build-webkit --chromium to All.gyp + https://bugs.webkit.org/show_bug.cgi?id=76505 + + Reviewed by Tony Chang. + + Update path to Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp. + + * All.gyp: + * gyp_webkit: + - change to using All.gyp + - change build_webkit_exes_from_webkit_gyp to 0 + +2012-01-18 David Grogan <dgrogan@chromium.org> + + IndexedDB: Check for permission before using IndexedDB from a worker. + https://bugs.webkit.org/show_bug.cgi?id=76500 + + Reviewed by David Levin. + + * src/IDBFactoryBackendProxy.cpp: + (WebKit::AllowIndexedDBMainThreadBridge::create): + (WebKit::AllowIndexedDBMainThreadBridge::cancel): + (WebKit::AllowIndexedDBMainThreadBridge::result): + (WebKit::AllowIndexedDBMainThreadBridge::signalCompleted): + (WebKit::AllowIndexedDBMainThreadBridge::AllowIndexedDBMainThreadBridge): + (WebKit::AllowIndexedDBMainThreadBridge::allowIndexedDBTask): Call + webView->permissionClient()->allowIndexedDB on the main thread because + ContentSettingsObserver::AllowIndexedDB(), which is called down the + chain, expects to be run on the main thread. + (WebKit::AllowIndexedDBMainThreadBridge::didComplete): + (WebKit::IDBFactoryBackendProxy::allowIDBFromWorkerThread): Wait for + main permission check to complete on main thread before proceeding on + worker thread. + +2012-01-18 Tommy Widenflycht <tommyw@google.com> + + [chromium] MediaStream API: Make WebMediaStreamDescriptor copyable + https://bugs.webkit.org/show_bug.cgi?id=76526 + + Reviewed by Darin Fisher. + + This patch adds a copy constructor and a assignment operator to WebMediaStreamDescriptor. + + * public/platform/WebMediaStreamDescriptor.h: + (WebKit::WebMediaStreamDescriptor::WebMediaStreamDescriptor): + (WebKit::WebMediaStreamDescriptor::operator=): + * src/WebMediaStreamDescriptor.cpp: + (WebKit::WebMediaStreamDescriptor::assign): + +2012-01-18 Dana Jansens <danakj@chromium.org> + + [chromium] Enable tracking opaque region in Skia graphics context, return it from LayerTextureUpdater + https://bugs.webkit.org/show_bug.cgi?id=76211 + + Reviewed by James Robinson. + + * WebKit.gypi: + * tests/LayerTextureUpdaterTest.cpp: Added. + (WebCore::TestLayerPainterChromium::TestLayerPainterChromium): + (WebCore::TestLayerPainterChromium::paint): + (WebCore::PaintFillOpaque::operator()): + (WebCore::PaintFillAlpha::operator()): + (WebCore::TEST): + * tests/TiledLayerChromiumTest.cpp: + (WTF::FakeLayerTextureUpdater::prepareToUpdate): + +2012-01-18 Tim Dresser <tdresser@chromium.org> + + [chromium] Refactor canvas, plugin, and video drawing to be more data-driven + https://bugs.webkit.org/show_bug.cgi?id=76274 + + Reviewed by James Robinson. + + No longer test culling in CCLayerTreeHostImplTest.blendingOffWhenDrawingLayers. + + * tests/CCLayerTreeHostImplTest.cpp: + (WebKit::BlendStateCheckLayer::appendQuads): + (WebKit::BlendStateCheckLayer::setExpectation): + (WebKit::BlendStateCheckLayer::quadsAppended): + (WebKit::BlendStateCheckLayer::BlendStateCheckLayer): + (WebKit::TEST_F): + +2012-01-18 Dominic Mazzoni <dmazzoni@google.com> + + Accessibility: Chromium needs methods to scroll an object into view or to a specific location. + https://bugs.webkit.org/show_bug.cgi?id=73460 + + Reviewed by Chris Fleizach. + + * public/WebAccessibilityObject.h: + * src/WebAccessibilityObject.cpp: + (WebKit::WebAccessibilityObject::scrollToMakeVisible): + (WebKit::WebAccessibilityObject::scrollToMakeVisibleWithSubFocus): + (WebKit::WebAccessibilityObject::scrollToGlobalPoint): + +2012-01-17 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r105244. + http://trac.webkit.org/changeset/105244 + https://bugs.webkit.org/show_bug.cgi?id=76518 + + broke Chromium Mac (Requested by rolandsteiner on #webkit). + + * public/WebAccessibilityObject.h: + * src/WebAccessibilityObject.cpp: + +2012-01-17 Dominic Mazzoni <dmazzoni@google.com> + + Accessibility: Chromium needs methods to scroll an object into view or to a specific location. + https://bugs.webkit.org/show_bug.cgi?id=73460 + + Reviewed by Chris Fleizach. + + * public/WebAccessibilityObject.h: + * src/WebAccessibilityObject.cpp: + (WebKit::WebAccessibilityObject::scrollToMakeVisible): + (WebKit::WebAccessibilityObject::scrollToMakeVisibleWithSubFocus): + (WebKit::WebAccessibilityObject::scrollToGlobalPoint): + +2012-01-17 Noel Gordon <noel.gordon@gmail.com> + + [chromium] Remove public/WebWorker.h from the gyp projects + https://bugs.webkit.org/show_bug.cgi?id=76512 + + Reviewed by David Levin. + + public/WebWorker.h was removed in r105020, remove references from the gyp projects. + + * WebKit.gyp: + +2012-01-17 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. Update Chromium dependency 117616:117882 + + * DEPS: + +2012-01-17 Bill Budge <bbudge@chromium.org> + + AssociatedURLLoader adds support for the HTTP response header Access-Control-Expose-Header. + https://bugs.webkit.org/show_bug.cgi?id=76419 + + Reviewed by Adam Barth. + + * src/AssociatedURLLoader.cpp: + (WebKit::AssociatedURLLoader::ClientAdapter::didReceiveResponse): + * tests/AssociatedURLLoaderTest.cpp: + (WebKit::AssociatedURLLoaderTest::CheckAccessControlHeaders): + (WebKit::TEST_F): + +2012-01-16 Bill Budge <bbudge@chromium.org> + + Changes AssociatedURLLoader to remove non-whitelisted HTTP response headers for CORS requests, + and Set-Cookie and Set-Cookie2 response headers for all requests. + https://bugs.webkit.org/show_bug.cgi?id=76228 + + Reviewed by Adam Barth. + + * src/AssociatedURLLoader.cpp: + (WebKit::AssociatedURLLoader::ClientAdapter::create): + (WebKit::AssociatedURLLoader::ClientAdapter::ClientAdapter): + (WebKit::AssociatedURLLoader::ClientAdapter::didReceiveResponse): + (WebKit::AssociatedURLLoader::loadAsynchronously): + * tests/AssociatedURLLoaderTest.cpp: + (WebKit::AssociatedURLLoaderTest::didReceiveResponse): + (WebKit::TEST_F): + +2012-01-16 xueqing huang <huangxueqing@baidu.com> + + Add offline web applications API applicationCache.abort. + https://bugs.webkit.org/show_bug.cgi?id=76270 + + Reviewed by Alexey Proskuryakov. + + * src/ApplicationCacheHost.cpp: + (WebCore::ApplicationCacheHost::abort): + +2012-01-16 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r105040. + http://trac.webkit.org/changeset/105040 + https://bugs.webkit.org/show_bug.cgi?id=76373 + + Breaks Win (dbg) canary builder (Requested by apavlov on + #webkit). + + * WebKit.gypi: + * tests/DispatchEventTest.cpp: Removed. + * tests/data/event_target.html: Removed. + +2012-01-16 Dave Michael <dmichael@chromium.org> + + Reland chromium event dispatch test from https://bugs.webkit.org/show_bug.cgi?id=72988 + https://bugs.webkit.org/show_bug.cgi?id=73837 + + The original patch had a mistake that caused it to fail (not sure how I + missed that or why the bots didn't catch it). + + Reviewed by Hajime Morita. + + * WebKit.gypi: + * tests/DispatchEventTest.cpp: Added. + (WebKit::MockListener::MockListener): + (WebKit::MockListener::~MockListener): + (WebKit::MockListener::events): + (WebKit::DispatchEventTest::DispatchEventTest): + (WebKit::DispatchEventTest::TearDown): + (WebKit::DispatchEventTest::createMessageEvent): + (WebKit::TEST_F): + * tests/data/event_target.html: Added. + +2012-01-15 Xinchao He <xinchao.he@intel.com> + + Add DeviceOrientationEvent.absolute + https://bugs.webkit.org/show_bug.cgi?id=51742 + + Reviewed by Darin Fisher. + + This patch add the DeviceOrientationEvent.absolute to follow the + latest w3c device orientation event spec. + http://www.w3.org/TR/orientation-event/ + + * public/WebDeviceOrientation.h: + (WebKit::WebDeviceOrientation::WebDeviceOrientation): + (WebKit::WebDeviceOrientation::canProvideAbsolute): + (WebKit::WebDeviceOrientation::absolute): + * src/WebDeviceOrientation.cpp: + (WebKit::WebDeviceOrientation::WebDeviceOrientation): + (WebKit::WebDeviceOrientation::operator=): + (WebKit::WebDeviceOrientation::operator PassRefPtr<WebCore::DeviceOrientation>): + +2012-01-14 David Levin <levin@chromium.org> + + HWndDC should be in platform/win instead of wtf. + https://bugs.webkit.org/show_bug.cgi?id=76314 + + Reviewed by Sam Weinig. + + * src/win/WebScreenInfoFactory.cpp: + (WebKit::WebScreenInfoFactory::screenInfo): + +2012-01-14 Dmitry Lomov <dslomov@google.com> + + [Chromium] Remove WebKit::WebWorker class. + https://bugs.webkit.org/show_bug.cgi?id=76327 + + Reviewed by Darin Fisher. + + * public/WebWorker.h: Removed. + * src/WebWorkerClientImpl.cpp: + +2012-01-13 David Levin <levin@chromium.org> + + HWndDC is a better name than HwndDC. + https://bugs.webkit.org/show_bug.cgi?id=76281 + + Reviewed by Darin Adler. + + * src/win/WebScreenInfoFactory.cpp: + (WebKit::WebScreenInfoFactory::screenInfo): + +2012-01-13 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-01-12 David Levin <levin@chromium.org> + + HwndDC is a better name than OwnGetDC. + https://bugs.webkit.org/show_bug.cgi?id=76235 + + Reviewed by Dmitry Titov. + + * src/win/WebScreenInfoFactory.cpp: + (WebKit::WebScreenInfoFactory::screenInfo): + +2012-01-12 David Levin <levin@chromium.org> + + [chromium] Fix DC leak in WebScreenInfoFactory. + https://bugs.webkit.org/show_bug.cgi?id=76203 + + Reviewed by Dmitry Titov. + + * src/win/WebScreenInfoFactory.cpp: + (WebKit::WebScreenInfoFactory::screenInfo): Use OwnGetDC to ensure its release. + +2012-01-12 Dana Jansens <danakj@chromium.org> + + [skia] Track a simple opaque area when painting via PlatformContextSkia and save in LayerTextureUpdater + https://bugs.webkit.org/show_bug.cgi?id=74352 + + Reviewed by Stephen White. + + * WebKit.gypi: + * tests/PlatformContextSkiaTest.cpp: Added. + (WebCore::TEST): + +2012-01-12 Nat Duca <nduca@chromium.org> + + [chromium] Turn off FrameRateController timesource when it is not needed + https://bugs.webkit.org/show_bug.cgi?id=76149 + + Reviewed by James Robinson. + + * tests/CCDelayBasedTimeSourceTest.cpp: + (WebKitTests::TEST): + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTest::timeout): + * tests/CCSchedulerStateMachineTest.cpp: + (WebCore::TEST): + * tests/CCSchedulerTest.cpp: + (WebKitTests::TEST): + * tests/CCSchedulerTestCommon.h: + (WebKitTests::FakeCCTimeSource::active): + +2012-01-12 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-01-11 Vsevolod Vlasov <vsevik@chromium.org> + + Make default console messages line numbers consistent. + https://bugs.webkit.org/show_bug.cgi?id=74075 + + Reviewed by Pavel Feldman. + + Unset line numbers are not printed to console now. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::addMessageToConsole): + +2012-01-11 Takashi Toyoshima <toyoshim@chromium.org> + + Add WebArrayBuffer support in WebSocket to WebKit API. + https://bugs.webkit.org/show_bug.cgi?id=75080 + + Reviewed by Darin Fisher. + + * public/WebSocket.h: Add interface to send WebArrayBuffer, and set and get receiving binary object type. + * public/WebSocketClient.h: Add interface to receive WebArrayBuffer. + (WebKit::WebSocketClient::didReceiveArrayBuffer): + * src/WebSocketImpl.cpp: Add various binary types handling. + (WebKit::WebSocketImpl::WebSocketImpl): + (WebKit::WebSocketImpl::binaryType): + (WebKit::WebSocketImpl::setBinaryType): + (WebKit::WebSocketImpl::sendArrayBuffer): + (WebKit::WebSocketImpl::didReceiveBinaryData): + * src/WebSocketImpl.h: Add methods to handle various binary types. + +2012-01-11 Scott Violet <sky@google.com> + + [chromium] TiledLayerChromium drops invalidates that occur during + LayerTextureUpdater::prepareToUpdate + https://bugs.webkit.org/show_bug.cgi?id=76067 + + Reviewed by James Robinson. + + * tests/TiledLayerChromiumTest.cpp: + (WTF::FakeLayerTextureUpdater::FakeLayerTextureUpdater): + (WTF::FakeLayerTextureUpdater::prepareCount): + (WTF::FakeLayerTextureUpdater::clearPrepareCount): + (WTF::FakeLayerTextureUpdater::lastUpdateRect): + (WTF::FakeTiledLayerChromium::fakeLayerTextureUpdater): + (WTF::FakeLayerTextureUpdater::setRectToInvalidate): + (WTF::FakeLayerTextureUpdater::prepareToUpdate): + (WTF::TEST): + +2012-01-10 Dmitry Lomov <dslomov@google.com> + + [Chromium] Remove obsolete references to WebWorker class. + https://bugs.webkit.org/show_bug.cgi?id=76020 + + Reviewed by David Levin. + + * public/WebFrameClient.h: + * public/WebSharedWorkerClient.h: + +2012-01-11 Jochen Eisinger <jochen@chromium.org> + + Move the check for canExecuteScripts out of V8Proxy::retrieve + https://bugs.webkit.org/show_bug.cgi?id=75533 + + Reviewed by Adam Barth. + + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::didClearWindowObject): + 2012-01-10 Daniel Cheng <dcheng@chromium.org> [chromium] Unreviewed, roll Chromium DEPS to r117121. diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index 71471f7ad..b357b10dd 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': '117121' + 'chromium_rev': '119875' } deps = { diff --git a/Source/WebKit/chromium/Tools.gyp b/Source/WebKit/chromium/Tools.gyp deleted file mode 100644 index 9e2d5bc9d..000000000 --- a/Source/WebKit/chromium/Tools.gyp +++ /dev/null @@ -1,391 +0,0 @@ -# -# Copyright (C) 2011 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * 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. -# - -{ - 'variables': { - 'tools_dir': '../../../Tools', - 'source_dir': '../..', - }, - # FIXME: Remove this conditional check once chromium's - # build/common.gypi is setting this flag to 0 by default. See - # https://bugs.webkit.org/show_bug.cgi?id=68463. - 'conditions': [ - ['build_webkit_exes_from_webkit_gyp==0', { - 'includes': [ - '../../../Tools/DumpRenderTree/DumpRenderTree.gypi', - 'features.gypi', - ], - 'variables': { - 'conditions': [ - # Location of the chromium src directory and target type is different - # if webkit is built inside chromium or as standalone project. - ['inside_chromium_build==0', { - # Webkit is being built outside of the full chromium project. - # e.g. via build-webkit --chromium - 'chromium_src_dir': '<(source_dir)/WebKit/chromium', - },{ - # WebKit is checked out in src/chromium/third_party/WebKit - 'chromium_src_dir': '../../../..', - }], - ], - 'ahem_path': '<(tools_dir)/DumpRenderTree/qt/fonts/AHEM____.TTF', - }, - 'targets': [ - { - 'target_name': 'ImageDiff', - 'type': 'executable', - 'dependencies': [ - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support_gfx', - ], - 'include_dirs': [ - '<(source_dir)/JavaScriptCore', - '<(DEPTH)', - ], - 'sources': [ - '<(tools_dir)/DumpRenderTree/chromium/ImageDiff.cpp', - ], - 'conditions': [ - ['OS=="android"', { - 'toolsets': ['host'], - }], - ], - }, - { - 'target_name': 'DumpRenderTree', - 'type': 'executable', - 'mac_bundle': 1, - 'dependencies': [ - '<(source_dir)/WebKit/chromium/WebKit.gyp:inspector_resources', - '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit', - '<(source_dir)/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf_config', - '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl', - '<(chromium_src_dir)/third_party/icu/icu.gyp:icuuc', - '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8', - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:blob', - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support', - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_user_agent', - ], - 'include_dirs': [ - '<(chromium_src_dir)', - '<(source_dir)/WebKit/chromium/public', - '<(source_dir)/JavaScriptCore', - '<(source_dir)/JavaScriptCore/wtf', # wtf/text/*.h refers headers in wtf/ without wtf/. - '<(DEPTH)', - ], - 'defines': [ - # Technically not a unit test but require functions available only to - # unit tests. - 'UNIT_TEST', - ], - 'sources': [ - '<@(drt_files)', - ], - 'conditions': [ - ['OS=="win"', { - 'dependencies': [ - 'LayoutTestHelper', - '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:libEGL', - '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:libGLESv2', - ], - - 'resource_include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/webkit'], - 'sources': [ - '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc', - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.rc', - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc', - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.rc', - ], - 'conditions': [ - ['inside_chromium_build==1', { - 'configurations': { - 'Debug_Base': { - 'msvs_settings': { - 'VCLinkerTool': { - 'LinkIncremental': '<(msvs_large_module_debug_link_mode)', - }, - }, - }, - }, - }], - ], - 'copies': [{ - 'destination': '<(PRODUCT_DIR)', - 'files': ['<(ahem_path)'], - }], - },{ # OS!="win" - 'sources/': [ - ['exclude', 'Win\\.cpp$'], - ], - 'actions': [ - { - 'action_name': 'repack_locale', - 'variables': { - 'repack_path': '<(chromium_src_dir)/tools/grit/grit/format/repack.py', - 'pak_inputs': [ - '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.pak', - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.pak', - ]}, - 'inputs': [ - '<(repack_path)', - '<@(pak_inputs)', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/repack/DumpRenderTree.pak', - ], - 'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'], - 'process_outputs_as_mac_bundle_resources': 1, - }, - ], # actions - }], - ['OS=="mac"', { - 'dependencies': [ - '<(source_dir)/WebKit/chromium/WebKit.gyp:copy_mesa', - 'LayoutTestHelper', - ], - 'mac_bundle_resources': [ - '<(ahem_path)', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher300.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher400.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher500.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher600.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher700.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher800.ttf', - '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher900.ttf', - '<(SHARED_INTERMEDIATE_DIR)/webkit/textAreaResizeCorner.png', - ], - },{ # OS!="mac" - 'sources/': [ - # .mm is already excluded by common.gypi - ['exclude', 'Mac\\.cpp$'], - ], - }], - ['use_x11 == 1', { - 'dependencies': [ - '<(chromium_src_dir)/build/linux/system.gyp:fontconfig', - ], - 'copies': [{ - 'destination': '<(PRODUCT_DIR)', - 'files': [ - '<(ahem_path)', - '<(tools_dir)/DumpRenderTree/chromium/fonts.conf', - '<(INTERMEDIATE_DIR)/repack/DumpRenderTree.pak', - ] - }], - 'variables': { - # FIXME: Enable warnings on other platforms. - 'chromium_code': 1, - }, - 'conditions': [ - ['linux_use_tcmalloc == 1', { - 'dependencies': [ - '<(chromium_src_dir)/base/allocator/allocator.gyp:allocator', - ], - }], - ], - },{ # use_x11 != 1 - 'sources/': [ - ['exclude', 'Linux\\.cpp$'] - ] - }], - ['toolkit_uses_gtk == 1', { - 'defines': [ - 'WTF_USE_GTK=1', - ], - 'dependencies': [ - '<(chromium_src_dir)/build/linux/system.gyp:gtk', - ], - 'include_dirs': [ - '<(source_dir)/WebKit/chromium/public/gtk', - ], - },{ # toolkit_uses_gtk != 1 - 'sources/': [ - ['exclude', 'Gtk\\.cpp$'] - ] - }], - ['OS=="android"', { - 'dependencies': [ - 'ImageDiff#host', - ], - },{ # OS!="android" - 'sources/': [ - ['exclude', '(Android)\\.cpp$'] - ], - 'dependencies': [ - 'ImageDiff', - 'copy_TestNetscapePlugIn', - '<(chromium_src_dir)/third_party/mesa/mesa.gyp:osmesa', - ], - }], - ['inside_chromium_build==1 and component=="shared_library"', { - 'sources': [ - '<(source_dir)/WebKit/chromium/src/ChromiumCurrentTime.cpp', - '<(source_dir)/WebKit/chromium/src/ChromiumThreading.cpp', - ], - 'include_dirs': [ - '<(source_dir)/WebKit/chromium/public', - ], - 'dependencies': [ - '<(source_dir)/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf', - '<(source_dir)/WTF/WTF.gyp/WTF.gyp:newwtf', - ], - }], - ['inside_chromium_build==0', { - 'dependencies': [ - '<(chromium_src_dir)/webkit/support/setup_third_party.gyp:third_party_headers', - ] - }], - ['inside_chromium_build==0 or component!="shared_library"', { - 'dependencies': [ - '<(source_dir)/WebCore/WebCore.gyp/WebCore.gyp:webcore_test_support', - ], - 'include_dirs': [ - # WARNING: Do not view this particular case as a precedent for - # including WebCore headers in DumpRenderTree project. - '<(source_dir)/WebCore/testing/v8', # for WebCoreTestSupport.h, needed to link in window.internals code. - ], - 'sources': [ - '<(source_dir)/WebKit/chromium/src/WebTestingSupport.cpp', - '<(source_dir)/WebKit/chromium/public/WebTestingSupport.h', - ], - }], - ], - }, - { - 'target_name': 'TestNetscapePlugIn', - 'type': 'loadable_module', - 'sources': [ '<@(test_plugin_files)' ], - 'dependencies': [ - '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi', - ], - 'include_dirs': [ - '<(chromium_src_dir)', - '<(tools_dir)/DumpRenderTree/TestNetscapePlugIn', - '<(tools_dir)/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders', - ], - 'conditions': [ - ['OS=="mac"', { - 'mac_bundle': 1, - 'product_extension': 'plugin', - 'link_settings': { - 'libraries': [ - '$(SDKROOT)/System/Library/Frameworks/Carbon.framework', - '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework', - '$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework', - ] - }, - 'xcode_settings': { - 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO', - 'INFOPLIST_FILE': '<(tools_dir)/DumpRenderTree/TestNetscapePlugIn/mac/Info.plist', - }, - }], - ['os_posix == 1 and OS != "mac"', { - 'cflags': [ - '-fvisibility=default', - ], - }], - ['OS=="win"', { - 'defines': [ - # This seems like a hack, but this is what Safari Win does. - 'snprintf=_snprintf', - ], - 'sources': [ - '<(tools_dir)/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.def', - '<(tools_dir)/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc', - ], - # The .rc file requires that the name of the dll is npTestNetscapePlugin.dll. - 'product_name': 'npTestNetscapePlugin', - }], - ], - }, - { - 'target_name': 'copy_TestNetscapePlugIn', - 'type': 'none', - 'dependencies': [ - 'TestNetscapePlugIn', - ], - 'conditions': [ - ['OS=="win"', { - 'copies': [{ - 'destination': '<(PRODUCT_DIR)/plugins', - 'files': ['<(PRODUCT_DIR)/npTestNetscapePlugIn.dll'], - }], - }], - ['OS=="mac"', { - 'dependencies': ['TestNetscapePlugIn'], - 'copies': [{ - 'destination': '<(PRODUCT_DIR)/plugins/', - 'files': ['<(PRODUCT_DIR)/TestNetscapePlugIn.plugin/'], - }], - }], - ['os_posix == 1 and OS != "mac"', { - 'copies': [{ - 'destination': '<(PRODUCT_DIR)/plugins', - 'files': ['<(PRODUCT_DIR)/libTestNetscapePlugIn.so'], - }], - }], - ], - }, - ], # targets - 'conditions': [ - ['OS=="win"', { - 'targets': [{ - 'target_name': 'LayoutTestHelper', - 'type': 'executable', - 'sources': ['<(tools_dir)/DumpRenderTree/chromium/LayoutTestHelperWin.cpp'], - }], - }], - ['OS=="mac"', { - 'targets': [{ - 'target_name': 'LayoutTestHelper', - 'type': 'executable', - 'sources': ['<(tools_dir)/DumpRenderTree/chromium/LayoutTestHelper.mm'], - 'link_settings': { - 'libraries': [ - '$(SDKROOT)/System/Library/Frameworks/AppKit.framework', - ], - }, - }], - }], - ['os_posix==1 and OS!="mac" and OS!="android" and gcc_version==46', { - 'target_defaults': { - # Disable warnings about c++0x compatibility, as some names (such - # as nullptr) conflict with upcoming c++0x types. - 'cflags_cc': ['-Wno-c++0x-compat'], - }, - }], - ], # conditions - }], - ], -} diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp index 2e59f8c1f..1dc295704 100644 --- a/Source/WebKit/chromium/WebKit.gyp +++ b/Source/WebKit/chromium/WebKit.gyp @@ -30,6 +30,7 @@ { 'includes': [ + 'WinPrecompile.gypi', '../../WebCore/WebCore.gypi', 'WebKit.gypi', 'features.gypi', @@ -187,6 +188,7 @@ 'public/WebInputElement.h', 'public/WebInputEvent.h', 'public/WebIntent.h', + 'public/WebIntentRequest.h', 'public/WebIntentServiceInfo.h', 'public/WebKit.h', 'public/WebLabelElement.h', @@ -243,7 +245,6 @@ 'public/WebSocket.h', 'public/WebSocketClient.h', 'public/WebSpeechInputController.h', - 'public/WebSpeechInputControllerMock.h', 'public/WebSpeechInputListener.h', 'public/WebSpeechInputResult.h', 'public/WebSpellCheckClient.h', @@ -266,7 +267,7 @@ 'public/WebViewClient.h', 'public/WebWidget.h', 'public/WebWidgetClient.h', - 'public/WebWorker.h', + 'public/WebWorkerInfo.h', 'public/WebWorkerRunLoop.h', 'public/android/WebInputEventFactory.h', 'public/android/WebSandboxSupport.h', @@ -325,6 +326,7 @@ 'public/platform/WebSocketStreamError.h', 'public/platform/WebSocketStreamHandle.h', 'public/platform/WebSocketStreamHandleClient.h', + 'public/platform/WebSolidColorLayer.h', 'public/platform/WebString.h', 'public/platform/WebThread.h', 'public/platform/WebThreadSafeData.h', @@ -443,6 +445,8 @@ 'src/NotificationPresenterImpl.h', 'src/NotificationPresenterImpl.cpp', 'src/painting/GraphicsContextBuilder.h', + 'src/painting/PaintAggregator.h', + 'src/painting/PaintAggregator.cpp', 'src/PageOverlay.cpp', 'src/PageOverlay.h', 'src/PageOverlayList.cpp', @@ -469,6 +473,7 @@ 'src/UserMediaClientImpl.cpp', 'src/WebTextCheckingCompletionImpl.h', 'src/WebTextCheckingCompletionImpl.cpp', + 'src/WebTextCheckingResult.cpp', 'src/VideoFrameChromiumImpl.cpp', 'src/VideoFrameChromiumImpl.h', 'src/WebAccessibilityObject.cpp', @@ -579,6 +584,7 @@ 'src/WebInputEventConversion.cpp', 'src/WebInputEventConversion.h', 'src/WebIntent.cpp', + 'src/WebIntentRequest.cpp', 'src/WebIntentServiceInfo.cpp', 'src/WebKit.cpp', 'src/WebLabelElement.cpp', @@ -635,8 +641,8 @@ 'src/WebSocket.cpp', 'src/WebSocketImpl.cpp', 'src/WebSocketImpl.h', - 'src/WebSpeechInputControllerMockImpl.cpp', - 'src/WebSpeechInputControllerMockImpl.h', + 'src/WebSolidColorLayer.cpp', + 'src/WebSolidColorLayerImpl.cpp', 'src/WebSpeechInputResult.cpp', 'src/WebStorageAreaImpl.cpp', 'src/WebStorageAreaImpl.h', @@ -662,6 +668,7 @@ 'src/WebWorkerBase.h', 'src/WebWorkerClientImpl.cpp', 'src/WebWorkerClientImpl.h', + 'src/WebWorkerInfo.cpp', 'src/WebWorkerRunLoop.cpp', 'src/WorkerAsyncFileSystemChromium.cpp', 'src/WorkerAsyncFileSystemChromium.h', @@ -728,7 +735,6 @@ # These tests depend on webkit_support and # functions defined only in !WEBKIT_IMPLEMENTATION. 'tests/AssociatedURLLoaderTest.cpp', - 'tests/CCLayerTreeHostTest.cpp', 'tests/FrameTestHelpers.cpp', 'tests/PopupMenuTest.cpp', 'tests/RenderTableCellTest.cpp', @@ -762,6 +768,12 @@ }, }], ], + }, { # else: inside_chromium_build==0 + 'direct_dependent_settings': { + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)/webkit', # in a chromium-inside-WebKit build, headers in the public WebKit API are copied beneath this directory so includes referencing third_party/WebKit work. + ], + }, }], ['use_x11 == 1', { 'dependencies': [ @@ -1145,429 +1157,5 @@ }, ], }], - # FIXME: Delete this whole block once chromium's build/common.gypi - # is setting this flag to 0 by default. See - # https://bugs.webkit.org/show_bug.cgi?id=68463. - ['build_webkit_exes_from_webkit_gyp==1', { - 'includes': [ - '../../../Tools/DumpRenderTree/DumpRenderTree.gypi', - '../../../Tools/TestWebKitAPI/TestWebKitAPI.gypi', - ], - 'targets': [ - { - 'target_name': 'webkit_unit_tests', - 'type': 'executable', - 'dependencies': [ - 'webkit', - '../../WebCore/WebCore.gyp/WebCore.gyp:webcore', - '<(chromium_src_dir)/testing/gtest.gyp:gtest', - '<(chromium_src_dir)/testing/gmock.gyp:gmock', - '<(chromium_src_dir)/base/base.gyp:base', - '<(chromium_src_dir)/base/base.gyp:base_i18n', - '<(chromium_src_dir)/base/base.gyp:test_support_base', - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support', - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_user_agent', - ], - 'sources': [ - 'tests/RunAllTests.cpp', - ], - 'include_dirs': [ - 'public', - 'src', - ], - 'conditions': [ - ['inside_chromium_build==1 and component=="shared_library"', { - 'defines': [ - 'WEBKIT_DLL_UNITTEST', - ], - }, { - 'sources': [ - '<@(webkit_unittest_files)', - ], - 'conditions': [ - ['toolkit_uses_gtk == 1', { - 'include_dirs': [ - 'public/gtk', - ], - 'variables': { - # FIXME: Enable warnings on other platforms. - 'chromium_code': 1, - }, - }], - ], - }], - ['inside_chromium_build==1 and OS=="win" and component!="shared_library"', { - 'configurations': { - 'Debug_Base': { - 'msvs_settings': { - 'VCLinkerTool': { - 'LinkIncremental': '<(msvs_large_module_debug_link_mode)', - }, - }, - }, - }, - }], - ], - }, - { - 'target_name': 'ImageDiff', - 'type': 'executable', - 'dependencies': [ - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support_gfx', - ], - 'include_dirs': [ - '../../JavaScriptCore', - '<(DEPTH)', - ], - 'sources': [ - '../../../Tools/DumpRenderTree/chromium/ImageDiff.cpp', - ], - 'conditions': [ - ['OS=="android"', { - 'toolsets': ['host'], - }], - ], - }, - { - 'target_name': 'DumpRenderTree', - 'type': 'executable', - 'mac_bundle': 1, - 'dependencies': [ - 'inspector_resources', - 'webkit', - '../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf_config', - '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl', - '<(chromium_src_dir)/third_party/icu/icu.gyp:icuuc', - '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8', - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:blob', - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support', - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_user_agent', - ], - 'include_dirs': [ - '<(chromium_src_dir)', - 'public', - '../../JavaScriptCore', - '../../JavaScriptCore/wtf', # wtf/text/*.h refers headers in wtf/ without wtf/. - '<(DEPTH)', - ], - 'defines': [ - # Technically not a unit test but require functions available only to - # unit tests. - 'UNIT_TEST', - ], - 'sources': [ - '<@(drt_files)', - ], - 'conditions': [ - ['OS=="win"', { - 'dependencies': [ - 'LayoutTestHelper', - '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:libEGL', - '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:libGLESv2', - ], - - 'resource_include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/webkit'], - 'sources': [ - '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc', - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.rc', - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc', - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.rc', - ], - 'conditions': [ - ['inside_chromium_build==1', { - 'configurations': { - 'Debug_Base': { - 'msvs_settings': { - 'VCLinkerTool': { - 'LinkIncremental': '<(msvs_large_module_debug_link_mode)', - }, - }, - }, - }, - }], - ], - 'copies': [{ - 'destination': '<(PRODUCT_DIR)', - 'files': ['<(ahem_path)'], - }], - },{ # OS!="win" - 'sources/': [ - ['exclude', 'Win\\.cpp$'], - ], - 'actions': [ - { - 'action_name': 'repack_locale', - 'variables': { - 'repack_path': '<(chromium_src_dir)/tools/grit/grit/format/repack.py', - 'pak_inputs': [ - '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.pak', - '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.pak', - ]}, - 'inputs': [ - '<(repack_path)', - '<@(pak_inputs)', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/repack/DumpRenderTree.pak', - ], - 'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'], - 'process_outputs_as_mac_bundle_resources': 1, - }, - ], # actions - }], - ['OS=="mac"', { - 'dependencies': [ - 'copy_mesa', - 'LayoutTestHelper', - ], - 'mac_bundle_resources': [ - '<(ahem_path)', - '../../../Tools/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf', - '../../../Tools/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf', - '../../../Tools/DumpRenderTree/fonts/WebKitWeightWatcher300.ttf', - '../../../Tools/DumpRenderTree/fonts/WebKitWeightWatcher400.ttf', - '../../../Tools/DumpRenderTree/fonts/WebKitWeightWatcher500.ttf', - '../../../Tools/DumpRenderTree/fonts/WebKitWeightWatcher600.ttf', - '../../../Tools/DumpRenderTree/fonts/WebKitWeightWatcher700.ttf', - '../../../Tools/DumpRenderTree/fonts/WebKitWeightWatcher800.ttf', - '../../../Tools/DumpRenderTree/fonts/WebKitWeightWatcher900.ttf', - '<(SHARED_INTERMEDIATE_DIR)/webkit/textAreaResizeCorner.png', - ], - },{ # OS!="mac" - 'sources/': [ - # .mm is already excluded by common.gypi - ['exclude', 'Mac\\.cpp$'], - ], - }], - ['use_x11 == 1', { - 'dependencies': [ - '<(chromium_src_dir)/build/linux/system.gyp:fontconfig', - ], - 'copies': [{ - 'destination': '<(PRODUCT_DIR)', - 'files': [ - '<(ahem_path)', - '../../../Tools/DumpRenderTree/chromium/fonts.conf', - '<(INTERMEDIATE_DIR)/repack/DumpRenderTree.pak', - ] - }], - 'variables': { - # FIXME: Enable warnings on other platforms. - 'chromium_code': 1, - }, - 'conditions': [ - ['linux_use_tcmalloc == 1', { - 'dependencies': [ - '<(chromium_src_dir)/base/allocator/allocator.gyp:allocator', - ], - }], - ], - },{ # use_x11 != 1 - 'sources/': [ - ['exclude', 'Linux\\.cpp$'] - ] - }], - ['toolkit_uses_gtk == 1', { - 'defines': [ - 'WTF_USE_GTK=1', - ], - 'dependencies': [ - '<(chromium_src_dir)/build/linux/system.gyp:gtk', - ], - 'include_dirs': [ - 'public/gtk', - ], - },{ # toolkit_uses_gtk != 1 - 'sources/': [ - ['exclude', 'Gtk\\.cpp$'] - ] - }], - ['OS=="android"', { - 'sources/': [ - ['include', 'chromium/TestShellLinux\\.cpp$'], - ], - 'dependencies': [ - 'ImageDiff#host', - ], - },{ # OS!="android" - 'dependencies': [ - 'ImageDiff', - 'copy_TestNetscapePlugIn', - '<(chromium_src_dir)/third_party/mesa/mesa.gyp:osmesa', - ], - }], - ['inside_chromium_build==1 and component=="shared_library"', { - 'sources': [ - 'src/ChromiumCurrentTime.cpp', - 'src/ChromiumThreading.cpp', - ], - 'include_dirs': [ - 'public', - ], - 'dependencies': [ - '../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf', - '../../WTF/WTF.gyp/WTF.gyp:newwtf', - ], - }], - ['inside_chromium_build==0', { - 'dependencies': [ - '<(chromium_src_dir)/webkit/support/setup_third_party.gyp:third_party_headers', - ] - }], - ['inside_chromium_build==0 or component!="shared_library"', { - 'dependencies': [ - '../../WebCore/WebCore.gyp/WebCore.gyp:webcore_test_support', - ], - 'include_dirs': [ - # WARNING: Do not view this particular case as a precedent for - # including WebCore headers in DumpRenderTree project. - '../../WebCore/testing/v8', # for WebCoreTestSupport.h, needed to link in window.internals code. - ], - 'sources': [ - 'src/WebTestingSupport.cpp', - 'public/WebTestingSupport.h', - ], - }], - ], - }, - { - 'target_name': 'TestNetscapePlugIn', - 'type': 'loadable_module', - 'sources': [ '<@(test_plugin_files)' ], - 'dependencies': [ - '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi', - ], - 'include_dirs': [ - '<(chromium_src_dir)', - '../../../Tools/DumpRenderTree/TestNetscapePlugIn', - '../../../Tools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders', - ], - 'conditions': [ - ['OS=="mac"', { - 'mac_bundle': 1, - 'product_extension': 'plugin', - 'link_settings': { - 'libraries': [ - '$(SDKROOT)/System/Library/Frameworks/Carbon.framework', - '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework', - '$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework', - ] - }, - 'xcode_settings': { - 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO', - 'INFOPLIST_FILE': '../../../Tools/DumpRenderTree/TestNetscapePlugIn/mac/Info.plist', - }, - }], - ['os_posix == 1 and OS != "mac"', { - 'cflags': [ - '-fvisibility=default', - ], - }], - ['OS=="android"', { - 'ldflags!': [ - '-nostdlib', - ], - }], - ['OS=="win"', { - 'defines': [ - # This seems like a hack, but this is what Safari Win does. - 'snprintf=_snprintf', - ], - 'sources': [ - '../../../Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.def', - '../../../Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc', - ], - # The .rc file requires that the name of the dll is npTestNetscapePlugin.dll. - 'product_name': 'npTestNetscapePlugin', - }], - ], - }, - { - 'target_name': 'copy_TestNetscapePlugIn', - 'type': 'none', - 'dependencies': [ - 'TestNetscapePlugIn', - ], - 'conditions': [ - ['OS=="win"', { - 'copies': [{ - 'destination': '<(PRODUCT_DIR)/plugins', - 'files': ['<(PRODUCT_DIR)/npTestNetscapePlugIn.dll'], - }], - }], - ['OS=="mac"', { - 'dependencies': ['TestNetscapePlugIn'], - 'copies': [{ - 'destination': '<(PRODUCT_DIR)/plugins/', - 'files': ['<(PRODUCT_DIR)/TestNetscapePlugIn.plugin/'], - }], - }], - ['os_posix == 1 and OS != "mac"', { - 'copies': [{ - 'destination': '<(PRODUCT_DIR)/plugins', - 'files': ['<(PRODUCT_DIR)/libTestNetscapePlugIn.so'], - }], - }], - ], - }, - { - 'target_name': 'TestWebKitAPI', - 'type': 'executable', - 'dependencies': [ - 'webkit', - '../../WebCore/WebCore.gyp/WebCore.gyp:webcore', - '<(chromium_src_dir)/base/base.gyp:test_support_base', - '<(chromium_src_dir)/testing/gtest.gyp:gtest', - '<(chromium_src_dir)/testing/gmock.gyp:gmock', - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support', - ], - 'include_dirs': [ - '../../../Tools/TestWebKitAPI', - # Needed by tests/RunAllTests.cpp, as well as ChromiumCurrentTime.cpp and - # ChromiumThreading.cpp in chromium shared library configuration. - 'public', - ], - 'sources': [ - # Reuse the same testing driver of Chromium's webkit_unit_tests. - 'tests/RunAllTests.cpp', - '<@(TestWebKitAPI_files)', - ], - 'conditions': [ - ['inside_chromium_build==1 and component=="shared_library"', { - 'sources': [ - # To satisfy linking of WTF::currentTime() etc. in shared library configuration, - # as the symbols are not exported from the DLLs. - 'src/ChromiumCurrentTime.cpp', - 'src/ChromiumThreading.cpp', - ], - }], - ], - }, - ], # targets - 'conditions': [ - ['OS=="win"', { - 'targets': [{ - 'target_name': 'LayoutTestHelper', - 'type': 'executable', - 'sources': ['../../../Tools/DumpRenderTree/chromium/LayoutTestHelperWin.cpp'], - }], - }], - ['OS=="mac"', { - 'targets': [{ - 'target_name': 'LayoutTestHelper', - 'type': 'executable', - 'sources': ['../../../Tools/DumpRenderTree/chromium/LayoutTestHelper.mm'], - 'link_settings': { - 'libraries': [ - '$(SDKROOT)/System/Library/Frameworks/AppKit.framework', - ], - }, - }], - }], - ], - }], ], # conditions } diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index ca8fb39d2..e15fbfcaa 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -60,13 +60,17 @@ 'tests/ArenaTestHelpers.h', 'tests/AssociatedURLLoaderTest.cpp', 'tests/Canvas2DLayerChromiumTest.cpp', + 'tests/CCActiveAnimationTest.cpp', 'tests/CCDamageTrackerTest.cpp', 'tests/CCDelayBasedTimeSourceTest.cpp', 'tests/CCFrameRateControllerTest.cpp', + 'tests/CCLayerAnimationControllerImplTest.cpp', 'tests/CCLayerImplTest.cpp', 'tests/CCLayerIteratorTest.cpp', 'tests/CCLayerQuadTest.cpp', 'tests/CCLayerSorterTest.cpp', + 'tests/CCLayerTestCommon.cpp', + 'tests/CCLayerTestCommon.h', 'tests/CCLayerTreeHostCommonTest.cpp', 'tests/CCLayerTreeHostImplTest.cpp', 'tests/CCLayerTreeHostTest.cpp', @@ -76,11 +80,14 @@ 'tests/CCSchedulerStateMachineTest.cpp', 'tests/CCSchedulerTestCommon.h', 'tests/CCSchedulerTest.cpp', + 'tests/CCSolidColorLayerImplTest.cpp', 'tests/CCTiledLayerImplTest.cpp', 'tests/CCThreadTaskTest.cpp', 'tests/CCTimerTest.cpp', + 'tests/ClipboardChromiumTest.cpp', 'tests/CompositorFakeGraphicsContext3D.h', 'tests/CompositorFakeWebGraphicsContext3D.h', + 'tests/FakeCCLayerTreeHostClient.h', 'tests/FakeGraphicsContext3DTest.cpp', 'tests/FakeWebGraphicsContext3D.h', 'tests/FloatQuadTest.cpp', @@ -93,6 +100,8 @@ 'tests/KeyboardTest.cpp', 'tests/KURLTest.cpp', 'tests/LayerChromiumTest.cpp', + 'tests/LayerTextureUpdaterTest.cpp', + 'tests/PaintAggregatorTest.cpp', 'tests/PODArenaTest.cpp', 'tests/PODIntervalTreeTest.cpp', 'tests/PODRedBlackTreeTest.cpp', @@ -119,6 +128,7 @@ 'webkit_unittest_files': [ 'tests/DragImageTest.cpp', 'tests/ImageLayerChromiumTest.cpp', + 'tests/PlatformContextSkiaTest.cpp', ], }], ['OS=="win"', { diff --git a/Source/WebKit/chromium/WebKitUnitTests.gyp b/Source/WebKit/chromium/WebKitUnitTests.gyp index eb7622436..5a98a8459 100644 --- a/Source/WebKit/chromium/WebKitUnitTests.gyp +++ b/Source/WebKit/chromium/WebKitUnitTests.gyp @@ -29,96 +29,90 @@ # { - # FIXME: Remove this conditional check once chromium's - # build/common.gypi is setting this flag to 0 by default. See - # https://bugs.webkit.org/show_bug.cgi?id=68463. - 'conditions': [ - ['build_webkit_exes_from_webkit_gyp==0', { - 'includes': [ - 'features.gypi', - 'WebKit.gypi', + 'includes': [ + 'features.gypi', + 'WebKit.gypi', + ], + 'variables': { + 'conditions': [ + # Location of the chromium src directory and target type is different + # if webkit is built inside chromium or as standalone project. + ['inside_chromium_build==0', { + # Webkit is being built outside of the full chromium project. + # e.g. via build-webkit --chromium + 'chromium_src_dir': '../../WebKit/chromium', + },{ + # WebKit is checked out in src/chromium/third_party/WebKit + 'chromium_src_dir': '../../../../..', + }], + ], + }, + 'targets': [ + { + 'target_name': 'webkit_unit_tests', + 'type': 'executable', + 'variables': { 'enable_wexit_time_destructors': 1, }, + 'msvs_guid': '7CEFE800-8403-418A-AD6A-2D52C6FC3EAD', + 'dependencies': [ + 'WebKit.gyp:webkit', + '../../WebCore/WebCore.gyp/WebCore.gyp:webcore', + '<(chromium_src_dir)/testing/gtest.gyp:gtest', + '<(chromium_src_dir)/testing/gmock.gyp:gmock', + '<(chromium_src_dir)/base/base.gyp:base', + '<(chromium_src_dir)/base/base.gyp:base_i18n', + '<(chromium_src_dir)/base/base.gyp:test_support_base', + '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support', + '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_user_agent', ], - 'variables': { - 'conditions': [ - # Location of the chromium src directory and target type is different - # if webkit is built inside chromium or as standalone project. - ['inside_chromium_build==0', { - # Webkit is being built outside of the full chromium project. - # e.g. via build-webkit --chromium - 'chromium_src_dir': '../../WebKit/chromium', - },{ - # WebKit is checked out in src/chromium/third_party/WebKit - 'chromium_src_dir': '../../../../..', - }], - ], - }, - 'targets': [ - { - 'target_name': 'webkit_unit_tests', - 'type': 'executable', - 'msvs_guid': '7CEFE800-8403-418A-AD6A-2D52C6FC3EAD', - 'dependencies': [ - 'WebKit.gyp:webkit', - '../../WebCore/WebCore.gyp/WebCore.gyp:webcore', - '<(chromium_src_dir)/testing/gtest.gyp:gtest', - '<(chromium_src_dir)/testing/gmock.gyp:gmock', - '<(chromium_src_dir)/base/base.gyp:base', - '<(chromium_src_dir)/base/base.gyp:base_i18n', - '<(chromium_src_dir)/base/base.gyp:test_support_base', - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support', - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_user_agent', + 'sources': [ + 'tests/RunAllTests.cpp', + ], + 'include_dirs': [ + 'public', + 'src', + ], + 'conditions': [ + ['inside_chromium_build==1 and component=="shared_library"', { + 'defines': [ + 'WEBKIT_DLL_UNITTEST', ], + }, { 'sources': [ - 'tests/RunAllTests.cpp', - ], - 'include_dirs': [ - 'public', - 'src', + '<@(webkit_unittest_files)', ], 'conditions': [ - ['inside_chromium_build==1 and component=="shared_library"', { - 'defines': [ - 'WEBKIT_DLL_UNITTEST', - ], - }, { - 'sources': [ - '<@(webkit_unittest_files)', - ], - 'conditions': [ - ['toolkit_uses_gtk == 1', { - 'include_dirs': [ - 'public/gtk', - ], - 'variables': { - # FIXME: Enable warnings on other platforms. - 'chromium_code': 1, - }, - }], + ['toolkit_uses_gtk == 1', { + 'include_dirs': [ + 'public/gtk', ], - }], - ['inside_chromium_build==1 and OS=="win" and component!="shared_library"', { - 'configurations': { - 'Debug_Base': { - 'msvs_settings': { - 'VCLinkerTool': { - 'LinkIncremental': '<(msvs_large_module_debug_link_mode)', - }, - }, - }, + 'variables': { + # FIXME: Enable warnings on other platforms. + 'chromium_code': 1, }, }], ], - } - ], # targets - 'conditions': [ - ['os_posix==1 and OS!="mac" and OS!="android" and gcc_version==46', { - 'target_defaults': { - # Disable warnings about c++0x compatibility, as some names (such - # as nullptr) conflict with upcoming c++0x types. - 'cflags_cc': ['-Wno-c++0x-compat'], + }], + ['inside_chromium_build==1 and OS=="win" and component!="shared_library"', { + 'configurations': { + 'Debug_Base': { + 'msvs_settings': { + 'VCLinkerTool': { + 'LinkIncremental': '<(msvs_large_module_debug_link_mode)', + }, + }, + }, }, }], ], + } + ], # targets + 'conditions': [ + ['os_posix==1 and OS!="mac" and OS!="android" and gcc_version==46', { + 'target_defaults': { + # Disable warnings about c++0x compatibility, as some names (such + # as nullptr) conflict with upcoming c++0x types. + 'cflags_cc': ['-Wno-c++0x-compat'], + }, }], ], } diff --git a/Source/WebKit/chromium/WinPrecompile.cpp b/Source/WebKit/chromium/WinPrecompile.cpp new file mode 100644 index 000000000..6482416ae --- /dev/null +++ b/Source/WebKit/chromium/WinPrecompile.cpp @@ -0,0 +1,35 @@ +/* + * 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. + */ + +/* + * Precompiled header generator for Windows builds. No include is needed + * in this file as the PCH include is forced via the "Forced Include File" + * flag in the projects generated by GYP. + */ diff --git a/Source/WebKit/chromium/WinPrecompile.gypi b/Source/WebKit/chromium/WinPrecompile.gypi new file mode 100644 index 000000000..fcb21f22a --- /dev/null +++ b/Source/WebKit/chromium/WinPrecompile.gypi @@ -0,0 +1,53 @@ +# 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 this file to make targets in your .gyp use the default precompiled +# header on Windows, when precompiled headers are turned on. + +{ + 'conditions': [ + ['OS=="win" and chromium_win_pch==1', { + 'variables': { + 'conditions': [ + # We need to calculate the path to the gyp directory differently depending on whether we are + # being built stand-alone (via build-webkit --chromium) or as part of the Chromium checkout. + ['inside_chromium_build==0', { + 'win_pch_dir': '<(DEPTH)/../../WebKit/chromium', + },{ + 'win_pch_dir': '<(DEPTH)/third_party/WebKit/Source/WebKit/chromium', + }], + ] + }, + 'target_defaults': { + 'msvs_precompiled_header': '<(win_pch_dir)/WinPrecompile.h', + 'msvs_precompiled_source': '<(win_pch_dir)/WinPrecompile.cpp', + 'sources': ['<(win_pch_dir)/WinPrecompile.cpp'], + } + }], + ], +} diff --git a/Source/WebKit/chromium/WinPrecompile.h b/Source/WebKit/chromium/WinPrecompile.h new file mode 100644 index 000000000..c30811c1f --- /dev/null +++ b/Source/WebKit/chromium/WinPrecompile.h @@ -0,0 +1,63 @@ +/* + * 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. + */ + +/* + * Precompiled header for WebKit when built on Windows using + * GYP-generated project files. Not used by other build + * configurations. + * + * Using precompiled headers speeds the build up significantly. On a + * fast machine (HP Z600, 12 GB of RAM), an ~18% decrease in full + * build time was measured. + */ + +#if defined(WinPrecompile_h_) +#error You shouldn't include the precompiled header file more than once. +#endif + +#define WinPrecompile_h_ + +#include <Windows.h> + +#include <errno.h> +#include <fcntl.h> +#include <limits.h> +#include <math.h> +#include <stdarg.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +#include <algorithm> +#include <limits> +#include <string> +#include <utility> diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index 9d2e06047..e7ef18f8d 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -81,6 +81,7 @@ 'ENABLE_REQUEST_ANIMATION_FRAME=1', 'ENABLE_RUBY=1', 'ENABLE_SANDBOX=1', + 'ENABLE_SHADOW_DOM=1', 'ENABLE_SHARED_WORKERS=1', 'ENABLE_SMOOTH_SCROLLING=1', 'ENABLE_SQL_DATABASE=1', diff --git a/Source/WebKit/chromium/gyp_webkit b/Source/WebKit/chromium/gyp_webkit index 0178c6bd2..2e73f4ea6 100755 --- a/Source/WebKit/chromium/gyp_webkit +++ b/Source/WebKit/chromium/gyp_webkit @@ -102,11 +102,12 @@ if __name__ == '__main__': if sys.platform not in ('darwin',): args.append('--no-circular-check') - # On linux, we want gyp to output a makefile (default is scons). - if (sys.platform.startswith('linux') or + generators = os.environ.get('GYP_GENERATORS', '') + if 'ninja' in generators: + args.extend([ '--toplevel-dir=../../..' ]) + elif (sys.platform.startswith('linux') or 'WEBKIT_ANDROID_BUILD' in os.environ or - (sys.platform == 'darwin' and - os.environ.get('GYP_GENERATORS', '').find('make') != -1)): + (sys.platform == 'darwin' and 'make' in generators)): args.extend(['-fmake', '--suffix=.chromium', '--toplevel-dir=../../..', @@ -119,7 +120,6 @@ if __name__ == '__main__': '-Dinside_chromium_build=0', '-Dv8_use_snapshot=false', '-Dmsvs_use_common_release=0', - '-Dbuild_webkit_exes_from_webkit_gyp=1', # WebKit doesn't use the chromium style checker. '-Dmake_clang_dir=Source/WebKit/chromium/third_party/llvm-build/Release+Asserts', @@ -129,7 +129,7 @@ if __name__ == '__main__': '--depth=./', # gyp file to execute. - 'WebKit.gyp']) + 'All.gyp']) print 'Updating webkit projects from gyp files...' sys.stdout.flush() diff --git a/Source/WebKit/chromium/public/WebAccessibilityObject.h b/Source/WebKit/chromium/public/WebAccessibilityObject.h index 9c67b7766..c52b830a9 100644 --- a/Source/WebKit/chromium/public/WebAccessibilityObject.h +++ b/Source/WebKit/chromium/public/WebAccessibilityObject.h @@ -164,6 +164,13 @@ public: WEBKIT_EXPORT unsigned cellRowIndex() const; WEBKIT_EXPORT unsigned cellRowSpan() const; + // Make this object visible by scrolling as many nested scrollable views as needed. + WEBKIT_EXPORT void scrollToMakeVisible() const; + // Same, but if the whole object can't be made visible, try for this subrect, in local coordinates. + WEBKIT_EXPORT void scrollToMakeVisibleWithSubFocus(const WebRect&) const; + // Scroll this object to a given point in global coordinates of the top-level window. + WEBKIT_EXPORT void scrollToGlobalPoint(const WebPoint&) const; + #if WEBKIT_IMPLEMENTATION WebAccessibilityObject(const WTF::PassRefPtr<WebCore::AccessibilityObject>&); WebAccessibilityObject& operator=(const WTF::PassRefPtr<WebCore::AccessibilityObject>&); diff --git a/Source/WebKit/chromium/public/WebWorker.h b/Source/WebKit/chromium/public/WebContentSecurityPolicy.h index c70a87361..cafd17aba 100644 --- a/Source/WebKit/chromium/public/WebWorker.h +++ b/Source/WebKit/chromium/public/WebContentSecurityPolicy.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,33 +28,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebWorker_h -#define WebWorker_h - -#include "WebMessagePortChannel.h" +#ifndef WebContentSecurityPolicy_h +#define WebContentSecurityPolicy_h namespace WebKit { -class WebString; -class WebURL; -class WebWorkerClient; - -// Provides an interface to the script execution context for a worker. -class WebWorker { -public: - // Instantiates a built-in WebWorker. - WEBKIT_EXPORT static WebWorker* create(WebWorkerClient*); - - virtual ~WebWorker() { } - virtual void startWorkerContext(const WebURL& scriptURL, - const WebString& userAgent, - const WebString& sourceCode) = 0; - virtual void terminateWorkerContext() = 0; - virtual void postMessageToWorkerContext( - const WebString&, - const WebMessagePortChannelArray&) = 0; - virtual void workerObjectDestroyed() = 0; - virtual void clientDestroyed() = 0; +enum WebContentSecurityPolicyType { + WebContentSecurityPolicyTypeReportOnly, + WebContentSecurityPolicyTypeEnforcePolicy }; } // namespace WebKit diff --git a/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h b/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h index acb5f9849..c09f514c1 100644 --- a/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h +++ b/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h @@ -49,6 +49,7 @@ public: virtual void requestUndockWindow() { } virtual void requestSetDockSide(const WebString& side) { } virtual void moveWindowBy(const WebFloatPoint&) { } + virtual void openInNewTab(const WebString& side) { } virtual void saveAs(const WebString& fileName, const WebString& content) { } protected: diff --git a/Source/WebKit/chromium/public/WebDeviceOrientation.h b/Source/WebKit/chromium/public/WebDeviceOrientation.h index 7e8aa7244..282dc7157 100644 --- a/Source/WebKit/chromium/public/WebDeviceOrientation.h +++ b/Source/WebKit/chromium/public/WebDeviceOrientation.h @@ -35,14 +35,16 @@ namespace WebKit { class WebDeviceOrientation { public: - WebDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) + WebDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma, bool canProvideAbsolute = false, bool absolute = false) : m_isNull(false), m_canProvideAlpha(canProvideAlpha), m_alpha(alpha), m_canProvideBeta(canProvideBeta), m_beta(beta), m_canProvideGamma(canProvideGamma), - m_gamma(gamma) + m_gamma(gamma), + m_canProvideAbsolute(canProvideAbsolute), + m_absolute(absolute) { } @@ -55,6 +57,8 @@ public: double beta() { return m_beta; } bool canProvideGamma() { return m_canProvideGamma; } double gamma() { return m_gamma; } + bool canProvideAbsolute() {return m_canProvideAbsolute; } + bool absolute() { return m_absolute; } #if WEBKIT_IMPLEMENTATION WebDeviceOrientation(const WTF::PassRefPtr<WebCore::DeviceOrientation>&); @@ -70,7 +74,9 @@ private: m_canProvideBeta(false), m_beta(0), m_canProvideGamma(false), - m_gamma(0) + m_gamma(0), + m_canProvideAbsolute(false), + m_absolute(false) { } @@ -81,6 +87,8 @@ private: double m_beta; bool m_canProvideGamma; double m_gamma; + bool m_canProvideAbsolute; + bool m_absolute; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/public/WebFrame.h b/Source/WebKit/chromium/public/WebFrame.h index 85bbda108..9574c490e 100644 --- a/Source/WebKit/chromium/public/WebFrame.h +++ b/Source/WebKit/chromium/public/WebFrame.h @@ -418,7 +418,7 @@ public: // Spell-checking support. virtual void enableContinuousSpellChecking(bool) = 0; virtual bool isContinuousSpellCheckingEnabled() const = 0; - + virtual void requestTextChecking(const WebElement&) = 0; // Selection ----------------------------------------------------------- diff --git a/Source/WebKit/chromium/public/WebFrameClient.h b/Source/WebKit/chromium/public/WebFrameClient.h index 94abe83fb..d0507e3d1 100644 --- a/Source/WebKit/chromium/public/WebFrameClient.h +++ b/Source/WebKit/chromium/public/WebFrameClient.h @@ -55,8 +55,9 @@ class WebDataSource; class WebDOMEvent; class WebFormElement; class WebFrame; -class WebIntentServiceInfo; class WebIntent; +class WebIntentRequest; +class WebIntentServiceInfo; class WebMediaPlayer; class WebMediaPlayerClient; class WebNode; @@ -83,9 +84,6 @@ public: virtual WebPlugin* createPlugin(WebFrame*, const WebPluginParams&) { return 0; } // May return null. - virtual WebWorker* createWorker(WebFrame*, WebSharedWorkerClient*) { return 0; } - - // May return null. virtual WebSharedWorker* createSharedWorker(WebFrame*, const WebURL&, const WebString&, unsigned long long) { return 0; } // May return null. @@ -383,9 +381,9 @@ public: // Register a service to handle Web Intents. virtual void registerIntentService(WebFrame*, const WebIntentServiceInfo&) { } - // Start a Web Intents activity. Replies to this request should be sent to - // the WebFrame starting the activity. - virtual void dispatchIntent(WebFrame*, const WebIntent&) { } + // Start a Web Intents activity. The callee uses the |WebIntentRequest| + // object to coordinate replies to the intent invocation. + virtual void dispatchIntent(WebFrame*, const WebIntentRequest&) { } // Messages ------------------------------------------------------ diff --git a/Source/WebKit/chromium/public/WebIDBKey.h b/Source/WebKit/chromium/public/WebIDBKey.h index e47971755..a78142345 100644 --- a/Source/WebKit/chromium/public/WebIDBKey.h +++ b/Source/WebKit/chromium/public/WebIDBKey.h @@ -49,6 +49,7 @@ public: WEBKIT_EXPORT static WebIDBKey createDate(double); WEBKIT_EXPORT static WebIDBKey createNumber(double); WEBKIT_EXPORT static WebIDBKey createInvalid(); + WEBKIT_EXPORT static WebIDBKey createNull(); WEBKIT_EXPORT static WebIDBKey createFromValueAndKeyPath(const WebSerializedScriptValue&, const WebIDBKeyPath&); WEBKIT_EXPORT static WebSerializedScriptValue injectIDBKeyIntoSerializedValue(const WebIDBKey&, const WebSerializedScriptValue&, const WebIDBKeyPath&); @@ -65,6 +66,7 @@ public: WEBKIT_EXPORT void assignDate(double); WEBKIT_EXPORT void assignNumber(double); WEBKIT_EXPORT void assignInvalid(); + WEBKIT_EXPORT void assignNull(); WEBKIT_EXPORT void reset(); enum Type { @@ -72,7 +74,8 @@ public: ArrayType, StringType, DateType, - NumberType + NumberType, + NullType, }; WEBKIT_EXPORT Type type() const; diff --git a/Source/WebKit/chromium/public/WebInputEvent.h b/Source/WebKit/chromium/public/WebInputEvent.h index 65bc87232..57b1f4b5c 100644 --- a/Source/WebKit/chromium/public/WebInputEvent.h +++ b/Source/WebKit/chromium/public/WebInputEvent.h @@ -107,6 +107,8 @@ public: GestureFlingStart, GestureFlingCancel, GestureTap, + GestureTapDown, + GestureDoubleTap, // WebTouchEvent TouchStart, @@ -304,11 +306,12 @@ class WebMouseWheelEvent : public WebMouseEvent { public: enum Phase { PhaseNone = 0, - PhaseBegan = 1 << 1, - PhaseStationary = 1 << 2, - PhaseChanged = 1 << 3, - PhaseEnded = 1 << 4, - PhaseCancelled = 1 << 5, + PhaseBegan = 1 << 0, + PhaseStationary = 1 << 1, + PhaseChanged = 1 << 2, + PhaseEnded = 1 << 3, + PhaseCancelled = 1 << 4, + PhaseMayBegin = 1 << 5, }; float deltaX; diff --git a/Source/WebKit/chromium/public/WebIntent.h b/Source/WebKit/chromium/public/WebIntent.h index 4ce0342b7..d01098fe5 100644 --- a/Source/WebKit/chromium/public/WebIntent.h +++ b/Source/WebKit/chromium/public/WebIntent.h @@ -32,8 +32,11 @@ #define WebIntent_h #include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" #include "platform/WebString.h" +namespace WebCore { class Intent; } + namespace WebKit { // Holds data passed through a Web Intents invocation call from the Javascript @@ -41,29 +44,30 @@ namespace WebKit { // See spec at http://www.chromium.org/developers/design-documents/webintentsapi class WebIntent { public: - ~WebIntent() { } + WebIntent() { } + WebIntent(const WebIntent& other) { assign(other); } + ~WebIntent() { reset(); } - WEBKIT_EXPORT WebString action() const; - WEBKIT_EXPORT void setAction(const WebString&); + WebIntent& operator=(const WebIntent& other) + { + assign(other); + return *this; + } + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT bool isNull() const; + WEBKIT_EXPORT bool equals(const WebIntent&) const; + WEBKIT_EXPORT void assign(const WebIntent&); + WEBKIT_EXPORT WebString action() const; WEBKIT_EXPORT WebString type() const; - WEBKIT_EXPORT void setType(const WebString&); - WEBKIT_EXPORT WebString data() const; - WEBKIT_EXPORT void setData(const WebString&); - - WEBKIT_EXPORT int identifier() const; - WEBKIT_EXPORT void setIdentifier(int); #if WEBKIT_IMPLEMENTATION - WebIntent(); + WebIntent(const WTF::PassRefPtr<WebCore::Intent>&); #endif private: - WebString m_action; - WebString m_type; - WebString m_data; - int m_identifier; + WebPrivatePtr<WebCore::Intent> m_private; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h b/Source/WebKit/chromium/public/WebIntentRequest.h index 05bfd52a8..7934f1327 100644 --- a/Source/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h +++ b/Source/WebKit/chromium/public/WebIntentRequest.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2011 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,52 +28,52 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebSpeechInputControllerMockImpl_h -#define WebSpeechInputControllerMockImpl_h +#ifndef WebIntentRequest_h +#define WebIntentRequest_h -#include "SpeechInputListener.h" -#include "WebSpeechInputControllerMock.h" -#include "WebSpeechInputListener.h" +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" #include "platform/WebString.h" -#include <wtf/OwnPtr.h> -#if ENABLE(INPUT_SPEECH) - -namespace WebCore { -class SpeechInputClientMock; -} +namespace WebCore { class IntentRequest; } namespace WebKit { -struct WebRect; +class WebIntent; +class WebSerializedScriptValue; -class WebSpeechInputControllerMockImpl : public WebCore::SpeechInputListener - , public WebSpeechInputControllerMock { +// Holds data passed through a Web Intents invocation call from the Javascript +// Intent object. +// See spec at http://www.chromium.org/developers/design-documents/webintentsapi +class WebIntentRequest { public: - WebSpeechInputControllerMockImpl(WebSpeechInputListener*); - virtual ~WebSpeechInputControllerMockImpl(); + WebIntentRequest() { } + WebIntentRequest(const WebIntentRequest& other) { assign(other); } + ~WebIntentRequest() { reset(); } + + WebIntentRequest& operator=(const WebIntentRequest& other) + { + assign(other); + return *this; + } + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT bool isNull() const; + WEBKIT_EXPORT bool equals(const WebIntentRequest&) const; + WEBKIT_EXPORT void assign(const WebIntentRequest&); - // WebCore::SpeechInputListener methods. - void didCompleteRecording(int requestId); - void didCompleteRecognition(int requestId); - void setRecognitionResult(int requestId, const WebCore::SpeechInputResultArray& result); + WEBKIT_EXPORT void postResult(const WebSerializedScriptValue&); + WEBKIT_EXPORT void postFailure(const WebSerializedScriptValue&); - // WebSpeechInputController methods. - bool startRecognition(int requestId, const WebRect& elementRect, const WebString& language, const WebString& grammar, const WebSecurityOrigin&); - void cancelRecognition(int requestId); - void stopRecording(int requestId); + WEBKIT_EXPORT WebIntent intent() const; - // WebSpeechInputControllerMock methods. - void addMockRecognitionResult(const WebString& result, double confidence, const WebString& language); - void clearResults(); +#if WEBKIT_IMPLEMENTATION + WebIntentRequest(const WTF::PassRefPtr<WebCore::IntentRequest>&); +#endif private: - OwnPtr<WebCore::SpeechInputClientMock> m_webcoreMock; - WebSpeechInputListener* m_listener; + WebPrivatePtr<WebCore::IntentRequest> m_private; }; } // namespace WebKit -#endif // ENABLE(INPUT_SPEECH) - -#endif // WebSpeechInputControllerMockImpl_h +#endif // WebIntentRequest_h diff --git a/Source/WebKit/chromium/public/WebIntentServiceInfo.h b/Source/WebKit/chromium/public/WebIntentServiceInfo.h index 5879be8aa..b296ca46e 100644 --- a/Source/WebKit/chromium/public/WebIntentServiceInfo.h +++ b/Source/WebKit/chromium/public/WebIntentServiceInfo.h @@ -67,6 +67,11 @@ public: WEBKIT_EXPORT WebString disposition() const; WEBKIT_EXPORT void setDisposition(const WebString&); +#if WEBKIT_IMPLEMENTATION + WebIntentServiceInfo(const WebString& action, const WebString& type, const WebURL& href, + const WebString& title, const WebString& disposition); +#endif + private: WebString m_action; WebString m_type; diff --git a/Source/WebKit/chromium/public/WebNode.h b/Source/WebKit/chromium/public/WebNode.h index 38be3b66f..d4ee874e9 100644 --- a/Source/WebKit/chromium/public/WebNode.h +++ b/Source/WebKit/chromium/public/WebNode.h @@ -42,6 +42,7 @@ class WebDOMEvent; class WebDOMEventListener; class WebDOMEventListenerPrivate; class WebDocument; +class WebElement; class WebFrame; class WebNodeList; @@ -109,6 +110,7 @@ public: WEBKIT_EXPORT bool dispatchEvent(const WebDOMEvent&); WEBKIT_EXPORT void simulateClick(); WEBKIT_EXPORT WebNodeList getElementsByTagName(const WebString&) const; + WEBKIT_EXPORT WebElement rootEditableElement() const; // Returns true if the node has a non-empty bounding box in layout. // This does not 100% guarantee the user can see it, but is pretty close. diff --git a/Source/WebKit/chromium/public/WebRuntimeFeatures.h b/Source/WebKit/chromium/public/WebRuntimeFeatures.h index 5fff989e5..7e29ab0db 100644 --- a/Source/WebKit/chromium/public/WebRuntimeFeatures.h +++ b/Source/WebKit/chromium/public/WebRuntimeFeatures.h @@ -121,6 +121,9 @@ public: WEBKIT_EXPORT static void enableGamepad(bool); WEBKIT_EXPORT static bool isGamepadEnabled(); + WEBKIT_EXPORT static void enableShadowDOM(bool); + WEBKIT_EXPORT static bool isShadowDOMEnabled(); + private: WebRuntimeFeatures(); }; diff --git a/Source/WebKit/chromium/public/WebScreenInfo.h b/Source/WebKit/chromium/public/WebScreenInfo.h index ac92e1667..bd885f424 100644 --- a/Source/WebKit/chromium/public/WebScreenInfo.h +++ b/Source/WebKit/chromium/public/WebScreenInfo.h @@ -69,16 +69,12 @@ struct WebScreenInfo { // some of the rectangle's coordinates may be negative values". WebRect availableRect; - // Measured in frames per second. 0 if the rate is unknown or not applicable. - double refreshRate; - WebScreenInfo() : horizontalDPI(0) , verticalDPI(0) , depth(0) , depthPerComponent(0) - , isMonochrome(false) - , refreshRate(0) { } + , isMonochrome(false) { } }; } // namespace WebKit diff --git a/Source/WebKit/chromium/public/WebSecurityPolicy.h b/Source/WebKit/chromium/public/WebSecurityPolicy.h index 4063f91cc..466d98684 100644 --- a/Source/WebKit/chromium/public/WebSecurityPolicy.h +++ b/Source/WebKit/chromium/public/WebSecurityPolicy.h @@ -61,6 +61,9 @@ public: // included by an HTTPS page. WEBKIT_EXPORT static void registerURLSchemeAsSecure(const WebString&); + // Registers a non-HTTP URL scheme which can be sent CORS requests. + WEBKIT_EXPORT static void registerURLSchemeAsCORSEnabled(const WebString&); + // Support for whitelisting access to origins beyond the same-origin policy. WEBKIT_EXPORT static void addOriginAccessWhitelistEntry( const WebURL& sourceOrigin, const WebString& destinationProtocol, diff --git a/Source/WebKit/chromium/public/WebSettings.h b/Source/WebKit/chromium/public/WebSettings.h index cce47e2e2..b5da4e6ba 100644 --- a/Source/WebKit/chromium/public/WebSettings.h +++ b/Source/WebKit/chromium/public/WebSettings.h @@ -85,6 +85,7 @@ public: virtual void setJavaScriptCanAccessClipboard(bool) = 0; virtual void setXSSAuditorEnabled(bool) = 0; virtual void setDNSPrefetchingEnabled(bool) = 0; + virtual void setFixedElementsLayoutRelativeToFrame(bool) = 0; virtual void setLocalStorageEnabled(bool) = 0; virtual void setEditableLinkBehaviorNeverLive() = 0; virtual void setFrameFlatteningEnabled(bool) = 0; @@ -114,11 +115,13 @@ public: virtual void setAcceleratedCompositingForPluginsEnabled(bool) = 0; virtual void setAcceleratedCompositingForAnimationEnabled(bool) = 0; virtual void setAccelerated2dCanvasEnabled(bool) = 0; + virtual void setDeferred2dCanvasEnabled(bool) = 0; virtual void setAcceleratedCompositingForFixedPositionEnabled(bool) = 0; virtual void setMinimumAccelerated2dCanvasSize(int) = 0; virtual void setAcceleratedFiltersEnabled(bool) = 0; virtual void setMemoryInfoEnabled(bool) = 0; virtual void setHyperlinkAuditingEnabled(bool) = 0; + virtual void setLayoutFallbackWidth(int) = 0; virtual void setAsynchronousSpellCheckingEnabled(bool) = 0; virtual void setUnifiedTextCheckerEnabled(bool) = 0; virtual void setCaretBrowsingEnabled(bool) = 0; diff --git a/Source/WebKit/chromium/public/WebSharedWorker.h b/Source/WebKit/chromium/public/WebSharedWorker.h index 447f7f486..f97ab9e4b 100644 --- a/Source/WebKit/chromium/public/WebSharedWorker.h +++ b/Source/WebKit/chromium/public/WebSharedWorker.h @@ -31,6 +31,7 @@ #ifndef WebSharedWorker_h #define WebSharedWorker_h +#include "WebContentSecurityPolicy.h" #include "platform/WebCommon.h" namespace WebCore { @@ -61,6 +62,8 @@ public: const WebString& name, const WebString& userAgent, const WebString& sourceCode, + const WebString& contentSecurityPolicy, + WebContentSecurityPolicyType, long long scriptResourceAppCacheID) = 0; class ConnectListener { diff --git a/Source/WebKit/chromium/public/WebSharedWorkerClient.h b/Source/WebKit/chromium/public/WebSharedWorkerClient.h index 01700c6c1..a085a3ea2 100644 --- a/Source/WebKit/chromium/public/WebSharedWorkerClient.h +++ b/Source/WebKit/chromium/public/WebSharedWorkerClient.h @@ -76,11 +76,6 @@ public: // is owned by the object implementing WebCommonWorkerClient. virtual WebNotificationPresenter* notificationPresenter() = 0; - // This can be called on any thread to create a nested WebWorker. - // WebSharedWorkers are not instantiated via this API - instead - // they are created via the WebSharedWorkerRepository. - virtual WebWorker* createWorker(WebSharedWorkerClient*) = 0; - // Called on the main webkit thread in the worker process during initialization. virtual WebApplicationCacheHost* createApplicationCacheHost(WebApplicationCacheHostClient*) = 0; diff --git a/Source/WebKit/chromium/public/WebSocket.h b/Source/WebKit/chromium/public/WebSocket.h index f00b7957a..c10c372ad 100644 --- a/Source/WebKit/chromium/public/WebSocket.h +++ b/Source/WebKit/chromium/public/WebSocket.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2011, 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 @@ -38,7 +38,7 @@ namespace WebCore { class WebSocketChannel; } namespace WebKit { -class WebData; +class WebArrayBuffer; class WebDocument; class WebString; class WebURL; @@ -60,13 +60,28 @@ public: CloseEventCodeMaximumUserDefined = 4999 }; + enum BinaryType { + BinaryTypeBlob = 0, + BinaryTypeArrayBuffer = 1 + }; + WEBKIT_EXPORT static WebSocket* create(const WebDocument&, WebSocketClient*); virtual ~WebSocket() { } + // These functions come from binaryType attribute of the WebSocket API + // specification. It specifies binary object type for receiving binary + // frames representation. Receiving text frames are always mapped to + // WebString type regardless of this attribute. + // Default type is BinaryTypeBlob. But currently it is not supported. + // Set BinaryTypeArrayBuffer here ahead of using binary communication. + // See also, The WebSocket API - http://www.w3.org/TR/websockets/ . + virtual BinaryType binaryType() const = 0; + virtual bool setBinaryType(BinaryType) = 0; + virtual void connect(const WebURL&, const WebString& protocol) = 0; virtual WebString subprotocol() = 0; - virtual bool sendText(const WebString& message) = 0; - virtual bool sendBinary(const WebData& binaryData) = 0; + virtual bool sendText(const WebString&) = 0; + virtual bool sendArrayBuffer(const WebArrayBuffer&) = 0; virtual unsigned long bufferedAmount() const = 0; virtual void close(int code, const WebString& reason) = 0; virtual void fail(const WebString& reason) = 0; diff --git a/Source/WebKit/chromium/public/WebSocketClient.h b/Source/WebKit/chromium/public/WebSocketClient.h index b3a856bd2..06670626a 100644 --- a/Source/WebKit/chromium/public/WebSocketClient.h +++ b/Source/WebKit/chromium/public/WebSocketClient.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2011, 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 @@ -32,10 +32,10 @@ #define WebSocketClient_h #include "platform/WebCommon.h" -#include "platform/WebData.h" namespace WebKit { +class WebArrayBuffer; class WebString; class WebSocketClient { @@ -48,7 +48,7 @@ public: virtual ~WebSocketClient() { } virtual void didConnect() { } virtual void didReceiveMessage(const WebString& message) { } - virtual void didReceiveBinaryData(const WebData& binaryData) { } + virtual void didReceiveArrayBuffer(const WebArrayBuffer& arrayBuffer) { } virtual void didReceiveMessageError() { } virtual void didUpdateBufferedAmount(unsigned long bufferedAmount) { } virtual void didStartClosingHandshake() { } diff --git a/Source/WebKit/chromium/public/WebSpeechInputResult.h b/Source/WebKit/chromium/public/WebSpeechInputResult.h index a316fd230..82eb74aaa 100644 --- a/Source/WebKit/chromium/public/WebSpeechInputResult.h +++ b/Source/WebKit/chromium/public/WebSpeechInputResult.h @@ -42,9 +42,14 @@ namespace WebKit { class WebSpeechInputResult { public: WebSpeechInputResult() { } + WebSpeechInputResult(const WebSpeechInputResult& other) { assign(other); } ~WebSpeechInputResult() { reset(); } - WEBKIT_EXPORT void set(const WebString& utterance, double confidence); + // FIXME: Remove this when Chromium has been updated. + void set(const WebString& utterance, double confidence) { assign(utterance, confidence); } + + WEBKIT_EXPORT void assign(const WebString& utterance, double confidence); + WEBKIT_EXPORT void assign(const WebSpeechInputResult& other); WEBKIT_EXPORT void reset(); #if WEBKIT_IMPLEMENTATION diff --git a/Source/WebKit/chromium/public/WebSpellCheckClient.h b/Source/WebKit/chromium/public/WebSpellCheckClient.h index 457bd13c9..3005f2490 100644 --- a/Source/WebKit/chromium/public/WebSpellCheckClient.h +++ b/Source/WebKit/chromium/public/WebSpellCheckClient.h @@ -31,6 +31,7 @@ #ifndef WebSpellCheckClient_h #define WebSpellCheckClient_h +#include "WebTextCheckingType.h" #include "platform/WebString.h" #include "platform/WebVector.h" @@ -38,6 +39,7 @@ namespace WebKit { class WebString; class WebTextCheckingCompletion; +struct WebTextCheckingResult; class WebSpellCheckClient { public: @@ -51,6 +53,13 @@ public: int& misspelledOffset, int& misspelledLength, WebVector<WebString>* optionalSuggestions) { } + + // The client should perform spell-checking on the given text. This function will + // enumerate all misspellings at once. + virtual void checkTextOfParagraph(const WebString&, + WebTextCheckingTypeMask mask, + WebVector<WebTextCheckingResult>* results) { } + // Requests asynchronous spelling and grammar checking, whose result should be // returned by passed completion object. virtual void requestCheckingOfText(const WebString&, WebTextCheckingCompletion*) { } diff --git a/Source/WebKit/chromium/public/WebTextCheckingResult.h b/Source/WebKit/chromium/public/WebTextCheckingResult.h index 010aa1abf..dfd0181e5 100644 --- a/Source/WebKit/chromium/public/WebTextCheckingResult.h +++ b/Source/WebKit/chromium/public/WebTextCheckingResult.h @@ -31,27 +31,66 @@ #ifndef WebTextCheckingResult_h #define WebTextCheckingResult_h +#include "WebTextCheckingType.h" #include "platform/WebCommon.h" +#include "platform/WebString.h" +#include "platform/WebVector.h" + +namespace WebCore { +struct TextCheckingResult; +} namespace WebKit { // A checked entry of text checking. struct WebTextCheckingResult { + // FIXME: Should be removed after we confirm Chromium does not use it. enum Error { ErrorSpelling = 1 << 0, ErrorGrammar = 1 << 1 }; - explicit WebTextCheckingResult(Error e = ErrorSpelling, int p = 0, int l = 0) - : error(e) + explicit WebTextCheckingResult(Error e = ErrorSpelling, int p = 0, int l = 0) + : type(WebTextCheckingTypeSpelling) + , error(e) , position(p) + , location(p) , length(l) { + if (e & ErrorSpelling) + type = WebTextCheckingTypeSpelling; + else if (e & ErrorGrammar) + type = WebTextCheckingTypeGrammar; + else + WEBKIT_ASSERT_NOT_REACHED(); + } + + WebTextCheckingResult(WebTextCheckingType type, int location, int length, const WebString& replacement = WebString()) + : type(type) + , error(ErrorSpelling) + , position(location) + , location(location) + , length(length) + , replacement(replacement) + { + if (type & WebTextCheckingTypeSpelling) + error = ErrorSpelling; + else if (type & WebTextCheckingTypeGrammar) + error = ErrorGrammar; + else + WEBKIT_ASSERT_NOT_REACHED(); } - Error error; - int position; +#if WEBKIT_IMPLEMENTATION + operator WebCore::TextCheckingResult() const; +#endif + + WebTextCheckingType type; + Error error; // FIXME: Should be removed after we confirm Chromium does not use it. + int position; // FIXME: Should be removed after we confirm Chromium does not use it. + int location; int length; + WebString replacement; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/public/WebSpeechInputControllerMock.h b/Source/WebKit/chromium/public/WebTextCheckingType.h index d4e543f02..b22139bcf 100644 --- a/Source/WebKit/chromium/public/WebSpeechInputControllerMock.h +++ b/Source/WebKit/chromium/public/WebTextCheckingType.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2011 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,27 +28,24 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebSpeechInputControllerMock_h -#define WebSpeechInputControllerMock_h - -#include "WebSpeechInputController.h" +#ifndef WebTextCheckingType_h +#define WebTextCheckingType_h namespace WebKit { -class WebString; -class WebSpeechInputListener; - -class WebSpeechInputControllerMock : public WebSpeechInputController { -public: - WEBKIT_EXPORT static WebSpeechInputControllerMock* create( - WebSpeechInputListener* listener); - virtual ~WebSpeechInputControllerMock() { } - - virtual void addMockRecognitionResult(const WebString& result, double confidence, const WebString& language) = 0; - - virtual void clearResults() = 0; +enum WebTextCheckingType { + WebTextCheckingTypeSpelling = 1 << 1, + WebTextCheckingTypeGrammar = 1 << 2, + WebTextCheckingTypeLink = 1 << 5, + WebTextCheckingTypeQuote = 1 << 6, + WebTextCheckingTypeDash = 1 << 7, + WebTextCheckingTypeReplacement = 1 << 8, + WebTextCheckingTypeCorrection = 1 << 9, + WebTextCheckingTypeShowCorrectionPanel = 1 << 10 }; +typedef unsigned WebTextCheckingTypeMask; + } // namespace WebKit #endif diff --git a/Source/WebKit/chromium/public/WebUserMediaClient.h b/Source/WebKit/chromium/public/WebUserMediaClient.h index a4b75e940..2998159ee 100644 --- a/Source/WebKit/chromium/public/WebUserMediaClient.h +++ b/Source/WebKit/chromium/public/WebUserMediaClient.h @@ -41,7 +41,11 @@ class WebUserMediaClient { public: virtual ~WebUserMediaClient() { } - virtual void requestUserMedia(const WebUserMediaRequest&, const WebVector<WebMediaStreamSource>&) = 0; + // DEPRECATED + virtual void requestUserMedia(const WebUserMediaRequest&, const WebVector<WebMediaStreamSource>&) { } + + virtual void requestUserMedia(const WebUserMediaRequest&, const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources) { } + virtual void cancelUserMediaRequest(const WebUserMediaRequest&) = 0; }; diff --git a/Source/WebKit/chromium/public/WebUserMediaRequest.h b/Source/WebKit/chromium/public/WebUserMediaRequest.h index ab88125d6..38fb1898b 100644 --- a/Source/WebKit/chromium/public/WebUserMediaRequest.h +++ b/Source/WebKit/chromium/public/WebUserMediaRequest.h @@ -68,7 +68,10 @@ public: WEBKIT_EXPORT bool cameraPreferenceEnvironment() const; WEBKIT_EXPORT WebSecurityOrigin securityOrigin() const; + // DEPRECATED WEBKIT_EXPORT void requestSucceeded(const WebVector<WebMediaStreamSource>&); + + WEBKIT_EXPORT void requestSucceeded(const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources); WEBKIT_EXPORT void requestFailed(); #if WEBKIT_IMPLEMENTATION diff --git a/Source/WebKit/chromium/public/WebView.h b/Source/WebKit/chromium/public/WebView.h index c72b6133c..ed853e23a 100644 --- a/Source/WebKit/chromium/public/WebView.h +++ b/Source/WebKit/chromium/public/WebView.h @@ -242,13 +242,6 @@ public: // Sets the ratio as computed by computeViewportAttributes. virtual void setDeviceScaleFactor(float) = 0; - // Indicates whether position:fixed elements should be laid out relative - // to the frame or relative to the page. - virtual bool shouldLayoutFixedElementsRelativeToFrame() const = 0; - - // Sets the relative layout of position:fixed elements. - virtual void setShouldLayoutFixedElementsRelativeToFrame(bool) = 0; - // Fixed Layout -------------------------------------------------------- diff --git a/Source/WebKit/chromium/public/WebViewClient.h b/Source/WebKit/chromium/public/WebViewClient.h index 5a4d4e8e4..1b42a48a8 100644 --- a/Source/WebKit/chromium/public/WebViewClient.h +++ b/Source/WebKit/chromium/public/WebViewClient.h @@ -42,6 +42,7 @@ #include "WebTextDirection.h" #include "WebWidgetClient.h" #include "platform/WebColor.h" +#include "platform/WebGraphicsContext3D.h" #include "platform/WebString.h" namespace WebKit { @@ -109,6 +110,12 @@ public: // Create a session storage namespace object associated with this WebView. virtual WebStorageNamespace* createSessionStorageNamespace(unsigned quota) { return 0; } + // Creates a graphics context associated with the client's WebView. + // renderDirectlyToWebView means whether the context should be setup to + // render directly to the WebView (e.g. compositor context), or to an + // offscreen surface (e.g. WebGL context). + virtual WebGraphicsContext3D* createGraphicsContext3D(const WebGraphicsContext3D::Attributes&, bool renderDirectlyToWebView) { return 0; } + // Misc ---------------------------------------------------------------- // A new message was added to the console. diff --git a/Source/WebKit/chromium/public/WebWidget.h b/Source/WebKit/chromium/public/WebWidget.h index 3f594f369..ca160a26e 100644 --- a/Source/WebKit/chromium/public/WebWidget.h +++ b/Source/WebKit/chromium/public/WebWidget.h @@ -44,6 +44,7 @@ namespace WebKit { class WebInputEvent; +class WebMouseEvent; class WebString; struct WebPoint; template <typename T> class WebVector; @@ -170,6 +171,22 @@ public: // to render its contents. virtual bool isAcceleratedCompositingActive() const { return false; } + // Calling WebWidgetClient::requestPointerLock() will result in one + // return call to didAcquirePointerLock() or didNotAcquirePointerLock(). + virtual void didAcquirePointerLock() { } + virtual void didNotAcquirePointerLock() { } + + // Pointer lock was held, but has been lost. This may be due to a + // request via WebWidgetClient::requestPointerUnlock(), or for other + // reasons such as the user exiting lock, window focus changing, etc. + virtual void didLosePointerLock() { } + + // Informs the WebWidget that the resizer rect changed. Happens for example + // on mac, when a widget appears below the WebWidget without changing the + // WebWidget's size (WebWidget::resize() automatically checks the resizer + // rect.) + virtual void didChangeWindowResizerRect() { } + protected: ~WebWidget() { } }; diff --git a/Source/WebKit/chromium/public/WebWidgetClient.h b/Source/WebKit/chromium/public/WebWidgetClient.h index e5b405dea..24cd9c6ac 100644 --- a/Source/WebKit/chromium/public/WebWidgetClient.h +++ b/Source/WebKit/chromium/public/WebWidgetClient.h @@ -126,6 +126,21 @@ public: // reset the input method by cancelling any ongoing composition. virtual void resetInputMethod() { } + // Requests to lock the mouse cursor. If true is returned, the success + // result will be asynchronously returned via a single call to + // WebWidget::didAcquirePointerLock() or + // WebWidget::didNotAcquirePointerLock(). + // If false, the request has been denied synchronously. + virtual bool requestPointerLock() { return false; } + + // Cause the pointer lock to be released. This may be called at any time, + // including when a lock is pending but not yet acquired. + // WebWidget::didLosePointerLock() is called when unlock is complete. + virtual void requestPointerUnlock() { } + + // Returns true iff the pointer is locked to this widget. + virtual bool isPointerLocked() { return false; } + protected: ~WebWidgetClient() { } }; diff --git a/Source/WebKit/chromium/public/WebWorkerInfo.h b/Source/WebKit/chromium/public/WebWorkerInfo.h new file mode 100644 index 000000000..24cfa8961 --- /dev/null +++ b/Source/WebKit/chromium/public/WebWorkerInfo.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebWorkerInfo_h +#define WebWorkerInfo_h + +#include "platform/WebCommon.h" + +namespace WebKit { + +class WebWorkerInfo { +public: + WEBKIT_EXPORT static unsigned dedicatedWorkerCount(); +}; + +} +#endif diff --git a/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h b/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h index 3811436c2..57f9d7985 100644 --- a/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h +++ b/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h @@ -118,6 +118,12 @@ public: virtual ~WebGraphicsContextLostCallback() { } }; + class WebGraphicsErrorMessageCallback { + public: + virtual void onErrorMessage(const WebString&, WGC3Dint) = 0; + virtual ~WebGraphicsErrorMessageCallback() { } + }; + class WebGraphicsSwapBuffersCompleteCallbackCHROMIUM { public: virtual void onSwapBuffersComplete() = 0; @@ -127,9 +133,8 @@ public: // This destructor needs to be public so that using classes can destroy instances if initialization fails. virtual ~WebGraphicsContext3D() {} - // Initializes the graphics context; should be the first operation performed - // on newly-constructed instances. Returns true on success. - virtual bool initialize(Attributes, WebView*, bool renderDirectlyToWebView) = 0; + // This function is deprecated and will be removed soon. + virtual bool initialize(Attributes, WebView*, bool renderDirectlyToWebView) { return false; } // Makes the OpenGL context current on the current thread. Returns true on // success. @@ -369,6 +374,7 @@ public: virtual void deleteTexture(WebGLId) = 0; virtual void setContextLostCallback(WebGraphicsContextLostCallback* callback) {} + virtual void setErrorMessageCallback(WebGraphicsErrorMessageCallback* callback) { } // GL_ARB_robustness // // This entry point must provide slightly different semantics than diff --git a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h index 6c0e74f12..0acc9eafa 100644 --- a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h +++ b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h @@ -36,6 +36,7 @@ #include "WebCommon.h" #include "WebData.h" #include "WebGamepads.h" +#include "WebGraphicsContext3D.h" #include "WebLocalizedString.h" #include "WebSerializedScriptValue.h" #include "WebString.h" @@ -313,10 +314,12 @@ public: // Callable from a background WebKit thread. virtual void callOnMainThread(void (*func)(void*), void* context) { } - // WebGL -------------------------------------------------------------- - - // May return null if WebGL is not supported. - // Returns newly allocated WebGraphicsContext3D instance. + // GPU ---------------------------------------------------------------- + // + // May return null if GPU is not supported. + // Returns newly allocated and initialized offscreen WebGraphicsContext3D instance. + virtual WebGraphicsContext3D* createOffscreenGraphicsContext3D(const WebGraphicsContext3D::Attributes&) { return 0; } + // Deprecated. virtual WebGraphicsContext3D* createGraphicsContext3D() { return 0; } // Audio -------------------------------------------------------------- diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h b/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h index 52c63d321..ff8bd19cb 100644 --- a/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h +++ b/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h @@ -42,15 +42,32 @@ class WebString; class WebMediaStreamDescriptor { public: WebMediaStreamDescriptor() { } + WebMediaStreamDescriptor(const WebMediaStreamDescriptor& other) { assign(other); } ~WebMediaStreamDescriptor() { reset(); } + WebMediaStreamDescriptor& operator=(const WebMediaStreamDescriptor& other) + { + assign(other); + return *this; + } + + WEBKIT_EXPORT void assign(const WebMediaStreamDescriptor&); + + // DEPRECATED WEBKIT_EXPORT void initialize(const WebString& label, const WebVector<WebMediaStreamSource>&); + + WEBKIT_EXPORT void initialize(const WebString& label, const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources); WEBKIT_EXPORT void reset(); bool isNull() const { return m_private.isNull(); } WEBKIT_EXPORT WebString label() const; + + // DEPRECATED WEBKIT_EXPORT void sources(WebVector<WebMediaStreamSource>&) const; + WEBKIT_EXPORT void audioSources(WebVector<WebMediaStreamSource>&) const; + WEBKIT_EXPORT void videoSources(WebVector<WebMediaStreamSource>&) const; + #if WEBKIT_IMPLEMENTATION WebMediaStreamDescriptor(const WTF::PassRefPtr<WebCore::MediaStreamDescriptor>&); operator WTF::PassRefPtr<WebCore::MediaStreamDescriptor>() const; diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamSource.h b/Source/WebKit/chromium/public/platform/WebMediaStreamSource.h index b65e996bd..142d59866 100644 --- a/Source/WebKit/chromium/public/platform/WebMediaStreamSource.h +++ b/Source/WebKit/chromium/public/platform/WebMediaStreamSource.h @@ -51,8 +51,17 @@ public: }; WebMediaStreamSource() { } + WebMediaStreamSource(const WebMediaStreamSource& other) { assign(other); } ~WebMediaStreamSource() { reset(); } + WebMediaStreamSource& operator=(const WebMediaStreamSource& other) + { + assign(other); + return *this; + } + + WEBKIT_EXPORT void assign(const WebMediaStreamSource&); + WEBKIT_EXPORT void initialize(const WebString& id, Type, const WebString& name); WEBKIT_EXPORT void reset(); bool isNull() const { return m_private.isNull(); } diff --git a/Source/WebKit/chromium/public/platform/WebSolidColorLayer.h b/Source/WebKit/chromium/public/platform/WebSolidColorLayer.h new file mode 100644 index 000000000..ad9123d96 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebSolidColorLayer.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSolidColorLayer_h +#define WebSolidColorLayer_h + +#include "WebCommon.h" +#include "WebFloatRect.h" +#include "WebLayer.h" + +namespace WebKit { +class WebSolidColorLayerImpl; + +class WebSolidColorLayer : public WebLayer { +public: + WEBKIT_EXPORT static WebSolidColorLayer create(); + WEBKIT_EXPORT void setBackgroundColor(const WebColor&); + +#if WEBKIT_IMPLEMENTATION + WebSolidColorLayer(const WTF::PassRefPtr<WebSolidColorLayerImpl>&); +#endif +}; + +} // namespace WebKit + +#endif // WebSolidColorLayer_h diff --git a/Source/WebKit/chromium/public/platform/WebThread.h b/Source/WebKit/chromium/public/platform/WebThread.h index a7b372fee..b54bee849 100644 --- a/Source/WebKit/chromium/public/platform/WebThread.h +++ b/Source/WebKit/chromium/public/platform/WebThread.h @@ -51,9 +51,19 @@ public: virtual void postTask(Task*) = 0; virtual void postDelayedTask(Task*, long long delayMs) = 0; + virtual void addTaskObserver(TaskObserver*) { } virtual void removeTaskObserver(TaskObserver*) { } + // enterRunLoop() processes tasks posted to this WebThread. This call does not return until some task calls exitRunLoop(). + // WebThread does not support nesting, meaning that once the run loop is entered for a given WebThread it is not valid to + // call enterRunLoop() again. + virtual void enterRunLoop() = 0; + + // exitRunLoop() runs tasks until there are no tasks available to run, then returns control to the caller of enterRunLoop(). + // Must be called when the WebThread is running. + virtual void exitRunLoop() = 0; + virtual ~WebThread() { } }; diff --git a/Source/WebKit/chromium/src/ApplicationCacheHost.cpp b/Source/WebKit/chromium/src/ApplicationCacheHost.cpp index 9042a1175..73f258b0c 100644 --- a/Source/WebKit/chromium/src/ApplicationCacheHost.cpp +++ b/Source/WebKit/chromium/src/ApplicationCacheHost.cpp @@ -295,6 +295,11 @@ bool ApplicationCacheHost::swapCache() return success; } +void ApplicationCacheHost::abort() +{ + // FIXME: See https://bugs.webkit.org/show_bug.cgi?id=76270 +} + bool ApplicationCacheHost::isApplicationCacheEnabled() { ASSERT(m_documentLoader->frame()); diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index 5a3af4301..a451b88a6 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -37,6 +37,7 @@ #include "AccessibilityObject.h" #include "ApplicationCacheHost.h" #include "AsyncFileSystem.h" +#include "ContentSecurityPolicy.h" #include "DocumentMarker.h" #include "EditorInsertAction.h" #include "ExceptionCode.h" @@ -60,6 +61,7 @@ #include "Settings.h" #include "StorageInfo.h" #include "TextAffinity.h" +#include "TextChecking.h" #include "TextControlInnerElements.h" #include "UserContentTypes.h" #include "UserScriptTypes.h" @@ -68,6 +70,7 @@ #include "WebAccessibilityNotification.h" #include "WebAccessibilityObject.h" #include "WebApplicationCacheHost.h" +#include "WebContentSecurityPolicy.h" #include "WebCursorInfo.h" #include "WebEditingAction.h" #include "WebFileError.h" @@ -89,6 +92,7 @@ #include "WebStorageQuotaType.h" #include "WebTextAffinity.h" #include "WebTextCaseSensitivity.h" +#include "WebTextCheckingType.h" #include "WebTextCheckingResult.h" #include "WebVideoFrame.h" #include "WebView.h" @@ -429,7 +433,6 @@ COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::NumberType, IDBKey::NumberType); #if ENABLE(FILE_SYSTEM) COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeTemporary, AsyncFileSystem::Temporary); COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypePersistent, AsyncFileSystem::Persistent); -COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeExternal, AsyncFileSystem::External); COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeUnknown, FileMetadata::TypeUnknown); COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeFile, FileMetadata::TypeFile); COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeDirectory, FileMetadata::TypeDirectory); @@ -454,6 +457,15 @@ COMPILE_ASSERT_MATCHING_ENUM(WebGeolocationError::ErrorPositionUnavailable, Geol COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingResult::ErrorSpelling, DocumentMarker::Spelling); COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingResult::ErrorGrammar, DocumentMarker::Grammar); +COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeSpelling, TextCheckingTypeSpelling); +COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeGrammar, TextCheckingTypeGrammar); +COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeLink, TextCheckingTypeLink); +COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeQuote, TextCheckingTypeQuote); +COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeDash, TextCheckingTypeDash); +COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeReplacement, TextCheckingTypeReplacement); +COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeCorrection, TextCheckingTypeCorrection); +COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeShowCorrectionPanel, TextCheckingTypeShowCorrectionPanel); + #if ENABLE(QUOTA) COMPILE_ASSERT_MATCHING_ENUM(WebStorageQuotaErrorNotSupported, NOT_SUPPORTED_ERR); COMPILE_ASSERT_MATCHING_ENUM(WebStorageQuotaErrorAbort, ABORT_ERR); @@ -494,3 +506,6 @@ COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyAlways, SecurityPolicy::ReferrerPo COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyDefault, SecurityPolicy::ReferrerPolicyDefault); COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyNever, SecurityPolicy::ReferrerPolicyNever); COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyOrigin, SecurityPolicy::ReferrerPolicyOrigin); + +COMPILE_ASSERT_MATCHING_ENUM(WebContentSecurityPolicyTypeReportOnly, ContentSecurityPolicy::ReportOnly); +COMPILE_ASSERT_MATCHING_ENUM(WebContentSecurityPolicyTypeEnforcePolicy, ContentSecurityPolicy::EnforcePolicy); diff --git a/Source/WebKit/chromium/src/AssociatedURLLoader.cpp b/Source/WebKit/chromium/src/AssociatedURLLoader.cpp index 6adeba746..c314411b4 100644 --- a/Source/WebKit/chromium/src/AssociatedURLLoader.cpp +++ b/Source/WebKit/chromium/src/AssociatedURLLoader.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010, 2011 Google Inc. All rights reserved. + * Copyright (C) 2010, 2011, 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 @@ -31,6 +31,7 @@ #include "config.h" #include "AssociatedURLLoader.h" +#include "CrossOriginAccessControl.h" #include "DocumentThreadableLoader.h" #include "DocumentThreadableLoaderClient.h" #include "HTTPValidation.h" @@ -45,9 +46,12 @@ #include "XMLHttpRequest.h" #include "platform/WebHTTPHeaderVisitor.h" #include "platform/WebKitPlatformSupport.h" +#include "platform/WebString.h" #include "platform/WebURLError.h" #include "platform/WebURLLoaderClient.h" #include "platform/WebURLRequest.h" +#include <wtf/HashSet.h> +#include <wtf/text/WTFString.h> using namespace WebCore; using namespace WTF; @@ -56,10 +60,10 @@ namespace WebKit { namespace { -class SafeHTTPHeaderValidator : public WebHTTPHeaderVisitor { - WTF_MAKE_NONCOPYABLE(SafeHTTPHeaderValidator); +class HTTPRequestHeaderValidator : public WebHTTPHeaderVisitor { + WTF_MAKE_NONCOPYABLE(HTTPRequestHeaderValidator); public: - SafeHTTPHeaderValidator() : m_isSafe(true) { } + HTTPRequestHeaderValidator() : m_isSafe(true) { } void visitHeader(const WebString& name, const WebString& value); bool isSafe() const { return m_isSafe; } @@ -68,11 +72,55 @@ private: bool m_isSafe; }; -void SafeHTTPHeaderValidator::visitHeader(const WebString& name, const WebString& value) +typedef HashSet<String, CaseFoldingHash> HTTPHeaderSet; + +void HTTPRequestHeaderValidator::visitHeader(const WebString& name, const WebString& value) { m_isSafe = m_isSafe && isValidHTTPToken(name) && XMLHttpRequest::isAllowedHTTPHeader(name) && isValidHTTPHeaderValue(value); } +class HTTPResponseHeaderValidator : public WebHTTPHeaderVisitor { + WTF_MAKE_NONCOPYABLE(HTTPResponseHeaderValidator); +public: + HTTPResponseHeaderValidator(bool usingAccessControl) : m_usingAccessControl(usingAccessControl) { } + + void visitHeader(const WebString& name, const WebString& value); + const HTTPHeaderSet& blockedHeaders(); + +private: + HTTPHeaderSet m_exposedHeaders; + HTTPHeaderSet m_blockedHeaders; + bool m_usingAccessControl; +}; + +void HTTPResponseHeaderValidator::visitHeader(const WebString& name, const WebString& value) +{ + String headerName(name); + if (m_usingAccessControl) { + if (equalIgnoringCase(headerName, "access-control-expose-header")) + parseAccessControlExposeHeadersAllowList(value, m_exposedHeaders); + else if (!isOnAccessControlResponseHeaderWhitelist(headerName)) + m_blockedHeaders.add(name); + } +} + +const HTTPHeaderSet& HTTPResponseHeaderValidator::blockedHeaders() +{ + // Remove exposed headers from the blocked set. + if (!m_exposedHeaders.isEmpty()) { + // Don't allow Set-Cookie headers to be exposed. + m_exposedHeaders.remove("set-cookie"); + m_exposedHeaders.remove("set-cookie2"); + // Block Access-Control-Expose-Header itself. It could be exposed later. + m_blockedHeaders.add("access-control-expose-header"); + HTTPHeaderSet::const_iterator end = m_exposedHeaders.end(); + for (HTTPHeaderSet::const_iterator it = m_exposedHeaders.begin(); it != end; ++it) + m_blockedHeaders.remove(*it); + } + + return m_blockedHeaders; +} + } // This class bridges the interface differences between WebCore and WebKit loader clients. @@ -80,7 +128,7 @@ void SafeHTTPHeaderValidator::visitHeader(const WebString& name, const WebString class AssociatedURLLoader::ClientAdapter : public DocumentThreadableLoaderClient { WTF_MAKE_NONCOPYABLE(ClientAdapter); public: - static PassOwnPtr<ClientAdapter> create(AssociatedURLLoader*, WebURLLoaderClient*, bool /*downloadToFile*/); + static PassOwnPtr<ClientAdapter> create(AssociatedURLLoader*, WebURLLoaderClient*, const WebURLLoaderOptions&); virtual void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/); virtual void willSendRequest(ResourceRequest& /*newRequest*/, const ResourceResponse& /*redirectResponse*/); @@ -105,30 +153,30 @@ public: void clearClient() { m_client = 0; } private: - ClientAdapter(AssociatedURLLoader*, WebURLLoaderClient*, bool /*downloadToFile*/); + ClientAdapter(AssociatedURLLoader*, WebURLLoaderClient*, const WebURLLoaderOptions&); void notifyError(Timer<ClientAdapter>*); AssociatedURLLoader* m_loader; WebURLLoaderClient* m_client; + WebURLLoaderOptions m_options; WebURLError m_error; Timer<ClientAdapter> m_errorTimer; - bool m_downloadToFile; bool m_enableErrorNotifications; bool m_didFail; }; -PassOwnPtr<AssociatedURLLoader::ClientAdapter> AssociatedURLLoader::ClientAdapter::create(AssociatedURLLoader* loader, WebURLLoaderClient* client, bool downloadToFile) +PassOwnPtr<AssociatedURLLoader::ClientAdapter> AssociatedURLLoader::ClientAdapter::create(AssociatedURLLoader* loader, WebURLLoaderClient* client, const WebURLLoaderOptions& options) { - return adoptPtr(new ClientAdapter(loader, client, downloadToFile)); + return adoptPtr(new ClientAdapter(loader, client, options)); } -AssociatedURLLoader::ClientAdapter::ClientAdapter(AssociatedURLLoader* loader, WebURLLoaderClient* client, bool downloadToFile) +AssociatedURLLoader::ClientAdapter::ClientAdapter(AssociatedURLLoader* loader, WebURLLoaderClient* client, const WebURLLoaderOptions& options) : m_loader(loader) , m_client(client) + , m_options(options) , m_errorTimer(this, &ClientAdapter::notifyError) - , m_downloadToFile(downloadToFile) , m_enableErrorNotifications(false) , m_didFail(false) { @@ -156,8 +204,19 @@ void AssociatedURLLoader::ClientAdapter::didSendData(unsigned long long bytesSen void AssociatedURLLoader::ClientAdapter::didReceiveResponse(unsigned long, const ResourceResponse& response) { - WrappedResourceResponse wrappedResponse(response); - m_client->didReceiveResponse(m_loader, wrappedResponse); + // Try to use the original ResourceResponse if possible. + WebURLResponse validatedResponse = WrappedResourceResponse(response); + HTTPResponseHeaderValidator validator(m_options.crossOriginRequestPolicy == WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl); + validatedResponse.visitHTTPHeaderFields(&validator); + // If there are blocked headers, copy the response so we can remove them. + const HTTPHeaderSet& blockedHeaders = validator.blockedHeaders(); + if (!blockedHeaders.isEmpty()) { + validatedResponse = WebURLResponse(validatedResponse); + HTTPHeaderSet::const_iterator end = blockedHeaders.end(); + for (HTTPHeaderSet::const_iterator it = blockedHeaders.begin(); it != end; ++it) + validatedResponse.clearHTTPHeaderField(*it); + } + m_client->didReceiveResponse(m_loader, validatedResponse); } void AssociatedURLLoader::ClientAdapter::didDownloadData(int dataLength) @@ -263,13 +322,13 @@ void AssociatedURLLoader::loadAsynchronously(const WebURLRequest& request, WebUR allowLoad = isValidHTTPToken(method) && XMLHttpRequest::isAllowedHTTPMethod(method); if (allowLoad) { newRequest.setHTTPMethod(XMLHttpRequest::uppercaseKnownHTTPMethod(method)); - SafeHTTPHeaderValidator validator; + HTTPRequestHeaderValidator validator; newRequest.visitHTTPHeaderFields(&validator); allowLoad = validator.isSafe(); } } - m_clientAdapter = ClientAdapter::create(this, m_client, request.downloadToFile()); + m_clientAdapter = ClientAdapter::create(this, m_client, m_options); if (allowLoad) { ThreadableLoaderOptions options; diff --git a/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp b/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp index c55c71b79..28712827d 100644 --- a/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp @@ -34,6 +34,7 @@ #include "AsyncFileSystemCallbacks.h" #include "AsyncFileWriterChromium.h" +#include "SecurityOrigin.h" #include "WebFileInfo.h" #include "WebFileSystemCallbacksImpl.h" #include "WebFileWriter.h" @@ -41,14 +42,58 @@ #include "platform/WebFileSystem.h" #include "platform/WebKitPlatformSupport.h" #include <wtf/text/CString.h> +#include <wtf/text/StringBuilder.h> namespace WebCore { +// ChromeOS-specific filesystem type. +const AsyncFileSystem::Type externalType = static_cast<AsyncFileSystem::Type>(WebKit::WebFileSystem::TypeExternal); +const char externalPathPrefix[] = "external"; +const size_t externalPathPrefixLength = sizeof(externalPathPrefix) - 1; + +// static bool AsyncFileSystem::isAvailable() { return true; } +// static +bool AsyncFileSystem::crackFileSystemURL(const KURL& url, AsyncFileSystem::Type& type, String& filePath) +{ + if (!url.protocolIs("filesystem")) + return false; + + KURL originURL(ParsedURLString, url.path()); + String path = decodeURLEscapeSequences(originURL.path()); + if (path.isEmpty() || path[0] != '/') + return false; + path = path.substring(1); + + if (path.startsWith(temporaryPathPrefix)) { + type = Temporary; + path = path.substring(temporaryPathPrefixLength); + } else if (path.startsWith(persistentPathPrefix)) { + type = Persistent; + path = path.substring(persistentPathPrefixLength); + } else if (path.startsWith(externalPathPrefix)) { + type = externalType; + path = path.substring(externalPathPrefixLength); + } else + return false; + + if (path.isEmpty() || path[0] != '/') + return false; + + filePath.swap(path); + return true; +} + +// static +bool AsyncFileSystem::isValidType(Type type) +{ + return type == Temporary || type == Persistent || type == static_cast<Type>(WebKit::WebFileSystem::TypeExternal); +} + AsyncFileSystemChromium::AsyncFileSystemChromium(AsyncFileSystem::Type type, const KURL& rootURL) : AsyncFileSystem(type) , m_webFileSystem(WebKit::webKitPlatformSupport()->fileSystem()) @@ -61,6 +106,28 @@ AsyncFileSystemChromium::~AsyncFileSystemChromium() { } +String AsyncFileSystemChromium::toURL(const String& originString, const String& fullPath) +{ + ASSERT(!originString.isEmpty()); + if (originString == "null") + return String(); + + if (type() == externalType) { + // For external filesystem originString could be different from what we have in m_filesystemRootURL. + StringBuilder result; + result.append("filesystem:"); + result.append(originString); + result.append("/"); + result.append(externalPathPrefix); + result.append(encodeWithURLEscapeSequences(fullPath)); + return result.toString(); + } + + // For regular types we can just call virtualPathToFileSystemURL which appends the fullPath to the m_filesystemRootURL that should look like 'filesystem:<origin>/<typePrefix>'. + ASSERT(SecurityOrigin::create(m_filesystemRootURL)->toString() == originString); + return virtualPathToFileSystemURL(fullPath); +} + void AsyncFileSystemChromium::move(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { m_webFileSystem->move(virtualPathToFileSystemURL(sourcePath), virtualPathToFileSystemURL(destinationPath), new WebKit::WebFileSystemCallbacksImpl(callbacks)); diff --git a/Source/WebKit/chromium/src/AsyncFileSystemChromium.h b/Source/WebKit/chromium/src/AsyncFileSystemChromium.h index 0c550b5e2..a8cbca276 100644 --- a/Source/WebKit/chromium/src/AsyncFileSystemChromium.h +++ b/Source/WebKit/chromium/src/AsyncFileSystemChromium.h @@ -54,6 +54,7 @@ public: virtual ~AsyncFileSystemChromium(); + virtual String toURL(const String& originString, const String& fullPath); virtual void move(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>); virtual void copy(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>); virtual void remove(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); @@ -66,7 +67,7 @@ public: virtual void readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); virtual void createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); -private: +protected: AsyncFileSystemChromium(AsyncFileSystem::Type, const KURL& rootURL); WebKit::WebFileSystem* m_webFileSystem; diff --git a/Source/WebKit/chromium/src/AudioDestinationChromium.cpp b/Source/WebKit/chromium/src/AudioDestinationChromium.cpp index e6ef7d10b..6c82385c8 100644 --- a/Source/WebKit/chromium/src/AudioDestinationChromium.cpp +++ b/Source/WebKit/chromium/src/AudioDestinationChromium.cpp @@ -160,8 +160,8 @@ void AudioDestinationChromium::FIFO::consume(AudioBus* destination, size_t frame size_t numberOfChannels = m_fifoAudioBus.numberOfChannels(); for (size_t channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex) { - float* destinationData = destination->channel(channelIndex)->data(); - float* sourceData = m_fifoAudioBus.channel(channelIndex)->data(); + float* destinationData = destination->channel(channelIndex)->mutableData(); + const float* sourceData = m_fifoAudioBus.channel(channelIndex)->data(); bool isCopyGood = ((m_readIndex < m_fifoLength) && (m_readIndex + part1Length) <= m_fifoLength @@ -219,8 +219,8 @@ void AudioDestinationChromium::FIFO::fillBuffer(size_t numberOfFrames) size_t numberOfChannels = m_fifoAudioBus.numberOfChannels(); for (size_t channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex) { - float* destination = m_fifoAudioBus.channel(channelIndex)->data(); - float* source = m_tempBus.channel(channelIndex)->data(); + float* destination = m_fifoAudioBus.channel(channelIndex)->mutableData(); + const float* source = m_tempBus.channel(channelIndex)->data(); bool isCopyGood = (part1Length <= m_providerSize && (part1Length + part2Length) <= m_providerSize diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index 5f2851bb5..fb07b4c10 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -773,7 +773,7 @@ void ChromeClientImpl::popupOpened(PopupContainer* popupContainer, // transparent to the WebView. m_webView->popupOpened(popupContainer); } - static_cast<WebPopupMenuImpl*>(webwidget)->Init(popupContainer, bounds); + static_cast<WebPopupMenuImpl*>(webwidget)->init(popupContainer, bounds); } void ChromeClientImpl::popupClosed(WebCore::PopupContainer* popupContainer) @@ -1018,4 +1018,21 @@ void ChromeClientImpl::numWheelEventHandlersChanged(unsigned numberOfWheelHandle m_webView->numberOfWheelEventHandlersChanged(numberOfWheelHandlers); } +#if ENABLE(POINTER_LOCK) +bool ChromeClientImpl::requestPointerLock() +{ + return m_webView->requestPointerLock(); +} + +void ChromeClientImpl::requestPointerUnlock() +{ + return m_webView->requestPointerUnlock(); +} + +bool ChromeClientImpl::isPointerLocked() +{ + return m_webView->isPointerLocked(); +} +#endif + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.h b/Source/WebKit/chromium/src/ChromeClientImpl.h index 2113ec1af..8fd2488d9 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.h +++ b/Source/WebKit/chromium/src/ChromeClientImpl.h @@ -205,6 +205,12 @@ public: virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const; virtual void numWheelEventHandlersChanged(unsigned); +#if ENABLE(POINTER_LOCK) + virtual bool requestPointerLock(); + virtual void requestPointerUnlock(); + virtual bool isPointerLocked(); +#endif + private: void getPopupMenuInfo(WebCore::PopupContainer*, WebPopupMenuInfo*); void setCursor(const WebCursorInfo&); diff --git a/Source/WebKit/chromium/src/EditorClientImpl.cpp b/Source/WebKit/chromium/src/EditorClientImpl.cpp index 5fa237852..04aa719ed 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.cpp +++ b/Source/WebKit/chromium/src/EditorClientImpl.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved. - * Copyright (C) 2010 Google, Inc. All rights reserved. + * Copyright (C) 2012 Google, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -57,6 +57,7 @@ #include "WebSpellCheckClient.h" #include "WebTextAffinity.h" #include "WebTextCheckingCompletionImpl.h" +#include "WebTextCheckingResult.h" #include "WebViewClient.h" #include "WebViewImpl.h" @@ -765,6 +766,22 @@ void EditorClientImpl::checkGrammarOfString(const UChar*, int length, *badGrammarLength = 0; } +void EditorClientImpl::checkTextOfParagraph(const UChar* text, int length, + TextCheckingTypeMask mask, + WTF::Vector<TextCheckingResult>& results) +{ + if (!m_webView->spellCheckClient()) + return; + + WebTextCheckingTypeMask webMask = static_cast<WebTextCheckingTypeMask>(mask); + WebVector<WebTextCheckingResult> webResults; + m_webView->spellCheckClient()->checkTextOfParagraph(WebString(text, length), webMask, &webResults); + + results.resize(webResults.size()); + for (size_t i = 0; i < webResults.size(); ++i) + results[i] = webResults[i]; +} + void EditorClientImpl::updateSpellingUIWithGrammarString(const String&, const GrammarDetail& detail) { diff --git a/Source/WebKit/chromium/src/EditorClientImpl.h b/Source/WebKit/chromium/src/EditorClientImpl.h index 233695f9f..2b577107c 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.h +++ b/Source/WebKit/chromium/src/EditorClientImpl.h @@ -99,6 +99,8 @@ public: virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength); virtual void checkGrammarOfString(const UChar*, int length, WTF::Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength); + virtual void checkTextOfParagraph(const UChar*, int length, WebCore::TextCheckingTypeMask checkingTypes, + WTF::Vector<WebCore::TextCheckingResult>& results); virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&); virtual void updateSpellingUIWithGrammarString(const WTF::String&, const WebCore::GrammarDetail&); virtual void updateSpellingUIWithMisspelledWord(const WTF::String&); diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp index 72e71b960..a85ccbd2e 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -47,6 +47,7 @@ #include "HTMLAppletElement.h" #include "HTMLFormElement.h" // needed by FormState.h #include "HTMLNames.h" +#include "IntentRequest.h" #include "MessageEvent.h" #include "MIMETypeRegistry.h" #include "MouseEvent.h" @@ -66,6 +67,7 @@ #include "WebFormElement.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" +#include "WebIntentRequest.h" #include "WebKit.h" #include "platform/WebKitPlatformSupport.h" #include <public/WebMimeRegistry.h> @@ -692,7 +694,7 @@ void FrameLoaderClientImpl::dispatchDidNavigateWithinPage() } bool isNewNavigation; - webView->didCommitLoad(&isNewNavigation); + webView->didCommitLoad(&isNewNavigation, true); if (m_webFrame->client()) m_webFrame->client()->didNavigateWithinPage(m_webFrame, isNewNavigation); @@ -804,7 +806,7 @@ void FrameLoaderClientImpl::dispatchDidCommitLoad() { WebViewImpl* webview = m_webFrame->viewImpl(); bool isNewNavigation; - webview->didCommitLoad(&isNewNavigation); + webview->didCommitLoad(&isNewNavigation, false); if (m_webFrame->client()) m_webFrame->client()->didCommitProvisionalLoad(m_webFrame, isNewNavigation); @@ -1629,4 +1631,11 @@ bool FrameLoaderClientImpl::willCheckAndDispatchMessageEvent( m_webFrame, WebSecurityOrigin(target), WebDOMMessageEvent(event)); } +#if ENABLE(WEB_INTENTS) +void FrameLoaderClientImpl::dispatchIntent(PassRefPtr<WebCore::IntentRequest> intentRequest) +{ + m_webFrame->client()->dispatchIntent(webFrame(), intentRequest); +} +#endif + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h index b1b85ba35..0bf935d6d 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -208,6 +208,10 @@ public: virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext(); virtual bool willCheckAndDispatchMessageEvent(WebCore::SecurityOrigin* target, WebCore::MessageEvent*) const; +#if ENABLE(WEB_INTENTS) + virtual void dispatchIntent(PassRefPtr<WebCore::IntentRequest>) OVERRIDE; +#endif + private: void makeDocumentView(); diff --git a/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp b/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp index beeb94b65..94958c94e 100644 --- a/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp +++ b/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp @@ -46,9 +46,10 @@ #include "ImageBuffer.h" #include "ImageData.h" #include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" +#include "WebViewClient.h" #include "WebViewImpl.h" #include "platform/WebGraphicsContext3D.h" +#include "platform/WebKitPlatformSupport.h" #include <stdio.h> #include <wtf/FastMalloc.h> @@ -151,14 +152,17 @@ PassRefPtr<GraphicsContext3D> createGraphicsContext(GraphicsContext3D::Attribute webAttributes.noExtensions = attrs.noExtensions; webAttributes.shareResources = attrs.shareResources; webAttributes.forUseOnAnotherThread = threadUsage == GraphicsContext3DPrivate::ForUseOnAnotherThread; - OwnPtr<WebKit::WebGraphicsContext3D> webContext = adoptPtr(WebKit::webKitPlatformSupport()->createGraphicsContext3D()); - if (!webContext) - return 0; Chrome* chrome = static_cast<Chrome*>(hostWindow); WebKit::WebViewImpl* webViewImpl = chrome ? static_cast<WebKit::WebViewImpl*>(chrome->client()->webView()) : 0; - - if (!webContext->initialize(webAttributes, webViewImpl, renderDirectlyToHostWindow)) + OwnPtr<WebKit::WebGraphicsContext3D> webContext; + if (!webViewImpl || !webViewImpl->client()) { + if (renderDirectlyToHostWindow) + return 0; + webContext = adoptPtr(WebKit::webKitPlatformSupport()->createOffscreenGraphicsContext3D(webAttributes)); + } else + webContext = adoptPtr(webViewImpl->client()->createGraphicsContext3D(webAttributes, renderDirectlyToHostWindow)); + if (!webContext) return 0; return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), attrs, hostWindow, renderStyle, threadUsage); @@ -210,7 +214,7 @@ GrContext* GraphicsContext3DPrivate::grContext() // Limit the number of textures we hold in the bitmap->texture cache. static const int maxTextureCacheCount = 512; // Limit the bytes allocated toward textures in the bitmap->texture cache. - static const size_t maxTextureCacheBytes = 50 * 1024 * 1024; + static const size_t maxTextureCacheBytes = 96 * 1024 * 1024; if (!m_grContext) { SkAutoTUnref<GrGLInterface> interface(m_impl->createGrGLInterface()); @@ -1032,6 +1036,7 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes, HostWindow*, GraphicsContext3D::~GraphicsContext3D() { m_private->setContextLostCallback(nullptr); + m_private->setErrorMessageCallback(nullptr); m_private->setSwapBuffersCompleteCallbackCHROMIUM(nullptr); } @@ -1268,6 +1273,7 @@ DELEGATE_TO_INTERNAL_1(synthesizeGLError, GC3Denum) DELEGATE_TO_INTERNAL_R(getExtensions, Extensions3D*) DELEGATE_TO_INTERNAL_1(setContextLostCallback, PassOwnPtr<GraphicsContext3D::ContextLostCallback>) +DELEGATE_TO_INTERNAL_1(setErrorMessageCallback, PassOwnPtr<GraphicsContext3D::ErrorMessageCallback>) class GraphicsContextLostCallbackAdapter : public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { public: @@ -1296,6 +1302,33 @@ void GraphicsContext3DPrivate::setContextLostCallback(PassOwnPtr<GraphicsContext m_impl->setContextLostCallback(m_contextLostCallbackAdapter.get()); } +class GraphicsErrorMessageCallbackAdapter : public WebKit::WebGraphicsContext3D::WebGraphicsErrorMessageCallback { +public: + virtual void onErrorMessage(const WebKit::WebString&, WebKit::WGC3Dint); + static PassOwnPtr<GraphicsErrorMessageCallbackAdapter> create(PassOwnPtr<GraphicsContext3D::ErrorMessageCallback>); + virtual ~GraphicsErrorMessageCallbackAdapter() { } +private: + GraphicsErrorMessageCallbackAdapter(PassOwnPtr<GraphicsContext3D::ErrorMessageCallback> cb) : m_errorMessageCallback(cb) { } + OwnPtr<GraphicsContext3D::ErrorMessageCallback> m_errorMessageCallback; +}; + +void GraphicsErrorMessageCallbackAdapter::onErrorMessage(const WebKit::WebString& message, WebKit::WGC3Dint id) +{ + if (m_errorMessageCallback) + m_errorMessageCallback->onErrorMessage(message, id); +} + +PassOwnPtr<GraphicsErrorMessageCallbackAdapter> GraphicsErrorMessageCallbackAdapter::create(PassOwnPtr<GraphicsContext3D::ErrorMessageCallback> cb) +{ + return adoptPtr(cb.get() ? new GraphicsErrorMessageCallbackAdapter(cb) : 0); +} + +void GraphicsContext3DPrivate::setErrorMessageCallback(PassOwnPtr<GraphicsContext3D::ErrorMessageCallback> cb) +{ + m_errorMessageCallbackAdapter = GraphicsErrorMessageCallbackAdapter::create(cb); + m_impl->setErrorMessageCallback(m_errorMessageCallbackAdapter.get()); +} + bool GraphicsContext3D::isGLES2Compliant() const { return m_private->isGLES2Compliant(); diff --git a/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h b/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h index 28079c313..f2d49a132 100644 --- a/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h +++ b/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h @@ -50,6 +50,7 @@ class DrawingBuffer; class Extensions3DChromium; class GraphicsContextLostCallbackAdapter; class GraphicsContext3DSwapBuffersCompleteCallbackAdapter; +class GraphicsErrorMessageCallbackAdapter; class GraphicsContext3DPrivate { public: @@ -273,6 +274,7 @@ public: void synthesizeGLError(GC3Denum error); void setContextLostCallback(PassOwnPtr<GraphicsContext3D::ContextLostCallback>); + void setErrorMessageCallback(PassOwnPtr<GraphicsContext3D::ErrorMessageCallback>); // Extensions3D support. Extensions3D* getExtensions(); @@ -321,6 +323,7 @@ private: OwnPtr<WebKit::WebGraphicsContext3D> m_impl; OwnPtr<Extensions3DChromium> m_extensions; OwnPtr<GraphicsContextLostCallbackAdapter> m_contextLostCallbackAdapter; + OwnPtr<GraphicsErrorMessageCallbackAdapter> m_errorMessageCallbackAdapter; OwnPtr<GraphicsContext3DSwapBuffersCompleteCallbackAdapter> m_swapBuffersCompleteCallbackAdapter; WebKit::WebViewImpl* m_webViewImpl; bool m_initializedAvailableExtensions; diff --git a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp index c22309b2a..80b711a56 100755 --- a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp @@ -47,6 +47,7 @@ #include "platform/WebVector.h" #include "WebViewImpl.h" #include "WebWorkerBase.h" +#include "WebWorkerClientImpl.h" #include "WorkerContext.h" #include "WorkerLoaderProxy.h" #include "WorkerScriptController.h" @@ -85,9 +86,91 @@ void IDBFactoryBackendProxy::getDatabaseNames(PassRefPtr<IDBCallbacks> callbacks m_webIDBFactory->getDatabaseNames(new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); } -bool IDBFactoryBackendProxy::allowIDBFromWorkerThread(WorkerContext*, const String&, const WebSecurityOrigin&) +static const char allowIndexedDBMode[] = "allowIndexedDBMode"; + +class AllowIndexedDBMainThreadBridge : public ThreadSafeRefCounted<AllowIndexedDBMainThreadBridge> { +public: + static PassRefPtr<AllowIndexedDBMainThreadBridge> create(WebWorkerClientImpl* webWorkerClientImpl, const String& mode, const String& name) + { + return adoptRef(new AllowIndexedDBMainThreadBridge(webWorkerClientImpl, mode, name)); + } + + // These methods are invoked on the worker context. + void cancel() + { + MutexLocker locker(m_mutex); + m_webWorkerClientImpl = 0; + } + + bool result() + { + return m_result; + } + + // This method is invoked on the main thread. + void signalCompleted(bool result, const String& mode) + { + MutexLocker locker(m_mutex); + if (m_webWorkerClientImpl) + m_webWorkerClientImpl->postTaskForModeToWorkerContext(createCallbackTask(&didComplete, this, result), mode); + } + +private: + AllowIndexedDBMainThreadBridge(WebWorkerClientImpl* webWorkerClientImpl, const String& mode, const String& name) + : m_result(false) + , m_webWorkerClientImpl(webWorkerClientImpl) + { + WebFrameImpl* webFrame = static_cast<WebFrameImpl*>(webWorkerClientImpl->view()->mainFrame()); + // webFrame is not deleted as long as the process is alive, relying on + // it to exist on the main thread should be ok. + WebWorkerBase::dispatchTaskToMainThread( + createCallbackTask(&allowIndexedDBTask, this, WebCore::AllowCrossThreadAccess(webFrame), name, mode)); + } + + static void allowIndexedDBTask(ScriptExecutionContext*, PassRefPtr<AllowIndexedDBMainThreadBridge> bridge, PassRefPtr<WebFrameImpl> prpWebFrame, const String& name, const String& mode) + { + RefPtr<WebFrameImpl> webFrame = prpWebFrame; + WebViewImpl* webView = webFrame->viewImpl(); + if (!webView) { + bridge->signalCompleted(false, mode); + return; + } + bool allowed = !webView->permissionClient() || webView->permissionClient()->allowIndexedDB(webFrame.get(), name, WebSecurityOrigin()); + bridge->signalCompleted(allowed, mode); + } + + static void didComplete(ScriptExecutionContext* context, PassRefPtr<AllowIndexedDBMainThreadBridge> bridge, bool result) + { + bridge->m_result = result; + } + + bool m_result; + Mutex m_mutex; + // WebWorkerClientImpl is never deleted as long as the renderer process + // is alive. We use it on the main thread to notify the worker thread that + // the permission result has been set. The underlying message proxy object + // is valid as long as the worker run loop hasn't returned + // MessageQueueTerminated, in which case we don't use the + // WebWorkerClientImpl. + WebWorkerClientImpl* m_webWorkerClientImpl; +}; + +bool IDBFactoryBackendProxy::allowIDBFromWorkerThread(WorkerContext* workerContext, const String& name, const WebSecurityOrigin&) { - return true; + WebWorkerClientImpl* webWorkerClientImpl = static_cast<WebWorkerClientImpl*>(&workerContext->thread()->workerLoaderProxy()); + WorkerRunLoop& runLoop = workerContext->thread()->runLoop(); + + String mode = allowIndexedDBMode; + mode.append(String::number(runLoop.createUniqueId())); + RefPtr<AllowIndexedDBMainThreadBridge> bridge = AllowIndexedDBMainThreadBridge::create(webWorkerClientImpl, mode, name); + + // Either the bridge returns, or the queue gets terminated. + if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated) { + bridge->cancel(); + return false; + } + + return bridge->result(); } void IDBFactoryBackendProxy::openFromWorker(const String& name, IDBCallbacks* callbacks, PassRefPtr<SecurityOrigin> prpOrigin, WorkerContext* context, const String& dataDir) diff --git a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp index 494822376..ee2e89a42 100644 --- a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp +++ b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp @@ -124,9 +124,9 @@ void InspectorFrontendClientImpl::changeAttachedWindowHeight(unsigned) // Do nothing; } -void InspectorFrontendClientImpl::saveAs(const String& fileName, const String& content) +void InspectorFrontendClientImpl::openInNewTab(const String& url) { - m_client->saveAs(fileName, content); + m_client->openInNewTab(url); } bool InspectorFrontendClientImpl::canSaveAs() @@ -134,6 +134,11 @@ bool InspectorFrontendClientImpl::canSaveAs() return true; } +void InspectorFrontendClientImpl::saveAs(const String& fileName, const String& content) +{ + m_client->saveAs(fileName, content); +} + void InspectorFrontendClientImpl::inspectedURLChanged(const String& url) { m_frontendPage->mainFrame()->document()->setTitle("Developer Tools - " + url); diff --git a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h index d8e9a3669..4f7a72b96 100644 --- a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h +++ b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h @@ -66,6 +66,9 @@ public: virtual void requestDetachWindow(); virtual void requestSetDockSide(const String&); virtual void changeAttachedWindowHeight(unsigned); + + virtual void openInNewTab(const String& url); + virtual bool canSaveAs(); virtual void saveAs(const WTF::String& fileName, const WTF::String& content); diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp index edf1da7a3..5f43a9ab3 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp @@ -45,6 +45,7 @@ NonCompositedContentHost::NonCompositedContentHost(PassOwnPtr<WebCore::LayerPain #endif m_graphicsLayer->setDrawsContent(true); m_graphicsLayer->platformLayer()->setIsNonCompositedContent(true); + m_graphicsLayer->platformLayer()->setBackgroundCoversViewport(true); m_graphicsLayer->platformLayer()->setOpaque(true); } @@ -77,6 +78,20 @@ void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer) ASSERT(scrollLayer()); } +static void reserveScrollbarLayers(WebCore::LayerChromium* layer, WebCore::LayerChromium* clipLayer) +{ + // Scrollbars and corners are known to be attached outside the root clip + // rect, so skip the clipLayer subtree. + if (layer == clipLayer) + return; + + for (size_t i = 0; i < layer->children().size(); ++i) + reserveScrollbarLayers(layer->children()[i].get(), clipLayer); + + if (layer->drawsContent()) + layer->setAlwaysReserveTextures(true); +} + void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float pageScale, int layerAdjustX) { if (!scrollLayer()) @@ -105,6 +120,12 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, if (m_graphicsLayer->pageScaleFactor() != pageScale) m_graphicsLayer->deviceOrPageScaleFactorChanged(); + + WebCore::LayerChromium* clipLayer = scrollLayer()->parent(); + WebCore::LayerChromium* rootLayer = clipLayer; + while (rootLayer->parent()) + rootLayer = rootLayer->parent(); + reserveScrollbarLayers(rootLayer, clipLayer); } WebCore::LayerChromium* NonCompositedContentHost::scrollLayer() @@ -150,12 +171,12 @@ void NonCompositedContentHost::setShowDebugBorders(bool showDebugBorders) m_graphicsLayer->updateDebugIndicators(); } -bool NonCompositedContentHost::showDebugBorders() const +bool NonCompositedContentHost::showDebugBorders(const WebCore::GraphicsLayer*) const { return m_showDebugBorders; } -bool NonCompositedContentHost::showRepaintCounter() const +bool NonCompositedContentHost::showRepaintCounter(const WebCore::GraphicsLayer*) const { return false; } diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.h b/Source/WebKit/chromium/src/NonCompositedContentHost.h index 2ae85b736..be9f509a2 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.h +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.h @@ -71,8 +71,8 @@ private: virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time); virtual void notifySyncRequired(const WebCore::GraphicsLayer*); virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect); - virtual bool showDebugBorders() const; - virtual bool showRepaintCounter() const; + virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const; + virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const; WebCore::LayerChromium* scrollLayer(); diff --git a/Source/WebKit/chromium/src/PageOverlay.cpp b/Source/WebKit/chromium/src/PageOverlay.cpp index 6bbb69581..5f16d29c2 100644 --- a/Source/WebKit/chromium/src/PageOverlay.cpp +++ b/Source/WebKit/chromium/src/PageOverlay.cpp @@ -98,12 +98,12 @@ public: return m_webViewImpl->pageScaleFactor(); } - virtual bool showDebugBorders() const + virtual bool showDebugBorders(const GraphicsLayer*) const { return m_webViewImpl->page()->settings()->showDebugBorders(); } - virtual bool showRepaintCounter() const + virtual bool showRepaintCounter(const GraphicsLayer*) const { return m_webViewImpl->page()->settings()->showRepaintCounter(); } diff --git a/Source/WebKit/chromium/src/PlatformSupport.cpp b/Source/WebKit/chromium/src/PlatformSupport.cpp index 24681ec96..7ed80bb24 100644 --- a/Source/WebKit/chromium/src/PlatformSupport.cpp +++ b/Source/WebKit/chromium/src/PlatformSupport.cpp @@ -1092,30 +1092,22 @@ bool PlatformSupport::screenIsMonochrome(Widget* widget) return client->screenInfo().isMonochrome; } -IntRect PlatformSupport::screenRect(Widget* widget) +IntRect PlatformSupport::screenRect(FrameView* frameView) { - WebWidgetClient* client = toWebWidgetClient(widget); + WebWidgetClient* client = toWebWidgetClient(frameView); if (!client) return IntRect(); return client->screenInfo().rect; } -IntRect PlatformSupport::screenAvailableRect(Widget* widget) +IntRect PlatformSupport::screenAvailableRect(FrameView* frameView) { - WebWidgetClient* client = toWebWidgetClient(widget); + WebWidgetClient* client = toWebWidgetClient(frameView); if (!client) return IntRect(); return client->screenInfo().availableRect; } -double PlatformSupport::screenRefreshRate(Widget* widget) -{ - WebWidgetClient* client = toWebWidgetClient(widget); - if (!client) - return 0; - return client->screenInfo().refreshRate; -} - bool PlatformSupport::popupsAllowed(NPP npp) { // FIXME: Give the embedder a way to control this. diff --git a/Source/WebKit/chromium/src/SharedWorkerRepository.cpp b/Source/WebKit/chromium/src/SharedWorkerRepository.cpp index 17f5dc210..e7aae4263 100644 --- a/Source/WebKit/chromium/src/SharedWorkerRepository.cpp +++ b/Source/WebKit/chromium/src/SharedWorkerRepository.cpp @@ -34,6 +34,7 @@ #include "SharedWorkerRepository.h" +#include "ContentSecurityPolicy.h" #include "Event.h" #include "EventNames.h" #include "ExceptionCode.h" @@ -42,13 +43,14 @@ #include "PlatformMessagePortChannel.h" #include "ScriptExecutionContext.h" #include "SharedWorker.h" +#include "WebContentSecurityPolicy.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" #include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" #include "WebMessagePortChannel.h" #include "WebSharedWorker.h" #include "WebSharedWorkerRepository.h" +#include "platform/WebKitPlatformSupport.h" #include "platform/WebString.h" #include "platform/WebURL.h" #include "WorkerScriptLoader.h" @@ -168,7 +170,10 @@ void SharedWorkerScriptLoader::notifyFinished() } else { InspectorInstrumentation::scriptImported(m_worker->scriptExecutionContext(), m_scriptLoader->identifier(), m_scriptLoader->script()); // Pass the script off to the worker, then send a connect event. - m_webWorker->startWorkerContext(m_url, m_name, m_worker->scriptExecutionContext()->userAgent(m_url), m_scriptLoader->script(), m_responseAppCacheID); + m_webWorker->startWorkerContext(m_url, m_name, m_worker->scriptExecutionContext()->userAgent(m_url), m_scriptLoader->script(), + m_worker->scriptExecutionContext()->contentSecurityPolicy()->policy(), + static_cast<WebKit::WebContentSecurityPolicyType>(m_worker->scriptExecutionContext()->contentSecurityPolicy()->headerType()), + m_responseAppCacheID); sendConnect(); } } diff --git a/Source/WebKit/chromium/src/UserMediaClientImpl.cpp b/Source/WebKit/chromium/src/UserMediaClientImpl.cpp index 67a7c34b9..9c0bf58e1 100644 --- a/Source/WebKit/chromium/src/UserMediaClientImpl.cpp +++ b/Source/WebKit/chromium/src/UserMediaClientImpl.cpp @@ -38,6 +38,7 @@ #include "WebViewClient.h" #include "WebViewImpl.h" #include "platform/WebMediaStreamSource.h" +#include <wtf/RefPtr.h> using namespace WebCore; @@ -52,10 +53,19 @@ void UserMediaClientImpl::pageDestroyed() { } -void UserMediaClientImpl::requestUserMedia(PassRefPtr<UserMediaRequest> request, const MediaStreamSourceVector& sources) +void UserMediaClientImpl::requestUserMedia(PassRefPtr<UserMediaRequest> prpRequest, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) { - if (m_client) - m_client->requestUserMedia(request, sources); + if (m_client) { + RefPtr<UserMediaRequest> request = prpRequest; + + // FIXME: Cleanup when the chromium code has switched to the split sources implementation. + MediaStreamSourceVector combinedSources; + combinedSources.append(audioSources); + combinedSources.append(videoSources); + m_client->requestUserMedia(PassRefPtr<UserMediaRequest>(request.get()), combinedSources); + + m_client->requestUserMedia(request.release(), audioSources, videoSources); + } } void UserMediaClientImpl::cancelUserMediaRequest(UserMediaRequest* request) diff --git a/Source/WebKit/chromium/src/UserMediaClientImpl.h b/Source/WebKit/chromium/src/UserMediaClientImpl.h index ef36a4818..f0871236b 100644 --- a/Source/WebKit/chromium/src/UserMediaClientImpl.h +++ b/Source/WebKit/chromium/src/UserMediaClientImpl.h @@ -50,7 +50,7 @@ public: // WebCore::UserMediaClient ---------------------------------------------- virtual void pageDestroyed(); - virtual void requestUserMedia(PassRefPtr<WebCore::UserMediaRequest>, const WebCore::MediaStreamSourceVector&); + virtual void requestUserMedia(PassRefPtr<WebCore::UserMediaRequest>, const WebCore::MediaStreamSourceVector&, const WebCore::MediaStreamSourceVector&); virtual void cancelUserMediaRequest(WebCore::UserMediaRequest*); private: diff --git a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp index 806bfd809..489347bf2 100644 --- a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp +++ b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp @@ -870,6 +870,24 @@ unsigned WebAccessibilityObject::cellRowSpan() const return rowRange.second; } +void WebAccessibilityObject::scrollToMakeVisible() const +{ + m_private->updateBackingStore(); + m_private->scrollToMakeVisible(); +} + +void WebAccessibilityObject::scrollToMakeVisibleWithSubFocus(const WebRect& subfocus) const +{ + m_private->updateBackingStore(); + m_private->scrollToMakeVisibleWithSubFocus(subfocus); +} + +void WebAccessibilityObject::scrollToGlobalPoint(const WebPoint& point) const +{ + m_private->updateBackingStore(); + m_private->scrollToGlobalPoint(point); +} + WebAccessibilityObject::WebAccessibilityObject(const WTF::PassRefPtr<WebCore::AccessibilityObject>& object) : m_private(object) { diff --git a/Source/WebKit/chromium/src/WebAudioBus.cpp b/Source/WebKit/chromium/src/WebAudioBus.cpp index 50e3814cc..cc447ba20 100644 --- a/Source/WebKit/chromium/src/WebAudioBus.cpp +++ b/Source/WebKit/chromium/src/WebAudioBus.cpp @@ -110,7 +110,7 @@ float* WebAudioBus::channelData(unsigned channelIndex) if (!m_private) return 0; ASSERT(channelIndex < numberOfChannels()); - return m_private->channel(channelIndex)->data(); + return m_private->channel(channelIndex)->mutableData(); #else ASSERT_NOT_REACHED(); return 0; diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp index ea083de56..4f64d5471 100644 --- a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp @@ -52,7 +52,7 @@ WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* contentClient) WebContentLayerImpl::~WebContentLayerImpl() { - setDelegate(0); + clearDelegate(); } void WebContentLayerImpl::setDrawsContent(bool drawsContent) diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.h b/Source/WebKit/chromium/src/WebContentLayerImpl.h index bc1e26008..51f344f7c 100644 --- a/Source/WebKit/chromium/src/WebContentLayerImpl.h +++ b/Source/WebKit/chromium/src/WebContentLayerImpl.h @@ -32,7 +32,7 @@ namespace WebKit { class WebContentLayerClient; -class WebContentLayerImpl : public WebCore::ContentLayerChromium, public WebCore::CCLayerDelegate { +class WebContentLayerImpl : public WebCore::ContentLayerChromium, public WebCore::ContentLayerDelegate { public: static PassRefPtr<WebContentLayerImpl> create(WebContentLayerClient* contentClient); @@ -41,6 +41,8 @@ public: protected: explicit WebContentLayerImpl(WebContentLayerClient* contentClient); virtual ~WebContentLayerImpl(); + + // ContentLayerDelegate implementation. virtual void paintContents(WebCore::GraphicsContext&, const WebCore::IntRect& clip); WebContentLayerClient* m_contentClient; diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index e821f0b1e..52eb37400 100644 --- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -227,7 +227,7 @@ void WebDevToolsAgentImpl::didNavigate() void WebDevToolsAgentImpl::didClearWindowObject(WebFrameImpl* webframe) { WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve(webframe->frame()); - if (proxy) + if (proxy && webframe->frame()->script()->canExecuteScripts(NotAboutToExecuteScript)) proxy->setContextDebugId(m_hostId); } diff --git a/Source/WebKit/chromium/src/WebDeviceOrientation.cpp b/Source/WebKit/chromium/src/WebDeviceOrientation.cpp index 47f6bd188..098cb425c 100644 --- a/Source/WebKit/chromium/src/WebDeviceOrientation.cpp +++ b/Source/WebKit/chromium/src/WebDeviceOrientation.cpp @@ -41,6 +41,8 @@ WebDeviceOrientation::WebDeviceOrientation(const PassRefPtr<WebCore::DeviceOrien m_beta = 0; m_canProvideGamma = false; m_gamma = 0; + m_canProvideAbsolute = false; + m_absolute = false; return; } @@ -51,6 +53,8 @@ WebDeviceOrientation::WebDeviceOrientation(const PassRefPtr<WebCore::DeviceOrien m_beta = orientation->beta(); m_canProvideGamma = orientation->canProvideGamma(); m_gamma = orientation->gamma(); + m_canProvideAbsolute = orientation->canProvideAbsolute(); + m_absolute = orientation->absolute(); } WebDeviceOrientation& WebDeviceOrientation::operator=(const PassRefPtr<WebCore::DeviceOrientation>& orientation) @@ -63,6 +67,8 @@ WebDeviceOrientation& WebDeviceOrientation::operator=(const PassRefPtr<WebCore:: m_beta = 0; m_canProvideGamma = false; m_gamma = 0; + m_canProvideAbsolute = false; + m_absolute = false; return *this; } @@ -73,6 +79,8 @@ WebDeviceOrientation& WebDeviceOrientation::operator=(const PassRefPtr<WebCore:: m_beta = orientation->beta(); m_canProvideGamma = orientation->canProvideGamma(); m_gamma = orientation->gamma(); + m_canProvideAbsolute = orientation->canProvideAbsolute(); + m_absolute = orientation->absolute(); return *this; } @@ -80,7 +88,7 @@ WebDeviceOrientation::operator PassRefPtr<WebCore::DeviceOrientation>() const { if (m_isNull) return 0; - return WebCore::DeviceOrientation::create(m_canProvideAlpha, m_alpha, m_canProvideBeta, m_beta, m_canProvideGamma, m_gamma); + return WebCore::DeviceOrientation::create(m_canProvideAlpha, m_alpha, m_canProvideBeta, m_beta, m_canProvideGamma, m_gamma, m_canProvideAbsolute, m_absolute); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp index 4d439fd43..ec6c29060 100644 --- a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp @@ -39,7 +39,7 @@ PassRefPtr<WebExternalTextureLayerImpl> WebExternalTextureLayerImpl::create() } WebExternalTextureLayerImpl::WebExternalTextureLayerImpl() - : PluginLayerChromium(this) + : PluginLayerChromium() { setFlipped(false); setIsDrawable(true); @@ -47,7 +47,6 @@ WebExternalTextureLayerImpl::WebExternalTextureLayerImpl() WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl() { - setDelegate(0); } bool WebExternalTextureLayerImpl::drawsContent() const @@ -55,8 +54,4 @@ bool WebExternalTextureLayerImpl::drawsContent() const return !!textureId() && LayerChromium::drawsContent(); } -void WebExternalTextureLayerImpl::paintContents(GraphicsContext&, const IntRect&) -{ -} - } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h index 1ad2b8199..7b73e7080 100644 --- a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h +++ b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h @@ -31,14 +31,13 @@ namespace WebKit { -class WebExternalTextureLayerImpl : public WebCore::PluginLayerChromium, public WebCore::CCLayerDelegate { +class WebExternalTextureLayerImpl : public WebCore::PluginLayerChromium { public: static PassRefPtr<WebExternalTextureLayerImpl> create(); protected: WebExternalTextureLayerImpl(); virtual ~WebExternalTextureLayerImpl(); - virtual void paintContents(WebCore::GraphicsContext&, const WebCore::IntRect& clip); virtual bool drawsContent() const; }; diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index 2e8a328f8..2524cf45b 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -106,6 +106,7 @@ #include "IconURL.h" #include "InspectorController.h" #include "KURL.h" +#include "Node.h" #include "Page.h" #include "PageOverlay.h" #include "painting/GraphicsContextBuilder.h" @@ -133,6 +134,7 @@ #include "SecurityPolicy.h" #include "Settings.h" #include "SkiaUtils.h" +#include "SpellChecker.h" #include "SubstituteData.h" #include "TextAffinity.h" #include "TextIterator.h" @@ -858,9 +860,7 @@ void WebFrameImpl::addMessageToConsole(const WebConsoleMessage& message) return; } - frame()->domWindow()->console()->addMessage( - OtherMessageSource, LogMessageType, webCoreMessageLevel, message.text, - 1, String()); + frame()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, webCoreMessageLevel, message.text); } void WebFrameImpl::collectGarbage() @@ -1296,6 +1296,16 @@ bool WebFrameImpl::isContinuousSpellCheckingEnabled() const return frame()->editor()->isContinuousSpellCheckingEnabled(); } +void WebFrameImpl::requestTextChecking(const WebElement& webElem) +{ + if (webElem.isNull()) + return; + + RefPtr<Range> rangeToCheck = rangeOfContents(const_cast<Element*>(webElem.constUnwrap<Element>())); + + frame()->editor()->spellChecker()->requestCheckingFor(SpellCheckRequest::create(TextCheckingTypeSpelling | TextCheckingTypeGrammar, rangeToCheck, rangeToCheck)); +} + bool WebFrameImpl::hasSelection() const { WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame()); @@ -1374,7 +1384,7 @@ void WebFrameImpl::selectRange(const WebPoint& start, const WebPoint& end) VisiblePosition WebFrameImpl::visiblePositionForWindowPoint(const WebPoint& point) { - HitTestRequest::HitTestRequestType hitType = HitTestRequest::MouseMove; + HitTestRequest::HitTestRequestType hitType = HitTestRequest::Move; hitType |= HitTestRequest::ReadOnly; hitType |= HitTestRequest::Active; HitTestRequest request(hitType); @@ -2154,11 +2164,18 @@ void WebFrameImpl::setFindEndstateFocusAndSelection() // Try to find the first focusable node up the chain, which will, for // example, focus links if we have found text within the link. Node* node = m_activeMatch->firstNode(); + if (node && node->isInShadowTree()) { + Node* host = node->shadowAncestorNode(); + if (host->hasTagName(HTMLNames::inputTag) || host->hasTagName(HTMLNames::textareaTag)) + node = host; + } while (node && !node->isFocusable() && node != frame()->document()) node = node->parentNode(); if (node && node != frame()->document()) { - // Found a focusable parent node. Set focus to it. + // Found a focusable parent node. Set the active match as the + // selection and focus to the focusable node. + frame()->selection()->setSelection(m_activeMatch.get()); frame()->document()->setFocusedNode(node); return; } diff --git a/Source/WebKit/chromium/src/WebFrameImpl.h b/Source/WebKit/chromium/src/WebFrameImpl.h index 23e60d980..de38d0dca 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.h +++ b/Source/WebKit/chromium/src/WebFrameImpl.h @@ -158,6 +158,7 @@ public: virtual bool isCommandEnabled(const WebString&) const; virtual void enableContinuousSpellChecking(bool); virtual bool isContinuousSpellCheckingEnabled() const; + virtual void requestTextChecking(const WebElement&); virtual bool hasSelection() const; virtual WebRange selectionRange() const; virtual WebString selectionAsText() const; diff --git a/Source/WebKit/chromium/src/WebIDBKey.cpp b/Source/WebKit/chromium/src/WebIDBKey.cpp index 35be9f3b2..25be6c52f 100644 --- a/Source/WebKit/chromium/src/WebIDBKey.cpp +++ b/Source/WebKit/chromium/src/WebIDBKey.cpp @@ -76,10 +76,18 @@ WebIDBKey WebIDBKey::createInvalid() return key; } +WebIDBKey WebIDBKey::createNull() +{ + WebIDBKey key; + key.assignNull(); + return key; +} + WebIDBKey WebIDBKey::createFromValueAndKeyPath(const WebSerializedScriptValue& serializedScriptValue, const WebIDBKeyPath& idbKeyPath) { + // FIXME: If key path is empty string, this should return invalid key instead if (serializedScriptValue.isNull()) - return WebIDBKey::createInvalid(); + return WebIDBKey::createNull(); return createIDBKeyFromSerializedValueAndKeyPath(serializedScriptValue, idbKeyPath); } @@ -112,6 +120,7 @@ static PassRefPtr<IDBKey> convertFromWebIDBKeyArray(const WebVector<WebIDBKey>& keys.append(IDBKey::createNumber(array[i].number())); break; case WebIDBKey::InvalidType: + case WebIDBKey::NullType: ASSERT_NOT_REACHED(); break; } @@ -170,6 +179,11 @@ void WebIDBKey::assignNumber(double number) void WebIDBKey::assignInvalid() { + m_private = IDBKey::createInvalid(); +} + +void WebIDBKey::assignNull() +{ m_private = 0; } @@ -181,7 +195,7 @@ void WebIDBKey::reset() WebIDBKey::Type WebIDBKey::type() const { if (!m_private.get()) - return InvalidType; + return NullType; return Type(m_private->type()); } diff --git a/Source/WebKit/chromium/src/WebInputEventConversion.cpp b/Source/WebKit/chromium/src/WebInputEventConversion.cpp index 38d8a5502..ddd4736ab 100644 --- a/Source/WebKit/chromium/src/WebInputEventConversion.cpp +++ b/Source/WebKit/chromium/src/WebInputEventConversion.cpp @@ -149,6 +149,12 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W case WebInputEvent::GestureTap: m_type = PlatformEvent::GestureTap; break; + case WebInputEvent::GestureTapDown: + m_type = PlatformEvent::GestureTapDown; + break; + case WebInputEvent::GestureDoubleTap: + m_type = PlatformEvent::GestureDoubleTap; + break; default: ASSERT_NOT_REACHED(); } diff --git a/Source/WebKit/chromium/src/WebIntent.cpp b/Source/WebKit/chromium/src/WebIntent.cpp index 13540e162..77d766d76 100644 --- a/Source/WebKit/chromium/src/WebIntent.cpp +++ b/Source/WebKit/chromium/src/WebIntent.cpp @@ -31,48 +31,75 @@ #include "config.h" #include "WebIntent.h" -namespace WebKit { +#include "Intent.h" +#include "SerializedScriptValue.h" -WebIntent::WebIntent() { } +namespace WebKit { -WebString WebIntent::action() const +#if ENABLE(WEB_INTENTS) +WebIntent::WebIntent(const PassRefPtr<WebCore::Intent>& intent) + : m_private(intent) { - return m_action; } +#endif -void WebIntent::setAction(const WebString& action) +void WebIntent::reset() { - m_action = action; +#if ENABLE(WEB_INTENTS) + m_private.reset(); +#endif } -WebString WebIntent::type() const +bool WebIntent::isNull() const { - return m_type; +#if ENABLE(WEB_INTENTS) + return m_private.isNull(); +#else + return true; +#endif } -void WebIntent::setType(const WebString& type) +bool WebIntent::equals(const WebIntent& other) const { - m_type = type; +#if ENABLE(WEB_INTENTS) + return (m_private.get() == other.m_private.get()); +#else + return true; +#endif } -WebString WebIntent::data() const +void WebIntent::assign(const WebIntent& other) { - return m_data; +#if ENABLE(WEB_INTENTS) + m_private = other.m_private; +#endif } -void WebIntent::setData(const WebString& data) +WebString WebIntent::action() const { - m_data = data; +#if ENABLE(WEB_INTENTS) + return m_private->action(); +#else + return WebString(); +#endif } -int WebIntent::identifier() const +WebString WebIntent::type() const { - return m_identifier; +#if ENABLE(WEB_INTENTS) + return m_private->type(); +#else + return WebString(); +#endif } -void WebIntent::setIdentifier(int identifier) +WebString WebIntent::data() const { - m_identifier = identifier; +#if ENABLE(WEB_INTENTS) + return m_private->data()->toWireString(); +#else + return WebString(); +#endif } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebIntentRequest.cpp b/Source/WebKit/chromium/src/WebIntentRequest.cpp new file mode 100644 index 000000000..64d341217 --- /dev/null +++ b/Source/WebKit/chromium/src/WebIntentRequest.cpp @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * 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 "WebIntentRequest.h" + +#include "Intent.h" +#include "IntentRequest.h" +#include "SerializedScriptValue.h" +#include "WebIntent.h" +#include "platform/WebSerializedScriptValue.h" + +namespace WebKit { + +#if ENABLE(WEB_INTENTS) +WebIntentRequest::WebIntentRequest(const PassRefPtr<WebCore::IntentRequest>& intentRequest) + : m_private(intentRequest) +{ +} +#endif + +void WebIntentRequest::reset() +{ +#if ENABLE(WEB_INTENTS) + m_private.reset(); +#endif +} + +bool WebIntentRequest::isNull() const +{ +#if ENABLE(WEB_INTENTS) + return m_private.isNull(); +#else + return true; +#endif +} + +bool WebIntentRequest::equals(const WebIntentRequest& other) const +{ +#if ENABLE(WEB_INTENTS) + return (m_private.get() == other.m_private.get()); +#else + return true; +#endif +} + +void WebIntentRequest::assign(const WebIntentRequest& other) +{ +#if ENABLE(WEB_INTENTS) + m_private = other.m_private; +#endif +} + +WebIntent WebIntentRequest::intent() const +{ +#if ENABLE(WEB_INTENTS) + return WebIntent(m_private->intent()); +#else + return WebIntent(); +#endif +} + +void WebIntentRequest::postResult(const WebSerializedScriptValue& data) +{ +#if ENABLE(WEB_INTENTS) + m_private->postResult(PassRefPtr<WebCore::SerializedScriptValue>(data).get()); +#endif +} + +void WebIntentRequest::postFailure(const WebSerializedScriptValue& data) +{ +#if ENABLE(WEB_INTENTS) + m_private->postFailure(PassRefPtr<WebCore::SerializedScriptValue>(data).get()); +#endif +} + + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebIntentServiceInfo.cpp b/Source/WebKit/chromium/src/WebIntentServiceInfo.cpp index bd1983488..f08ab4885 100644 --- a/Source/WebKit/chromium/src/WebIntentServiceInfo.cpp +++ b/Source/WebKit/chromium/src/WebIntentServiceInfo.cpp @@ -83,4 +83,17 @@ void WebIntentServiceInfo::setDisposition(const WebString& disposition) m_disposition = disposition; } +WebIntentServiceInfo::WebIntentServiceInfo(const WebString& action, + const WebString& type, + const WebURL& href, + const WebString& title, + const WebString& disposition) + : m_action(action) + , m_type(type) + , m_href(href) + , m_title(title) + , m_disposition(disposition) +{ +} + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebLayerImpl.cpp b/Source/WebKit/chromium/src/WebLayerImpl.cpp index 07a162d64..13721be0c 100644 --- a/Source/WebKit/chromium/src/WebLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebLayerImpl.cpp @@ -36,7 +36,7 @@ PassRefPtr<WebLayerImpl> WebLayerImpl::create() } WebLayerImpl::WebLayerImpl() - : LayerChromium(this) + : LayerChromium() { // Make sure that this layer does not draw content. This way we don't have to override // the base class implementation of drawsContent(). @@ -45,7 +45,6 @@ WebLayerImpl::WebLayerImpl() WebLayerImpl::~WebLayerImpl() { - setDelegate(0); } void WebLayerImpl::paintContents(GraphicsContext&, const IntRect& clip) diff --git a/Source/WebKit/chromium/src/WebLayerImpl.h b/Source/WebKit/chromium/src/WebLayerImpl.h index 6bda83f54..3884c42bc 100644 --- a/Source/WebKit/chromium/src/WebLayerImpl.h +++ b/Source/WebKit/chromium/src/WebLayerImpl.h @@ -31,7 +31,7 @@ namespace WebKit { -class WebLayerImpl : public WebCore::LayerChromium, public WebCore::CCLayerDelegate { +class WebLayerImpl : public WebCore::LayerChromium { public: static PassRefPtr<WebLayerImpl> create(); diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index 891c31f3f..996e70710 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -120,7 +120,7 @@ void WebMediaPlayerClientImpl::readyStateChanged() m_mediaPlayer->readyStateChanged(); #if USE(ACCELERATED_COMPOSITING) if (hasVideo() && supportsAcceleratedRendering() && !m_videoLayer) { - m_videoLayer = VideoLayerChromium::create(0, this); + m_videoLayer = VideoLayerChromium::create(this); m_videoLayer->setOpaque(m_opaque); } #endif @@ -603,7 +603,7 @@ VideoFrameChromium* WebMediaPlayerClientImpl::getCurrentFrame() { MutexLocker locker(m_compositingMutex); ASSERT(!m_currentVideoFrame); - if (m_webMediaPlayer && !m_currentVideoFrame) { + if (m_webMediaPlayer) { WebVideoFrame* webkitVideoFrame = m_webMediaPlayer->getCurrentFrame(); if (webkitVideoFrame) m_currentVideoFrame = adoptPtr(new VideoFrameChromiumImpl(webkitVideoFrame)); @@ -614,14 +614,14 @@ VideoFrameChromium* WebMediaPlayerClientImpl::getCurrentFrame() void WebMediaPlayerClientImpl::putCurrentFrame(VideoFrameChromium* videoFrame) { MutexLocker locker(m_compositingMutex); - if (videoFrame && videoFrame == m_currentVideoFrame) { - if (m_webMediaPlayer) { - m_webMediaPlayer->putCurrentFrame( - VideoFrameChromiumImpl::toWebVideoFrame(videoFrame)); - } - ASSERT(videoFrame == m_currentVideoFrame); - m_currentVideoFrame.clear(); + ASSERT(videoFrame == m_currentVideoFrame); + if (!videoFrame) + return; + if (m_webMediaPlayer) { + m_webMediaPlayer->putCurrentFrame( + VideoFrameChromiumImpl::toWebVideoFrame(videoFrame)); } + m_currentVideoFrame.clear(); } #endif @@ -726,7 +726,7 @@ void WebMediaPlayerClientImpl::AudioSourceProviderImpl::provideInput(AudioBus* b size_t n = bus->numberOfChannels(); WebVector<float*> webAudioData(n); for (size_t i = 0; i < n; ++i) - webAudioData[i] = bus->channel(i)->data(); + webAudioData[i] = bus->channel(i)->mutableData(); m_webAudioSourceProvider->provideInput(webAudioData, framesToProcess); } diff --git a/Source/WebKit/chromium/src/WebMediaStreamDescriptor.cpp b/Source/WebKit/chromium/src/WebMediaStreamDescriptor.cpp index 0cf53c0eb..7daf329e5 100644 --- a/Source/WebKit/chromium/src/WebMediaStreamDescriptor.cpp +++ b/Source/WebKit/chromium/src/WebMediaStreamDescriptor.cpp @@ -60,12 +60,35 @@ WebString WebMediaStreamDescriptor::label() const return m_private->label(); } +// FIXME: Cleanup when the chromium code has switched to the split sources implementation. void WebMediaStreamDescriptor::sources(WebVector<WebMediaStreamSource>& webSources) const { - size_t numberOfSources = m_private->numberOfComponents(); + size_t numberOfAudioSources = m_private->numberOfAudioComponents(); + size_t numberOfVideoSources = m_private->numberOfVideoComponents(); + WebVector<WebMediaStreamSource> result(numberOfAudioSources + numberOfVideoSources); + size_t i = 0; + for (size_t j = 0; j < numberOfAudioSources; ++i, ++j) + result[i] = m_private->audioComponent(j)->source(); + for (size_t j = 0; j < numberOfVideoSources; ++i, ++j) + result[i] = m_private->videoComponent(j)->source(); + webSources.swap(result); +} + +void WebMediaStreamDescriptor::audioSources(WebVector<WebMediaStreamSource>& webSources) const +{ + size_t numberOfSources = m_private->numberOfAudioComponents(); + WebVector<WebMediaStreamSource> result(numberOfSources); + for (size_t i = 0; i < numberOfSources; ++i) + result[i] = m_private->audioComponent(i)->source(); + webSources.swap(result); +} + +void WebMediaStreamDescriptor::videoSources(WebVector<WebMediaStreamSource>& webSources) const +{ + size_t numberOfSources = m_private->numberOfVideoComponents(); WebVector<WebMediaStreamSource> result(numberOfSources); for (size_t i = 0; i < numberOfSources; ++i) - result[i] = m_private->component(i)->source(); + result[i] = m_private->videoComponent(i)->source(); webSources.swap(result); } @@ -85,14 +108,37 @@ WebMediaStreamDescriptor::operator WebCore::MediaStreamDescriptor*() const return m_private.get(); } +// FIXME: Cleanup when the chromium code has switched to the split sources implementation. void WebMediaStreamDescriptor::initialize(const WebString& label, const WebVector<WebMediaStreamSource>& sources) { - MediaStreamSourceVector s; + MediaStreamSourceVector audio, video; for (size_t i = 0; i < sources.size(); ++i) { MediaStreamSource* curr = sources[i]; - s.append(curr); + if (curr->type() == MediaStreamSource::TypeAudio) + audio.append(curr); + else if (curr->type() == MediaStreamSource::TypeVideo) + video.append(curr); + } + m_private = MediaStreamDescriptor::create(label, audio, video); +} + +void WebMediaStreamDescriptor::initialize(const WebString& label, const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources) +{ + MediaStreamSourceVector audio, video; + for (size_t i = 0; i < audioSources.size(); ++i) { + MediaStreamSource* curr = audioSources[i]; + audio.append(curr); } - m_private = MediaStreamDescriptor::create(label, s); + for (size_t i = 0; i < videoSources.size(); ++i) { + MediaStreamSource* curr = videoSources[i]; + video.append(curr); + } + m_private = MediaStreamDescriptor::create(label, audio, video); +} + +void WebMediaStreamDescriptor::assign(const WebMediaStreamDescriptor& other) +{ + m_private = other.m_private; } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebMediaStreamSource.cpp b/Source/WebKit/chromium/src/WebMediaStreamSource.cpp index fe826f18b..a9fac4b06 100644 --- a/Source/WebKit/chromium/src/WebMediaStreamSource.cpp +++ b/Source/WebKit/chromium/src/WebMediaStreamSource.cpp @@ -53,6 +53,11 @@ WebMediaStreamSource& WebMediaStreamSource::operator=(WebCore::MediaStreamSource return *this; } +void WebMediaStreamSource::assign(const WebMediaStreamSource& other) +{ + m_private = other.m_private; +} + void WebMediaStreamSource::reset() { m_private.reset(); diff --git a/Source/WebKit/chromium/src/WebNode.cpp b/Source/WebKit/chromium/src/WebNode.cpp index a4a26f2ee..69908c9b7 100644 --- a/Source/WebKit/chromium/src/WebNode.cpp +++ b/Source/WebKit/chromium/src/WebNode.cpp @@ -42,6 +42,7 @@ #include "WebDOMEvent.h" #include "WebDOMEventListener.h" #include "WebDocument.h" +#include "WebElement.h" #include "WebFrameImpl.h" #include "WebNodeList.h" #include "platform/WebString.h" @@ -207,6 +208,11 @@ WebNodeList WebNode::getElementsByTagName(const WebString& tag) const return WebNodeList(m_private->getElementsByTagName(tag)); } +WebElement WebNode::rootEditableElement() const +{ + return WebElement(m_private->rootEditableElement()); +} + bool WebNode::hasNonEmptyBoundingBox() const { return m_private->hasNonEmptyBoundingBox(); diff --git a/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp b/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp index fd2690a9f..da0e32555 100644 --- a/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp @@ -283,7 +283,7 @@ void WebPageSerializerImpl::encodeAndFlushBuffer( return; String content = m_dataBuffer.toString(); - m_dataBuffer = StringBuilder(); + m_dataBuffer.clear(); // Convert the unicode content to target encoding CString encodedContent = param->textEncoding.encode( @@ -307,7 +307,7 @@ void WebPageSerializerImpl::openTagToString(Element* element, // Add open tag result += "<" + element->nodeName().lower(); // Go through all attributes and serialize them. - const NamedNodeMap *attrMap = element->attributes(true); + const NamedNodeMap *attrMap = element->updatedAttributes(); if (attrMap) { unsigned numAttrs = attrMap->length(); for (unsigned i = 0; i < numAttrs; i++) { diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp index 95eca8891..a8f6d126b 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -537,7 +537,7 @@ WebPluginContainerImpl::WebPluginContainerImpl(WebCore::HTMLPlugInElement* eleme , m_element(element) , m_webPlugin(webPlugin) #if USE(ACCELERATED_COMPOSITING) - , m_platformLayer(PluginLayerChromium::create(0)) + , m_platformLayer(PluginLayerChromium::create()) #endif { } diff --git a/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp b/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp index 84c66a6d2..687b03360 100644 --- a/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp +++ b/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp @@ -32,25 +32,23 @@ #include "WebPopupMenuImpl.h" #include "Cursor.h" -#include "FramelessScrollView.h" #include "FrameView.h" +#include "FramelessScrollView.h" #include "IntRect.h" #include "NotImplemented.h" -#include "painting/GraphicsContextBuilder.h" #include "PlatformKeyboardEvent.h" #include "PlatformMouseEvent.h" #include "PlatformWheelEvent.h" #include "PopupContainer.h" #include "PopupMenuChromium.h" #include "SkiaUtils.h" - #include "WebInputEvent.h" #include "WebInputEventConversion.h" #include "WebRange.h" -#include "platform/WebRect.h" #include "WebViewClient.h" #include "WebWidgetClient.h" - +#include "painting/GraphicsContextBuilder.h" +#include "platform/WebRect.h" #include <skia/ext/platform_canvas.h> #if ENABLE(GESTURE_RECOGNIZER) @@ -79,7 +77,7 @@ WebPopupMenuImpl::WebPopupMenuImpl(WebWidgetClient* client) , m_gestureRecognizer(WebCore::PlatformGestureRecognizer::create()) #endif { - // set to impossible point so we always get the first mouse pos + // Set to impossible point so we always get the first mouse position. m_lastMousePosition = WebPoint(-1, -1); } @@ -89,20 +87,20 @@ WebPopupMenuImpl::~WebPopupMenuImpl() m_widget->setClient(0); } -void WebPopupMenuImpl::Init(FramelessScrollView* widget, const WebRect& bounds) +void WebPopupMenuImpl::init(FramelessScrollView* widget, const WebRect& bounds) { m_widget = widget; m_widget->setClient(this); if (m_client) { m_client->setWindowRect(bounds); - m_client->show(WebNavigationPolicy()); // Policy is ignored + m_client->show(WebNavigationPolicy()); // Policy is ignored. } } -void WebPopupMenuImpl::MouseMove(const WebMouseEvent& event) +void WebPopupMenuImpl::handleMouseMove(const WebMouseEvent& event) { - // don't send mouse move messages if the mouse hasn't moved. + // Don't send mouse move messages if the mouse hasn't moved. if (event.x != m_lastMousePosition.x || event.y != m_lastMousePosition.y) { m_lastMousePosition = WebPoint(event.x, event.y); m_widget->handleMouseMoveEvent(PlatformMouseEventBuilder(m_widget, event)); @@ -113,34 +111,34 @@ void WebPopupMenuImpl::MouseMove(const WebMouseEvent& event) } } -void WebPopupMenuImpl::MouseLeave(const WebMouseEvent& event) +void WebPopupMenuImpl::handleMouseLeave(const WebMouseEvent& event) { m_widget->handleMouseMoveEvent(PlatformMouseEventBuilder(m_widget, event)); } -void WebPopupMenuImpl::MouseDown(const WebMouseEvent& event) +void WebPopupMenuImpl::handleMouseDown(const WebMouseEvent& event) { m_widget->handleMouseDownEvent(PlatformMouseEventBuilder(m_widget, event)); } -void WebPopupMenuImpl::MouseUp(const WebMouseEvent& event) +void WebPopupMenuImpl::handleMouseUp(const WebMouseEvent& event) { mouseCaptureLost(); m_widget->handleMouseReleaseEvent(PlatformMouseEventBuilder(m_widget, event)); } -void WebPopupMenuImpl::MouseWheel(const WebMouseWheelEvent& event) +void WebPopupMenuImpl::handleMouseWheel(const WebMouseWheelEvent& event) { m_widget->handleWheelEvent(PlatformWheelEventBuilder(m_widget, event)); } -bool WebPopupMenuImpl::GestureEvent(const WebGestureEvent& event) +bool WebPopupMenuImpl::handleGestureEvent(const WebGestureEvent& event) { return m_widget->handleGestureEvent(PlatformGestureEventBuilder(m_widget, event)); } #if ENABLE(TOUCH_EVENTS) -bool WebPopupMenuImpl::TouchEvent(const WebTouchEvent& event) +bool WebPopupMenuImpl::handleTouchEvent(const WebTouchEvent& event) { PlatformTouchEventBuilder touchEventBuilder(m_widget, event); @@ -154,7 +152,7 @@ bool WebPopupMenuImpl::TouchEvent(const WebTouchEvent& event) } #endif -bool WebPopupMenuImpl::KeyEvent(const WebKeyboardEvent& event) +bool WebPopupMenuImpl::handleKeyEvent(const WebKeyboardEvent& event) { return m_widget->handleKeyEvent(PlatformKeyboardEventBuilder(event)); } @@ -168,7 +166,7 @@ void WebPopupMenuImpl::close() m_client = 0; - deref(); // Balances ref() from WebWidget::Create + deref(); // Balances ref() from WebPopupMenu::create. } void WebPopupMenuImpl::willStartLiveResize() @@ -218,7 +216,7 @@ void WebPopupMenuImpl::themeChanged() notImplemented(); } -void WebPopupMenuImpl::composite(bool finish) +void WebPopupMenuImpl::composite(bool) { notImplemented(); } @@ -228,28 +226,28 @@ bool WebPopupMenuImpl::handleInputEvent(const WebInputEvent& inputEvent) if (!m_widget) return false; - // TODO (jcampan): WebKit seems to always return false on mouse events - // methods. For now we'll assume it has processed them (as we are only - // interested in whether keyboard events are processed). + // FIXME: WebKit seems to always return false on mouse events methods. For + // now we'll assume it has processed them (as we are only interested in + // whether keyboard events are processed). switch (inputEvent.type) { case WebInputEvent::MouseMove: - MouseMove(*static_cast<const WebMouseEvent*>(&inputEvent)); + handleMouseMove(*static_cast<const WebMouseEvent*>(&inputEvent)); return true; case WebInputEvent::MouseLeave: - MouseLeave(*static_cast<const WebMouseEvent*>(&inputEvent)); + handleMouseLeave(*static_cast<const WebMouseEvent*>(&inputEvent)); return true; case WebInputEvent::MouseWheel: - MouseWheel(*static_cast<const WebMouseWheelEvent*>(&inputEvent)); + handleMouseWheel(*static_cast<const WebMouseWheelEvent*>(&inputEvent)); return true; case WebInputEvent::MouseDown: - MouseDown(*static_cast<const WebMouseEvent*>(&inputEvent)); + handleMouseDown(*static_cast<const WebMouseEvent*>(&inputEvent)); return true; case WebInputEvent::MouseUp: - MouseUp(*static_cast<const WebMouseEvent*>(&inputEvent)); + handleMouseUp(*static_cast<const WebMouseEvent*>(&inputEvent)); return true; // In Windows, RawKeyDown only has information about the physical key, but @@ -264,13 +262,13 @@ bool WebPopupMenuImpl::handleInputEvent(const WebInputEvent& inputEvent) case WebInputEvent::KeyDown: case WebInputEvent::KeyUp: case WebInputEvent::Char: - return KeyEvent(*static_cast<const WebKeyboardEvent*>(&inputEvent)); + return handleKeyEvent(*static_cast<const WebKeyboardEvent*>(&inputEvent)); case WebInputEvent::TouchStart: case WebInputEvent::TouchMove: case WebInputEvent::TouchEnd: case WebInputEvent::TouchCancel: - return TouchEvent(*static_cast<const WebTouchEvent*>(&inputEvent)); + return handleTouchEvent(*static_cast<const WebTouchEvent*>(&inputEvent)); case WebInputEvent::GestureScrollBegin: case WebInputEvent::GestureScrollEnd: @@ -278,7 +276,9 @@ bool WebPopupMenuImpl::handleInputEvent(const WebInputEvent& inputEvent) case WebInputEvent::GestureFlingStart: case WebInputEvent::GestureFlingCancel: case WebInputEvent::GestureTap: - return GestureEvent(*static_cast<const WebGestureEvent*>(&inputEvent)); + case WebInputEvent::GestureTapDown: + case WebInputEvent::GestureDoubleTap: + return handleGestureEvent(*static_cast<const WebGestureEvent*>(&inputEvent)); case WebInputEvent::Undefined: case WebInputEvent::MouseEnter: @@ -292,7 +292,7 @@ void WebPopupMenuImpl::mouseCaptureLost() { } -void WebPopupMenuImpl::setFocus(bool enable) +void WebPopupMenuImpl::setFocus(bool) { } @@ -301,9 +301,7 @@ void WebPopupMenu::setMinimumRowHeight(int minimumRowHeight) PopupMenuChromium::setMinimumRowHeight(minimumRowHeight); } -bool WebPopupMenuImpl::setComposition( - const WebString& text, const WebVector<WebCompositionUnderline>& underlines, - int selectionStart, int selectionEnd) +bool WebPopupMenuImpl::setComposition(const WebString&, const WebVector<WebCompositionUnderline>&, int, int) { return false; } @@ -313,7 +311,7 @@ bool WebPopupMenuImpl::confirmComposition() return false; } -bool WebPopupMenuImpl::confirmComposition(const WebString& text) +bool WebPopupMenuImpl::confirmComposition(const WebString&) { return false; } @@ -337,7 +335,7 @@ bool WebPopupMenuImpl::caretOrSelectionRange(size_t* location, size_t* length) return false; } -void WebPopupMenuImpl::setTextDirection(WebTextDirection direction) +void WebPopupMenuImpl::setTextDirection(WebTextDirection) { } @@ -345,11 +343,6 @@ void WebPopupMenuImpl::setTextDirection(WebTextDirection direction) //----------------------------------------------------------------------------- // WebCore::HostWindow -void WebPopupMenuImpl::invalidateContents(const IntRect&, bool) -{ - notImplemented(); -} - void WebPopupMenuImpl::invalidateRootView(const IntRect&, bool) { notImplemented(); @@ -372,9 +365,7 @@ void WebPopupMenuImpl::scheduleAnimation() { } -void WebPopupMenuImpl::scroll(const IntSize& scrollDelta, - const IntRect& scrollRect, - const IntRect& clipRect) +void WebPopupMenuImpl::scroll(const IntSize& scrollDelta, const IntRect& scrollRect, const IntRect& clipRect) { if (m_client) { int dx = scrollDelta.width(); @@ -395,12 +386,6 @@ IntRect WebPopupMenuImpl::rootViewToScreen(const IntRect& rect) const return IntRect(); } -void WebPopupMenuImpl::scrollRectIntoView(const IntRect&) const -{ - // Nothing to be done here since we do not have the concept of a container - // that implements its own scrolling. -} - void WebPopupMenuImpl::scrollbarsModeDidChange() const { // Nothing to be done since we have no concept of different scrollbar modes. diff --git a/Source/WebKit/chromium/src/WebPopupMenuImpl.h b/Source/WebKit/chromium/src/WebPopupMenuImpl.h index 1dec77c28..0ad03963a 100644 --- a/Source/WebKit/chromium/src/WebPopupMenuImpl.h +++ b/Source/WebKit/chromium/src/WebPopupMenuImpl.h @@ -32,8 +32,8 @@ #define WebPopupMenuImpl_h #include "FramelessScrollViewClient.h" -#include "platform/WebPoint.h" #include "WebPopupMenu.h" +#include "platform/WebPoint.h" #include "platform/WebSize.h" #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> @@ -65,81 +65,78 @@ class WebPopupMenuImpl : public WebPopupMenu, public RefCounted<WebPopupMenuImpl> { WTF_MAKE_FAST_ALLOCATED; public: - // WebWidget - virtual void close(); - virtual WebSize size() { return m_size; } - virtual void willStartLiveResize(); - virtual void resize(const WebSize&); - virtual void willEndLiveResize(); - virtual void animate(double frameBeginTime); - virtual void layout(); - virtual void paint(WebCanvas* canvas, const WebRect& rect); - virtual void themeChanged(); - virtual void composite(bool finish); - virtual bool handleInputEvent(const WebInputEvent&); - virtual void mouseCaptureLost(); - virtual void setFocus(bool enable); + // WebWidget functions: + virtual void close() OVERRIDE; + virtual WebSize size() OVERRIDE { return m_size; } + virtual void willStartLiveResize() OVERRIDE; + virtual void resize(const WebSize&) OVERRIDE; + virtual void willEndLiveResize() OVERRIDE; + virtual void animate(double frameBeginTime) OVERRIDE; + virtual void layout() OVERRIDE; + virtual void paint(WebCanvas*, const WebRect&) OVERRIDE; + virtual void themeChanged() OVERRIDE; + virtual void composite(bool finish) OVERRIDE; + virtual bool handleInputEvent(const WebInputEvent&) OVERRIDE; + virtual void mouseCaptureLost() OVERRIDE; + virtual void setFocus(bool enable) OVERRIDE; virtual bool setComposition( const WebString& text, const WebVector<WebCompositionUnderline>& underlines, - int selectionStart, int selectionEnd); - virtual bool confirmComposition(); - virtual bool confirmComposition(const WebString& text); - virtual bool compositionRange(size_t* location, size_t* length); - virtual WebTextInputType textInputType(); - virtual bool caretOrSelectionRange(size_t* location, size_t* length); - virtual void setTextDirection(WebTextDirection direction); - virtual bool isAcceleratedCompositingActive() const { return false; } + int selectionStart, int selectionEnd) OVERRIDE; + virtual bool confirmComposition() OVERRIDE; + virtual bool confirmComposition(const WebString& text) OVERRIDE; + virtual bool compositionRange(size_t* location, size_t* length) OVERRIDE; + virtual WebTextInputType textInputType() OVERRIDE; + virtual bool caretOrSelectionRange(size_t* location, size_t* length) OVERRIDE; + virtual void setTextDirection(WebTextDirection) OVERRIDE; + virtual bool isAcceleratedCompositingActive() const OVERRIDE { return false; } // WebPopupMenuImpl - void Init(WebCore::FramelessScrollView* widget, - const WebRect& bounds); + void init(WebCore::FramelessScrollView* widget, const WebRect& bounds); WebWidgetClient* client() { return m_client; } - void MouseMove(const WebMouseEvent&); - void MouseLeave(const WebMouseEvent&); - void MouseDown(const WebMouseEvent&); - void MouseUp(const WebMouseEvent&); - void MouseDoubleClick(const WebMouseEvent&); - void MouseWheel(const WebMouseWheelEvent&); - bool GestureEvent(const WebGestureEvent&); - bool TouchEvent(const WebTouchEvent&); - bool KeyEvent(const WebKeyboardEvent&); + void handleMouseMove(const WebMouseEvent&); + void handleMouseLeave(const WebMouseEvent&); + void handleMouseDown(const WebMouseEvent&); + void handleMouseUp(const WebMouseEvent&); + void handleMouseDoubleClick(const WebMouseEvent&); + void handleMouseWheel(const WebMouseWheelEvent&); + bool handleGestureEvent(const WebGestureEvent&); + bool handleTouchEvent(const WebTouchEvent&); + bool handleKeyEvent(const WebKeyboardEvent&); protected: - friend class WebPopupMenu; // For WebPopupMenu::create + friend class WebPopupMenu; // For WebPopupMenu::create. friend class WTF::RefCounted<WebPopupMenuImpl>; - WebPopupMenuImpl(WebWidgetClient* client); + WebPopupMenuImpl(WebWidgetClient*); ~WebPopupMenuImpl(); // WebCore::HostWindow methods: - virtual void invalidateContents(const WebCore::IntRect&, bool); - virtual void invalidateRootView(const WebCore::IntRect&, bool); - virtual void invalidateContentsAndRootView(const WebCore::IntRect&, bool); - virtual void invalidateContentsForSlowScroll(const WebCore::IntRect&, bool); - virtual void scheduleAnimation(); + virtual void invalidateRootView(const WebCore::IntRect&, bool) OVERRIDE; + virtual void invalidateContentsAndRootView(const WebCore::IntRect&, bool) OVERRIDE; + virtual void invalidateContentsForSlowScroll(const WebCore::IntRect&, bool) OVERRIDE; + virtual void scheduleAnimation() OVERRIDE; virtual void scroll( const WebCore::IntSize& scrollDelta, const WebCore::IntRect& scrollRect, - const WebCore::IntRect& clipRect); - virtual WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) const; - virtual WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) const; - virtual PlatformPageClient platformPageClient() const { return 0; } - virtual void scrollRectIntoView(const WebCore::IntRect&) const; - virtual void scrollbarsModeDidChange() const; - virtual void setCursor(const WebCore::Cursor&); - virtual void setCursorHiddenUntilMouseMoves(bool); + const WebCore::IntRect& clipRect) OVERRIDE; + virtual WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) const OVERRIDE; + virtual WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) const OVERRIDE; + virtual PlatformPageClient platformPageClient() const OVERRIDE { return 0; } + virtual void scrollbarsModeDidChange() const OVERRIDE; + virtual void setCursor(const WebCore::Cursor&) OVERRIDE; + virtual void setCursorHiddenUntilMouseMoves(bool) OVERRIDE; // WebCore::FramelessScrollViewClient methods: - virtual void popupClosed(WebCore::FramelessScrollView*); + virtual void popupClosed(WebCore::FramelessScrollView*) OVERRIDE; WebWidgetClient* m_client; WebSize m_size; WebPoint m_lastMousePosition; - // This is a non-owning ref. The popup will notify us via popupClosed() + // This is a non-owning ref. The popup will notify us via popupClosed() // before it is destroyed. WebCore::FramelessScrollView* m_widget; diff --git a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp index de6cda186..38963b521 100644 --- a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp +++ b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp @@ -432,4 +432,23 @@ bool WebRuntimeFeatures::isGamepadEnabled() #endif } +void WebRuntimeFeatures::enableShadowDOM(bool enable) +{ +#if ENABLE(SHADOW_DOM) + RuntimeEnabledFeatures::setShadowDOMEnabled(enable); +#else + UNUSED_PARAM(enable); +#endif +} + +bool WebRuntimeFeatures::isShadowDOMEnabled() +{ +#if ENABLE(SHADOW_DOM) + return RuntimeEnabledFeatures::shadowDOMEnabled(); +#else + return false; +#endif +} + + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSecurityPolicy.cpp b/Source/WebKit/chromium/src/WebSecurityPolicy.cpp index 39f5e2770..01162779e 100644 --- a/Source/WebKit/chromium/src/WebSecurityPolicy.cpp +++ b/Source/WebKit/chromium/src/WebSecurityPolicy.cpp @@ -63,6 +63,11 @@ void WebSecurityPolicy::registerURLSchemeAsSecure(const WebString& scheme) SchemeRegistry::registerURLSchemeAsSecure(scheme); } +void WebSecurityPolicy::registerURLSchemeAsCORSEnabled(const WebString& scheme) +{ + SchemeRegistry::registerURLSchemeAsCORSEnabled(scheme); +} + void WebSecurityPolicy::addOriginAccessWhitelistEntry( const WebURL& sourceOrigin, const WebString& destinationProtocol, diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp index 7733e2699..2723ca78b 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp @@ -224,6 +224,11 @@ void WebSettingsImpl::setDNSPrefetchingEnabled(bool enabled) m_settings->setDNSPrefetchingEnabled(enabled); } +void WebSettingsImpl::setFixedElementsLayoutRelativeToFrame(bool fixedElementsLayoutRelativeToFrame) +{ + m_settings->setFixedElementsLayoutRelativeToFrame(fixedElementsLayoutRelativeToFrame); +} + void WebSettingsImpl::setLocalStorageEnabled(bool enabled) { m_settings->setLocalStorageEnabled(enabled); @@ -368,6 +373,11 @@ void WebSettingsImpl::setAccelerated2dCanvasEnabled(bool enabled) m_settings->setAccelerated2dCanvasEnabled(enabled); } +void WebSettingsImpl::setDeferred2dCanvasEnabled(bool enabled) +{ + m_settings->setDeferred2dCanvasEnabled(enabled); +} + void WebSettingsImpl::setAcceleratedCompositingForFixedPositionEnabled(bool enabled) { m_settings->setAcceleratedCompositingForFixedPositionEnabled(enabled); @@ -388,6 +398,11 @@ void WebSettingsImpl::setHyperlinkAuditingEnabled(bool enabled) m_settings->setHyperlinkAuditingEnabled(enabled); } +void WebSettingsImpl::setLayoutFallbackWidth(int width) +{ + m_settings->setLayoutFallbackWidth(width); +} + void WebSettingsImpl::setAsynchronousSpellCheckingEnabled(bool enabled) { m_settings->setAsynchronousSpellCheckingEnabled(enabled); diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index cc70d1316..63a00a099 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -77,6 +77,7 @@ public: virtual void setJavaScriptCanAccessClipboard(bool); virtual void setXSSAuditorEnabled(bool); virtual void setDNSPrefetchingEnabled(bool); + virtual void setFixedElementsLayoutRelativeToFrame(bool); virtual void setLocalStorageEnabled(bool); virtual void setEditableLinkBehaviorNeverLive(); virtual void setFrameFlatteningEnabled(bool); @@ -106,11 +107,13 @@ public: virtual void setAcceleratedCompositingForCanvasEnabled(bool); virtual void setAcceleratedCompositingForAnimationEnabled(bool); virtual void setAccelerated2dCanvasEnabled(bool); + virtual void setDeferred2dCanvasEnabled(bool); virtual void setAcceleratedCompositingForFixedPositionEnabled(bool); virtual void setMinimumAccelerated2dCanvasSize(int); virtual void setAcceleratedFiltersEnabled(bool); virtual void setMemoryInfoEnabled(bool); virtual void setHyperlinkAuditingEnabled(bool); + virtual void setLayoutFallbackWidth(int); virtual void setAsynchronousSpellCheckingEnabled(bool); virtual void setUnifiedTextCheckerEnabled(bool); virtual void setCaretBrowsingEnabled(bool); diff --git a/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp b/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp index a2e16847d..7a4bddb22 100644 --- a/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp +++ b/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp @@ -361,12 +361,13 @@ void WebSharedWorkerImpl::connectTask(ScriptExecutionContext* context, PassOwnPt workerContext->dispatchEvent(createConnectEvent(port)); } -void WebSharedWorkerImpl::startWorkerContext(const WebURL& url, const WebString& name, const WebString& userAgent, const WebString& sourceCode, long long) +void WebSharedWorkerImpl::startWorkerContext(const WebURL& url, const WebString& name, const WebString& userAgent, const WebString& sourceCode, const WebString& contentSecurityPolicy, WebContentSecurityPolicyType policyType, long long) { initializeLoader(url); WorkerThreadStartMode startMode = m_pauseWorkerContextOnStart ? PauseWorkerContextOnStart : DontPauseWorkerContextOnStart; - // FIXME: pass content-security-policy directives into shared worker. - setWorkerThread(SharedWorkerThread::create(name, url, userAgent, sourceCode, *this, *this, startMode, "", ContentSecurityPolicy::ReportOnly)); + setWorkerThread(SharedWorkerThread::create(name, url, userAgent, sourceCode, *this, *this, startMode, contentSecurityPolicy, + static_cast<WebCore::ContentSecurityPolicy::HeaderType>(policyType))); + workerThread()->start(); } diff --git a/Source/WebKit/chromium/src/WebSharedWorkerImpl.h b/Source/WebKit/chromium/src/WebSharedWorkerImpl.h index 70bf3707b..b98a2c9d7 100644 --- a/Source/WebKit/chromium/src/WebSharedWorkerImpl.h +++ b/Source/WebKit/chromium/src/WebSharedWorkerImpl.h @@ -36,6 +36,7 @@ #if ENABLE(SHARED_WORKERS) #include "ScriptExecutionContext.h" #include "WebCommonWorkerClient.h" +#include "WebContentSecurityPolicy.h" #include "WebFrameClient.h" #include "WebSharedWorkerClient.h" #include "WebWorkerBase.h" @@ -95,7 +96,9 @@ public: // WebSharedWorker methods: virtual bool isStarted(); - virtual void startWorkerContext(const WebURL&, const WebString& name, const WebString& userAgent, const WebString& sourceCode, long long); + + virtual void startWorkerContext(const WebURL&, const WebString& name, const WebString& userAgent, const WebString& sourceCode, const WebString& contentSecurityPolicy, WebContentSecurityPolicyType, long long cacheId); + virtual void connect(WebMessagePortChannel*, ConnectListener*); virtual void terminateWorkerContext(); virtual void clientDestroyed(); diff --git a/Source/WebKit/chromium/src/WebSocketImpl.cpp b/Source/WebKit/chromium/src/WebSocketImpl.cpp index 9c4e8534f..f0bf28206 100644 --- a/Source/WebKit/chromium/src/WebSocketImpl.cpp +++ b/Source/WebKit/chromium/src/WebSocketImpl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2011, 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 @@ -31,6 +31,7 @@ #include "config.h" #include "WebSocketImpl.h" +#include "ArrayBuffer.h" #include "Document.h" #include "KURL.h" #if ENABLE(WEB_SOCKETS) @@ -43,7 +44,7 @@ class WebSocketChannel { } // namespace WebCore #endif -#include "platform/WebData.h" +#include "WebArrayBuffer.h" #include "WebDocument.h" #include "WebSocketClient.h" #include "platform/WebString.h" @@ -55,6 +56,7 @@ namespace WebKit { WebSocketImpl::WebSocketImpl(const WebDocument& document, WebSocketClient* client) : m_client(client) + , m_binaryType(BinaryTypeBlob) { #if ENABLE(WEB_SOCKETS) m_private = WebSocketChannel::create(PassRefPtr<Document>(document).get(), this); @@ -72,6 +74,19 @@ WebSocketImpl::~WebSocketImpl() #endif } +WebSocket::BinaryType WebSocketImpl::binaryType() const +{ + return m_binaryType; +} + +bool WebSocketImpl::setBinaryType(BinaryType binaryType) +{ + if (binaryType > BinaryTypeArrayBuffer) + return false; + m_binaryType = binaryType; + return true; +} + void WebSocketImpl::connect(const WebURL& url, const WebString& protocol) { #if ENABLE(WEB_SOCKETS) @@ -99,10 +114,10 @@ bool WebSocketImpl::sendText(const WebString& message) #endif } -bool WebSocketImpl::sendBinary(const WebData& binaryData) +bool WebSocketImpl::sendArrayBuffer(const WebArrayBuffer& webArrayBuffer) { #if ENABLE(WEB_SOCKETS) - return m_private->send(binaryData.data(), binaryData.size()); + return m_private->send(*PassRefPtr<ArrayBuffer>(webArrayBuffer)); #else ASSERT_NOT_REACHED(); #endif @@ -166,7 +181,14 @@ void WebSocketImpl::didReceiveMessage(const String& message) void WebSocketImpl::didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData) { #if ENABLE(WEB_SOCKETS) - m_client->didReceiveBinaryData(WebData(binaryData->data(), binaryData->size())); + switch (m_binaryType) { + case BinaryTypeBlob: + // FIXME: Handle Blob after supporting WebBlob. + break; + case BinaryTypeArrayBuffer: + m_client->didReceiveArrayBuffer(WebArrayBuffer(ArrayBuffer::create(binaryData->data(), binaryData->size()))); + break; + } #else ASSERT_NOT_REACHED(); #endif diff --git a/Source/WebKit/chromium/src/WebSocketImpl.h b/Source/WebKit/chromium/src/WebSocketImpl.h index 3d37355d0..3d42bd506 100644 --- a/Source/WebKit/chromium/src/WebSocketImpl.h +++ b/Source/WebKit/chromium/src/WebSocketImpl.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2011, 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 @@ -42,7 +42,6 @@ namespace WebCore { class WebSocketChannel; } namespace WebKit { -class WebData; class WebDocument; class WebString; class WebURL; @@ -54,10 +53,12 @@ public: bool isNull() const { return !m_private; } + BinaryType binaryType() const; + virtual bool setBinaryType(BinaryType); virtual void connect(const WebURL&, const WebString& protocol); virtual WebString subprotocol(); - virtual bool sendText(const WebString& message); - virtual bool sendBinary(const WebData& binaryData); + virtual bool sendText(const WebString&); + virtual bool sendArrayBuffer(const WebArrayBuffer&); virtual unsigned long bufferedAmount() const; virtual void close(int code, const WebString& reason); virtual void fail(const WebString& reason); @@ -75,6 +76,7 @@ public: private: RefPtr<WebCore::WebSocketChannel> m_private; WebSocketClient* m_client; + BinaryType m_binaryType; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSolidColorLayer.cpp b/Source/WebKit/chromium/src/WebSolidColorLayer.cpp new file mode 100644 index 000000000..11d7c1417 --- /dev/null +++ b/Source/WebKit/chromium/src/WebSolidColorLayer.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "platform/WebSolidColorLayer.h" + +#include "WebSolidColorLayerImpl.h" +#include "platform/WebFloatRect.h" + +namespace WebKit { + +WebSolidColorLayer WebSolidColorLayer::create() +{ + return WebSolidColorLayer(WebSolidColorLayerImpl::create()); +} + +WebSolidColorLayer::WebSolidColorLayer(const PassRefPtr<WebSolidColorLayerImpl>& node) + : WebLayer(node) +{ +} + +void WebSolidColorLayer::setBackgroundColor(const WebColor& color) +{ + m_private->setBackgroundColor(color); +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp new file mode 100644 index 000000000..33b1a30e3 --- /dev/null +++ b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebSolidColorLayerImpl.h" + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<WebSolidColorLayerImpl> WebSolidColorLayerImpl::create() +{ + return adoptRef(new WebSolidColorLayerImpl()); +} + +WebSolidColorLayerImpl::WebSolidColorLayerImpl() + : SolidColorLayerChromium() +{ + setIsDrawable(true); +} + +WebSolidColorLayerImpl::~WebSolidColorLayerImpl() +{ +} + +} // namespace WebKit + diff --git a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h new file mode 100644 index 000000000..d2673b42b --- /dev/null +++ b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSolidColorLayerImpl_h +#define WebSolidColorLayerImpl_h + +#include "SolidColorLayerChromium.h" +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +class WebSolidColorLayerImpl : public WebCore::SolidColorLayerChromium { +public: + static PassRefPtr<WebSolidColorLayerImpl> create(); + +protected: + WebSolidColorLayerImpl(); + virtual ~WebSolidColorLayerImpl(); +}; + +} // namespace WebKit + +#endif // WebSolidColorLayerImpl_h + diff --git a/Source/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp b/Source/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp deleted file mode 100644 index 4f1f07457..000000000 --- a/Source/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2010 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 "WebSpeechInputControllerMockImpl.h" - -#if ENABLE(INPUT_SPEECH) - -#include "PlatformString.h" -#include "SecurityOrigin.h" -#include "SpeechInputClientMock.h" -#include "platform/WebRect.h" -#include "WebSecurityOrigin.h" -#include <wtf/PassOwnPtr.h> - -namespace WebKit { - -WebSpeechInputControllerMock* WebSpeechInputControllerMock::create(WebSpeechInputListener* listener) -{ - return new WebSpeechInputControllerMockImpl(listener); -} - -WebSpeechInputControllerMockImpl::WebSpeechInputControllerMockImpl( - WebSpeechInputListener* listener) - : m_webcoreMock(adoptPtr(new WebCore::SpeechInputClientMock())) - , m_listener(listener) -{ - m_webcoreMock->setListener(this); -} - -WebSpeechInputControllerMockImpl::~WebSpeechInputControllerMockImpl() -{ - m_webcoreMock->setListener(0); -} - -void WebSpeechInputControllerMockImpl::addMockRecognitionResult(const WebString& result, double confidence, const WebString &language) -{ - m_webcoreMock->addRecognitionResult(result, confidence, language); -} - -void WebSpeechInputControllerMockImpl::clearResults() -{ - m_webcoreMock->clearResults(); -} - -void WebSpeechInputControllerMockImpl::didCompleteRecording(int requestId) -{ - m_listener->didCompleteRecording(requestId); -} - -void WebSpeechInputControllerMockImpl::didCompleteRecognition(int requestId) -{ - m_listener->didCompleteRecognition(requestId); -} - -void WebSpeechInputControllerMockImpl::setRecognitionResult(int requestId, const WebCore::SpeechInputResultArray& result) -{ - m_listener->setRecognitionResult(requestId, result); -} - -bool WebSpeechInputControllerMockImpl::startRecognition(int requestId, const WebRect& elementRect, const WebString& language, const WebString& grammar, const WebSecurityOrigin& origin) -{ - return m_webcoreMock->startRecognition(requestId, elementRect, language, grammar, origin.get()); -} - -void WebSpeechInputControllerMockImpl::cancelRecognition(int requestId) -{ - m_webcoreMock->cancelRecognition(requestId); -} - -void WebSpeechInputControllerMockImpl::stopRecording(int requestId) -{ - m_webcoreMock->stopRecording(requestId); -} - -} // namespace WebKit - -#else - -namespace WebKit { - -WebSpeechInputControllerMock* WebSpeechInputControllerMock::create(WebSpeechInputListener* listener) -{ - return 0; -} - -} // namespace WebKit - -#endif // ENABLE(INPUT_SPEECH) - diff --git a/Source/WebKit/chromium/src/WebSpeechInputResult.cpp b/Source/WebKit/chromium/src/WebSpeechInputResult.cpp index 9b1314418..45de4674e 100644 --- a/Source/WebKit/chromium/src/WebSpeechInputResult.cpp +++ b/Source/WebKit/chromium/src/WebSpeechInputResult.cpp @@ -43,11 +43,16 @@ WebSpeechInputResult::WebSpeechInputResult(const PassRefPtr<WebCore::SpeechInput { } -void WebSpeechInputResult::set(const WebString& utterance, double confidence) +void WebSpeechInputResult::assign(const WebString& utterance, double confidence) { m_private = WebCore::SpeechInputResult::create(utterance, confidence); } +void WebSpeechInputResult::assign(const WebSpeechInputResult& other) +{ + m_private = WebCore::SpeechInputResult::create(*other.m_private.get()); +} + WebSpeechInputResult::operator PassRefPtr<WebCore::SpeechInputResult>() const { return m_private.get(); diff --git a/Source/WebKit/chromium/src/WebTextCheckingResult.cpp b/Source/WebKit/chromium/src/WebTextCheckingResult.cpp new file mode 100644 index 000000000..cfd4fa72a --- /dev/null +++ b/Source/WebKit/chromium/src/WebTextCheckingResult.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * 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 "WebTextCheckingResult.h" + +#include "TextCheckerClient.h" + +using namespace WebCore; + +namespace WebKit { + +WebTextCheckingResult::operator TextCheckingResult() const +{ + TextCheckingResult result; + result.type = static_cast<TextCheckingType>(type); + result.location = location; + result.length = length; + result.replacement = replacement; + + return result; +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebUserMediaRequest.cpp b/Source/WebKit/chromium/src/WebUserMediaRequest.cpp index 4172aae5b..5a76c83b0 100644 --- a/Source/WebKit/chromium/src/WebUserMediaRequest.cpp +++ b/Source/WebKit/chromium/src/WebUserMediaRequest.cpp @@ -86,18 +86,41 @@ WebSecurityOrigin WebUserMediaRequest::securityOrigin() const return WebSecurityOrigin(m_private->scriptExecutionContext()->securityOrigin()); } +void WebUserMediaRequest::requestSucceeded(const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources) +{ + if (m_private.isNull()) + return; + + MediaStreamSourceVector audio; + for (size_t i = 0; i < audioSources.size(); ++i) { + MediaStreamSource* curr = audioSources[i]; + audio.append(curr); + } + MediaStreamSourceVector video; + for (size_t i = 0; i < videoSources.size(); ++i) { + MediaStreamSource* curr = videoSources[i]; + video.append(curr); + } + + m_private->succeed(audio, video); +} + +// FIXME: Cleanup when the chromium code has switched to the split sources implementation. void WebUserMediaRequest::requestSucceeded(const WebVector<WebMediaStreamSource>& sources) { if (m_private.isNull()) return; - MediaStreamSourceVector s; + MediaStreamSourceVector audio, video; for (size_t i = 0; i < sources.size(); ++i) { MediaStreamSource* curr = sources[i]; - s.append(curr); + if (curr->type() == MediaStreamSource::TypeAudio) + audio.append(curr); + else if (curr->type() == MediaStreamSource::TypeVideo) + video.append(curr); } - m_private->succeed(s); + m_private->succeed(audio, video); } void WebUserMediaRequest::requestFailed() diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index a14748353..84de7729c 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -87,9 +87,10 @@ #include "PlatformContextSkia.h" #include "PlatformKeyboardEvent.h" #include "PlatformMouseEvent.h" -#include "PlatformScreen.h" #include "PlatformThemeChromiumLinux.h" #include "PlatformWheelEvent.h" +#include "PointerLock.h" +#include "PointerLockController.h" #include "PopupContainer.h" #include "PopupMenuClient.h" #include "ProgressTracker.h" @@ -1331,6 +1332,13 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) m_currentInputEvent = &inputEvent; +#if ENABLE(POINTER_LOCK) + if (isPointerLocked() && WebInputEvent::isMouseEventType(inputEvent.type)) { + pointerLockMouseEvent(inputEvent); + return true; + } +#endif + if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type)) { // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. RefPtr<Node> node = m_mouseCaptureNode; @@ -1407,6 +1415,8 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) case WebInputEvent::GestureFlingStart: case WebInputEvent::GestureFlingCancel: case WebInputEvent::GestureTap: + case WebInputEvent::GestureTapDown: + case WebInputEvent::GestureDoubleTap: handled = gestureEvent(*static_cast<const WebGestureEvent*>(&inputEvent)); break; #endif @@ -1742,6 +1752,36 @@ bool WebViewImpl::isAcceleratedCompositingActive() const #endif } +void WebViewImpl::didAcquirePointerLock() +{ +#if ENABLE(POINTER_LOCK) + if (page()) + page()->pointerLockController()->didAcquirePointerLock(); +#endif +} + +void WebViewImpl::didNotAcquirePointerLock() +{ +#if ENABLE(POINTER_LOCK) + if (page()) + page()->pointerLockController()->didNotAcquirePointerLock(); +#endif +} + +void WebViewImpl::didLosePointerLock() +{ +#if ENABLE(POINTER_LOCK) + if (page()) + page()->pointerLockController()->didLosePointerLock(); +#endif +} + +void WebViewImpl::didChangeWindowResizerRect() +{ + if (mainFrameImpl()->frameView()) + mainFrameImpl()->frameView()->windowResizerRectChanged(); +} + // WebView -------------------------------------------------------------------- WebSettings* WebViewImpl::settings() @@ -1996,8 +2036,6 @@ void WebViewImpl::setPageScaleFactorPreservingScrollOffset(float scaleFactor) { // Pick a scale factor that is within the expected limits scaleFactor = clampPageScaleFactorToLimits(scaleFactor); - if (scaleFactor == pageScaleFactor()) - return; IntPoint scrollOffsetAtNewScale(mainFrame()->scrollOffset().width, mainFrame()->scrollOffset().height); float deltaScale = scaleFactor / pageScaleFactor(); @@ -2037,30 +2075,6 @@ void WebViewImpl::setDeviceScaleFactor(float scaleFactor) page()->setDeviceScaleFactor(scaleFactor); } -bool WebViewImpl::shouldLayoutFixedElementsRelativeToFrame() const -{ - if (!page()) - return false; - - Frame* frame = page()->mainFrame(); - if (!frame || !frame->view()) - return false; - - return frame->view()->shouldLayoutFixedElementsRelativeToFrame(); -} - -void WebViewImpl::setShouldLayoutFixedElementsRelativeToFrame(bool enable) -{ - if (!page()) - return; - - Frame* frame = page()->mainFrame(); - if (!frame || !frame->view()) - return; - - frame->view()->setShouldLayoutFixedElementsRelativeToFrame(enable); -} - bool WebViewImpl::isFixedLayoutModeEnabled() const { if (!page()) @@ -2649,7 +2663,7 @@ void WebView::removeAllUserContent() pageGroup->removeAllUserContent(); } -void WebViewImpl::didCommitLoad(bool* isNewNavigation) +void WebViewImpl::didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPage) { if (isNewNavigation) *isNewNavigation = m_observedNewNavigation; @@ -2660,6 +2674,8 @@ void WebViewImpl::didCommitLoad(bool* isNewNavigation) m_newNavigationLoader = 0; #endif m_observedNewNavigation = false; + if (!isNavigationWithinPage) + m_pageScaleFactorIsSet = false; } void WebViewImpl::layoutUpdated(WebFrameImpl* webframe) @@ -2742,9 +2758,6 @@ void WebViewImpl::startDragging(const WebDragData& dragData, void WebViewImpl::observeNewNavigation() { m_observedNewNavigation = true; - // FIXME: We need to make sure that m_pageScaleFactorIsSet is not reset - // on same page navigations. - m_pageScaleFactorIsSet = false; #ifndef NDEBUG m_newNavigationLoader = m_page->mainFrame()->loader()->documentLoader(); #endif @@ -2989,24 +3002,21 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) } else { TRACE_EVENT("WebViewImpl::setIsAcceleratedCompositingActive(true)", this, 0); - static const double defaultRefreshRate = 60.0; - WebCore::CCSettings ccSettings; ccSettings.acceleratePainting = page()->settings()->acceleratedDrawingEnabled(); ccSettings.compositeOffscreen = settings()->compositeToTextureEnabled(); ccSettings.showFPSCounter = settings()->showFPSCounter(); ccSettings.showPlatformLayerTree = settings()->showPlatformLayerTree(); - ccSettings.refreshRate = screenRefreshRate(page()->mainFrame()->view()); - - ASSERT(ccSettings.refreshRate >= 0); - if (!ccSettings.refreshRate) - ccSettings.refreshRate = defaultRefreshRate; ccSettings.perTilePainting = page()->settings()->perTileDrawingEnabled(); ccSettings.partialSwapEnabled = page()->settings()->partialSwapEnabled(); m_nonCompositedContentHost = NonCompositedContentHost::create(WebViewImplContentPainter::create(this)); m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->showDebugBorders()); + + if (page() && page()->mainFrame()->view()) + m_nonCompositedContentHost->setBackgroundColor(page()->mainFrame()->view()->documentBackgroundColor()); + m_layerTreeHost = CCLayerTreeHost::create(this, ccSettings); if (m_layerTreeHost) { m_layerTreeHost->setHaveWheelEventHandlers(m_haveWheelEventHandlers); @@ -3177,4 +3187,47 @@ void WebViewImpl::resetGestureRecognizer() } #endif +#if ENABLE(POINTER_LOCK) +bool WebViewImpl::requestPointerLock() +{ + return m_client && m_client->requestPointerLock(); +} + +void WebViewImpl::requestPointerUnlock() +{ + if (m_client) + m_client->requestPointerUnlock(); +} + +bool WebViewImpl::isPointerLocked() +{ + return m_client && m_client->isPointerLocked(); +} + +void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event) +{ + AtomicString eventType; + switch (event.type) { + case WebInputEvent::MouseDown: + eventType = eventNames().mousedownEvent; + break; + case WebInputEvent::MouseUp: + eventType = eventNames().mouseupEvent; + break; + case WebInputEvent::MouseMove: + eventType = eventNames().mousemoveEvent; + break; + default: + ASSERT_NOT_REACHED(); + } + + const WebMouseEvent& mouseEvent = static_cast<const WebMouseEvent&>(event); + + if (page()) + page()->pointerLockController()->dispatchLockedMouseEvent( + PlatformMouseEventBuilder(mainFrameImpl()->frameView(), mouseEvent), + eventType); +} +#endif + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index 6ea196a75..a039a09ce 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -129,6 +129,10 @@ public: virtual bool caretOrSelectionRange(size_t* location, size_t* length); virtual void setTextDirection(WebTextDirection direction); virtual bool isAcceleratedCompositingActive() const; + virtual void didAcquirePointerLock(); + virtual void didNotAcquirePointerLock(); + virtual void didLosePointerLock(); + virtual void didChangeWindowResizerRect(); // WebView methods: virtual void initializeMainFrame(WebFrameClient*); @@ -173,8 +177,6 @@ public: virtual float deviceScaleFactor() const; virtual void setDeviceScaleFactor(float); - virtual bool shouldLayoutFixedElementsRelativeToFrame() const; - virtual void setShouldLayoutFixedElementsRelativeToFrame(bool); virtual bool isFixedLayoutModeEnabled() const; virtual void enableFixedLayoutMode(bool enable); virtual WebSize fixedLayoutSize() const; @@ -331,8 +333,9 @@ public: // Notifies the WebView that a load has been committed. isNewNavigation // will be true if a new session history item should be created for that - // load. - void didCommitLoad(bool* isNewNavigation); + // load. isNavigationWithinPage will be true if the navigation does + // not take the user away from the current page. + void didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPage); // Indicates two things: // 1) This view may have a new layout now. @@ -468,6 +471,14 @@ public: bool hasHorizontalScrollbar(); bool hasVerticalScrollbar(); + // Pointer Lock calls allow a page to capture all mouse events and + // disable the system cursor. +#if ENABLE(POINTER_LOCK) + virtual bool requestPointerLock(); + virtual void requestPointerUnlock(); + virtual bool isPointerLocked(); +#endif + private: bool computePageScaleFactorLimits(); float clampPageScaleFactorToLimits(float scale); @@ -521,6 +532,10 @@ private: void updateLayerTreeViewport(); #endif +#if ENABLE(POINTER_LOCK) + void pointerLockMouseEvent(const WebInputEvent&); +#endif + WebViewClient* m_client; WebAutofillClient* m_autofillClient; WebPermissionClient* m_permissionClient; diff --git a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp index d36e83a70..799599ab3 100644 --- a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp @@ -62,7 +62,6 @@ #include "platform/WebString.h" #include "platform/WebURL.h" #include "WebViewImpl.h" -#include "WebWorker.h" using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebWorkerInfo.cpp b/Source/WebKit/chromium/src/WebWorkerInfo.cpp new file mode 100644 index 000000000..8454e518d --- /dev/null +++ b/Source/WebKit/chromium/src/WebWorkerInfo.cpp @@ -0,0 +1,43 @@ +/* + * 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 "WebWorkerInfo.h" + +#include "WorkerThread.h" + +namespace WebKit { + +unsigned WebWorkerInfo::dedicatedWorkerCount() +{ + return WebCore::WorkerThread::workerThreadCount(); +} + +} diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp index 6155d152a..7fbb1f468 100644 --- a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp @@ -57,14 +57,11 @@ namespace WebCore { static const char fileSystemOperationsMode[] = "fileSystemOperationsMode"; WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium(ScriptExecutionContext* context, AsyncFileSystem::Type type, const WebKit::WebURL& rootURL, bool synchronous) - : AsyncFileSystem(type) + : AsyncFileSystemChromium(type, rootURL) , m_scriptExecutionContext(context) - , m_webFileSystem(webKitPlatformSupport()->fileSystem()) , m_workerContext(static_cast<WorkerContext*>(context)) , m_synchronous(synchronous) - , m_filesystemRootURL(rootURL) { - ASSERT(m_webFileSystem); ASSERT(m_scriptExecutionContext->isWorkerContext()); WorkerLoaderProxy* workerLoaderProxy = &m_workerContext->thread()->workerLoaderProxy(); @@ -222,15 +219,6 @@ PassRefPtr<WorkerFileSystemCallbacksBridge> WorkerAsyncFileSystemChromium::creat return m_bridgeForCurrentOperation; } -KURL WorkerAsyncFileSystemChromium::virtualPathToFileSystemURL(const String& virtualPath) const -{ - ASSERT(!m_filesystemRootURL.isEmpty()); - KURL url = m_filesystemRootURL; - // Remove the extra leading slash. - url.setPath(url.path() + encodeWithURLEscapeSequences(virtualPath.substring(1))); - return url; -} - } // namespace WebCore #endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h index 13a8e7cb4..c8ae3565f 100644 --- a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h +++ b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h @@ -33,7 +33,7 @@ #if ENABLE(FILE_SYSTEM) && ENABLE(WORKERS) -#include "AsyncFileSystem.h" +#include "AsyncFileSystemChromium.h" #include "PlatformString.h" #include <wtf/PassOwnPtr.h> #include <wtf/RefPtr.h> @@ -51,7 +51,7 @@ class AsyncFileSystemCallbacks; class ScriptExecutionContext; class WorkerContext; -class WorkerAsyncFileSystemChromium : public AsyncFileSystem { +class WorkerAsyncFileSystemChromium : public AsyncFileSystemChromium { public: static PassOwnPtr<AsyncFileSystem> create(ScriptExecutionContext* context, AsyncFileSystem::Type type, const WebKit::WebURL& rootURL, bool synchronous) { @@ -80,17 +80,12 @@ private: PassRefPtr<WebKit::WorkerFileSystemCallbacksBridge> createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks>); - // Converts a given absolute virtual path to a full origin-qualified FileSystem URL. - KURL virtualPathToFileSystemURL(const String& virtualPath) const; - ScriptExecutionContext* m_scriptExecutionContext; - WebKit::WebFileSystem* m_webFileSystem; WebKit::WebWorkerBase* m_worker; WorkerContext* m_workerContext; RefPtr<WebKit::WorkerFileSystemCallbacksBridge> m_bridgeForCurrentOperation; String m_modeForCurrentOperation; bool m_synchronous; - KURL m_filesystemRootURL; }; } // namespace WebCore diff --git a/Source/WebKit/chromium/src/js/Tests.js b/Source/WebKit/chromium/src/js/Tests.js index f27db1bf0..a41eefdd0 100644 --- a/Source/WebKit/chromium/src/js/Tests.js +++ b/Source/WebKit/chromium/src/js/Tests.js @@ -744,7 +744,7 @@ TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callb if (test._scriptsAreParsed(expectedScripts)) callback(); else - test.addSniffer(WebInspector.panels.scripts, "_addOptionToFilesSelect", waitForAllScripts); + test.addSniffer(WebInspector.panels.scripts, "_uiSourceCodeAdded", waitForAllScripts); } waitForAllScripts(); diff --git a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm index f84df986c..f719f2d5e 100644 --- a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm +++ b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm @@ -43,7 +43,8 @@ enum { NSEventPhaseStationary = 0x1 << 1, NSEventPhaseChanged = 0x1 << 2, NSEventPhaseEnded = 0x1 << 3, - NSEventPhaseCancelled = 0x1 << 4 + NSEventPhaseCancelled = 0x1 << 4, + NSEventPhaseMayBegin = 0x1 << 5 }; typedef NSUInteger NSEventPhase; diff --git a/Source/WebKit/chromium/src/painting/PaintAggregator.cpp b/Source/WebKit/chromium/src/painting/PaintAggregator.cpp new file mode 100644 index 000000000..2f7e4c73c --- /dev/null +++ b/Source/WebKit/chromium/src/painting/PaintAggregator.cpp @@ -0,0 +1,374 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * 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 "PaintAggregator.h" + +#include "WebKit.h" +#include "platform/WebKitPlatformSupport.h" + +using namespace WebCore; + +namespace WebKit { + +// ---------------------------------------------------------------------------- +// ALGORITHM NOTES +// +// We attempt to maintain a scroll rect in the presence of invalidations that +// are contained within the scroll rect. If an invalidation crosses a scroll +// rect, then we just treat the scroll rect as an invalidation rect. +// +// For invalidations performed prior to scrolling and contained within the +// scroll rect, we offset the invalidation rects to account for the fact that +// the consumer will perform scrolling before painting. +// +// We only support scrolling along one axis at a time. A diagonal scroll will +// therefore be treated as an invalidation. +// ---------------------------------------------------------------------------- + +// If the combined area of paint rects contained within the scroll rect grows +// too large, then we might as well just treat the scroll rect as a paint rect. +// This constant sets the max ratio of paint rect area to scroll rect area that +// we will tolerate before dograding the scroll into a repaint. +static const float maxRedundantPaintToScrollArea = 0.8f; + +// The maximum number of paint rects. If we exceed this limit, then we'll +// start combining paint rects (see CombinePaintRects). This limiting is +// important since the WebKit code associated with deciding what to paint given +// a paint rect can be significant. +static const size_t maxPaintRects = 5; + +// If the combined area of paint rects divided by the area of the union of all +// paint rects exceeds this threshold, then we will combine the paint rects. +static const float maxPaintRectsAreaRatio = 0.7f; + +static int calculateArea(const IntRect& rect) +{ + return rect.size().width() * rect.size().height(); +} + +// Subtracts out the intersection of |a| and |b| from |a|, assuming |b| fully +// overlaps with |a| in either the x- or y-direction. If there is no full +// overlap, then |a| is returned. +static IntRect subtractIntersection(const IntRect& a, const IntRect& b) +{ + // boundary cases: + if (!a.intersects(b)) + return a; + if (b.contains(a)) + return IntRect(); + + int rx = a.x(); + int ry = a.y(); + int rr = a.maxX(); + int rb = a.maxY(); + + if (b.y() <= a.y() && b.maxY() >= a.maxY()) { + // complete intersection in the y-direction + if (b.x() <= a.x()) + rx = b.maxX(); + else + rr = b.x(); + } else if (b.x() <= a.x() && b.maxX() >= a.maxX()) { + // complete intersection in the x-direction + if (b.y() <= a.y()) + ry = b.maxY(); + else + rb = b.y(); + } + return IntRect(rx, ry, rr - rx, rb - ry); +} + +// Returns true if |a| and |b| share an entire edge (i.e., same width or same +// height), and the rectangles do not overlap. +static bool sharesEdge(const IntRect& a, const IntRect& b) +{ + return (a.y() == b.y() && a.height() == b.height() && (a.x() == b.maxX() || a.maxX() == b.x())) + || (a.x() == b.x() && a.width() == b.width() && (a.y() == b.maxY() || a.maxY() == b.y())); +} + +PaintAggregator::PendingUpdate::PendingUpdate() +{ +} + +PaintAggregator::PendingUpdate::~PendingUpdate() +{ +} + +IntRect PaintAggregator::PendingUpdate::calculateScrollDamage() const +{ + // Should only be scrolling in one direction at a time. + ASSERT(!(scrollDelta.x() && scrollDelta.y())); + + IntRect damagedRect; + + // Compute the region we will expose by scrolling, and paint that into a + // shared memory section. + if (scrollDelta.x()) { + int dx = scrollDelta.x(); + damagedRect.setY(scrollRect.y()); + damagedRect.setHeight(scrollRect.height()); + if (dx > 0) { + damagedRect.setX(scrollRect.x()); + damagedRect.setWidth(dx); + } else { + damagedRect.setX(scrollRect.maxX() + dx); + damagedRect.setWidth(-dx); + } + } else { + int dy = scrollDelta.y(); + damagedRect.setX(scrollRect.x()); + damagedRect.setWidth(scrollRect.width()); + if (dy > 0) { + damagedRect.setY(scrollRect.y()); + damagedRect.setHeight(dy); + } else { + damagedRect.setY(scrollRect.maxY() + dy); + damagedRect.setHeight(-dy); + } + } + + // In case the scroll offset exceeds the width/height of the scroll rect + return intersection(scrollRect, damagedRect); +} + +IntRect PaintAggregator::PendingUpdate::calculatePaintBounds() const +{ + IntRect bounds; + for (size_t i = 0; i < paintRects.size(); ++i) + bounds.unite(paintRects[i]); + return bounds; +} + +bool PaintAggregator::hasPendingUpdate() const +{ + return !m_update.scrollRect.isEmpty() || !m_update.paintRects.isEmpty(); +} + +void PaintAggregator::clearPendingUpdate() +{ + m_update = PendingUpdate(); +} + +void PaintAggregator::popPendingUpdate(PendingUpdate* update) +{ + // Combine paint rects if their combined area is not sufficiently less than + // the area of the union of all paint rects. We skip this if there is a + // scroll rect since scrolling benefits from smaller paint rects. + if (m_update.scrollRect.isEmpty() && m_update.paintRects.size() > 1) { + int paintArea = 0; + IntRect unionRect; + for (size_t i = 0; i < m_update.paintRects.size(); ++i) { + paintArea += calculateArea(m_update.paintRects[i]); + unionRect.unite(m_update.paintRects[i]); + } + int unionArea = calculateArea(unionRect); + if (float(paintArea) / float(unionArea) > maxPaintRectsAreaRatio) + combinePaintRects(); + } + *update = m_update; + clearPendingUpdate(); +} + +void PaintAggregator::invalidateRect(const IntRect& rect) +{ + // Combine overlapping paints using smallest bounding box. + for (size_t i = 0; i < m_update.paintRects.size(); ++i) { + const IntRect& existingRect = m_update.paintRects[i]; + if (existingRect.contains(rect)) // Optimize out redundancy. + return; + if (rect.intersects(existingRect) || sharesEdge(rect, existingRect)) { + // Re-invalidate in case the union intersects other paint rects. + IntRect combinedRect = unionRect(existingRect, rect); + m_update.paintRects.remove(i); + invalidateRect(combinedRect); + return; + } + } + + // Add a non-overlapping paint. + m_update.paintRects.append(rect); + + // If the new paint overlaps with a scroll, then it forces an invalidation of + // the scroll. If the new paint is contained by a scroll, then trim off the + // scroll damage to avoid redundant painting. + if (!m_update.scrollRect.isEmpty()) { + if (shouldInvalidateScrollRect(rect)) + invalidateScrollRect(); + else if (m_update.scrollRect.contains(rect)) { + m_update.paintRects[m_update.paintRects.size() - 1] = + subtractIntersection(rect, m_update.calculateScrollDamage()); + if (m_update.paintRects[m_update.paintRects.size() - 1].isEmpty()) + m_update.paintRects.remove(m_update.paintRects.size() - 1); + } + } + + if (m_update.paintRects.size() > maxPaintRects) + combinePaintRects(); + + // Track how large the paintRects vector grows during an invalidation + // sequence. Note: A subsequent invalidation may end up being combined + // with all existing paints, which means that tracking the size of + // paintRects at the time when popPendingUpdate() is called may mask + // certain performance problems. + webKitPlatformSupport()->histogramCustomCounts("MPArch.RW_IntermediatePaintRectCount", + m_update.paintRects.size(), 1, 100, 50); +} + +void PaintAggregator::scrollRect(int dx, int dy, const IntRect& clipRect) +{ + // We only support scrolling along one axis at a time. + if (dx && dy) { + invalidateRect(clipRect); + return; + } + + // We can only scroll one rect at a time. + if (!m_update.scrollRect.isEmpty() && m_update.scrollRect != clipRect) { + invalidateRect(clipRect); + return; + } + + // Again, we only support scrolling along one axis at a time. Make sure this + // update doesn't scroll on a different axis than any existing one. + if ((dx && m_update.scrollDelta.y()) || (dy && m_update.scrollDelta.x())) { + invalidateRect(clipRect); + return; + } + + // The scroll rect is new or isn't changing (though the scroll amount may + // be changing). + m_update.scrollRect = clipRect; + m_update.scrollDelta.move(dx, dy); + + // We might have just wiped out a pre-existing scroll. + if (m_update.scrollDelta == IntPoint()) { + m_update.scrollRect = IntRect(); + return; + } + + // Adjust any contained paint rects and check for any overlapping paints. + for (size_t i = 0; i < m_update.paintRects.size(); ++i) { + if (m_update.scrollRect.contains(m_update.paintRects[i])) { + m_update.paintRects[i] = scrollPaintRect(m_update.paintRects[i], dx, dy); + // The rect may have been scrolled out of view. + if (m_update.paintRects[i].isEmpty()) { + m_update.paintRects.remove(i); + i--; + } + } else if (m_update.scrollRect.intersects(m_update.paintRects[i])) { + invalidateScrollRect(); + return; + } + } + + // If the new scroll overlaps too much with contained paint rects, then force + // an invalidation of the scroll. + if (shouldInvalidateScrollRect(IntRect())) + invalidateScrollRect(); +} + +IntRect PaintAggregator::scrollPaintRect(const IntRect& paintRect, int dx, int dy) const +{ + IntRect result = paintRect; + + result.move(dx, dy); + result = intersection(m_update.scrollRect, result); + + // Subtract out the scroll damage rect to avoid redundant painting. + return subtractIntersection(result, m_update.calculateScrollDamage()); +} + +bool PaintAggregator::shouldInvalidateScrollRect(const IntRect& rect) const +{ + if (!rect.isEmpty()) { + if (!m_update.scrollRect.intersects(rect)) + return false; + + if (!m_update.scrollRect.contains(rect)) + return true; + } + + // Check if the combined area of all contained paint rects plus this new + // rect comes too close to the area of the scrollRect. If so, then we + // might as well invalidate the scroll rect. + + int paintArea = calculateArea(rect); + for (size_t i = 0; i < m_update.paintRects.size(); ++i) { + const IntRect& existingRect = m_update.paintRects[i]; + if (m_update.scrollRect.contains(existingRect)) + paintArea += calculateArea(existingRect); + } + int scrollArea = calculateArea(m_update.scrollRect); + if (float(paintArea) / float(scrollArea) > maxRedundantPaintToScrollArea) + return true; + + return false; +} + +void PaintAggregator::invalidateScrollRect() +{ + IntRect scrollRect = m_update.scrollRect; + m_update.scrollRect = IntRect(); + m_update.scrollDelta = IntPoint(); + invalidateRect(scrollRect); +} + +void PaintAggregator::combinePaintRects() +{ + // Combine paint rects do to at most two rects: one inside the scrollRect + // and one outside the scrollRect. If there is no scrollRect, then just + // use the smallest bounding box for all paint rects. + // + // NOTE: This is a fairly simple algorithm. We could get fancier by only + // combining two rects to get us under the maxPaintRects limit, but if we + // reach this method then it means we're hitting a rare case, so there's no + // need to over-optimize it. + // + if (m_update.scrollRect.isEmpty()) { + IntRect bounds = m_update.calculatePaintBounds(); + m_update.paintRects.clear(); + m_update.paintRects.append(bounds); + } else { + IntRect inner, outer; + for (size_t i = 0; i < m_update.paintRects.size(); ++i) { + const IntRect& existingRect = m_update.paintRects[i]; + if (m_update.scrollRect.contains(existingRect)) + inner.unite(existingRect); + else + outer.unite(existingRect); + } + m_update.paintRects.clear(); + m_update.paintRects.append(inner); + m_update.paintRects.append(outer); + } +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/painting/PaintAggregator.h b/Source/WebKit/chromium/src/painting/PaintAggregator.h new file mode 100644 index 000000000..f083e4017 --- /dev/null +++ b/Source/WebKit/chromium/src/painting/PaintAggregator.h @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef PaintAggregator_h +#define PaintAggregator_h + +#include "IntPoint.h" +#include "IntRect.h" +#include <wtf/Vector.h> + +namespace WebKit { + +// This class is responsible for aggregating multiple invalidation and scroll +// commands to produce a scroll and repaint sequence. +class PaintAggregator { +public: + // This structure describes an aggregation of invalidateRect and scrollRect + // calls. If |scrollRect| is non-empty, then that rect should be scrolled + // by the amount specified by |scrollDelta|. If |paintRects| is non-empty, + // then those rects should be repainted. If |scrollRect| and |paintRects| + // are non-empty, then scrolling should be performed before repainting. + // |scrollDelta| can only specify scrolling in one direction (i.e., the x + // and y members cannot both be non-zero). + struct PendingUpdate { + PendingUpdate(); + ~PendingUpdate(); + + // Returns the rect damaged by scrolling within |scrollRect| by + // |scrollDelta|. This rect must be repainted. + WebCore::IntRect calculateScrollDamage() const; + + // Returns the smallest rect containing all paint rects. + WebCore::IntRect calculatePaintBounds() const; + + WebCore::IntPoint scrollDelta; + WebCore::IntRect scrollRect; + WTF::Vector<WebCore::IntRect> paintRects; + }; + + // There is a PendingUpdate if invalidateRect or scrollRect were called and + // ClearPendingUpdate was not called. + bool hasPendingUpdate() const; + void clearPendingUpdate(); + + // Fills |update| and clears the pending update. + void popPendingUpdate(PendingUpdate*); + + // The given rect should be repainted. + void invalidateRect(const WebCore::IntRect&); + + // The given rect should be scrolled by the given amounts. + void scrollRect(int dx, int dy, const WebCore::IntRect& clipRect); + +private: + WebCore::IntRect scrollPaintRect(const WebCore::IntRect& paintRect, int dx, int dy) const; + bool shouldInvalidateScrollRect(const WebCore::IntRect&) const; + void invalidateScrollRect(); + void combinePaintRects(); + + PendingUpdate m_update; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/src/win/WebScreenInfoFactory.cpp b/Source/WebKit/chromium/src/win/WebScreenInfoFactory.cpp index 9263deac7..5a6c11214 100644 --- a/Source/WebKit/chromium/src/win/WebScreenInfoFactory.cpp +++ b/Source/WebKit/chromium/src/win/WebScreenInfoFactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2009, 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 @@ -31,6 +31,7 @@ #include "config.h" #include "WebScreenInfoFactory.h" +#include "HWndDC.h" #include "WebScreenInfo.h" #include <windows.h> @@ -60,7 +61,8 @@ WebScreenInfo WebScreenInfoFactory::screenInfo(HWND window) devMode.dmDriverExtra = 0; EnumDisplaySettings(monitorInfo.szDevice, ENUM_CURRENT_SETTINGS, &devMode); - HDC hdc = GetDC(0); + WebCore::HWndDC hdc(0); + ASSERT(hdc); WebScreenInfo results; results.horizontalDPI = GetDeviceCaps(hdc, LOGPIXELSX); diff --git a/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp b/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp index 62d12b400..677865ac0 100644 --- a/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp +++ b/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp @@ -40,6 +40,7 @@ #include "platform/WebURLLoaderClient.h" #include "platform/WebURLRequest.h" #include "platform/WebURLResponse.h" +#include <wtf/text/WTFString.h> #include <googleurl/src/gurl.h> #include <gtest/gtest.h> @@ -137,6 +138,7 @@ public: void didReceiveResponse(WebURLLoader* loader, const WebURLResponse& response) { m_didReceiveResponse = true; + m_actualResponse = WebURLResponse(response); EXPECT_EQ(m_expectedLoader, loader); EXPECT_EQ(m_expectedResponse.url(), response.url()); EXPECT_EQ(m_expectedResponse.httpStatusCode(), response.httpStatusCode()); @@ -220,12 +222,49 @@ public: EXPECT_FALSE(m_didReceiveResponse); } + bool CheckAccessControlHeaders(const char* headerName, bool exposed) + { + std::string id("http://www.other.com/CheckAccessControlExposeHeaders_"); + id.append(headerName); + if (exposed) + id.append("-Exposed"); + id.append(".html"); + + GURL url = GURL(id); + WebURLRequest request; + request.initialize(); + request.setURL(url); + + WebString headerNameString(WebString::fromUTF8(headerName)); + m_expectedResponse = WebURLResponse(); + m_expectedResponse.initialize(); + m_expectedResponse.setMIMEType("text/html"); + m_expectedResponse.addHTTPHeaderField("Access-Control-Allow-Origin", "*"); + if (exposed) + m_expectedResponse.addHTTPHeaderField("access-control-expose-header", headerNameString); + m_expectedResponse.addHTTPHeaderField(headerNameString, "foo"); + webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath); + + WebURLLoaderOptions options; + options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl; + m_expectedLoader = createAssociatedURLLoader(options); + EXPECT_TRUE(m_expectedLoader); + m_expectedLoader->loadAsynchronously(request, this); + serveRequests(); + EXPECT_TRUE(m_didReceiveResponse); + EXPECT_TRUE(m_didReceiveData); + EXPECT_TRUE(m_didFinishLoading); + + return !m_actualResponse.httpHeaderField(headerNameString).isEmpty(); + } + protected: WebString m_frameFilePath; TestWebFrameClient m_webFrameClient; WebView* m_webView; WebURLLoader* m_expectedLoader; + WebURLResponse m_actualResponse; WebURLResponse m_expectedResponse; WebURLRequest m_expectedNewRequest; WebURLResponse m_expectedRedirectResponse; @@ -487,4 +526,29 @@ TEST_F(AssociatedURLLoaderTest, UntrustedCheckHeaders) CheckHeaderFails("foo", "bar\x0d\x0ax-csrf-token:\x20test1234"); } +// Test that the loader filters response headers according to the CORS standard. +TEST_F(AssociatedURLLoaderTest, CrossOriginHeaderWhitelisting) +{ + // Test that whitelisted headers are returned without exposing them. + EXPECT_TRUE(CheckAccessControlHeaders("cache-control", false)); + EXPECT_TRUE(CheckAccessControlHeaders("content-language", false)); + EXPECT_TRUE(CheckAccessControlHeaders("content-type", false)); + EXPECT_TRUE(CheckAccessControlHeaders("expires", false)); + EXPECT_TRUE(CheckAccessControlHeaders("last-modified", false)); + EXPECT_TRUE(CheckAccessControlHeaders("pragma", false)); + + // Test that non-whitelisted headers aren't returned. + EXPECT_FALSE(CheckAccessControlHeaders("non-whitelisted", false)); + + // Test that Set-Cookie headers aren't returned. + EXPECT_FALSE(CheckAccessControlHeaders("Set-Cookie", false)); + EXPECT_FALSE(CheckAccessControlHeaders("Set-Cookie2", false)); + + // Test that exposed headers that aren't whitelisted are returned. + EXPECT_TRUE(CheckAccessControlHeaders("non-whitelisted", true)); + + // Test that Set-Cookie headers aren't returned, even if exposed. + EXPECT_FALSE(CheckAccessControlHeaders("Set-Cookie", true)); +} + } diff --git a/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp b/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp new file mode 100644 index 000000000..3e93d95de --- /dev/null +++ b/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp @@ -0,0 +1,167 @@ +/* + * 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 "cc/CCActiveAnimation.h" + +#include "cc/CCAnimationCurve.h" + +#include <gmock/gmock.h> +#include <gtest/gtest.h> +#include <wtf/Vector.h> + +namespace WebCore { + +class FakeFloatAnimation : public CCFloatAnimationCurve { +public: + virtual double duration() const { return 1; } + virtual float getValue(double now) const { return 0; } +}; + +PassOwnPtr<CCActiveAnimation> createActiveAnimation(int iterations) +{ + OwnPtr<CCActiveAnimation> toReturn(CCActiveAnimation::create(adoptPtr(new FakeFloatAnimation), 1, CCActiveAnimation::Opacity)); + toReturn->setIterations(iterations); + return toReturn.release(); +} + +TEST(CCActiveAnimationTest, TrimTimeZeroIterations) +{ + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(0)); + EXPECT_EQ(0, anim->trimTimeToCurrentIteration(-1)); + EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); + EXPECT_EQ(0, anim->trimTimeToCurrentIteration(1)); +} + +TEST(CCActiveAnimationTest, TrimTimeOneIteration) +{ + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); + EXPECT_EQ(0, anim->trimTimeToCurrentIteration(-1)); + EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); + EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1)); + EXPECT_EQ(1, anim->trimTimeToCurrentIteration(2)); +} + +TEST(CCActiveAnimationTest, TrimTimeInfiniteIterations) +{ + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(-1)); + EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); + EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); + EXPECT_EQ(0, anim->trimTimeToCurrentIteration(1)); + EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1.5)); +} + +TEST(CCActiveAnimationTest, TrimTimeStartTime) +{ + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); + anim->setStartTime(4); + EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); + EXPECT_EQ(0, anim->trimTimeToCurrentIteration(4)); + EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(4.5)); + EXPECT_EQ(1, anim->trimTimeToCurrentIteration(5)); + EXPECT_EQ(1, anim->trimTimeToCurrentIteration(6)); +} + +TEST(CCActiveAnimationTest, TrimTimePauseResume) +{ + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); + anim->setRunState(CCActiveAnimation::Running, 0); + EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); + EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); + anim->setRunState(CCActiveAnimation::Paused, 0.5); + EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1024)); + anim->setRunState(CCActiveAnimation::Running, 1024); + EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1024)); + EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1024.5)); +} + +TEST(CCActiveAnimationTest, IsFinishedAtZeroIterations) +{ + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(0)); + anim->setRunState(CCActiveAnimation::Running, 0); + EXPECT_FALSE(anim->isFinishedAt(-1)); + EXPECT_TRUE(anim->isFinishedAt(0)); + EXPECT_TRUE(anim->isFinishedAt(1)); +} + +TEST(CCActiveAnimationTest, IsFinishedAtOneIteration) +{ + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); + anim->setRunState(CCActiveAnimation::Running, 0); + EXPECT_FALSE(anim->isFinishedAt(-1)); + EXPECT_FALSE(anim->isFinishedAt(0)); + EXPECT_TRUE(anim->isFinishedAt(1)); + EXPECT_TRUE(anim->isFinishedAt(2)); +} + +TEST(CCActiveAnimationTest, IsFinishedAtInfiniteIterations) +{ + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(-1)); + anim->setRunState(CCActiveAnimation::Running, 0); + EXPECT_FALSE(anim->isFinishedAt(0)); + EXPECT_FALSE(anim->isFinishedAt(0.5)); + EXPECT_FALSE(anim->isFinishedAt(1)); + EXPECT_FALSE(anim->isFinishedAt(1.5)); +} + +TEST(CCActiveAnimationTest, IsFinishedAtNotRunning) +{ + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(0)); + anim->setRunState(CCActiveAnimation::Running, 0); + EXPECT_TRUE(anim->isFinishedAt(0)); + anim->setRunState(CCActiveAnimation::Paused, 0); + EXPECT_FALSE(anim->isFinishedAt(0)); + anim->setRunState(CCActiveAnimation::WaitingForNextTick, 0); + EXPECT_FALSE(anim->isFinishedAt(0)); + anim->setRunState(CCActiveAnimation::WaitingForTargetAvailability, 0); + EXPECT_FALSE(anim->isFinishedAt(0)); + anim->setRunState(CCActiveAnimation::WaitingForStartTime, 0); + EXPECT_FALSE(anim->isFinishedAt(0)); + anim->setRunState(CCActiveAnimation::Finished, 0); + EXPECT_TRUE(anim->isFinishedAt(0)); + anim->setRunState(CCActiveAnimation::Aborted, 0); + EXPECT_TRUE(anim->isFinishedAt(0)); +} + +TEST(CCActiveAnimationTest, IsFinished) +{ + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); + anim->setRunState(CCActiveAnimation::Running, 0); + EXPECT_FALSE(anim->isFinished()); + anim->setRunState(CCActiveAnimation::Paused, 0); + EXPECT_FALSE(anim->isFinished()); + anim->setRunState(CCActiveAnimation::WaitingForNextTick, 0); + EXPECT_FALSE(anim->isFinished()); + anim->setRunState(CCActiveAnimation::WaitingForTargetAvailability, 0); + EXPECT_FALSE(anim->isFinished()); + anim->setRunState(CCActiveAnimation::WaitingForStartTime, 0); + EXPECT_FALSE(anim->isFinished()); + anim->setRunState(CCActiveAnimation::Finished, 0); + EXPECT_TRUE(anim->isFinished()); + anim->setRunState(CCActiveAnimation::Aborted, 0); + EXPECT_TRUE(anim->isFinished()); +} + +} // namespace WebCore diff --git a/Source/WebKit/chromium/tests/CCDelayBasedTimeSourceTest.cpp b/Source/WebKit/chromium/tests/CCDelayBasedTimeSourceTest.cpp index 41c9d119e..867d56ea8 100644 --- a/Source/WebKit/chromium/tests/CCDelayBasedTimeSourceTest.cpp +++ b/Source/WebKit/chromium/tests/CCDelayBasedTimeSourceTest.cpp @@ -46,10 +46,12 @@ TEST(CCDelayBasedTimeSourceTest, TaskPostedAndTickCalled) timer->setMonotonicallyIncreasingTimeMs(0); timer->setActive(true); + EXPECT_TRUE(timer->active()); EXPECT_TRUE(thread.hasPendingTask()); timer->setMonotonicallyIncreasingTimeMs(16); thread.runPendingTask(); + EXPECT_TRUE(timer->active()); EXPECT_TRUE(client.tickCalled()); } diff --git a/Source/WebKit/chromium/tests/CCLayerAnimationControllerImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerAnimationControllerImplTest.cpp new file mode 100644 index 000000000..3d50d06e6 --- /dev/null +++ b/Source/WebKit/chromium/tests/CCLayerAnimationControllerImplTest.cpp @@ -0,0 +1,454 @@ +/* + * 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 "cc/CCLayerAnimationControllerImpl.h" + +#include "TransformOperations.h" +#include "cc/CCAnimationCurve.h" + +#include <gmock/gmock.h> +#include <gtest/gtest.h> +#include <wtf/Vector.h> + +using namespace WebCore; + +namespace { + +class FakeControllerClient : public CCLayerAnimationControllerImplClient { +public: + FakeControllerClient() : m_opacity(0) { } + virtual ~FakeControllerClient() { } + + virtual float opacity() const { return m_opacity; } + virtual void setOpacity(float opacity) { m_opacity = opacity; } + virtual const TransformationMatrix& transform() const { return m_transform; } + virtual void setTransform(const TransformationMatrix& transform) { m_transform = transform; } + virtual void animationControllerImplDidActivate(CCLayerAnimationControllerImpl* controller) + { + m_activeControllers.append(controller); + } + + Vector<CCLayerAnimationControllerImpl*>& activeControllers() { return m_activeControllers; } + +private: + float m_opacity; + TransformationMatrix m_transform; + Vector<CCLayerAnimationControllerImpl*> m_activeControllers; +}; + +class FakeTransformTransition : public CCTransformAnimationCurve { +public: + FakeTransformTransition(double duration) : m_duration(duration) { } + virtual double duration() const { return m_duration; } + virtual TransformOperations getValue(double time) const + { + return TransformOperations(); + } + +private: + double m_duration; +}; + +class FakeFloatTransition : public CCFloatAnimationCurve { +public: + FakeFloatTransition(double duration, float from, float to) + : m_duration(duration) + , m_from(from) + , m_to(to) + { + } + + virtual double duration() const { return m_duration; } + virtual float getValue(double time) const + { + time /= m_duration; + if (time >= 1) + time = 1; + return (1 - time) * m_from + time * m_to; + } + +private: + double m_duration; + float m_from; + float m_to; +}; + +// Tests that transitioning opacity from 0 to 1 works as expected. +TEST(CCLayerAnimationControllerImplTest, TrivialTransition) +{ + FakeControllerClient dummy; + OwnPtr<CCLayerAnimationControllerImpl> controller( + CCLayerAnimationControllerImpl::create(&dummy)); + + OwnPtr<CCActiveAnimation> toAdd(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity)); + + controller->add(toAdd.release()); + controller->animate(0); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0, dummy.opacity()); + controller->animate(1); + EXPECT_EQ(1, dummy.opacity()); + EXPECT_FALSE(controller->hasActiveAnimation()); +} + +// Tests that two queued animations affecting the same property run in sequence. +TEST(CCLayerAnimationControllerImplTest, TrivialQueuing) +{ + FakeControllerClient dummy; + OwnPtr<CCLayerAnimationControllerImpl> controller( + CCLayerAnimationControllerImpl::create(&dummy)); + + controller->add(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity)); + controller->add(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(1, 1, 0.5f)), 2, CCActiveAnimation::Opacity)); + + controller->animate(0); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0, dummy.opacity()); + controller->animate(1); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(1, dummy.opacity()); + controller->animate(2); + EXPECT_EQ(0.5f, dummy.opacity()); + EXPECT_FALSE(controller->hasActiveAnimation()); +} + +// Tests interrupting a transition with another transition. +TEST(CCLayerAnimationControllerImplTest, Interrupt) +{ + FakeControllerClient dummy; + OwnPtr<CCLayerAnimationControllerImpl> controller( + CCLayerAnimationControllerImpl::create(&dummy)); + controller->add(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity)); + controller->animate(0); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0, dummy.opacity()); + + OwnPtr<CCActiveAnimation> toAdd(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(1, 1, 0.5f)), 2, CCActiveAnimation::Opacity)); + toAdd->setRunState(CCActiveAnimation::WaitingForNextTick, 0); + controller->add(toAdd.release()); + + controller->animate(0.5); // second anim starts NOW. + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(1, dummy.opacity()); + controller->animate(1.5); + EXPECT_EQ(0.5f, dummy.opacity()); + EXPECT_FALSE(controller->hasActiveAnimation()); +} + +// Tests scheduling two animations to run together when only one property is free. +TEST(CCLayerAnimationControllerImplTest, ScheduleTogetherWhenAPropertyIsBlocked) +{ + FakeControllerClient dummy; + OwnPtr<CCLayerAnimationControllerImpl> controller( + CCLayerAnimationControllerImpl::create(&dummy)); + + controller->add(CCActiveAnimation::create(adoptPtr(new FakeTransformTransition(1)), 1, CCActiveAnimation::Transform)); + controller->add(CCActiveAnimation::create(adoptPtr(new FakeTransformTransition(1)), 2, CCActiveAnimation::Transform)); + controller->add(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(1, 0, 1)), 2, CCActiveAnimation::Opacity)); + + controller->animate(0); + EXPECT_EQ(0, dummy.opacity()); + EXPECT_TRUE(controller->hasActiveAnimation()); + controller->animate(1); + // Should not have started the float transition yet. + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0, dummy.opacity()); + // The the float animation should have started at time 1 and should be done. + controller->animate(2); + EXPECT_EQ(1, dummy.opacity()); + EXPECT_FALSE(controller->hasActiveAnimation()); +} + +// Tests scheduling two animations to run together with different lengths and another +// animation queued to start when the shorter animation finishes (should wait +// for both to finish). +TEST(CCLayerAnimationControllerImplTest, ScheduleTogetherWithAnAnimWaiting) +{ + FakeControllerClient dummy; + OwnPtr<CCLayerAnimationControllerImpl> controller( + CCLayerAnimationControllerImpl::create(&dummy)); + + controller->add(CCActiveAnimation::create(adoptPtr(new FakeTransformTransition(2)), 1, CCActiveAnimation::Transform)); + controller->add(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity)); + controller->add(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(1, 1, 0.5f)), 2, CCActiveAnimation::Opacity)); + + // Anims with id 1 should both start now. + controller->animate(0); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0, dummy.opacity()); + // The opacity animation should have finished at time 1, but the group + // of animations with id 1 don't finish until time 2 because of the length + // of the transform animation. + controller->animate(2); + // Should not have started the float transition yet. + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(1, dummy.opacity()); + + // The the second opacity animation should start at time 2 and should be + // done by time 3 + controller->animate(3); + EXPECT_EQ(0.5f, dummy.opacity()); + EXPECT_FALSE(controller->hasActiveAnimation()); +} + +// Tests scheduling an animation to start in the future. +TEST(CCLayerAnimationControllerImplTest, ScheduleAnimation) +{ + FakeControllerClient dummy; + OwnPtr<CCLayerAnimationControllerImpl> controller( + CCLayerAnimationControllerImpl::create(&dummy)); + + OwnPtr<CCActiveAnimation> toAdd(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity)); + toAdd->setRunState(CCActiveAnimation::WaitingForStartTime, 0); + toAdd->setStartTime(1); + controller->add(toAdd.release()); + + controller->animate(0); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0, dummy.opacity()); + controller->animate(1); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0, dummy.opacity()); + controller->animate(2); + EXPECT_EQ(1, dummy.opacity()); + EXPECT_FALSE(controller->hasActiveAnimation()); +} + +// Tests scheduling an animation to start in the future that's interrupting a running animation. +TEST(CCLayerAnimationControllerImplTest, ScheduledAnimationInterruptsRunningAnimation) +{ + FakeControllerClient dummy; + OwnPtr<CCLayerAnimationControllerImpl> controller( + CCLayerAnimationControllerImpl::create(&dummy)); + + controller->add(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(2, 0, 1)), 1, CCActiveAnimation::Opacity)); + + OwnPtr<CCActiveAnimation> toAdd(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(1, 0.5f, 0)), 2, CCActiveAnimation::Opacity)); + toAdd->setRunState(CCActiveAnimation::WaitingForStartTime, 0); + toAdd->setStartTime(1); + controller->add(toAdd.release()); + + // First 2s opacity transition should start immediately. + controller->animate(0); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0, dummy.opacity()); + controller->animate(0.5); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0.25f, dummy.opacity()); + controller->animate(1); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0.5f, dummy.opacity()); + controller->animate(2); + EXPECT_EQ(0, dummy.opacity()); + EXPECT_FALSE(controller->hasActiveAnimation()); +} + +// Tests scheduling an animation to start in the future that interrupts a running animation +// and there is yet another animation queued to start later. +TEST(CCLayerAnimationControllerImplTest, ScheduledAnimationInterruptsRunningAnimationWithAnimInQueue) +{ + FakeControllerClient dummy; + OwnPtr<CCLayerAnimationControllerImpl> controller( + CCLayerAnimationControllerImpl::create(&dummy)); + + controller->add(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(2, 0, 1)), 1, CCActiveAnimation::Opacity)); + + OwnPtr<CCActiveAnimation> toAdd(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(2, 0.5f, 0)), 2, CCActiveAnimation::Opacity)); + toAdd->setRunState(CCActiveAnimation::WaitingForStartTime, 0); + toAdd->setStartTime(1); + controller->add(toAdd.release()); + + controller->add(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(1, 0, 0.75f)), 3, CCActiveAnimation::Opacity)); + + // First 2s opacity transition should start immediately. + controller->animate(0); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0, dummy.opacity()); + controller->animate(0.5); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0.25f, dummy.opacity()); + EXPECT_TRUE(controller->hasActiveAnimation()); + controller->animate(1); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0.5f, dummy.opacity()); + controller->animate(3); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0, dummy.opacity()); + controller->animate(4); + EXPECT_EQ(0.75f, dummy.opacity()); + EXPECT_FALSE(controller->hasActiveAnimation()); +} + +// Test that a looping animation loops and for the correct number of iterations. +TEST(CCLayerAnimationControllerImplTest, TrivialLooping) +{ + FakeControllerClient dummy; + OwnPtr<CCLayerAnimationControllerImpl> controller( + CCLayerAnimationControllerImpl::create(&dummy)); + + OwnPtr<CCActiveAnimation> toAdd(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity)); + toAdd->setIterations(3); + controller->add(toAdd.release()); + + controller->animate(0); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0, dummy.opacity()); + controller->animate(1.25); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0.25f, dummy.opacity()); + controller->animate(1.75); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0.75f, dummy.opacity()); + controller->animate(2.25); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0.25f, dummy.opacity()); + controller->animate(2.75); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0.75f, dummy.opacity()); + controller->animate(3); + EXPECT_FALSE(controller->hasActiveAnimation()); + EXPECT_EQ(1, dummy.opacity()); + + // Just be extra sure. + controller->animate(4); + EXPECT_EQ(1, dummy.opacity()); +} + +// Test that an infinitely looping animation does indeed go until aborted. +TEST(CCLayerAnimationControllerImplTest, InfiniteLooping) +{ + FakeControllerClient dummy; + OwnPtr<CCLayerAnimationControllerImpl> controller( + CCLayerAnimationControllerImpl::create(&dummy)); + + const int id = 1; + OwnPtr<CCActiveAnimation> toAdd(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(1, 0, 1)), id, CCActiveAnimation::Opacity)); + toAdd->setIterations(-1); + controller->add(toAdd.release()); + + controller->animate(0); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0, dummy.opacity()); + controller->animate(1.25); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0.25f, dummy.opacity()); + controller->animate(1.75); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0.75f, dummy.opacity()); + + controller->animate(1073741824.25); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0.25f, dummy.opacity()); + controller->animate(1073741824.75); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0.75f, dummy.opacity()); + + EXPECT_TRUE(controller->getActiveAnimation(id, CCActiveAnimation::Opacity)); + controller->getActiveAnimation(id, CCActiveAnimation::Opacity)->setRunState(CCActiveAnimation::Aborted, 0.75f); + EXPECT_FALSE(controller->hasActiveAnimation()); + EXPECT_EQ(0.75f, dummy.opacity()); +} + +// Test that pausing and resuming work as expected. +TEST(CCLayerAnimationControllerImplTest, PauseResume) +{ + FakeControllerClient dummy; + OwnPtr<CCLayerAnimationControllerImpl> controller( + CCLayerAnimationControllerImpl::create(&dummy)); + + const int id = 1; + controller->add(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(1, 0, 1)), id, CCActiveAnimation::Opacity)); + + controller->animate(0); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0, dummy.opacity()); + controller->animate(0.5); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0.5f, dummy.opacity()); + + EXPECT_TRUE(controller->getActiveAnimation(id, CCActiveAnimation::Opacity)); + controller->getActiveAnimation(id, CCActiveAnimation::Opacity)->setRunState(CCActiveAnimation::Paused, 0.5f); + + controller->animate(1024); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0.5f, dummy.opacity()); + + EXPECT_TRUE(controller->getActiveAnimation(id, CCActiveAnimation::Opacity)); + controller->getActiveAnimation(id, CCActiveAnimation::Opacity)->setRunState(CCActiveAnimation::Running, 1024); + + controller->animate(1024.25); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0.75f, dummy.opacity()); + controller->animate(1024.5); + EXPECT_FALSE(controller->hasActiveAnimation()); + EXPECT_EQ(1, dummy.opacity()); +} + +TEST(CCLayerAnimationControllerImplTest, AbortAGroupedAnimation) +{ + FakeControllerClient dummy; + OwnPtr<CCLayerAnimationControllerImpl> controller( + CCLayerAnimationControllerImpl::create(&dummy)); + + const int id = 1; + controller->add(CCActiveAnimation::create(adoptPtr(new FakeTransformTransition(1)), id, CCActiveAnimation::Transform)); + controller->add(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(2, 0, 1)), id, CCActiveAnimation::Opacity)); + controller->add(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(1, 1, 0.75f)), 2, CCActiveAnimation::Opacity)); + + controller->animate(0); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0, dummy.opacity()); + controller->animate(1); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(0.5f, dummy.opacity()); + + EXPECT_TRUE(controller->getActiveAnimation(id, CCActiveAnimation::Opacity)); + controller->getActiveAnimation(id, CCActiveAnimation::Opacity)->setRunState(CCActiveAnimation::Aborted, 1); + controller->animate(1); + EXPECT_TRUE(controller->hasActiveAnimation()); + EXPECT_EQ(1, dummy.opacity()); + controller->animate(2); + EXPECT_TRUE(!controller->hasActiveAnimation()); + EXPECT_EQ(0.75f, dummy.opacity()); +} + +// Tests that adding an animation to the controller calls the appropriate callback on the controller client +// (in this case, adding the controller to the list of active controller). +TEST(CCLayerAnimationControllerImplTest, DidActivate) +{ + FakeControllerClient dummy; + OwnPtr<CCLayerAnimationControllerImpl> controller( + CCLayerAnimationControllerImpl::create(&dummy)); + + EXPECT_EQ(size_t(0), dummy.activeControllers().size()); + + controller->add(CCActiveAnimation::create(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity)); + + EXPECT_EQ(size_t(1), dummy.activeControllers().size()); + EXPECT_EQ(controller.get(), dummy.activeControllers()[0]); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp index 165405d49..27728cbef 100644 --- a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp @@ -112,6 +112,7 @@ TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly) EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->setDebugBorderWidth(arbitraryNumber)); EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->setDrawsContent(true)); EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->setBackgroundColor(Color::gray)); + EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->setBackgroundCoversViewport(true)); // Special case: check that sublayer transform changes all layer's descendants, but not the layer itself. root->resetAllChangeTrackingForSubtree(); diff --git a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp index 47a6fd4dc..bff7e1ba9 100644 --- a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp @@ -52,7 +52,7 @@ public: private: TestLayerChromium() - : LayerChromium(0) + : LayerChromium() , m_drawsContent(true) { setBounds(IntSize(100, 100)); diff --git a/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp b/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp new file mode 100644 index 000000000..9fe377766 --- /dev/null +++ b/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp @@ -0,0 +1,63 @@ +/* + * 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 "CCLayerTestCommon.h" + +#include <gtest/gtest.h> +#include <wtf/Vector.h> + +using namespace WebCore; + +namespace CCLayerTestCommon { + +// Align with expected and actual output +const char* quadString = " Quad: "; + +bool completelyContains(const Region& container, const IntRect& rect) +{ + Region tester(rect); + Vector<IntRect> rects = container.rects(); + for (size_t i = 0; i < rects.size(); ++i) + tester.subtract(rects[i]); + return tester.isEmpty(); +} + +void verifyQuadsExactlyCoverRect(const CCQuadList& quads, const IntRect& rect) +{ + Region remaining(rect); + + for (size_t i = 0; i < quads.size(); ++i) { + CCDrawQuad* quad = quads[i].get(); + + EXPECT_TRUE(rect.contains(quad->quadRect())) << quadString << i; + EXPECT_TRUE(completelyContains(remaining, quad->quadRect())) << quadString << i; + remaining.subtract(Region(quad->quadRect())); + } + + EXPECT_TRUE(remaining.isEmpty()); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/CCLayerTestCommon.h b/Source/WebKit/chromium/tests/CCLayerTestCommon.h new file mode 100644 index 000000000..c5add93a9 --- /dev/null +++ b/Source/WebKit/chromium/tests/CCLayerTestCommon.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CCLayerTestCommon_h +#define CCLayerTestCommon_h + +#include "IntRect.h" +#include "Region.h" +#include "cc/CCRenderPass.h" + +namespace CCLayerTestCommon { + +extern const char* quadString; + +bool completelyContains(const WebCore::Region&, const WebCore::IntRect&); +void verifyQuadsExactlyCoverRect(const WebCore::CCQuadList&, const WebCore::IntRect&); + +} // namespace CCLayerTestCommon +#endif // CCLayerTestCommon_h diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp index a35d96522..b1fa72918 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp @@ -28,6 +28,7 @@ #include "CCLayerTreeTestCommon.h" #include "LayerChromium.h" +#include "Region.h" #include "TransformationMatrix.h" #include <gmock/gmock.h> @@ -35,6 +36,12 @@ using namespace WebCore; +#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 { void setLayerPropertiesForTesting(LayerChromium* layer, const TransformationMatrix& transform, const TransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D) @@ -71,8 +78,8 @@ TransformationMatrix remove3DComponentOfMatrix(const TransformationMatrix& mat) class LayerChromiumWithForcedDrawsContent : public LayerChromium { public: - explicit LayerChromiumWithForcedDrawsContent(CCLayerDelegate* delegate) - : LayerChromium(delegate) + LayerChromiumWithForcedDrawsContent() + : LayerChromium() { } @@ -86,9 +93,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForNoOpLayer) // screenSpaceTransform, and the hierarchy passed on to children // layers should also be identity transforms. - RefPtr<LayerChromium> parent = LayerChromium::create(0); - RefPtr<LayerChromium> child = LayerChromium::create(0); - RefPtr<LayerChromium> grandChild = LayerChromium::create(0); + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromium> child = LayerChromium::create(); + RefPtr<LayerChromium> grandChild = LayerChromium::create(); parent->createRenderSurface(); parent->addChild(child); child->addChild(grandChild); @@ -116,7 +123,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) // different position. When we initialize layers for testing here, we need to initialize that unintutive position value. TransformationMatrix identityMatrix; - RefPtr<LayerChromium> layer = LayerChromium::create(0); + 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. @@ -181,9 +188,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) { TransformationMatrix identityMatrix; - RefPtr<LayerChromium> parent = LayerChromium::create(0); - RefPtr<LayerChromium> child = LayerChromium::create(0); - RefPtr<LayerChromium> grandChild = LayerChromium::create(0); + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromium> child = LayerChromium::create(); + RefPtr<LayerChromium> grandChild = LayerChromium::create(); parent->createRenderSurface(); parent->addChild(child); child->addChild(grandChild); @@ -263,9 +270,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) { - RefPtr<LayerChromium> parent = LayerChromium::create(0); - RefPtr<LayerChromium> child = LayerChromium::create(0); - RefPtr<LayerChromiumWithForcedDrawsContent> grandChild = adoptRef(new LayerChromiumWithForcedDrawsContent(0)); + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromium> child = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> grandChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); parent->createRenderSurface(); parent->addChild(child); child->addChild(grandChild); @@ -318,15 +325,15 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) // - Sanity check on recursion: verify transforms of layers described w.r.t. a render surface that is described w.r.t. an ancestor render surface. // - verifying that each layer has a reference to the correct renderSurface and targetRenderSurface values. - RefPtr<LayerChromium> parent = LayerChromium::create(0); - RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(0); - RefPtr<LayerChromium> renderSurface2 = LayerChromium::create(0); - RefPtr<LayerChromium> childOfRoot = LayerChromium::create(0); - RefPtr<LayerChromium> childOfRS1 = LayerChromium::create(0); - RefPtr<LayerChromium> childOfRS2 = LayerChromium::create(0); - RefPtr<LayerChromium> grandChildOfRoot = LayerChromium::create(0); - RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS1 = adoptRef(new LayerChromiumWithForcedDrawsContent(0)); - RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS2 = adoptRef(new LayerChromiumWithForcedDrawsContent(0)); + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(); + RefPtr<LayerChromium> renderSurface2 = LayerChromium::create(); + RefPtr<LayerChromium> childOfRoot = LayerChromium::create(); + RefPtr<LayerChromium> childOfRS1 = LayerChromium::create(); + RefPtr<LayerChromium> childOfRS2 = LayerChromium::create(); + RefPtr<LayerChromium> grandChildOfRoot = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); parent->createRenderSurface(); parent->addChild(renderSurface1); parent->addChild(childOfRoot); @@ -454,9 +461,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForClipLayer) { - RefPtr<LayerChromium> parent = LayerChromium::create(0); - RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(0); - RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent(0)); + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); renderSurface1->setOpacity(0.9); const TransformationMatrix identityMatrix; @@ -483,9 +490,9 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForClipLayer) TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) { - RefPtr<LayerChromium> parent = LayerChromium::create(0); - RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(0); - RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent(0)); + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); renderSurface1->setOpacity(0); const TransformationMatrix identityMatrix; @@ -526,12 +533,12 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces) // const TransformationMatrix identityMatrix; - RefPtr<LayerChromium> parent = LayerChromium::create(0); - RefPtr<LayerChromium> child = LayerChromium::create(0); - RefPtr<LayerChromium> grandChild = LayerChromium::create(0); - RefPtr<LayerChromium> greatGrandChild = LayerChromium::create(0); - RefPtr<LayerChromiumWithForcedDrawsContent> leafNode1 = adoptRef(new LayerChromiumWithForcedDrawsContent(0)); - RefPtr<LayerChromiumWithForcedDrawsContent> leafNode2 = adoptRef(new LayerChromiumWithForcedDrawsContent(0)); + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromium> child = LayerChromium::create(); + RefPtr<LayerChromium> grandChild = LayerChromium::create(); + RefPtr<LayerChromium> greatGrandChild = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> leafNode1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); + RefPtr<LayerChromiumWithForcedDrawsContent> leafNode2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); parent->createRenderSurface(); parent->addChild(child); child->addChild(grandChild); @@ -595,4 +602,174 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces) // - test the other functions in CCLayerTreeHostCommon // +TEST(CCLayerTreeHostCommonTest, layerAddsSelfToOccludedRegion) +{ + // This tests that the right transforms are being used. + Region occluded; + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(layer); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); + setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false); + + layer->setOpaque(true); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too. + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + occluded = Region(); + layer->addSelfToOccludedScreenSpace(occluded); + EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occluded.bounds()); + EXPECT_EQ(1u, occluded.rects().size()); +} + +TEST(CCLayerTreeHostCommonTest, layerAddsSelfToOccludedRegionWithRotation) +{ + // This tests that the right transforms are being used. + Region occluded; + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(layer); + + TransformationMatrix layerTransform; + layerTransform.translate(250, 250); + layerTransform.rotate(90); + layerTransform.translate(-250, -250); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); + setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false); + + layer->setOpaque(true); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too. + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + occluded = Region(); + layer->addSelfToOccludedScreenSpace(occluded); + EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occluded.bounds()); + EXPECT_EQ(1u, occluded.rects().size()); +} + +TEST(CCLayerTreeHostCommonTest, layerAddsSelfToOccludedRegionWithTranslation) +{ + // This tests that the right transforms are being used. + Region occluded; + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(layer); + + TransformationMatrix layerTransform; + layerTransform.translate(20, 20); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); + setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false); + + layer->setOpaque(true); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too. + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + occluded = Region(); + layer->addSelfToOccludedScreenSpace(occluded); + EXPECT_EQ_RECT(IntRect(50, 50, 50, 50), occluded.bounds()); + EXPECT_EQ(1u, occluded.rects().size()); +} + +TEST(CCLayerTreeHostCommonTest, layerAddsSelfToOccludedRegionWithRotatedSurface) +{ + // This tests that the right transforms are being used. + Region occluded; + const TransformationMatrix identityMatrix; + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromium> child = LayerChromium::create(); + RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent()); + parent->createRenderSurface(); + parent->addChild(child); + child->addChild(layer); + + TransformationMatrix childTransform; + childTransform.translate(250, 250); + childTransform.rotate(90); + childTransform.translate(-250, -250); + + setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); + setLayerPropertiesForTesting(child.get(), childTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false); + setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), false); + + child->setMasksToBounds(true); + layer->setOpaque(true); + + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; + Vector<RefPtr<LayerChromium> > dummyLayerList; + int dummyMaxTextureSize = 512; + + // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too. + parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds())); + parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds())); + renderSurfaceLayerList.append(parent); + + CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + + occluded = Region(); + layer->addSelfToOccludedScreenSpace(occluded); + EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occluded.bounds()); + EXPECT_EQ(1u, occluded.rects().size()); + + /* Justification for the above opaque rect from |layer|: + 100 + +---------------------+ +---------------------+ + | | | |30 Visible region of |layer|: ///// + | 30 | rotate(90) | | + | 30 + ---------------------------------+ | +---------------------------------+ + 100 | | 10 | | ==> | | |10 | + | |10+---------------------------------+ | +---------------------------------+ | + | | | | | | | | |///////////////| 420 | | + | | | | | | | | |///////////////|60 | | + | | | | | | | | |///////////////| | | + +----|--|-------------+ | | +--|--|---------------+ | | + | | | | 20|10| 70 | | + | | | | | | | | + | | | |500 | | | | + | | | | | | | | + | | | | | | | | + | | | | | | | | + | | | | | | |10| + +--|-------------------------------+ | | +------------------------------|--+ + | | | 490 | + +---------------------------------+ +---------------------------------+ + 500 500 + */ +} + } // namespace diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp index 9b87d00fa..f59893de9 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp @@ -31,6 +31,7 @@ #include "LayerRendererChromium.h" #include "cc/CCLayerImpl.h" #include "cc/CCSingleThreadProxy.h" +#include "cc/CCSolidColorDrawQuad.h" #include <gtest/gtest.h> using namespace WebCore; @@ -73,6 +74,20 @@ public: ASSERT_EQ(timesEncountered, 1); } + void setupScrollAndContentsLayers(const IntSize& contentSize) + { + RefPtr<CCLayerImpl> root = CCLayerImpl::create(0); + root->setScrollable(true); + root->setScrollPosition(IntPoint(0, 0)); + root->setMaxScrollPosition(contentSize); + RefPtr<CCLayerImpl> contents = CCLayerImpl::create(1); + contents->setDrawsContent(true); + contents->setBounds(contentSize); + contents->setContentBounds(contentSize); + root->addChild(contents); + m_hostImpl->setRootLayer(root); + } + protected: DebugScopedSetImplThread m_alwaysImplThread; OwnPtr<CCLayerTreeHostImpl> m_hostImpl; @@ -155,6 +170,112 @@ TEST_F(CCLayerTreeHostImplTest, scrollRootCallsCommitAndRedraw) EXPECT_TRUE(m_didRequestCommit); } +TEST_F(CCLayerTreeHostImplTest, pinchGesture) +{ + setupScrollAndContentsLayers(IntSize(100, 100)); + m_hostImpl->setViewportSize(IntSize(50, 50)); + + CCLayerImpl* scrollLayer = m_hostImpl->scrollLayer(); + ASSERT(scrollLayer); + + const float minPageScale = 0.5, maxPageScale = 4; + + // Basic pinch zoom in gesture + { + m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); + scrollLayer->setPageScaleDelta(1); + + float pageScaleDelta = 2; + m_hostImpl->pinchGestureBegin(); + m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(50, 50)); + m_hostImpl->pinchGestureEnd(); + EXPECT_TRUE(m_didRequestRedraw); + EXPECT_TRUE(m_didRequestCommit); + + OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta); + } + + // Zoom-in clamping + { + m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); + scrollLayer->setPageScaleDelta(1); + float pageScaleDelta = 10; + + m_hostImpl->pinchGestureBegin(); + m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(50, 50)); + m_hostImpl->pinchGestureEnd(); + + OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + EXPECT_EQ(scrollInfo->pageScaleDelta, maxPageScale); + } + + // Zoom-out clamping + { + m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); + scrollLayer->setPageScaleDelta(1); + scrollLayer->setScrollPosition(IntPoint(50, 50)); + + float pageScaleDelta = 0.1; + m_hostImpl->pinchGestureBegin(); + m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(0, 0)); + m_hostImpl->pinchGestureEnd(); + + OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale); + + // Pushed to (0,0) via clamping against contents layer size. + expectContains(*scrollInfo.get(), scrollLayer->id(), IntSize(-50, -50)); + } +} + +TEST_F(CCLayerTreeHostImplTest, pageScaleAnimation) +{ + setupScrollAndContentsLayers(IntSize(100, 100)); + m_hostImpl->setViewportSize(IntSize(50, 50)); + + CCLayerImpl* scrollLayer = m_hostImpl->scrollLayer(); + ASSERT(scrollLayer); + + const float minPageScale = 0.5, maxPageScale = 4; + const double startTimeMs = 1000; + const double durationMs = 100; + + // Non-anchor zoom-in + { + m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); + scrollLayer->setPageScaleDelta(1); + scrollLayer->setScrollPosition(IntPoint(50, 50)); + + m_hostImpl->startPageScaleAnimation(IntSize(0, 0), false, 2, startTimeMs, durationMs); + m_hostImpl->animate(startTimeMs + durationMs / 2); + EXPECT_TRUE(m_didRequestRedraw); + m_hostImpl->animate(startTimeMs + durationMs); + EXPECT_TRUE(m_didRequestCommit); + + OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + EXPECT_EQ(scrollInfo->pageScaleDelta, 2); + expectContains(*scrollInfo.get(), scrollLayer->id(), IntSize(-50, -50)); + } + + // Anchor zoom-out + { + m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); + scrollLayer->setPageScaleDelta(1); + scrollLayer->setScrollPosition(IntPoint(50, 50)); + + m_hostImpl->startPageScaleAnimation(IntSize(25, 25), true, minPageScale, startTimeMs, durationMs); + m_hostImpl->animate(startTimeMs + durationMs); + EXPECT_TRUE(m_didRequestRedraw); + EXPECT_TRUE(m_didRequestCommit); + + OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas(); + EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale); + // Pushed to (0,0) via clamping against contents layer size. + expectContains(*scrollInfo.get(), scrollLayer->id(), IntSize(-50, -50)); + } +} + class BlendStateTrackerContext: public FakeWebGraphicsContext3D { public: BlendStateTrackerContext() : m_blend(false) { } @@ -183,11 +304,13 @@ class BlendStateCheckLayer : public CCLayerImpl { public: static PassRefPtr<BlendStateCheckLayer> create(int id) { return adoptRef(new BlendStateCheckLayer(id)); } - virtual void draw(LayerRendererChromium* renderer) + virtual void appendQuads(CCQuadList& quadList, const CCSharedQuadState* sharedQuadState) { - m_drawn = true; - BlendStateTrackerContext* context = static_cast<BlendStateTrackerContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(renderer->context())); - EXPECT_EQ(m_blend, context->blend()); + m_quadsAppended = true; + + Color color = m_opaqueColor ? Color::white : Color(0, 0, 0, 0); + OwnPtr<CCDrawQuad> testBlendingDrawQuad = CCSolidColorDrawQuad::create(sharedQuadState, IntRect(5, 5, 5, 5), color); + EXPECT_EQ(m_blend, testBlendingDrawQuad->needsBlending()); EXPECT_EQ(m_hasRenderSurface, !!renderSurface()); } @@ -195,17 +318,20 @@ public: { m_blend = blend; m_hasRenderSurface = hasRenderSurface; - m_drawn = false; + m_quadsAppended = false; } - bool drawn() const { return m_drawn; } + bool quadsAppended() const { return m_quadsAppended; } + + void setOpaqueColor(bool opaqueColor) { m_opaqueColor = opaqueColor; } private: explicit BlendStateCheckLayer(int id) : CCLayerImpl(id) , m_blend(false) , m_hasRenderSurface(false) - , m_drawn(false) + , m_quadsAppended(false) + , m_opaqueColor(true) { setAnchorPoint(FloatPoint(0, 0)); setBounds(IntSize(10, 10)); @@ -214,7 +340,8 @@ private: bool m_blend; bool m_hasRenderSurface; - bool m_drawn; + bool m_quadsAppended; + bool m_opaqueColor; }; // https://bugs.webkit.org/show_bug.cgi?id=75783 @@ -236,45 +363,76 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) // Opaque layer, drawn without blending. layer1->setOpaque(true); + layer1->setOpaqueColor(true); layer1->setExpectation(false, false); m_hostImpl->drawLayers(); - EXPECT_TRUE(layer1->drawn()); + EXPECT_TRUE(layer1->quadsAppended()); - // Layer with translucent content, drawn with blending. + // Layer with translucent content, but solid color is opaque, so drawn without blending. layer1->setOpaque(false); + layer1->setOpaqueColor(true); + layer1->setExpectation(false, false); + m_hostImpl->drawLayers(); + EXPECT_TRUE(layer1->quadsAppended()); + + // Layer with translucent content and painting, so drawn with blending. + layer1->setOpaque(false); + layer1->setOpaqueColor(false); layer1->setExpectation(true, false); m_hostImpl->drawLayers(); - EXPECT_TRUE(layer1->drawn()); + EXPECT_TRUE(layer1->quadsAppended()); // Layer with translucent opacity, drawn with blending. layer1->setOpaque(true); + layer1->setOpaqueColor(true); + layer1->setOpacity(0.5); + layer1->setExpectation(true, false); + m_hostImpl->drawLayers(); + EXPECT_TRUE(layer1->quadsAppended()); + + // Layer with translucent opacity and painting, drawn with blending. + layer1->setOpaque(true); + layer1->setOpaqueColor(false); layer1->setOpacity(0.5); layer1->setExpectation(true, false); m_hostImpl->drawLayers(); - EXPECT_TRUE(layer1->drawn()); + EXPECT_TRUE(layer1->quadsAppended()); RefPtr<BlendStateCheckLayer> layer2 = BlendStateCheckLayer::create(2); layer1->addChild(layer2); // 2 opaque layers, drawn without blending. layer1->setOpaque(true); + layer1->setOpaqueColor(true); layer1->setOpacity(1); layer1->setExpectation(false, false); layer2->setOpaque(true); + layer2->setOpaqueColor(true); layer2->setOpacity(1); layer2->setExpectation(false, false); m_hostImpl->drawLayers(); - EXPECT_FALSE(layer1->drawn()); - EXPECT_TRUE(layer2->drawn()); + EXPECT_TRUE(layer1->quadsAppended()); + EXPECT_TRUE(layer2->quadsAppended()); // Parent layer with translucent content, drawn with blending. // Child layer with opaque content, drawn without blending. layer1->setOpaque(false); + layer1->setOpaqueColor(false); layer1->setExpectation(true, false); layer2->setExpectation(false, false); m_hostImpl->drawLayers(); - EXPECT_FALSE(layer1->drawn()); - EXPECT_TRUE(layer2->drawn()); + EXPECT_TRUE(layer1->quadsAppended()); + EXPECT_TRUE(layer2->quadsAppended()); + + // Parent layer with translucent content but opaque painting, drawn without blending. + // Child layer with opaque content, drawn without blending. + layer1->setOpaque(false); + layer1->setOpaqueColor(true); + layer1->setExpectation(false, false); + layer2->setExpectation(false, false); + m_hostImpl->drawLayers(); + EXPECT_TRUE(layer1->quadsAppended()); + EXPECT_TRUE(layer2->quadsAppended()); // Parent layer with translucent opacity and opaque content. Since it has a // drawing child, it's drawn to a render surface which carries the opacity, @@ -282,35 +440,51 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) // Child layer with opaque content, drawn without blending (parent surface // carries the inherited opacity). layer1->setOpaque(true); + layer1->setOpaqueColor(true); layer1->setOpacity(0.5); layer1->setExpectation(false, true); layer2->setExpectation(false, false); m_hostImpl->drawLayers(); - EXPECT_FALSE(layer1->drawn()); - EXPECT_TRUE(layer2->drawn()); + EXPECT_TRUE(layer1->quadsAppended()); + EXPECT_TRUE(layer2->quadsAppended()); // Draw again, but with child non-opaque, to make sure // layer1 not culled. layer1->setOpaque(true); + layer1->setOpaqueColor(true); layer1->setOpacity(1); layer1->setExpectation(false, false); layer2->setOpaque(true); + layer2->setOpaqueColor(true); layer2->setOpacity(0.5); layer2->setExpectation(true, false); m_hostImpl->drawLayers(); - EXPECT_TRUE(layer1->drawn()); - EXPECT_TRUE(layer2->drawn()); + EXPECT_TRUE(layer1->quadsAppended()); + EXPECT_TRUE(layer2->quadsAppended()); // A second way of making the child non-opaque. layer1->setOpaque(true); layer1->setOpacity(1); layer1->setExpectation(false, false); layer2->setOpaque(false); + layer2->setOpaqueColor(false); layer2->setOpacity(1); layer2->setExpectation(true, false); m_hostImpl->drawLayers(); - EXPECT_TRUE(layer1->drawn()); - EXPECT_TRUE(layer2->drawn()); + EXPECT_TRUE(layer1->quadsAppended()); + EXPECT_TRUE(layer2->quadsAppended()); + + // And when the layer says its not opaque but is painted opaque, it is not blended. + layer1->setOpaque(true); + layer1->setOpacity(1); + layer1->setExpectation(false, false); + layer2->setOpaque(false); + layer2->setOpaqueColor(true); + layer2->setOpacity(1); + layer2->setExpectation(false, false); + m_hostImpl->drawLayers(); + EXPECT_TRUE(layer1->quadsAppended()); + EXPECT_TRUE(layer2->quadsAppended()); } class ReshapeTrackerContext: public FakeWebGraphicsContext3D { diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp index bfa1b0822..41fe4fb65 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp @@ -26,10 +26,11 @@ #include "cc/CCLayerTreeHost.h" -#include "CompositorFakeGraphicsContext3D.h" +#include "CompositorFakeWebGraphicsContext3D.h" #include "ContentLayerChromium.h" -#include "FakeWebGraphicsContext3D.h" +#include "GraphicsContext3DPrivate.h" #include "LayerChromium.h" +#include "Region.h" #include "TextureManager.h" #include "WebCompositor.h" #include "WebKit.h" @@ -40,8 +41,8 @@ #include "cc/CCThreadTask.h" #include "platform/WebKitPlatformSupport.h" #include "platform/WebThread.h" +#include <gmock/gmock.h> #include <gtest/gtest.h> -#include <webkit/support/webkit_support.h> #include <wtf/MainThread.h> #include <wtf/PassRefPtr.h> #include <wtf/Vector.h> @@ -130,6 +131,52 @@ private: TestHooks* m_testHooks; }; +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> m_usedTextures; +}; + // Implementation of CCLayerTreeHost callback interface. class MockLayerTreeHostClient : public CCLayerTreeHostClient { public: @@ -155,7 +202,15 @@ public: virtual PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D() { - return createCompositorMockGraphicsContext3D(GraphicsContext3D::Attributes()); + GraphicsContext3D::Attributes attrs; + WebGraphicsContext3D::Attributes webAttrs; + webAttrs.alpha = attrs.alpha; + + OwnPtr<WebGraphicsContext3D> webContext = CompositorFakeWebGraphicsContext3DWithTextureTracking::create(webAttrs); + return GraphicsContext3DPrivate::createGraphicsContextFromWebContext( + webContext.release(), attrs, 0, + GraphicsContext3D::RenderDirectlyToHostWindow, + GraphicsContext3DPrivate::ForUseOnAnotherThread); } virtual void didCommitAndDrawFrame() @@ -243,16 +298,10 @@ protected: void doBeginTest(); - static void onBeginTest(void* self) - { - static_cast<CCLayerTreeHostTest*>(self)->doBeginTest(); - } - static void onEndTest(void* self) { ASSERT(isMainThread()); - webkit_support::QuitMessageLoop(); - webkit_support::RunAllPendingMessages(); + webKitPlatformSupport()->currentThread()->exitRunLoop(); } static void dispatchSetNeedsAnimate(void* self) @@ -311,7 +360,7 @@ protected: test->m_layerTreeHost->setVisible(false); } - class TimeoutTask : public webkit_support::TaskAdaptor { + class TimeoutTask : public WebThread::Task { public: explicit TimeoutTask(CCLayerTreeHostTest* test) : m_test(test) @@ -329,7 +378,7 @@ protected: m_test->clearTimeout(); } - virtual void Run() + virtual void run() { if (m_test) m_test->timeout(); @@ -339,10 +388,24 @@ protected: CCLayerTreeHostTest* m_test; }; + class BeginTask : public WebThread::Task { + public: + explicit BeginTask(CCLayerTreeHostTest* test) + : m_test(test) + { + } + + virtual ~BeginTask() { } + virtual void run() + { + m_test->doBeginTest(); + } + private: + CCLayerTreeHostTest* m_test; + }; + virtual void runTest(bool threaded) { - m_settings.refreshRate = 100.0; - if (threaded) { m_webThread = adoptPtr(webKitPlatformSupport()->createThread("CCLayerTreeHostTest")); WebCompositor::initialize(m_webThread.get()); @@ -352,11 +415,11 @@ protected: ASSERT(CCProxy::isMainThread()); m_mainThreadProxy = CCScopedThreadProxy::create(CCProxy::mainThread()); - webkit_support::PostDelayedTask(CCLayerTreeHostTest::onBeginTest, static_cast<void*>(this), 0); + m_beginTask = new BeginTask(this); + webKitPlatformSupport()->currentThread()->postDelayedTask(m_beginTask, 0); // postDelayedTask takes ownership of the task m_timeoutTask = new TimeoutTask(this); - webkit_support::PostDelayedTask(m_timeoutTask, 5000); // webkit_support takes ownership of the task - webkit_support::RunMessageLoop(); - webkit_support::RunAllPendingMessages(); + webKitPlatformSupport()->currentThread()->postDelayedTask(m_timeoutTask, 5000); + webKitPlatformSupport()->currentThread()->enterRunLoop(); if (m_layerTreeHost && m_layerTreeHost->rootLayer()) m_layerTreeHost->rootLayer()->setLayerTreeHost(0); @@ -388,6 +451,7 @@ private: OwnPtr<WebThread> m_webThread; RefPtr<CCScopedThreadProxy> m_mainThreadProxy; TimeoutTask* m_timeoutTask; + BeginTask* m_beginTask; }; void CCLayerTreeHostTest::doBeginTest() @@ -395,7 +459,7 @@ void CCLayerTreeHostTest::doBeginTest() ASSERT(isMainThread()); m_client = MockLayerTreeHostClient::create(this); - RefPtr<LayerChromium> rootLayer = LayerChromium::create(0); + RefPtr<LayerChromium> rootLayer = LayerChromium::create(); m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), rootLayer, m_settings); ASSERT_TRUE(m_layerTreeHost); rootLayer->setLayerTreeHost(m_layerTreeHost.get()); @@ -912,7 +976,7 @@ TEST_F(CCLayerTreeHostTestSetVisible, runMultiThread) runTest(true); } -class TestOpacityChangeLayerDelegate : public CCLayerDelegate { +class TestOpacityChangeLayerDelegate : public ContentLayerDelegate { public: TestOpacityChangeLayerDelegate(CCLayerTreeHostTest* test) : m_test(test) @@ -933,7 +997,7 @@ private: class ContentLayerChromiumWithUpdateTracking : public ContentLayerChromium { public: - static PassRefPtr<ContentLayerChromiumWithUpdateTracking> create(CCLayerDelegate *delegate) { return adoptRef(new ContentLayerChromiumWithUpdateTracking(delegate)); } + static PassRefPtr<ContentLayerChromiumWithUpdateTracking> create(ContentLayerDelegate *delegate) { return adoptRef(new ContentLayerChromiumWithUpdateTracking(delegate)); } int paintContentsCount() { return m_paintContentsCount; } int idlePaintContentsCount() { return m_idlePaintContentsCount; } @@ -942,9 +1006,9 @@ public: int updateCount() { return m_updateCount; } void resetUpdateCount() { m_updateCount = 0; } - virtual void paintContentsIfDirty() + virtual void paintContentsIfDirty(const Region& occludedScreenSpace) { - ContentLayerChromium::paintContentsIfDirty(); + ContentLayerChromium::paintContentsIfDirty(occludedScreenSpace); m_paintContentsCount++; } @@ -961,7 +1025,7 @@ public: } private: - explicit ContentLayerChromiumWithUpdateTracking(CCLayerDelegate *delegate) + explicit ContentLayerChromiumWithUpdateTracking(ContentLayerDelegate* delegate) : ContentLayerChromium(delegate) , m_paintContentsCount(0) , m_idlePaintContentsCount(0) @@ -1068,4 +1132,341 @@ TEST_F(CCLayerTreeHostTestSetViewportSize, runSingleThread) runTest(false); } +class MockContentLayerDelegate : public ContentLayerDelegate { +public: + bool drawsContent() const { return true; } + MOCK_CONST_METHOD0(preserves3D, bool()); + void paintContents(GraphicsContext&, const IntRect&) { } + void notifySyncRequired() { } +}; + +// Verify atomicity of commits and reuse of textures. +class CCLayerTreeHostTestAtomicCommit : public CCLayerTreeHostTest { +public: + CCLayerTreeHostTestAtomicCommit() + : m_updateCheckLayer(ContentLayerChromiumWithUpdateTracking::create(&m_delegate)) + , m_numCommits(0) + { + // Make sure partial texture updates are turned off. + m_settings.partialTextureUpdates = false; + } + + virtual void beginTest() + { + m_layerTreeHost->setRootLayer(m_updateCheckLayer); + m_layerTreeHost->setViewportSize(IntSize(10, 10)); + + postSetNeedsCommitToMainThread(); + postSetNeedsRedrawToMainThread(); + } + + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) + { + CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context())); + + switch (impl->frameNumber()) { + case 0: + // Number of textures should be one. + EXPECT_EQ(1, context->numTextures()); + // Number of textures used for commit should be one. + EXPECT_EQ(1, context->numUsedTextures()); + // Verify used texture is correct. + EXPECT_TRUE(context->usedTexture(context->texture(0))); + + context->resetUsedTextures(); + break; + case 1: + // Number of textures should be two as the first texture + // is used by impl thread and cannot by used for update. + EXPECT_EQ(2, context->numTextures()); + // Number of textures used for commit should still be one. + EXPECT_EQ(1, context->numUsedTextures()); + // First texture should not have been used. + EXPECT_FALSE(context->usedTexture(context->texture(0))); + // New texture should have been used. + EXPECT_TRUE(context->usedTexture(context->texture(1))); + + context->resetUsedTextures(); + break; + default: + ASSERT_NOT_REACHED(); + break; + } + } + + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) + { + CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context())); + + // Number of textures used for draw should always be one. + EXPECT_EQ(1, context->numUsedTextures()); + + if (impl->frameNumber() < 2) { + context->resetUsedTextures(); + postSetNeedsAnimateAndCommitToMainThread(); + postSetNeedsRedrawToMainThread(); + } else + endTest(); + } + + virtual void layout() + { + m_updateCheckLayer->setNeedsDisplay(); + } + + virtual void afterTest() + { + } + +private: + MockContentLayerDelegate m_delegate; + RefPtr<ContentLayerChromiumWithUpdateTracking> m_updateCheckLayer; + int m_numCommits; +}; + +TEST_F(CCLayerTreeHostTestAtomicCommit, runMultiThread) +{ + runTest(true); +} + +#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()); + +class TestLayerChromium : public LayerChromium { +public: + static PassRefPtr<TestLayerChromium> create() { return adoptRef(new TestLayerChromium()); } + + virtual void paintContentsIfDirty(const Region& occludedScreenSpace) + { + m_occludedScreenSpace = occludedScreenSpace; + } + + virtual bool drawsContent() const { return true; } + + const Region& occludedScreenSpace() const { return m_occludedScreenSpace; } + void clearOccludedScreenSpace() { m_occludedScreenSpace = Region(); } + +private: + TestLayerChromium() : LayerChromium() { } + + Region m_occludedScreenSpace; +}; + +static void setLayerPropertiesForTesting(TestLayerChromium* layer, LayerChromium* parent, const TransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque) +{ + layer->removeAllChildren(); + if (parent) + parent->addChild(layer); + layer->setTransform(transform); + layer->setAnchorPoint(anchor); + layer->setPosition(position); + layer->setBounds(bounds); + layer->setOpaque(opaque); + layer->clearOccludedScreenSpace(); +} + +class CCLayerTreeHostTestLayerOcclusion : public CCLayerTreeHostTest { +public: + CCLayerTreeHostTestLayerOcclusion() { } + + virtual void beginTest() + { + RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create(); + RefPtr<TestLayerChromium> child = TestLayerChromium::create(); + RefPtr<TestLayerChromium> child2 = TestLayerChromium::create(); + RefPtr<TestLayerChromium> grandChild = TestLayerChromium::create(); + RefPtr<TestLayerChromium> mask = TestLayerChromium::create(); + + TransformationMatrix identityMatrix; + TransformationMatrix childTransform; + childTransform.translate(250, 250); + childTransform.rotate(90); + childTransform.translate(-250, -250); + + child->setMasksToBounds(true); + + // See CCLayerTreeHostCommonTest.layerAddsSelfToOccludedRegionWithRotatedSurface for a nice visual of these layers and how they end up + // positioned on the screen. + + // The child layer is rotated and the grandChild is opaque, but clipped to the child and rootLayer + setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); + setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false); + setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); + + m_layerTreeHost->setRootLayer(rootLayer); + m_layerTreeHost->setViewportSize(rootLayer->bounds()); + m_layerTreeHost->updateLayers(); + m_layerTreeHost->commitComplete(); + + EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), child->occludedScreenSpace().bounds()); + EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), rootLayer->occludedScreenSpace().bounds()); + EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); + + // If the child layer is opaque, then it adds to the occlusion seen by the rootLayer. + setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); + setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); + setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); + + m_layerTreeHost->setRootLayer(rootLayer); + m_layerTreeHost->setViewportSize(rootLayer->bounds()); + m_layerTreeHost->updateLayers(); + m_layerTreeHost->commitComplete(); + + EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), child->occludedScreenSpace().bounds()); + EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), rootLayer->occludedScreenSpace().bounds()); + EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); + + // Add a second child to the root layer and the regions should merge + setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); + setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(70, 20), IntSize(500, 500), true); + setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); + setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); + + m_layerTreeHost->setRootLayer(rootLayer); + m_layerTreeHost->setViewportSize(rootLayer->bounds()); + m_layerTreeHost->updateLayers(); + m_layerTreeHost->commitComplete(); + + EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), child->occludedScreenSpace().bounds()); + EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), child2->occludedScreenSpace().bounds()); + EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(30, 20, 70, 80), rootLayer->occludedScreenSpace().bounds()); + EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size()); + + // Move the second child to be sure. + setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); + setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); + setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); + setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); + + m_layerTreeHost->setRootLayer(rootLayer); + m_layerTreeHost->setViewportSize(rootLayer->bounds()); + m_layerTreeHost->updateLayers(); + m_layerTreeHost->commitComplete(); + + EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), child->occludedScreenSpace().bounds()); + EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), child2->occludedScreenSpace().bounds()); + EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(10, 30, 90, 70), rootLayer->occludedScreenSpace().bounds()); + EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size()); + + // If the child layer has a mask on it, then it shouldn't contribute to occlusion on stuff below it + setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); + setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); + setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); + setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); + + child->setMaskLayer(mask.get()); + + m_layerTreeHost->setRootLayer(rootLayer); + m_layerTreeHost->setViewportSize(rootLayer->bounds()); + m_layerTreeHost->updateLayers(); + m_layerTreeHost->commitComplete(); + + EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), child->occludedScreenSpace().bounds()); + EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); + EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(10, 70, 90, 30), rootLayer->occludedScreenSpace().bounds()); + EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); + + // If the child layer with a mask is below child2, then child2 should contribute to occlusion on everything, and child shouldn't contribute to the rootLayer + setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); + setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); + setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); + setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); + + child->setMaskLayer(mask.get()); + + m_layerTreeHost->setRootLayer(rootLayer); + m_layerTreeHost->setViewportSize(rootLayer->bounds()); + m_layerTreeHost->updateLayers(); + m_layerTreeHost->commitComplete(); + + EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); + EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(10, 70, 90, 30), grandChild->occludedScreenSpace().bounds()); + EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(10, 40, 90, 60), child->occludedScreenSpace().bounds()); + EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(10, 70, 90, 30), rootLayer->occludedScreenSpace().bounds()); + EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); + + // If the child layer has a non-opaque drawOpacity, then it shouldn't contribute to occlusion on stuff below it + setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); + setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); + setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); + setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); + + child->setMaskLayer(0); + child->setOpacity(0.5); + + m_layerTreeHost->setRootLayer(rootLayer); + m_layerTreeHost->setViewportSize(rootLayer->bounds()); + m_layerTreeHost->updateLayers(); + m_layerTreeHost->commitComplete(); + + EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), child->occludedScreenSpace().bounds()); + EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); + EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(10, 70, 90, 30), rootLayer->occludedScreenSpace().bounds()); + EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); + + // If the child layer with non-opaque drawOpacity is below child2, then child2 should contribute to occlusion on everything, and child shouldn't contribute to the rootLayer + setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); + setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); + setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); + setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); + + child->setMaskLayer(0); + child->setOpacity(0.5); + + m_layerTreeHost->setRootLayer(rootLayer); + m_layerTreeHost->setViewportSize(rootLayer->bounds()); + m_layerTreeHost->updateLayers(); + m_layerTreeHost->commitComplete(); + + EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); + EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(10, 70, 90, 30), grandChild->occludedScreenSpace().bounds()); + EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(10, 40, 90, 60), child->occludedScreenSpace().bounds()); + EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(10, 70, 90, 30), rootLayer->occludedScreenSpace().bounds()); + EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); + + // Kill the layerTreeHost immediately. + m_layerTreeHost->setRootLayer(0); + m_layerTreeHost.clear(); + + endTest(); + } + + virtual void afterTest() + { + } +}; + +SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestLayerOcclusion) + } // namespace diff --git a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp index ed15e6c10..299e5c7e5 100644 --- a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp +++ b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp @@ -26,6 +26,7 @@ #include "cc/CCQuadCuller.h" +#include "cc/CCTileDrawQuad.h" #include <gmock/gmock.h> #include <gtest/gtest.h> @@ -36,37 +37,29 @@ namespace { class CCQuadCullerTest : public testing::Test { }; -class TestDrawQuad : public CCDrawQuad { -public: - TestDrawQuad(const CCSharedQuadState* state, Material m, const IntRect& rect) - : CCDrawQuad(state, m, rect) - { - } - - static PassOwnPtr<TestDrawQuad> create(const CCSharedQuadState* state, Material m, const IntRect& rect) - { - return adoptPtr(new TestDrawQuad(state, m, rect)); - } -}; +static PassOwnPtr<CCDrawQuad> MakeTileQuad(CCSharedQuadState* state, const IntRect& rect, const IntRect& opaqueRect = IntRect()) +{ + return CCTileDrawQuad::create(state, rect, intersection(rect, opaqueRect), 1, IntPoint(1, 1), IntSize(100, 100), 0, false, false, false, false, false); +} -void setQuads(CCSharedQuadState* rootState, CCSharedQuadState* childState, CCQuadList& quadList) +void setQuads(CCSharedQuadState* rootState, CCSharedQuadState* childState, CCQuadList& quadList, const IntRect& opaqueRect = IntRect()) { quadList.clear(); - quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(), IntSize(100, 100)))); - quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(100, 0), IntSize(100, 100)))); - quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(200, 0), IntSize(100, 100)))); - quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(0, 100), IntSize(100, 100)))); - quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(100, 100), IntSize(100, 100)))); - quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(200, 100), IntSize(100, 100)))); - quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(0, 200), IntSize(100, 100)))); - quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(100, 200), IntSize(100, 100)))); - quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(200, 200), IntSize(100, 100)))); - - quadList.append(TestDrawQuad::create(childState, CCDrawQuad::TiledContent, IntRect(IntPoint(), IntSize(100, 100)))); - quadList.append(TestDrawQuad::create(childState, CCDrawQuad::TiledContent, IntRect(IntPoint(100, 0), IntSize(100, 100)))); - quadList.append(TestDrawQuad::create(childState, CCDrawQuad::TiledContent, IntRect(IntPoint(0, 100), IntSize(100, 100)))); - quadList.append(TestDrawQuad::create(childState, CCDrawQuad::TiledContent, IntRect(IntPoint(100, 100), IntSize(100, 100)))); + quadList.append(MakeTileQuad(rootState, IntRect(IntPoint(), IntSize(100, 100)), opaqueRect)); + quadList.append(MakeTileQuad(rootState, IntRect(IntPoint(100, 0), IntSize(100, 100)), opaqueRect)); + quadList.append(MakeTileQuad(rootState, IntRect(IntPoint(200, 0), IntSize(100, 100)), opaqueRect)); + quadList.append(MakeTileQuad(rootState, IntRect(IntPoint(0, 100), IntSize(100, 100)), opaqueRect)); + quadList.append(MakeTileQuad(rootState, IntRect(IntPoint(100, 100), IntSize(100, 100)), opaqueRect)); + quadList.append(MakeTileQuad(rootState, IntRect(IntPoint(200, 100), IntSize(100, 100)), opaqueRect)); + quadList.append(MakeTileQuad(rootState, IntRect(IntPoint(0, 200), IntSize(100, 100)), opaqueRect)); + quadList.append(MakeTileQuad(rootState, IntRect(IntPoint(100, 200), IntSize(100, 100)), opaqueRect)); + quadList.append(MakeTileQuad(rootState, IntRect(IntPoint(200, 200), IntSize(100, 100)), opaqueRect)); + + quadList.append(MakeTileQuad(childState, IntRect(IntPoint(), IntSize(100, 100)), opaqueRect)); + quadList.append(MakeTileQuad(childState, IntRect(IntPoint(100, 0), IntSize(100, 100)), opaqueRect)); + quadList.append(MakeTileQuad(childState, IntRect(IntPoint(0, 100), IntSize(100, 100)), opaqueRect)); + quadList.append(MakeTileQuad(childState, IntRect(IntPoint(100, 100), IntSize(100, 100)), opaqueRect)); } #define DECLARE_AND_INITIALIZE_TEST_QUADS \ @@ -129,6 +122,67 @@ TEST(CCQuadCullerTest, verifyCullCenterTileOnly) EXPECT_EQ(quadList.size(), 13u); CCQuadCuller::cullOccludedQuads(quadList); EXPECT_EQ(quadList.size(), 12u); + + IntRect quadVisibleRect1 = quadList[1].get()->quadVisibleRect(); + EXPECT_EQ(quadVisibleRect1.height(), 50); + + IntRect quadVisibleRect3 = quadList[3].get()->quadVisibleRect(); + EXPECT_EQ(quadVisibleRect3.width(), 50); + + // Next index is 4, not 5, since centre quad culled. + IntRect quadVisibleRect4 = quadList[4].get()->quadVisibleRect(); + EXPECT_EQ(quadVisibleRect4.width(), 50); + EXPECT_EQ(quadVisibleRect4.x(), 250); + + IntRect quadVisibleRect6 = quadList[6].get()->quadVisibleRect(); + EXPECT_EQ(quadVisibleRect6.height(), 50); + EXPECT_EQ(quadVisibleRect6.y(), 250); +} + +TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize1) +{ + DECLARE_AND_INITIALIZE_TEST_QUADS + + childTransform.translate(100, 100); + + // Create root layer tile with extent (99.1, 99.1) -> (200.9, 200.9) to make + // sure it doesn't get culled due to transform rounding. + TransformationMatrix rootTransform; + rootTransform.translate(99.1, 99.1); + rootTransform.scale(1.018); + + OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(rootTransform, TransformationMatrix(), rootRect, IntRect(), 1.0, true); + OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, true); + + quadList.append(MakeTileQuad(rootState.get(), IntRect(IntPoint(), IntSize(100, 100)))); + quadList.append(MakeTileQuad(childState.get(), IntRect(IntPoint(), IntSize(100, 100)))); + + EXPECT_EQ(quadList.size(), 2u); + CCQuadCuller::cullOccludedQuads(quadList); + EXPECT_EQ(quadList.size(), 2u); +} + +TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize2) +{ + DECLARE_AND_INITIALIZE_TEST_QUADS + + // Make the child quad slightly smaller than, and centred over, the root layer tile. + // Verify the child does not cause the quad below to be culled due to rounding. + childTransform.translate(100.1, 100.1); + childTransform.scale(0.982); + + TransformationMatrix rootTransform; + rootTransform.translate(100, 100); + + OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(rootTransform, TransformationMatrix(), rootRect, IntRect(), 1.0, true); + OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, true); + + quadList.append(MakeTileQuad(rootState.get(), IntRect(IntPoint(), IntSize(100, 100)))); + quadList.append(MakeTileQuad(childState.get(), IntRect(IntPoint(), IntSize(100, 100)))); + + EXPECT_EQ(quadList.size(), 2u); + CCQuadCuller::cullOccludedQuads(quadList); + EXPECT_EQ(quadList.size(), 2u); } TEST(CCQuadCullerTest, verifyCullChildLinesUpBottomRight) @@ -146,6 +200,54 @@ TEST(CCQuadCullerTest, verifyCullChildLinesUpBottomRight) EXPECT_EQ(quadList.size(), 9u); } +TEST(CCQuadCullerTest, verifyCullSubRegion) +{ + DECLARE_AND_INITIALIZE_TEST_QUADS + + childTransform.translate(50, 50); + + OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true); + OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, false); + IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2); + + setQuads(rootState.get(), childState.get(), quadList, childOpaqueRect); + EXPECT_EQ(quadList.size(), 13u); + CCQuadCuller::cullOccludedQuads(quadList); + EXPECT_EQ(quadList.size(), 12u); +} + +TEST(CCQuadCullerTest, verifyCullSubRegion2) +{ + DECLARE_AND_INITIALIZE_TEST_QUADS + + childTransform.translate(50, 10); + + OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true); + OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, false); + IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() * 3 / 4); + + setQuads(rootState.get(), childState.get(), quadList, childOpaqueRect); + EXPECT_EQ(quadList.size(), 13u); + CCQuadCuller::cullOccludedQuads(quadList); + EXPECT_EQ(quadList.size(), 12u); +} + +TEST(CCQuadCullerTest, verifyCullSubRegionCheckOvercull) +{ + DECLARE_AND_INITIALIZE_TEST_QUADS + + childTransform.translate(50, 49); + + OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true); + OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, false); + IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2); + + setQuads(rootState.get(), childState.get(), quadList, childOpaqueRect); + EXPECT_EQ(quadList.size(), 13u); + CCQuadCuller::cullOccludedQuads(quadList); + EXPECT_EQ(quadList.size(), 13u); +} + TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude) { DECLARE_AND_INITIALIZE_TEST_QUADS diff --git a/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp b/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp index 48a3fda1f..3908f40a9 100644 --- a/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp +++ b/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp @@ -77,8 +77,11 @@ TEST(CCSchedulerStateMachineTest, TestNextActionBeginsFrameIfNeeded) state.setUpdateMoreResourcesPending(false); state.setVisible(true); + EXPECT_FALSE(state.vsyncCallbackNeeded()); + state.didLeaveVSync(); EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); + EXPECT_FALSE(state.vsyncCallbackNeeded()); state.didEnterVSync(); EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); } @@ -91,6 +94,7 @@ TEST(CCSchedulerStateMachineTest, TestNextActionBeginsFrameIfNeeded) state.setNeedsCommit(true); state.setUpdateMoreResourcesPending(false); state.setVisible(true); + EXPECT_FALSE(state.vsyncCallbackNeeded()); } // Begin the frame, make sure needsCommit and commitState update correctly. @@ -100,6 +104,7 @@ TEST(CCSchedulerStateMachineTest, TestNextActionBeginsFrameIfNeeded) state.updateState(CCSchedulerStateMachine::ACTION_BEGIN_FRAME); EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.commitState()); EXPECT_FALSE(state.needsCommit()); + EXPECT_FALSE(state.vsyncCallbackNeeded()); } } @@ -108,6 +113,7 @@ TEST(CCSchedulerStateMachineTest, TestSetForcedRedrawDoesNotSetsNormalRedraw) CCSchedulerStateMachine state; state.setNeedsForcedRedraw(); EXPECT_FALSE(state.redrawPending()); + EXPECT_TRUE(state.vsyncCallbackNeeded()); } TEST(CCSchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) @@ -115,6 +121,7 @@ TEST(CCSchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) CCSchedulerStateMachine state; state.setVisible(true); state.setNeedsRedraw(); + EXPECT_TRUE(state.vsyncCallbackNeeded()); state.didEnterVSync(); EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction()); state.updateState(CCSchedulerStateMachine::ACTION_DRAW); @@ -126,10 +133,12 @@ TEST(CCSchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) // Move to another frame. This should now draw. state.didLeaveVSync(); + EXPECT_TRUE(state.vsyncCallbackNeeded()); state.didEnterVSync(); EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction()); state.updateState(CCSchedulerStateMachine::ACTION_DRAW); + EXPECT_FALSE(state.vsyncCallbackNeeded()); } TEST(CCSchedulerStateMachineTest, TestNextActionDrawsOnVSync) @@ -140,34 +149,42 @@ TEST(CCSchedulerStateMachineTest, TestNextActionDrawsOnVSync) for (unsigned j = 0; j < 2; ++j) { StateMachine state; state.setCommitState(allCommitStates[i]); - if (!j) { + bool visible = j; + if (!visible) { state.didEnterVSync(); state.setVisible(false); - } + } else + state.setVisible(true); // Case 1: needsCommit=false updateMoreResourcesPending=false. state.setNeedsCommit(false); state.setUpdateMoreResourcesPending(false); + EXPECT_FALSE(state.vsyncCallbackNeeded()); EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction()); // Case 2: needsCommit=false updateMoreResourcesPending=true. state.setNeedsCommit(false); state.setUpdateMoreResourcesPending(true); + if (visible) + EXPECT_TRUE(state.vsyncCallbackNeeded()); EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction()); // Case 3: needsCommit=true updateMoreResourcesPending=false. state.setNeedsCommit(true); state.setUpdateMoreResourcesPending(false); + EXPECT_FALSE(state.vsyncCallbackNeeded()); EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction()); // Case 4: needsCommit=true updateMoreResourcesPending=true. state.setNeedsCommit(true); state.setUpdateMoreResourcesPending(true); + if (visible) + EXPECT_TRUE(state.vsyncCallbackNeeded()); EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction()); } } - // When on vsync, or not on vsync but needsForcedRedraw set, should always draw expect if you're ready to commit, in which case commit. + // When on vsync, or not on vsync but needsForcedRedraw set, should always draw except if you're ready to commit, in which case commit. for (size_t i = 0; i < numCommitStates; ++i) { for (unsigned j = 0; j < 2; ++j) { StateMachine state; @@ -188,21 +205,25 @@ TEST(CCSchedulerStateMachineTest, TestNextActionDrawsOnVSync) // Case 1: needsCommit=false updateMoreResourcesPending=false. state.setNeedsCommit(false); state.setUpdateMoreResourcesPending(false); + EXPECT_TRUE(state.vsyncCallbackNeeded()); EXPECT_EQ(expectedAction, state.nextAction()); // Case 2: needsCommit=false updateMoreResourcesPending=true. state.setNeedsCommit(false); state.setUpdateMoreResourcesPending(true); + EXPECT_TRUE(state.vsyncCallbackNeeded()); EXPECT_EQ(expectedAction, state.nextAction()); // Case 3: needsCommit=true updateMoreResourcesPending=false. state.setNeedsCommit(true); state.setUpdateMoreResourcesPending(false); + EXPECT_TRUE(state.vsyncCallbackNeeded()); EXPECT_EQ(expectedAction, state.nextAction()); // Case 4: needsCommit=true updateMoreResourcesPending=true. state.setNeedsCommit(true); state.setUpdateMoreResourcesPending(true); + EXPECT_TRUE(state.vsyncCallbackNeeded()); EXPECT_EQ(expectedAction, state.nextAction()); } } diff --git a/Source/WebKit/chromium/tests/CCSchedulerTest.cpp b/Source/WebKit/chromium/tests/CCSchedulerTest.cpp index 0fe811d86..475987f13 100644 --- a/Source/WebKit/chromium/tests/CCSchedulerTest.cpp +++ b/Source/WebKit/chromium/tests/CCSchedulerTest.cpp @@ -77,6 +77,7 @@ TEST(CCSchedulerTest, RequestCommit) scheduler->setNeedsCommit(); EXPECT_EQ(1, client.numActions()); EXPECT_STREQ("scheduledActionBeginFrame", client.action(0)); + EXPECT_FALSE(timeSource->active()); client.reset(); // Since, hasMoreResourceUpdates is set to false, @@ -86,17 +87,18 @@ TEST(CCSchedulerTest, RequestCommit) EXPECT_EQ(2, client.numActions()); EXPECT_STREQ("scheduledActionUpdateMoreResources", client.action(0)); EXPECT_STREQ("scheduledActionCommit", client.action(1)); + EXPECT_TRUE(timeSource->active()); client.reset(); // Tick should draw. timeSource->tick(); EXPECT_EQ(1, client.numActions()); EXPECT_STREQ("scheduledActionDrawAndSwap", client.action(0)); + EXPECT_FALSE(timeSource->active()); client.reset(); - // Tick should do nothing. - timeSource->tick(); - EXPECT_EQ(0, client.numActions()); + // Timer should be off. + EXPECT_FALSE(timeSource->active()); } TEST(CCSchedulerTest, RequestCommitAfterBeginFrame) @@ -126,6 +128,7 @@ TEST(CCSchedulerTest, RequestCommitAfterBeginFrame) // Tick should draw but then begin another frame. timeSource->tick(); + EXPECT_FALSE(timeSource->active()); EXPECT_EQ(2, client.numActions()); EXPECT_STREQ("scheduledActionDrawAndSwap", client.action(0)); EXPECT_STREQ("scheduledActionBeginFrame", client.action(1)); @@ -175,15 +178,18 @@ TEST(CCSchedulerTest, RequestRedrawInsideDraw) scheduler->setNeedsRedraw(); EXPECT_TRUE(scheduler->redrawPending()); + EXPECT_TRUE(timeSource->active()); EXPECT_EQ(0, client.numDraws()); timeSource->tick(); EXPECT_EQ(1, client.numDraws()); EXPECT_TRUE(scheduler->redrawPending()); + EXPECT_TRUE(timeSource->active()); timeSource->tick(); EXPECT_EQ(2, client.numDraws()); EXPECT_FALSE(scheduler->redrawPending()); + EXPECT_FALSE(timeSource->active()); } class SchedulerClientThatSetNeedsCommitInsideDraw : public CCSchedulerClient { @@ -228,14 +234,17 @@ TEST(CCSchedulerTest, RequestCommitInsideDraw) scheduler->setNeedsRedraw(); EXPECT_TRUE(scheduler->redrawPending()); EXPECT_EQ(0, client.numDraws()); + EXPECT_TRUE(timeSource->active()); timeSource->tick(); + EXPECT_FALSE(timeSource->active()); EXPECT_EQ(1, client.numDraws()); EXPECT_TRUE(scheduler->commitPending()); scheduler->beginFrameComplete(); timeSource->tick(); EXPECT_EQ(2, client.numDraws()); + EXPECT_FALSE(timeSource->active()); EXPECT_FALSE(scheduler->redrawPending()); } diff --git a/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h b/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h index fcf703e51..9b5e0383e 100644 --- a/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h +++ b/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h @@ -91,6 +91,7 @@ public: virtual void setClient(WebCore::CCTimeSourceClient* client) { m_client = client; } virtual void setActive(bool b) { m_active = b; } + virtual bool active() const { return m_active; } void tick() { diff --git a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp new file mode 100644 index 000000000..059ef2adc --- /dev/null +++ b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 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 "cc/CCSolidColorLayerImpl.h" + +#include "CCLayerTestCommon.h" +#include "cc/CCSingleThreadProxy.h" +#include "cc/CCSolidColorDrawQuad.h" + +#include <gmock/gmock.h> +#include <gtest/gtest.h> + +using namespace WebCore; +using namespace CCLayerTestCommon; + +namespace { + +TEST(CCSolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap) +{ + DebugScopedSetImplThread scopedImplThread; + + CCQuadList quadList; + IntSize layerSize = IntSize(800, 600); + IntRect visibleLayerRect = IntRect(IntPoint(), layerSize); + + RefPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(0); + layer->setVisibleLayerRect(visibleLayerRect); + layer->setBounds(layerSize); + + OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); + layer->appendQuads(quadList, sharedQuadState.get()); + + verifyQuadsExactlyCoverRect(quadList, visibleLayerRect); +} + +TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) +{ + DebugScopedSetImplThread scopedImplThread; + + const Color testColor = 0xFFA55AFF; + + CCQuadList quadList; + IntSize layerSize = IntSize(100, 100); + IntRect visibleLayerRect = IntRect(IntPoint(), layerSize); + + RefPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(0); + layer->setVisibleLayerRect(visibleLayerRect); + layer->setBounds(layerSize); + layer->setBackgroundColor(testColor); + + OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); + layer->appendQuads(quadList, sharedQuadState.get()); + + ASSERT_EQ(quadList.size(), 1U); + EXPECT_EQ(quadList[0]->toSolidColorDrawQuad()->color(), testColor); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp index a2eea9440..d55c0bc16 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp @@ -26,13 +26,14 @@ #include "cc/CCTiledLayerImpl.h" -#include "Region.h" +#include "CCLayerTestCommon.h" #include "cc/CCSingleThreadProxy.h" #include "cc/CCTileDrawQuad.h" #include <gmock/gmock.h> #include <gtest/gtest.h> using namespace WebCore; +using namespace CCLayerTestCommon; namespace { @@ -46,11 +47,12 @@ static PassRefPtr<CCTiledLayerImpl> createLayer(const IntSize& tileSize, const I layer->setTilingData(*tiler); layer->setSkipsDraw(false); layer->setVisibleLayerRect(IntRect(IntPoint(), layerSize)); + layer->setDrawOpacity(1); int textureId = 1; for (int i = 0; i < tiler->numTilesX(); ++i) for (int j = 0; j < tiler->numTilesY(); ++j) - layer->syncTextureId(i, j, static_cast<Platform3DObject>(textureId++)); + layer->pushTileProperties(i, j, static_cast<Platform3DObject>(textureId++), IntRect(0, 0, 1, 1)); return layer.release(); } @@ -134,7 +136,7 @@ TEST(CCTiledLayerImplTest, checkerboarding) for (int i = 0; i < numTilesX; ++i) for (int j = 0; j < numTilesY; ++j) - layer->syncTextureId(i, j, static_cast<Platform3DObject>(0)); + layer->pushTileProperties(i, j, static_cast<Platform3DObject>(0), IntRect()); // All checkerboarding { @@ -146,16 +148,7 @@ TEST(CCTiledLayerImplTest, checkerboarding) } } -static bool completelyContains(const Region& container, const IntRect& rect) -{ - Region tester(rect); - Vector<IntRect> rects = container.rects(); - for (size_t i = 0; i < rects.size(); ++i) - tester.subtract(rects[i]); - return tester.isEmpty(); -} - -static void getQuads(CCQuadList& quads, IntSize tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleLayerRect) +static PassOwnPtr<CCSharedQuadState> getQuads(CCQuadList& quads, IntSize tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleLayerRect) { RefPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTexelOption); layer->setVisibleLayerRect(visibleLayerRect); @@ -163,24 +156,7 @@ static void getQuads(CCQuadList& quads, IntSize tileSize, const IntSize& layerSi OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); layer->appendQuads(quads, sharedQuadState.get()); -} - -// Align with expected and actual output -static const char* quadString = " Quad: "; - -static void verifyQuadsExactlyCoverRect(const CCQuadList& quads, const IntRect& rect) -{ - Region remaining(rect); - - for (size_t i = 0; i < quads.size(); ++i) { - CCDrawQuad* quad = quads[i].get(); - - EXPECT_TRUE(rect.contains(quad->quadRect())) << quadString << i; - EXPECT_TRUE(completelyContains(remaining, quad->quadRect())) << quadString << i; - remaining.subtract(Region(quad->quadRect())); - } - - EXPECT_TRUE(remaining.isEmpty()); + return sharedQuadState.release(); // The shared data must be owned as long as the quad list exists. } // Test with both border texels and without. @@ -200,7 +176,8 @@ static void coverageVisibleRectOnTileBoundaries(CCLayerTilingData::BorderTexelOp IntSize layerSize(1000, 1000); CCQuadList quads; - getQuads(quads, IntSize(100, 100), layerSize, borders, IntRect(IntPoint(), layerSize)); + OwnPtr<CCSharedQuadState> sharedState; + sharedState = getQuads(quads, IntSize(100, 100), layerSize, borders, IntRect(IntPoint(), layerSize)); verifyQuadsExactlyCoverRect(quads, IntRect(IntPoint(), layerSize)); } WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectOnTileBoundaries); @@ -216,7 +193,8 @@ static void coverageVisibleRectIntersectsTiles(CCLayerTilingData::BorderTexelOpt IntSize layerSize(250, 250); CCQuadList quads; - getQuads(quads, IntSize(50, 50), IntSize(250, 250), CCLayerTilingData::NoBorderTexels, visibleLayerRect); + OwnPtr<CCSharedQuadState> sharedState; + sharedState = getQuads(quads, IntSize(50, 50), IntSize(250, 250), CCLayerTilingData::NoBorderTexels, visibleLayerRect); verifyQuadsExactlyCoverRect(quads, visibleLayerRect); } WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsTiles); @@ -228,7 +206,8 @@ static void coverageVisibleRectIntersectsBounds(CCLayerTilingData::BorderTexelOp IntSize layerSize(220, 210); IntRect visibleLayerRect(IntPoint(), layerSize); CCQuadList quads; - getQuads(quads, IntSize(100, 100), layerSize, CCLayerTilingData::NoBorderTexels, visibleLayerRect); + OwnPtr<CCSharedQuadState> sharedState; + sharedState = getQuads(quads, IntSize(100, 100), layerSize, CCLayerTilingData::NoBorderTexels, visibleLayerRect); verifyQuadsExactlyCoverRect(quads, visibleLayerRect); } WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsBounds); @@ -240,7 +219,8 @@ TEST(CCTiledLayerImplTest, textureInfoForLayerNoBorders) IntSize tileSize(50, 50); IntSize layerSize(250, 250); CCQuadList quads; - getQuads(quads, tileSize, layerSize, CCLayerTilingData::NoBorderTexels, IntRect(IntPoint(), layerSize)); + OwnPtr<CCSharedQuadState> sharedState; + sharedState = getQuads(quads, tileSize, layerSize, CCLayerTilingData::NoBorderTexels, IntRect(IntPoint(), layerSize)); for (size_t i = 0; i < quads.size(); ++i) { ASSERT_EQ(quads[i]->material(), CCDrawQuad::TiledContent) << quadString << i; @@ -249,8 +229,95 @@ TEST(CCTiledLayerImplTest, textureInfoForLayerNoBorders) EXPECT_NE(quad->textureId(), 0u) << quadString << i; EXPECT_EQ(quad->textureOffset(), IntPoint()) << quadString << i; EXPECT_EQ(quad->textureSize(), tileSize) << quadString << i; + EXPECT_EQ(IntRect(0, 0, 1, 1), quad->opaqueRect()) << quadString << i; + } +} + +TEST(CCTiledLayerImplTest, tileOpaqueRectForLayerNoBorders) +{ + DebugScopedSetImplThread scopedImplThread; + + IntSize tileSize(50, 50); + IntSize layerSize(250, 250); + CCQuadList quads; + OwnPtr<CCSharedQuadState> sharedState; + sharedState = getQuads(quads, tileSize, layerSize, CCLayerTilingData::NoBorderTexels, IntRect(IntPoint(), layerSize)); + + for (size_t i = 0; i < quads.size(); ++i) { + ASSERT_EQ(quads[i]->material(), CCDrawQuad::TiledContent) << quadString << i; + CCTileDrawQuad* quad = static_cast<CCTileDrawQuad*>(quads[i].get()); + + EXPECT_EQ(IntRect(0, 0, 1, 1), quad->opaqueRect()) << quadString << i; } } +TEST(CCTiledLayerImplTest, backgroundCoversViewport) +{ + DebugScopedSetImplThread scopedImplThread; + + const IntSize tileSize(10, 10); + const int numTilesX = 2; + const int numTilesY = 2; + const unsigned numTiles = numTilesX * numTilesY; + const IntSize layerSize(tileSize.width() * numTilesX, tileSize.height() * numTilesY); + RefPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); + layer->setBackgroundColor(Color::gray); + layer->setBackgroundCoversViewport(true); + + // No gutter rects + { + IntRect clipRect = IntRect(IntPoint(), layerSize); + layer->setClipRect(clipRect); + layer->setVisibleLayerRect(IntRect(IntPoint(), layerSize)); + + OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); + + CCQuadList quads; + layer->appendQuads(quads, sharedQuadState.get()); + EXPECT_EQ(quads.size(), numTiles); + + for (size_t i = 0; i < quads.size(); ++i) + EXPECT_EQ(quads[i]->material(), CCDrawQuad::TiledContent); + } + + // Empty visible content area (fullscreen gutter rect) + { + IntRect clipRect = IntRect(100, 100, 100, 100); + layer->setClipRect(clipRect); + layer->setVisibleLayerRect(IntRect()); + + OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); + CCQuadList quads; + layer->appendQuads(quads, sharedQuadState.get()); + + for (size_t i = 0; i < quads.size(); ++i) + EXPECT_EQ(quads[i]->material(), CCDrawQuad::SolidColor); + + verifyQuadsExactlyCoverRect(quads, clipRect); + } + + // Content area in middle of clip rect (four surrounding gutter rects) + { + IntRect clipRect = IntRect(-50, -50, 100, 100); + layer->setClipRect(clipRect); + layer->setVisibleLayerRect(IntRect(IntPoint(), layerSize)); + + OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); + CCQuadList quads; + layer->appendQuads(quads, sharedQuadState.get()); + + unsigned numContentTiles = 0, numGutterTiles = 0; + for (size_t i = 0; i < quads.size(); ++i) { + if (quads[i]->material() == CCDrawQuad::TiledContent) + numContentTiles++; + else if (quads[i]->material() == CCDrawQuad::SolidColor) + numGutterTiles++; + } + EXPECT_EQ(numContentTiles, numTiles); + EXPECT_GE(numGutterTiles, 4u); + + verifyQuadsExactlyCoverRect(quads, clipRect); + } +} } // namespace diff --git a/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp index f0b5c411b..1df27c011 100644 --- a/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp @@ -29,6 +29,7 @@ #include "CCSchedulerTestCommon.h" #include "FakeWebGraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" +#include "Region.h" #include "TextureManager.h" #include "cc/CCCanvasLayerImpl.h" #include "cc/CCSingleThreadProxy.h" @@ -138,7 +139,8 @@ protected: canvas->contentChanged(); EXPECT_TRUE(canvas->needsDisplay()); - canvas->paintContentsIfDirty(); + Region occludedScreenSpace; + canvas->paintContentsIfDirty(occludedScreenSpace); EXPECT_FALSE(canvas->needsDisplay()); { DebugScopedSetImplThread scopedImplThread; diff --git a/Source/WebKit/chromium/tests/ClipboardChromiumTest.cpp b/Source/WebKit/chromium/tests/ClipboardChromiumTest.cpp new file mode 100644 index 000000000..24c11a4ec --- /dev/null +++ b/Source/WebKit/chromium/tests/ClipboardChromiumTest.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2010 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 "ClipboardChromium.h" + +#include <gtest/gtest.h> + +using namespace WebCore; + +namespace { + +#if OS(WINDOWS) +const char invalidCharacters[] = "\x00/\\:*?\"<>|"; +#else +const char invalidCharacters[] = + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" + "\x7f/"; +#endif +const char longString[] = + "0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368," + "75025,121393,196418,317811,514229,832040,1346269,2178309,3524578,5702887,9227465,14930352"; + +TEST(ClipboardChromiumTest, Normal) +{ + String name = "name"; + String extension = "ext"; + ClipboardChromium::validateFilename(name, extension); + EXPECT_EQ("name", name); + EXPECT_EQ("ext", extension); +} + +TEST(ClipboardChromiumTest, InvalidCharacters) +{ + String name = makeString("na", String(invalidCharacters, arraysize(invalidCharacters)), "me"); + String extension = makeString("e", String(invalidCharacters, arraysize(invalidCharacters)), "xt"); + ClipboardChromium::validateFilename(name, extension); + EXPECT_EQ("name", name); + EXPECT_EQ("ext", extension); +} + +TEST(ClipboardChromiumTest, ExtensionTooLong) +{ + String name; + String extension = makeString(longString, longString); + ClipboardChromium::validateFilename(name, extension); + EXPECT_EQ(String(), extension); +} + +TEST(ClipboardChromiumTest, NamePlusExtensionTooLong) +{ + String name = makeString(longString, longString); + String extension = longString; + ClipboardChromium::validateFilename(name, extension); + EXPECT_EQ("0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,109", name); + EXPECT_EQ(longString, extension); + EXPECT_EQ(254u, name.length() + extension.length()); +} + +} // anonymous namespace diff --git a/Source/WebKit/chromium/tests/CompositorFakeWebGraphicsContext3D.h b/Source/WebKit/chromium/tests/CompositorFakeWebGraphicsContext3D.h index de1409bd4..0790639d5 100644 --- a/Source/WebKit/chromium/tests/CompositorFakeWebGraphicsContext3D.h +++ b/Source/WebKit/chromium/tests/CompositorFakeWebGraphicsContext3D.h @@ -43,7 +43,7 @@ public: virtual void getShaderiv(WebGLId, WGC3Denum, WGC3Dint* value) { *value = 1; } virtual void getProgramiv(WebGLId, WGC3Denum, WGC3Dint* value) { *value = 1; } -private: +protected: explicit CompositorFakeWebGraphicsContext3D(Attributes attrs) { m_attrs = attrs; diff --git a/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h b/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h new file mode 100755 index 000000000..23231038a --- /dev/null +++ b/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef FakeCCLayerTreeHostClient_h +#define FakeCCLayerTreeHostClient_h + +#include "config.h" + +#include "cc/CCLayerTreeHost.h" +#include "CompositorFakeGraphicsContext3D.h" + +namespace WebCore { + +class FakeCCLayerTreeHostClient : public CCLayerTreeHostClient { +public: + virtual void updateAnimations(double frameBeginTime) { } + virtual void layout() { } + virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) { } + virtual PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D() + { + GraphicsContext3D::Attributes attrs; + return createCompositorMockGraphicsContext3D(attrs); + } + virtual void didRecreateGraphicsContext(bool success) { } + virtual void didCommitAndDrawFrame() { } + virtual void didCompleteSwapBuffers() { } + + // Used only in the single-threaded path. + virtual void scheduleComposite() { } +}; + +} +#endif // FakeCCLayerTreeHostClient_h diff --git a/Source/WebKit/chromium/tests/FrameTestHelpers.cpp b/Source/WebKit/chromium/tests/FrameTestHelpers.cpp index 1a1145631..ba6666699 100644 --- a/Source/WebKit/chromium/tests/FrameTestHelpers.cpp +++ b/Source/WebKit/chromium/tests/FrameTestHelpers.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "FrameTestHelpers.h" +#include "StdLibExtras.h" #include "WebFrame.h" #include "WebFrameClient.h" #include "WebSettings.h" @@ -71,7 +72,7 @@ class TestWebFrameClient : public WebFrameClient { static WebFrameClient* defaultWebFrameClient() { - static TestWebFrameClient client; + DEFINE_STATIC_LOCAL(TestWebFrameClient, client, ()); return &client; } @@ -80,7 +81,7 @@ class TestWebViewClient : public WebViewClient { static WebViewClient* defaultWebViewClient() { - static TestWebViewClient client; + DEFINE_STATIC_LOCAL(TestWebViewClient, client, ()); return &client; } diff --git a/Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp b/Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp index 7de6a6c8f..adceadf08 100644 --- a/Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp +++ b/Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp @@ -159,7 +159,7 @@ TEST(InjectIDBKeyTest, SubProperty) checkInjection(IDBKey::createArray(IDBKey::KeyArray()), SerializedScriptValue::create(object), "bar"); checkInjectionFails(IDBKey::createString("zoo"), SerializedScriptValue::create(object), "foo.bar.baz"); - checkInjectionFails(IDBKey::createString("zoo"), SerializedScriptValue::create(object), "foo.xyz.foo"); + checkInjection(IDBKey::createString("zoo"), SerializedScriptValue::create(object), "foo.xyz.foo"); } } // namespace diff --git a/Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp index b28f8e8b4..bf889594c 100644 --- a/Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp @@ -41,8 +41,8 @@ class MockGraphicsLayerClient : public GraphicsLayerClient { virtual void notifyAnimationStarted(const GraphicsLayer*, double time) { } virtual void notifySyncRequired(const GraphicsLayer*) { } virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip) { } - virtual bool showDebugBorders() const { return false; } - virtual bool showRepaintCounter() const { return false; } + virtual bool showDebugBorders(const GraphicsLayer*) const { return false; } + virtual bool showRepaintCounter(const GraphicsLayer*) const { return false; } }; class TestImage : public Image { diff --git a/Source/WebKit/chromium/tests/KURLTest.cpp b/Source/WebKit/chromium/tests/KURLTest.cpp index f2abda56b..394c664b1 100644 --- a/Source/WebKit/chromium/tests/KURLTest.cpp +++ b/Source/WebKit/chromium/tests/KURLTest.cpp @@ -316,7 +316,7 @@ TEST(KURLTest, Encode) {"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", "%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F"}, {" !\"#$%&'()*+,-./", - "%20!%22%23%24%25%26'()*%2B%2C-.%2F"}, + "%20!%22%23%24%25%26'()*%2B%2C-./"}, {"0123456789:;<=>?", "0123456789%3A%3B%3C%3D%3E%3F"}, {"@ABCDEFGHIJKLMNO", diff --git a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp index bc27c4329..43083a1d7 100644 --- a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp @@ -28,6 +28,7 @@ #include "cc/CCLayerTreeHost.h" #include "CCLayerTreeTestCommon.h" +#include "FakeCCLayerTreeHostClient.h" #include "LayerPainterChromium.h" #include "NonCompositedContentHost.h" #include "WebCompositor.h" @@ -50,20 +51,6 @@ using ::testing::AnyNumber; namespace { -class FakeCCLayerTreeHostClient : public CCLayerTreeHostClient { -public: - virtual void updateAnimations(double frameBeginTime) { } - virtual void layout() { } - virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) { } - virtual PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D() { return 0; } - virtual void didRecreateGraphicsContext(bool success) { } - virtual void didCommitAndDrawFrame() { } - virtual void didCompleteSwapBuffers() { } - - // Used only in the single-threaded path. - virtual void scheduleComposite() { } -}; - class MockCCLayerTreeHost : public CCLayerTreeHost { public: MockCCLayerTreeHost() @@ -135,13 +122,13 @@ protected: void createSimpleTestTree() { - m_parent = LayerChromium::create(0); - m_child1 = LayerChromium::create(0); - m_child2 = LayerChromium::create(0); - m_child3 = LayerChromium::create(0); - m_grandChild1 = LayerChromium::create(0); - m_grandChild2 = LayerChromium::create(0); - m_grandChild3 = LayerChromium::create(0); + m_parent = LayerChromium::create(); + m_child1 = LayerChromium::create(); + m_child2 = LayerChromium::create(); + m_child3 = LayerChromium::create(); + m_grandChild1 = LayerChromium::create(); + m_grandChild2 = LayerChromium::create(); + m_grandChild3 = LayerChromium::create(); EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AnyNumber()); m_layerTreeHost->setRootLayer(m_parent); @@ -164,7 +151,7 @@ protected: TEST_F(LayerChromiumTest, basicCreateAndDestroy) { - RefPtr<LayerChromium> testLayer = LayerChromium::create(0); + RefPtr<LayerChromium> testLayer = LayerChromium::create(); ASSERT_TRUE(testLayer); EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(0); @@ -173,8 +160,8 @@ TEST_F(LayerChromiumTest, basicCreateAndDestroy) TEST_F(LayerChromiumTest, addAndRemoveChild) { - RefPtr<LayerChromium> parent = LayerChromium::create(0); - RefPtr<LayerChromium> child = LayerChromium::create(0); + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromium> child = LayerChromium::create(); // Upon creation, layers should not have children or parent. ASSERT_EQ(static_cast<size_t>(0), parent->children().size()); @@ -194,11 +181,11 @@ TEST_F(LayerChromiumTest, addAndRemoveChild) TEST_F(LayerChromiumTest, insertChild) { - RefPtr<LayerChromium> parent = LayerChromium::create(0); - RefPtr<LayerChromium> child1 = LayerChromium::create(0); - RefPtr<LayerChromium> child2 = LayerChromium::create(0); - RefPtr<LayerChromium> child3 = LayerChromium::create(0); - RefPtr<LayerChromium> child4 = LayerChromium::create(0); + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromium> child1 = LayerChromium::create(); + RefPtr<LayerChromium> child2 = LayerChromium::create(); + RefPtr<LayerChromium> child3 = LayerChromium::create(); + RefPtr<LayerChromium> child4 = LayerChromium::create(); parent->setLayerTreeHost(m_layerTreeHost.get()); @@ -240,9 +227,9 @@ TEST_F(LayerChromiumTest, insertChild) TEST_F(LayerChromiumTest, insertChildPastEndOfList) { - RefPtr<LayerChromium> parent = LayerChromium::create(0); - RefPtr<LayerChromium> child1 = LayerChromium::create(0); - RefPtr<LayerChromium> child2 = LayerChromium::create(0); + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromium> child1 = LayerChromium::create(); + RefPtr<LayerChromium> child2 = LayerChromium::create(); ASSERT_EQ(static_cast<size_t>(0), parent->children().size()); @@ -262,9 +249,9 @@ TEST_F(LayerChromiumTest, insertChildPastEndOfList) TEST_F(LayerChromiumTest, insertSameChildTwice) { - RefPtr<LayerChromium> parent = LayerChromium::create(0); - RefPtr<LayerChromium> child1 = LayerChromium::create(0); - RefPtr<LayerChromium> child2 = LayerChromium::create(0); + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromium> child1 = LayerChromium::create(); + RefPtr<LayerChromium> child2 = LayerChromium::create(); parent->setLayerTreeHost(m_layerTreeHost.get()); @@ -291,7 +278,7 @@ TEST_F(LayerChromiumTest, insertSameChildTwice) TEST_F(LayerChromiumTest, replaceChildWithNewChild) { createSimpleTestTree(); - RefPtr<LayerChromium> child4 = LayerChromium::create(0); + RefPtr<LayerChromium> child4 = LayerChromium::create(); EXPECT_FALSE(child4->parent()); @@ -311,8 +298,8 @@ TEST_F(LayerChromiumTest, replaceChildWithNewChildThatHasOtherParent) createSimpleTestTree(); // create another simple tree with testLayer and child4. - RefPtr<LayerChromium> testLayer = LayerChromium::create(0); - RefPtr<LayerChromium> child4 = LayerChromium::create(0); + RefPtr<LayerChromium> testLayer = LayerChromium::create(); + RefPtr<LayerChromium> child4 = LayerChromium::create(); testLayer->addChild(child4); ASSERT_EQ(static_cast<size_t>(1), testLayer->children().size()); EXPECT_EQ(child4, testLayer->children()[0]); @@ -356,11 +343,11 @@ TEST_F(LayerChromiumTest, removeAllChildren) TEST_F(LayerChromiumTest, setChildren) { - RefPtr<LayerChromium> oldParent = LayerChromium::create(0); - RefPtr<LayerChromium> newParent = LayerChromium::create(0); + RefPtr<LayerChromium> oldParent = LayerChromium::create(); + RefPtr<LayerChromium> newParent = LayerChromium::create(); - RefPtr<LayerChromium> child1 = LayerChromium::create(0); - RefPtr<LayerChromium> child2 = LayerChromium::create(0); + RefPtr<LayerChromium> child1 = LayerChromium::create(); + RefPtr<LayerChromium> child2 = LayerChromium::create(); Vector<RefPtr<LayerChromium> > newChildren; newChildren.append(child1); @@ -390,7 +377,7 @@ TEST_F(LayerChromiumTest, getRootLayerAfterTreeManipulations) // For this test we don't care about setNeedsCommit calls. EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AtLeast(1)); - RefPtr<LayerChromium> child4 = LayerChromium::create(0); + RefPtr<LayerChromium> child4 = LayerChromium::create(); EXPECT_EQ(m_parent.get(), m_parent->rootLayer()); EXPECT_EQ(m_parent.get(), m_child1->rootLayer()); @@ -443,7 +430,7 @@ TEST_F(LayerChromiumTest, checkSetNeedsDisplayCausesCorrectBehavior) // 1. sets needsDisplay flag appropriately. // 2. indirectly calls setNeedsCommit, exactly once for each call to setNeedsDisplay. - RefPtr<LayerChromium> testLayer = LayerChromium::create(0); + RefPtr<LayerChromium> testLayer = LayerChromium::create(); testLayer->setLayerTreeHost(m_layerTreeHost.get()); IntSize testBounds = IntSize(501, 508); @@ -458,7 +445,7 @@ TEST_F(LayerChromiumTest, checkSetNeedsDisplayCausesCorrectBehavior) // This is just initialization, but setNeedsCommit behavior is verified anyway to avoid warnings. EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBounds(testBounds)); - testLayer = LayerChromium::create(0); + testLayer = LayerChromium::create(); testLayer->setLayerTreeHost(m_layerTreeHost.get()); EXPECT_FALSE(testLayer->needsDisplay()); @@ -477,43 +464,26 @@ TEST_F(LayerChromiumTest, checkSetNeedsDisplayCausesCorrectBehavior) EXPECT_TRUE(testLayer->needsDisplay()); // Case 4: LayerChromium should accept dirty rects that go beyond its bounds. - testLayer = LayerChromium::create(0); + testLayer = LayerChromium::create(); testLayer->setLayerTreeHost(m_layerTreeHost.get()); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBounds(testBounds)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setNeedsDisplayRect(outOfBoundsDirtyRect)); EXPECT_TRUE(testLayer->needsDisplay()); // Case 5: setNeedsDisplay() without the dirty rect arg. - testLayer = LayerChromium::create(0); + testLayer = LayerChromium::create(); testLayer->setLayerTreeHost(m_layerTreeHost.get()); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBounds(testBounds)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setNeedsDisplay()); EXPECT_TRUE(testLayer->needsDisplay()); } -TEST_F(LayerChromiumTest, checkSetNeedsDisplayWithNullDelegate) -{ - RefPtr<LayerChromium> testLayer = LayerChromium::create(0); - IntSize testBounds = IntSize(501, 508); - - FloatRect dirty = FloatRect(10.0f, 15.0f, 1.0f, 2.0f); - - testLayer->setBounds(testBounds); - EXPECT_TRUE(testLayer->needsDisplay()); - - testLayer = LayerChromium::create(0); - EXPECT_FALSE(testLayer->needsDisplay()); - - testLayer->setNeedsDisplayRect(dirty); - EXPECT_TRUE(testLayer->needsDisplay()); -} - TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) { - RefPtr<LayerChromium> testLayer = LayerChromium::create(0); + RefPtr<LayerChromium> testLayer = LayerChromium::create(); testLayer->setLayerTreeHost(m_layerTreeHost.get()); - RefPtr<LayerChromium> dummyLayer = LayerChromium::create(0); // just a dummy layer for this test case. + RefPtr<LayerChromium> dummyLayer = LayerChromium::create(); // just a dummy layer for this test case. // sanity check of initial test condition EXPECT_FALSE(testLayer->needsDisplay()); @@ -536,6 +506,7 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setAnchorPoint(FloatPoint(1.23f, 4.56f))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setAnchorPointZ(0.7f)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBackgroundColor(Color(0.4f, 0.4f, 0.4f))); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBackgroundCoversViewport(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setMasksToBounds(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setMaskLayer(dummyLayer.get())); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setOpacity(0.5f)); @@ -558,8 +529,8 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) class LayerChromiumWithContentScaling : public LayerChromium { public: - explicit LayerChromiumWithContentScaling(CCLayerDelegate* delegate) - : LayerChromium(delegate) + explicit LayerChromiumWithContentScaling() + : LayerChromium() { } @@ -576,7 +547,7 @@ public: TEST_F(LayerChromiumTest, checkContentsScaleChangeTriggersNeedsDisplay) { - RefPtr<LayerChromiumWithContentScaling> testLayer = adoptRef(new LayerChromiumWithContentScaling(0)); + RefPtr<LayerChromiumWithContentScaling> testLayer = adoptRef(new LayerChromiumWithContentScaling()); testLayer->setLayerTreeHost(m_layerTreeHost.get()); IntSize testBounds = IntSize(320, 240); @@ -626,11 +597,11 @@ void assertLayerTreeHostMatchesForSubtree(LayerChromium* layer, CCLayerTreeHost* TEST(LayerChromiumLayerTreeHostTest, enteringTree) { WebKit::WebCompositor::initialize(0); - RefPtr<LayerChromium> parent = LayerChromium::create(0); - RefPtr<LayerChromium> child = LayerChromium::create(0); - RefPtr<LayerChromium> mask = LayerChromium::create(0); - RefPtr<LayerChromium> replica = LayerChromium::create(0); - RefPtr<LayerChromium> replicaMask = LayerChromium::create(0); + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromium> child = LayerChromium::create(); + RefPtr<LayerChromium> mask = LayerChromium::create(); + RefPtr<LayerChromium> replica = LayerChromium::create(); + RefPtr<LayerChromium> replicaMask = LayerChromium::create(); // Set up a detached tree of layers. The host pointer should be nil for these layers. parent->addChild(child); @@ -658,7 +629,7 @@ TEST(LayerChromiumLayerTreeHostTest, enteringTree) TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree) { WebKit::WebCompositor::initialize(0); - RefPtr<LayerChromium> parent = LayerChromium::create(0); + RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<FakeCCLayerTreeHost> layerTreeHost = FakeCCLayerTreeHost::create(); layerTreeHost->setRootLayer(parent.get()); @@ -666,16 +637,16 @@ TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree) EXPECT_EQ(parent->layerTreeHost(), layerTreeHost.get()); // Adding a subtree to a layer already associated with a host should set the host pointer on all layers in that subtree. - RefPtr<LayerChromium> child = LayerChromium::create(0); - RefPtr<LayerChromium> grandChild = LayerChromium::create(0); + RefPtr<LayerChromium> child = LayerChromium::create(); + RefPtr<LayerChromium> grandChild = LayerChromium::create(); child->addChild(grandChild); // Masks, replicas, and replica masks should pick up the new host too. - RefPtr<LayerChromium> childMask = LayerChromium::create(0); + RefPtr<LayerChromium> childMask = LayerChromium::create(); child->setMaskLayer(childMask.get()); - RefPtr<LayerChromium> childReplica = LayerChromium::create(0); + RefPtr<LayerChromium> childReplica = LayerChromium::create(); child->setReplicaLayer(childReplica.get()); - RefPtr<LayerChromium> childReplicaMask = LayerChromium::create(0); + RefPtr<LayerChromium> childReplicaMask = LayerChromium::create(); childReplica->setMaskLayer(childReplicaMask.get()); parent->addChild(child); @@ -689,11 +660,11 @@ TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree) TEST(LayerChromiumLayerTreeHostTest, changeHost) { WebKit::WebCompositor::initialize(0); - RefPtr<LayerChromium> parent = LayerChromium::create(0); - RefPtr<LayerChromium> child = LayerChromium::create(0); - RefPtr<LayerChromium> mask = LayerChromium::create(0); - RefPtr<LayerChromium> replica = LayerChromium::create(0); - RefPtr<LayerChromium> replicaMask = LayerChromium::create(0); + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromium> child = LayerChromium::create(); + RefPtr<LayerChromium> mask = LayerChromium::create(); + RefPtr<LayerChromium> replica = LayerChromium::create(); + RefPtr<LayerChromium> replicaMask = LayerChromium::create(); // Same setup as the previous test. parent->addChild(child); @@ -722,11 +693,11 @@ TEST(LayerChromiumLayerTreeHostTest, changeHost) TEST(LayerChromiumLayerTreeHostTest, changeHostInSubtree) { WebKit::WebCompositor::initialize(0); - RefPtr<LayerChromium> firstParent = LayerChromium::create(0); - RefPtr<LayerChromium> firstChild = LayerChromium::create(0); - RefPtr<LayerChromium> secondParent = LayerChromium::create(0); - RefPtr<LayerChromium> secondChild = LayerChromium::create(0); - RefPtr<LayerChromium> secondGrandChild = LayerChromium::create(0); + RefPtr<LayerChromium> firstParent = LayerChromium::create(); + RefPtr<LayerChromium> firstChild = LayerChromium::create(); + RefPtr<LayerChromium> secondParent = LayerChromium::create(); + RefPtr<LayerChromium> secondChild = LayerChromium::create(); + RefPtr<LayerChromium> secondGrandChild = LayerChromium::create(); // First put all children under the first parent and set the first host. firstParent->addChild(firstChild); @@ -759,13 +730,13 @@ TEST(LayerChromiumLayerTreeHostTest, changeHostInSubtree) TEST(LayerChromiumLayerTreeHostTest, replaceMaskAndReplicaLayer) { WebKit::WebCompositor::initialize(0); - RefPtr<LayerChromium> parent = LayerChromium::create(0); - RefPtr<LayerChromium> mask = LayerChromium::create(0); - RefPtr<LayerChromium> replica = LayerChromium::create(0); - RefPtr<LayerChromium> maskChild = LayerChromium::create(0); - RefPtr<LayerChromium> replicaChild = LayerChromium::create(0); - RefPtr<LayerChromium> maskReplacement = LayerChromium::create(0); - RefPtr<LayerChromium> replicaReplacement = LayerChromium::create(0); + RefPtr<LayerChromium> parent = LayerChromium::create(); + RefPtr<LayerChromium> mask = LayerChromium::create(); + RefPtr<LayerChromium> replica = LayerChromium::create(); + RefPtr<LayerChromium> maskChild = LayerChromium::create(); + RefPtr<LayerChromium> replicaChild = LayerChromium::create(); + RefPtr<LayerChromium> maskReplacement = LayerChromium::create(); + RefPtr<LayerChromium> replicaReplacement = LayerChromium::create(); parent->setMaskLayer(mask.get()); parent->setReplicaLayer(replica.get()); diff --git a/Source/WebKit/chromium/tests/LayerTextureUpdaterTest.cpp b/Source/WebKit/chromium/tests/LayerTextureUpdaterTest.cpp new file mode 100644 index 000000000..bdbf7bb09 --- /dev/null +++ b/Source/WebKit/chromium/tests/LayerTextureUpdaterTest.cpp @@ -0,0 +1,198 @@ +/* + * 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 "LayerTextureUpdater.h" + +#include "BitmapCanvasLayerTextureUpdater.h" +#include "BitmapSkPictureCanvasLayerTextureUpdater.h" +#include "FrameBufferSkPictureCanvasLayerTextureUpdater.h" +#include "GraphicsContext.h" +#include "LayerPainterChromium.h" +#include "PlatformContextSkia.h" +#include "SkPictureCanvasLayerTextureUpdater.h" + +#include <gmock/gmock.h> +#include <gtest/gtest.h> + +using namespace WebCore; + +namespace { + +struct PaintCallback { + virtual void operator()(GraphicsContext&, const IntRect&) = 0; +}; + +class TestLayerPainterChromium : public LayerPainterChromium { +public: + TestLayerPainterChromium(PaintCallback& callback) : m_callback(callback) { } + + virtual void paint(GraphicsContext& context, const IntRect& contentRect) + { + m_callback(context, contentRect); + } + + private: + PaintCallback& m_callback; +}; + +// Paint callback functions + +struct PaintFillOpaque : public PaintCallback { + virtual void operator()(GraphicsContext& context, const IntRect& contentRect) + { + Color opaque(255, 0, 0, 255); + IntRect top(contentRect.x(), contentRect.y(), contentRect.width(), contentRect.height() / 2); + IntRect bottom(contentRect.x(), contentRect.y() + contentRect.height() / 2, contentRect.width(), contentRect.height() / 2); + context.fillRect(top, opaque, ColorSpaceDeviceRGB); + context.fillRect(bottom, opaque, ColorSpaceDeviceRGB); + } +}; + +struct PaintFillAlpha : public PaintCallback { + virtual void operator()(GraphicsContext& context, const IntRect& contentRect) + { + Color alpha(0, 0, 0, 0); + context.fillRect(contentRect, alpha, ColorSpaceDeviceRGB); + } +}; + +#define EXPECT_EQ_RECT(a, b) \ + EXPECT_EQ(a.x(), b.x()); \ + EXPECT_EQ(a.maxX(), b.maxX()); \ + EXPECT_EQ(a.y(), b.y()); \ + EXPECT_EQ(a.maxY(), b.maxY()); + +TEST(LayerTextureUpdaterTest, testOpaqueRectPresentAfterOpaquePaint) +{ + PaintFillOpaque fillOpaque; + RefPtr<LayerTextureUpdater> updater; + IntRect opaqueRect; + OwnPtr<TestLayerPainterChromium> painter; + + opaqueRect = IntRect(); + painter = adoptPtr(new TestLayerPainterChromium(fillOpaque)); + updater = BitmapCanvasLayerTextureUpdater::create(painter.release(), false); + updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, &opaqueRect); + EXPECT_EQ_RECT(IntRect(0, 0, 400, 400), opaqueRect); + + opaqueRect = IntRect(); + painter = adoptPtr(new TestLayerPainterChromium(fillOpaque)); + updater = BitmapSkPictureCanvasLayerTextureUpdater::create(painter.release(), false); + updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, &opaqueRect); + EXPECT_EQ_RECT(IntRect(0, 0, 400, 400), opaqueRect); + + opaqueRect = IntRect(); + painter = adoptPtr(new TestLayerPainterChromium(fillOpaque)); + updater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(painter.release()); + updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, &opaqueRect); + EXPECT_EQ_RECT(IntRect(0, 0, 400, 400), opaqueRect); +} + +TEST(LayerTextureUpdaterTest, testOpaqueRectNotPresentAfterNonOpaquePaint) +{ + PaintFillAlpha fillAlpha; + RefPtr<LayerTextureUpdater> updater; + IntRect opaqueRect; + OwnPtr<TestLayerPainterChromium> painter; + + opaqueRect = IntRect(); + painter = adoptPtr(new TestLayerPainterChromium(fillAlpha)); + updater = BitmapCanvasLayerTextureUpdater::create(painter.release(), false); + updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, &opaqueRect); + EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect); + + opaqueRect = IntRect(); + painter = adoptPtr(new TestLayerPainterChromium(fillAlpha)); + updater = BitmapSkPictureCanvasLayerTextureUpdater::create(painter.release(), false); + updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, &opaqueRect); + EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect); + + opaqueRect = IntRect(); + painter = adoptPtr(new TestLayerPainterChromium(fillAlpha)); + updater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(painter.release()); + updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, &opaqueRect); + EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect); +} + +TEST(LayerTextureUpdaterTest, testOpaqueRectNotPresentForOpaqueLayerWithOpaquePaint) +{ + PaintFillOpaque fillOpaque; + RefPtr<LayerTextureUpdater> updater; + IntRect opaqueRect; + OwnPtr<TestLayerPainterChromium> painter; + + opaqueRect = IntRect(); + painter = adoptPtr(new TestLayerPainterChromium(fillOpaque)); + updater = BitmapCanvasLayerTextureUpdater::create(painter.release(), false); + updater->setOpaque(true); + updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, &opaqueRect); + EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect); + + opaqueRect = IntRect(); + painter = adoptPtr(new TestLayerPainterChromium(fillOpaque)); + updater = BitmapSkPictureCanvasLayerTextureUpdater::create(painter.release(), false); + updater->setOpaque(true); + updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, &opaqueRect); + EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect); + + opaqueRect = IntRect(); + painter = adoptPtr(new TestLayerPainterChromium(fillOpaque)); + updater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(painter.release()); + updater->setOpaque(true); + updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, &opaqueRect); + EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect); +} + +TEST(LayerTextureUpdaterTest, testOpaqueRectNotPresentForOpaqueLayerWithNonOpaquePaint) +{ + PaintFillAlpha fillAlpha; + RefPtr<LayerTextureUpdater> updater; + IntRect opaqueRect; + OwnPtr<TestLayerPainterChromium> painter; + + opaqueRect = IntRect(); + painter = adoptPtr(new TestLayerPainterChromium(fillAlpha)); + updater = BitmapCanvasLayerTextureUpdater::create(painter.release(), false); + updater->setOpaque(true); + updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, &opaqueRect); + EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect); + + opaqueRect = IntRect(); + painter = adoptPtr(new TestLayerPainterChromium(fillAlpha)); + updater = BitmapSkPictureCanvasLayerTextureUpdater::create(painter.release(), false); + updater->setOpaque(true); + updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, &opaqueRect); + EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect); + + opaqueRect = IntRect(); + painter = adoptPtr(new TestLayerPainterChromium(fillAlpha)); + updater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(painter.release()); + updater->setOpaque(true); + updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, &opaqueRect); + EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/PaintAggregatorTest.cpp b/Source/WebKit/chromium/tests/PaintAggregatorTest.cpp new file mode 100644 index 000000000..fcf374b47 --- /dev/null +++ b/Source/WebKit/chromium/tests/PaintAggregatorTest.cpp @@ -0,0 +1,493 @@ +/* + * Copyright (C) 2010 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 "painting/PaintAggregator.h" + +#include <gtest/gtest.h> + +using namespace WebCore; +using namespace WebKit; + +namespace { + +TEST(PaintAggregator, InitialState) +{ + PaintAggregator greg; + EXPECT_FALSE(greg.hasPendingUpdate()); +} + +TEST(PaintAggregator, SingleInvalidation) +{ + PaintAggregator greg; + + IntRect rect(2, 4, 10, 16); + greg.invalidateRect(rect); + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + EXPECT_TRUE(update.scrollRect.isEmpty()); + ASSERT_EQ(1U, update.paintRects.size()); + + EXPECT_EQ(rect, update.paintRects[0]); +} + +TEST(PaintAggregator, DoubleDisjointInvalidation) +{ + PaintAggregator greg; + + IntRect r1(2, 4, 2, 40); + IntRect r2(4, 2, 40, 2); + + greg.invalidateRect(r1); + greg.invalidateRect(r2); + + IntRect expectedBounds = unionRect(r1, r2); + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + EXPECT_TRUE(update.scrollRect.isEmpty()); + EXPECT_EQ(2U, update.paintRects.size()); + + EXPECT_EQ(expectedBounds, update.calculatePaintBounds()); +} + +TEST(PaintAggregator, DisjointInvalidationsCombined) +{ + PaintAggregator greg; + + // Make the rectangles such that they don't overlap but cover a very large + // percentage of the area of covered by their union. This is so we're not + // very sensitive to the combining heuristic in the paint aggregator. + IntRect r1(2, 4, 2, 1000); + IntRect r2(5, 2, 2, 1000); + + greg.invalidateRect(r1); + greg.invalidateRect(r2); + + IntRect expectedBounds = unionRect(r1, r2); + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + EXPECT_TRUE(update.scrollRect.isEmpty()); + ASSERT_EQ(1U, update.paintRects.size()); + + EXPECT_EQ(expectedBounds, update.paintRects[0]); +} + +TEST(PaintAggregator, SingleScroll) +{ + PaintAggregator greg; + + IntRect rect(1, 2, 3, 4); + IntPoint delta(1, 0); + greg.scrollRect(delta.x(), delta.y(), rect); + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + EXPECT_TRUE(update.paintRects.isEmpty()); + EXPECT_FALSE(update.scrollRect.isEmpty()); + + EXPECT_EQ(rect, update.scrollRect); + + EXPECT_EQ(delta.x(), update.scrollDelta.x()); + EXPECT_EQ(delta.y(), update.scrollDelta.y()); + + IntRect resultingDamage = update.calculateScrollDamage(); + IntRect expectedDamage(1, 2, 1, 4); + EXPECT_EQ(expectedDamage, resultingDamage); +} + +TEST(PaintAggregator, DoubleOverlappingScroll) +{ + PaintAggregator greg; + + IntRect rect(1, 2, 3, 4); + IntPoint delta1(1, 0); + IntPoint delta2(1, 0); + greg.scrollRect(delta1.x(), delta1.y(), rect); + greg.scrollRect(delta2.x(), delta2.y(), rect); + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + EXPECT_TRUE(update.paintRects.isEmpty()); + EXPECT_FALSE(update.scrollRect.isEmpty()); + + EXPECT_EQ(rect, update.scrollRect); + + IntPoint expectedDelta(delta1.x() + delta2.x(), + delta1.y() + delta2.y()); + EXPECT_EQ(expectedDelta.x(), update.scrollDelta.x()); + EXPECT_EQ(expectedDelta.y(), update.scrollDelta.y()); + + IntRect resultingDamage = update.calculateScrollDamage(); + IntRect expectedDamage(1, 2, 2, 4); + EXPECT_EQ(expectedDamage, resultingDamage); +} + +TEST(PaintAggregator, NegatingScroll) +{ + PaintAggregator greg; + + // Scroll twice in opposite directions by equal amounts. The result + // should be no scrolling. + + IntRect rect(1, 2, 3, 4); + IntPoint delta1(1, 0); + IntPoint delta2(-1, 0); + greg.scrollRect(delta1.x(), delta1.y(), rect); + greg.scrollRect(delta2.x(), delta2.y(), rect); + + EXPECT_FALSE(greg.hasPendingUpdate()); +} + +TEST(PaintAggregator, DiagonalScroll) +{ + PaintAggregator greg; + + // We don't support optimized diagonal scrolling, so this should result in + // repainting. + + IntRect rect(1, 2, 3, 4); + IntPoint delta(1, 1); + greg.scrollRect(delta.x(), delta.y(), rect); + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + EXPECT_TRUE(update.scrollRect.isEmpty()); + ASSERT_EQ(1U, update.paintRects.size()); + + EXPECT_EQ(rect, update.paintRects[0]); +} + +TEST(PaintAggregator, ContainedPaintAfterScroll) +{ + PaintAggregator greg; + + IntRect scrollRect(0, 0, 10, 10); + greg.scrollRect(2, 0, scrollRect); + + IntRect paintRect(4, 4, 2, 2); + greg.invalidateRect(paintRect); + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + // expecting a paint rect inside the scroll rect + EXPECT_FALSE(update.scrollRect.isEmpty()); + EXPECT_EQ(1U, update.paintRects.size()); + + EXPECT_EQ(scrollRect, update.scrollRect); + EXPECT_EQ(paintRect, update.paintRects[0]); +} + +TEST(PaintAggregator, ContainedPaintBeforeScroll) +{ + PaintAggregator greg; + + IntRect paintRect(4, 4, 2, 2); + greg.invalidateRect(paintRect); + + IntRect scrollRect(0, 0, 10, 10); + greg.scrollRect(2, 0, scrollRect); + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + // Expecting a paint rect inside the scroll rect + EXPECT_FALSE(update.scrollRect.isEmpty()); + EXPECT_EQ(1U, update.paintRects.size()); + + paintRect.move(2, 0); + + EXPECT_EQ(scrollRect, update.scrollRect); + EXPECT_EQ(paintRect, update.paintRects[0]); +} + +TEST(PaintAggregator, ContainedPaintsBeforeAndAfterScroll) +{ + PaintAggregator greg; + + IntRect paintRect1(4, 4, 2, 2); + greg.invalidateRect(paintRect1); + + IntRect scrollRect(0, 0, 10, 10); + greg.scrollRect(2, 0, scrollRect); + + IntRect paintRect2(6, 4, 2, 2); + greg.invalidateRect(paintRect2); + + IntRect expectedPaintRect = paintRect2; + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + // Expecting a paint rect inside the scroll rect + EXPECT_FALSE(update.scrollRect.isEmpty()); + EXPECT_EQ(1U, update.paintRects.size()); + + EXPECT_EQ(scrollRect, update.scrollRect); + EXPECT_EQ(expectedPaintRect, update.paintRects[0]); +} + +TEST(PaintAggregator, LargeContainedPaintAfterScroll) +{ + PaintAggregator greg; + + IntRect scrollRect(0, 0, 10, 10); + greg.scrollRect(0, 1, scrollRect); + + IntRect paintRect(0, 0, 10, 9); // Repaint 90% + greg.invalidateRect(paintRect); + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + EXPECT_TRUE(update.scrollRect.isEmpty()); + EXPECT_EQ(1U, update.paintRects.size()); + + EXPECT_EQ(scrollRect, update.paintRects[0]); +} + +TEST(PaintAggregator, LargeContainedPaintBeforeScroll) +{ + PaintAggregator greg; + + IntRect paintRect(0, 0, 10, 9); // Repaint 90% + greg.invalidateRect(paintRect); + + IntRect scrollRect(0, 0, 10, 10); + greg.scrollRect(0, 1, scrollRect); + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + EXPECT_TRUE(update.scrollRect.isEmpty()); + EXPECT_EQ(1U, update.paintRects.size()); + + EXPECT_EQ(scrollRect, update.paintRects[0]); +} + +TEST(PaintAggregator, OverlappingPaintBeforeScroll) +{ + PaintAggregator greg; + + IntRect paintRect(4, 4, 10, 2); + greg.invalidateRect(paintRect); + + IntRect scrollRect(0, 0, 10, 10); + greg.scrollRect(2, 0, scrollRect); + + IntRect expectedPaintRect = unionRect(scrollRect, paintRect); + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + EXPECT_TRUE(update.scrollRect.isEmpty()); + EXPECT_EQ(1U, update.paintRects.size()); + + EXPECT_EQ(expectedPaintRect, update.paintRects[0]); +} + +TEST(PaintAggregator, OverlappingPaintAfterScroll) +{ + PaintAggregator greg; + + IntRect scrollRect(0, 0, 10, 10); + greg.scrollRect(2, 0, scrollRect); + + IntRect paintRect(4, 4, 10, 2); + greg.invalidateRect(paintRect); + + IntRect expectedPaintRect = unionRect(scrollRect, paintRect); + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + EXPECT_TRUE(update.scrollRect.isEmpty()); + EXPECT_EQ(1U, update.paintRects.size()); + + EXPECT_EQ(expectedPaintRect, update.paintRects[0]); +} + +TEST(PaintAggregator, DisjointPaintBeforeScroll) +{ + PaintAggregator greg; + + IntRect paintRect(4, 4, 10, 2); + greg.invalidateRect(paintRect); + + IntRect scrollRect(0, 0, 2, 10); + greg.scrollRect(2, 0, scrollRect); + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + EXPECT_FALSE(update.scrollRect.isEmpty()); + EXPECT_EQ(1U, update.paintRects.size()); + + EXPECT_EQ(paintRect, update.paintRects[0]); + EXPECT_EQ(scrollRect, update.scrollRect); +} + +TEST(PaintAggregator, DisjointPaintAfterScroll) +{ + PaintAggregator greg; + + IntRect scrollRect(0, 0, 2, 10); + greg.scrollRect(2, 0, scrollRect); + + IntRect paintRect(4, 4, 10, 2); + greg.invalidateRect(paintRect); + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + EXPECT_FALSE(update.scrollRect.isEmpty()); + EXPECT_EQ(1U, update.paintRects.size()); + + EXPECT_EQ(paintRect, update.paintRects[0]); + EXPECT_EQ(scrollRect, update.scrollRect); +} + +TEST(PaintAggregator, ContainedPaintTrimmedByScroll) +{ + PaintAggregator greg; + + IntRect paintRect(4, 4, 6, 6); + greg.invalidateRect(paintRect); + + IntRect scrollRect(0, 0, 10, 10); + greg.scrollRect(2, 0, scrollRect); + + // The paint rect should have become narrower. + IntRect expectedPaintRect(6, 4, 4, 6); + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + EXPECT_FALSE(update.scrollRect.isEmpty()); + EXPECT_EQ(1U, update.paintRects.size()); + + EXPECT_EQ(expectedPaintRect, update.paintRects[0]); + EXPECT_EQ(scrollRect, update.scrollRect); +} + +TEST(PaintAggregator, ContainedPaintEliminatedByScroll) +{ + PaintAggregator greg; + + IntRect paintRect(4, 4, 6, 6); + greg.invalidateRect(paintRect); + + IntRect scrollRect(0, 0, 10, 10); + greg.scrollRect(6, 0, scrollRect); + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + EXPECT_FALSE(update.scrollRect.isEmpty()); + EXPECT_TRUE(update.paintRects.isEmpty()); + + EXPECT_EQ(scrollRect, update.scrollRect); +} + +TEST(PaintAggregator, ContainedPaintAfterScrollTrimmedByScrollDamage) +{ + PaintAggregator greg; + + IntRect scrollRect(0, 0, 10, 10); + greg.scrollRect(4, 0, scrollRect); + + IntRect paintRect(2, 0, 4, 10); + greg.invalidateRect(paintRect); + + IntRect expectedScrollDamage(0, 0, 4, 10); + IntRect expectedPaintRect(4, 0, 2, 10); + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + EXPECT_FALSE(update.scrollRect.isEmpty()); + EXPECT_EQ(1U, update.paintRects.size()); + + EXPECT_EQ(scrollRect, update.scrollRect); + EXPECT_EQ(expectedScrollDamage, update.calculateScrollDamage()); + EXPECT_EQ(expectedPaintRect, update.paintRects[0]); +} + +TEST(PaintAggregator, ContainedPaintAfterScrollEliminatedByScrollDamage) +{ + PaintAggregator greg; + + IntRect scrollRect(0, 0, 10, 10); + greg.scrollRect(4, 0, scrollRect); + + IntRect paintRect(2, 0, 2, 10); + greg.invalidateRect(paintRect); + + IntRect expectedScrollDamage(0, 0, 4, 10); + + EXPECT_TRUE(greg.hasPendingUpdate()); + PaintAggregator::PendingUpdate update; + greg.popPendingUpdate(&update); + + EXPECT_FALSE(update.scrollRect.isEmpty()); + EXPECT_TRUE(update.paintRects.isEmpty()); + + EXPECT_EQ(scrollRect, update.scrollRect); + EXPECT_EQ(expectedScrollDamage, update.calculateScrollDamage()); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp b/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp new file mode 100644 index 000000000..0ff539023 --- /dev/null +++ b/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp @@ -0,0 +1,464 @@ +/* + * 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 "PlatformContextSkia.h" + +#include "BitmapImageSingleFrameSkia.h" +#include "GraphicsContext.h" +#include "NativeImageSkia.h" +#include "SkCanvas.h" +#include <gtest/gtest.h> + +using namespace WebCore; + +namespace { + +#define EXPECT_EQ_RECT(a, b) \ + EXPECT_EQ(a.x(), b.x()); \ + EXPECT_EQ(a.maxX(), b.maxX()); \ + EXPECT_EQ(a.y(), b.y()); \ + EXPECT_EQ(a.maxY(), b.maxY()); + +#define EXPECT_PIXELS_MATCH(bitmap, opaqueRect) \ +{ \ + SkAutoLockPixels locker(bitmap); \ + for (int y = opaqueRect.y(); y < opaqueRect.maxY(); ++y) \ + for (int x = opaqueRect.x(); x < opaqueRect.maxX(); ++x) { \ + int alpha = *bitmap.getAddr32(x, y) >> 24; \ + EXPECT_EQ(255, alpha); \ + } \ +} + +TEST(PlatformContextSkiaTest, trackOpaqueTest) +{ + SkBitmap bitmap; + bitmap.setConfig(SkBitmap::kARGB_8888_Config, 400, 400); + bitmap.allocPixels(); + SkCanvas canvas(bitmap); + + PlatformContextSkia platformContext(&canvas); + platformContext.setTrackOpaqueRegion(true); + GraphicsContext context(&platformContext); + + Color opaque(1.0f, 0.0f, 0.0f, 1.0f); + Color alpha(0.0f, 0.0f, 0.0f, 0.0f); + + context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.fillRect(FloatRect(10, 10, 90, 90), alpha, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.fillRect(FloatRect(99, 13, 10, 90), opaque, ColorSpaceDeviceRGB, CompositePlusLighter); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.fillRect(FloatRect(99, 13, 10, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceIn); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.fillRect(FloatRect(99, 13, 10, 90), alpha, ColorSpaceDeviceRGB, CompositeSourceIn); + EXPECT_EQ_RECT(IntRect(10, 10, 89, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.fillRect(FloatRect(8, 8, 3, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOut); + EXPECT_EQ_RECT(IntRect(11, 10, 88, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.fillRect(FloatRect(30, 30, 290, 290), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(30, 30, 290, 290), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.fillRect(FloatRect(40, 20, 290, 50), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(30, 30, 290, 290), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.fillRect(FloatRect(10, 10, 390, 50), opaque, ColorSpaceDeviceRGB, CompositeSourceIn); + EXPECT_EQ_RECT(IntRect(30, 30, 290, 290), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.fillRect(FloatRect(10, 10, 390, 50), alpha, ColorSpaceDeviceRGB); + EXPECT_EQ_RECT(IntRect(30, 30, 290, 290), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.fillRect(FloatRect(10, 10, 390, 50), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(30, 10, 290, 310), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); +} + +TEST(PlatformContextSkiaTest, trackOpaqueJoinTest) +{ + SkBitmap bitmap; + bitmap.setConfig(SkBitmap::kARGB_8888_Config, 400, 400); + bitmap.allocPixels(); + SkCanvas canvas(bitmap); + + PlatformContextSkia platformContext(&canvas); + platformContext.setTrackOpaqueRegion(true); + GraphicsContext context(&platformContext); + + Color opaque(1.0f, 0.0f, 0.0f, 1.0f); + Color alpha(0.0f, 0.0f, 0.0f, 0.0f); + + context.fillRect(FloatRect(20, 20, 10, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(20, 20, 10, 10), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + // Doesn't join + context.fillRect(FloatRect(31, 20, 10, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(20, 20, 10, 10), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + // Does join + context.fillRect(FloatRect(30, 20, 10, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(20, 20, 20, 10), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + // Doesn't join + context.fillRect(FloatRect(20, 31, 20, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(20, 20, 20, 10), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + // Does join + context.fillRect(FloatRect(20, 30, 20, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(20, 20, 20, 20), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + // Doesn't join + context.fillRect(FloatRect(9, 20, 10, 20), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(20, 20, 20, 20), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + // Does join + context.fillRect(FloatRect(10, 20, 10, 20), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(10, 20, 30, 20), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + // Doesn't join + context.fillRect(FloatRect(10, 9, 30, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(10, 20, 30, 20), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + // Does join + context.fillRect(FloatRect(10, 10, 30, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(10, 10, 30, 30), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); +} + +TEST(PlatformContextSkiaTest, trackOpaqueLineTest) +{ + SkBitmap bitmap; + bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200); + bitmap.allocPixels(); + SkCanvas canvas(bitmap); + + PlatformContextSkia platformContext(&canvas); + platformContext.setTrackOpaqueRegion(true); + GraphicsContext context(&platformContext); + + Color opaque(1.0f, 0.0f, 0.0f, 1.0f); + Color alpha(0.0f, 0.0f, 0.0f, 0.0f); + + context.setShouldAntialias(false); + context.setMiterLimit(0); + context.setStrokeThickness(4); + context.setLineCap(SquareCap); + context.setStrokeStyle(SolidStroke); + context.setCompositeOperation(CompositeSourceOver); + + context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.setCompositeOperation(CompositeSourceIn); + + context.save(); + context.setStrokeColor(alpha, ColorSpaceDeviceRGB); + context.drawLine(IntPoint(0, 0), IntPoint(100, 0)); + context.restore(); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.save(); + context.setStrokeColor(opaque, ColorSpaceDeviceRGB); + context.drawLine(IntPoint(0, 10), IntPoint(100, 10)); + context.restore(); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.save(); + context.setStrokeColor(alpha, ColorSpaceDeviceRGB); + context.drawLine(IntPoint(0, 10), IntPoint(100, 10)); + context.restore(); + EXPECT_EQ_RECT(IntRect(10, 13, 90, 87), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.save(); + context.setStrokeColor(alpha, ColorSpaceDeviceRGB); + context.drawLine(IntPoint(0, 11), IntPoint(100, 11)); + context.restore(); + EXPECT_EQ_RECT(IntRect(10, 14, 90, 86), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.setShouldAntialias(true); + context.setCompositeOperation(CompositeSourceOver); + + context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.setCompositeOperation(CompositeSourceIn); + + context.save(); + context.setStrokeColor(alpha, ColorSpaceDeviceRGB); + context.drawLine(IntPoint(0, 0), IntPoint(100, 0)); + context.restore(); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.setShouldAntialias(false); + context.save(); + context.setStrokeColor(opaque, ColorSpaceDeviceRGB); + context.drawLine(IntPoint(0, 10), IntPoint(100, 10)); + context.restore(); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.setShouldAntialias(true); + context.save(); + context.setStrokeColor(opaque, ColorSpaceDeviceRGB); + context.drawLine(IntPoint(0, 10), IntPoint(100, 10)); + context.restore(); + EXPECT_EQ_RECT(IntRect(10, 13, 90, 87), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.save(); + context.setStrokeColor(alpha, ColorSpaceDeviceRGB); + context.drawLine(IntPoint(0, 11), IntPoint(100, 11)); + context.restore(); + EXPECT_EQ_RECT(IntRect(10, 14, 90, 86), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); +} + +TEST(PlatformContextSkiaTest, trackOpaquePathTest) +{ + SkBitmap bitmap; + bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200); + bitmap.allocPixels(); + SkCanvas canvas(bitmap); + + PlatformContextSkia platformContext(&canvas); + platformContext.setTrackOpaqueRegion(true); + GraphicsContext context(&platformContext); + + Color opaque(1.0f, 0.0f, 0.0f, 1.0f); + Color alpha(0.0f, 0.0f, 0.0f, 0.0f); + + context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.setShouldAntialias(false); + context.setMiterLimit(1); + context.setStrokeThickness(5); + context.setLineCap(SquareCap); + context.setStrokeStyle(SolidStroke); + context.setCompositeOperation(CompositeSourceIn); + + Path path; + + context.setFillColor(alpha, ColorSpaceDeviceRGB); + path.moveTo(FloatPoint(0, 0)); + path.addLineTo(FloatPoint(100, 0)); + context.fillPath(path); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + path.clear(); + + context.setFillColor(opaque, ColorSpaceDeviceRGB); + path.moveTo(FloatPoint(0, 10)); + path.addLineTo(FloatPoint(100, 13)); + context.fillPath(path); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + path.clear(); + + context.setFillColor(alpha, ColorSpaceDeviceRGB); + path.moveTo(FloatPoint(0, 10)); + path.addLineTo(FloatPoint(100, 13)); + context.fillPath(path); + EXPECT_EQ_RECT(IntRect(10, 13, 90, 87), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + path.clear(); + + context.setFillColor(alpha, ColorSpaceDeviceRGB); + path.moveTo(FloatPoint(0, 14)); + path.addLineTo(FloatPoint(100, 10)); + context.fillPath(path); + EXPECT_EQ_RECT(IntRect(10, 14, 90, 86), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + path.clear(); +} + +TEST(PlatformContextSkiaTest, trackOpaqueImageTest) +{ + SkBitmap bitmap; + bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200); + bitmap.allocPixels(); + SkCanvas canvas(bitmap); + + PlatformContextSkia platformContext(&canvas); + platformContext.setTrackOpaqueRegion(true); + GraphicsContext context(&platformContext); + + Color opaque(1.0f, 0.0f, 0.0f, 1.0f); + Color alpha(0.0f, 0.0f, 0.0f, 0.0f); + + SkBitmap drawBitmap; + drawBitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); + drawBitmap.allocPixels(); + + drawBitmap.setIsOpaque(true); + for (int y = 0; y < drawBitmap.height(); ++y) + for (int x = 0; x < drawBitmap.width(); ++x) + *drawBitmap.getAddr32(x, y) = 0xFFFFFFFF; + RefPtr<BitmapImageSingleFrameSkia> opaqueImage = BitmapImageSingleFrameSkia::create(drawBitmap, true); + EXPECT_FALSE(opaqueImage->currentFrameHasAlpha()); + + drawBitmap.setIsOpaque(false); + for (int y = 0; y < drawBitmap.height(); ++y) + for (int x = 0; x < drawBitmap.width(); ++x) + *drawBitmap.getAddr32(x, y) = 0x00000000; + RefPtr<BitmapImageSingleFrameSkia> alphaImage = BitmapImageSingleFrameSkia::create(drawBitmap, true); + EXPECT_TRUE(alphaImage->currentFrameHasAlpha()); + + context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.drawImage(opaqueImage.get(), ColorSpaceDeviceRGB, IntPoint(0, 0)); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + context.drawImage(alphaImage.get(), ColorSpaceDeviceRGB, IntPoint(0, 0)); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.drawImage(opaqueImage.get(), ColorSpaceDeviceRGB, IntPoint(5, 5)); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + context.drawImage(alphaImage.get(), ColorSpaceDeviceRGB, IntPoint(5, 5)); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.drawImage(opaqueImage.get(), ColorSpaceDeviceRGB, IntPoint(10, 10)); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + context.drawImage(alphaImage.get(), ColorSpaceDeviceRGB, IntPoint(10, 10)); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.drawImage(alphaImage.get(), ColorSpaceDeviceRGB, IntPoint(20, 10), CompositeSourceIn); + EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.save(); + context.setAlpha(0.5); + context.drawImage(opaqueImage.get(), ColorSpaceDeviceRGB, IntPoint(25, 15), CompositeSourceIn); + context.restore(); + EXPECT_EQ_RECT(IntRect(10, 25, 90, 75), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.drawImage(alphaImage.get(), ColorSpaceDeviceRGB, IntPoint(10, 20), CompositeSourceIn); + EXPECT_EQ_RECT(IntRect(20, 10, 80, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.save(); + context.setAlpha(0.5); + context.drawImage(opaqueImage.get(), ColorSpaceDeviceRGB, IntPoint(15, 25), CompositeSourceIn); + context.restore(); + EXPECT_EQ_RECT(IntRect(25, 10, 75, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); +} + +TEST(PlatformContextSkiaTest, trackOpaqueOvalTest) +{ + SkBitmap bitmap; + bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200); + bitmap.allocPixels(); + SkCanvas canvas(bitmap); + + PlatformContextSkia platformContext(&canvas); + platformContext.setTrackOpaqueRegion(true); + GraphicsContext context(&platformContext); + + Color opaque(1.0f, 0.0f, 0.0f, 1.0f); + Color alpha(0.0f, 0.0f, 0.0f, 0.0f); + + EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.drawEllipse(IntRect(10, 10, 90, 90)); + EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.setCompositeOperation(CompositeSourceIn); + + context.setShouldAntialias(false); + + context.setFillColor(opaque, ColorSpaceDeviceRGB); + context.drawEllipse(IntRect(10, 10, 50, 30)); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.setFillColor(alpha, ColorSpaceDeviceRGB); + context.drawEllipse(IntRect(10, 10, 30, 50)); + EXPECT_EQ_RECT(IntRect(40, 10, 60, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.setShouldAntialias(true); + + context.setFillColor(opaque, ColorSpaceDeviceRGB); + context.drawEllipse(IntRect(10, 10, 50, 30)); + EXPECT_EQ_RECT(IntRect(40, 41, 60, 59), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.setFillColor(alpha, ColorSpaceDeviceRGB); + context.drawEllipse(IntRect(20, 10, 30, 50)); + EXPECT_EQ_RECT(IntRect(51, 41, 49, 59), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/TextureManagerTest.cpp b/Source/WebKit/chromium/tests/TextureManagerTest.cpp index 7c088dabc..6fe616c24 100644 --- a/Source/WebKit/chromium/tests/TextureManagerTest.cpp +++ b/Source/WebKit/chromium/tests/TextureManagerTest.cpp @@ -35,34 +35,49 @@ namespace { class FakeTextureAllocator : public TextureAllocator { public: + virtual ~FakeTextureAllocator() { } virtual unsigned createTexture(const IntSize&, GC3Denum) { return 1; } virtual void deleteTexture(unsigned, const IntSize&, GC3Denum) { } }; -FakeTextureAllocator fakeTextureAllocator; -const IntSize textureSize(256, 256); -const GC3Denum textureFormat = GraphicsContext3D::RGBA; +class TextureManagerTest : public testing::Test { +public: + TextureManagerTest() + : m_textureSize(256, 256) + , m_textureFormat(GraphicsContext3D::RGBA) + { + } -size_t texturesMemorySize(size_t textureCount) -{ - return TextureManager::memoryUseBytes(textureSize, textureFormat) * textureCount; -} + virtual ~TextureManagerTest() + { + } -PassOwnPtr<TextureManager> createTextureManager(size_t maxTextures, size_t preferredTextures) -{ - return TextureManager::create(texturesMemorySize(maxTextures), texturesMemorySize(preferredTextures), 1024); -} + size_t texturesMemorySize(size_t textureCount) + { + return TextureManager::memoryUseBytes(m_textureSize, m_textureFormat) * textureCount; + } -bool requestTexture(TextureManager* manager, TextureToken token) -{ - unsigned textureId; - bool result = manager->requestTexture(token, textureSize, textureFormat, textureId); - if (result) - manager->allocateTexture(&fakeTextureAllocator, token); - return result; -} + PassOwnPtr<TextureManager> createTextureManager(size_t maxTextures, size_t preferredTextures) + { + return TextureManager::create(texturesMemorySize(maxTextures), texturesMemorySize(preferredTextures), 1024); + } + + bool requestTexture(TextureManager* manager, TextureToken token) + { + unsigned textureId; + bool result = manager->requestTexture(token, m_textureSize, m_textureFormat, textureId); + if (result) + manager->allocateTexture(&m_fakeTextureAllocator, token); + return result; + } + +private: + FakeTextureAllocator m_fakeTextureAllocator; + const IntSize m_textureSize; + const GC3Denum m_textureFormat; +}; -TEST(TextureManagerTest, requestTextureInPreferredLimit) +TEST_F(TextureManagerTest, requestTextureInPreferredLimit) { const size_t preferredTextures = 8; OwnPtr<TextureManager> textureManager = createTextureManager(preferredTextures * 2, preferredTextures); @@ -82,7 +97,7 @@ TEST(TextureManagerTest, requestTextureInPreferredLimit) EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->currentMemoryUseBytes()); } -TEST(TextureManagerTest, requestTextureExceedingPreferredLimit) +TEST_F(TextureManagerTest, requestTextureExceedingPreferredLimit) { const size_t maxTextures = 8; const size_t preferredTextures = 4; @@ -114,7 +129,7 @@ TEST(TextureManagerTest, requestTextureExceedingPreferredLimit) EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->currentMemoryUseBytes()); } -TEST(TextureManagerTest, requestTextureExceedingMaxLimit) +TEST_F(TextureManagerTest, requestTextureExceedingMaxLimit) { const size_t maxTextures = 8; const size_t preferredTextures = 4; @@ -146,7 +161,7 @@ TEST(TextureManagerTest, requestTextureExceedingMaxLimit) EXPECT_FALSE(textureManager->hasTexture(tokens[3])); } -TEST(TextureManagerTest, reduceMemoryToLimit) +TEST_F(TextureManagerTest, reduceMemoryToLimit) { const size_t maxTextures = 8; const size_t preferredTextures = 4; @@ -179,7 +194,7 @@ TEST(TextureManagerTest, reduceMemoryToLimit) EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->preferredMemoryLimitBytes()); } -TEST(TextureManagerTest, setMaxMemoryLimitBytes) +TEST_F(TextureManagerTest, setMaxMemoryLimitBytes) { const size_t maxTextures = 8; const size_t preferredTextures = 4; @@ -203,7 +218,7 @@ TEST(TextureManagerTest, setMaxMemoryLimitBytes) EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->maxMemoryLimitBytes()); } -TEST(TextureManagerTest, setPreferredMemoryLimitBytes) +TEST_F(TextureManagerTest, setPreferredMemoryLimitBytes) { const size_t maxTextures = 8; const size_t preferredTextures = 4; diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index 93e2ee8be..b0350db49 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -26,8 +26,12 @@ #include "TiledLayerChromium.h" +#include "CCLayerTreeTestCommon.h" +#include "FakeCCLayerTreeHostClient.h" #include "LayerTextureUpdater.h" +#include "Region.h" #include "TextureManager.h" +#include "WebCompositor.h" #include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread #include "cc/CCTextureUpdater.h" #include "cc/CCTiledLayerImpl.h" @@ -36,6 +40,12 @@ using namespace WebCore; using namespace WTF; +#define EXPECT_EQ_RECT(a, b) \ + EXPECT_EQ(a.x(), b.x()); \ + EXPECT_EQ(a.y(), b.y()); \ + EXPECT_EQ(a.width(), b.width()); \ + EXPECT_EQ(a.height(), b.height()); + namespace { class FakeTextureAllocator : public TextureAllocator { @@ -44,6 +54,8 @@ public: virtual void deleteTexture(unsigned, const IntSize&, GC3Denum) { } }; +class FakeTiledLayerChromium; + class FakeLayerTextureUpdater : public LayerTextureUpdater { public: class Texture : public LayerTextureUpdater::Texture { @@ -54,12 +66,32 @@ public: virtual void updateRect(GraphicsContext3D*, TextureAllocator*, const IntRect&, const IntRect&) { } }; - FakeLayerTextureUpdater() { } + FakeLayerTextureUpdater() : m_prepareCount(0) { } virtual ~FakeLayerTextureUpdater() { } + // Sets the rect to invalidate during the next call to prepareToUpdate(). After the next + // call to prepareToUpdate() the rect is reset. + void setRectToInvalidate(const IntRect&, FakeTiledLayerChromium*); + + // Number of times prepareToUpdate has been invoked. + int prepareCount() const { return m_prepareCount; } + void clearPrepareCount() { m_prepareCount = 0; } + + void setOpaquePaintRect(const IntRect& opaquePaintRect) { m_opaquePaintRect = opaquePaintRect; } + + // Last rect passed to prepareToUpdate(). + const IntRect& lastUpdateRect() const { return m_lastUpdateRect; } + virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(TextureManager* manager) { return adoptPtr(new Texture(ManagedTexture::create(manager))); } virtual SampledTexelFormat sampledTexelFormat(GC3Denum) { return SampledTexelFormatRGBA; } - virtual void prepareToUpdate(const IntRect&, const IntSize&, int, float) { } + virtual void prepareToUpdate(const IntRect& contentRect, const IntSize&, int, float, IntRect* resultingOpaqueRect); + +private: + int m_prepareCount; + IntRect m_rectToInvalidate; + IntRect m_lastUpdateRect; + IntRect m_opaquePaintRect; + RefPtr<FakeTiledLayerChromium> m_layer; }; class FakeCCTiledLayerImpl : public CCTiledLayerImpl { @@ -77,7 +109,7 @@ public: class FakeTiledLayerChromium : public TiledLayerChromium { public: explicit FakeTiledLayerChromium(TextureManager* textureManager) - : TiledLayerChromium(0) + : TiledLayerChromium() , m_fakeTextureUpdater(adoptRef(new FakeLayerTextureUpdater)) , m_textureManager(textureManager) { @@ -108,8 +140,20 @@ public: return TiledLayerChromium::needsIdlePaint(rect); } + bool skipsDraw() const + { + return TiledLayerChromium::skipsDraw(); + } + + FakeLayerTextureUpdater* fakeLayerTextureUpdater() { return m_fakeTextureUpdater.get(); } + virtual TextureManager* textureManager() const { return m_textureManager; } + virtual void paintContentsIfDirty(const Region& /* occludedScreenSpace */) + { + prepareToUpdate(visibleLayerRect()); + } + private: virtual void createTextureUpdater(const CCLayerTreeHost*) { } @@ -122,6 +166,40 @@ private: TextureManager* m_textureManager; }; +class FakeTiledLayerWithScaledBounds : public FakeTiledLayerChromium { +public: + explicit FakeTiledLayerWithScaledBounds(TextureManager* textureManager) + : FakeTiledLayerChromium(textureManager) + { + } + + void setContentBounds(const IntSize& contentBounds) { m_forcedContentBounds = contentBounds; } + virtual IntSize contentBounds() const { return m_forcedContentBounds; } + + FloatRect updateRect() { return m_updateRect; } + +protected: + IntSize m_forcedContentBounds; +}; + +void FakeLayerTextureUpdater::setRectToInvalidate(const IntRect& rect, FakeTiledLayerChromium* layer) +{ + m_rectToInvalidate = rect; + m_layer = layer; +} + +void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, int, float, IntRect* resultingOpaqueRect) +{ + m_prepareCount++; + m_lastUpdateRect = contentRect; + if (!m_rectToInvalidate.isEmpty()) { + m_layer->invalidateRect(m_rectToInvalidate); + m_rectToInvalidate = IntRect(); + m_layer = 0; + } + *resultingOpaqueRect = m_opaquePaintRect; +} + TEST(TiledLayerChromiumTest, pushDirtyTiles) { OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); @@ -259,4 +337,231 @@ TEST(TiledLayerChromiumTest, idlePaintOutOfMemory) layer->pushPropertiesTo(layerImpl.get()); } +TEST(TiledLayerChromiumTest, invalidateFromPrepare) +{ + OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + DebugScopedSetImplThread implThread; + RefPtr<FakeCCTiledLayerImpl> layerImpl = adoptRef(new FakeCCTiledLayerImpl(0)); + + FakeTextureAllocator textureAllocator; + CCTextureUpdater updater(&textureAllocator); + + // The tile size is 100x100, so this invalidates and then paints two tiles. + layer->setBounds(IntSize(100, 200)); + layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->prepareToUpdate(IntRect(0, 0, 100, 200)); + layer->updateCompositorResources(0, updater); + layer->pushPropertiesTo(layerImpl.get()); + + // We should have both tiles on the impl side. + EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); + EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); + + textureManager->unprotectAllTextures(); + + layer->fakeLayerTextureUpdater()->clearPrepareCount(); + // Invoke prepareToUpdate again. As the layer is valid prepareToUpdate shouldn't be invoked on + // the LayerTextureUpdater. + layer->prepareToUpdate(IntRect(0, 0, 100, 200)); + EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareCount()); + + layer->invalidateRect(IntRect(0, 0, 50, 50)); + // setRectToInvalidate triggers invalidateRect() being invoked from prepareToUpdate. + layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(25, 25, 50, 50), layer.get()); + layer->fakeLayerTextureUpdater()->clearPrepareCount(); + layer->prepareToUpdate(IntRect(0, 0, 100, 200)); + EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); + layer->fakeLayerTextureUpdater()->clearPrepareCount(); + // The layer should still be invalid as prepareToUpdate invoked invalidate. + layer->prepareToUpdate(IntRect(0, 0, 100, 200)); + EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); +} + +TEST(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) +{ + // The updateRect (that indicates what was actually painted) should be in + // layer space, not the content space. + + OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); + RefPtr<FakeTiledLayerWithScaledBounds> layer = adoptRef(new FakeTiledLayerWithScaledBounds(textureManager.get())); + + FakeTextureAllocator textureAllocator; + CCTextureUpdater updater(&textureAllocator); + + IntRect layerBounds(0, 0, 300, 200); + IntRect contentBounds(0, 0, 200, 250); + + layer->setBounds(layerBounds.size()); + layer->setContentBounds(contentBounds.size()); + layer->setVisibleLayerRect(contentBounds); + + // On first update, the updateRect includes all tiles, even beyond the boundaries of the layer. + // However, it should still be in layer space, not content space. + layer->invalidateRect(contentBounds); + layer->prepareToUpdate(contentBounds); + layer->updateCompositorResources(0, updater); + EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 300, 300 * 0.8), layer->updateRect()); + + // After the tiles are updated once, another invalidate only needs to update the bounds of the layer. + layer->invalidateRect(contentBounds); + layer->prepareToUpdate(contentBounds); + layer->updateCompositorResources(0, updater); + EXPECT_FLOAT_RECT_EQ(FloatRect(layerBounds), layer->updateRect()); + + // Partial re-paint should also be represented by the updateRect in layer space, not content space. + IntRect partialDamage(30, 100, 10, 10); + layer->invalidateRect(partialDamage); + layer->prepareToUpdate(contentBounds); + layer->updateCompositorResources(0, updater); + EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect()); +} + +TEST(TiledLayerChromiumTest, skipsDrawGetsReset) +{ + // Initialize without threading support. + WebKit::WebCompositor::initialize(0); + FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; + RefPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCSettings()); + + // Create two 300 x 300 tiled layers. + IntSize contentBounds(300, 300); + IntRect contentRect(IntPoint::zero(), contentBounds); + + RefPtr<FakeTiledLayerChromium> rootLayer = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); + RefPtr<FakeTiledLayerChromium> childLayer = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); + rootLayer->addChild(childLayer); + + rootLayer->setBounds(contentBounds); + rootLayer->setPosition(FloatPoint(150, 150)); + childLayer->setBounds(contentBounds); + childLayer->setPosition(FloatPoint(150, 150)); + rootLayer->invalidateRect(contentRect); + childLayer->invalidateRect(contentRect); + + // We have enough memory for only one of the two layers. + int memoryLimit = 4 * 300 * 300; // 4 bytes per pixel. + + FakeTextureAllocator textureAllocator; + CCTextureUpdater updater(&textureAllocator); + + ccLayerTreeHost->setRootLayer(rootLayer); + ccLayerTreeHost->setViewportSize(IntSize(300, 300)); + ccLayerTreeHost->contentsTextureManager()->setMaxMemoryLimitBytes(memoryLimit); + ccLayerTreeHost->updateLayers(); + ccLayerTreeHost->updateCompositorResources(ccLayerTreeHost->context(), updater); + + // We'll skip the root layer. + EXPECT_TRUE(rootLayer->skipsDraw()); + EXPECT_FALSE(childLayer->skipsDraw()); + + ccLayerTreeHost->commitComplete(); + + // Remove the child layer. + rootLayer->removeAllChildren(); + + // Need to set the max limit again as it gets overwritten by updateLayers(). + ccLayerTreeHost->contentsTextureManager()->setMaxMemoryLimitBytes(memoryLimit); + ccLayerTreeHost->updateLayers(); + EXPECT_FALSE(rootLayer->skipsDraw()); + + ccLayerTreeHost->setRootLayer(0); + ccLayerTreeHost.clear(); + WebKit::WebCompositor::shutdown(); +} + +TEST(TiledLayerChromiumTest, layerAddsSelfToOccludedRegion) +{ + OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + + // The tile size is 100x100, so this invalidates and then paints two tiles in various ways. + + Region occluded; + IntRect contentBounds = IntRect(0, 0, 100, 200); + IntRect visibleBounds = IntRect(0, 0, 100, 150); + + layer->setBounds(contentBounds.size()); + layer->setVisibleLayerRect(visibleBounds); + layer->setDrawOpacity(1); + + // The screenSpaceTransform is verified in CCLayerTreeHostCommonTests + TransformationMatrix screenSpaceTransform; + layer->setScreenSpaceTransform(screenSpaceTransform); + + // If the layer is opaque then the occluded region should be the whole layer's visible region. + layer->setOpaque(true); + layer->invalidateRect(contentBounds); + layer->prepareToUpdate(contentBounds); + + occluded = Region(); + layer->addSelfToOccludedScreenSpace(occluded); + EXPECT_EQ_RECT(visibleBounds, occluded.bounds()); + EXPECT_EQ(1u, occluded.rects().size()); + + // If the layer is not opaque then the occluded region should be empty. + layer->setOpaque(false); + layer->invalidateRect(contentBounds); + layer->prepareToUpdate(contentBounds); + + occluded = Region(); + layer->addSelfToOccludedScreenSpace(occluded); + EXPECT_EQ_RECT(IntRect(), occluded.bounds()); + EXPECT_EQ(1u, occluded.rects().size()); + + // If the layer paints opaque content, then the occluded region should match the visible opaque content. + IntRect opaquePaintRect = IntRect(10, 10, 90, 190); + layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect); + layer->invalidateRect(contentBounds); + layer->prepareToUpdate(contentBounds); + + occluded = Region(); + layer->addSelfToOccludedScreenSpace(occluded); + EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), occluded.bounds()); + EXPECT_EQ(1u, occluded.rects().size()); + + // If we paint again without invalidating, the same stuff should be occluded. + layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); + layer->prepareToUpdate(contentBounds); + + occluded = Region(); + layer->addSelfToOccludedScreenSpace(occluded); + EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), occluded.bounds()); + EXPECT_EQ(1u, occluded.rects().size()); + + // If the layer is transformed then the resulting occluded area needs to be transformed to its target space. + TransformationMatrix transform; + transform.translate(contentBounds.width() / 2.0, contentBounds.height() / 2.0); + transform.rotate(90); + transform.translate(-contentBounds.width() / 2.0, -contentBounds.height() / 2.0); + transform.translate(10, 10); + screenSpaceTransform.translate(contentBounds.width() / 2.0, contentBounds.height() / 2.0); + screenSpaceTransform *= transform; + screenSpaceTransform.translate(-contentBounds.width() / 2.0, -contentBounds.height() / 2.0); + layer->setScreenSpaceTransform(screenSpaceTransform); + layer->prepareToUpdate(contentBounds); + + occluded = Region(); + layer->addSelfToOccludedScreenSpace(occluded); + EXPECT_EQ_RECT(screenSpaceTransform.mapRect(intersection(opaquePaintRect, visibleBounds)), occluded.bounds()); + EXPECT_EQ(1u, occluded.rects().size()); + + // But a non-axis-aligned transform does not get considered for occlusion. + transform.translate(contentBounds.width() / 2.0, contentBounds.height() / 2.0); + transform.rotate(5); + transform.translate(-contentBounds.width() / 2.0, -contentBounds.height() / 2.0); + screenSpaceTransform.translate(contentBounds.width() / 2.0, contentBounds.height() / 2.0); + screenSpaceTransform *= transform; + screenSpaceTransform.translate(-contentBounds.width() / 2.0, -contentBounds.height() / 2.0); + layer->setScreenSpaceTransform(screenSpaceTransform); + layer->prepareToUpdate(contentBounds); + + occluded = Region(); + layer->addSelfToOccludedScreenSpace(occluded); + // FIXME: If we find an opaque rect contained in the rotated non-axis-aligned rect, then + // this won't be an empty result. + EXPECT_EQ_RECT(IntRect(), occluded.bounds()); + EXPECT_EQ(0u, occluded.rects().size()); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp b/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp index ca83846c2..1557a7d93 100644 --- a/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp +++ b/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp @@ -83,7 +83,7 @@ public: } private: MockLayerChromium(Vector<int>* ccLayerDestructionList) - : LayerChromium(0) + : LayerChromium() , m_ccLayerDestructionList(ccLayerDestructionList) { } @@ -119,9 +119,9 @@ void expectTreesAreIdentical(LayerChromium* layer, CCLayerImpl* ccLayer) TEST(TreeSynchronizerTest, syncSimpleTreeFromEmpty) { DebugScopedSetImplThread impl; - RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create(0); - layerTreeRoot->addChild(LayerChromium::create(0)); - layerTreeRoot->addChild(LayerChromium::create(0)); + RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create(); + layerTreeRoot->addChild(LayerChromium::create()); + layerTreeRoot->addChild(LayerChromium::create()); RefPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), 0); @@ -158,9 +158,9 @@ TEST(TreeSynchronizerTest, syncSimpleTreeReusingLayers) TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties) { DebugScopedSetImplThread impl; - RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create(0); - layerTreeRoot->addChild(LayerChromium::create(0)); - layerTreeRoot->addChild(LayerChromium::create(0)); + RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create(); + layerTreeRoot->addChild(LayerChromium::create()); + layerTreeRoot->addChild(LayerChromium::create()); // Pick some random properties to set. The values are not important, we're just testing that at least some properties are making it through. FloatPoint rootPosition = FloatPoint(2.3, 7.4); @@ -254,7 +254,7 @@ TEST(TreeSynchronizerTest, syncSimpleTreeThenDestroy) oldLayerTreeRoot->removeAllChildren(); // Synchronize again. After the sync all CCLayerImpls from the old tree should be deleted. - RefPtr<LayerChromium> newLayerTreeRoot = LayerChromium::create(0); + RefPtr<LayerChromium> newLayerTreeRoot = LayerChromium::create(); ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(newLayerTreeRoot.get(), ccLayerTreeRoot.release()); expectTreesAreIdentical(newLayerTreeRoot.get(), ccLayerTreeRoot.get()); @@ -268,22 +268,22 @@ TEST(TreeSynchronizerTest, syncSimpleTreeThenDestroy) TEST(TreeSynchronizerTest, syncMaskReplicaAndReplicaMaskLayers) { DebugScopedSetImplThread impl; - RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create(0); - layerTreeRoot->addChild(LayerChromium::create(0)); - layerTreeRoot->addChild(LayerChromium::create(0)); - layerTreeRoot->addChild(LayerChromium::create(0)); + RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create(); + layerTreeRoot->addChild(LayerChromium::create()); + layerTreeRoot->addChild(LayerChromium::create()); + layerTreeRoot->addChild(LayerChromium::create()); // First child gets a mask layer. - RefPtr<LayerChromium> maskLayer = LayerChromium::create(0); + RefPtr<LayerChromium> maskLayer = LayerChromium::create(); layerTreeRoot->children()[0]->setMaskLayer(maskLayer.get()); // Second child gets a replica layer. - RefPtr<LayerChromium> replicaLayer = LayerChromium::create(0); + RefPtr<LayerChromium> replicaLayer = LayerChromium::create(); layerTreeRoot->children()[1]->setReplicaLayer(replicaLayer.get()); // Third child gets a replica layer with a mask layer. - RefPtr<LayerChromium> replicaLayerWithMask = LayerChromium::create(0); - RefPtr<LayerChromium> replicaMaskLayer = LayerChromium::create(0); + RefPtr<LayerChromium> replicaLayerWithMask = LayerChromium::create(); + RefPtr<LayerChromium> replicaMaskLayer = LayerChromium::create(); replicaLayerWithMask->setMaskLayer(replicaMaskLayer.get()); layerTreeRoot->children()[2]->setReplicaLayer(replicaLayerWithMask.get()); diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp index 2b2ea7601..06b26469a 100644 --- a/Source/WebKit/chromium/tests/WebFrameTest.cpp +++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp @@ -33,9 +33,11 @@ #include "FrameTestHelpers.h" #include "ResourceError.h" #include "WebDocument.h" +#include "WebFindOptions.h" #include "WebFormElement.h" #include "WebFrame.h" #include "WebFrameClient.h" +#include "WebRange.h" #include "WebScriptSource.h" #include "WebSearchableFormData.h" #include "WebSecurityPolicy.h" @@ -379,4 +381,54 @@ TEST_F(WebFrameTest, ContextNotificationsIsolatedWorlds) EXPECT_EQ(1, matchCount); } +TEST_F(WebFrameTest, DISABLED_FindInPage) +{ + registerMockedHttpURLLoad("find.html"); + WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find.html"); + WebFrame* frame = webView->mainFrame(); + const int findIdentifier = 12345; + WebFindOptions options; + + // Find in a <div> element. + EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar1"), options, false, 0)); + frame->stopFinding(false); + WebRange range = frame->selectionRange(); + EXPECT_EQ(5, range.startOffset()); + EXPECT_EQ(9, range.endOffset()); + EXPECT_TRUE(frame->document().focusedNode().isNull()); + + // Find in an <input> value. + EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar2"), options, false, 0)); + // Confirm stopFinding(false) sets the selection on the found text. + frame->stopFinding(false); + range = frame->selectionRange(); + ASSERT_FALSE(range.isNull()); + EXPECT_EQ(5, range.startOffset()); + EXPECT_EQ(9, range.endOffset()); + EXPECT_EQ(WebString::fromUTF8("INPUT"), frame->document().focusedNode().nodeName()); + + // Find in a <textarea> content. + EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar3"), options, false, 0)); + // Confirm stopFinding(false) sets the selection on the found text. + frame->stopFinding(false); + range = frame->selectionRange(); + ASSERT_FALSE(range.isNull()); + EXPECT_EQ(5, range.startOffset()); + EXPECT_EQ(9, range.endOffset()); + EXPECT_EQ(WebString::fromUTF8("TEXTAREA"), frame->document().focusedNode().nodeName()); + + // Find in a contentEditable element. + EXPECT_TRUE(frame->find(findIdentifier, WebString::fromUTF8("bar4"), options, false, 0)); + // Confirm stopFinding(false) sets the selection on the found text. + frame->stopFinding(false); + range = frame->selectionRange(); + ASSERT_FALSE(range.isNull()); + EXPECT_EQ(0, range.startOffset()); + EXPECT_EQ(4, range.endOffset()); + // "bar4" is surrounded by <span>, but the focusable node should be the parent <div>. + EXPECT_EQ(WebString::fromUTF8("DIV"), frame->document().focusedNode().nodeName()); + + webView->close(); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/data/find.html b/Source/WebKit/chromium/tests/data/find.html new file mode 100644 index 000000000..952c823fb --- /dev/null +++ b/Source/WebKit/chromium/tests/data/find.html @@ -0,0 +1,6 @@ +<body> +<div>foo1 bar1 baz1</div> +<input value="foo2 bar2 baz2"> +<textarea>foo3 bar3 baz3</textarea> +<div contentEditable="true">foo4 <span>bar4</span> baz4</div> +</body> |