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 | |
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')
251 files changed, 10381 insertions, 2330 deletions
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index 89991f914..6fc9adf7a 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,3 +1,17 @@ +2012-01-11 Jacky Jiang <zhajiang@rim.com> + + [BlackBerry] ASSERT failure in BackingStorePrivate::blitVisibleContents() + https://bugs.webkit.org/show_bug.cgi?id=76096 + + Reviewed by Rob Buis. + + We shouldn't blit visible contents for direct rendering. Guard it from + call sites. + + * blackberry/Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::repaint): + (BlackBerry::WebKit::BackingStorePrivate::slowScroll): + 2012-01-11 Rafael Brandao <rafael.lobo@openbossa.org> [Qt][WK2] Fix the build for newer Qt5 diff --git a/Source/WebKit/blackberry/Api/BackingStore.cpp b/Source/WebKit/blackberry/Api/BackingStore.cpp index b9b929d4b..4bd0333e0 100644 --- a/Source/WebKit/blackberry/Api/BackingStore.cpp +++ b/Source/WebKit/blackberry/Api/BackingStore.cpp @@ -333,7 +333,7 @@ void BackingStorePrivate::repaint(const Platform::IntRect& windowRect, #endif if (immediate) { - if (render(rect)) + if (render(rect) && !shouldDirectRenderingToWindow()) blitVisibleContents(); } else m_renderQueue->addToQueue(RenderQueue::RegularRender, rect); @@ -354,7 +354,7 @@ void BackingStorePrivate::slowScroll(const Platform::IntSize& delta, const Platf Platform::IntRect rect = m_webPage->d->mapToTransformed(m_client->mapFromViewportToContents(windowRect)); if (immediate) { - if (render(rect) && !isSuspended()) + if (render(rect) && !isSuspended() && !shouldDirectRenderingToWindow()) blitVisibleContents(); } else { m_renderQueue->addToQueue(RenderQueue::VisibleScroll, rect); 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> diff --git a/Source/WebKit/efl/CMakeListsEfl.txt b/Source/WebKit/efl/CMakeListsEfl.txt index c5ef6564f..ec0c7d894 100644 --- a/Source/WebKit/efl/CMakeListsEfl.txt +++ b/Source/WebKit/efl/CMakeListsEfl.txt @@ -82,6 +82,7 @@ LIST(APPEND WebKit_SOURCES efl/ewk/ewk_history.cpp efl/ewk/ewk_main.cpp efl/ewk/ewk_network.cpp + efl/ewk/ewk_security_policy.cpp efl/ewk/ewk_settings.cpp efl/ewk/ewk_tiled_backing_store.cpp efl/ewk/ewk_tiled_matrix.cpp @@ -242,6 +243,7 @@ SET(EWebKit_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_logging.h ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_main.h ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_network.h + ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_security_policy.h ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_settings.h ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_view.h ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_window_features.h diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog index 9247d340f..dd94c852f 100644 --- a/Source/WebKit/efl/ChangeLog +++ b/Source/WebKit/efl/ChangeLog @@ -1,3 +1,235 @@ +2012-01-31 Ryuan Choi <ryuan.choi@samsung.com> + + [EFL] Add basic DRT/Efl implementation to support viewport test. + https://bugs.webkit.org/show_bug.cgi?id=77320 + + Reviewed by Andreas Kling. + + Add dumpConfigurationForViewport. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + (DumpRenderTreeSupportEfl::dumpConfigurationForViewport): + * WebCoreSupport/DumpRenderTreeSupportEfl.h: + +2012-01-31 KwangHyuk Kim <hyuki.kim@samsung.com> + + [EFL] Set content hint information for ewk_view_single. + https://bugs.webkit.org/show_bug.cgi?id=77319 + + Reviewed by Ryosuke Niwa. + + The content hint information corresponding to opengl_x11 engine is set + for the image object which ewk_view_single owns when evas is based on + opengl_x11 engine. + + * ewk/ewk_view_single.cpp: + (_ewk_view_single_smart_backing_store_add): + +2012-01-30 Eunsol Park <eunsol47.park@samsung.com> + + [EFL] Define the names of view smart class + https://bugs.webkit.org/show_bug.cgi?id=76370 + + Reviewed by Andreas Kling. + + Strings of ewk_tiled_view's name were defined differently, + so the definitions were modified to make users not confused. + + * ewk/ewk_private.h: + * ewk/ewk_view.cpp: + * ewk/ewk_view_single.cpp: + (_ewk_view_single_smart_class_new): + * ewk/ewk_view_tiled.cpp: + (ewk_view_tiled_smart_set): + (_ewk_view_tiled_smart_class_new): + +2012-01-26 Tomasz Morawski <t.morawski@samsung.com> + + [EFL] Added missing NETSCAPE_PLUGIN_API macro. + https://bugs.webkit.org/show_bug.cgi?id=77093 + + Reviewed by Andreas Kling. + + The ewk_view_js_window_object_clear function should be inside ENABLE(NETSCAPE_PLUGIN_API) macro. + + * ewk/ewk_view.cpp: + +2012-01-17 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [EFL] Use static const insted of #define macro. + https://bugs.webkit.org/show_bug.cgi?id=76499 + + Reviewed by Hajime Morita. + + WebKit coding style prefers const to #define. EFL port needs to use const insted of #define macro. + This patch replace global variables defined by #define with const. + + * ewk/ewk_tiled_backing_store.cpp: + (_ewk_tiled_backing_store_smart_add): + (_ewk_tiled_backing_store_zoom_set_internal): + * ewk/ewk_tiled_backing_store.h: + * ewk/ewk_tiled_matrix.cpp: + (ewk_tile_matrix_new): + * ewk/ewk_view.cpp: + (_ewk_view_repaint_add): + (_ewk_view_repaints_flush): + (_ewk_view_scroll_add): + (_ewk_view_scrolls_flush): + (_ewk_view_priv_new): + (ewk_view_base_smart_set): + * ewk/ewk_view_tiled.cpp: + (_ewk_view_tiled_smart_pre_render_start): + +2012-01-13 Raphael Kubo da Costa <kubo@profusion.mobi> + + [EFL] Emit "resource,request,willsend" from ewk_view. + https://bugs.webkit.org/show_bug.cgi?id=76292 + + Reviewed by Andreas Kling. + + Make ewk_view dispatch the "resource,request,willsend" signal as well, + so that it is possible to know whether the request is for the main + frame itself or for anything else. + + * WebCoreSupport/FrameLoaderClientEfl.cpp: + (WebCore::FrameLoaderClientEfl::dispatchWillSendRequest): + * ewk/ewk_view.h: + +2012-01-16 Ryuan Choi <ryuan.choi@samsung.com> + + [EFL] Build fix when using pango as font backends. + https://bugs.webkit.org/show_bug.cgi?id=76368 + + Unreviewed build fix. + + * ewk/ewk_view.cpp: include RefPtrCairo.h + +2012-01-13 Leandro Pereira <leandro@profusion.mobi> + + [EFL] SecurityPolicy whitelist interface should be exposed to EWebKit + https://bugs.webkit.org/show_bug.cgi?id=76082 + + Reviewed by Andreas Kling. + + * CMakeListsEfl.txt: Added reference to ewk_security_policy.{cpp,h}. + * ewk/EWebKit.h: Include ewk_security_policy.h. + * ewk/ewk_security_policy.cpp: Added. + (ewk_security_policy_whitelist_origin_add): Implemented thin layer around SecurityPolicy::addOriginAccessWhitelistEntry(). + (ewk_security_policy_whitelist_origin_del): Implemented thin layer around SecurityPolicy::removeOriginAccessWhitelistEntry(). + (ewk_security_policy_whitelist_origin_reset): Implemented thin layer around SecurityPolicy::resetOriginAccessWhitelists(). + * ewk/ewk_security_policy.h: Added. + +2012-01-13 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [EFL] Remove extern "C" from ewk_private.h + https://bugs.webkit.org/show_bug.cgi?id=76250 + + Reviewed by Andreas Kling. + + ewk_private.h defines internal functions used by WebKit itself. There is no chance to be used by C application. + So, extern "C" keyword is unneeded in ewk_private.h. + + * ewk/ewk_private.h: + +2012-01-13 Grzegorz Czajkowski <g.czajkowski@samsung.com> + + [EFL] Add 'Copy Image Address' to context menu. + https://bugs.webkit.org/show_bug.cgi?id=76153 + + Reviewed by Andreas Kling. + + Adds EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_URL_TO_CLIPBOARD to Ewk_Context_Menu_Action to synchronize it with ContextMenuItem.h + + * ewk/ewk_contextmenu.h: + +2012-01-13 KwangHyuk Kim <hyuki.kim@samsung.com> + + [EFL] Add visible field into ewk_tiled_backing_store's data. + https://bugs.webkit.org/show_bug.cgi?id=76165 + + Reviewed by Nikolas Zimmermann. + + Using of evas_object_visible_get() API can't gurantee the correctness of + evas_object's visible status if it's called inside of evas_object's + smart_show() method. + So, a visible flag for the ewk_tiled_backing_store is added. + In addition, as tiles are not visible, ewk_tiled_backing_store will push + its own tiles into the cache when it disapear. + + * ewk/ewk_tiled_backing_store.cpp: + (_ewk_tiled_backing_store_updates_process): + (_ewk_tiled_backing_store_item_process_idler_start): + (_ewk_tiled_backing_store_item_fill): + (_ewk_tiled_backing_store_smart_member_add): + (_ewk_tiled_backing_store_smart_show): + (_ewk_tiled_backing_store_smart_hide): + +2012-01-13 KwangHyuk Kim <hyuki.kim@samsung.com> + + [EFL] Unused code cleanup on ewk_tiled_model.cpp. + https://bugs.webkit.org/show_bug.cgi?id=76031 + + Reviewed by Ryosuke Niwa. + + Remove unused code from ewk_tiled_model.cpp. + + * ewk/ewk_tiled_model.cpp: + +2012-01-12 Grzegorz Czajkowski <g.czajkowski@samsung.com> + + [EFL] Move macro checking to functions' definition in ewk_js.cpp. + https://bugs.webkit.org/show_bug.cgi?id=76037 + + Reviewed by Andreas Kling. + + Moves macro checking to functions' definition instead of duplicate them in source depending on macro value. + It's known practice in WebKit and EFL port. + Duplicating functions in the same file whose return value is different may confuse user, + especially if macro isn't included in a patch. + + * ewk/ewk_js.cpp: + (ewk_js_object_new): + (ewk_js_object_free): + (ewk_js_object_view_get): + (ewk_js_object_properties_get): + (ewk_js_object_name_get): + (ewk_js_object_invoke): + (ewk_js_object_type_get): + (ewk_js_object_type_set): + (ewk_js_variant_free): + (ewk_js_variant_array_free): + +2012-01-12 KwangHyuk Kim <hyuki.kim@samsung.com> + + [EFL] Modify some API's implementation to let it directly pass Eina_Rectangle into IntRect. + https://bugs.webkit.org/show_bug.cgi?id=75695 + + Reviewed by Andreas Kling. + + Dereference Eina_Rectangle pointers so the shorter IntRect constructor can be used. + + * ewk/ewk_view.cpp: + (ewk_view_paint_context_clip): + (ewk_view_paint_context_paint): + (ewk_view_paint_context_paint_contents): + (ewk_view_paint): + (ewk_view_paint_contents): + +2012-01-11 JungJik Lee <jungjik.lee@samsung.com> + + [EFL] Refactor single backing store scroll code. + https://bugs.webkit.org/show_bug.cgi?id=75243 + + Reviewed by Zoltan Herczeg. + + Remove the duplicated code and refactor the scroll procedure. + Wherever the page is scrolled, there are one screen copy and two updates. + This patch optimises the scroll procedure by less calculation. + + * ewk/ewk_view_single.cpp: + (_ewk_view_screen_move): + (_ewk_view_single_scroll_process_single): + 2012-01-11 KwangHyuk Kim <hyuki.kim@samsung.com> [EFL] Fix page rendering issue on ewk_view_tiled. diff --git a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp index e7ceef1a4..1eb58d5b5 100644 --- a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp @@ -385,3 +385,20 @@ void DumpRenderTreeSupportEfl::setMockScrollbarsEnabled(bool enable) { WebCore::Settings::setMockScrollbarsEnabled(enable); } + +void DumpRenderTreeSupportEfl::dumpConfigurationForViewport(Evas_Object* ewkView, int deviceDPI, const WebCore::IntSize& deviceSize, const WebCore::IntSize& availableSize) +{ + WebCore::Page* page = EWKPrivate::corePage(ewkView); + + if (!page) + return; + WebCore::ViewportArguments arguments = page->mainFrame()->document()->viewportArguments(); + WebCore::ViewportAttributes attributes = computeViewportAttributes(arguments, + /* default layout width for non-mobile pages */ 980, + deviceSize.width(), deviceSize.height(), + deviceDPI, + availableSize); + restrictMinimumScaleFactorToViewportSize(attributes, availableSize); + restrictScaleFactorToInitialScaleIfNotUserScalable(attributes); + fprintf(stdout, "viewport size %dx%d scale %f with limits [%f, %f] and userScalable %f\n", attributes.layoutSize.width(), attributes.layoutSize.height(), attributes.initialScale, attributes.minimumScale, attributes.maximumScale, attributes.userScalable); +} diff --git a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h index d6f25ffb0..0ba342a6d 100644 --- a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h @@ -74,6 +74,8 @@ public: static bool isTargetItem(const Ewk_History_Item*); static void setMockScrollbarsEnabled(bool); + + static void dumpConfigurationForViewport(Evas_Object* ewkView, int deviceDPI, const WebCore::IntSize& deviceSize, const WebCore::IntSize& availableSize); }; #endif // DumpRenderTreeSupportEfl_h diff --git a/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp index 37c738c22..1d4d64a9f 100644 --- a/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp @@ -172,6 +172,15 @@ void FrameLoaderClientEfl::dispatchWillSendRequest(DocumentLoader* loader, unsig ewk_frame_request_will_send(m_frame, &request); + // We want to distinguish between a request for a document to be loaded into + // the main frame, a sub-frame, or the sub-objects in that document (via Chromium). + if (loader) { + const FrameLoader* frameLoader = loader->frameLoader(); + const bool isMainFrameRequest = (loader == frameLoader->provisionalDocumentLoader() && frameLoader->isLoadingMainFrame()); + if (isMainFrameRequest) + evas_object_smart_callback_call(m_view, "resource,request,willsend", &request); + } + if (request.url != orig.url) { coreRequest.setURL(KURL(KURL(), request.url)); diff --git a/Source/WebKit/efl/ewk/EWebKit.h b/Source/WebKit/efl/ewk/EWebKit.h index 3f794fb0f..0ffb51cac 100644 --- a/Source/WebKit/efl/ewk/EWebKit.h +++ b/Source/WebKit/efl/ewk/EWebKit.h @@ -37,6 +37,7 @@ #include "ewk_js.h" #include "ewk_main.h" #include "ewk_network.h" +#include "ewk_security_policy.h" #include "ewk_settings.h" #include "ewk_view.h" #include "ewk_window_features.h" diff --git a/Source/WebKit/efl/ewk/ewk_contextmenu.h b/Source/WebKit/efl/ewk/ewk_contextmenu.h index 4e8ef9e6b..e781f4d9c 100644 --- a/Source/WebKit/efl/ewk/ewk_contextmenu.h +++ b/Source/WebKit/efl/ewk/ewk_contextmenu.h @@ -57,6 +57,7 @@ enum _Ewk_Context_Menu_Action { EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW, EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_IMAGE_TO_DISK, EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_TO_CLIPBOARD, + EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_URL_TO_CLIPBOARD, EWK_CONTEXT_MENU_ITEM_TAG_OPEN_FRAME_IN_NEW_WINDOW, EWK_CONTEXT_MENU_ITEM_TAG_COPY, EWK_CONTEXT_MENU_ITEM_TAG_GO_BACK, diff --git a/Source/WebKit/efl/ewk/ewk_frame.cpp b/Source/WebKit/efl/ewk/ewk_frame.cpp index 11b2af6a9..961fa0b1d 100644 --- a/Source/WebKit/efl/ewk/ewk_frame.cpp +++ b/Source/WebKit/efl/ewk/ewk_frame.cpp @@ -436,7 +436,8 @@ char* ewk_frame_script_execute(Evas_Object* ewkFrame, const char* script) return 0; JSC::JSLock lock(JSC::SilenceAssertionsOnly); - resultString = WebCore::ustringToString(result.toString(smartData->frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec())); + JSC::ExecState* exec = smartData->frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec(); + resultString = WebCore::ustringToString(result.toString(exec)->value(exec)); return strdup(resultString.utf8().data()); #else notImplemented(); diff --git a/Source/WebKit/efl/ewk/ewk_js.cpp b/Source/WebKit/efl/ewk/ewk_js.cpp index 3e5817b9f..a8b206eb1 100644 --- a/Source/WebKit/efl/ewk/ewk_js.cpp +++ b/Source/WebKit/efl/ewk/ewk_js.cpp @@ -525,9 +525,11 @@ static Eina_Bool ewk_js_npvariant_to_variant(Ewk_JS_Variant* data, const NPVaria return true; } +#endif // ENABLE(NETSCAPE_PLUGIN_API) Ewk_JS_Object* ewk_js_object_new(const Ewk_JS_Class_Meta* jsMetaClass) { +#if ENABLE(NETSCAPE_PLUGIN_API) Ewk_JS_Object* object; EINA_SAFETY_ON_NULL_RETURN_VAL(jsMetaClass, 0); @@ -593,10 +595,14 @@ Ewk_JS_Object* ewk_js_object_new(const Ewk_JS_Class_Meta* jsMetaClass) error: ewk_js_object_free(object); return 0; +#else + return 0; +#endif } void ewk_js_object_free(Ewk_JS_Object* jsObject) { +#if ENABLE(NETSCAPE_PLUGIN_API) EINA_SAFETY_ON_NULL_RETURN(jsObject); EINA_MAGIC_CHECK_OR_RETURN(jsObject); Eina_Bool script_obj = !jsObject->cls->meta; @@ -610,31 +616,45 @@ void ewk_js_object_free(Ewk_JS_Object* jsObject) if (script_obj) free(jsObject); +#endif } Evas_Object* ewk_js_object_view_get(const Ewk_JS_Object* jsObject) { +#if ENABLE(NETSCAPE_PLUGIN_API) EINA_SAFETY_ON_NULL_RETURN_VAL(jsObject, 0); EINA_MAGIC_CHECK_OR_RETURN(jsObject, 0); return jsObject->view; +#else + return 0; +#endif } Eina_Hash* ewk_js_object_properties_get(const Ewk_JS_Object* jsObject) { +#if ENABLE(NETSCAPE_PLUGIN_API) EINA_SAFETY_ON_NULL_RETURN_VAL(jsObject, 0); EINA_MAGIC_CHECK_OR_RETURN(jsObject, 0); return jsObject->properties; +#else + return 0; +#endif } const char* ewk_js_object_name_get(const Ewk_JS_Object* jsObject) { +#if ENABLE(NETSCAPE_PLUGIN_API) EINA_SAFETY_ON_NULL_RETURN_VAL(jsObject, 0); EINA_MAGIC_CHECK_OR_RETURN(jsObject, 0); return jsObject->name; +#else + return 0; +#endif } Eina_Bool ewk_js_object_invoke(Ewk_JS_Object* jsObject, Ewk_JS_Variant* args, int argCount, Ewk_JS_Variant* result) { +#if ENABLE(NETSCAPE_PLUGIN_API) NPVariant* np_args; NPVariant np_result; bool fail = false; @@ -663,36 +683,48 @@ Eina_Bool ewk_js_object_invoke(Ewk_JS_Object* jsObject, Ewk_JS_Variant* args, in end: free(np_args); return fail; +#else + return false; +#endif } Ewk_JS_Object_Type ewk_js_object_type_get(Ewk_JS_Object* jsObject) { +#if ENABLE(NETSCAPE_PLUGIN_API) EINA_SAFETY_ON_NULL_RETURN_VAL(jsObject, EWK_JS_OBJECT_OBJECT); EINA_MAGIC_CHECK_OR_RETURN(jsObject, EWK_JS_OBJECT_OBJECT); return jsObject->type; +#else + return EWK_JS_OBJECT_INVALID; +#endif } void ewk_js_object_type_set(Ewk_JS_Object* jsObject, Ewk_JS_Object_Type type) { +#if ENABLE(NETSCAPE_PLUGIN_API) EINA_SAFETY_ON_NULL_RETURN(jsObject); EINA_MAGIC_CHECK_OR_RETURN(jsObject); jsObject->type = type; +#endif } void ewk_js_variant_free(Ewk_JS_Variant* jsVariant) { +#if ENABLE(NETSCAPE_PLUGIN_API) EINA_SAFETY_ON_NULL_RETURN(jsVariant); if (jsVariant->type == EWK_JS_VARIANT_STRING) free(jsVariant->value.s); else if (jsVariant->type == EWK_JS_VARIANT_OBJECT) ewk_js_object_free(jsVariant->value.o); free(jsVariant); +#endif } void ewk_js_variant_array_free(Ewk_JS_Variant* jsVariant, int count) { +#if ENABLE(NETSCAPE_PLUGIN_API) EINA_SAFETY_ON_NULL_RETURN(jsVariant); for (int i = 0; i < count; i++) { if (jsVariant[i].type == EWK_JS_VARIANT_STRING) @@ -701,54 +733,5 @@ void ewk_js_variant_array_free(Ewk_JS_Variant* jsVariant, int count) ewk_js_object_free(jsVariant[i].value.o); } free(jsVariant); +#endif } - -#else - -Eina_Hash* ewk_js_object_properties_get(const Ewk_JS_Object* jsObject) -{ - return 0; -} - -const char* ewk_js_object_name_get(const Ewk_JS_Object* jsObject) -{ - return 0; -} - -Evas_Object* ewk_js_object_view_get(const Ewk_JS_Object* jsObject) -{ - return 0; -} - -void ewk_js_variant_free(Ewk_JS_Variant* jsVariant) -{ -} - -void ewk_js_variant_array_free(Ewk_JS_Variant* jsVariant, int count) -{ -} - -Ewk_JS_Object* ewk_js_object_new(const Ewk_JS_Class_Meta* jsMetaClass) -{ - return 0; -} - -void ewk_js_object_free(Ewk_JS_Object* jsObject) -{ -} - -Eina_Bool ewk_js_object_invoke(Ewk_JS_Object* jsObject, Ewk_JS_Variant* args, int argCount, Ewk_JS_Variant* result) -{ - return false; -} - -Ewk_JS_Object_Type ewk_js_object_type_get(Ewk_JS_Object* jsObject) -{ - return EWK_JS_OBJECT_INVALID; -} - -void ewk_js_object_type_set(Ewk_JS_Object* jsObject, Ewk_JS_Object_Type type) -{ -} - -#endif // ENABLE(NETSCAPE_PLUGIN_API) diff --git a/Source/WebKit/efl/ewk/ewk_private.h b/Source/WebKit/efl/ewk/ewk_private.h index 2025941c9..bbff734fc 100644 --- a/Source/WebKit/efl/ewk/ewk_private.h +++ b/Source/WebKit/efl/ewk/ewk_private.h @@ -39,10 +39,6 @@ #include <wtf/PassRefPtr.h> #include <wtf/Vector.h> -#ifdef __cplusplus -extern "C" { -#endif - // If defined, ewk will do type checking to ensure objects are of correct type #define EWK_TYPE_CHECK 1 #define EWK_ARGB_BYTES_SIZE 4 @@ -62,6 +58,10 @@ struct _Ewk_JS_Object { }; #endif // ENABLE(NETSCAPE_PLUGIN_API) +// Defines the names for initializing ewk_view_smart_class +const char ewkViewTiledName[] = "Ewk_View_Tiled"; +const char ewkViewSingleName[] = "Ewk_View_Single"; + // forward declarations namespace WebCore { struct PopupMenuClient; @@ -227,8 +227,4 @@ void ewk_frame_mixed_content_run_set(Evas_Object* ewkFrame, bool hasRun); void ewk_view_mixed_content_displayed_set(Evas_Object* ewkView, bool hasDisplayed); void ewk_view_mixed_content_run_set(Evas_Object* ewkView, bool hasRun); -#ifdef __cplusplus - -} -#endif #endif // ewk_private_h diff --git a/Source/WebKit/efl/ewk/ewk_security_policy.cpp b/Source/WebKit/efl/ewk/ewk_security_policy.cpp new file mode 100644 index 000000000..dd3ba9fa9 --- /dev/null +++ b/Source/WebKit/efl/ewk/ewk_security_policy.cpp @@ -0,0 +1,48 @@ +/* + Copyright (C) 2012 ProFUSION embedded systems + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" +#include "ewk_security_policy.h" + +#include "KURL.h" +#include "SecurityOrigin.h" +#include "SecurityPolicy.h" + +using namespace WebCore; + +void ewk_security_policy_whitelist_origin_add(const char* sourceUrl, const char* destinationUrl, Eina_Bool allowSubdomains) +{ + const RefPtr<SecurityOrigin> source = SecurityOrigin::createFromString(sourceUrl); + const KURL destination(KURL(), destinationUrl); + + SecurityPolicy::addOriginAccessWhitelistEntry(*source, destination.protocol(), destination.host(), allowSubdomains); +} + +void ewk_security_policy_whitelist_origin_del(const char* sourceUrl, const char* destinationUrl, Eina_Bool allowSubdomains) +{ + const RefPtr<SecurityOrigin> source = SecurityOrigin::createFromString(sourceUrl); + const KURL destination(KURL(), destinationUrl); + + SecurityPolicy::removeOriginAccessWhitelistEntry(*source, destination.protocol(), destination.host(), allowSubdomains); +} + +void ewk_security_policy_whitelist_origin_reset() +{ + SecurityPolicy::resetOriginAccessWhitelists(); +} diff --git a/Source/WebKit/efl/ewk/ewk_security_policy.h b/Source/WebKit/efl/ewk/ewk_security_policy.h new file mode 100644 index 000000000..339f148b3 --- /dev/null +++ b/Source/WebKit/efl/ewk/ewk_security_policy.h @@ -0,0 +1,60 @@ +/* + Copyright (C) 2012 ProFUSION embedded systems + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef ewk_security_policy_h +#define ewk_security_policy_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include <Eina.h> + +/** + * Allows a page from @p source_url to request a resource from @p destination_url. + * + * @param source_url Source URL; protocol and domain only (e.g. app://clock.zip) + * @param destination_url Destination URL; protocol and domain only (e.g. http://api.example.com) + * @param allow_subdomains EINA_TRUE if subdomains of destination URLs should be whitelisted + */ +EAPI void ewk_security_policy_whitelist_origin_add(const char *source_url, + const char *destination_url, + Eina_Bool allow_subdomains); + +/** + * Remove a whitelist item added with ewk_security_policy_whitelist_origin_del(). + * + * @param source_url Source URL; protocol and domain only (e.g. app://clock.zip) + * @param destination_url Destination URL; protocol and domain only (e.g. http://api.example.com) + * @param allow_subdomains EINA_TRUE if subdomains of destination URLs should be whitelisted + */ +EAPI void ewk_security_policy_whitelist_origin_del(const char *source_url, + const char *destination_url, + Eina_Bool allow_subdomains); + +/** + * Resets the whitelist to EWebKit's default, empty list. + */ +EAPI void ewk_security_policy_whitelist_origin_reset(); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_security_policy_h diff --git a/Source/WebKit/efl/ewk/ewk_tiled_backing_store.cpp b/Source/WebKit/efl/ewk/ewk_tiled_backing_store.cpp index 094767a0c..4cdd72d85 100644 --- a/Source/WebKit/efl/ewk/ewk_tiled_backing_store.cpp +++ b/Source/WebKit/efl/ewk/ewk_tiled_backing_store.cpp @@ -73,6 +73,7 @@ struct _Ewk_Tiled_Backing_Store_Data { Evas_Coord x, y; } cur, old, base, zoomCenter; } offset; + bool visible : 1; } view; Evas_Colorspace colorSpace; struct { @@ -133,7 +134,7 @@ static inline void _ewk_tiled_backing_store_updates_process(Ewk_Tiled_Backing_St * in the queue in order to not miss any updates after the render is * resumed. */ - if (priv->render.suspend || !evas_object_visible_get(priv->self)) + if (priv->render.suspend || !priv->view.visible) return; if (priv->process.preCallback) @@ -382,7 +383,7 @@ static inline void _ewk_tiled_backing_store_item_process_idler_stop(Ewk_Tiled_Ba static inline void _ewk_tiled_backing_store_item_process_idler_start(Ewk_Tiled_Backing_Store_Data* priv) { - if (priv->render.idler || !evas_object_visible_get(priv->self)) + if (priv->render.idler || !priv->view.visible) return; priv->render.idler = ecore_idler_add( _ewk_tiled_backing_store_item_process_idler_cb, priv); @@ -413,7 +414,7 @@ static Eina_Bool _ewk_tiled_backing_store_enable_render(Ewk_Tiled_Backing_Store_ static inline Eina_Bool _ewk_tiled_backing_store_item_fill(Ewk_Tiled_Backing_Store_Data* priv, Ewk_Tiled_Backing_Store_Item* item, unsigned long column, unsigned long row) { - if (!evas_object_visible_get(priv->self)) + if (!priv->view.visible) return false; unsigned long currentColumn = priv->model.base.column + column; @@ -644,7 +645,7 @@ static void _ewk_tiled_backing_store_smart_member_add(Evas_Object* ewkBackingSto if (!priv->contentsClipper) return; evas_object_clip_set(member, priv->contentsClipper); - if (evas_object_visible_get(ewkBackingStore)) + if (priv->view.visible) evas_object_show(priv->contentsClipper); } @@ -695,8 +696,8 @@ static void _ewk_tiled_backing_store_smart_add(Evas_Object* ewkBackingStore) priv->self = ewkBackingStore; priv->view.tile.zoom = 1.0; - priv->view.tile.width = DEFAULT_TILE_W; - priv->view.tile.height = DEFAULT_TILE_H; + priv->view.tile.width = defaultTileWidth; + priv->view.tile.height = defaultTileHeigth; priv->view.offset.cur.x = 0; priv->view.offset.cur.y = 0; priv->view.offset.old.x = 0; @@ -805,13 +806,18 @@ static void _ewk_tiled_backing_store_smart_resize(Evas_Object* ewkBackingStore, static void _ewk_tiled_backing_store_smart_show(Evas_Object* ewkBackingStore) { + PRIV_DATA_GET_OR_RETURN(ewkBackingStore, priv); + priv->view.visible = true; ewk_tiled_backing_store_enable_render(ewkBackingStore); _parent_sc.show(ewkBackingStore); } static void _ewk_tiled_backing_store_smart_hide(Evas_Object* ewkBackingStore) { + PRIV_DATA_GET_OR_RETURN(ewkBackingStore, priv); + priv->view.visible = false; ewk_tiled_backing_store_disable_render(ewkBackingStore); + _ewk_tiled_backing_store_tile_dissociate_all(priv); _parent_sc.hide(ewkBackingStore); } @@ -1479,9 +1485,9 @@ static Eina_Bool _ewk_tiled_backing_store_zoom_set_internal(Ewk_Tiled_Backing_St *offsetX = priv->view.offset.cur.x; *offsetY = priv->view.offset.cur.y; - if (fabsf(priv->view.tile.zoom - *zoom) < ZOOM_STEP_MIN) { + if (fabsf(priv->view.tile.zoom - *zoom) < zoomStepMinimum) { DBG("ignored as zoom difference is < %f: %f", - (double)ZOOM_STEP_MIN, fabsf(priv->view.tile.zoom - *zoom)); + (double)zoomStepMinimum, fabsf(priv->view.tile.zoom - *zoom)); return true; } diff --git a/Source/WebKit/efl/ewk/ewk_tiled_backing_store.h b/Source/WebKit/efl/ewk/ewk_tiled_backing_store.h index 44740cb42..e93ccf799 100644 --- a/Source/WebKit/efl/ewk/ewk_tiled_backing_store.h +++ b/Source/WebKit/efl/ewk/ewk_tiled_backing_store.h @@ -33,10 +33,10 @@ */ #undef DEBUG_MEM_LEAKS -#define DEFAULT_TILE_W (256) -#define DEFAULT_TILE_H (256) +const int defaultTileWidth = 256; +const int defaultTileHeigth = 256; -#define ZOOM_STEP_MIN (0.01) +const float zoomStepMinimum = 0.01; #define TILE_SIZE_AT_ZOOM(SIZE, ZOOM) ((int)roundf((SIZE) * (ZOOM))) #define TILE_ZOOM_AT_SIZE(SIZE, ORIG_TILE) ((float)(SIZE) / (float)(ORIG_TILE)) diff --git a/Source/WebKit/efl/ewk/ewk_tiled_matrix.cpp b/Source/WebKit/efl/ewk/ewk_tiled_matrix.cpp index 95e2319fe..ab06042ce 100644 --- a/Source/WebKit/efl/ewk/ewk_tiled_matrix.cpp +++ b/Source/WebKit/efl/ewk/ewk_tiled_matrix.cpp @@ -225,8 +225,8 @@ Ewk_Tile_Matrix* ewk_tile_matrix_new(Ewk_Tile_Unused_Cache* tileUnusedCache, uns tileMatrix->cspace = colorSpace; tileMatrix->render.callback = renderCallback; tileMatrix->render.data = (void*)renderData; - tileMatrix->tile.width = DEFAULT_TILE_W; - tileMatrix->tile.height = DEFAULT_TILE_H; + tileMatrix->tile.width = defaultTileWidth; + tileMatrix->tile.height = defaultTileHeigth; return tileMatrix; } diff --git a/Source/WebKit/efl/ewk/ewk_tiled_model.cpp b/Source/WebKit/efl/ewk/ewk_tiled_model.cpp index 0ef28b3a3..84048cbf6 100644 --- a/Source/WebKit/efl/ewk/ewk_tiled_model.cpp +++ b/Source/WebKit/efl/ewk/ewk_tiled_model.cpp @@ -146,73 +146,6 @@ void ewk_tile_accounting_dbg() } #endif -static inline void _ewk_tile_paint_rgb888(Ewk_Tile* tile, uint8_t red, uint8_t green, uint8_t blue) -{ - uint32_t color1 = 0xff000000 | ((uint32_t)red << 16) | ((uint32_t)green << 8) | blue; - uint32_t color2 = ((uint64_t)color1 << 32) | color1; - - uint64_t* dst64 = (uint64_t*)tile->pixels; - uint64_t* dst64_end = dst64 + ((tile->bytes / 8) & ~7); - for (; dst64 < dst64_end; dst64 += 8) { - /* TODO: ARM add pld or NEON instructions */ - dst64[0] = color2; - dst64[1] = color2; - dst64[2] = color2; - dst64[3] = color2; - dst64[4] = color2; - dst64[5] = color2; - dst64[6] = color2; - dst64[7] = color2; - } - - uint32_t* dst32 = (uint32_t*)dst64_end; - uint32_t* dst32_end = (uint32_t*)(tile->pixels + tile->bytes); - for (; dst32 < dst32_end; dst32++) - *dst32 = color1; -} - -static inline void _ewk_tile_paint_rgb565(Ewk_Tile* tile, uint8_t red, uint8_t green, uint8_t blue) -{ - uint16_t* dst16, * dst16_end, color1; - uint64_t* dst64, * dst64_end, color2; - - color1 = ((((red >> 3) & 0x1f) << 11) | - (((green >> 2) & 0x3f) << 5) | - ((blue >> 3) & 0x1f)); - - color2 = (((uint64_t)color1 << 48) | ((uint64_t)color1 << 32) | - ((uint64_t)color1 << 16) | color1); - - dst64 = (uint64_t*)tile->pixels; - dst64_end = dst64 + ((tile->bytes / 8) & ~7); - for (; dst64 < dst64_end; dst64 += 8) { - /* TODO: ARM add pld or NEON instructions */ - dst64[0] = color2; - dst64[1] = color2; - dst64[2] = color2; - dst64[3] = color2; - dst64[4] = color2; - dst64[5] = color2; - dst64[6] = color2; - dst64[7] = color2; - } - - dst16 = (uint16_t*)dst16_end; - dst16_end = (uint16_t*)(tile->pixels + tile->bytes); - for (; dst16 < dst16_end; dst16++) - *dst16 = color1; -} - -static inline void _ewk_tile_paint(Ewk_Tile* tile, uint8_t red, uint8_t green, uint8_t blue) -{ - if (tile->cspace == EVAS_COLORSPACE_ARGB8888) - _ewk_tile_paint_rgb888(tile, red, green, blue); - else if (tile->cspace == EVAS_COLORSPACE_RGB565_A5P) - _ewk_tile_paint_rgb565(tile, red, green, blue); - else - ERR("unknown color space: %d", tile->cspace); -} - /** * Create a new tile of given size, zoom level and colorspace. * diff --git a/Source/WebKit/efl/ewk/ewk_view.cpp b/Source/WebKit/efl/ewk/ewk_view.cpp index 8e089e130..853b342eb 100644 --- a/Source/WebKit/efl/ewk/ewk_view.cpp +++ b/Source/WebKit/efl/ewk/ewk_view.cpp @@ -48,6 +48,7 @@ #include "PlatformMouseEvent.h" #include "PopupMenuClient.h" #include "ProgressTracker.h" +#include "RefPtrCairo.h" #include "RenderTheme.h" #include "Settings.h" #include "c_instance.h" @@ -67,20 +68,20 @@ #include "DeviceOrientationClientEfl.h" #endif -#define ZOOM_MIN (0.05) -#define ZOOM_MAX (4.0) +static const float zoomMinimum = 0.05; +static const float zoomMaximum = 4.0; -#define DEVICE_PIXEL_RATIO (1.0) +static const float devicePixelRatio = 1.0; -static const char EWK_VIEW_TYPE_STR[] = "EWK_View"; +static const char ewkViewTypeString[] = "EWK_View"; -static const size_t EWK_VIEW_REPAINTS_SIZE_INITIAL = 32; -static const size_t EWK_VIEW_REPAINTS_SIZE_STEP = 8; -static const size_t EWK_VIEW_REPAINTS_SIZE_MAX_FREE = 64; +static const size_t ewkViewRepaintsSizeInitial = 32; +static const size_t ewkViewRepaintsSizeStep = 8; +static const size_t ewkViewRepaintsSizeMaximumFree = 64; -static const size_t EWK_VIEW_SCROLLS_SIZE_INITIAL = 8; -static const size_t EWK_VIEW_SCROLLS_SIZE_STEP = 2; -static const size_t EWK_VIEW_SCROLLS_SIZE_MAX_FREE = 32; +static const size_t ewkViewScrollsSizeInitial = 8; +static const size_t ewkViewScrollsSizeStep = 2; +static const size_t ewkViewScrollsSizeMaximumFree = 32; static const Evas_Smart_Cb_Description _ewk_view_callback_names[] = { { "download,request", "p" }, @@ -232,11 +233,11 @@ struct _Ewk_View_Private_Data { _tmp_otype ? _tmp_otype : "(null)"); \ return __VA_ARGS__; \ } \ - if (EINA_UNLIKELY(_tmp_sc->data != EWK_VIEW_TYPE_STR)) { \ + if (EINA_UNLIKELY(_tmp_sc->data != ewkViewTypeString)) { \ EINA_LOG_CRIT \ ("%p (%s) is not of an ewk_view (need %p, got %p)!", \ ewkView, _tmp_otype ? _tmp_otype : "(null)", \ - EWK_VIEW_TYPE_STR, _tmp_sc->data); \ + ewkViewTypeString, _tmp_sc->data); \ return __VA_ARGS__; \ } \ } while (0) @@ -266,8 +267,8 @@ struct _Ewk_View_Private_Data { } #define EWK_VIEW_TILED_TYPE_CHECK_OR_RETURN(ewkView, ...) \ - if (!evas_object_smart_type_check(ewkView, "Ewk_View_Tiled")) { \ - INF("object is not a instance of Ewk_View_Tiled"); \ + if (!evas_object_smart_type_check(ewkView, ewkViewTiledName)) { \ + INF("object isn't an instance of %s", ewkViewTiledName); \ return __VA_ARGS__; \ } @@ -296,9 +297,9 @@ static void _ewk_view_repaint_add(Ewk_View_Private_Data* priv, Evas_Coord x, Eva size_t newSize = 0; if (priv->repaints.allocated == priv->repaints.count) - newSize = priv->repaints.allocated + EWK_VIEW_REPAINTS_SIZE_STEP; - else if (!priv->repaints.count && priv->repaints.allocated > EWK_VIEW_REPAINTS_SIZE_INITIAL) - newSize = EWK_VIEW_REPAINTS_SIZE_INITIAL; + newSize = priv->repaints.allocated + ewkViewRepaintsSizeStep; + else if (!priv->repaints.count && priv->repaints.allocated > ewkViewRepaintsSizeInitial) + newSize = ewkViewRepaintsSizeInitial; if (newSize) { if (!_ewk_view_repaints_resize(priv, newSize)) @@ -319,9 +320,9 @@ static void _ewk_view_repaint_add(Ewk_View_Private_Data* priv, Evas_Coord x, Eva static void _ewk_view_repaints_flush(Ewk_View_Private_Data* priv) { priv->repaints.count = 0; - if (priv->repaints.allocated <= EWK_VIEW_REPAINTS_SIZE_MAX_FREE) + if (priv->repaints.allocated <= ewkViewRepaintsSizeMaximumFree) return; - _ewk_view_repaints_resize(priv, EWK_VIEW_REPAINTS_SIZE_MAX_FREE); + _ewk_view_repaints_resize(priv, ewkViewRepaintsSizeMaximumFree); } static Eina_Bool _ewk_view_scrolls_resize(Ewk_View_Private_Data* priv, size_t size) @@ -365,9 +366,9 @@ static void _ewk_view_scroll_add(Ewk_View_Private_Data* priv, Evas_Coord deltaX, if (priv->scrolls.allocated == priv->scrolls.count) { size_t size; if (!priv->scrolls.allocated) - size = EWK_VIEW_SCROLLS_SIZE_INITIAL; + size = ewkViewScrollsSizeInitial; else - size = priv->scrolls.allocated + EWK_VIEW_SCROLLS_SIZE_STEP; + size = priv->scrolls.allocated + ewkViewScrollsSizeStep; if (!_ewk_view_scrolls_resize(priv, size)) return; } @@ -400,9 +401,9 @@ static void _ewk_view_scroll_add(Ewk_View_Private_Data* priv, Evas_Coord deltaX, static void _ewk_view_scrolls_flush(Ewk_View_Private_Data* priv) { priv->scrolls.count = 0; - if (priv->scrolls.allocated <= EWK_VIEW_SCROLLS_SIZE_MAX_FREE) + if (priv->scrolls.allocated <= ewkViewScrollsSizeMaximumFree) return; - _ewk_view_scrolls_resize(priv, EWK_VIEW_SCROLLS_SIZE_MAX_FREE); + _ewk_view_scrolls_resize(priv, ewkViewScrollsSizeMaximumFree); } // Default Event Handling ////////////////////////////////////////////// @@ -699,10 +700,10 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData) // Since there's no scale separated from zooming in webkit-efl, this functionality of // viewport meta tag is implemented using zoom. When scale zoom is supported by webkit-efl, // this functionality will be modified by the scale zoom patch. - priv->settings.zoomRange.minScale = ZOOM_MIN; - priv->settings.zoomRange.maxScale = ZOOM_MAX; + priv->settings.zoomRange.minScale = zoomMinimum; + priv->settings.zoomRange.maxScale = zoomMaximum; priv->settings.zoomRange.userScalable = true; - priv->settings.devicePixelRatio = DEVICE_PIXEL_RATIO; + priv->settings.devicePixelRatio = devicePixelRatio; priv->settings.domTimerInterval = priv->pageSettings->defaultMinDOMTimerInterval(); @@ -1135,7 +1136,7 @@ Eina_Bool ewk_view_base_smart_set(Ewk_View_Smart_Class* api) api->sc.calculate = _ewk_view_smart_calculate; api->sc.show = _ewk_view_smart_show; api->sc.hide = _ewk_view_smart_hide; - api->sc.data = EWK_VIEW_TYPE_STR; /* used by type checking */ + api->sc.data = ewkViewTypeString; /* used by type checking */ api->sc.callbacks = _ewk_view_callback_names; api->contents_resize = _ewk_view_smart_contents_resize; @@ -2609,8 +2610,7 @@ void ewk_view_paint_context_clip(Ewk_View_Paint_Context* context, const Eina_Rec { EINA_SAFETY_ON_NULL_RETURN(context); EINA_SAFETY_ON_NULL_RETURN(area); - - context->graphicContext->clip(WebCore::IntRect(area->x, area->y, area->w, area->h)); + context->graphicContext->clip(WebCore::IntRect(*area)); } void ewk_view_paint_context_paint(Ewk_View_Paint_Context* context, const Eina_Rectangle* area) @@ -2618,7 +2618,7 @@ void ewk_view_paint_context_paint(Ewk_View_Paint_Context* context, const Eina_Re EINA_SAFETY_ON_NULL_RETURN(context); EINA_SAFETY_ON_NULL_RETURN(area); - WebCore::IntRect rect(area->x, area->y, area->w, area->h); + WebCore::IntRect rect(*area); if (context->view->isTransparent()) context->graphicContext->clearRect(rect); @@ -2630,7 +2630,7 @@ void ewk_view_paint_context_paint_contents(Ewk_View_Paint_Context* context, cons EINA_SAFETY_ON_NULL_RETURN(context); EINA_SAFETY_ON_NULL_RETURN(area); - WebCore::IntRect rect(area->x, area->y, area->w, area->h); + WebCore::IntRect rect(*area); if (context->view->isTransparent()) context->graphicContext->clearRect(rect); @@ -2663,7 +2663,7 @@ Eina_Bool ewk_view_paint(Ewk_View_Private_Data* priv, cairo_t* cr, const Eina_Re if (view->needsLayout()) view->forceLayout(); WebCore::GraphicsContext graphicsContext(cr); - WebCore::IntRect rect(area->x, area->y, area->w, area->h); + WebCore::IntRect rect(*area); cairo_save(cr); graphicsContext.save(); @@ -2686,7 +2686,7 @@ Eina_Bool ewk_view_paint_contents(Ewk_View_Private_Data* priv, cairo_t* cr, cons EINA_SAFETY_ON_NULL_RETURN_VAL(view, false); WebCore::GraphicsContext graphicsContext(cr); - WebCore::IntRect rect(area->x, area->y, area->w, area->h); + WebCore::IntRect rect(*area); cairo_save(cr); graphicsContext.save(); @@ -3534,6 +3534,7 @@ void ewk_view_download_request(Evas_Object* ewkView, Ewk_Download* download) evas_object_smart_callback_call(ewkView, "download,request", download); } +#if ENABLE(NETSCAPE_PLUGIN_API) /** * @internal * Reports the JS window object was cleared. @@ -3545,6 +3546,7 @@ void ewk_view_js_window_object_clear(Evas_Object* ewkView, Evas_Object* frame) { evas_object_smart_callback_call(ewkView, "js,windowobject,clear", frame); } +#endif /** * @internal diff --git a/Source/WebKit/efl/ewk/ewk_view.h b/Source/WebKit/efl/ewk/ewk_view.h index d0be61d75..a4335374f 100644 --- a/Source/WebKit/efl/ewk/ewk_view.h +++ b/Source/WebKit/efl/ewk/ewk_view.h @@ -61,6 +61,7 @@ * - "mixedcontent,displayed", void: any of the containing frames has loaded and displayed mixed content. * - "mixedcontent,run", void: any of the containing frames has loaded and run mixed content. * - "ready", void: page is fully loaded. + * - "resource,request,willsend", Ewk_Frame_Resource_Request*: the network request for the main frame will be sent. * - "scrollbars,visible,get", Eina_Bool *: expects a @c EINA_TRUE if scrollbars * are visible; @c EINA_FALSE, otherwise. * - "scrollbars,visible,set", Eina_Bool: sets scrollbars visibility. diff --git a/Source/WebKit/efl/ewk/ewk_view_single.cpp b/Source/WebKit/efl/ewk/ewk_view_single.cpp index be836d065..526524bdd 100644 --- a/Source/WebKit/efl/ewk/ewk_view_single.cpp +++ b/Source/WebKit/efl/ewk/ewk_view_single.cpp @@ -25,6 +25,7 @@ #include "ewk_logging.h" #include "ewk_private.h" +#include <Ecore_Evas.h> #include <Evas.h> #include <eina_safety_checks.h> #include <string.h> @@ -57,6 +58,12 @@ static void _ewk_view_single_smart_add(Evas_Object* ewkView) static Evas_Object* _ewk_view_single_smart_backing_store_add(Ewk_View_Smart_Data* smartData) { Evas_Object* bs = evas_object_image_add(smartData->base.evas); + EINA_SAFETY_ON_NULL_RETURN_VAL(bs, 0); + const Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas); + const char* engine = ecore_evas_engine_name_get(ecoreEvas); + if (!strncmp(engine, "opengl_x11", strlen("opengl_x11"))) + evas_object_image_content_hint_set(bs, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); + evas_object_image_alpha_set(bs, false); evas_object_image_smooth_scale_set(bs, smartData->zoom_weak_smooth_scale); @@ -88,115 +95,29 @@ static void _ewk_view_single_smart_resize(Evas_Object* ewkView, Evas_Coord width } } -static inline void _ewk_view_4b_move_region_up(uint32_t* image, size_t rows, size_t x, size_t y, size_t width, size_t height, size_t rowSize) -{ - uint32_t* source; - uint32_t* destination; - - destination = image + x + y * rowSize; - source = destination + rows * rowSize; - height -= rows; - - for (; height > 0; height--, destination += rowSize, source += rowSize) - memcpy(destination, source, width * 4); -} - -static inline void _ewk_view_4b_move_region_down(uint32_t* image, size_t rows, size_t x, size_t y, size_t width, size_t height, size_t rowSize) +static inline void _ewk_view_screen_move(uint32_t* image, size_t destinationX, size_t destinationY, size_t sourceX, size_t sourceY, size_t copyWidth, size_t copyHeight, size_t frameWidth) { - uint32_t* source; - uint32_t* destination; - - height -= rows; - source = image + x + (y + height - 1) * rowSize; - destination = source + rows * rowSize; - - for (; height > 0; height--, destination -= rowSize, source -= rowSize) - memcpy(destination, source, width * 4); -} - -static inline void _ewk_view_4b_move_line_left(uint32_t* destination, const uint32_t* source, size_t count) -{ - uint32_t* endOfDestination = destination + count; - /* no memcpy() as it does not allow overlapping regions */ - /* no memmove() as it will copy to a temporary buffer */ - /* TODO: loop unrolling, copying up to quad-words would help */ - for (; destination < endOfDestination; destination++, source++) - *destination = *source; -} - -static inline void _ewk_view_4b_move_line_right(uint32_t* destination, uint32_t* source, size_t count) -{ - uint32_t* endOfDestination = destination - count; - /* no memcpy() as it does not allow overlapping regions */ - /* no memmove() as it will copy to a temporary buffer */ - /* TODO: loop unrolling, copying up to quad-words would help */ - for (; destination > endOfDestination; destination--, source--) - *destination = *source; -} - -static inline void _ewk_view_4b_move_region_left(uint32_t* image, size_t columns, size_t x, size_t y, size_t width, size_t height, size_t rowSize) -{ - uint32_t* source; - uint32_t* destination; - - destination = image + x + y * rowSize; - source = destination + columns; - width -= columns; - - for (; height > 0; height--, destination += rowSize, source += rowSize) - _ewk_view_4b_move_line_left(destination, source, width); -} - -static inline void _ewk_view_4b_move_region_right(uint32_t* image, size_t columns, size_t x, size_t y, size_t width, size_t height, size_t rowSize) -{ - uint32_t* source; - uint32_t* destination; - - width -= columns; - source = image + (x + width - 1) + y * rowSize; - destination = source + columns; - - for (; height > 0; height--, destination += rowSize, source += rowSize) - _ewk_view_4b_move_line_right(destination, source, width); -} - -/* catch-all function, not as optimized as the others, but does the work. */ -static inline void _ewk_view_4b_move_region(uint32_t* image, int deltaX, int deltaY, size_t x, size_t y, size_t width, size_t height, size_t rowSize) -{ - uint32_t* source; - uint32_t* destination; - - if (deltaY < 0) { - height += deltaY; - destination = image + x + y * rowSize; - source = destination - deltaY * rowSize; - if (deltaX <= 0) { - width += deltaX; - source -= deltaX; - for (; height > 0; height--, destination += rowSize, source += rowSize) - _ewk_view_4b_move_line_left(destination, source, width); - } else { - width -= deltaX; - source += width - 1; - destination += width + deltaX -1; - for (; height > 0; height--, destination += rowSize, source += rowSize) - _ewk_view_4b_move_line_right(destination, source, width); + uint32_t* sourceBegin = image + (frameWidth * sourceY) + sourceX; + uint32_t* destinationBegin = image + (frameWidth * destinationY) + destinationX; + + size_t copyLength = copyWidth * 4; + const int moveLineUpDown = sourceY >= destinationY ? 1 : -1; + int startHeight = sourceY >= destinationY ? 0 : copyHeight - 1; + + uint32_t* source, * destination; + if (sourceX >= destinationX) { + for (int i = 0; i < copyHeight; i++) { + source = sourceBegin + (frameWidth * startHeight); + destination = destinationBegin + (frameWidth * startHeight); + startHeight = startHeight + moveLineUpDown; + memcpy(destination, source, copyLength); } } else { - height -= deltaY; - source = image + x + (y + height - 1) * rowSize; - destination = source + deltaY * rowSize; - if (deltaX <= 0) { - width += deltaX; - source -= deltaX; - for (; height > 0; height--, destination -= rowSize, source -= rowSize) - _ewk_view_4b_move_line_left(destination, source, width); - } else { - width -= deltaX; - source += width - 1; - destination += width + deltaX - 1; - for (; height > 0; height--, destination -= rowSize, source -= rowSize) - _ewk_view_4b_move_line_right(destination, source, width); + for (int i = 0; i < copyHeight; i++) { + source = sourceBegin + (frameWidth * startHeight); + destination = destinationBegin + (frameWidth * startHeight); + startHeight = startHeight + moveLineUpDown; + memmove(destination, source, copyLength); } } } @@ -241,105 +162,33 @@ static inline void _ewk_view_single_scroll_process_single(Ewk_View_Smart_Data* s scrollHeight = 0; EINA_SAFETY_ON_TRUE_RETURN(!scrollWidth || !scrollHeight); - if (!scrollRequest->dx) { - if (scrollRequest->dy < 0) { - DBG("scroll up: %+03d,%+03d update=%d,%d+%dx%d, " - "repaint=%d,%d+%dx%d", - scrollRequest->dx, scrollRequest->dy, scrollX, scrollY, scrollWidth, scrollHeight + scrollRequest->dy, - scrollX, scrollY + scrollHeight + scrollRequest->dy, scrollWidth, -scrollRequest->dy); - - _ewk_view_4b_move_region_up - (static_cast<uint32_t*>(pixels), -scrollRequest->dy, scrollX, scrollY, scrollWidth, scrollHeight, width); - evas_object_image_data_update_add - (smartData->backing_store, scrollX, scrollY, scrollWidth, scrollHeight + scrollRequest->dy); - - ewk_view_repaint_add(smartData->_priv, scrollX, scrollY + scrollHeight + scrollRequest->dy, scrollWidth, -scrollRequest->dy); - } else if (scrollRequest->dy > 0) { - DBG("scroll down: %+03d,%+03d update=%d,%d+%dx%d, " - "repaint=%d,%d+%dx%d", - scrollRequest->dx, scrollRequest->dy, scrollX, scrollY + scrollRequest->dy, scrollWidth, scrollHeight - scrollRequest->dy, - scrollX, scrollY, scrollWidth, scrollRequest->dy); - - _ewk_view_4b_move_region_down - (static_cast<uint32_t*>(pixels), scrollRequest->dy, scrollX, scrollY, scrollWidth, scrollHeight, width); - evas_object_image_data_update_add - (smartData->backing_store, scrollX, scrollY + scrollRequest->dy, scrollWidth, scrollHeight - scrollRequest->dy); - - ewk_view_repaint_add(smartData->_priv, scrollX, scrollY, scrollWidth, scrollRequest->dy); - } - } else if (!scrollRequest->dy) { - if (scrollRequest->dx < 0) { - DBG("scroll left: %+03d,%+03d update=%d,%d+%dx%d, " - "repaint=%d,%d+%dx%d", - scrollRequest->dx, scrollRequest->dy, scrollX, scrollY, scrollWidth + scrollRequest->dx, scrollHeight, - scrollX + scrollWidth + scrollRequest->dx, scrollY, -scrollRequest->dx, scrollHeight); - - _ewk_view_4b_move_region_left - (static_cast<uint32_t*>(pixels), -scrollRequest->dx, scrollX, scrollY, scrollWidth, scrollHeight, width); - evas_object_image_data_update_add - (smartData->backing_store, scrollX, scrollY, scrollWidth + scrollRequest->dx, scrollHeight); - - ewk_view_repaint_add(smartData->_priv, scrollX + scrollWidth + scrollRequest->dx, scrollY, -scrollRequest->dx, scrollHeight); - } else if (scrollRequest->dx > 0) { - DBG("scroll up: %+03d,%+03d update=%d,%d+%dx%d, " - "repaint=%d,%d+%dx%d", - scrollRequest->dx, scrollRequest->dy, scrollX + scrollRequest->dx, scrollY, scrollWidth - scrollRequest->dx, scrollHeight, - scrollX, scrollY, scrollRequest->dx, scrollHeight); - - _ewk_view_4b_move_region_right - (static_cast<uint32_t*>(pixels), scrollRequest->dx, scrollX, scrollY, scrollWidth, scrollHeight, width); - evas_object_image_data_update_add - (smartData->backing_store, scrollX + scrollRequest->dx, scrollY, scrollWidth - scrollRequest->dx, scrollHeight); - - ewk_view_repaint_add(smartData->_priv, scrollX, scrollY, scrollRequest->dx, scrollHeight); - } - } else { - Evas_Coord moveX, moveY, moveWidth, moveHeight; - Evas_Coord verticalX, verticalY, verticalWidth, verticalHeight; - Evas_Coord horizontalX, horizontalY, horizontalWidth, horizontalHeight; - - if (scrollRequest->dx < 0) { - moveX = scrollX; - moveWidth = scrollWidth + scrollRequest->dx; - verticalX = moveX + moveWidth; - verticalWidth = -scrollRequest->dx; - } else { - verticalX = scrollX; - verticalWidth = scrollRequest->dx; - moveX = verticalX + verticalWidth; - moveWidth = scrollWidth - scrollRequest->dx; - } - - if (scrollRequest->dy < 0) { - moveY = scrollY; - moveHeight = scrollHeight + scrollRequest->dy; - horizontalY = moveY + moveHeight; - horizontalHeight = -scrollRequest->dy; - } else { - horizontalY = scrollY; - horizontalHeight = scrollRequest->dy; - moveY = horizontalY + horizontalHeight; - moveHeight = scrollHeight - scrollRequest->dy; - } - verticalY = moveY; - verticalHeight = moveHeight; - horizontalX = scrollX; - horizontalWidth = scrollWidth; - - DBG("scroll diagonal: %+03d,%+03d update=%d,%d+%dx%d, " - "repaints: h=%d,%d+%dx%d v=%d,%d+%dx%d", - scrollRequest->dx, scrollRequest->dy, moveX, moveY, moveWidth, moveHeight, - verticalX, verticalY, verticalWidth, verticalHeight, - horizontalX, horizontalY, horizontalWidth, horizontalHeight); - - _ewk_view_4b_move_region - (static_cast<uint32_t*>(pixels), scrollRequest->dx, scrollRequest->dy, scrollX, scrollY, scrollWidth, scrollHeight, width); - - evas_object_image_data_update_add(smartData->backing_store, moveX, moveY, moveWidth, moveHeight); - ewk_view_repaint_add(smartData->_priv, verticalX, verticalY, verticalWidth, verticalHeight); - ewk_view_repaint_add(smartData->_priv, horizontalX, horizontalY, horizontalWidth, horizontalHeight); + int sourceX = scrollRequest->dx < 0 ? abs(scrollRequest->dx) : 0; + int sourceY = scrollRequest->dy < 0 ? abs(scrollRequest->dy) : 0; + int destinationX = scrollRequest->dx < 0 ? 0 : scrollRequest->dx; + int destinationY = scrollRequest->dy < 0 ? 0 : scrollRequest->dy; + int copyWidth = scrollWidth - abs(scrollRequest->dx); + int copyHeight = scrollHeight - abs(scrollRequest->dy); + if (scrollRequest->dx || scrollRequest->dy) { + _ewk_view_screen_move(static_cast<uint32_t*>(pixels), destinationX, destinationY, sourceX, sourceY, copyWidth, copyHeight, scrollWidth); + evas_object_image_data_update_add(smartData->backing_store, destinationX, destinationY, copyWidth, copyHeight); } + + Eina_Rectangle verticalUpdate; + verticalUpdate.x = destinationX ? 0 : copyWidth - 1; + verticalUpdate.y = 0; + verticalUpdate.w = abs(scrollRequest->dx); + verticalUpdate.h = scrollHeight; + if (verticalUpdate.w && verticalUpdate.h) + ewk_view_repaint_add(smartData->_priv, verticalUpdate.x, verticalUpdate.y, verticalUpdate.w, verticalUpdate.h); + + Eina_Rectangle horizontalUpdate; + horizontalUpdate.x = destinationX; + horizontalUpdate.y = destinationY ? 0 : copyHeight - 1; + horizontalUpdate.w = copyWidth; + horizontalUpdate.h = abs(scrollRequest->dy); + if (horizontalUpdate.w && horizontalUpdate.h) + ewk_view_repaint_add(smartData->_priv, horizontalUpdate.x, horizontalUpdate.y, horizontalUpdate.w, horizontalUpdate.h); } static Eina_Bool _ewk_view_single_smart_scrolls_process(Ewk_View_Smart_Data* smartData) @@ -554,7 +403,7 @@ Eina_Bool ewk_view_single_smart_set(Ewk_View_Smart_Class* api) static inline Evas_Smart* _ewk_view_single_smart_class_new(void) { - static Ewk_View_Smart_Class api = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("Ewk_View_Single"); + static Ewk_View_Smart_Class api = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION(ewkViewSingleName); static Evas_Smart* smart = 0; if (EINA_UNLIKELY(!smart)) { diff --git a/Source/WebKit/efl/ewk/ewk_view_tiled.cpp b/Source/WebKit/efl/ewk/ewk_view_tiled.cpp index 3101c12e9..e5b826319 100644 --- a/Source/WebKit/efl/ewk/ewk_view_tiled.cpp +++ b/Source/WebKit/efl/ewk/ewk_view_tiled.cpp @@ -262,8 +262,8 @@ static Eina_Bool _ewk_view_tiled_smart_pre_render_start(Ewk_View_Smart_Data* sma // pre-render works when two conditions are met. // zoom has been changed. // and the view has been moved more than tile size. - if (abs(previousViewX - viewX) < DEFAULT_TILE_W - && abs(previousViewY - viewY) < DEFAULT_TILE_H + if (abs(previousViewX - viewX) < defaultTileWidth + && abs(previousViewY - viewY) < defaultTileHeigth && smartData->previousView.zoom == currentViewZoom) { return false; } @@ -295,7 +295,7 @@ static Eina_Bool _ewk_view_tiled_smart_pre_render_start(Ewk_View_Smart_Data* sma // Make a base rectangle as big as possible with using maxMemory. // and then reshape the base rectangle to fit to contents. const int baseSize = static_cast<int>(sqrt(maxMemory / 4.0f)); - const float widthRate = (viewRect.w + (DEFAULT_TILE_W * 2)) / static_cast<float>(baseSize); + const float widthRate = (viewRect.w + (defaultTileWidth * 2)) / static_cast<float>(baseSize); const float heightRate = baseSize / static_cast<float>(contentHeight); const float rectRate = std::max(widthRate, heightRate); @@ -347,7 +347,7 @@ Eina_Bool ewk_view_tiled_smart_set(Ewk_View_Smart_Class* api) return false; if (EINA_UNLIKELY(!_parent_sc.sc.add)) { - _parent_sc.sc.name = "Ewk_View_Tiled"; + _parent_sc.sc.name = ewkViewTiledName; ewk_view_base_smart_set(&_parent_sc); api->sc.parent = reinterpret_cast<Evas_Smart_Class*>(&_parent_sc); } @@ -374,7 +374,7 @@ Eina_Bool ewk_view_tiled_smart_set(Ewk_View_Smart_Class* api) static inline Evas_Smart* _ewk_view_tiled_smart_class_new(void) { - static Ewk_View_Smart_Class api = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("EWK_View_Tiled"); + static Ewk_View_Smart_Class api = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION(ewkViewTiledName); static Evas_Smart* smart = 0; if (EINA_UNLIKELY(!smart)) { diff --git a/Source/WebKit/gtk/ChangeLog b/Source/WebKit/gtk/ChangeLog index 2c50a1bac..6dbea6560 100644 --- a/Source/WebKit/gtk/ChangeLog +++ b/Source/WebKit/gtk/ChangeLog @@ -1,3 +1,230 @@ +2012-02-02 Claudio Saavedra <csaavedra@igalia.com> and Martin Robinson <mrobinson@igalia.com> + + [GTK] WebKitWebView won't work in a GtkOffscreenWindow + https://bugs.webkit.org/show_bug.cgi?id=76911 + + Reviewed by Philippe Normand. + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::windowRect): Use the new widgetIsOnscreenToplevelWindow helper. + (WebKit::ChromeClient::setWindowRect): Ditto. + (WebKit::ChromeClient::unfocus): Ditto. + (WebKit::ChromeClient::runOpenPanel): Ditto. + * tests/testwebview.c: Added a test to ensure that loading a page in an offscreen window does not crash. + * webkit/webkitglobals.cpp: + (currentToplevelCallback): + * webkit/webkitwebframe.cpp: + (webkit_web_frame_print_full): + (webkit_web_frame_print): + * webkit/webkitwebview.cpp: + (webkit_web_view_focus_in_event): + (webkit_web_view_script_dialog): + +2012-02-02 Mario Sanchez Prada <msanchez@igalia.com> + + [Gtk] atk_text_get_text_at_offset() sometimes fails to provide the correct line + https://bugs.webkit.org/show_bug.cgi?id=72382 + + Reviewed by Martin Robinson. + + New unit test to ensure the right line is retrieved for the first + position of each line in a multiline preformatted portion of text. + + * tests/testatk.c: + (testWebkitAtkGetTextAtOffsetWithPreformattedText): New unit test. + (main): Add the new unit test. + +2012-02-01 Philippe Normand <pnormand@igalia.com> + + [GStreamer] FFTFrame implementation + https://bugs.webkit.org/show_bug.cgi?id=73545 + + Reviewed by Chris Rogers. + + * GNUmakefile.am: Remove libfftw compilation flags. + +2012-02-01 Philippe Normand <pnormand@igalia.com> + + [GTK] unittests/testloading crashes + https://bugs.webkit.org/show_bug.cgi?id=77544 + + Reviewed by Xan Lopez. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::dispatchDidFailLoading): Bail out + early from dispatchDidFailLoading if the error is the result of an + interrupted load. + +2012-02-01 Philippe Normand <pnormand@igalia.com> and Sergio Villar Senin <svillar@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] Improve FrameLoader signals. Resource loading + https://bugs.webkit.org/show_bug.cgi?id=49543 + + New signals: + WebKitWebFrame::resource-request-starting + WebKitWebFrame::resource-response-received + WebKitWebFrame::resource-load-finished + WebKitWebFrame::resource-content-length-received + WebKitWebFrame::resource-load-failed + WebKitWebResource::response-received + WebKitWebResource::load-failed + WebKitWebResource::load-finished + WebKitWebResource::content-length-received + WebKitWebView::resource-response-received + WebKitWebView::resource-load-finished + WebKitWebView::resource-content-length-received + WebKitWebView::resource-load-failed + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::dispatchWillSendRequest): + (WebKit::FrameLoaderClient::dispatchDidReceiveResponse): + (WebKit::FrameLoaderClient::dispatchDidReceiveContentLength): + (WebKit::FrameLoaderClient::dispatchDidFinishLoading): + (WebKit::FrameLoaderClient::dispatchDidFailLoading): + * webkit/webkitwebframe.cpp: + (webkit_web_frame_class_init): + * webkit/webkitwebresource.cpp: + (webkit_web_resource_class_init): + * webkit/webkitwebview.cpp: + (webkit_web_view_class_init): + * webkitmarshal.list: + +2012-01-23 Mario Sanchez Prada <msanchez@igalia.com> + + [GTK] Refactor GTK's accessibilitity code to be more modular + https://bugs.webkit.org/show_bug.cgi?id=76783 + + Reviewed by Martin Robinson. + + Update callers to WebKitAccessible's public functions. + + * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: + (DumpRenderTreeSupportGtk::getFocusedAccessibleElement): + (modifyAccessibilityValue): + (DumpRenderTreeSupportGtk::accessibilityHelpText): + +2012-01-22 Mario Sanchez Prada <msanchez@igalia.com> + + [GTK] Refactor GTK's accessibilitity code to be more modular + https://bugs.webkit.org/show_bug.cgi?id=76783 + + Reviewed by Martin Robinson. + + Update the include for the AccessibilityObject wrapper header. + + * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: Update include. + * webkit/webkitwebframe.cpp: Ditto. + +2012-01-22 Mario Sanchez Prada <msanchez@igalia.com> + + [GTK] ATK text-caret-moved and text-selection-changed events not being emitted + https://bugs.webkit.org/show_bug.cgi?id=76069 + + Reviewed by Martin Robinson. + + Update caret browsing related unit tests to check emissions of + 'text-caret-moved' and 'text-selection-changed' signals. + + * tests/testatk.c: + (textCaretMovedCallback): New callback for 'text-caret-moved'. + (testWebkitAtkCaretOffsets): Check emissions of 'text-caret-moved'. + (textSelectionChangedCallback): New callback for 'text-selection-changed'. + (testWebkitAtkTextSelections): Check emissions of 'text-selection-changed'. + +2012-01-18 Evan Nemerson <evan@coeus-group.com> + + [GTK] WebKit-3.0.gir does not include information about C includes or exported packages + https://bugs.webkit.org/show_bug.cgi?id=49875 + + Reviewed by Martin Robinson. + + * GNUmakefile.am: Add some information to the GIR generator to fix + Vala binding generation. + +2012-01-18 Carlos Garnacho <carlosg@gnome.org> + + [GTK] Listen to GDK_SCROLL_MASK + https://bugs.webkit.org/show_bug.cgi?id=76529 + + Set GDK_SCROLL_MASK explicitly, as WebKitWebView does handle + scroll events, scrolling currently works because GTK+ happens + to send such events to widgets listening to GDK_BUTTON_PRESS_MASK, + but this isn't the intended behavior, so it's subject to change. + + Reviewed by Martin Robinson. + + * webkit/webkitwebview.cpp: + (webkit_web_view_realize): + +2012-01-17 Martin Robinson <mrobinson@igalia.com> + + [Gtk] Input text field not repainted when value is changed + https://bugs.webkit.org/show_bug.cgi?id=76279 + + Reviewed by Gustavo Noronha Silva. + + Force pending relayouts before freezing the dirty region in a temporary. + This prevents the following code from throwing the dirty updates away + after the original paint is finished. + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::paintWebView): Remove the relayout. + (WebKit::ChromeClient::paint): Move the relayout here, before the + dirty region is frozen. + +2012-01-16 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Update NEWS and configure.ac for 1.7.4 release + https://bugs.webkit.org/show_bug.cgi?id=76375 + + Reviewed by Philippe Normand. + + * NEWS: Added release notes for 1.7.4. + +2012-01-13 Mario Sanchez Prada <msanchez@igalia.com> + + Unreviewed, rolling out r104905. + http://trac.webkit.org/changeset/104905 + https://bugs.webkit.org/show_bug.cgi?id=76267 + + This patch broke tests in the GTK 64bit Debug bot (Requested + by msanchez on #webkit). + + * tests/testatk.c: + (testWebkitAtkCaretOffsets): + (testWebkitAtkTextSelections): + +2012-01-13 Mario Sanchez Prada <msanchez@igalia.com> + + [GTK] ATK text-caret-moved and text-selection-changed events not being emitted + https://bugs.webkit.org/show_bug.cgi?id=76069 + + Reviewed by Martin Robinson. + + Update caret browsing related unit tests to check emissions of + 'text-caret-moved' and 'text-selection-changed' signals. + + * tests/testatk.c: + (textCaretMovedCallback): New callback for 'text-caret-moved'. + (testWebkitAtkCaretOffsets): Check emissions of 'text-caret-moved'. + (textSelectionChangedCallback): New callback for 'text-selection-changed'. + (testWebkitAtkTextSelections): Check emissions of 'text-selection-changed'. + +2012-01-12 Mario Sanchez Prada <msanchez@igalia.com> + + [Gtk] Removed duplicated unit test. + + The unit test testWebkitAtkGetTextAtOffsetForms is exactly the + same test case than testWebkitAtkGetTextAtOffset, so it makes no + sense to have it duplicated. + + Rubber-stamped by Martin Robinson. + + * tests/testatk.c: + (main): Removed testWebkitAtkGetTextAtOffsetForms. + 2012-01-10 Mario Sanchez Prada <msanchez@igalia.com> AX: support helpText() in DumpRenderTree diff --git a/Source/WebKit/gtk/GNUmakefile.am b/Source/WebKit/gtk/GNUmakefile.am index 0a3348685..2472212e9 100644 --- a/Source/WebKit/gtk/GNUmakefile.am +++ b/Source/WebKit/gtk/GNUmakefile.am @@ -68,7 +68,6 @@ libwebkitgtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CPPF $(GSTREAMER_CFLAGS) \ $(GTK_CFLAGS) \ $(HILDON_CFLAGS) \ - $(LIBFFTW_CFLAGS) \ $(LIBSOUP_CFLAGS) \ $(LIBXML_CFLAGS) \ $(LIBXSLT_CFLAGS) \ @@ -101,7 +100,6 @@ libwebkitgtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBA $(GTK_LIBS) \ $(HILDON_LIBS) \ $(JPEG_LIBS) \ - $(LIBFFTW_LIBS) \ $(LIBSOUP_LIBS) \ $(LIBXML_LIBS) \ $(LIBXSLT_LIBS) \ @@ -294,9 +292,11 @@ $(WEBKIT_GIRSOURCES): $(G_IR_SCANNER) $(JSCORE_GIRSOURCES) libwebkitgtk-@WEBKITG --pkg=gobject-2.0 \ --pkg=gtk+-@GTK_API_VERSION@ \ --pkg=libsoup-2.4 \ + --pkg-export=webkitgtk-@WEBKITGTK_API_VERSION@ \ --output=$@ \ --add-include-path=$(WebKit) \ --add-include-path=$(top_builddir) \ + --c-include="webkit/webkit.h" \ -I$(srcdir)/Source \ -I$(WebKit) \ -I$(GENSOURCES) \ diff --git a/Source/WebKit/gtk/NEWS b/Source/WebKit/gtk/NEWS index 54e7ceab3..94096480d 100644 --- a/Source/WebKit/gtk/NEWS +++ b/Source/WebKit/gtk/NEWS @@ -1,4 +1,29 @@ ================= +WebKitGTK+ 1.7.4 +================= + +What's new in WebKitGTK+ 1.7.4? + + - Fix a11y regression: text-inserted events lack text inserted and + current line. + - Fix scrollbars in WebKit2 that were drawn behind the window resize + grip. + - Fix a memory leak in WebKitWebSourceGStreamer. + - Slider thumb is not centered on the track with the unico theme. + - Fix context menu in WebKit2 to not dissapear right after it's shown. + - Use GtkOrientable style class in GTK+ 3 theming code. + - Change default WebSocket protocol to the latest one (hybi-17). + - Fix scrollbars size with GTK+ 3.x to follow the current theme. + - Use gdk_screen_get_monitor_workarea() when available for + screenAvailableRect(). + - Rename webkit_web_view_load_alternate_html as + webkit_web_view_replace_content in WebKit2 GTK+. + - Fix emission of ATK text-caret-moved and text-selection-changed events. + - Add methods to get/set the WebView zoom level to WebKit2 GTK+ API. + - Make WebProcess and PluginProcess use the same locale as the UI process. + - Simplify WebKit2 loader client API. + +================= WebKitGTK+ 1.7.3 ================= diff --git a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp index 29a84a6fe..137b918ad 100644 --- a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp @@ -5,6 +5,7 @@ * Copyright (C) 2008 Alp Toker <alp@atoker.com> * Copyright (C) 2008 Gustavo Noronha Silva <gns@gnome.org> * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (C) 2012 Igalia S. L. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -99,7 +100,7 @@ void ChromeClient::chromeDestroyed() FloatRect ChromeClient::windowRect() { GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView)); - if (gtk_widget_is_toplevel(window)) { + if (widgetIsOnscreenToplevelWindow(window)) { gint left, top, width, height; gtk_window_get_position(GTK_WINDOW(window), &left, &top); gtk_window_get_size(GTK_WINDOW(window), &width, &height); @@ -128,7 +129,7 @@ void ChromeClient::setWindowRect(const FloatRect& rect) return; GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView)); - if (gtk_widget_is_toplevel(window)) { + if (widgetIsOnscreenToplevelWindow(window)) { gtk_window_move(GTK_WINDOW(window), intrect.x(), intrect.y()); gtk_window_resize(GTK_WINDOW(window), intrect.width(), intrect.height()); } @@ -153,7 +154,7 @@ void ChromeClient::focus() void ChromeClient::unfocus() { GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView)); - if (gtk_widget_is_toplevel(window)) + if (widgetIsOnscreenToplevelWindow(window)) gtk_window_set_focus(GTK_WINDOW(window), NULL); } @@ -504,7 +505,6 @@ static void paintWebView(WebKitWebView* webView, Frame* frame, Region dirtyRegio Vector<IntRect> rects = dirtyRegion.rects(); coalesceRectsIfPossible(dirtyRegion.bounds(), rects); - frame->view()->updateLayoutAndStyleIfNeededRecursive(); RefPtr<cairo_t> backingStoreContext = adoptRef(cairo_create(webView->priv->backingStore->cairoSurface())); GraphicsContext gc(backingStoreContext.get()); @@ -560,6 +560,7 @@ void ChromeClient::paint(WebCore::Timer<ChromeClient>*) return; performAllPendingScrolls(); + frame->view()->updateLayoutAndStyleIfNeededRecursive(); paintWebView(m_webView, frame, m_dirtyRegion); const IntRect& rect = m_dirtyRegion.bounds(); @@ -775,8 +776,12 @@ void ChromeClient::runOpenPanel(Frame*, PassRefPtr<FileChooser> prpFileChooser) { RefPtr<FileChooser> chooser = prpFileChooser; + GtkWidget* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(m_webView)); + if (!widgetIsOnscreenToplevelWindow(toplevel)) + toplevel = 0; + GtkWidget* dialog = gtk_file_chooser_dialog_new(_("Upload File"), - GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(m_webView))), + toplevel ? GTK_WINDOW(toplevel) : 0, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, diff --git a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp index 19fc6fb6d..c59e1f792 100644 --- a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp @@ -25,7 +25,6 @@ #include "APICast.h" #include "AXObjectCache.h" #include "AccessibilityObject.h" -#include "AccessibilityObjectWrapperAtk.h" #include "AnimationController.h" #include "DOMWrapperWorld.h" #include "Document.h" @@ -60,6 +59,7 @@ #include "SecurityPolicy.h" #include "Settings.h" #include "TextIterator.h" +#include "WebKitAccessibleWrapperAtk.h" #include "WebKitDOMRangePrivate.h" #include "WorkerThread.h" #include "webkitglobalsprivate.h" @@ -484,7 +484,7 @@ AtkObject* DumpRenderTreeSupportGtk::getFocusedAccessibleElement(WebKitWebFrame* if (!wrapper) return 0; - return webkit_accessible_get_focused_element(WEBKIT_ACCESSIBLE(wrapper)); + return webkitAccessibleGetFocusedElement(WEBKIT_ACCESSIBLE(wrapper)); #else return 0; #endif @@ -761,7 +761,7 @@ static void modifyAccessibilityValue(AtkObject* axObject, bool increment) if (!axObject || !WEBKIT_IS_ACCESSIBLE(axObject)) return; - AccessibilityObject* coreObject = webkit_accessible_get_accessibility_object(WEBKIT_ACCESSIBLE(axObject)); + AccessibilityObject* coreObject = webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(axObject)); if (!coreObject) return; @@ -786,7 +786,7 @@ CString DumpRenderTreeSupportGtk::accessibilityHelpText(AtkObject* axObject) if (!axObject || !WEBKIT_IS_ACCESSIBLE(axObject)) return CString(); - AccessibilityObject* coreObject = webkit_accessible_get_accessibility_object(WEBKIT_ACCESSIBLE(axObject)); + AccessibilityObject* coreObject = webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(axObject)); if (!coreObject) return CString(); diff --git a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp index d907b2bcf..60b00e893 100644 --- a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp @@ -233,8 +233,9 @@ void FrameLoaderClient::dispatchWillSendRequest(WebCore::DocumentLoader* loader, g_free(webResource->priv->uri); webResource->priv->uri = g_strdup(request.url().string().utf8().data()); } - + g_signal_emit_by_name(webView, "resource-request-starting", m_frame, webResource, networkRequest.get(), networkResponse.get()); + g_signal_emit_by_name(m_frame, "resource-request-starting", webResource, networkRequest.get(), networkResponse.get()); // Feed any changes back into the ResourceRequest object. SoupMessage* message = webkit_network_request_get_message(networkRequest.get()); @@ -298,13 +299,22 @@ void FrameLoaderClient::frameLoaderDestroyed() delete this; } -void FrameLoaderClient::dispatchDidReceiveResponse(WebCore::DocumentLoader* loader, unsigned long, const ResourceResponse& response) +void FrameLoaderClient::dispatchDidReceiveResponse(WebCore::DocumentLoader* loader, unsigned long identifier, const ResourceResponse& response) { // Update our knowledge of request soup flags - some are only set // after the request is done. loader->request().setSoupMessageFlags(response.soupMessageFlags()); m_response = response; + + WebKitWebView* webView = getViewFromFrame(m_frame); + GOwnPtr<gchar> identifierString(toString(identifier)); + WebKitWebResource* webResource = webkit_web_view_get_resource(webView, identifierString.get()); + GRefPtr<WebKitNetworkResponse> networkResponse(adoptGRef(kitNew(response))); + + g_signal_emit_by_name(webResource, "response-received", networkResponse.get()); + g_signal_emit_by_name(m_frame, "resource-response-received", webResource, networkResponse.get()); + g_signal_emit_by_name(webView, "resource-response-received", m_frame, webResource, networkResponse.get()); } void FrameLoaderClient::dispatchDecidePolicyForResponse(FramePolicyFunction policyFunction, const ResourceResponse& response, const ResourceRequest& resourceRequest) @@ -992,7 +1002,13 @@ void FrameLoaderClient::setTitle(const StringWithDirection& title, const KURL& u void FrameLoaderClient::dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int dataLength) { - notImplemented(); + WebKitWebView* webView = getViewFromFrame(m_frame); + GOwnPtr<gchar> identifierString(toString(identifier)); + WebKitWebResource* webResource = webkit_web_view_get_resource(webView, identifierString.get()); + + g_signal_emit_by_name(webResource, "content-length-received", dataLength); + g_signal_emit_by_name(m_frame, "resource-content-length-received", webResource, dataLength); + g_signal_emit_by_name(webView, "resource-content-length-received", m_frame, webResource, dataLength); } void FrameLoaderClient::dispatchDidFinishLoading(WebCore::DocumentLoader* loader, unsigned long identifier) @@ -1021,20 +1037,31 @@ void FrameLoaderClient::dispatchDidFinishLoading(WebCore::DocumentLoader* loader webkit_web_resource_init_with_core_resource(webResource, coreResource.get()); - // FIXME: This function should notify the application that the resource - // finished loading, maybe using a load-status property in the - // WebKitWebResource object, similar to what we do for WebKitWebFrame' - // signal. - notImplemented(); + g_signal_emit_by_name(webResource, "load-finished"); + g_signal_emit_by_name(m_frame, "resource-load-finished", webResource); + g_signal_emit_by_name(webView, "resource-load-finished", m_frame, webResource); } void FrameLoaderClient::dispatchDidFailLoading(WebCore::DocumentLoader* loader, unsigned long identifier, const ResourceError& error) { static_cast<WebKit::DocumentLoader*>(loader)->decreaseLoadCount(identifier); - // FIXME: This function should notify the application that the resource failed - // loading, maybe a 'load-error' signal in the WebKitWebResource object. - notImplemented(); + WebKitWebView* webView = getViewFromFrame(m_frame); + GOwnPtr<gchar> identifierString(toString(identifier)); + WebKitWebResource* webResource = webkit_web_view_get_resource(webView, identifierString.get()); + + // A NULL WebResource means the load has been interrupted, and + // replaced by another one while this resource was being loaded. + if (!webResource) + return; + + GOwnPtr<GError> webError(g_error_new_literal(g_quark_from_string(error.domain().utf8().data()), + error.errorCode(), + error.localizedDescription().utf8().data())); + + g_signal_emit_by_name(webResource, "load-failed", webError.get()); + g_signal_emit_by_name(m_frame, "resource-load-failed", webResource, webError.get()); + g_signal_emit_by_name(webView, "resource-load-failed", m_frame, webResource, webError.get()); } bool FrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length) diff --git a/Source/WebKit/gtk/tests/testatk.c b/Source/WebKit/gtk/tests/testatk.c index e852deeed..a79010175 100644 --- a/Source/WebKit/gtk/tests/testatk.c +++ b/Source/WebKit/gtk/tests/testatk.c @@ -33,6 +33,8 @@ static const char* contents = "<html><body><p>This is a test. This is the second static const char* contentsWithNewlines = "<html><body><p>This is a test. \n\nThis\n is the second sentence. And this the third.</p></body></html>"; +static const char* contentsWithPreformattedText = "<html><body><pre>\n\t\n\tfirst line\n\tsecond line\n</pre></body></html>"; + static const char* contentsWithSpecialChars = "<html><body><p>« This is a paragraph with “special” characters inside. »</p></body></html>"; static const char* contentsInTextarea = "<html><body><textarea cols='80'>This is a test. This is the second sentence. And this the third.</textarea></body></html>"; @@ -254,6 +256,17 @@ static void runGetTextTests(AtkText* textObject) } } +static gchar* textCaretMovedResult = 0; + +static void textCaretMovedCallback(AtkText* text, gint pos, gpointer data) +{ + g_assert(ATK_IS_TEXT(text)); + + g_free(textCaretMovedResult); + AtkRole role = atk_object_get_role(ATK_OBJECT(text)); + textCaretMovedResult = g_strdup_printf("|%s|%d|", atk_role_get_name(role), pos); +} + static void testWebkitAtkCaretOffsets() { WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); @@ -267,6 +280,8 @@ static void testWebkitAtkCaretOffsets() AtkObject* header = atk_object_ref_accessible_child(object, 0); g_assert(ATK_IS_TEXT(header)); + g_signal_connect(header, "text-caret-moved", G_CALLBACK(textCaretMovedCallback), 0); + gchar* text = atk_text_get_text(ATK_TEXT(header), 0, -1); g_assert_cmpstr(text, ==, "A text header"); g_free (text); @@ -276,9 +291,12 @@ static void testWebkitAtkCaretOffsets() g_assert_cmpint(result, ==, TRUE); gint offset = atk_text_get_caret_offset(ATK_TEXT(header)); g_assert_cmpint(offset, ==, 5); + g_assert_cmpstr(textCaretMovedResult, ==, "|heading|5|"); AtkObject* paragraph = atk_object_ref_accessible_child(object, 1); g_assert(ATK_IS_TEXT(paragraph)); + g_signal_connect(paragraph, "text-caret-moved", G_CALLBACK(textCaretMovedCallback), 0); + text = atk_text_get_text(ATK_TEXT(paragraph), 0, -1); g_assert_cmpstr(text, ==, "A paragraph with a link in the middle"); g_free (text); @@ -288,16 +306,32 @@ static void testWebkitAtkCaretOffsets() g_assert_cmpint(result, ==, TRUE); offset = atk_text_get_caret_offset(ATK_TEXT(paragraph)); g_assert_cmpint(offset, ==, 5); + g_assert_cmpstr(textCaretMovedResult, ==, "|paragraph|5|"); result = atk_text_set_caret_offset(ATK_TEXT(paragraph), 20); g_assert_cmpint(result, ==, TRUE); offset = atk_text_get_caret_offset(ATK_TEXT(paragraph)); g_assert_cmpint(offset, ==, 20); + g_assert_cmpstr(textCaretMovedResult, ==, "|paragraph|20|"); result = atk_text_set_caret_offset(ATK_TEXT(paragraph), 30); g_assert_cmpint(result, ==, TRUE); offset = atk_text_get_caret_offset(ATK_TEXT(paragraph)); g_assert_cmpint(offset, ==, 30); + g_assert_cmpstr(textCaretMovedResult, ==, "|paragraph|30|"); + + AtkObject* link = atk_object_ref_accessible_child(paragraph, 0); + g_assert(ATK_IS_TEXT(link)); + text = atk_text_get_text(ATK_TEXT(link), 0, -1); + g_assert_cmpstr(text, ==, "with a link"); + g_free (text); + + result = atk_text_set_caret_offset(ATK_TEXT(link), 5); + g_assert_cmpint(result, ==, TRUE); + offset = atk_text_get_caret_offset(ATK_TEXT(link)); + g_assert_cmpint(offset, ==, 5); + /* Positions inside links are reported relative to the paragraph. */ + g_assert_cmpstr(textCaretMovedResult, ==, "|paragraph|17|"); AtkObject* list = atk_object_ref_accessible_child(object, 2); g_assert(ATK_OBJECT(list)); @@ -355,8 +389,11 @@ static void testWebkitAtkCaretOffsets() offset = atk_text_get_caret_offset(ATK_TEXT(textEntry)); g_assert_cmpint(offset, ==, 5); + g_free(textCaretMovedResult); + g_object_unref(header); g_object_unref(paragraph); + g_object_unref(link); g_object_unref(list); g_object_unref(listItem); g_object_unref(panel); @@ -642,7 +679,7 @@ static void testWebkitAtkEmbeddedObjects() g_object_unref(webView); } -static void testWebkitAtkGetTextAtOffsetForms() +static void testWebkitAtkGetTextAtOffset() { WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); g_object_ref_sink(webView); @@ -664,13 +701,13 @@ static void testWebkitAtkGetTextAtOffsetForms() g_object_unref(webView); } -static void testWebkitAtkGetTextAtOffset() +static void testWebkitAtkGetTextAtOffsetNewlines() { WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); g_object_ref_sink(webView); GtkAllocation allocation = { 0, 0, 800, 600 }; gtk_widget_size_allocate(GTK_WIDGET(webView), &allocation); - webkit_web_view_load_string(webView, contents, 0, 0, 0); + webkit_web_view_load_string(webView, contentsWithNewlines, 0, 0, 0); /* Get to the inner AtkText object. */ AtkObject* object = getWebAreaObject(webView); @@ -686,19 +723,21 @@ static void testWebkitAtkGetTextAtOffset() g_object_unref(webView); } -static void testWebkitAtkGetTextAtOffsetNewlines() +static void testWebkitAtkGetTextAtOffsetTextarea() { WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); g_object_ref_sink(webView); GtkAllocation allocation = { 0, 0, 800, 600 }; gtk_widget_size_allocate(GTK_WIDGET(webView), &allocation); - webkit_web_view_load_string(webView, contentsWithNewlines, 0, 0, 0); + webkit_web_view_load_string(webView, contentsInTextarea, 0, 0, 0); /* Get to the inner AtkText object. */ AtkObject* object = getWebAreaObject(webView); g_assert(object); object = atk_object_ref_accessible_child(object, 0); g_assert(object); + object = atk_object_ref_accessible_child(object, 0); + g_assert(object); AtkText* textObject = ATK_TEXT(object); g_assert(ATK_IS_TEXT(textObject)); @@ -708,13 +747,13 @@ static void testWebkitAtkGetTextAtOffsetNewlines() g_object_unref(webView); } -static void testWebkitAtkGetTextAtOffsetTextarea() +static void testWebkitAtkGetTextAtOffsetTextInput() { WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); g_object_ref_sink(webView); GtkAllocation allocation = { 0, 0, 800, 600 }; gtk_widget_size_allocate(GTK_WIDGET(webView), &allocation); - webkit_web_view_load_string(webView, contentsInTextarea, 0, 0, 0); + webkit_web_view_load_string(webView, contentsInTextInput, 0, 0, 0); /* Get to the inner AtkText object. */ AtkObject* object = getWebAreaObject(webView); @@ -732,27 +771,31 @@ static void testWebkitAtkGetTextAtOffsetTextarea() g_object_unref(webView); } -static void testWebkitAtkGetTextAtOffsetTextInput() +static void testWebkitAtkGetTextAtOffsetWithPreformattedText() { WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); g_object_ref_sink(webView); GtkAllocation allocation = { 0, 0, 800, 600 }; gtk_widget_size_allocate(GTK_WIDGET(webView), &allocation); - webkit_web_view_load_string(webView, contentsInTextInput, 0, 0, 0); + webkit_web_view_load_string(webView, contentsWithPreformattedText, 0, 0, 0); - /* Get to the inner AtkText object. */ AtkObject* object = getWebAreaObject(webView); g_assert(object); - object = atk_object_ref_accessible_child(object, 0); - g_assert(object); - object = atk_object_ref_accessible_child(object, 0); - g_assert(object); - AtkText* textObject = ATK_TEXT(object); - g_assert(ATK_IS_TEXT(textObject)); + AtkObject* preformattedText = atk_object_ref_accessible_child(object, 0); + g_assert(ATK_IS_OBJECT(preformattedText)); + g_assert(atk_object_get_role(preformattedText) == ATK_ROLE_PANEL); + g_assert(ATK_IS_TEXT(preformattedText)); + char* text = atk_text_get_text(ATK_TEXT(preformattedText), 0, -1); + g_assert_cmpstr(text, ==, "\t\n\tfirst line\n\tsecond line\n"); + g_free(text); - runGetTextTests(textObject); + /* Try retrieving all the lines indicating the position of the offsets at the beginning of each of them. */ + testGetTextFunction(ATK_TEXT(preformattedText), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 0, "\t\n", 0, 2); + testGetTextFunction(ATK_TEXT(preformattedText), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 2, "\tfirst line\n", 2, 14); + testGetTextFunction(ATK_TEXT(preformattedText), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 14, "\tsecond line\n", 14, 27); + g_object_unref(preformattedText); g_object_unref(webView); } @@ -1109,6 +1152,20 @@ static void testWebkitAtkTextAttributes() atk_attribute_set_free(set3); } +static gchar* textSelectionChangedResult = 0; + +static void textSelectionChangedCallback(AtkText* text, gpointer data) +{ + g_assert(ATK_IS_TEXT(text)); + + g_free(textSelectionChangedResult); + AtkRole role = atk_object_get_role(ATK_OBJECT(text)); + int startOffset = 0; + int endOffset = 0; + atk_text_get_selection(ATK_TEXT(text), 0, &startOffset, &endOffset); + textSelectionChangedResult = g_strdup_printf("|%s|%d|%d|", atk_role_get_name(role), startOffset, endOffset); +} + static void testWebkitAtkTextSelections() { WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); @@ -1122,9 +1179,11 @@ static void testWebkitAtkTextSelections() AtkText* paragraph1 = ATK_TEXT(atk_object_ref_accessible_child(object, 0)); g_assert(ATK_IS_TEXT(paragraph1)); + g_signal_connect(paragraph1, "text-selection-changed", G_CALLBACK(textSelectionChangedCallback), 0); AtkText* paragraph2 = ATK_TEXT(atk_object_ref_accessible_child(object, 1)); g_assert(ATK_IS_TEXT(paragraph2)); + g_signal_connect(paragraph2, "text-selection-changed", G_CALLBACK(textSelectionChangedCallback), 0); AtkText* link = ATK_TEXT(atk_object_ref_accessible_child(ATK_OBJECT(paragraph2), 0)); g_assert(ATK_IS_TEXT(link)); @@ -1160,11 +1219,13 @@ static void testWebkitAtkTextSelections() result = atk_text_set_selection(paragraph1, 0, 5, 25); g_assert(result); g_assert_cmpint(atk_text_get_n_selections(paragraph1), ==, 1); + g_assert_cmpstr(textSelectionChangedResult, ==, "|paragraph|5|25|"); selectedText = atk_text_get_selection(paragraph1, 0, &startOffset, &endOffset); g_assert_cmpint(startOffset, ==, 5); g_assert_cmpint(endOffset, ==, 25); g_assert_cmpstr(selectedText, ==, "agraph with plain te"); g_free (selectedText); + /* Try removing the selection from other AtkText object (should fail). */ result = atk_text_remove_selection(paragraph2, 0); g_assert(!result); @@ -1207,6 +1268,7 @@ static void testWebkitAtkTextSelections() result = atk_text_set_selection(paragraph2, 0, 27, 37); g_assert(result); g_assert_cmpint(atk_text_get_n_selections(paragraph2), ==, 1); + g_assert_cmpstr(textSelectionChangedResult, ==, "|paragraph|27|37|"); selectedText = atk_text_get_selection(paragraph2, 0, &startOffset, &endOffset); g_assert_cmpint(startOffset, ==, 27); g_assert_cmpint(endOffset, ==, 37); @@ -1256,6 +1318,8 @@ static void testWebkitAtkTextSelections() g_assert_cmpstr(selectedText, ==, "A list"); g_free (selectedText); + g_free(textSelectionChangedResult); + g_object_unref(paragraph1); g_object_unref(paragraph2); g_object_unref(list); @@ -1794,10 +1858,10 @@ int main(int argc, char** argv) g_test_add_func("/webkit/atk/documentLoadingEvents", testWebkitAtkDocumentLoadingEvents); g_test_add_func("/webkit/atk/embeddedObjects", testWebkitAtkEmbeddedObjects); g_test_add_func("/webkit/atk/getTextAtOffset", testWebkitAtkGetTextAtOffset); - g_test_add_func("/webkit/atk/getTextAtOffsetForms", testWebkitAtkGetTextAtOffsetForms); g_test_add_func("/webkit/atk/getTextAtOffsetNewlines", testWebkitAtkGetTextAtOffsetNewlines); g_test_add_func("/webkit/atk/getTextAtOffsetTextarea", testWebkitAtkGetTextAtOffsetTextarea); g_test_add_func("/webkit/atk/getTextAtOffsetTextInput", testWebkitAtkGetTextAtOffsetTextInput); + g_test_add_func("/webkit/atk/getTextAtOffsetWithPreformattedText", testWebkitAtkGetTextAtOffsetWithPreformattedText); g_test_add_func("/webkit/atk/getTextAtOffsetWithSpecialCharacters", testWebkitAtkGetTextAtOffsetWithSpecialCharacters); g_test_add_func("/webkit/atk/getTextInParagraphAndBodySimple", testWebkitAtkGetTextInParagraphAndBodySimple); g_test_add_func("/webkit/atk/getTextInParagraphAndBodyModerate", testWebkitAtkGetTextInParagraphAndBodyModerate); diff --git a/Source/WebKit/gtk/tests/testwebview.c b/Source/WebKit/gtk/tests/testwebview.c index 335ffdd22..41cf308f6 100644 --- a/Source/WebKit/gtk/tests/testwebview.c +++ b/Source/WebKit/gtk/tests/testwebview.c @@ -1,6 +1,7 @@ /* * Copyright (C) 2008 Holger Hans Peter Freyther * Copyright (C) 2009, 2010 Collabora Ltd. + * Copyright (C) 2012 Igalia S.L. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -363,6 +364,24 @@ static void test_webkit_web_view_window_features() gtk_widget_destroy(window); } +static void test_webkit_web_view_in_offscreen_window_does_not_crash() +{ + loop = g_main_loop_new(NULL, TRUE); + + GtkWidget *window = gtk_offscreen_window_new(); + GtkWidget *web_view = webkit_web_view_new(); + + gtk_container_add(GTK_CONTAINER(window), web_view); + gtk_widget_show_all(window); + g_signal_connect(web_view, "notify::load-status", G_CALLBACK(idle_quit_loop_cb), NULL); + webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web_view), base_uri); + + g_main_loop_run(loop); + + gtk_widget_destroy(window); + g_main_loop_unref(loop); +} + int main(int argc, char** argv) { SoupServer* server; @@ -390,6 +409,7 @@ int main(int argc, char** argv) g_test_add_func("/webkit/webview/destroy", test_webkit_web_view_destroy); g_test_add_func("/webkit/webview/grab_focus", test_webkit_web_view_grab_focus); g_test_add_func("/webkit/webview/window-features", test_webkit_web_view_window_features); + g_test_add_func("/webkit/webview/webview-in-offscreen-window-does-not-crash", test_webkit_web_view_in_offscreen_window_does_not_crash); return g_test_run (); } diff --git a/Source/WebKit/gtk/webkit/webkitglobals.cpp b/Source/WebKit/gtk/webkit/webkitglobals.cpp index 71433c893..3967c6376 100644 --- a/Source/WebKit/gtk/webkit/webkitglobals.cpp +++ b/Source/WebKit/gtk/webkit/webkitglobals.cpp @@ -24,6 +24,7 @@ #include "ApplicationCacheStorage.h" #include "Chrome.h" #include "FrameNetworkingContextGtk.h" +#include "GtkUtilities.h" #include "GOwnPtr.h" #include "GRefPtr.h" #include "IconDatabase.h" @@ -225,10 +226,7 @@ static GtkWidget* currentToplevelCallback(WebKitSoupAuthDialog* feature, SoupMes return NULL; GtkWidget* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(context->coreFrame()->page()->chrome()->platformPageClient())); - if (gtk_widget_is_toplevel(toplevel)) - return toplevel; - else - return NULL; + return widgetIsOnscreenToplevelWindow(toplevel) ? toplevel : 0; } /** diff --git a/Source/WebKit/gtk/webkit/webkitwebframe.cpp b/Source/WebKit/gtk/webkit/webkitwebframe.cpp index 0ccddd1cd..4de192704 100644 --- a/Source/WebKit/gtk/webkit/webkitwebframe.cpp +++ b/Source/WebKit/gtk/webkit/webkitwebframe.cpp @@ -28,7 +28,6 @@ #include "webkitwebframe.h" #include "AXObjectCache.h" -#include "AccessibilityObjectWrapperAtk.h" #include "AnimationController.h" #include "DOMObjectCache.h" #include "DocumentFragment.h" @@ -41,6 +40,7 @@ #include "FrameView.h" #include "GCController.h" #include "GraphicsContext.h" +#include "GtkUtilities.h" #include "GtkVersioning.h" #include "HTMLFrameOwnerElement.h" #include "JSDOMBinding.h" @@ -55,15 +55,18 @@ #include "ScriptController.h" #include "SubstituteData.h" #include "TextIterator.h" +#include "WebKitAccessibleWrapperAtk.h" #include "markup.h" #include "webkit/WebKitDOMRangePrivate.h" #include "webkitenumtypes.h" #include "webkitglobalsprivate.h" #include "webkitmarshal.h" +#include "webkitnetworkresponse.h" #include "webkitnetworkrequestprivate.h" #include "webkitnetworkresponseprivate.h" #include "webkitsecurityoriginprivate.h" #include "webkitwebframeprivate.h" +#include "webkitwebresource.h" #include "webkitwebview.h" #include "webkitwebviewprivate.h" #include <JavaScriptCore/APICast.h> @@ -104,6 +107,13 @@ enum { TITLE_CHANGED, HOVERING_OVER_LINK, SCROLLBARS_POLICY_CHANGED, + // Resource loading signals + RESOURCE_REQUEST_STARTING, + RESOURCE_RESPONSE_RECEIVED, + RESOURCE_LOAD_FINISHED, + RESOURCE_CONTENT_LENGTH_RECEIVED, + RESOURCE_LOAD_FAILED, + LAST_SIGNAL }; @@ -301,6 +311,124 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass) webkit_marshal_BOOLEAN__VOID, G_TYPE_BOOLEAN, 0); + + /** + * WebKitWebFrame::resource-request-starting: + * @web_frame: the #WebKitWebFrame whose load dispatched this request + * @web_resource: an empty #WebKitWebResource object + * @request: the #WebKitNetworkRequest that will be dispatched + * @response: the #WebKitNetworkResponse representing the redirect + * response, if any + * + * Emitted when a request is about to be sent. You can modify the + * request while handling this signal. You can set the URI in the + * #WebKitNetworkRequest object itself, and add/remove/replace + * headers using the #SoupMessage object it carries, if it is + * present. See webkit_network_request_get_message(). Setting the + * request URI to "about:blank" will effectively cause the request + * to load nothing, and can be used to disable the loading of + * specific resources. + * + * Notice that information about an eventual redirect is available + * in @response's #SoupMessage, not in the #SoupMessage carried by + * the @request. If @response is %NULL, then this is not a + * redirected request. + * + * The #WebKitWebResource object will be the same throughout all + * the lifetime of the resource, but the contents may change + * between signal emissions. + * + * Since: 1.7.5 + */ + webkit_web_frame_signals[RESOURCE_REQUEST_STARTING] = g_signal_new("resource-request-starting", + G_TYPE_FROM_CLASS(frameClass), + G_SIGNAL_RUN_LAST, + 0, + 0, 0, + webkit_marshal_VOID__OBJECT_OBJECT_OBJECT, + G_TYPE_NONE, 3, + WEBKIT_TYPE_WEB_RESOURCE, + WEBKIT_TYPE_NETWORK_REQUEST, + WEBKIT_TYPE_NETWORK_RESPONSE); + + /* + * WebKitWebFrame::resource-response-received + * @webFrame: the #WebKitWebFrame the response was received for + * @webResource: the #WebKitWebResource being loaded + * @response: the #WebKitNetworkResponse that was received. + * + * Emitted when the first byte of data arrives + * + * Since: 1.7.5 + */ + webkit_web_frame_signals[RESOURCE_RESPONSE_RECEIVED] = g_signal_new("resource-response-received", + G_TYPE_FROM_CLASS(frameClass), + G_SIGNAL_RUN_LAST, + 0, + 0, 0, + webkit_marshal_VOID__OBJECT_OBJECT, + G_TYPE_NONE, 2, + WEBKIT_TYPE_WEB_RESOURCE, + WEBKIT_TYPE_NETWORK_RESPONSE); + + /* + * WebKitWebFrame::resource-load-finished + * @webFrame: the #WebKitWebFrame the response was received for + * @webResource: the #WebKitWebResource being loaded + * + * Emitted when all the data for the resource was loaded. + * + * Since: 1.7.5 + */ + webkit_web_frame_signals[RESOURCE_LOAD_FINISHED] = g_signal_new("resource-load-finished", + G_TYPE_FROM_CLASS(frameClass), + G_SIGNAL_RUN_LAST, + 0, + 0, 0, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + WEBKIT_TYPE_WEB_RESOURCE); + + /* + * WebKitWebFrame::resource-content-length-received + * @webFrame: the #WebKitWebFrame the response was received for + * @webResource: the #WebKitWebResource that was loaded + * @lengthReceived: the resource data length in bytes + * + * Emitted when all the data for the resource was loaded. + * + * Since: 1.7.5 + */ + webkit_web_frame_signals[RESOURCE_CONTENT_LENGTH_RECEIVED] = g_signal_new("resource-content-length-received", + G_TYPE_FROM_CLASS(frameClass), + G_SIGNAL_RUN_LAST, + 0, + 0, 0, + webkit_marshal_VOID__OBJECT_INT, + G_TYPE_NONE, 2, + WEBKIT_TYPE_WEB_RESOURCE, + G_TYPE_INT); + + /* + * WebKitWebFrame::resource-load-failed + * @webFrame: the #WebKitWebFrame the response was received for + * @webResource: the #WebKitWebResource that was loaded + * @webError: the #GError that was triggered + * + * Invoked when a resource failed to load. + * + * Since: 1.7.5 + */ + webkit_web_frame_signals[RESOURCE_LOAD_FAILED] = g_signal_new("resource-load-failed", + G_TYPE_FROM_CLASS(frameClass), + G_SIGNAL_RUN_LAST, + 0, + 0, 0, + webkit_marshal_VOID__OBJECT_POINTER, + G_TYPE_NONE, 2, + WEBKIT_TYPE_WEB_RESOURCE, + G_TYPE_POINTER); + /* * implementations of virtual methods */ @@ -813,8 +941,7 @@ GtkPrintOperationResult webkit_web_frame_print_full(WebKitWebFrame* frame, GtkPr g_return_val_if_fail(GTK_IS_PRINT_OPERATION(operation), GTK_PRINT_OPERATION_RESULT_ERROR); GtkWidget* topLevel = gtk_widget_get_toplevel(GTK_WIDGET(webkit_web_frame_get_web_view(frame))); - - if (!gtk_widget_is_toplevel(topLevel)) + if (!widgetIsOnscreenToplevelWindow(topLevel)) topLevel = 0; Frame* coreFrame = core(frame); @@ -853,7 +980,7 @@ void webkit_web_frame_print(WebKitWebFrame* frame) if (error) { GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(priv->webView)); - GtkWidget* dialog = gtk_message_dialog_new(gtk_widget_is_toplevel(window) ? GTK_WINDOW(window) : 0, + GtkWidget* dialog = gtk_message_dialog_new(widgetIsOnscreenToplevelWindow(window) ? GTK_WINDOW(window) : 0, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, diff --git a/Source/WebKit/gtk/webkit/webkitwebresource.cpp b/Source/WebKit/gtk/webkit/webkitwebresource.cpp index 870b9c87f..f3239626b 100644 --- a/Source/WebKit/gtk/webkit/webkitwebresource.cpp +++ b/Source/WebKit/gtk/webkit/webkitwebresource.cpp @@ -27,6 +27,7 @@ #include "webkitenumtypes.h" #include "webkitglobalsprivate.h" #include "webkitmarshal.h" +#include "webkitnetworkresponse.h" #include "webkitwebresourceprivate.h" #include <glib.h> #include <glib/gi18n-lib.h> @@ -45,14 +46,25 @@ using namespace WebCore; enum { - PROP_0, + // Resource loading + RESPONSE_RECEIVED, + LOAD_FINISHED, + CONTENT_LENGTH_RECEIVED, + LOAD_FAILED, + + LAST_SIGNAL +}; +enum { + PROP_0, PROP_URI, PROP_MIME_TYPE, PROP_ENCODING, PROP_FRAME_NAME }; +static guint webkit_web_resource_signals[LAST_SIGNAL] = { 0, }; + G_DEFINE_TYPE(WebKitWebResource, webkit_web_resource, G_TYPE_OBJECT); static void webkit_web_resource_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec); @@ -101,15 +113,85 @@ static void webkit_web_resource_finalize(GObject* object) G_OBJECT_CLASS(webkit_web_resource_parent_class)->finalize(object); } -static void webkit_web_resource_class_init(WebKitWebResourceClass* klass) +static void webkit_web_resource_class_init(WebKitWebResourceClass* webResourceClass) { - GObjectClass* gobject_class = G_OBJECT_CLASS(klass); + GObjectClass* gobject_class = G_OBJECT_CLASS(webResourceClass); gobject_class->dispose = webkit_web_resource_dispose; gobject_class->finalize = webkit_web_resource_finalize; gobject_class->get_property = webkit_web_resource_get_property; gobject_class->set_property = webkit_web_resource_set_property; + /* + * WebKitWebResource::response-received + * @webResource: the #WebKitWebResource being loaded + * @response: the #WebKitNetworkResponse that was received + * + * Emitted when the first byte of data arrives + * + * Since: 1.7.5 + */ + webkit_web_resource_signals[RESPONSE_RECEIVED] = g_signal_new("response-received", + G_TYPE_FROM_CLASS(webResourceClass), + G_SIGNAL_RUN_LAST, + 0, + 0, 0, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + WEBKIT_TYPE_NETWORK_RESPONSE); + + /* + * WebKitWebResource::load-failed + * @webResource: the #WebKitWebResource that was loaded + * @webError: the #GError that was triggered + * + * Invoked when a resource failed to load + * + * Since: 1.7.5 + */ + webkit_web_resource_signals[LOAD_FAILED] = g_signal_new("load-failed", + G_TYPE_FROM_CLASS(webResourceClass), + G_SIGNAL_RUN_LAST, + 0, + 0, 0, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + G_TYPE_POINTER); + + /* + * WebKitWebResource::load-finished + * @webResource: the #WebKitWebResource being loaded + * + * Emitted when all the data for the resource was loaded + * + * Since: 1.7.5 + */ + webkit_web_resource_signals[LOAD_FINISHED] = g_signal_new("load-finished", + G_TYPE_FROM_CLASS(webResourceClass), + G_SIGNAL_RUN_LAST, + 0, + 0, 0, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /* + * WebKitWebResource::content-length-received + * @webResource: the #WebKitWebResource that was loaded + * @lengthReceived: the resource data length in bytes + * + * Emitted when all the data for the resource was loaded + * + * Since: 1.7.5 + */ + webkit_web_resource_signals[CONTENT_LENGTH_RECEIVED] = g_signal_new("content-length-received", + G_TYPE_FROM_CLASS(webResourceClass), + G_SIGNAL_RUN_LAST, + 0, + 0, 0, + g_cclosure_marshal_VOID__INT, + G_TYPE_NONE, 1, + G_TYPE_INT); + /** * WebKitWebResource:uri: * diff --git a/Source/WebKit/gtk/webkit/webkitwebview.cpp b/Source/WebKit/gtk/webkit/webkitwebview.cpp index 0868a4a22..ac6158b44 100644 --- a/Source/WebKit/gtk/webkit/webkitwebview.cpp +++ b/Source/WebKit/gtk/webkit/webkitwebview.cpp @@ -208,6 +208,10 @@ enum { EDITING_ENDED, VIEWPORT_ATTRIBUTES_RECOMPUTE_REQUESTED, VIEWPORT_ATTRIBUTES_CHANGED, + RESOURCE_RESPONSE_RECEIVED, + RESOURCE_LOAD_FINISHED, + RESOURCE_CONTENT_LENGTH_RECEIVED, + RESOURCE_LOAD_FAILED, LAST_SIGNAL }; @@ -900,7 +904,7 @@ static gboolean webkit_web_view_focus_in_event(GtkWidget* widget, GdkEventFocus* // TODO: Improve focus handling as suggested in // http://bugs.webkit.org/show_bug.cgi?id=16910 GtkWidget* toplevel = gtk_widget_get_toplevel(widget); - if (gtk_widget_is_toplevel(toplevel) && gtk_window_has_toplevel_focus(GTK_WINDOW(toplevel))) { + if (widgetIsOnscreenToplevelWindow(toplevel) && gtk_window_has_toplevel_focus(GTK_WINDOW(toplevel))) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); FocusController* focusController = core(webView)->focusController(); @@ -961,6 +965,7 @@ static void webkit_web_view_realize(GtkWidget* widget) | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + | GDK_SCROLL_MASK | GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK @@ -1101,7 +1106,12 @@ static gboolean webkit_web_view_script_dialog(WebKitWebView* webView, WebKitWebF } window = gtk_widget_get_toplevel(GTK_WIDGET(webView)); - dialog = gtk_message_dialog_new(gtk_widget_is_toplevel(window) ? GTK_WINDOW(window) : 0, GTK_DIALOG_DESTROY_WITH_PARENT, messageType, buttons, "%s", message); + dialog = gtk_message_dialog_new(widgetIsOnscreenToplevelWindow(window) ? GTK_WINDOW(window) : 0, + GTK_DIALOG_DESTROY_WITH_PARENT, + messageType, + buttons, + "%s", + message); gchar* title = g_strconcat("JavaScript - ", webkit_web_frame_get_uri(frame), NULL); gtk_window_set_title(GTK_WINDOW(dialog), title); g_free(title); @@ -2607,6 +2617,93 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) WEBKIT_TYPE_VIEWPORT_ATTRIBUTES); /* + * WebKitWebView::resource-response-received + * @webView: the object which received the signal + * @webFrame: the #WebKitWebFrame the response was received for + * @webResource: the #WebKitWebResource being loaded + * @response: the #WebKitNetworkResponse that was received + * + * Emitted when the first byte of data arrives + * + * Since: 1.7.5 + */ + webkit_web_view_signals[RESOURCE_RESPONSE_RECEIVED] = g_signal_new("resource-response-received", + G_TYPE_FROM_CLASS(webViewClass), + G_SIGNAL_RUN_LAST, + 0, + 0, 0, + webkit_marshal_VOID__OBJECT_OBJECT_OBJECT, + G_TYPE_NONE, 3, + WEBKIT_TYPE_WEB_FRAME, + WEBKIT_TYPE_WEB_RESOURCE, + WEBKIT_TYPE_NETWORK_RESPONSE); + + /* + * WebKitWebView::resource-load-finished + * @webView: the object which received the signal + * @webFrame: the #WebKitWebFrame the response was received for + * @webResource: the #WebKitWebResource that was loaded + * + * Emitted when all the data for the resource was loaded + * + * Since: 1.7.5 + */ + webkit_web_view_signals[RESOURCE_LOAD_FINISHED] = g_signal_new("resource-load-finished", + G_TYPE_FROM_CLASS(webViewClass), + G_SIGNAL_RUN_LAST, + 0, + 0, 0, + webkit_marshal_VOID__OBJECT_OBJECT, + G_TYPE_NONE, 2, + WEBKIT_TYPE_WEB_FRAME, + WEBKIT_TYPE_WEB_RESOURCE); + + /* + * WebKitWebView::resource-content-length-received + * @webView: the object which received the signal + * @webFrame: the #WebKitWebFrame the response was received for + * @webResource: the #WebKitWebResource that was loaded + * @lengthReceived: the resource data length in bytes + * + * Emitted when the HTTP Content-Length response header has been + * received and parsed successfully. + * + * Since: 1.7.5 + */ + webkit_web_view_signals[RESOURCE_CONTENT_LENGTH_RECEIVED] = g_signal_new("resource-content-length-received", + G_TYPE_FROM_CLASS(webViewClass), + G_SIGNAL_RUN_LAST, + 0, + 0, 0, + webkit_marshal_VOID__OBJECT_OBJECT_INT, + G_TYPE_NONE, 3, + WEBKIT_TYPE_WEB_FRAME, + WEBKIT_TYPE_WEB_RESOURCE, + G_TYPE_INT); + + /* + * WebKitWebView::resource-load-failed + * @webView: the object which received the signal + * @webFrame: the #WebKitWebFrame the response was received for + * @webResource: the #WebKitWebResource that was loaded + * @webError: the #GError that was triggered + * + * Invoked when a resource failed to load + * + * Since: 1.7.5 + */ + webkit_web_view_signals[RESOURCE_LOAD_FAILED] = g_signal_new("resource-load-failed", + G_TYPE_FROM_CLASS(webViewClass), + G_SIGNAL_RUN_LAST, + 0, + 0, 0, + webkit_marshal_VOID__OBJECT_OBJECT_POINTER, + G_TYPE_NONE, 3, + WEBKIT_TYPE_WEB_FRAME, + WEBKIT_TYPE_WEB_RESOURCE, + G_TYPE_POINTER); + + /* * implementations of virtual methods */ webViewClass->create_web_view = webkit_web_view_real_create_web_view; diff --git a/Source/WebKit/gtk/webkitmarshal.list b/Source/WebKit/gtk/webkitmarshal.list index 5372c5763..b7890825d 100644 --- a/Source/WebKit/gtk/webkitmarshal.list +++ b/Source/WebKit/gtk/webkitmarshal.list @@ -17,9 +17,13 @@ OBJECT:OBJECT OBJECT:STRING,STRING,POINTER OBJECT:VOID VOID:OBJECT,OBJECT +VOID:OBJECT,OBJECT,INT +VOID:OBJECT,OBJECT,OBJECT +VOID:OBJECT,OBJECT,POINTER VOID:OBJECT,OBJECT,OBJECT,OBJECT VOID:OBJECT,POINTER,POINTER +VOID:OBJECT,INT +VOID:OBJECT,POINTER VOID:OBJECT,STRING VOID:STRING VOID:STRING,STRING - diff --git a/Source/WebKit/mac/Carbon/CarbonWindowAdapter.mm b/Source/WebKit/mac/Carbon/CarbonWindowAdapter.mm index 5b036fdae..38f1347a3 100644 --- a/Source/WebKit/mac/Carbon/CarbonWindowAdapter.mm +++ b/Source/WebKit/mac/Carbon/CarbonWindowAdapter.mm @@ -73,6 +73,7 @@ #import <assert.h> #import <WebCore/WebCoreObjCExtras.h> +#import <WebCore/RunLoop.h> #import <runtime/InitializeThreading.h> #import <wtf/MainThread.h> @@ -271,6 +272,7 @@ static OSStatus NSCarbonWindowHandleEvent(EventHandlerCallRef inEventHandlerCall { JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); WebCoreObjCFinalizeOnMainThread(self); } diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index c5e65fa52..9e3f1563b 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,359 @@ +2012-02-01 Dan Bernstein <mitz@apple.com> + + WebKit/mac part of <rdar://problem/10442663> Paginated display does not respect page-break-{before,after} + https://bugs.webkit.org/show_bug.cgi?id=77505 + + Reviewed by Darin Adler. + + * WebView/WebView.mm: + (-[WebView _setPaginationBehavesLikeColumns:]): Added this setter. + (-[WebView _paginationBehavesLikeColumns]): Added this getter. + * WebView/WebViewPrivate.h: + +2012-01-25 Eric Seidel <eric@webkit.org> + + HTMLIsIndexElement should not expose HTMLInputElement properties + https://bugs.webkit.org/show_bug.cgi?id=76095 + + Reviewed by Adam Barth. + + * MigrateHeaders.make: + +2012-01-31 Pablo Flouret <pablof@motorola.com> + + Fix compilation errors on build-webkit --debug --no-workers on mac. + https://bugs.webkit.org/show_bug.cgi?id=75869 + + Reviewed by Adam Barth. + + * Workers/WebWorkersPrivate.mm: + (+[WebWorkersPrivate workerThreadCount]): + +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. + + toUserSpace() and toDeviceSpace() now take a parameter for the + deviceScaleFactor. + * WebCoreSupport/WebChromeClient.mm: + (windowScaleFactor): + (WebChromeClient::setWindowRect): + (WebChromeClient::windowRect): + +2012-01-25 Mark Rowe <mrowe@apple.com> + + Build in to an alternate location when USE_STAGING_INSTALL_PATH is set. + + <rdar://problem/10609417> Adopt USE_STAGING_INSTALL_PATH + + Reviewed by David Kilzer. + + * Configurations/WebKit.xcconfig: Define NORMAL_WEBKIT_FRAMEWORKS_DIR, which contains + the path where WebKit is normally installed. Update WEBKIT_FRAMEWORKS_DIR to point to + the staged frameworks directory when USE_STAGING_INSTALL_PATH is set. Define + NORMAL_PRODUCTION_FRAMEWORKS_DIR, which contains the path where our public frameworks + are normally installed. Update PRODUCTION_FRAMEWORKS_DIR to point to the staged frameworks + directory when USE_STAGING_INSTALL_PATH is set. Always set the framework's install name + based on the normal framework location. This prevents an incorrect install name from being + used when installing in to the staged frameworks directory. Look for our other frameworks + in the staged frameworks directory when USE_STAGING_INSTALL_PATH is set. Update + WEBCORE_PRIVATE_HEADERS_DIR to find WebCore at the top level of the staged frameworks + directory when USE_STAGING_INSTALL_PATH is set, rather than finding it embedded inside of + WebKit.framework. + +2012-01-25 Eric Seidel <eric@webkit.org> + + HTMLIsIndexElement should not expose HTMLInputElement properties + https://bugs.webkit.org/show_bug.cgi?id=76095 + + Reviewed by Adam Barth. + + * MigrateHeaders.make: + +2012-01-25 Hajime Morita <morrita@google.com> + + ENABLE_SHADOW_DOM should be available via build-webkit --shadow-dom + https://bugs.webkit.org/show_bug.cgi?id=76863 + + Reviewed by Dimitri Glazkov. + + Added a feature flag. + + * Configurations/FeatureDefines.xcconfig: + +2012-01-25 Enrica Casucci <enrica@apple.com> + + WebView should implement typingAttributes methods to work correctly with the Inspector bar in Mail. + https://bugs.webkit.org/show_bug.cgi?id=76951 + <rdar://problem/9325158> + + Reviewed by Alexey Proskuryakov. + + * WebView/WebHTMLView.mm: Removed typingAttributes implementation. + * WebView/WebView.mm: + (-[WebView typingAttributes]): Added. + +2012-01-24 Enrica Casucci <enrica@apple.com> + + WebHTMLView should implement typingAttributes methods to work correctly with the Inspector bar in Mail. + https://bugs.webkit.org/show_bug.cgi?id=76951 + <rdar://problem/9325158> + + The Inspector bar calls the typingAttributes methods on the clients that support it + to retrieve the set of attributes representing the style at the selection and uses + this information to update the state of the B, I and U buttons. + If this method is not supported, it defaults to the attributes of the previous + character position, reporting an incorrect state. + This occurs only when we have a caret selection. + + Reviewed by Alexey Proskuryakov. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView _styleForAttributeChange:]): Removed dead code. + (-[WebHTMLView _updateFontPanel]): Removed comment that doesn't apply anymore. + (-[WebHTMLView typingAttributes]): Added. + +2012-01-24 Benjamin Poulain <bpoulain@apple.com> + + pageCacheSupportsPlugins should default to true on WebKit1 + https://bugs.webkit.org/show_bug.cgi?id=76891 + + Reviewed by Joseph Pecoraro. + + The default was left out of r102619 by accident. + + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + +2012-01-23 Geoffrey Garen <ggaren@apple.com> + + JSValue::toString() should return a JSString* instead of a UString + https://bugs.webkit.org/show_bug.cgi?id=76861 + + Reviewed by Gavin Barraclough. + + Mechanical changes to call value() after calling toString(), to + convert from "JS string" (JSString*) to "C++ string" (UString), since + toString() no longer returns a "C++ string". + + * Plugins/Hosted/NetscapePluginInstanceProxy.mm: + (WebKit::NetscapePluginInstanceProxy::addValueToArray): + * WebView/WebFrame.mm: + (-[WebFrame _stringByEvaluatingJavaScriptFromString:forceUserGesture:]): + (-[WebFrame _stringByEvaluatingJavaScriptFromString:withGlobalObject:inScriptWorld:]): + +2012-01-20 Sam Weinig <sam@webkit.org> + + Make WebCore RunLoop work for WebKit1 + https://bugs.webkit.org/show_bug.cgi?id=76739 + + Reviewed by Anders Carlsson. + + * Carbon/CarbonWindowAdapter.mm: + (+[CarbonWindowAdapter initialize]): + * History/WebBackForwardList.mm: + (+[WebBackForwardList initialize]): + * History/WebHistoryItem.mm: + (+[WebHistoryItem initialize]): + * Misc/WebElementDictionary.mm: + (+[WebElementDictionary initialize]): + * Misc/WebIconDatabase.mm: + (+[WebIconDatabase initialize]): + * Plugins/Hosted/WebHostedNetscapePluginView.mm: + (+[WebHostedNetscapePluginView initialize]): + * Plugins/WebBaseNetscapePluginView.mm: + * Plugins/WebBasePluginPackage.mm: + * Plugins/WebNetscapePluginView.mm: + (+[WebNetscapePluginView initialize]): + * WebCoreSupport/WebEditorClient.mm: + (+[WebUndoStep initialize]): + * WebCoreSupport/WebFrameLoaderClient.mm: + * WebView/WebArchive.mm: + (+[WebArchivePrivate initialize]): + * WebView/WebDataSource.mm: + (+[WebDataSourcePrivate initialize]): + * WebView/WebHTMLView.mm: + (+[WebHTMLViewPrivate initialize]): + (+[WebHTMLView initialize]): + * WebView/WebResource.mm: + (+[WebResourcePrivate initialize]): + * WebView/WebTextIterator.mm: + (+[WebTextIteratorPrivate initialize]): + * WebView/WebView.mm: + (+[WebView initialize]): + * WebView/WebViewData.mm: + (+[WebViewPrivate initialize]): + Initialized the main run loop in addition to other initialization. + +2012-01-20 Simon Fraser <simon.fraser@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=76444 + + #if ENABLE(CSS_SHADERS) cannot appear in framework headers. + This breaks builds. + + * WebView/WebPreferences.mm: + * WebView/WebPreferencesPrivate.h: + +2012-01-20 Alexandru Chiculita <achicu@adobe.com> + + CSS Shaders: Add a Settings flag to enable/disable CSS Shaders at runtime + https://bugs.webkit.org/show_bug.cgi?id=76444 + + Added private WebPreference property called "WebKitCSSCustomFilterEnabled". + + Reviewed by Nikolas Zimmermann. + + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + (-[WebPreferences cssCustomFilterEnabled]): + (-[WebPreferences setCSSCustomFilterEnabled:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChanged:]): + +2012-01-17 Enrica Casucci <enrica@apple.com> + + Missing NSForegroundColorAttributeName should be treated as black instead of transparent. + https://bugs.webkit.org/show_bug.cgi?id=76490 + <rdar://problem/9460733> + + Starting with Lion, there is no more NSForegroundColor attribute in the dictionary + if the color matches the default (solid black). + The fix consists in treating the lack of color as solid black instead of transparent as + we did before. + + Added a TestWebKitAPI test. + + Reviewed by Darin Adler and Dan Bernstein. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView _styleForAttributeChange:]): + +2012-01-17 Matthew Delaney <mdelaney@apple.com> + + On post-Lion releases, preserve the Lion behavior where WebKit explicitly calls -setGeometryFlipped on the hosting layer for applications that were linked on Lion or earlier. + <rdar://problem/10692025> + + Reviewed by Simon Fraser. + + * WebCoreSupport/WebSystemInterface.mm: Init newly added function. + * WebView/WebHTMLView.mm: Added case for post-Lion builds that calls -setGeometryFlipped if the app is linked on or before Lion. + +2012-01-17 Enrica Casucci <enrica@apple.com> + + REGRESSION (r101413): Correction panel overlaps misspelled text. + https://bugs.webkit.org/show_bug.cgi?id=74589 + <rdar://problem/10585115> + + When converting the rectangle from the root view, we need + to take into account the height of the rectangle. + + Reviewed by Anders Carlsson. + + * WebView/WebView.mm: + (-[WebView _convertRectFromRootView:]): + +2012-01-16 Simon Fraser <simon.fraser@apple.com> + + <rdar://problem/10703228> ASSERTION FAILED: Uncaught exception - Cannot lock focus on image <NSImage 0x1206572a0 Size={0, 0} Reps=( )>, because it is size zero loading techcrunch.com + + Reviewed by Anders Carlsson. + + Avoid trying to create image snapshots for zero-sized plugins, because + it causes -[NSView lockFocus] to throw an exception. + + * Plugins/WebBaseNetscapePluginView.mm: + (-[WebBaseNetscapePluginView cacheSnapshot]): + +2012-01-16 Alexey Proskuryakov <ap@apple.com> + + A follow-up fix for: + A warning is logged to console when typing a bare "/" in Safari address bar + https://bugs.webkit.org/show_bug.cgi?id=76236 + + <rdar://problem/10702986> + + Reviewed by John Sullivan. + + * Misc/WebNSURLExtras.mm: (+[NSURL _web_URLWithData:relativeToURL:]): It's OK to have a + path when there is a base URL. + +2012-01-16 Jon Lee <jonlee@apple.com> + + Build fix for r105086. + + * Configurations/FeatureDefines.xcconfig: + +2012-01-12 Alexey Proskuryakov <ap@apple.com> + + A warning is logged to console when typing a bare "/" in Safari address bar + https://bugs.webkit.org/show_bug.cgi?id=76236 + + Reviewed by John Sullivan. + + * Misc/WebNSURLExtras.mm: (+[NSURL _web_URLWithData:relativeToURL:]): Bail out early for paths. + +2012-01-16 Pablo Flouret <pablof@motorola.com> + + Fix compilation errors on build-webkit --debug --no-svg --no-svg-fonts --no-svg-dom-objc-bindings on mac. + https://bugs.webkit.org/show_bug.cgi?id=75865 + + Reviewed by Hajime Morita. + + * WebView/WebFrame.mm: + (-[WebFrame _pauseSVGAnimation:onSMILNode:atTime:]): + +2012-01-15 Pablo Flouret <pablof@motorola.com> + + Fix compilation errors on build-webkit --debug --no-video on mac. + https://bugs.webkit.org/show_bug.cgi?id=75867 + + Reviewed by Philippe Normand. + + - WebChromeClient::fullScreenRendererChanged() declaration wrongly guarded + by VIDEO feature instead of FULLSCREEN_API. + - _isAnyMoviePlaying implementation depends on VIDEO. + + * WebCoreSupport/WebChromeClient.h: + * WebView/WebFullScreenController.mm: + (-[WebFullScreenController _isAnyMoviePlaying]): + +2012-01-11 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=75904 + WebKit 1: Scrollbar uiStateTransitionProgress requires tracking the mouse all + the time + -and corresponding- + <rdar://problem/10498816> + + Reviewed by Darin Adler. + + New ivar trackingAreaForNonKeyWindow stores our NSTrackingArea whenever we + have one. + * WebView/WebHTMLView.mm: + (-[WebHTMLViewPrivate dealloc]): + (-[WebHTMLViewPrivate clear]): + + When we know that mouse movements won't affect anything other than + scrollbars, call our new function passMouseMovedEventToScrollbars(), + otherwise we'll call the old mouseMoved(). + (mouseEventIsPartOfClickOrDrag): + (-[WebHTMLView _updateMouseoverWithEvent:]): + + Make sure not to remove the mouse observer when there are legacy scrollbars. + (-[WebHTMLView removeMouseMovedObserver]): + + Set up a tracking area when the window is not key to ensure that the WebView + gets the relevant events. Remove it when the window is key again so that we + rely on the existing mechanism. + (-[WebHTMLView windowDidBecomeKey:]): + (-[WebHTMLView windowDidResignKey:]): + 2012-01-10 Dan Bernstein <mitz@apple.com> Made -[WebHistoryItem copyWithZone:] allocate an object of the same class as the receiver. diff --git a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig index 0dbc8bd15..9be349394 100644 --- a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -106,11 +106,13 @@ ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG; ENABLE_QUOTA = ; ENABLE_REGISTER_PROTOCOL_HANDLER = ; ENABLE_REQUEST_ANIMATION_FRAME = ENABLE_REQUEST_ANIMATION_FRAME; +ENABLE_SHADOW_DOM = ; ENABLE_SHARED_WORKERS = ENABLE_SHARED_WORKERS; ENABLE_SQL_DATABASE = ENABLE_SQL_DATABASE; ENABLE_STYLE_SCOPED = ; ENABLE_SVG = ENABLE_SVG; ENABLE_SVG_FONTS = ENABLE_SVG_FONTS; +ENABLE_TEXT_NOTIFICATIONS_ONLY = ENABLE_TEXT_NOTIFICATIONS_ONLY; ENABLE_TOUCH_ICON_LOADING = ; ENABLE_VIDEO = ENABLE_VIDEO; ENABLE_VIDEO_TRACK = ENABLE_VIDEO_TRACK; @@ -121,4 +123,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_SHADERS) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_SHADERS) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebKit/mac/Configurations/Version.xcconfig b/Source/WebKit/mac/Configurations/Version.xcconfig index 42e245604..39d847570 100644 --- a/Source/WebKit/mac/Configurations/Version.xcconfig +++ b/Source/WebKit/mac/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 535; -MINOR_VERSION = 16; +MINOR_VERSION = 19; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebKit/mac/Configurations/WebKit.xcconfig b/Source/WebKit/mac/Configurations/WebKit.xcconfig index 364aed9a9..7e0ac2979 100644 --- a/Source/WebKit/mac/Configurations/WebKit.xcconfig +++ b/Source/WebKit/mac/Configurations/WebKit.xcconfig @@ -44,14 +44,18 @@ FRAMEWORK_SEARCH_PATHS_iphoneos_Debug = $(BUILT_PRODUCTS_DIR) $(PRODUCTION_FRAME FRAMEWORK_SEARCH_PATHS_iphoneos_Release = $(FRAMEWORK_SEARCH_PATHS_iphoneos_Debug); FRAMEWORK_SEARCH_PATHS_iphoneos_Production = $(PRODUCTION_FRAMEWORKS_DIR); FRAMEWORK_SEARCH_PATHS_iphonesimulator = $(FRAMEWORK_SEARCH_PATHS_iphoneos_$(CONFIGURATION)); -FRAMEWORK_SEARCH_PATHS_macosx = $(UMBRELLA_FRAMEWORKS_DIR) $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks $(FRAMEWORK_SEARCH_PATHS); +FRAMEWORK_SEARCH_PATHS_macosx = $(STAGED_FRAMEWORKS_SEARCH_PATH) $(UMBRELLA_FRAMEWORKS_DIR) $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks $(FRAMEWORK_SEARCH_PATHS); + +STAGED_FRAMEWORKS_SEARCH_PATH = $(STAGED_FRAMEWORKS_SEARCH_PATH_$(USE_STAGING_INSTALL_PATH)); +STAGED_FRAMEWORKS_SEARCH_PATH_YES = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/StagedFrameworks/Safari; GCC_PREFIX_HEADER = mac/WebKitPrefix.h; GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(FEATURE_DEFINES) FRAMEWORK_NAME=WebKit WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST $(GCC_PREPROCESSOR_DEFINITIONS); HEADER_SEARCH_PATHS = $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(WEBCORE_PRIVATE_HEADERS_DIR)/icu $(WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH) "${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit" $(HEADER_SEARCH_PATHS); INFOPLIST_FILE = mac/Info.plist; INSTALL_PATH = $(INSTALL_PATH_$(REAL_PLATFORM_NAME)); -INSTALL_PATH_macosx = $(SYSTEM_LIBRARY_DIR)/Frameworks; +INSTALL_PATH_macosx = $(WEBKIT_FRAMEWORKS_DIR); +DYLIB_INSTALL_NAME_BASE = $(NORMAL_WEBKIT_FRAMEWORKS_DIR); INSTALLHDRS_COPY_PHASE = YES; INSTALLHDRS_SCRIPT_PHASE = YES; PRODUCT_NAME = WebKit; @@ -65,10 +69,32 @@ OTHER_LDFLAGS_macosx_1070 = -Xlinker -objc_gc_compaction; OTHER_LDFLAGS_macosx_1080 = $(OTHER_LDFLAGS_macosx_1070); OTHER_LDFLAGS_macosx_1090 = $(OTHER_LDFLAGS_macosx_1070); +NORMAL_WEBKIT_FRAMEWORKS_DIR = $(NORMAL_WEBKIT_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME)); +NORMAL_WEBKIT_FRAMEWORKS_DIR_iphoneos = $(PRODUCTION_FRAMEWORKS_DIR); +NORMAL_WEBKIT_FRAMEWORKS_DIR_iphonesimulator = $(PRODUCTION_FRAMEWORKS_DIR); +NORMAL_WEBKIT_FRAMEWORKS_DIR_macosx = $(SYSTEM_LIBRARY_DIR)/Frameworks; + +WEBKIT_FRAMEWORKS_DIR = $(WEBKIT_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME)); +WEBKIT_FRAMEWORKS_DIR_iphoneos = $(NORMAL_WEBKIT_FRAMEWORKS_DIR_iphoneos); +WEBKIT_FRAMEWORKS_DIR_iphonesimulator = $(WEBKIT_FRAMEWORKS_DIR_iphoneos); +WEBKIT_FRAMEWORKS_DIR_macosx = $(WEBKIT_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_$(USE_STAGING_INSTALL_PATH)); +WEBKIT_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_ = $(WEBKIT_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_NO); +WEBKIT_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_NO = $(NORMAL_WEBKIT_FRAMEWORKS_DIR); +WEBKIT_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_YES = $(SYSTEM_LIBRARY_DIR)/StagedFrameworks/Safari; + +NORMAL_PRODUCTION_FRAMEWORKS_DIR = $(NORMAL_PRODUCTION_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME)); +NORMAL_PRODUCTION_FRAMEWORKS_DIR_iphoneos = $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks; +NORMAL_PRODUCTION_FRAMEWORKS_DIR_iphonesimulator = $(PRODUCTION_FRAMEWORKS_DIR_iphoneos); +NORMAL_PRODUCTION_FRAMEWORKS_DIR_macosx = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks; + PRODUCTION_FRAMEWORKS_DIR = $(PRODUCTION_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME)); -PRODUCTION_FRAMEWORKS_DIR_iphoneos = $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks; +PRODUCTION_FRAMEWORKS_DIR_iphoneos = $(NORMAL_PRODUCTION_FRAMEWORKS_DIR_iphoneos); PRODUCTION_FRAMEWORKS_DIR_iphonesimulator = $(PRODUCTION_FRAMEWORKS_DIR_iphoneos); -PRODUCTION_FRAMEWORKS_DIR_macosx = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks; +PRODUCTION_FRAMEWORKS_DIR_macosx = $(PRODUCTION_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_$(USE_STAGING_INSTALL_PATH)); +PRODUCTION_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_ = $(PRODUCTION_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_NO); +PRODUCTION_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_NO = $(NORMAL_PRODUCTION_FRAMEWORKS_DIR_macosx); +PRODUCTION_FRAMEWORKS_DIR_macosx_USE_STAGING_INSTALL_PATH_YES = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/StagedFrameworks/Safari; + PRODUCTION_ROOT = $(PRODUCTION_ROOT_$(REAL_PLATORM_NAME)); PRODUCTION_ROOT_iphoneos = $(SDKROOT); @@ -81,7 +107,10 @@ WEBCORE_PRIVATE_HEADERS_DIR_Debug = $(WEBCORE_PRIVATE_HEADERS_engineering); WEBCORE_PRIVATE_HEADERS_DIR_Production = $(WEBCORE_PRIVATE_HEADERS_DIR_Production_$(REAL_PLATFORM_NAME)); WEBCORE_PRIVATE_HEADERS_DIR_Production_iphoneos = $(PRODUCTION_FRAMEWORKS_DIR)/WebCore.framework/PrivateHeaders; WEBCORE_PRIVATE_HEADERS_DIR_Production_iphonesimulator = $(WEBCORE_PRIVATE_HEADERS_DIR_Production_iphoneos); -WEBCORE_PRIVATE_HEADERS_DIR_Production_macosx = $(UMBRELLA_FRAMEWORKS_DIR)/WebCore.framework/PrivateHeaders; +WEBCORE_PRIVATE_HEADERS_DIR_Production_macosx = $(WEBCORE_PRIVATE_HEADERS_DIR_Production_macosx_USE_STAGING_INSTALL_PATH_$(USE_STAGING_INSTALL_PATH)); +WEBCORE_PRIVATE_HEADERS_DIR_Production_macosx_USE_STAGING_INSTALL_PATH_ = $(WEBCORE_PRIVATE_HEADERS_DIR_Production_macosx_USE_STAGING_INSTALL_PATH_NO); +WEBCORE_PRIVATE_HEADERS_DIR_Production_macosx_USE_STAGING_INSTALL_PATH_NO = $(UMBRELLA_FRAMEWORKS_DIR)/WebCore.framework/PrivateHeaders; +WEBCORE_PRIVATE_HEADERS_DIR_Production_macosx_USE_STAGING_INSTALL_PATH_YES = $(PRODUCTION_FRAMEWORKS_DIR)/WebCore.framework/PrivateHeaders; WEBCORE_PRIVATE_HEADERS_engineering = $(BUILT_PRODUCTS_DIR)/WebCore.framework/PrivateHeaders; WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH = $(WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH_$(CONFIGURATION)); diff --git a/Source/WebKit/mac/History/WebBackForwardList.mm b/Source/WebKit/mac/History/WebBackForwardList.mm index a0a073d79..64b1785ef 100644 --- a/Source/WebKit/mac/History/WebBackForwardList.mm +++ b/Source/WebKit/mac/History/WebBackForwardList.mm @@ -42,6 +42,7 @@ #import <WebCore/HistoryItem.h> #import <WebCore/Page.h> #import <WebCore/PageCache.h> +#import <WebCore/RunLoop.h> #import <WebCore/Settings.h> #import <WebCore/ThreadCheck.h> #import <WebCore/WebCoreObjCExtras.h> @@ -104,6 +105,7 @@ WebBackForwardList *kit(BackForwardListImpl* backForwardList) { JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); WebCoreObjCFinalizeOnMainThread(self); } diff --git a/Source/WebKit/mac/History/WebHistoryItem.mm b/Source/WebKit/mac/History/WebHistoryItem.mm index 653b1afae..de708c95c 100644 --- a/Source/WebKit/mac/History/WebHistoryItem.mm +++ b/Source/WebKit/mac/History/WebHistoryItem.mm @@ -48,6 +48,7 @@ #import <WebCore/KURL.h> #import <WebCore/PageCache.h> #import <WebCore/PlatformString.h> +#import <WebCore/RunLoop.h> #import <WebCore/ThreadCheck.h> #import <WebCore/WebCoreObjCExtras.h> #import <runtime/InitializeThreading.h> @@ -97,6 +98,7 @@ void WKNotifyHistoryItemChanged(HistoryItem*) { JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); WebCoreObjCFinalizeOnMainThread(self); } diff --git a/Source/WebKit/mac/MigrateHeaders.make b/Source/WebKit/mac/MigrateHeaders.make index 1e799d4fa..0f8554202 100644 --- a/Source/WebKit/mac/MigrateHeaders.make +++ b/Source/WebKit/mac/MigrateHeaders.make @@ -112,7 +112,6 @@ all : \ $(PUBLIC_HEADERS_DIR)/DOMHTMLInputElement.h \ $(PRIVATE_HEADERS_DIR)/DOMHTMLInputElementPrivate.h \ $(INTERNAL_HEADERS_DIR)/DOMHTMLInputElementInternal.h \ - $(PUBLIC_HEADERS_DIR)/DOMHTMLIsIndexElement.h \ $(PUBLIC_HEADERS_DIR)/DOMHTMLLIElement.h \ $(PUBLIC_HEADERS_DIR)/DOMHTMLLabelElement.h \ $(PUBLIC_HEADERS_DIR)/DOMHTMLLegendElement.h \ diff --git a/Source/WebKit/mac/Misc/WebElementDictionary.mm b/Source/WebKit/mac/Misc/WebElementDictionary.mm index 162fb428b..17f220190 100644 --- a/Source/WebKit/mac/Misc/WebElementDictionary.mm +++ b/Source/WebKit/mac/Misc/WebElementDictionary.mm @@ -39,6 +39,7 @@ #import <WebCore/Frame.h> #import <WebCore/HitTestResult.h> #import <WebCore/Image.h> +#import <WebCore/RunLoop.h> #import <WebCore/WebCoreObjCExtras.h> #import <WebKit/DOMCore.h> #import <WebKit/DOMExtensions.h> @@ -66,6 +67,7 @@ static void cacheValueForKey(const void *key, const void *value, void *self) { JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); WebCoreObjCFinalizeOnMainThread(self); } diff --git a/Source/WebKit/mac/Misc/WebIconDatabase.mm b/Source/WebKit/mac/Misc/WebIconDatabase.mm index 62dd013ff..4f8fc6e06 100644 --- a/Source/WebKit/mac/Misc/WebIconDatabase.mm +++ b/Source/WebKit/mac/Misc/WebIconDatabase.mm @@ -40,6 +40,7 @@ #import <WebCore/IconDatabase.h> #import <WebCore/Image.h> #import <WebCore/IntSize.h> +#import <WebCore/RunLoop.h> #import <WebCore/SharedBuffer.h> #import <WebCore/ThreadCheck.h> #import <runtime/InitializeThreading.h> @@ -94,6 +95,7 @@ static WebIconDatabaseClient* defaultClient() { JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); } + (WebIconDatabase *)sharedIconDatabase diff --git a/Source/WebKit/mac/Misc/WebNSURLExtras.mm b/Source/WebKit/mac/Misc/WebNSURLExtras.mm index 00819e4d3..b408bd4a3 100644 --- a/Source/WebKit/mac/Misc/WebNSURLExtras.mm +++ b/Source/WebKit/mac/Misc/WebNSURLExtras.mm @@ -434,6 +434,11 @@ static NSString *mapHostNames(NSString *string, BOOL encode) baseURL = [baseURL _webkit_URLByRemovingResourceSpecifier]; const UInt8 *bytes = static_cast<const UInt8*>([data bytes]); + + // CFURLCreateAbsoluteURLWithBytes would complain to console if we passed a path to it. + if (bytes[0] == '/' && !baseURL) + return nil; + // NOTE: We use UTF-8 here since this encoding is used when computing strings when returning URL components // (e.g calls to NSURL -path). However, this function is not tolerant of illegal UTF-8 sequences, which // could either be a malformed string or bytes in a different encoding, like shift-jis, so we fall back diff --git a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm index 1537f3962..7248f464b 100644 --- a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm +++ b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm @@ -1258,7 +1258,7 @@ void NetscapePluginInstanceProxy::addValueToArray(NSMutableArray *array, ExecSta if (value.isString()) { [array addObject:[NSNumber numberWithInt:StringValueType]]; - [array addObject:ustringToString(value.toString(exec))]; + [array addObject:ustringToString(value.toString(exec)->value(exec))]; } else if (value.isNumber()) { [array addObject:[NSNumber numberWithInt:DoubleValueType]]; [array addObject:[NSNumber numberWithDouble:value.toNumber(exec)]]; diff --git a/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm index 65bcdd46c..8ad8fe0cf 100644 --- a/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm +++ b/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm @@ -46,6 +46,7 @@ #import <WebCore/RenderEmbeddedObject.h> #import <WebCore/ResourceError.h> #import <WebCore/WebCoreObjCExtras.h> +#import <WebCore/RunLoop.h> #import <WebCore/runtime_root.h> #import <runtime/InitializeThreading.h> #import <wtf/Assertions.h> @@ -65,6 +66,7 @@ extern "C" { { JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); WebCoreObjCFinalizeOnMainThread(self); WKSendUserChangeNotifications(); } diff --git a/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm index 466c35432..66486fea3 100644 --- a/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm +++ b/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm @@ -55,6 +55,7 @@ #import <WebCore/ProtectionSpace.h> #import <WebCore/RenderView.h> #import <WebCore/RenderWidget.h> +#import <WebCore/RunLoop.h> #import <WebCore/SecurityOrigin.h> #import <WebCore/WebCoreObjCExtras.h> #import <WebKit/DOMPrivate.h> @@ -76,6 +77,7 @@ using namespace WebCore; { JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); WebCoreObjCFinalizeOnMainThread(self); WKSendUserChangeNotifications(); } @@ -476,7 +478,12 @@ using namespace WebCore; - (void)cacheSnapshot { - NSImage *snapshot = [[NSImage alloc] initWithSize: [self bounds].size]; + NSSize boundsSize = [self bounds].size; + if (!boundsSize.height || !boundsSize.width) + return; + + NSImage *snapshot = [[NSImage alloc] initWithSize:boundsSize]; + _snapshotting = YES; [snapshot lockFocus]; [self drawRect:[self bounds]]; diff --git a/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm b/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm index cca814f0e..1d1409ec8 100644 --- a/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm +++ b/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm @@ -29,6 +29,7 @@ #import <WebKit/WebBasePluginPackage.h> #import <algorithm> +#import <WebCore/RunLoop.h> #import <WebCore/WebCoreObjCExtras.h> #import <WebKit/WebKitNSStringExtras.h> #import <WebKit/WebNSObjectExtras.h> @@ -69,6 +70,7 @@ using namespace WebCore; { JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); WebCoreObjCFinalizeOnMainThread(self); } diff --git a/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm b/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm index 68f56c0f9..57df2fe02 100644 --- a/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm +++ b/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm @@ -67,6 +67,7 @@ #import <WebCore/Page.h> #import <WebCore/PluginMainThreadScheduler.h> #import <WebCore/ProxyServer.h> +#import <WebCore/RunLoop.h> #import <WebCore/ScriptController.h> #import <WebCore/SecurityOrigin.h> #import <WebCore/SoftLinking.h> @@ -194,6 +195,7 @@ typedef struct { { JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); WebCoreObjCFinalizeOnMainThread(self); WKSendUserChangeNotifications(); } diff --git a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h index ce97ab042..48ff09bba 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h +++ b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h @@ -164,13 +164,13 @@ public: virtual bool supportsFullscreenForNode(const WebCore::Node*) OVERRIDE; virtual void enterFullscreenForNode(WebCore::Node*) OVERRIDE; virtual void exitFullscreenForNode(WebCore::Node*) OVERRIDE; - virtual void fullScreenRendererChanged(WebCore::RenderBox*) OVERRIDE; #endif #if ENABLE(FULLSCREEN_API) virtual bool supportsFullScreenForElement(const WebCore::Element*, bool withKeyboard) OVERRIDE; virtual void enterFullScreenForElement(WebCore::Element*) OVERRIDE; virtual void exitFullScreenForElement(WebCore::Element*) OVERRIDE; + virtual void fullScreenRendererChanged(WebCore::RenderBox*) OVERRIDE; #endif // FIXME: Remove once all ports are using client-based geolocation. https://bugs.webkit.org/show_bug.cgi?id=40373 diff --git a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm index 3bac87b9c..ce2f37cc9 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm @@ -150,19 +150,16 @@ void WebChromeClient::chromeDestroyed() delete this; } -// These functions scale between window and WebView coordinates because JavaScript/DOM operations -// assume that the WebView and the window share the same coordinate system. - void WebChromeClient::setWindowRect(const FloatRect& rect) { - NSRect windowRect = toDeviceSpace(rect, [m_webView window]); + NSRect windowRect = toDeviceSpace(rect, [m_webView window], [m_webView _backingScaleFactor]); [[m_webView _UIDelegateForwarder] webView:m_webView setFrame:windowRect]; } FloatRect WebChromeClient::windowRect() { NSRect windowRect = [[m_webView _UIDelegateForwarder] webViewFrame:m_webView]; - return toUserSpace(windowRect, [m_webView window]); + return toUserSpace(windowRect, [m_webView window], [m_webView _backingScaleFactor]); } // FIXME: We need to add API for setting and getting this. diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm index 8cb31f848..fabdf6c6f 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm @@ -61,6 +61,7 @@ #import <WebCore/LegacyWebArchive.h> #import <WebCore/PlatformKeyboardEvent.h> #import <WebCore/PlatformString.h> +#import <WebCore/RunLoop.h> #import <WebCore/SpellChecker.h> #import <WebCore/UndoStep.h> #import <WebCore/UserTypingGestureIndicator.h> @@ -108,6 +109,7 @@ static const int InvalidCorrectionPanelTag = 0; { JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); WebCoreObjCFinalizeOnMainThread(self); } diff --git a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index 3bff13499..819dd16ce 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -112,6 +112,7 @@ #import <WebCore/ResourceHandle.h> #import <WebCore/ResourceLoader.h> #import <WebCore/ResourceRequest.h> +#import <WebCore/RunLoop.h> #import <WebCore/ScriptController.h> #import <WebCore/SharedBuffer.h> #import <WebCore/WebCoreObjCExtras.h> @@ -1982,6 +1983,7 @@ jobject WebFrameLoaderClient::javaApplet(NSView* view) { JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); WebCoreObjCFinalizeOnMainThread(self); } diff --git a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm index 0a780ff6a..5c3cdb3ee 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm @@ -171,6 +171,7 @@ void InitWebCoreSystemInterface(void) #if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) INIT(GetMacOSXVersionString); + INIT(ExecutableWasLinkedOnOrBeforeLion); #endif didInit = true; diff --git a/Source/WebKit/mac/WebView/WebArchive.mm b/Source/WebKit/mac/WebView/WebArchive.mm index 6d2469ae0..aeebd972c 100644 --- a/Source/WebKit/mac/WebView/WebArchive.mm +++ b/Source/WebKit/mac/WebView/WebArchive.mm @@ -36,6 +36,7 @@ #import <JavaScriptCore/InitializeThreading.h> #import <WebCore/ArchiveResource.h> #import <WebCore/LegacyWebArchive.h> +#import <WebCore/RunLoop.h> #import <WebCore/ThreadCheck.h> #import <WebCore/WebCoreObjCExtras.h> #import <wtf/MainThread.h> @@ -68,6 +69,7 @@ static NSString * const WebSubframeArchivesKey = @"WebSubframeArchives"; { JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); WebCoreObjCFinalizeOnMainThread(self); } diff --git a/Source/WebKit/mac/WebView/WebDataSource.mm b/Source/WebKit/mac/WebView/WebDataSource.mm index 818530b5a..d9125f70f 100644 --- a/Source/WebKit/mac/WebView/WebDataSource.mm +++ b/Source/WebKit/mac/WebView/WebDataSource.mm @@ -53,6 +53,7 @@ #import <WebCore/LegacyWebArchive.h> #import <WebCore/MIMETypeRegistry.h> #import <WebCore/ResourceRequest.h> +#import <WebCore/RunLoop.h> #import <WebCore/SharedBuffer.h> #import <WebCore/WebCoreObjCExtras.h> #import <WebCore/WebCoreURLResponse.h> @@ -81,6 +82,7 @@ using namespace WebCore; { JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); WebCoreObjCFinalizeOnMainThread(self); } diff --git a/Source/WebKit/mac/WebView/WebFrame.mm b/Source/WebKit/mac/WebView/WebFrame.mm index 09283be8f..c03435476 100644 --- a/Source/WebKit/mac/WebView/WebFrame.mm +++ b/Source/WebKit/mac/WebView/WebFrame.mm @@ -613,7 +613,8 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return @""; JSLock lock(SilenceAssertionsOnly); - return ustringToString(result.toString(_private->coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec())); + JSC::ExecState* exec = _private->coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec(); + return ustringToString(result.toString(exec)->value(exec)); } - (NSRect)_caretRectAtPosition:(const Position&)pos affinity:(NSSelectionAffinity)affinity @@ -995,6 +996,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) // This method is only intended to be used for testing the SVG animation system. - (BOOL)_pauseSVGAnimation:(NSString*)elementId onSMILNode:(DOMNode *)node atTime:(NSTimeInterval)time { +#if ENABLE(SVG) Frame* frame = core(self); if (!frame) return false; @@ -1007,7 +1009,6 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) if (!coreNode || !SVGSMILElement::isSMILElement(coreNode)) return false; -#if ENABLE(SVG) return document->accessSVGExtensions()->sampleAnimationAtTime(elementId, static_cast<SVGSMILElement*>(coreNode), time); #else return false; @@ -1191,7 +1192,8 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return @""; JSLock lock(SilenceAssertionsOnly); - return ustringToString(result.toString(anyWorldGlobalObject->globalExec())); + JSC::ExecState* exec = anyWorldGlobalObject->globalExec(); + return ustringToString(result.toString(exec)->value(exec)); } - (JSGlobalContextRef)_globalContextForScriptWorld:(WebScriptWorld *)world diff --git a/Source/WebKit/mac/WebView/WebFullScreenController.mm b/Source/WebKit/mac/WebView/WebFullScreenController.mm index 5a4d8826f..aae92e841 100644 --- a/Source/WebKit/mac/WebView/WebFullScreenController.mm +++ b/Source/WebKit/mac/WebView/WebFullScreenController.mm @@ -669,6 +669,7 @@ private: - (BOOL)_isAnyMoviePlaying { +#if ENABLE(VIDEO) if (!_element) return NO; @@ -683,6 +684,7 @@ private: nextNode = nextNode->traverseNextNode(_element.get()); } +#endif return NO; } diff --git a/Source/WebKit/mac/WebView/WebHTMLView.mm b/Source/WebKit/mac/WebView/WebHTMLView.mm index f4e79707c..cfc7b953c 100644 --- a/Source/WebKit/mac/WebView/WebHTMLView.mm +++ b/Source/WebKit/mac/WebView/WebHTMLView.mm @@ -108,6 +108,7 @@ #import <WebCore/Range.h> #import <WebCore/RenderWidget.h> #import <WebCore/RenderView.h> +#import <WebCore/RunLoop.h> #import <WebCore/RuntimeApplicationChecks.h> #import <WebCore/SharedBuffer.h> #import <WebCore/SimpleFontData.h> @@ -521,6 +522,8 @@ struct WebHTMLViewInterpretKeyEventsParameters { SEL selectorForDoCommandBySelector; + NSTrackingArea *trackingAreaForNonKeyWindow; + #ifndef NDEBUG BOOL enumeratingSubviews; #endif @@ -548,6 +551,7 @@ static NSCellStateValue kit(TriState state) { JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); WebCoreObjCFinalizeOnMainThread(self); if (!oldSetCursorForMouseLocationIMP) { @@ -584,6 +588,7 @@ static NSCellStateValue kit(TriState state) [completionController release]; [dataSource release]; [highlighters release]; + [trackingAreaForNonKeyWindow release]; if (promisedDragTIFFDataSource) promisedDragTIFFDataSource->removeClient(promisedDataClient()); @@ -609,6 +614,7 @@ static NSCellStateValue kit(TriState state) [completionController release]; [dataSource release]; [highlighters release]; + [trackingAreaForNonKeyWindow release]; if (promisedDragTIFFDataSource) promisedDragTIFFDataSource->removeClient(promisedDataClient()); @@ -619,6 +625,7 @@ static NSCellStateValue kit(TriState state) completionController = nil; dataSource = nil; highlighters = nil; + trackingAreaForNonKeyWindow = nil; promisedDragTIFFDataSource = 0; #if USE(ACCELERATED_COMPOSITING) @@ -1545,6 +1552,24 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) return [[_private->toolTip copy] autorelease]; } +static bool mouseEventIsPartOfClickOrDrag(NSEvent *event) +{ + switch ([event type]) { + case NSLeftMouseDown: + case NSLeftMouseUp: + case NSLeftMouseDragged: + case NSRightMouseDown: + case NSRightMouseUp: + case NSRightMouseDragged: + case NSOtherMouseDown: + case NSOtherMouseUp: + case NSOtherMouseDragged: + return true; + default: + return false; + } +} + - (void)_updateMouseoverWithEvent:(NSEvent *)event { if (_private->closed) @@ -1586,8 +1611,17 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) lastHitView = view; if (view) { - if (Frame* coreFrame = core([view _frame])) - coreFrame->eventHandler()->mouseMoved(event); + if (Frame* coreFrame = core([view _frame])) { + // We need to do a full, normal hit test during this mouse event if the page is active or if a mouse + // button is currently pressed. It is possible that neither of those things will be true on Lion and + // newer when legacy scrollbars are enabled, because then WebKit receives mouse events all the time. + // If it is one of those cases where the page is not active and the mouse is not pressed, then we can + // fire a much more restricted and efficient scrollbars-only version of the event. + if ([[self window] isKeyWindow] || mouseEventIsPartOfClickOrDrag(event)) + coreFrame->eventHandler()->mouseMoved(event); + else + coreFrame->eventHandler()->passMouseMovedEventToScrollbars(event); + } [view release]; } @@ -2243,6 +2277,7 @@ static bool matchesExtensionOrEquivalent(NSString *filename, NSString *extension returnTypes:[[self class] _insertablePasteboardTypes]]; JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); WebCoreObjCFinalizeOnMainThread(self); } @@ -2800,6 +2835,12 @@ WEBCORE_COMMAND(yankAndSelect) return; #endif +#if !defined(BUILDING_ON_SNOW_LEOPARD) + // Legacy scrollbars require tracking the mouse at all times. + if (WKRecommendedScrollerStyle() == NSScrollerStyleLegacy) + return; +#endif + [[self _webView] _mouseDidMoveOverElement:nil modifierFlags:0]; [self _removeMouseMovedObserverUnconditionally]; } @@ -3333,6 +3374,14 @@ static void setMenuTargets(NSMenu* menu) return; } +#if !defined(BUILDING_ON_SNOW_LEOPARD) + if (_private->trackingAreaForNonKeyWindow) { + [self removeTrackingArea:_private->trackingAreaForNonKeyWindow]; + [_private->trackingAreaForNonKeyWindow release]; + _private->trackingAreaForNonKeyWindow = nil; + } +#endif + NSWindow *keyWindow = [notification object]; if (keyWindow == [self window]) { @@ -3357,6 +3406,19 @@ static void setMenuTargets(NSMenu* menu) [self _updateSecureInputState]; [_private->completionController endRevertingChange:NO moveLeft:NO]; } + +#if !defined(BUILDING_ON_SNOW_LEOPARD) + if (WKRecommendedScrollerStyle() == NSScrollerStyleLegacy) { + // Legacy style scrollbars have design details that rely on tracking the mouse all the time. + // It's easiest to do this with a tracking area, which we will remove when the window is key + // again. + _private->trackingAreaForNonKeyWindow = [[NSTrackingArea alloc] initWithRect:[self bounds] + options:NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingInVisibleRect | NSTrackingActiveAlways + owner:self + userInfo:nil]; + [self addTrackingArea:_private->trackingAreaForNonKeyWindow]; + } +#endif } - (void)windowWillOrderOnScreen:(NSNotification *)notification @@ -4506,29 +4568,6 @@ static PassRefPtr<KeyboardEvent> currentKeyboardEvent(Frame* coreFrame) [shadow release]; -#if 0 - -NSObliquenessAttributeName /* float; skew to be applied to glyphs, default 0: no skew */ - // font-style, but that is just an on-off switch - -NSExpansionAttributeName /* float; log of expansion factor to be applied to glyphs, default 0: no expansion */ - // font-stretch? - -NSKernAttributeName /* float, amount to modify default kerning, if 0, kerning off */ - // letter-spacing? probably not good enough - -NSUnderlineColorAttributeName /* NSColor, default nil: same as foreground color */ -NSStrikethroughColorAttributeName /* NSColor, default nil: same as foreground color */ - // text-decoration-color? - -NSLigatureAttributeName /* int, default 1: default ligatures, 0: no ligatures, 2: all ligatures */ -NSBaselineOffsetAttributeName /* float, in points; offset from baseline, default 0 */ -NSStrokeWidthAttributeName /* float, in percent of font point size, default 0: no stroke; positive for stroke alone, negative for stroke and fill (a typical value for outlined text would be 3.0) */ -NSStrokeColorAttributeName /* NSColor, default nil: same as foreground color */ - // need extensions? - -#endif - NSDictionary *a = [sender convertAttributes:oa]; NSDictionary *b = [sender convertAttributes:ob]; @@ -4543,6 +4582,8 @@ NSStrokeColorAttributeName /* NSColor, default nil: same as foreground co ca = [a objectForKey:NSForegroundColorAttributeName]; cb = [b objectForKey:NSForegroundColorAttributeName]; if (ca == cb) { + if (!ca) + ca = [NSColor blackColor]; [style setColor:[self _colorAsString:ca]]; } @@ -5005,10 +5046,6 @@ static BOOL writingDirectionKeyBindingsEnabled() ASSERT(font != nil); [[NSFontManager sharedFontManager] setSelectedFont:font isMultiple:multipleFonts]; - - // FIXME: we don't keep track of selected attributes, or set them on the font panel. This - // appears to have no effect on the UI. E.g., underlined text in Mail or TextEdit is - // not reflected in the font panel. Maybe someday this will change. } - (BOOL)_canSmartCopyOrDelete @@ -5460,6 +5497,9 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) #elif (defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LION)) // Do geometry flipping here, which flips all the compositing layers so they are top-down. [viewLayer setGeometryFlipped:YES]; +#else + if (WKExecutableWasLinkedOnOrBeforeLion()) + [viewLayer setGeometryFlipped:YES]; #endif } diff --git a/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h index 7db743f65..20e42ab3d 100644 --- a/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h +++ b/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h @@ -94,6 +94,7 @@ #define WebKitAcceleratedDrawingEnabledPreferenceKey @"WebKitAcceleratedDrawingEnabled" #define WebKitCanvasUsesAcceleratedDrawingPreferenceKey @"WebKitCanvasUsesAcceleratedDrawing" #define WebKitAcceleratedCompositingEnabledPreferenceKey @"WebKitAcceleratedCompositingEnabled" +#define WebKitCSSCustomFilterEnabledPreferenceKey @"WebKitCSSCustomFilterEnabled" #define WebKitShowDebugBordersPreferenceKey @"WebKitShowDebugBorders" #define WebKitShowRepaintCounterPreferenceKey @"WebKitShowRepaintCounter" #define WebKitWebAudioEnabledPreferenceKey @"WebKitWebAudioEnabled" diff --git a/Source/WebKit/mac/WebView/WebPreferences.mm b/Source/WebKit/mac/WebView/WebPreferences.mm index c8dc82b9f..f49df5473 100644 --- a/Source/WebKit/mac/WebView/WebPreferences.mm +++ b/Source/WebKit/mac/WebView/WebPreferences.mm @@ -356,6 +356,7 @@ static WebCacheModel cacheModelForMainBundle(void) [NSNumber numberWithBool:NO], WebKitDOMPasteAllowedPreferenceKey, [NSNumber numberWithBool:YES], WebKitUsesPageCachePreferenceKey, [NSNumber numberWithInt:cacheModelForMainBundle()], WebKitCacheModelPreferenceKey, + [NSNumber numberWithBool:YES], WebKitPageCacheSupportsPluginsPreferenceKey, [NSNumber numberWithBool:NO], WebKitDeveloperExtrasEnabledPreferenceKey, [NSNumber numberWithBool:YES], WebKitAuthorAndUserStylesEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitApplicationChromeModeEnabledPreferenceKey, @@ -366,6 +367,8 @@ static WebCacheModel cacheModelForMainBundle(void) [NSNumber numberWithBool:NO], WebKitJavaScriptCanAccessClipboardPreferenceKey, [NSNumber numberWithBool:YES], WebKitXSSAuditorEnabledPreferenceKey, [NSNumber numberWithBool:YES], WebKitAcceleratedCompositingEnabledPreferenceKey, + // CSS Shaders also need WebGL enabled (which is disabled by default), so we can keep it enabled for now. + [NSNumber numberWithBool:YES], WebKitCSSCustomFilterEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitAcceleratedDrawingEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitCanvasUsesAcceleratedDrawingPreferenceKey, [NSNumber numberWithBool:NO], WebKitShowDebugBordersPreferenceKey, @@ -1322,6 +1325,16 @@ static NSString *classIBCreatorID = nil; [self _setBoolValue:enabled forKey:WebKitAcceleratedCompositingEnabledPreferenceKey]; } +- (BOOL)cssCustomFilterEnabled +{ + return [self _boolValueForKey:WebKitCSSCustomFilterEnabledPreferenceKey]; +} + +- (void)setCSSCustomFilterEnabled:(BOOL)enabled +{ + [self _setBoolValue:enabled forKey:WebKitCSSCustomFilterEnabledPreferenceKey]; +} + - (BOOL)showDebugBorders { return [self _boolValueForKey:WebKitShowDebugBordersPreferenceKey]; diff --git a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h index fa25999e8..305434ffb 100644 --- a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -186,6 +186,9 @@ extern NSString *WebPreferencesChangedInternalNotification; - (BOOL)acceleratedCompositingEnabled; - (void)setAcceleratedCompositingEnabled:(BOOL)enabled; +- (BOOL)cssCustomFilterEnabled; +- (void)setCSSCustomFilterEnabled:(BOOL)enabled; + - (BOOL)showDebugBorders; - (void)setShowDebugBorders:(BOOL)show; diff --git a/Source/WebKit/mac/WebView/WebResource.mm b/Source/WebKit/mac/WebView/WebResource.mm index 1fc339c3e..463f76846 100644 --- a/Source/WebKit/mac/WebView/WebResource.mm +++ b/Source/WebKit/mac/WebView/WebResource.mm @@ -38,6 +38,7 @@ #import <JavaScriptCore/PassRefPtr.h> #import <WebCore/ArchiveResource.h> #import <WebCore/LegacyWebArchive.h> +#import <WebCore/RunLoop.h> #import <WebCore/RuntimeApplicationChecks.h> #import <WebCore/TextEncoding.h> #import <WebCore/ThreadCheck.h> @@ -67,6 +68,7 @@ static NSString * const WebResourceResponseKey = @"WebResourceResponse" { JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); WebCoreObjCFinalizeOnMainThread(self); } diff --git a/Source/WebKit/mac/WebView/WebTextIterator.mm b/Source/WebKit/mac/WebView/WebTextIterator.mm index e305d6d46..e80d4671f 100644 --- a/Source/WebKit/mac/WebView/WebTextIterator.mm +++ b/Source/WebKit/mac/WebView/WebTextIterator.mm @@ -29,6 +29,7 @@ #import "DOMRangeInternal.h" #import "WebTypesInternal.h" #import <JavaScriptCore/Vector.h> +#import <WebCore/RunLoop.h> #import <WebCore/TextIterator.h> #import <WebCore/WebCoreObjCExtras.h> #import <runtime/InitializeThreading.h> @@ -49,6 +50,7 @@ using namespace WebCore; { JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); WebCoreObjCFinalizeOnMainThread(self); } diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm index 7ded2aa70..e2bf898e6 100644 --- a/Source/WebKit/mac/WebView/WebView.mm +++ b/Source/WebKit/mac/WebView/WebView.mm @@ -151,6 +151,7 @@ #import <WebCore/ResourceHandle.h> #import <WebCore/ResourceLoadScheduler.h> #import <WebCore/ResourceRequest.h> +#import <WebCore/RunLoop.h> #import <WebCore/RuntimeApplicationChecks.h> #import <WebCore/SchemeRegistry.h> #import <WebCore/ScriptController.h> @@ -1470,6 +1471,9 @@ static bool needsSelfRetainWhileLoadingQuirk() settings->setFrameFlatteningEnabled([preferences isFrameFlatteningEnabled]); settings->setSpatialNavigationEnabled([preferences isSpatialNavigationEnabled]); settings->setPaginateDuringLayoutEnabled([preferences paginateDuringLayoutEnabled]); +#if ENABLE(CSS_SHADERS) + settings->setCSSCustomFilterEnabled([preferences cssCustomFilterEnabled]); +#endif #if ENABLE(FULLSCREEN_API) settings->setFullScreenEnabled([preferences fullScreenEnabled]); #endif @@ -2787,6 +2791,25 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) return WebPaginationModeUnpaginated; } +- (void)_setPaginationBehavesLikeColumns:(BOOL)behavesLikeColumns +{ + Page* page = core(self); + if (!page) + return; + + Page::Pagination pagination = page->pagination(); + pagination.behavesLikeColumns = behavesLikeColumns; +} + +- (BOOL)_paginationBehavesLikeColumns +{ + Page* page = core(self); + if (!page) + return NO; + + return page->pagination().behavesLikeColumns; +} + - (void)_setPageLength:(CGFloat)pageLength { Page* page = core(self); @@ -2949,6 +2972,7 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) InitWebCoreSystemInterface(); JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationWillTerminate) name:NSApplicationWillTerminateNotification object:NSApp]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesChangedNotification:) name:WebPreferencesChangedInternalNotification object:nil]; @@ -5532,6 +5556,16 @@ FOR_EACH_RESPONDER_SELECTOR(FORWARD) [self _performResponderOperation:_cmd with:text]; } +- (NSDictionary *)typingAttributes +{ + Frame* coreFrame = core([self _selectedOrMainFrame]); + if (coreFrame) + return coreFrame->editor()->fontAttributesForSelectionStart(); + + return nil; +} + + @end @implementation WebView (WebViewEditingInMail) @@ -6306,7 +6340,7 @@ static void glibContextIterationCallback(CFRunLoopObserverRef, CFRunLoopActivity - (NSRect)_convertRectFromRootView:(NSRect)rect { - return NSMakeRect(rect.origin.x, [self bounds].size.height - rect.origin.y, rect.size.width, rect.size.height); + return NSMakeRect(rect.origin.x, [self bounds].size.height - rect.origin.y - rect.size.height, rect.size.width, rect.size.height); } @end diff --git a/Source/WebKit/mac/WebView/WebViewData.mm b/Source/WebKit/mac/WebView/WebViewData.mm index de93dcc1a..0b8117a09 100644 --- a/Source/WebKit/mac/WebView/WebViewData.mm +++ b/Source/WebKit/mac/WebView/WebViewData.mm @@ -33,6 +33,7 @@ #import "WebPreferenceKeysPrivate.h" #import <WebCore/WebCoreObjCExtras.h> #import <WebCore/HistoryItem.h> +#import <WebCore/RunLoop.h> #import <objc/objc-auto.h> #import <runtime/InitializeThreading.h> #import <wtf/MainThread.h> @@ -65,6 +66,7 @@ LayerFlushController::LayerFlushController(WebView* webView) { JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); + WebCore::RunLoop::initializeMainRunLoop(); WebCoreObjCFinalizeOnMainThread(self); } diff --git a/Source/WebKit/mac/WebView/WebViewPrivate.h b/Source/WebKit/mac/WebView/WebViewPrivate.h index 2bf005dca..cd92f31e5 100644 --- a/Source/WebKit/mac/WebView/WebViewPrivate.h +++ b/Source/WebKit/mac/WebView/WebViewPrivate.h @@ -557,6 +557,12 @@ Could be worth adding to the API. - (void)_setPaginationMode:(WebPaginationMode)paginationMode; - (WebPaginationMode)_paginationMode; + +// Whether the column-break-{before,after} properties are respected instead of the +// page-break-{before,after} properties. +- (void)_setPaginationBehavesLikeColumns:(BOOL)behavesLikeColumns; +- (BOOL)_paginationBehavesLikeColumns; + // Set to 0 to have the page length equal the view length. - (void)_setPageLength:(CGFloat)pageLength; - (CGFloat)_pageLength; diff --git a/Source/WebKit/mac/Workers/WebWorkersPrivate.mm b/Source/WebKit/mac/Workers/WebWorkersPrivate.mm index 2c14ad1b6..e6ea8c051 100644 --- a/Source/WebKit/mac/Workers/WebWorkersPrivate.mm +++ b/Source/WebKit/mac/Workers/WebWorkersPrivate.mm @@ -36,7 +36,7 @@ + (unsigned) workerThreadCount { -#if ENABLE_WORKERS +#if defined(ENABLE_WORKERS) && ENABLE_WORKERS return WebCore::WorkerThread::workerThreadCount(); #else return 0; diff --git a/Source/WebKit/qt/Api/qwebelement.cpp b/Source/WebKit/qt/Api/qwebelement.cpp index 07716efba..771ad56fb 100644 --- a/Source/WebKit/qt/Api/qwebelement.cpp +++ b/Source/WebKit/qt/Api/qwebelement.cpp @@ -503,7 +503,7 @@ QStringList QWebElement::attributeNames(const QString& namespaceUri) const return QStringList(); QStringList attributeNameList; - const NamedNodeMap* const attrs = m_element->attributes(/* read only = */ true); + const NamedNodeMap* const attrs = m_element->updatedAttributes(); if (attrs) { const String namespaceUriString(namespaceUri); // convert QString -> String once const unsigned attrsCount = attrs->length(); @@ -844,13 +844,13 @@ QString QWebElement::styleProperty(const QString &name, StyleResolveStrategy str if (!propID) return QString(); - CSSStyleDeclaration* style = static_cast<StyledElement*>(m_element)->style(); + CSSMutableStyleDeclaration* style = static_cast<StyledElement*>(m_element)->ensureInlineStyleDecl(); if (strategy == InlineStyle) return style->getPropertyValue(propID); if (strategy == CascadedStyle) { - if (style->getPropertyPriority(propID)) + if (style->propertyIsImportant(propID)) return style->getPropertyValue(propID); // We are going to resolve the style property by walking through the @@ -866,11 +866,11 @@ QString QWebElement::styleProperty(const QString &name, StyleResolveStrategy str for (int i = rules->length(); i > 0; --i) { CSSStyleRule* rule = static_cast<CSSStyleRule*>(rules->item(i - 1)); - if (rule->style()->getPropertyPriority(propID)) - return rule->style()->getPropertyValue(propID); + if (rule->declaration()->propertyIsImportant(propID)) + return rule->declaration()->getPropertyValue(propID); if (style->getPropertyValue(propID).isEmpty()) - style = rule->style(); + style = rule->declaration(); } } @@ -909,12 +909,11 @@ void QWebElement::setStyleProperty(const QString &name, const QString &value) return; int propID = cssPropertyID(name); - CSSStyleDeclaration* style = static_cast<StyledElement*>(m_element)->style(); + CSSMutableStyleDeclaration* style = static_cast<StyledElement*>(m_element)->ensureInlineStyleDecl(); if (!propID || !style) return; - ExceptionCode exception = 0; - style->setProperty(name, value,emptyString(), exception); + style->setProperty(propID, value); } /*! diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp index 91de6f53c..f94d44589 100644 --- a/Source/WebKit/qt/Api/qwebpage.cpp +++ b/Source/WebKit/qt/Api/qwebpage.cpp @@ -2092,8 +2092,12 @@ void QWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, // Catch plugin logDestroy message for LayoutTests/plugins/open-and-close-window-with-plugin.html // At this point DRT's WebPage has already been destroyed if (QWebPagePrivate::drtRun) { - if (message == QLatin1String("PLUGIN: NPP_Destroy")) - fprintf (stdout, "CONSOLE MESSAGE: line %d: %s\n", lineNumber, message.toUtf8().constData()); + if (message == QLatin1String("PLUGIN: NPP_Destroy")) { + fprintf(stdout, "CONSOLE MESSAGE: "); + if (lineNumber) + fprintf(stdout, "line %d: ", lineNumber); + fprintf(stdout, "%s\n", message.toUtf8().constData()); + } } } diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index 95f374866..0b854f952 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,91 @@ +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. + + * Api/qwebelement.cpp: + (QWebElement::attributeNames): use updateAttributes(). + +2012-02-01 Alexis Menard <alexis.menard@openbossa.org> + + CSSStyleDeclaration.getPropertyPriority() fails for CSS shorthand properties with 'important' priority + https://bugs.webkit.org/show_bug.cgi?id=49058 + + Reviewed by Andreas Kling. + + Update the code as getPropertyPriority has been renamed to propertyIsImportant. + + * Api/qwebelement.cpp: + (QWebElement::styleProperty): + +2012-01-31 Antti Koivisto <antti@apple.com> + + Try to fix Qt build. + + Not reviewed. + + * Api/qwebelement.cpp: + (QWebElement::styleProperty): + +2012-01-30 Antti Koivisto <antti@apple.com> + + Reduce non-CSSOM API of CSSStyleDeclaration + https://bugs.webkit.org/show_bug.cgi?id=77299 + + Reviewed by Andreas Kling. + + * Api/qwebelement.cpp: + (QWebElement::styleProperty): + (QWebElement::setStyleProperty): + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::computedStyleIncludingVisitedInfo): + +2012-01-25 Zeno Albisser <zeno@webkit.org> + + [Qt] public.pri is missing dependency to quick module. + https://bugs.webkit.org/show_bug.cgi?id=77016 + + Reviewed by Tor Arne Vestbø. + + * declarative/public.pri: + +2012-01-17 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com> + + [Qt] Debug build fails with debug qt5 + https://bugs.webkit.org/show_bug.cgi?id=76463 + + Reviewed by Simon Hausmann. + + Add QNetworkCookie include in order to satisfy sizeof in QTypeInfo in debug builds. + + * WebCoreSupport/FrameNetworkingContextQt.cpp: + +2012-01-13 Marcelo Lira <marcelo.lira@openbossa.org> + + [Qt] Fix missing signal in qwebframe API test for Qt5 + https://bugs.webkit.org/show_bug.cgi?id=76195 + + Reviewed by Noam Rosenthal. + + In Qt5 QObject has a new signal with this signature: "objectNameChanged(QString)". + + * tests/qwebframe/tst_qwebframe.cpp: + (tst_QWebFrame::enumerate_data): + +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. + + * Api/qwebpage.cpp: + (QWebPage::javaScriptConsoleMessage): + 2012-01-11 Simon Hausmann <simon.hausmann@nokia.com> Unreviewed trivial build fix: Removed unnecessary QHttpRequestHeader diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index 92ecdf8da..90254aeca 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -635,10 +635,11 @@ QVariantMap DumpRenderTreeSupportQt::computedStyleIncludingVisitedInfo(const QWe if (!webElement) return res; - RefPtr<WebCore::CSSComputedStyleDeclaration> style = computedStyle(webElement, true); + RefPtr<WebCore::CSSComputedStyleDeclaration> computedStyleDeclaration = computedStyle(webElement, true); + CSSStyleDeclaration* style = static_cast<WebCore::CSSStyleDeclaration*>(computedStyleDeclaration.get()); for (unsigned i = 0; i < style->length(); i++) { QString name = style->item(i); - QString value = (static_cast<WebCore::CSSStyleDeclaration*>(style.get()))->getPropertyValue(name); + QString value = style->getPropertyValue(name); res[convertToPropertyName(name)] = QVariant(value); } return res; diff --git a/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp b/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp index 02b64a443..7e99624b5 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp @@ -25,6 +25,7 @@ #include "qwebframe_p.h" #include "qwebpage.h" #include <QNetworkAccessManager> +#include <QNetworkCookie> #include <QNetworkCookieJar> namespace WebCore { diff --git a/Source/WebKit/qt/declarative/experimental/experimental.pri b/Source/WebKit/qt/declarative/experimental/experimental.pri index 49f463d1b..bbecabb5c 100644 --- a/Source/WebKit/qt/declarative/experimental/experimental.pri +++ b/Source/WebKit/qt/declarative/experimental/experimental.pri @@ -26,7 +26,7 @@ wince*:LIBS += $$QMAKE_LIBS_GUI CONFIG += qtwebkit qtwebkit-private -QT += declarative widgets network +QT += declarative widgets network quick DESTDIR = $${ROOT_BUILD_DIR}/imports/$${TARGET.module_name} diff --git a/Source/WebKit/qt/declarative/public.pri b/Source/WebKit/qt/declarative/public.pri index 3e2fb470a..667d944e2 100644 --- a/Source/WebKit/qt/declarative/public.pri +++ b/Source/WebKit/qt/declarative/public.pri @@ -27,7 +27,7 @@ wince*:LIBS += $$QMAKE_LIBS_GUI CONFIG += qtwebkit qtwebkit-private QT += declarative -haveQt(5): QT += widgets +haveQt(5): QT += widgets quick contains(QT_CONFIG, qtquick1): { QT += qtquick1 diff --git a/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 43ea86ff5..3eb08c450 100644 --- a/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -2031,8 +2031,11 @@ void tst_QWebFrame::enumerate_data() << "p1" << "p2" << "p4" << "p6" // dynamic properties << "dp1" << "dp2" << "dp3" - // inherited slots + // inherited signals and slots << "destroyed(QObject*)" << "destroyed()" +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + << "objectNameChanged(QString)" +#endif << "deleteLater()" // not included because it's private: // << "_q_reregisterTimers(void*)" diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog index 384faa5d0..0b0b9b632 100644 --- a/Source/WebKit/win/ChangeLog +++ b/Source/WebKit/win/ChangeLog @@ -1,3 +1,76 @@ +2012-02-01 Anders Carlsson <andersca@apple.com> + + Another attempt to fix the Windows build. + + * FullscreenVideoController.cpp: + (FullscreenVideoController::LayerClient::platformCALayerDidCreateTiles): + +2012-01-26 Andy Estes <aestes@apple.com> + + [Windows] Optionally invert colors when drawing to a WebView's backing store. + https://bugs.webkit.org/show_bug.cgi?id=77168 + + Reviewed by Sam Weinig. + + * WebView.cpp: + (WebView::WebView): Initialize m_shouldInvertColors to false. + (WebView::paintIntoBackingStore): If m_shouldInvertColors is true, draw + an opaque white quad using the CompositeDifference blend mode. This + blend operation instructs CoreGraphics to take the difference between + the source pixel (white) and the background pixel, resulting in an + inverted pixel. + * WebView.h: Define m_shouldInvertColors. + +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(). + + * WebView.cpp: + (WebView::showDebugBorders): + (WebView::showRepaintCounter): + * WebView.h: + +2012-01-23 David Levin <levin@chromium.org> + + [windows] Convert usages of GetDC to HWndDC Part 2. + https://bugs.webkit.org/show_bug.cgi?id=76750 + + Reviewed by Adam Roben. + + * FullscreenVideoController.cpp: + (createCompatibleDCForWindow): Moved out the code which creates a DC for a window + to keep the same scope for the DC lifetime. + (FullscreenVideoController::draw): Switch to using OwnPtr<HDC> + since createCompatibleDCForWindow returns a PassOwnPtr. + * WebNodeHighlight.cpp: + (WebNodeHighlight::update): + Cleaned up leaks from calling GetDC without release. + Note that there is a potential leak of hdc that previously existed + and still does in an early exit scenario. (This could be easily fixed + by using OwnPtr<HDC> but I was trying to keep this patch focused.) + * WebView.cpp: + (WebView::scrollBackingStore): Typical conversion. + (WebView::updateBackingStore): Reduced the scope of windowDC to be + right where it is being used. + (WebView::performLayeredWindowUpdate): Typical conversion. + (WebView::paintIntoBackingStore): Ditto. + +2012-01-23 David Levin <levin@chromium.org> + + [windows] Convert usages of GetDC to HWndDC Part 1. + https://bugs.webkit.org/show_bug.cgi?id=76744 + + Reviewed by Adam Roben. + + * WebIconDatabase.cpp: + (createDIB): Changed GetDC to HWndDC and removed ReleaseDC. + 2012-01-07 Andreas Kling <awesomekling@apple.com> Windows build fix. diff --git a/Source/WebKit/win/FullscreenVideoController.cpp b/Source/WebKit/win/FullscreenVideoController.cpp index 30405c67d..29ffacd0e 100644 --- a/Source/WebKit/win/FullscreenVideoController.cpp +++ b/Source/WebKit/win/FullscreenVideoController.cpp @@ -37,11 +37,14 @@ #include <WebCore/Font.h> #include <WebCore/FontSelector.h> #include <WebCore/GraphicsContext.h> +#include <WebCore/HWndDC.h> #include <WebCore/Page.h> #include <WebCore/PlatformCALayer.h> #include <WebCore/TextRun.h> #include <WebKitSystemInterface/WebKitSystemInterface.h> #include <windowsx.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> #include <wtf/StdLibExtras.h> using namespace std; @@ -192,6 +195,7 @@ private: virtual bool platformCALayerContentsOpaque() const { return false; } virtual bool platformCALayerDrawsContent() const { return false; } virtual void platformCALayerLayerDidDisplay(PlatformLayer*) { } + virtual void platformCALayerDidCreateTiles() { } FullscreenVideoController* m_parent; }; @@ -482,12 +486,10 @@ static String timeToString(float time) void FullscreenVideoController::draw() { - HDC windowDC = GetDC(m_hudWindow); - HDC bitmapDC = CreateCompatibleDC(windowDC); - ::ReleaseDC(m_hudWindow, windowDC); - HGDIOBJ oldBitmap = SelectObject(bitmapDC, m_bitmap.get()); + OwnPtr<HDC> bitmapDC = adoptPtr(CreateCompatibleDC(HWndDC(m_hudWindow))); + HGDIOBJ oldBitmap = SelectObject(bitmapDC.get(), m_bitmap.get()); - GraphicsContext context(bitmapDC, true); + GraphicsContext context(bitmapDC.get(), true); context.save(); @@ -549,12 +551,11 @@ void FullscreenVideoController::draw() SIZE size = { windowWidth, windowHeight }; POINT sourcePoint = {0, 0}; POINT destPoint = { m_hudPosition.x(), m_hudPosition.y() }; - BOOL result = UpdateLayeredWindow(m_hudWindow, 0, &destPoint, &size, bitmapDC, &sourcePoint, 0, &blendFunction, ULW_ALPHA); + BOOL result = UpdateLayeredWindow(m_hudWindow, 0, &destPoint, &size, bitmapDC.get(), &sourcePoint, 0, &blendFunction, ULW_ALPHA); context.restore(); - ::SelectObject(bitmapDC, oldBitmap); - ::DeleteDC(bitmapDC); + ::SelectObject(bitmapDC.get(), oldBitmap); } LRESULT FullscreenVideoController::hudWndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lParam) diff --git a/Source/WebKit/win/WebFrame.cpp b/Source/WebKit/win/WebFrame.cpp index 17bc7311a..f15d3efd5 100644 --- a/Source/WebKit/win/WebFrame.cpp +++ b/Source/WebKit/win/WebFrame.cpp @@ -2604,7 +2604,8 @@ HRESULT WebFrame::stringByEvaluatingJavaScriptInScriptWorld(IWebScriptWorld* iWo return S_OK; JSLock lock(SilenceAssertionsOnly); - String resultString = ustringToString(result.toString(anyWorldGlobalObject->globalExec())); + JSC::ExecState* exec = anyWorldGlobalObject->globalExec(); + String resultString = ustringToString(result.toString(exec)->value(exec)); *evaluationResult = BString(resultString).release(); return S_OK; diff --git a/Source/WebKit/win/WebIconDatabase.cpp b/Source/WebKit/win/WebIconDatabase.cpp index d817f6975..f428bfc76 100644 --- a/Source/WebKit/win/WebIconDatabase.cpp +++ b/Source/WebKit/win/WebIconDatabase.cpp @@ -34,6 +34,7 @@ #include <WebCore/BString.h> #include <WebCore/COMPtr.h> #include <WebCore/FileSystem.h> +#include <WebCore/HWndDC.h> #include <WebCore/IconDatabase.h> #include <WebCore/Image.h> #include <WebCore/PlatformString.h> @@ -284,11 +285,8 @@ HBITMAP createDIB(LPSIZE size) { BitmapInfo bmInfo = BitmapInfo::create(IntSize(*size)); - HDC dc = GetDC(0); - HBITMAP result = CreateDIBSection(dc, &bmInfo, DIB_RGB_COLORS, 0, 0, 0); - ReleaseDC(0, dc); - - return result; + HWndDC dc(0); + return CreateDIBSection(dc, &bmInfo, DIB_RGB_COLORS, 0, 0, 0); } HBITMAP WebIconDatabase::getOrCreateSharedBitmap(LPSIZE size) diff --git a/Source/WebKit/win/WebNodeHighlight.cpp b/Source/WebKit/win/WebNodeHighlight.cpp index 5952723cf..c35d0b6ab 100644 --- a/Source/WebKit/win/WebNodeHighlight.cpp +++ b/Source/WebKit/win/WebNodeHighlight.cpp @@ -33,11 +33,12 @@ #include <WebCore/BitmapInfo.h> #include <WebCore/Color.h> #include <WebCore/GraphicsContext.h> +#include <WebCore/HWndDC.h> #include <WebCore/InspectorController.h> #include <WebCore/Page.h> #include <WebCore/WindowMessageBroadcaster.h> -#include <wtf/OwnPtr.h> #include <wtf/HashSet.h> +#include <wtf/OwnPtr.h> using namespace WebCore; @@ -134,7 +135,7 @@ void WebNodeHighlight::update() { ASSERT(m_overlay); - HDC hdc = ::CreateCompatibleDC(::GetDC(m_overlay)); + HDC hdc = ::CreateCompatibleDC(HWndDC(m_overlay)); if (!hdc) return; @@ -174,8 +175,7 @@ void WebNodeHighlight::update() dstPoint.x = webViewRect.left; dstPoint.y = webViewRect.top; - ::UpdateLayeredWindow(m_overlay, ::GetDC(0), &dstPoint, &size, hdc, &srcPoint, 0, &bf, ULW_ALPHA); - + ::UpdateLayeredWindow(m_overlay, HWndDC(0), &dstPoint, &size, hdc, &srcPoint, 0, &bf, ULW_ALPHA); ::DeleteDC(hdc); } diff --git a/Source/WebKit/win/WebView.cpp b/Source/WebKit/win/WebView.cpp index 57d345821..57acc1318 100644 --- a/Source/WebKit/win/WebView.cpp +++ b/Source/WebKit/win/WebView.cpp @@ -95,6 +95,7 @@ #include <WebCore/GraphicsContext.h> #include <WebCore/HTMLMediaElement.h> #include <WebCore/HTMLNames.h> +#include <WebCore/HWndDC.h> #include <WebCore/HistoryItem.h> #include <WebCore/HitTestRequest.h> #include <WebCore/HitTestResult.h> @@ -331,6 +332,7 @@ bool WebView::s_allowSiteSpecificHacks = false; WebView::WebView() : m_refCount(0) + , m_shouldInvertColors(false) #if !ASSERT_DISABLED , m_deletionHasBegun(false) #endif @@ -862,7 +864,7 @@ void WebView::scrollBackingStore(FrameView* frameView, int dx, int dy, const Int HRGN updateRegion = ::CreateRectRgn(0, 0, 0, 0); // Collect our device context info and select the bitmap to scroll. - HDC windowDC = ::GetDC(m_viewWindow); + HWndDC windowDC(m_viewWindow); HDC bitmapDC = ::CreateCompatibleDC(windowDC); HGDIOBJ oldBitmap = ::SelectObject(bitmapDC, m_backingStoreBitmap->handle()); @@ -888,7 +890,6 @@ void WebView::scrollBackingStore(FrameView* frameView, int dx, int dy, const Int // Clean up. ::SelectObject(bitmapDC, oldBitmap); ::DeleteDC(bitmapDC); - ::ReleaseDC(m_viewWindow, windowDC); } void WebView::sizeChanged(const IntSize& newSize) @@ -958,11 +959,10 @@ void WebView::updateBackingStore(FrameView* frameView, HDC dc, bool backingStore LOCAL_GDI_COUNTER(0, __FUNCTION__); - HDC windowDC = 0; HDC bitmapDC = dc; HGDIOBJ oldBitmap = 0; if (!dc) { - windowDC = ::GetDC(m_viewWindow); + HWndDC windowDC(m_viewWindow); bitmapDC = ::CreateCompatibleDC(windowDC); oldBitmap = ::SelectObject(bitmapDC, m_backingStoreBitmap->handle()); } @@ -996,7 +996,6 @@ void WebView::updateBackingStore(FrameView* frameView, HDC dc, bool backingStore if (!dc) { ::SelectObject(bitmapDC, oldBitmap); ::DeleteDC(bitmapDC); - ::ReleaseDC(m_viewWindow, windowDC); } GdiFlush(); @@ -1008,7 +1007,7 @@ void WebView::performLayeredWindowUpdate() if (!m_backingStoreBitmap) return; - HDC hdcScreen = ::GetDC(m_viewWindow); + HWndDC hdcScreen(m_viewWindow); OwnPtr<HDC> hdcMem = adoptPtr(::CreateCompatibleDC(hdcScreen)); HBITMAP hbmOld = static_cast<HBITMAP>(::SelectObject(hdcMem.get(), m_backingStoreBitmap->handle())); @@ -1026,7 +1025,6 @@ void WebView::performLayeredWindowUpdate() ::UpdateLayeredWindow(m_viewWindow, hdcScreen, 0, &windowSize, hdcMem.get(), &layerPos, 0, &blendFunction, ULW_ALPHA); ::SelectObject(hdcMem.get(), hbmOld); - ::ReleaseDC(0, hdcScreen); } void WebView::paint(HDC dc, LPARAM options) @@ -1132,13 +1130,14 @@ void WebView::paintIntoBackingStore(FrameView* frameView, HDC bitmapDC, const In RECT rect = dirtyRect; #if FLASH_BACKING_STORE_REDRAW - HDC dc = ::GetDC(m_viewWindow); - OwnPtr<HBRUSH> yellowBrush(CreateSolidBrush(RGB(255, 255, 0))); - FillRect(dc, &rect, yellowBrush.get()); - GdiFlush(); - Sleep(50); - paintIntoWindow(bitmapDC, dc, dirtyRect); - ::ReleaseDC(m_viewWindow, dc); + { + HWndDC dc(m_viewWindow); + OwnPtr<HBRUSH> yellowBrush(CreateSolidBrush(RGB(255, 255, 0))); + FillRect(dc, &rect, yellowBrush.get()); + GdiFlush(); + Sleep(50); + paintIntoWindow(bitmapDC, dc, dirtyRect); + } #endif GraphicsContext gc(bitmapDC, m_transparent); @@ -1156,6 +1155,8 @@ void WebView::paintIntoBackingStore(FrameView* frameView, HDC bitmapDC, const In if (frameView && frameView->frame() && frameView->frame()->contentRenderer()) { gc.clip(dirtyRect); frameView->paint(&gc, dirtyRect); + if (m_shouldInvertColors) + gc.fillRect(dirtyRect, Color::white, ColorSpaceDeviceRGB, CompositeDifference); } gc.restore(); } @@ -6630,12 +6631,12 @@ void WebView::paintContents(const GraphicsLayer*, GraphicsContext& context, Grap context.restore(); } -bool WebView::showDebugBorders() const +bool WebView::showDebugBorders(const GraphicsLayer*) const { return m_page->settings()->showDebugBorders(); } -bool WebView::showRepaintCounter() const +bool WebView::showRepaintCounter(const GraphicsLayer*) const { return m_page->settings()->showRepaintCounter(); } diff --git a/Source/WebKit/win/WebView.h b/Source/WebKit/win/WebView.h index 1bdec21c7..7d2a6e2f9 100644 --- a/Source/WebKit/win/WebView.h +++ b/Source/WebKit/win/WebView.h @@ -994,13 +994,15 @@ 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& inClip); - virtual bool showDebugBorders() const; - virtual bool showRepaintCounter() const; + virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const; + virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const; // CACFLayerTreeHostClient virtual void flushPendingGraphicsLayerChanges(); #endif + bool m_shouldInvertColors; + protected: static bool registerWebViewWindowClass(); static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); diff --git a/Source/WebKit/wx/ChangeLog b/Source/WebKit/wx/ChangeLog index de7e0e0ff..b45b35005 100644 --- a/Source/WebKit/wx/ChangeLog +++ b/Source/WebKit/wx/ChangeLog @@ -1,3 +1,32 @@ +2012-01-30 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Unreviewed. Build fix, add JavaScriptCore/runtime + to include dirs. + + * bindings/python/wscript: + +2012-01-26 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Unreviewed. + Build fixes after UndoStep and ChromeClient changes. + + * WebFrame.cpp: + (wxWebFrame::RunScript): + * WebKitSupport/ChromeClientWx.cpp: + (WebCore): + (WebCore::ChromeClientWx::hasOpenedPopup): + * WebKitSupport/ChromeClientWx.h: + (ChromeClientWx): + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::registerUndoStep): + (WebCore::EditorClientWx::registerRedoStep): + (WebCore::EditorClientWx::undo): + (WebCore::EditorClientWx::redo): + * WebKitSupport/EditorClientWx.h: + (EditorClientWx): + * WebViewPrivate.h: + (WebViewPrivate): + 2011-12-16 Ryosuke Niwa <rniwa@webkit.org> Rename registerCommandFor(Undo|Redo) to register(Undo|Redo)Step diff --git a/Source/WebKit/wx/WebFrame.cpp b/Source/WebKit/wx/WebFrame.cpp index feda7f903..2c9cb68e0 100644 --- a/Source/WebKit/wx/WebFrame.cpp +++ b/Source/WebKit/wx/WebFrame.cpp @@ -384,8 +384,10 @@ wxString wxWebFrame::RunScript(const wxString& javascript) wxASSERT_MSG(jsEnabled, wxT("RunScript requires JavaScript to be enabled.")); if (jsEnabled) { JSC::JSValue result = controller->executeScript(javascript, true).jsValue(); - if (result) - returnValue = wxString(result.toString(m_impl->frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec()).utf8().data(), wxConvUTF8); + if (result) { + JSC::ExecState* exec = m_impl->frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec(); + returnValue = wxString(result.toString(exec)->value(exec).utf8().data(), wxConvUTF8); + } } } } diff --git a/Source/WebKit/wx/WebKitSupport/ChromeClientWx.cpp b/Source/WebKit/wx/WebKitSupport/ChromeClientWx.cpp index f3fca1399..bc9872414 100644 --- a/Source/WebKit/wx/WebKitSupport/ChromeClientWx.cpp +++ b/Source/WebKit/wx/WebKitSupport/ChromeClientWx.cpp @@ -490,5 +490,11 @@ PassRefPtr<SearchPopupMenu> ChromeClientWx::createSearchPopupMenu(PopupMenuClien { return adoptRef(new SearchPopupMenuWx(client)); } + +bool ChromeClientWx::hasOpenedPopup() const +{ + notImplemented(); + return false; +} } diff --git a/Source/WebKit/wx/WebKitSupport/ChromeClientWx.h b/Source/WebKit/wx/WebKitSupport/ChromeClientWx.h index 5a704e18e..dcd164f34 100644 --- a/Source/WebKit/wx/WebKitSupport/ChromeClientWx.h +++ b/Source/WebKit/wx/WebKitSupport/ChromeClientWx.h @@ -151,6 +151,8 @@ public: virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const { return true; } virtual void numWheelEventHandlersChanged(unsigned) { } + + virtual bool hasOpenedPopup() const; private: wxWebView* m_webView; diff --git a/Source/WebKit/wx/WebKitSupport/EditorClientWx.cpp b/Source/WebKit/wx/WebKitSupport/EditorClientWx.cpp index e8cf31dbb..81d54f813 100644 --- a/Source/WebKit/wx/WebKitSupport/EditorClientWx.cpp +++ b/Source/WebKit/wx/WebKitSupport/EditorClientWx.cpp @@ -276,27 +276,25 @@ void EditorClientWx::didSetSelectionTypesForPasteboard() notImplemented(); } -void EditorClientWx::registerUndoStep(PassRefPtr<EditCommand> command) +void EditorClientWx::registerUndoStep(PassRefPtr<UndoStep> step) { Frame* frame = m_page->focusController()->focusedOrMainFrame(); if (frame) { wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); - if (webKitWin) { - webKitWin->m_impl->undoStack.append(EditCommandWx(command)); - } + if (webKitWin) + webKitWin->m_impl->undoStack.append(step); } } -void EditorClientWx::registerRedoStep(PassRefPtr<EditCommand> command) +void EditorClientWx::registerRedoStep(PassRefPtr<UndoStep> step) { Frame* frame = m_page->focusController()->focusedOrMainFrame(); if (frame) { wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); - if (webKitWin) { - webKitWin->m_impl->redoStack.insert(0, EditCommandWx(command)); - } + if (webKitWin) + webKitWin->m_impl->redoStack.append(step); } } @@ -356,8 +354,8 @@ void EditorClientWx::undo() if (frame) { wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); if (webKitWin) { - webKitWin->m_impl->undoStack.last().editCommand()->unapply(); - webKitWin->m_impl->undoStack.removeLast(); + webKitWin->m_impl->undoStack.last()->unapply(); + webKitWin->m_impl->undoStack.remove(--webKitWin->m_impl->undoStack.end()); } } } @@ -369,8 +367,8 @@ void EditorClientWx::redo() if (frame) { wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); if (webKitWin) { - webKitWin->m_impl->redoStack.last().editCommand()->reapply(); - webKitWin->m_impl->redoStack.removeLast(); + webKitWin->m_impl->redoStack.last()->reapply(); + webKitWin->m_impl->redoStack.remove(--webKitWin->m_impl->redoStack.end()); } } } diff --git a/Source/WebKit/wx/WebKitSupport/EditorClientWx.h b/Source/WebKit/wx/WebKitSupport/EditorClientWx.h index 1387fb80c..d1403d17f 100644 --- a/Source/WebKit/wx/WebKitSupport/EditorClientWx.h +++ b/Source/WebKit/wx/WebKitSupport/EditorClientWx.h @@ -77,8 +77,8 @@ public: virtual void didWriteSelectionToPasteboard(); virtual void didSetSelectionTypesForPasteboard(); - virtual void registerUndoStep(PassRefPtr<EditCommand>); - virtual void registerRedoStep(PassRefPtr<EditCommand>); + virtual void registerUndoStep(PassRefPtr<UndoStep>); + virtual void registerRedoStep(PassRefPtr<UndoStep>); virtual void clearUndoRedoOperations(); virtual bool canCopyCut(Frame*, bool defaultValue) const; diff --git a/Source/WebKit/wx/WebViewPrivate.h b/Source/WebKit/wx/WebViewPrivate.h index 989a5794d..3d74db7d7 100644 --- a/Source/WebKit/wx/WebViewPrivate.h +++ b/Source/WebKit/wx/WebViewPrivate.h @@ -30,10 +30,10 @@ #define WXWEBVIEWPRIVATE_H #include "config.h" -#include "EditCommand.h" -#include "EditCommandWx.h" +#include "UndoStep.h" #include "Page.h" -#include "wtf/Vector.h" +#include "wtf/Deque.h" +#include "wtf/RefPtr.h" #include <wx/timer.h> @@ -49,8 +49,8 @@ public: wxTimer tripleClickTimer; wxPoint tripleClickPos; - WTF::Vector<EditCommandWx> undoStack; - WTF::Vector<EditCommandWx> redoStack; + WTF::Deque<WTF::RefPtr<WebCore::UndoStep> > undoStack; + WTF::Deque<WTF::RefPtr<WebCore::UndoStep> > redoStack; }; #endif diff --git a/Source/WebKit/wx/bindings/python/wscript b/Source/WebKit/wx/bindings/python/wscript index 5e1dfc1eb..c76a6f3f1 100644 --- a/Source/WebKit/wx/bindings/python/wscript +++ b/Source/WebKit/wx/bindings/python/wscript @@ -31,6 +31,7 @@ import Options include_paths = [ os.path.join(wk_root, 'Source', 'JavaScriptCore'), + os.path.join(wk_root, 'Source', 'JavaScriptCore', 'runtime'), os.path.join(wk_root, 'Source', 'WebCore', 'bindings', 'cpp'), os.path.join(wk_root, 'Source', 'WebCore', 'DerivedSources'), os.path.join(wk_root, 'Source', 'WebKit', 'wx'), |