diff options
Diffstat (limited to 'Source/WebKit/chromium')
102 files changed, 3531 insertions, 1590 deletions
diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index 4b8508c40..b373ff1c0 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,1099 @@ +2012-05-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r116727. + http://trac.webkit.org/changeset/116727 + https://bugs.webkit.org/show_bug.cgi?id=86181 + + Build error on Chromium-Android (Requested by tkent on + #webkit). + + * public/WebMediaPlayer.h: + (WebMediaPlayer): + (WebKit::WebMediaPlayer::enterFullscreen): + (WebKit::WebMediaPlayer::exitFullscreen): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::enterFullscreen): + (WebKit::WebMediaPlayerClientImpl::exitFullscreen): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::enterFullScreenForElement): + +2012-05-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r116731. + http://trac.webkit.org/changeset/116731 + https://bugs.webkit.org/show_bug.cgi?id=86178 + + Build failure on Chromium-mac (Requested by tkent on #webkit). + + * tests/CCLayerTreeHostImplTest.cpp: + (WebKitTests::CCLayerTreeHostImplTest::CCLayerTreeHostImplTest): + (WebKitTests::TEST_F): + * tests/LayerRendererChromiumTest.cpp: + (FakeLayerRendererChromium::FakeLayerRendererChromium): + (LayerRendererChromiumTest::LayerRendererChromiumTest): + (TEST): + +2012-05-10 David Reveman <reveman@chromium.org> + + [Chromium] Move instantiation of texture uploader to LayerRendererChromium. + https://bugs.webkit.org/show_bug.cgi?id=85893 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + (WebKitTests::CCLayerTreeHostImplTest::CCLayerTreeHostImplTest): + (WebKitTests::TEST_F): + * tests/LayerRendererChromiumTest.cpp: + (FakeLayerRendererChromium::FakeLayerRendererChromium): + (LayerRendererChromiumTest::LayerRendererChromiumTest): + (TEST): + +2012-05-10 Min Qin <qinmin@google.com> + + split MediaPlayer::enterFullscreen into 2 seperate functions + https://bugs.webkit.org/show_bug.cgi?id=86052 + + Reviewed by Benjamin Poulain. + + It is confusing that enterFullscreen returns a boolean while exitFullscreen does + not do the same. And ios does not need the return value. + So remove the return value on enterFullscreen and make a seperate canEnterFullscreen() + function for android. + No behavior change, just refactoring. + + * public/WebMediaPlayer.h: + (WebMediaPlayer): + (WebKit::WebMediaPlayer::enterFullscreen): + (WebKit::WebMediaPlayer::canEnterFullscreen): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::enterFullscreen): + (WebKit): + (WebKit::WebMediaPlayerClientImpl::exitFullscreen): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::enterFullScreenForElement): + +2012-05-10 Hajime Morrita <morrita@google.com> + + WebKit should support tab-size. + https://bugs.webkit.org/show_bug.cgi?id=52994 + + Reviewed by Simon Fraser. + + * src/WebTextRun.cpp: + (WebKit::WebTextRun::operator WebCore::TextRun): + +2012-05-10 Kent Tamura <tkent@chromium.org> + + Unreviewed, rolling out r116594. + http://trac.webkit.org/changeset/116594 + https://bugs.webkit.org/show_bug.cgi?id=86013 + + r116594 might have made some composition tests flaky. + + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTestTickAnimationWhileBackgrounded::animateLayers): + (WTF): + (WTF::TEST_F): + +2012-05-10 Jian Li <jianli@chromium.org> + + Unreviewed. Fix chromium build break. + + * src/LocalizedStrings.cpp: + (WebCore::insecurePluginVersionText): + +2012-05-10 Michael Nordman <michaeln@google.com> + + [chromium] DomStorage events handling needs TLC (2) + https://bugs.webkit.org/show_bug.cgi?id=85221 + Alter the WebStorageArea virtual interface such that the mutators no longer + return old values. This is to allow implementations of the interface to operate + more asynchronously. + + Also clean up from the last patch, remove support for the DEPRECATED event + dispatching API. + + Reviewed by Adam Barth. + + * WebKit.gyp: delete three files indicated below + * public/WebStorageArea.h: + (WebKit::WebStorageArea::setItem): no longer returns the old value + (WebKit::WebStorageArea::removeItem): no longer returns the old value + (WebKit::WebStorageArea::clear): no longer returns a bool indicated if something was cleared + * public/WebStorageEventDispatcher.h: removed the DEPRECATED instance methods + * public/WebStorageNamespace.h: removed the DEPRECATED close() method + * public/platform/WebKitPlatformSupport.h: removed the DEPRECATED dispatchStorageEvent() method + * src/StorageAreaProxy.cpp: removed the DEPREACTED storageEvent() method + (WebCore::StorageAreaProxy::setItem): no return value + (WebCore::StorageAreaProxy::removeItem): no return value + (WebCore::StorageAreaProxy::clear): no return value + (WebCore::StorageAreaProxy::dispatchLocalStorageEvent): remove an early return thats no longer needed + (WebCore::findPageWithSessionStorageNamespace): switched to passing pageGroup by ptr value instead of by name + (WebCore::StorageAreaProxy::dispatchSessionStorageEvent): remove an early return thats no longer needed + * src/StorageAreaProxy.h: + (WebCore): + (StorageAreaProxy): + * src/StorageEventDispatcherImpl.cpp: Deleted the file. + * src/StorageEventDispatcherImpl.h: Deleted the file. + * src/WebStorageEventDispatcherImpl.cpp: Deleted the DEPRECATED instance methods. + (WebKit::WebStorageEventDispatcher::dispatchLocalStorageEvent): use WebViewImpl::defaultPageGroup + (WebKit::WebStorageEventDispatcher::dispatchSessionStorageEvent): use WebViewImpl::defaultPageGroup + * src/WebStorageEventDispatcherImpl.h: Deleted the file. + * src/WebViewImpl.cpp: added a static method to retrieve a ptr to the default page group, + (WebKit::WebViewImpl::defaultPageGroup): + * src/WebViewImpl.h: + + +2012-05-10 Anders Carlsson <andersca@apple.com> + + Add insecurePluginVersionText stub here too. + + * src/LocalizedStrings.cpp: + +2012-05-10 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Call addTraceEvent and getTraceCategoryEnabledFlag directly + https://bugs.webkit.org/show_bug.cgi?id=85399 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * src/PlatformSupport.cpp: + (WebCore): + +2012-05-10 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Remove WEBKIT_USING_SKIA ifdefs that are always true + https://bugs.webkit.org/show_bug.cgi?id=86121 + + Reviewed by Adam Barth. + + Chromium always uses Skia now, so this just removes the barriers + around code that was previously #if'd. + + * README: + * src/DragClientImpl.cpp: + (WebKit::DragClientImpl::startDrag): + * src/PageOverlay.cpp: + * src/PlatformSupport.cpp: + (WebCore::PlatformSupport::clipboardWriteImage): + (WebCore::PlatformSupport::paintScrollbarThumb): + * src/WebContentLayerImpl.cpp: + (WebKit::WebContentLayerImpl::paintContents): + * src/WebFontImpl.cpp: + (WebKit::WebFontImpl::drawText): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::printPage): + (WebKit::WebFrameImpl::printPagesWithBoundaries): + * src/WebGraphicsContext3D.cpp: + (WebKit::WebGraphicsContext3D::createGrGLInterface): + * src/WebImageDecoder.cpp: + (WebKit::WebImageDecoder::getFrameAtIndex): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::paint): + (WebKit::WebPluginContainerImpl::printPage): + * src/painting/GraphicsContextBuilder.h: + (WebKit): + +2012-05-10 Tom Sepez <tsepez@chromium.org> + + [Chromium] WebFrameTest.ChromePageNoJavascript isn't catching regressions + https://bugs.webkit.org/show_bug.cgi?id=86046 + + Reviewed by Adam Barth. + + Test both cases for registerURLSchemeAsNotAllowingJavascriptURLs. Also add + a call to layout() to ensure the javascript result is seen. + + * tests/WebFrameTest.cpp: + (WebKit::TEST_F): + (WebKit): + +2012-05-10 Varun Jain <varunjain@google.com> + + [chromium] Trigger context menu for long press gesture + https://bugs.webkit.org/show_bug.cgi?id=85919 + + Reviewed by Adam Barth. + + * src/PageWidgetDelegate.cpp: + (WebKit::PageWidgetDelegate::handleInputEvent): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleGestureEvent): + +2012-05-10 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Remove dead code behind unused WEBKIT_USING_CG + https://bugs.webkit.org/show_bug.cgi?id=86018 + + Reviewed by Adam Barth. + + We never use CoreGraphics as the backend for GraphicsContext in + Chromium, so this is all dead code. + + * README: + * src/PageOverlay.cpp: + * src/WebContentLayerImpl.cpp: + (WebKit::WebContentLayerImpl::paintContents): + * src/WebFontImpl.cpp: + (WebKit::WebFontImpl::drawText): + * src/WebImageDecoder.cpp: + (WebKit::WebImageDecoder::getFrameAtIndex): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::paint): + (WebKit::WebPluginContainerImpl::printPage): + * src/painting/GraphicsContextBuilder.h: + (WebKit): + +2012-05-10 Sam D <dsam2912@gmail.com> + + Web Inspector: rename InspectorBackendStub.js to InspectorBackendCommands.js + https://bugs.webkit.org/show_bug.cgi?id=72306 + + Changed name for InspectorBackendStub.js to InspectorBackendCommands.js + + Reviewed by Yury Semikhatsky. + + * WebKit.gyp: + +2012-05-09 Kent Tamura <tkent@chromium.org> + + [Chromium] Mark CCLayerTreeHostTestSetNeedsCommit2.runMultiThread and + CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity.runMultiThread flaky. + + * tests/CCLayerTreeHostTest.cpp: + +2012-05-09 Dan Alcantara <dfalcantara@chromium.org> + + [chromium] Add ability to override user agent string per-WebFrameClient + https://bugs.webkit.org/show_bug.cgi?id=83959 + + Reviewed by Adam Barth. + + Adds a method that can be used to override the normal user agent in + chromium. Also adds a unit test to check if the override is taking effect. + + * WebKit.gypi: + * public/WebFrameClient.h: + (WebFrameClient): + (WebKit::WebFrameClient::userAgent): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::userAgent): + * tests/FrameLoaderClientImplTest.cpp: Added. + (WebKit): + (TestWebFrameClient): + (WebKit::TestWebFrameClient::setUserAgentOverride): + (FrameLoaderClientImplTest): + (WebKit::FrameLoaderClientImplTest::SetUp): + (WebKit::FrameLoaderClientImplTest::TearDown): + (WebKit::FrameLoaderClientImplTest::setUserAgentOverride): + (WebKit::FrameLoaderClientImplTest::userAgent): + (WebKit::TEST_F): + +2012-05-09 Charlie Reis <creis@chromium.org> + + Add dispatchMessageEventWithOriginCheck to WebFrame + https://bugs.webkit.org/show_bug.cgi?id=85815 + + Reviewed by Adam Barth. + + Tested by WebFrameTest.DispatchMessageEventWithOriginCheck. + Also fixes source frame bug in willCheckAndDispatchMessageEvent. + + * public/WebFrame.h: + (WebFrame): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::willCheckAndDispatchMessageEvent): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::checkAndDispatchMessageEvent): + (WebKit): + * src/WebFrameImpl.h: + (WebFrameImpl): + +2012-05-09 Hironori Bono <hbono@chromium.org> + + Fix a crash in ContextMenuClientImpl::getCustomMenuFromDefaultItems + https://bugs.webkit.org/show_bug.cgi?id=85866 + + Reviewed by Ryosuke Niwa. + + DocumentMarkerController::markersInRange crashes if the input range is NULL. + This change adds a NULL check before getCustomMenuFromDefaultItems() calls this + function to avoid this crash. + + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): Added a NULL check. + +2012-05-09 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r116602. + http://trac.webkit.org/changeset/116602 + https://bugs.webkit.org/show_bug.cgi?id=86057 + + Build error on Windows (Requested by tkent on #webkit). + + * WebKit.gypi: + * public/WebFrameClient.h: + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::userAgent): + * tests/FrameLoaderClientImplTest.cpp: Removed. + +2012-05-09 Kent Tamura <tkent@chromium.org> + + [Chromium] Fix compilation warning on Android. + https://bugs.webkit.org/show_bug.cgi?id=85958 + + * features.gypi: Move ENABLE_MEDIA_CAPTURE=0 to non-Android block. + +2012-05-09 Dan Alcantara <dfalcantara@chromium.org> + + [chromium] Add ability to override user agent string per-WebFrameClient + https://bugs.webkit.org/show_bug.cgi?id=83959 + + Reviewed by Adam Barth. + + Adds a method that can be used to override the normal user agent in + chromium. Also adds a unit test to check if the override is taking effect. + + * WebKit.gypi: + * public/WebFrameClient.h: + (WebFrameClient): + (WebKit::WebFrameClient::userAgent): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::userAgent): + * tests/FrameLoaderClientImplTest.cpp: Added. + (WebKit): + (TestWebFrameClient): + (WebKit::TestWebFrameClient::setUserAgentOverride): + (FrameLoaderClientImplTest): + (WebKit::FrameLoaderClientImplTest::SetUp): + (WebKit::FrameLoaderClientImplTest::TearDown): + (WebKit::FrameLoaderClientImplTest::setUserAgentOverride): + (WebKit::FrameLoaderClientImplTest::userAgent): + (WebKit::TEST_F): + +2012-05-09 Ian Vollick <vollick@chromium.org> + + [chromium] Ensure animations get ticked at least once when added. + https://bugs.webkit.org/show_bug.cgi?id=86013 + + Reviewed by James Robinson. + + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTestTickAnimationWhileBackgrounded::animateLayers): + (WTF): + +2012-05-09 Adam Barth <abarth@webkit.org> + + Implement HTML Media Capture + https://bugs.webkit.org/show_bug.cgi?id=85958 + + Reviewed by Eric Seidel. + + * features.gypi: + * public/WebFileChooserParams.h: + (WebFileChooserParams): + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::runOpenPanel): + +2012-05-09 Dana Jansens <danakj@chromium.org> + + [chromium] Don't draw when canDraw() is false + https://bugs.webkit.org/show_bug.cgi?id=85829 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + (WebKitTests::CCLayerTreeHostImplTest::CCLayerTreeHostImplTest): + (WebKitTests::TEST_F): + * tests/CCLayerTreeHostTest.cpp: + (WTF): + (CCLayerTreeHostTestCanDrawBlocksDrawing): + (WTF::CCLayerTreeHostTestCanDrawBlocksDrawing::CCLayerTreeHostTestCanDrawBlocksDrawing): + (WTF::CCLayerTreeHostTestCanDrawBlocksDrawing::beginTest): + (WTF::CCLayerTreeHostTestCanDrawBlocksDrawing::commitCompleteOnCCThread): + (WTF::CCLayerTreeHostTestCanDrawBlocksDrawing::drawLayersOnCCThread): + (WTF::CCLayerTreeHostTestCanDrawBlocksDrawing::didCommitAndDrawFrame): + (WTF::CCLayerTreeHostTestCanDrawBlocksDrawing::afterTest): + (WTF::TEST_F): + +2012-05-09 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r116573. + http://trac.webkit.org/changeset/116573 + https://bugs.webkit.org/show_bug.cgi?id=86038 + + Broke the Chromium Mac compile (Requested by ojan_gardening on + #webkit). + + * public/WebPlugin.h: + (WebPlugin): + +2012-05-09 Fady Samuel <fsamuel@chromium.org> + + [Chromium] Expose WebPluginContainer of WebPlugin to embedder + https://bugs.webkit.org/show_bug.cgi?id=85916 + + Reviewed by Darin Fisher. + + The browser plugin needs to access its current guest's WebPluginContainer + so that it can replace the guest with another guest WebPlugin when navigating + across processes. + + * public/WebPlugin.h: + (WebPlugin): + (WebKit::WebPlugin::container): + +2012-05-09 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Move clipboard to Platform.h + https://bugs.webkit.org/show_bug.cgi?id=85758 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * WebKit.gyp: + * public/platform/WebClipboard.h: + * public/platform/WebDragData.h: + * public/platform/WebImage.h: + * public/platform/WebKitPlatformSupport.h: + (WebKit): + (WebKitPlatformSupport): + * src/AssertMatchingEnums.cpp: + * src/DragClientImpl.cpp: + * src/PlatformSupport.cpp: + * src/WebDragData.cpp: + * src/WebImageCG.cpp: + * src/WebImageDecoder.cpp: + * src/WebImageSkia.cpp: + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::copy): + * src/WebViewImpl.cpp: + +2012-05-09 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Remove PlatformSupport::loadPlatformImageResource, call loadResource directly + https://bugs.webkit.org/show_bug.cgi?id=84417 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * src/PlatformSupport.cpp: + (WebCore): + +2012-05-09 Jochen Eisinger <jochen@chromium.org> + + [chromium] remove the obsolete WebFrame::referrerPolicy method + https://bugs.webkit.org/show_bug.cgi?id=86003 + + Reviewed by Adam Barth. + + * public/WebFrame.h: + * src/WebFrameImpl.cpp: + * src/WebFrameImpl.h: + (WebFrameImpl): + +2012-05-09 Jochen Eisinger <jochen@chromium.org> + + [chromium] Check whether an active document loader exists before accessing it + https://bugs.webkit.org/show_bug.cgi?id=85892 + + Reviewed by Eric Seidel. + + Although FrameLoader::loadInSameDocument which invokes this + method does not have a provisional document loader, we're seeing crashes + where the FrameLoader is in provisional state, and thus + activeDocumentLoader returns 0. Lacking any understanding of how this + can happen, we do this check here to avoid crashing. + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchDidNavigateWithinPage): + +2012-05-09 Ian Vollick <vollick@chromium.org> + + [chromium] Add impl-thread support for fill-mode and direction css animation properties + https://bugs.webkit.org/show_bug.cgi?id=77662 + + Reviewed by James Robinson. + + * tests/CCActiveAnimationTest.cpp: + (WebCore::TEST): + (WebCore): + * tests/CCLayerAnimationControllerTest.cpp: + (WebKitTests::TEST): + (WebKitTests): + +2012-05-09 Ojan Vafai <ojan@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-05-09 Marcus Bulach <bulach@chromium.org> + + [chromium] Exposes OrientationChangeEvent. + https://bugs.webkit.org/show_bug.cgi?id=85976 + + Reviewed by Adam Barth. + + This is used by the android port, we need to expose the existing + WebCore API. + + * public/WebFrame.h: + (WebFrame): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::sendOrientationChangeEvent): + (WebKit): + * src/WebFrameImpl.h: + (WebFrameImpl): + +2012-05-09 Dana Jansens <danakj@chromium.org> + + Early-out and avoid any copying when possible for Region operations + https://bugs.webkit.org/show_bug.cgi?id=85260 + + Reviewed by Anders Carlsson. + + * tests/RegionTest.cpp: + (WebCore::TEST): + (WebCore): + +2012-05-09 Tommy Widenflycht <tommyw@google.com> + + [chromium] MediaStream API: Fixing a memory leak in WebUserMediaRequest + https://bugs.webkit.org/show_bug.cgi?id=85992 + + Reviewed by Adam Barth. + + * src/WebUserMediaRequest.cpp: + (WebKit::WebUserMediaRequest::assign): + +2012-05-09 Kent Tamura <tkent@chromium.org> + + [Chromium] Disable WebViewTest.TextInputType because the test is incomplete. + + * tests/WebViewTest.cpp: + +2012-05-09 Kent Tamura <tkent@chromium.org> + + [Chromium] Some of *.runMultiThread tests intermittently crash. + Mark them flaky. + + * tests/CCLayerTreeHostTest.cpp: + +2012-05-09 Oli Lan <olilan@chromium.org> + + Adds date/time input types to WebTextInputType, and adds support for these + to WebViewImpl.textInputType(). + + Adds a new test WebViewTest.TextInputType to test WebViewImpl.textInputType(), + including the new types. + + https://bugs.webkit.org/show_bug.cgi?id=78746 + + Reviewed by Kent Tamura. + + * public/WebTextInputType.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::textInputType): + * tests/WebViewTest.cpp: + (WebViewTest): + (WebKit::WebViewTest::testTextInputType): + (WebKit): + (WebKit::TEST_F): + * tests/data/input_field_date.html: Added. + * tests/data/input_field_datetime.html: Added. + * tests/data/input_field_default.html: Added. + * tests/data/input_field_email.html: Added. + * tests/data/input_field_number.html: Added. + * tests/data/input_field_search.html: Added. + * tests/data/input_field_time.html: Added. + * tests/data/input_field_week.html: Added. + +2012-05-08 Jochen Eisinger <jochen@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-05-08 Dana Jansens <danakj@chromium.org> + + [chromium] Show borders for partial-draw-culled quads to visualize culling behaviour + https://bugs.webkit.org/show_bug.cgi?id=85414 + + Reviewed by Adrienne Walker. + + * tests/CCQuadCullerTest.cpp: + (WebCore::appendQuads): + * tests/MockCCQuadCuller.h: + (WebCore::MockCCQuadCuller::MockCCQuadCuller): + +2012-05-08 Tony Chang <tony@chromium.org> + + [chromium] force ENABLE_REGISTER_PROTOCOL_HANDLER=1 in features.gypi + https://bugs.webkit.org/show_bug.cgi?id=85924 + + Reviewed by Adam Barth. + + This has been enabled for a few months on Chromium trunk so remove the + ability to turn it off via a gyp flag. This simplifies features.gypi. + + * features.gypi: + +2012-05-08 Dana Jansens <danakj@chromium.org> + + [chromium] Reflections with masks should not occlude + https://bugs.webkit.org/show_bug.cgi?id=85927 + + Reviewed by James Robinson. + + * tests/CCOcclusionTrackerTest.cpp: + (WebKitTests::CCOcclusionTrackerTest::TearDown): + (WebKitTests::CCOcclusionTrackerTest::createMaskLayer): + (CCOcclusionTrackerTest): + (WebKitTests::CCOcclusionTrackerTest::setMask): + (CCOcclusionTrackerTestReplicaWithMask): + (WebKitTests::CCOcclusionTrackerTestReplicaWithMask::runMyTest): + (WebKitTests): + +2012-05-08 Dana Jansens <danakj@chromium.org> + + Region reads past end of spans + https://bugs.webkit.org/show_bug.cgi?id=85909 + + Reviewed by Anders Carlsson. + + * tests/RegionTest.cpp: + (WebCore::TEST): + (WebCore): + +2012-05-08 Tony Chang <tony@chromium.org> + + move listener_leak_test to webkit_unit_tests + https://bugs.webkit.org/show_bug.cgi?id=85922 + + Reviewed by Ojan Vafai. + + Porting the test from src/webkit/tools/test_shell/listener_leak_test.cc. + All I did was change the style and use the FrameTestHelper to load the file. + + * WebKit.gyp: Exclude file in components build. + * WebKit.gypi: Add new file. + * tests/ListenerLeakTest.cpp: Added. + (WebKit): + (WebKit::GetProperty): + (WebKit::GetNumObjects): + (ListenerLeakTest): + (WebKit::ListenerLeakTest::ListenerLeakTest): + (WebKit::ListenerLeakTest::RunTest): + (WebKit::TEST_F): + * tests/data/listener/listener_leak1.html: Added. + * tests/data/listener/listener_leak2.html: Added. + +2012-05-08 W. James MacLean <wjmaclean@chromium.org> + + [chromium] Create LinkHighlightLayerChromium class to provide link-highlight preview animations for GraphicsLayerChromium. + https://bugs.webkit.org/show_bug.cgi?id=85084 + + Reviewed by James Robinson. + + * WebKit.gypi: + * tests/LinkHighlightTest.cpp: Added. + (WebCore): + (MockGraphicsLayerClient): + (WebCore::MockGraphicsLayerClient::notifyAnimationStarted): + (WebCore::MockGraphicsLayerClient::notifySyncRequired): + (WebCore::MockGraphicsLayerClient::paintContents): + (WebCore::MockGraphicsLayerClient::showDebugBorders): + (WebCore::MockGraphicsLayerClient::showRepaintCounter): + (WebCore::TEST): + +2012-05-08 Tony Chang <tony@chromium.org> + + [chromium] move event_listener_unittest to webkit_unit_tests + https://bugs.webkit.org/show_bug.cgi?id=85836 + + Reviewed by James Robinson. + + Porting the test from src/webkit/tools/test_shell/event_listener_unittest.cc. + All I did was change the style and use the FrameTestHelper to load the file. + + * WebKit.gyp: Exclude file in components build. + * WebKit.gypi: Add new file. + * tests/EventListenerTest.cpp: Added. + (WebKit): + (TestWebDOMEventListener): + (WebKit::TestWebDOMEventListener::TestWebDOMEventListener): + (WebKit::TestWebDOMEventListener::~TestWebDOMEventListener): + (WebKit::TestWebDOMEventListener::eventCount): + (WebKit::TestWebDOMEventListener::eventAt): + (WebKit::TestWebDOMEventListener::clearEvents): + (WebDOMEventListenerTest): + (WebKit::WebDOMEventListenerTest::WebDOMEventListenerTest): + (WebKit::WebDOMEventListenerTest::SetUp): + (WebKit::WebDOMEventListenerTest::TearDown): + (WebKit::WebDOMEventListenerTest::mainFrame): + (WebKit::WebDOMEventListenerTest::document): + (WebKit::WebDOMEventListenerTest::executeScript): + (WebKit::WebDOMEventListenerTest::GetNodeID): + (WebKit::TEST_F): + * tests/data/listener/mutation_event_listener.html: Added. + +2012-05-07 Kinuko Yasuda <kinuko@chromium.org> + + Unreviewed build fix: didOpenFileSystem hides overloaded virtual function + + * src/WorkerAsyncFileSystemChromium.cpp: + +2012-05-07 Kinuko Yasuda <kinuko@chromium.org> + + Unreviewed build fix: adding missing include. + + * src/AsyncFileSystemChromium.cpp: + +2012-05-07 Kinuko Yasuda <kinuko@chromium.org> + + Support cross-filesystem operations in FileSystem API + https://bugs.webkit.org/show_bug.cgi?id=84135 + + Reviewed by David Levin. + + Currently we pass Entry's fullPath to AsyncFileSystem layer where + we convert the given path to filesystem URL which includes origin and + filesystem type information, but in that way we cannot handle + cross-filesystem operations (e.g. cross-filesystem copy and move) + well since we end up with always attaching the source filesystem's + origin and type information for argument paths. + + This patch does: + - move filesystem-type related code out of AsyncFileSystemChromium.cpp + (moving into DOMFileSystemChromium.cpp) + - change AsyncFileSystemChromium's methods implementation not to take + entry paths but complete filesystem URLs. + + * src/AsyncFileSystemChromium.cpp: + (WebCore::AsyncFileSystemChromium::AsyncFileSystemChromium): + (WebCore::AsyncFileSystemChromium::move): + (WebCore::AsyncFileSystemChromium::copy): + (WebCore::AsyncFileSystemChromium::remove): + (WebCore::AsyncFileSystemChromium::removeRecursively): + (WebCore::AsyncFileSystemChromium::readMetadata): + (WebCore::AsyncFileSystemChromium::createFile): + (WebCore::AsyncFileSystemChromium::createDirectory): + (WebCore::AsyncFileSystemChromium::fileExists): + (WebCore::AsyncFileSystemChromium::directoryExists): + (WebCore::AsyncFileSystemChromium::readDirectory): + (WebCore::AsyncFileSystemChromium::createWriter): + (WebCore::AsyncFileSystemChromium::createSnapshotFileAndReadMetadata): + * src/AsyncFileSystemChromium.h: + (WebCore::AsyncFileSystemChromium::create): + (AsyncFileSystemChromium): + * src/LocalFileSystemChromium.cpp: + (WebCore::openFileSystemHelper): + * src/PlatformSupport.cpp: + (WebCore::PlatformSupport::createAsyncFileSystem): + * src/WebFileSystemCallbacksImpl.cpp: + (WebKit::WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl): + (WebKit::WebFileSystemCallbacksImpl::didOpenFileSystem): + * src/WebFileSystemCallbacksImpl.h: + (WebFileSystemCallbacksImpl): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::createFileSystem): + (WebKit::WebFrameImpl::createFileEntry): + * src/WorkerAsyncFileSystemChromium.cpp: + (WebCore::WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium): + (WebCore::WorkerAsyncFileSystemChromium::move): + (WebCore::WorkerAsyncFileSystemChromium::copy): + (WebCore::WorkerAsyncFileSystemChromium::remove): + (WebCore::WorkerAsyncFileSystemChromium::removeRecursively): + (WebCore::WorkerAsyncFileSystemChromium::readMetadata): + (WebCore::WorkerAsyncFileSystemChromium::createFile): + (WebCore::WorkerAsyncFileSystemChromium::createDirectory): + (WebCore::WorkerAsyncFileSystemChromium::fileExists): + (WebCore::WorkerAsyncFileSystemChromium::directoryExists): + (WebCore::WorkerAsyncFileSystemChromium::readDirectory): + (WebCore::WorkerAsyncFileSystemChromium::createWriter): + (WebCore::WorkerAsyncFileSystemChromium::createSnapshotFileAndReadMetadata): + * src/WorkerAsyncFileSystemChromium.h: + (WebCore::WorkerAsyncFileSystemChromium::create): + (WorkerAsyncFileSystemChromium): + +2012-05-07 Greg Billock <gbillock@google.com> + + [Web Intents] Flagged-off implementation of an intent tag for registration. + https://bugs.webkit.org/show_bug.cgi?id=73039 + + Reviewed by Adam Barth. + + The intent tag allows web pages to mark themselves declaratively as accepting + web intent delivery of particular characteristics (action/type). + See the spec at: + http://dvcs.w3.org/hg/web-intents/raw-file/tip/spec/Overview.html + + * WebKit.gyp: + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::registerIntentService): + * src/FrameLoaderClientImpl.h: + +2012-05-07 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r116375. + http://trac.webkit.org/changeset/116375 + https://bugs.webkit.org/show_bug.cgi?id=85850 + + Build break on Chromium-win and Chromium-mac. (Requested by + tkent on #webkit). + + * WebKit.gyp: + * WebKit.gypi: + * tests/EventListenerTest.cpp: Removed. + * tests/data/listener/mutation_event_listener.html: Removed. + +2012-05-07 Dana Jansens <danakj@chromium.org> + + Region::intersects() and Region::contains() are slow due to copy overhead + https://bugs.webkit.org/show_bug.cgi?id=81076 + + Reviewed by Anders Carlsson. + + * tests/RegionTest.cpp: + (WebCore): + (WebCore::TEST): + +2012-05-07 Tony Chang <tony@chromium.org> + + [chromium] move event_listener_unittest to webkit_unit_tests + https://bugs.webkit.org/show_bug.cgi?id=85836 + + Reviewed by James Robinson. + + Porting the test from src/webkit/tools/test_shell/event_listener_unittest.cc. + All I did was change the style and use the FrameTestHelper to load the file. + + * WebKit.gyp: Exclude file in components build. + * WebKit.gypi: Add new file. + * tests/EventListenerTest.cpp: Added. + (WebKit): + (TestWebDOMEventListener): + (WebKit::TestWebDOMEventListener::TestWebDOMEventListener): + (WebKit::TestWebDOMEventListener::~TestWebDOMEventListener): + (WebKit::TestWebDOMEventListener::eventCount): + (WebKit::TestWebDOMEventListener::eventAt): + (WebKit::TestWebDOMEventListener::clearEvents): + (WebDOMEventListenerTest): + (WebKit::WebDOMEventListenerTest::WebDOMEventListenerTest): + (WebKit::WebDOMEventListenerTest::SetUp): + (WebKit::WebDOMEventListenerTest::TearDown): + (WebKit::WebDOMEventListenerTest::mainFrame): + (WebKit::WebDOMEventListenerTest::document): + (WebKit::WebDOMEventListenerTest::executeScript): + (WebKit::WebDOMEventListenerTest::GetNodeID): + (WebKit::TEST_F): + * tests/data/listener/mutation_event_listener.html: Added. + +2012-05-07 Julien Chaffraix <jchaffraix@webkit.org> + + Refactor windowClipRectForLayer to remove the explicit RenderLayer dependency + https://bugs.webkit.org/show_bug.cgi?id=84090 + + Reviewed by David Hyatt. + + * src/WebPluginContainerImpl.cpp: + Updated after windowClipRectForLayer name and signature change. + +2012-05-07 Dana Jansens <danakj@chromium.org> + + [chromium] Ensure synchronization in threaded unit tests by checking the sourceFrameNumber() to count commits + https://bugs.webkit.org/show_bug.cgi?id=85390 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTestScrollMultipleRedraw::beginCommitOnCCThread): + (WTF::CCLayerTreeHostTestAtomicCommit::commitCompleteOnCCThread): + (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::commitCompleteOnCCThread): + (WTF::CCLayerTreeHostTestScrollChildLayer::beginCommitOnCCThread): + +2012-05-07 Adrienne Walker <enne@google.com> + + [chromium] Allow for asymmetric tile sizes on composited tiled layers + https://bugs.webkit.org/show_bug.cgi?id=85687 + + Reviewed by James Robinson. + + Update tests for new constructor and function args. Add a few more + tests that use non-square tile sizes. + + * tests/TilingDataTest.cpp: + (WebCore::TestTiling::TestTiling): + (WebCore::TEST): + (WebCore): + +2012-05-07 David Reveman <reveman@chromium.org> + + [Chromium] Use GL_CHROMIUM_command_buffer_query to throttle texture uploads. + https://bugs.webkit.org/show_bug.cgi?id=81004 + + Reviewed by Adrienne Walker. + + * WebKit.gypi: + * tests/CCLayerTreeHostImplTest.cpp: + (WebKitTests::TEST_F): + * tests/CCTiledLayerTestCommon.h: + (WebKitTests::FakeTextureUploader::isBusy): + (WebKitTests::FakeTextureUploader::beginUploads): + (WebKitTests::FakeTextureUploader::endUploads): + * tests/Canvas2DLayerChromiumTest.cpp: + * tests/LayerRendererChromiumTest.cpp: + (FakeLayerRendererChromium::FakeLayerRendererChromium): + (LayerRendererChromiumTest::LayerRendererChromiumTest): + (TEST): + * tests/ThrottledTextureUploaderTest.cpp: Added. + (WebKit): + (FakeWebGraphicsContext3DWithQueryTesting): + (WebKit::FakeWebGraphicsContext3DWithQueryTesting::FakeWebGraphicsContext3DWithQueryTesting): + (WebKit::FakeWebGraphicsContext3DWithQueryTesting::getQueryObjectuivEXT): + (WebKit::FakeWebGraphicsContext3DWithQueryTesting::setResultAvailable): + (WebKit::TEST): + * tests/TiledLayerChromiumTest.cpp: + (WTF::TEST): + +2012-05-07 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r116334. + http://trac.webkit.org/changeset/116334 + https://bugs.webkit.org/show_bug.cgi?id=85816 + + Broke the Chromium Win/Mac compile (Requested by + ojan_gardening on #webkit). + + * WebKit.gypi: + * tests/LinkHighlightLayerDelegateTest.cpp: Removed. + +2012-05-07 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Move fileSystem to Platform.h + https://bugs.webkit.org/show_bug.cgi?id=85760 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * WebKit.gyp: + * public/platform/WebFileSystem.h: + * public/platform/WebKitPlatformSupport.h: + (WebKit): + (WebKitPlatformSupport): + * src/AssertMatchingEnums.cpp: + * src/AsyncFileSystemChromium.cpp: + (WebCore::AsyncFileSystemChromium::AsyncFileSystemChromium): + * src/LocalFileSystemChromium.cpp: + * src/WebFileSystemCallbacksImpl.cpp: + * src/WebFileSystemCallbacksImpl.h: + * src/WebFrameImpl.cpp: + * src/WebWorkerClientImpl.h: + * src/WorkerAsyncFileSystemChromium.cpp: + * src/WorkerAsyncFileWriterChromium.cpp: + * src/WorkerFileSystemCallbacksBridge.h: + * src/WorkerFileWriterCallbacksBridge.cpp: + (WebKit::WorkerFileWriterCallbacksBridge::initOnMainThread): + +2012-05-07 W. James MacLean <wjmaclean@chromium.org> + + [chromium] Create LinkHighlightLayerChromium class to provide link-highlight preview animations for GraphicsLayerChromium. + https://bugs.webkit.org/show_bug.cgi?id=85084 + + Reviewed by Adrienne Walker. + + * WebKit.gypi: + * tests/LinkHighlightLayerDelegateTest.cpp: Added. + (WebCore): + (MockGraphicsLayerClient): + (WebCore::MockGraphicsLayerClient::notifyAnimationStarted): + (WebCore::MockGraphicsLayerClient::notifySyncRequired): + (WebCore::MockGraphicsLayerClient::paintContents): + (WebCore::MockGraphicsLayerClient::showDebugBorders): + (WebCore::MockGraphicsLayerClient::showRepaintCounter): + (WebCore::TEST): + +2012-05-07 Joshua Bell <jsbell@chromium.org> + + IndexedDB: LevelDB coding for bools is broken + https://bugs.webkit.org/show_bug.cgi?id=85810 + + Reviewed by Tony Chang. + + Added tests for encodeBool/decodeBool. + + * tests/IDBLevelDBCodingTest.cpp: + (IDBLevelDBCoding::TEST): + (IDBLevelDBCoding): + +2012-05-07 Shawn Singh <shawnsingh@chromium.org> + + [chromium] CCMathUtil projectPoint needs to avoid divide-by-zero + https://bugs.webkit.org/show_bug.cgi?id=85560 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostCommonTest.cpp: + (WebKitTests::TEST): + * tests/CCMathUtilTest.cpp: + (WebCore::TEST): + (WebCore): + +2012-05-07 Nat Duca <nduca@chromium.org> + + Unreviewed, rolling out r115525. + http://trac.webkit.org/changeset/115525 + https://bugs.webkit.org/show_bug.cgi?id=66683 + + Too many pages rely on DOMTimeStamp as first argument. + Reverting while we consider next steps. + + * src/PageWidgetDelegate.cpp: + (WebKit::PageWidgetDelegate::animate): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::updateAnimations): + +2012-05-07 Tommy Widenflycht <tommyw@google.com> + + MediaStream API: Allow UserMediaRequest::succeed to take an MediaStreamDescriptor + https://bugs.webkit.org/show_bug.cgi?id=85798 + + Reviewed by Adam Barth. + + Adding another WebUserMediaRequest::requestSucceed function that takes an + WebMediaStreamDescriptor instead of the two WebMediaStreamSource arrays. + + * public/WebUserMediaRequest.h: + (WebKit): + (WebUserMediaRequest): + * src/WebUserMediaRequest.cpp: + (WebKit::WebUserMediaRequest::requestSucceeded): + +2012-05-07 Kinuko Yasuda <kinuko@chromium.org> + + Unreviewed: the same fix in another file for chromium win build. Adding WebCore namespace to FileSystemTypes. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::createFileSystem): + (WebKit::WebFrameImpl::createFileEntry): + +2012-05-07 Kinuko Yasuda <kinuko@chromium.org> + + Not reviewed: chromium win build fix attempt; adding WebCore namespace to ambiguous type name. + + * src/WebFileSystemCallbacksImpl.cpp: + (WebKit::WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl): + 2012-05-06 Kinuko Yasuda <kinuko@chromium.org> Cleanup: Change boolean synchronous flag argument into enum in FileSystem API code diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index 15044b59e..1346d5045 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': '135601' + 'chromium_rev': '136044' } deps = { diff --git a/Source/WebKit/chromium/README b/Source/WebKit/chromium/README index f540d343a..bbb1748bb 100644 --- a/Source/WebKit/chromium/README +++ b/Source/WebKit/chromium/README @@ -35,10 +35,6 @@ DEFINES called by a public inline-defined method should be annotated with WEBKIT_EXPORT. WEBKIT_EXPORT is not used to export whole classes. - WEBKIT_USING_SKIA is defined when using Skia as the graphics library. - - WEBKIT_USING_CG is defined when using CG as the graphics library. - WEBKIT_USING_V8 is defined when using V8 as the JavaScript library. WEBKIT_USING_JSC is defined when using JSC as the JavaScript library. diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp index ea966b1f1..a775f545d 100644 --- a/Source/WebKit/chromium/WebKit.gyp +++ b/Source/WebKit/chromium/WebKit.gyp @@ -299,7 +299,6 @@ 'public/platform/WebBlobData.h', 'public/platform/WebBlobRegistry.h', 'public/platform/WebCanvas.h', - 'public/platform/WebClipboard.h', 'public/platform/WebColor.h', 'public/platform/WebCommon.h', 'public/platform/WebContentLayer.h', @@ -307,9 +306,7 @@ 'public/platform/WebCookie.h', 'public/platform/WebCookieJar.h', 'public/platform/WebData.h', - 'public/platform/WebDragData.h', 'public/platform/WebExternalTextureLayer.h', - 'public/platform/WebFileSystem.h', 'public/platform/WebFloatPoint.h', 'public/platform/WebFloatQuad.h', 'public/platform/WebFloatRect.h', @@ -319,7 +316,6 @@ 'public/platform/WebHTTPBody.h', 'public/platform/WebHTTPHeaderVisitor.h', 'public/platform/WebHTTPLoadInfo.h', - 'public/platform/WebImage.h', 'public/platform/WebKitPlatformSupport.h', 'public/platform/WebLayer.h', 'public/platform/WebLayerTreeView.h', @@ -477,8 +473,6 @@ 'src/SpeechRecognitionClientProxy.h', 'src/StorageAreaProxy.cpp', 'src/StorageAreaProxy.h', - 'src/StorageEventDispatcherImpl.cpp', - 'src/StorageEventDispatcherImpl.h', 'src/StorageInfoChromium.cpp', 'src/StorageNamespaceProxy.cpp', 'src/StorageNamespaceProxy.h', @@ -656,7 +650,6 @@ 'src/WebSpeechRecognitionHandle.cpp', 'src/WebSpeechRecognitionResult.cpp', 'src/WebStorageEventDispatcherImpl.cpp', - 'src/WebStorageEventDispatcherImpl.h', 'src/WebStorageQuotaCallbacksImpl.cpp', 'src/WebStorageQuotaCallbacksImpl.h', 'src/WebSurroundingText.cpp', @@ -736,8 +729,10 @@ # These tests depend on webkit_support and # functions defined only in !WEBKIT_IMPLEMENTATION. 'tests/AssociatedURLLoaderTest.cpp', + 'tests/EventListenerTest.cpp', 'tests/FrameTestHelpers.cpp', 'tests/LevelDBTest.cpp', + 'tests/ListenerLeakTest.cpp', 'tests/PopupMenuTest.cpp', 'tests/RenderTableCellTest.cpp', 'tests/RenderTableRowTest.cpp', @@ -883,7 +878,7 @@ 'files': [ '<@(devtools_files)', '<@(webinspector_files)', - '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendStub.js', + '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendCommands.js', ], 'conditions': [ ['debug_devtools==0', { @@ -1014,7 +1009,7 @@ '<@(_inspector_html)', '<@(devtools_files)', '<@(webinspector_files)', - '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendStub.js', + '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendCommands.js', '<@(_workers_files)', '<@(webinspector_image_files)', '<@(devtools_image_files)', @@ -1077,7 +1072,7 @@ '<@(_input_page)', '<@(webinspector_files)', '<@(devtools_files)', - '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendStub.js' + '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendCommands.js' ], 'search_path': [ '../../WebCore/inspector/front-end', diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index f85d97920..f40951afe 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -97,10 +97,12 @@ 'tests/CompositorFakeWebGraphicsContext3D.h', 'tests/DragImageTest.cpp', 'tests/DrawingBufferChromiumTest.cpp', + 'tests/EventListenerTest.cpp', 'tests/FakeCCLayerTreeHostClient.h', 'tests/FakeGraphicsContext3DTest.cpp', 'tests/FakeWebGraphicsContext3D.h', 'tests/FloatQuadTest.cpp', + 'tests/FrameLoaderClientImplTest.cpp', 'tests/FrameTestHelpers.cpp', 'tests/FrameTestHelpers.h', 'tests/IDBBindingUtilitiesTest.cpp', @@ -113,6 +115,8 @@ 'tests/LayerRendererChromiumTest.cpp', 'tests/LayerTextureUpdaterTest.cpp', 'tests/LevelDBTest.cpp', + 'tests/LinkHighlightTest.cpp', + 'tests/ListenerLeakTest.cpp', 'tests/LocalizedNumberICUTest.cpp', 'tests/MockCCQuadCuller.h', 'tests/PaintAggregatorTest.cpp', @@ -126,7 +130,9 @@ 'tests/RenderTableRowTest.cpp', 'tests/ScrollbarLayerChromiumTest.cpp', 'tests/TextureCopierTest.cpp', + 'tests/TextureLayerChromiumTest.cpp', 'tests/TextureManagerTest.cpp', + 'tests/ThrottledTextureUploaderTest.cpp', 'tests/TiledLayerChromiumTest.cpp', 'tests/TilingDataTest.cpp', 'tests/TreeSynchronizerTest.cpp', diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index 86054fac1..3947a3826 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -55,6 +55,7 @@ 'ENABLE_GEOLOCATION=1', 'ENABLE_GESTURE_EVENTS=1', 'ENABLE_ICONDATABASE=0', + 'ENABLE_IFRAME_SEAMLESS=1', 'ENABLE_INDEXED_DATABASE=1', 'ENABLE_INPUT_SPEECH=1', 'ENABLE_INPUT_TYPE_DATE=1', @@ -84,6 +85,7 @@ 'ENABLE_POINTER_LOCK=1', 'ENABLE_PROGRESS_TAG=1', 'ENABLE_QUOTA=1', + 'ENABLE_REGISTER_PROTOCOL_HANDLER=1', 'ENABLE_REQUEST_ANIMATION_FRAME=1', 'ENABLE_RUBY=1', 'ENABLE_SANDBOX=1', @@ -137,6 +139,7 @@ ['OS=="android"', { 'feature_defines': [ 'ENABLE_CALENDAR_PICKER=0', + 'ENABLE_MEDIA_CAPTURE=1', 'ENABLE_PAGE_POPUP=0', 'ENABLE_WEB_AUDIO=0', 'WTF_USE_NATIVE_FULLSCREEN_VIDEO=1', @@ -144,6 +147,7 @@ }, { 'feature_defines': [ 'ENABLE_CALENDAR_PICKER=1', + 'ENABLE_MEDIA_CAPTURE=0', 'ENABLE_PAGE_POPUP=1', 'ENABLE_WEB_AUDIO=1', ], @@ -174,14 +178,14 @@ 'WTF_USE_WEBAUDIO_FFMPEG=1', ], }], - ['enable_register_protocol_handler==1', { + ['enable_web_intents==1', { 'feature_defines': [ - 'ENABLE_REGISTER_PROTOCOL_HANDLER=1', + 'ENABLE_WEB_INTENTS=1', ], }], - ['enable_web_intents==1', { + ['enable_web_intents_tag==1', { 'feature_defines': [ - 'ENABLE_WEB_INTENTS=1', + 'ENABLE_WEB_INTENTS_TAG=1', ], }], ['OS=="mac"', { diff --git a/Source/WebKit/chromium/public/WebFileChooserParams.h b/Source/WebKit/chromium/public/WebFileChooserParams.h index da462ef98..31e37b55e 100644 --- a/Source/WebKit/chromium/public/WebFileChooserParams.h +++ b/Source/WebKit/chromium/public/WebFileChooserParams.h @@ -62,6 +62,14 @@ struct WebFileChooserParams { // - replacing with other files // before opening a file chooser dialog. WebVector<WebString> selectedFiles; + // See http://www.w3.org/TR/html-media-capture/ for the semantics of the + // capture attribute. This string will either be empty (meaning the feature + // is disabled) or one of the following values: + // - filesystem (default) + // - camera + // - camcorder + // - microphone + WebString capture; WebFileChooserParams() : multiSelect(false) diff --git a/Source/WebKit/chromium/public/WebFrame.h b/Source/WebKit/chromium/public/WebFrame.h index da795ae8d..017cb0de8 100644 --- a/Source/WebKit/chromium/public/WebFrame.h +++ b/Source/WebKit/chromium/public/WebFrame.h @@ -143,9 +143,6 @@ public: // URLs virtual WebVector<WebIconURL> iconURLs(int iconTypes) const = 0; - // The referrer policy of the document associated with this frame. - virtual WebReferrerPolicy referrerPolicy() const = 0; - // Geometry ----------------------------------------------------------- @@ -565,6 +562,13 @@ public: // of matches found during the scoping effort. virtual void resetMatchCount() = 0; + // OrientationChange event --------------------------------------------- + + // Orientation is the interface orientation in degrees. + // Some examples are: + // 0 is straight up; -90 is when the device is rotated 90 clockwise; + // 90 is when rotated counter clockwise. + virtual void sendOrientationChangeEvent(int orientation) = 0; // Events -------------------------------------------------------------- @@ -577,6 +581,9 @@ public: virtual void removeEventListener(const WebString& eventType, WebDOMEventListener*, bool useCapture) = 0; virtual bool dispatchEvent(const WebDOMEvent&) = 0; + virtual void dispatchMessageEventWithOriginCheck( + const WebSecurityOrigin& intendedTargetOrigin, + const WebDOMEvent&) = 0; // Web Intents --------------------------------------------------------- diff --git a/Source/WebKit/chromium/public/WebFrameClient.h b/Source/WebKit/chromium/public/WebFrameClient.h index 9270d1ab9..662c7c1c5 100644 --- a/Source/WebKit/chromium/public/WebFrameClient.h +++ b/Source/WebKit/chromium/public/WebFrameClient.h @@ -397,6 +397,11 @@ public: WebSecurityOrigin target, WebDOMMessageEvent) { return false; } + // Asks the embedder if a specific user agent should be used for the given + // URL. Returns true if it should, along with the user agent. If false, + // WebKitPlatformSupport::userAgent() will be called to provide one. + virtual bool userAgent(const WebURL& url, WebString* userAgent) { return false; } + protected: ~WebFrameClient() { } }; diff --git a/Source/WebKit/chromium/public/WebStorageArea.h b/Source/WebKit/chromium/public/WebStorageArea.h index cb5ee8d36..23b799af1 100644 --- a/Source/WebKit/chromium/public/WebStorageArea.h +++ b/Source/WebKit/chromium/public/WebStorageArea.h @@ -38,9 +38,6 @@ namespace WebKit { class WebURL; -// In WebCore, there's one distinct StorageArea per origin per StorageNamespace. This -// class wraps a StorageArea. All the methods have obvious connections to the spec: -// http://dev.w3.org/html5/webstorage/ class WebStorageArea { public: virtual ~WebStorageArea() { } @@ -63,16 +60,34 @@ public: virtual WebString getItem(const WebString& key) = 0; // Set the value that corresponds to a specific key. Result will either be ResultOK - // or some particular error. The value is NOT set when there's an error. url is the + // or some particular error. The value is NOT set when there's an error. |pageUrl| is the // url that should be used if a storage event fires. - virtual void setItem(const WebString& key, const WebString& newValue, const WebURL&, Result&, WebString& oldValue) = 0; + virtual void setItem(const WebString& key, const WebString& newValue, const WebURL& pageUrl, Result& result) + { + WebString unused; + setItem(key, newValue, pageUrl, result, unused); + } + - // Remove the value associated with a particular key. url is the url that should be used + // Remove the value associated with a particular key. |pageUrl| is the url that should be used // if a storage event fires. - virtual void removeItem(const WebString& key, const WebURL& url, WebString& oldValue) = 0; + virtual void removeItem(const WebString& key, const WebURL& pageUrl) + { + WebString unused; + removeItem(key, pageUrl, unused); + } - // Clear all key/value pairs. url is the url that should be used if a storage event fires. - virtual void clear(const WebURL& url, bool& somethingCleared) = 0; + // Clear all key/value pairs. |pageUrl| is the url that should be used if a storage event fires. + virtual void clear(const WebURL& pageUrl) + { + bool unused; + clear(pageUrl, unused); + } + + // DEPRECATED - being replaced by the async variants above which do not return oldValues or block until completion. + virtual void setItem(const WebString& key, const WebString& newValue, const WebURL&, Result&, WebString& oldValue) = 0; + virtual void removeItem(const WebString& key, const WebURL& pageUrl, WebString& oldValue) = 0; + virtual void clear(const WebURL& pageUrl, bool& somethingCleared) = 0; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/public/WebStorageEventDispatcher.h b/Source/WebKit/chromium/public/WebStorageEventDispatcher.h index 4fbc596b2..b321bf0e9 100644 --- a/Source/WebKit/chromium/public/WebStorageEventDispatcher.h +++ b/Source/WebKit/chromium/public/WebStorageEventDispatcher.h @@ -55,13 +55,8 @@ public: const WebURL& pageUrl, const WebStorageNamespace&, WebStorageArea* sourceAreaInstance, bool originatedInProcess); - // DEPRECATED - The instance methods are going away soon in favor - // of the two static dispatch methods above. - WEBKIT_EXPORT static WebStorageEventDispatcher* create(); - virtual ~WebStorageEventDispatcher() { } - virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue, - const WebString& newValue, const WebString& origin, - const WebURL& url, bool isLocalStorage) = 0; + private: + WebStorageEventDispatcher() { } }; } // namespace WebKit diff --git a/Source/WebKit/chromium/public/WebStorageNamespace.h b/Source/WebKit/chromium/public/WebStorageNamespace.h index 894330717..dd4a8fd44 100644 --- a/Source/WebKit/chromium/public/WebStorageNamespace.h +++ b/Source/WebKit/chromium/public/WebStorageNamespace.h @@ -55,9 +55,6 @@ public: // Returns true of the two instances represent the same storage namespace. virtual bool isSameNamespace(const WebStorageNamespace&) const { return false; } - - // DEPRECATED - virtual void close() { } }; } // namespace WebKit diff --git a/Source/WebKit/chromium/public/WebTextInputType.h b/Source/WebKit/chromium/public/WebTextInputType.h index 428cf5549..b7212758e 100644 --- a/Source/WebKit/chromium/public/WebTextInputType.h +++ b/Source/WebKit/chromium/public/WebTextInputType.h @@ -48,6 +48,12 @@ enum WebTextInputType { WebTextInputTypeNumber, WebTextInputTypeTelephone, WebTextInputTypeURL, + WebTextInputTypeDate, + WebTextInputTypeDateTime, + WebTextInputTypeDateTimeLocal, + WebTextInputTypeMonth, + WebTextInputTypeTime, + WebTextInputTypeWeek, }; } // namespace WebKit diff --git a/Source/WebKit/chromium/public/WebUserMediaRequest.h b/Source/WebKit/chromium/public/WebUserMediaRequest.h index 54b534e7b..54949407f 100644 --- a/Source/WebKit/chromium/public/WebUserMediaRequest.h +++ b/Source/WebKit/chromium/public/WebUserMediaRequest.h @@ -41,6 +41,7 @@ class UserMediaRequest; namespace WebKit { +class WebMediaStreamDescriptor; class WebMediaStreamSource; class WebString; template <typename T> class WebVector; @@ -67,7 +68,11 @@ public: WEBKIT_EXPORT WebSecurityOrigin securityOrigin() const; + // DEPRECATED WEBKIT_EXPORT void requestSucceeded(const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources); + + WEBKIT_EXPORT void requestSucceeded(const WebMediaStreamDescriptor&); + WEBKIT_EXPORT void requestFailed(); #if WEBKIT_IMPLEMENTATION diff --git a/Source/WebKit/chromium/public/platform/WebClipboard.h b/Source/WebKit/chromium/public/platform/WebClipboard.h index 503213952..5f8822336 100644 --- a/Source/WebKit/chromium/public/platform/WebClipboard.h +++ b/Source/WebKit/chromium/public/platform/WebClipboard.h @@ -28,71 +28,4 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebClipboard_h -#define WebClipboard_h - -#include "WebCommon.h" -#include "WebData.h" -#include "WebString.h" -#include "WebVector.h" - -namespace WebKit { - -class WebDragData; -class WebImage; -class WebURL; - -class WebClipboard { -public: - enum Format { - FormatPlainText, - FormatHTML, - FormatBookmark, - FormatSmartPaste - }; - - enum Buffer { - BufferStandard, - // Used on platforms like the X Window System that treat selection - // as a type of clipboard. - BufferSelection, - }; - - // Returns an identifier which can be used to determine whether the data - // contained within the clipboard has changed. - virtual uint64 sequenceNumber(Buffer) { return 0; } - - virtual bool isFormatAvailable(Format, Buffer) { return false; } - - virtual WebVector<WebString> readAvailableTypes( - Buffer, bool* containsFilenames) { return WebVector<WebString>(); } - virtual WebString readPlainText(Buffer) { return WebString(); } - // fragmentStart and fragmentEnd are indexes into the returned markup that - // indicate the start and end of the fragment if the returned markup - // contains additional context. If there is no additional context, - // fragmentStart will be zero and fragmentEnd will be the same as the length - // of the returned markup. - virtual WebString readHTML( - Buffer buffer, WebURL* pageURL, unsigned* fragmentStart, - unsigned* fragmentEnd) { return WebString(); } - virtual WebData readImage(Buffer) { return WebData(); } - virtual WebString readCustomData( - Buffer, const WebString& type) { return WebString(); } - - virtual void writePlainText(const WebString&) { } - virtual void writeHTML( - const WebString& htmlText, const WebURL&, - const WebString& plainText, bool writeSmartPaste) { } - virtual void writeURL( - const WebURL&, const WebString& title) { } - virtual void writeImage( - const WebImage&, const WebURL&, const WebString& title) { } - virtual void writeDataObject(const WebDragData&) { } - -protected: - ~WebClipboard() {} -}; - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/WebClipboard.h" diff --git a/Source/WebKit/chromium/public/platform/WebDragData.h b/Source/WebKit/chromium/public/platform/WebDragData.h index 9666fe4b1..80cada276 100644 --- a/Source/WebKit/chromium/public/platform/WebDragData.h +++ b/Source/WebKit/chromium/public/platform/WebDragData.h @@ -28,96 +28,4 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebDragData_h -#define WebDragData_h - -#include "WebCommon.h" -#include "WebData.h" -#include "WebString.h" -#include "WebURL.h" - -#if WEBKIT_IMPLEMENTATION -namespace WebCore { class ChromiumDataObject; } -namespace WTF { template <typename T> class PassRefPtr; } -#endif - -namespace WebKit { - -class WebDragDataPrivate; -template <typename T> class WebVector; - -// Holds data that may be exchanged through a drag-n-drop operation. It is -// inexpensive to copy a WebDragData object. -class WebDragData { -public: - struct Item { - enum StorageType { - // String data with an associated MIME type. Depending on the MIME type, there may be - // optional metadata attributes as well. - StorageTypeString, - // Stores the name of one file being dragged into the renderer. - StorageTypeFilename, - // An image being dragged out of the renderer. Contains a buffer holding the image data - // as well as the suggested name for saving the image to. - StorageTypeBinaryData, - }; - - StorageType storageType; - - // Only valid when storageType == StorageTypeString. - WebString stringType; - WebString stringData; - - // Only valid when storageType == StorageTypeFilename. - WebString filenameData; - WebString displayNameData; - - // Only valid when storageType == StorageTypeBinaryData. - WebData binaryData; - - // Title associated with a link when stringType == "text/uri-list". - // Filename when storageType == StorageTypeBinaryData. - WebString title; - - // Only valid when stringType == "text/html". - WebURL baseURL; - }; - - ~WebDragData() { reset(); } - - WebDragData() : m_private(0) { } - WebDragData(const WebDragData& d) : m_private(0) { assign(d); } - WebDragData& operator=(const WebDragData& d) - { - assign(d); - return *this; - } - - WEBKIT_EXPORT void initialize(); - WEBKIT_EXPORT void reset(); - WEBKIT_EXPORT void assign(const WebDragData&); - - bool isNull() const { return !m_private; } - - WEBKIT_EXPORT WebVector<Item> items() const; - WEBKIT_EXPORT void setItems(const WebVector<Item>&); - WEBKIT_EXPORT void addItem(const Item&); - - WEBKIT_EXPORT WebString filesystemId() const; - WEBKIT_EXPORT void setFilesystemId(const WebString&); - -#if WEBKIT_IMPLEMENTATION - WebDragData(const WTF::PassRefPtr<WebCore::ChromiumDataObject>&); - WebDragData& operator=(const WTF::PassRefPtr<WebCore::ChromiumDataObject>&); - operator WTF::PassRefPtr<WebCore::ChromiumDataObject>() const; -#endif - -private: - void assign(WebDragDataPrivate*); - void ensureMutable(); - WebDragDataPrivate* m_private; -}; - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/WebDragData.h" diff --git a/Source/WebKit/chromium/public/platform/WebFileSystem.h b/Source/WebKit/chromium/public/platform/WebFileSystem.h index 25afb49f0..ad651e77c 100644 --- a/Source/WebKit/chromium/public/platform/WebFileSystem.h +++ b/Source/WebKit/chromium/public/platform/WebFileSystem.h @@ -28,111 +28,4 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebFileSystem_h -#define WebFileSystem_h - -#include "WebCommon.h" -#include "WebURL.h" - -namespace WebKit { - -// FIXME: Move these classes into platform. -class WebFileSystemCallbacks; -class WebFileWriter; -class WebFileWriterClient; - -class WebFileSystem { -public: - enum Type { - TypeTemporary, - TypePersistent, - - // Indicates an isolated filesystem which only exposes a set of files. - TypeIsolated, - - // Indicates a non-sandboxed filesystem. - TypeExternal, - }; - - // Moves a file or directory at |srcPath| to |destPath|. - // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void move(const WebURL& srcPath, const WebURL& destPath, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Copies a file or directory at |srcPath| to |destPath|. - // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void copy(const WebURL& srcPath, const WebURL& destPath, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Deletes a file or directory at a given |path|. - // It is an error to try to remove a directory that is not empty. - // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void remove(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Deletes a file or directory recursively at a given |path|. - // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void removeRecursively(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Retrieves the metadata information of the file or directory at the given |path|. - // This may not always return the local platform path in remote filesystem cases. - // WebFileSystemCallbacks::didReadMetadata() must be called with a valid metadata when the retrieval is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void readMetadata(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Creates a file at given |path|. - // If the |path| doesn't exist, it creates a new file at |path|. - // If |exclusive| is true, it fails if the |path| already exists. - // If |exclusive| is false, it succeeds if the |path| already exists or - // it has successfully created a new file at |path|. - // - // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void createFile(const WebURL& path, bool exclusive, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Creates a directory at a given |path|. - // If the |path| doesn't exist, it creates a new directory at |path|. - // If |exclusive| is true, it fails if the |path| already exists. - // If |exclusive| is false, it succeeds if the |path| already exists or it has successfully created a new directory at |path|. - // - // WebFileSystemCallbacks::didSucceed() must be called when - // the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void createDirectory(const WebURL& path, bool exclusive, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Checks if a file exists at a given |path|. - // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void fileExists(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Checks if a directory exists at a given |path|. - // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void directoryExists(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Reads directory entries of a given directory at |path|. - // WebFileSystemCallbacks::didReadDirectory() must be called when the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void readDirectory(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Creates a WebFileWriter that can be used to write to the given file. - // This is a fast, synchronous call, and should not stat the filesystem. - virtual WebFileWriter* createFileWriter(const WebURL& path, WebFileWriterClient*) { WEBKIT_ASSERT_NOT_REACHED(); return 0; } - - // Creates a snapshot file for a given file specified by |path| and registers the file with the |blobURL|. It returns the metadata of the created snapshot file. - // The returned metadata should include a local platform path to the snapshot image. - // In local filesystem cases the backend may simply return the metadata of the file itself (as well as readMetadata does), while in remote filesystem case the backend may download the file into a temporary snapshot file and return the metadata of the temporary file. - // The returned metadata is used to create a File object for the |path|. - // The snapshot file is supposed to be deleted when the last reference to the |blobURL| is dropped. - // WebFileSystemCallbacks::didReadMetadata() with the metadata of the snapshot file must be called when the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void createSnapshotFileAndReadMetadata(const WebURL& blobURL, const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - -protected: - virtual ~WebFileSystem() { } -}; - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/WebFileSystem.h" diff --git a/Source/WebKit/chromium/public/platform/WebImage.h b/Source/WebKit/chromium/public/platform/WebImage.h index bf0e9722e..2593f6b3a 100644 --- a/Source/WebKit/chromium/public/platform/WebImage.h +++ b/Source/WebKit/chromium/public/platform/WebImage.h @@ -28,99 +28,4 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebImage_h -#define WebImage_h - -#include "WebCommon.h" - -#if WEBKIT_USING_SKIA -#include <SkBitmap.h> -#elif WEBKIT_USING_CG -typedef struct CGImage* CGImageRef; -#endif - -#if WEBKIT_IMPLEMENTATION -namespace WebCore { class Image; } -namespace WTF { template <typename T> class PassRefPtr; } -#endif - -namespace WebKit { - -class WebData; -struct WebSize; - -// A container for an ARGB bitmap. -class WebImage { -public: - ~WebImage() { reset(); } - - WebImage() { init(); } - WebImage(const WebImage& image) - { - init(); - assign(image); - } - - WebImage& operator=(const WebImage& image) - { - assign(image); - return *this; - } - - // Decodes the given image data. If the image has multiple frames, - // then the frame whose size is desiredSize is returned. Otherwise, - // the first frame is returned. - WEBKIT_EXPORT static WebImage fromData(const WebData&, const WebSize& desiredSize); - - WEBKIT_EXPORT void reset(); - WEBKIT_EXPORT void assign(const WebImage&); - - WEBKIT_EXPORT bool isNull() const; - WEBKIT_EXPORT WebSize size() const; - -#if WEBKIT_IMPLEMENTATION - WebImage(const WTF::PassRefPtr<WebCore::Image>&); - WebImage& operator=(const WTF::PassRefPtr<WebCore::Image>&); -#endif - -#if WEBKIT_USING_SKIA - WebImage(const SkBitmap& bitmap) : m_bitmap(bitmap) { } - - WebImage& operator=(const SkBitmap& bitmap) - { - m_bitmap = bitmap; - return *this; - } - - SkBitmap& getSkBitmap() { return m_bitmap; } - const SkBitmap& getSkBitmap() const { return m_bitmap; } - -private: - void init() { } - SkBitmap m_bitmap; - -#elif WEBKIT_USING_CG - WebImage(CGImageRef imageRef) - { - init(); - assign(imageRef); - } - - WebImage& operator=(CGImageRef imageRef) - { - assign(imageRef); - return *this; - } - - CGImageRef getCGImageRef() const { return m_imageRef; } - -private: - void init() { m_imageRef = 0; } - WEBKIT_EXPORT void assign(CGImageRef); - CGImageRef m_imageRef; -#endif -}; - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/WebImage.h" diff --git a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h index ca3762dcb..cc5571ea6 100644 --- a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h +++ b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h @@ -51,9 +51,7 @@ namespace WebKit { class WebApplicationCacheHost; // FIXME: Does this belong in platform? class WebApplicationCacheHostClient; // FIXME: Does this belong in platform? class WebBlobRegistry; -class WebClipboard; class WebCookieJar; -class WebFileSystem; class WebFileUtilities; class WebIDBFactory; // FIXME: Does this belong in platform? class WebIDBKey; // FIXME: Does this belong in platform? @@ -69,9 +67,6 @@ class WebWorkerRunLoop; class WebKitPlatformSupport : public Platform { public: // Must return non-null. - virtual WebClipboard* clipboard() { return 0; } - - // Must return non-null. virtual WebFileUtilities* fileUtilities() { return 0; } // May return null if sandbox support is not necessary @@ -93,11 +88,6 @@ public: // Return a LocalStorage namespace that corresponds to the following path. virtual WebStorageNamespace* createLocalStorageNamespace(const WebString& path, unsigned quota) { return 0; } - // DEPRECATED - virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue, - const WebString& newValue, const WebString& origin, - const WebURL& url, bool isLocalStorage) { } - // HTML5 Database ------------------------------------------------------ @@ -177,11 +167,6 @@ public: virtual bool canAccelerate2dCanvas() { return false; } - // FileSystem ---------------------------------------------------------- - - // Must return non-null. - virtual WebFileSystem* fileSystem() { return 0; } - // WebWorker ---------------------------------------------------------- virtual void didStartWorkerRunLoop(const WebWorkerRunLoop&) { } diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index 9f39fc372..322f15046 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -99,12 +99,12 @@ #include "WebTextCheckingResult.h" #include "WebTextCheckingType.h" #include "WebView.h" -#include "platform/WebClipboard.h" -#include "platform/WebFileSystem.h" #include "platform/WebICEOptions.h" #include "platform/WebMediaStreamSource.h" #include "platform/WebPeerConnection00Handler.h" #include "platform/WebPeerConnection00HandlerClient.h" +#include <public/WebClipboard.h> +#include <public/WebFileSystem.h> #include <public/WebFilterOperation.h> #include <public/WebReferrerPolicy.h> #include <wtf/Assertions.h> diff --git a/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp b/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp index d2026d330..eb5021003 100644 --- a/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp @@ -44,6 +44,8 @@ #include "WebKit.h" #include "platform/WebFileSystem.h" #include "platform/WebKitPlatformSupport.h" +#include <public/Platform.h> +#include <public/WebFileSystem.h> #include <wtf/text/CString.h> #include <wtf/text/StringBuilder.h> @@ -51,12 +53,6 @@ namespace WebCore { namespace { -// For isolated filesystem. -const char isolatedPathPrefix[] = "isolated"; - -// For external filesystem. -const char externalPathPrefix[] = "external"; - // Specialized callback class for createSnapshotFileAndReadMetadata. class SnapshotFileCallbacks : public AsyncFileSystemCallbacks { public: @@ -101,149 +97,64 @@ bool AsyncFileSystem::isAvailable() return true; } -// static -bool AsyncFileSystem::crackFileSystemURL(const KURL& url, FileSystemType& type, String& filePath) -{ - if (!url.protocolIs("filesystem")) - return false; - - if (url.innerURL()) { - String typeString = url.innerURL()->path().substring(1); - if (typeString == temporaryPathPrefix) - type = FileSystemTypeTemporary; - else if (typeString == persistentPathPrefix) - type = FileSystemTypePersistent; - else if (typeString == externalPathPrefix) - type = FileSystemTypeExternal; - else - return false; - - filePath = decodeURLEscapeSequences(url.path()); - } - return true; -} - -// static -bool AsyncFileSystem::isValidType(FileSystemType type) -{ - return type == FileSystemTypeTemporary || type == FileSystemTypePersistent || type == FileSystemTypeExternal; -} - -AsyncFileSystemChromium::AsyncFileSystemChromium(FileSystemType type, const KURL& rootURL) - : AsyncFileSystem(type) - , m_webFileSystem(WebKit::webKitPlatformSupport()->fileSystem()) - , m_filesystemRootURL(rootURL) +AsyncFileSystemChromium::AsyncFileSystemChromium() + : m_webFileSystem(WebKit::webKitPlatformSupport()->fileSystem()) { ASSERT(m_webFileSystem); } -// static -String AsyncFileSystemChromium::createIsolatedFileSystemName(const String& storageIdentifier, const String& filesystemId) -{ - StringBuilder filesystemName; - filesystemName.append(storageIdentifier); - filesystemName.append(":"); - filesystemName.append(isolatedPathPrefix); - filesystemName.append("_"); - filesystemName.append(filesystemId); - return filesystemName.toString(); -} - -// static -PassOwnPtr<AsyncFileSystem> AsyncFileSystemChromium::createIsolatedFileSystem(const String& originString, const String& filesystemId) -{ - // The rootURL is used in succeeding filesystem requests sent to the - // chromium and is validated each time in the browser process. - StringBuilder rootURL; - rootURL.append("filesystem:"); - rootURL.append(originString); - rootURL.append("/"); - rootURL.append(isolatedPathPrefix); - rootURL.append("/"); - rootURL.append(filesystemId); - rootURL.append("/"); - - return AsyncFileSystemChromium::create(FileSystemTypeIsolated, KURL(ParsedURLString, rootURL.toString())); -} - AsyncFileSystemChromium::~AsyncFileSystemChromium() { } -KURL AsyncFileSystemChromium::toURL(const String& originString, const String& fullPath) const -{ - ASSERT(!originString.isEmpty()); - if (originString == "null") - return KURL(); - - // For now we don't support toURL for isolated filesystem (until we resolve the isolated filesystem lifetime issue). - if (type() == FileSystemTypeIsolated) - return KURL(); - - if (type() == FileSystemTypeExternal) { - // 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 KURL(ParsedURLString, 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 KURL(ParsedURLString, virtualPathToFileSystemURL(fullPath)); -} - -void AsyncFileSystemChromium::move(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::move(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->move(virtualPathToFileSystemURL(sourcePath), virtualPathToFileSystemURL(destinationPath), new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->move(sourcePath, destinationPath, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } -void AsyncFileSystemChromium::copy(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::copy(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->copy(virtualPathToFileSystemURL(sourcePath), virtualPathToFileSystemURL(destinationPath), new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->copy(sourcePath, destinationPath, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } -void AsyncFileSystemChromium::remove(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::remove(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->remove(virtualPathToFileSystemURL(path), new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->remove(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } -void AsyncFileSystemChromium::removeRecursively(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::removeRecursively(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->removeRecursively(virtualPathToFileSystemURL(path), new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->removeRecursively(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } -void AsyncFileSystemChromium::readMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::readMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->readMetadata(virtualPathToFileSystemURL(path), new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->readMetadata(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } -void AsyncFileSystemChromium::createFile(const String& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::createFile(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->createFile(virtualPathToFileSystemURL(path), exclusive, new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->createFile(path, exclusive, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } -void AsyncFileSystemChromium::createDirectory(const String& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::createDirectory(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->createDirectory(virtualPathToFileSystemURL(path), exclusive, new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->createDirectory(path, exclusive, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } -void AsyncFileSystemChromium::fileExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::fileExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->fileExists(virtualPathToFileSystemURL(path), new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->fileExists(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } -void AsyncFileSystemChromium::directoryExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::directoryExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->directoryExists(virtualPathToFileSystemURL(path), new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->directoryExists(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } -void AsyncFileSystemChromium::readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::readDirectory(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->readDirectory(virtualPathToFileSystemURL(path), new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->readDirectory(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } class FileWriterHelperCallbacks : public WebKit::WebFileSystemCallbacks { @@ -300,28 +211,17 @@ private: OwnPtr<WebCore::AsyncFileSystemCallbacks> m_callbacks; }; -void AsyncFileSystemChromium::createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::createWriter(AsyncFileWriterClient* client, const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - KURL pathAsURL = virtualPathToFileSystemURL(path); - m_webFileSystem->readMetadata(pathAsURL, new FileWriterHelperCallbacks(client, pathAsURL, m_webFileSystem, callbacks)); + m_webFileSystem->readMetadata(path, new FileWriterHelperCallbacks(client, path, m_webFileSystem, callbacks)); } -void AsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - KURL pathAsURL = virtualPathToFileSystemURL(path); KURL internalBlobURL = BlobURL::createInternalURL(); // This will create a snapshot file and register the file to a blob using the given internalBlobURL. - m_webFileSystem->createSnapshotFileAndReadMetadata(internalBlobURL, pathAsURL, new WebKit::WebFileSystemCallbacksImpl(createSnapshotFileCallback(internalBlobURL, callbacks))); -} - -KURL AsyncFileSystemChromium::virtualPathToFileSystemURL(const String& virtualPath) const -{ - ASSERT(!m_filesystemRootURL.isEmpty()); - KURL url = m_filesystemRootURL; - // Remove the extra leading slash. - url.setPath(url.path() + encodeWithURLEscapeSequences(virtualPath.substring(1))); - return url; + m_webFileSystem->createSnapshotFileAndReadMetadata(internalBlobURL, path, new WebKit::WebFileSystemCallbacksImpl(createSnapshotFileCallback(internalBlobURL, callbacks))); } PassOwnPtr<AsyncFileSystemCallbacks> AsyncFileSystemChromium::createSnapshotFileCallback(const KURL& internalBlobURL, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) const diff --git a/Source/WebKit/chromium/src/AsyncFileSystemChromium.h b/Source/WebKit/chromium/src/AsyncFileSystemChromium.h index e827855a0..7e1af3278 100644 --- a/Source/WebKit/chromium/src/AsyncFileSystemChromium.h +++ b/Source/WebKit/chromium/src/AsyncFileSystemChromium.h @@ -43,45 +43,35 @@ class WebFileSystem; namespace WebCore { class AsyncFileSystemCallbacks; -class KURL; class AsyncFileSystemChromium : public AsyncFileSystem { public: - static PassOwnPtr<AsyncFileSystem> create(FileSystemType type, const KURL& rootURL) + static PassOwnPtr<AsyncFileSystem> create() { - return adoptPtr(new AsyncFileSystemChromium(type, rootURL)); + return adoptPtr(new AsyncFileSystemChromium()); } - static String createIsolatedFileSystemName(const String& storageIdentifier, const String& filesystemId); - static PassOwnPtr<AsyncFileSystem> createIsolatedFileSystem(const String& originString, const String& filesystemId); - virtual ~AsyncFileSystemChromium(); - virtual KURL toURL(const String& originString, const String& fullPath) const; - 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>); - virtual void removeRecursively(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void readMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void createFile(const String& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void createDirectory(const String& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void fileExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void directoryExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void move(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void copy(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void remove(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void removeRecursively(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void readMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createFile(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createDirectory(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void fileExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void directoryExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void readDirectory(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createWriter(AsyncFileWriterClient*, const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createSnapshotFileAndReadMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); protected: - AsyncFileSystemChromium(FileSystemType, const KURL& rootURL); + AsyncFileSystemChromium(); PassOwnPtr<AsyncFileSystemCallbacks> createSnapshotFileCallback(const KURL& internalBlobURL, PassOwnPtr<AsyncFileSystemCallbacks>) const; WebKit::WebFileSystem* m_webFileSystem; - - // Converts a given absolute virtual path to a full origin-qualified FileSystem URL. - KURL virtualPathToFileSystemURL(const String& virtualPath) const; - - KURL m_filesystemRootURL; }; } // namespace WebCore diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index fac80d993..8808e5d6a 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -738,6 +738,11 @@ void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileCh params.selectedFiles = fileChooser->settings().selectedFiles; if (params.selectedFiles.size() > 0) params.initialValue = params.selectedFiles[0]; +#if ENABLE(MEDIA_CAPTURE) + params.capture = fileChooser->settings().capture; +#else + params.capture = WebString(); +#endif WebFileChooserCompletionImpl* chooserCompletion = new WebFileChooserCompletionImpl(fileChooser); diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp index 4491ea1ca..d35eb0e6c 100644 --- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -279,18 +279,20 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( // a mouse on a word, Chrome just needs to find a spelling marker on the word instread of spellchecking it. if (selectedFrame->settings() && selectedFrame->settings()->asynchronousSpellCheckingEnabled()) { RefPtr<Range> range = selectedFrame->selection()->toNormalizedRange(); - Vector<DocumentMarker*> markers = selectedFrame->document()->markers()->markersInRange(range.get(), DocumentMarker::Spelling); - if (!markers.isEmpty()) { - Vector<String> suggestions; - for (size_t i = 0; i < markers.size(); ++i) { - if (!markers[i]->description().isEmpty()) { - Vector<String> descriptions; - markers[i]->description().split('\n', descriptions); - suggestions.append(descriptions); + if (range.get()) { + Vector<DocumentMarker*> markers = selectedFrame->document()->markers()->markersInRange(range.get(), DocumentMarker::Spelling); + if (!markers.isEmpty()) { + Vector<String> suggestions; + for (size_t i = 0; i < markers.size(); ++i) { + if (!markers[i]->description().isEmpty()) { + Vector<String> descriptions; + markers[i]->description().split('\n', descriptions); + suggestions.append(descriptions); + } } + data.dictionarySuggestions = suggestions; + data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame); } - data.dictionarySuggestions = suggestions; - data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame); } } else if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) { data.isSpellCheckingEnabled = true; diff --git a/Source/WebKit/chromium/src/DragClientImpl.cpp b/Source/WebKit/chromium/src/DragClientImpl.cpp index f4b9e160d..afa570611 100644 --- a/Source/WebKit/chromium/src/DragClientImpl.cpp +++ b/Source/WebKit/chromium/src/DragClientImpl.cpp @@ -36,11 +36,12 @@ #include "Frame.h" #include "NativeImageSkia.h" #include "platform/WebCommon.h" -#include "platform/WebDragData.h" #include "platform/WebImage.h" #include "WebViewClient.h" #include "WebViewImpl.h" +#include <public/WebDragData.h> + using namespace WebCore; namespace WebKit { @@ -88,11 +89,7 @@ void DragClientImpl::startDrag(DragImageRef dragImage, WebPoint offsetPoint(offsetSize.width(), offsetSize.height()); m_webView->startDragging( dragData, static_cast<WebDragOperationsMask>(dragOperationMask), -#if WEBKIT_USING_SKIA dragImage ? WebImage(*dragImage) : WebImage(), -#else - dragImage ? WebImage(dragImage) : WebImage(), -#endif offsetPoint); } diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp index abe1e98b4..d0602a9a0 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -68,6 +68,7 @@ #include "WebFrameClient.h" #include "WebFrameImpl.h" #include "WebIntentRequest.h" +#include "WebIntentServiceInfo.h" #include "WebKit.h" #include "WebNode.h" #include "WebPermissionClient.h" @@ -634,8 +635,14 @@ void FrameLoaderClientImpl::dispatchDidNavigateWithinPage() // didStopLoading only when loader is completed so that we don't fire // them for fragment redirection that happens in window.onload handler. // See https://bugs.webkit.org/show_bug.cgi?id=31838 - bool loaderCompleted = - !webView->page()->mainFrame()->loader()->activeDocumentLoader()->isLoadingInAPISense(); + // + // FIXME: Although FrameLoader::loadInSameDocument which invokes this + // method does not have a provisional document loader, we're seeing crashes + // where the FrameLoader is in provisional state, and thus + // activeDocumentLoader returns 0. Lacking any understanding of how this + // can happen, we do this check here to avoid crashing. + FrameLoader* loader = webView->page()->mainFrame()->loader(); + bool loaderCompleted = !(loader->activeDocumentLoader() && loader->activeDocumentLoader()->isLoadingInAPISense()); // Generate didStartLoading if loader is completed. if (webView->client() && loaderCompleted) @@ -1376,6 +1383,10 @@ void FrameLoaderClientImpl::setTitle(const StringWithDirection& title, const KUR String FrameLoaderClientImpl::userAgent(const KURL& url) { + WebString override; + if (m_webFrame->client()->userAgent(WebURL(url), &override)) + return override; + return WebKit::Platform::current()->userAgent(url); } @@ -1591,10 +1602,28 @@ bool FrameLoaderClientImpl::willCheckAndDispatchMessageEvent( if (!m_webFrame->client()) return false; + WebFrame* source = 0; + if (event && event->source() && event->source()->document()) + source = WebFrameImpl::fromFrame(event->source()->document()->frame()); return m_webFrame->client()->willCheckAndDispatchMessageEvent( - m_webFrame, WebSecurityOrigin(target), WebDOMMessageEvent(event)); + source, WebSecurityOrigin(target), WebDOMMessageEvent(event)); } +#if ENABLE(WEB_INTENTS_TAG) +void FrameLoaderClientImpl::registerIntentService( + const String& action, + const String& type, + const KURL& href, + const String& title, + const String& disposition) { + if (!m_webFrame->client()) + return; + + WebIntentServiceInfo service(action, type, href, title, disposition); + m_webFrame->client()->registerIntentService(m_webFrame, service); +} +#endif + #if ENABLE(WEB_INTENTS) void FrameLoaderClientImpl::dispatchIntent(PassRefPtr<WebCore::IntentRequest> intentRequest) { diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h index df7e0f123..ecb20a2fb 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -205,6 +205,13 @@ public: virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext(); virtual bool willCheckAndDispatchMessageEvent(WebCore::SecurityOrigin* target, WebCore::MessageEvent*) const; +#if ENABLE(WEB_INTENTS_TAG) + virtual void registerIntentService(const String& action, + const String& type, + const WebCore::KURL& href, + const String& title, + const String& disposition); +#endif #if ENABLE(WEB_INTENTS) virtual void dispatchIntent(PassRefPtr<WebCore::IntentRequest>) OVERRIDE; #endif diff --git a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp index 5f6d52750..6fded29ff 100644 --- a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp @@ -41,7 +41,6 @@ #include "FileSystemType.h" #include "PlatformString.h" #include "WebFileError.h" -#include "platform/WebFileSystem.h" #include "WebFileSystemCallbacksImpl.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" @@ -51,6 +50,7 @@ #include "WorkerContext.h" #include "WorkerFileSystemCallbacksBridge.h" #include "WorkerThread.h" +#include <public/WebFileSystem.h> #include <wtf/Threading.h> using namespace WebKit; @@ -194,7 +194,7 @@ static void openFileSystemHelper(ScriptExecutionContext* context, FileSystemType if (webView->permissionClient() && !webView->permissionClient()->allowFileSystem(webFrame)) allowed = false; else - webFrame->client()->openFileSystem(webFrame, static_cast<WebFileSystem::Type>(type), size, create == CreateIfNotPresent, new WebFileSystemCallbacksImpl(callbacks, type)); + webFrame->client()->openFileSystem(webFrame, static_cast<WebFileSystem::Type>(type), size, create == CreateIfNotPresent, new WebFileSystemCallbacksImpl(callbacks)); } else { #if ENABLE(WORKERS) WorkerContext* workerContext = static_cast<WorkerContext*>(context); @@ -203,7 +203,7 @@ static void openFileSystemHelper(ScriptExecutionContext* context, FileSystemType if (!allowFileSystemForWorker(webWorker->commonClient())) allowed = false; else - openFileSystemForWorker(webWorker->commonClient(), static_cast<WebFileSystem::Type>(type), size, create == CreateIfNotPresent, new WebFileSystemCallbacksImpl(callbacks, type, context, synchronousType), synchronousType); + openFileSystemForWorker(webWorker->commonClient(), static_cast<WebFileSystem::Type>(type), size, create == CreateIfNotPresent, new WebFileSystemCallbacksImpl(callbacks, context, synchronousType), synchronousType); #else ASSERT_NOT_REACHED(); diff --git a/Source/WebKit/chromium/src/LocalizedStrings.cpp b/Source/WebKit/chromium/src/LocalizedStrings.cpp index 6af49515f..75b3a2847 100644 --- a/Source/WebKit/chromium/src/LocalizedStrings.cpp +++ b/Source/WebKit/chromium/src/LocalizedStrings.cpp @@ -215,6 +215,12 @@ String crashedPluginText() return String("Plug-in Failure"); } +String insecurePluginVersionText() +{ + notImplemented(); + return String(); +} + String multipleFileUploadText(unsigned numberOfFiles) { return query(WebLocalizedString::MultipleFileUploadText, String::number(numberOfFiles)); diff --git a/Source/WebKit/chromium/src/PageOverlay.cpp b/Source/WebKit/chromium/src/PageOverlay.cpp index 5f16d29c2..b5d157a4b 100644 --- a/Source/WebKit/chromium/src/PageOverlay.cpp +++ b/Source/WebKit/chromium/src/PageOverlay.cpp @@ -46,11 +46,7 @@ namespace { WebCanvas* ToWebCanvas(GraphicsContext* gc) { -#if WEBKIT_USING_SKIA return gc->platformContext()->canvas(); -#elif WEBKIT_USING_CG - return gc->platformContext(); -#endif } } // namespace diff --git a/Source/WebKit/chromium/src/PageWidgetDelegate.cpp b/Source/WebKit/chromium/src/PageWidgetDelegate.cpp index 058bae024..cb9e95fc3 100644 --- a/Source/WebKit/chromium/src/PageWidgetDelegate.cpp +++ b/Source/WebKit/chromium/src/PageWidgetDelegate.cpp @@ -59,7 +59,8 @@ void PageWidgetDelegate::animate(Page* page, double monotonicFrameBeginTime) FrameView* view = mainFrameView(page); if (!view) return; - view->serviceScriptedAnimations(monotonicFrameBeginTime); + double timeShift = currentTime() - monotonicallyIncreasingTime(); + view->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(monotonicFrameBeginTime + timeShift)); #endif } @@ -152,6 +153,7 @@ bool PageWidgetDelegate::handleInputEvent(Page* page, PageWidgetEventHandler& ha case WebInputEvent::GestureTap: case WebInputEvent::GestureTapDown: case WebInputEvent::GestureDoubleTap: + case WebInputEvent::GestureLongPress: return handler.handleGestureEvent(*static_cast<const WebGestureEvent*>(&event)); #endif diff --git a/Source/WebKit/chromium/src/PlatformSupport.cpp b/Source/WebKit/chromium/src/PlatformSupport.cpp index de9810dbd..717455688 100644 --- a/Source/WebKit/chromium/src/PlatformSupport.cpp +++ b/Source/WebKit/chromium/src/PlatformSupport.cpp @@ -50,7 +50,6 @@ #include "WebWorkerClientImpl.h" #include "WebWorkerRunLoop.h" #include "platform/WebAudioBus.h" -#include "platform/WebClipboard.h" #include "platform/WebCookie.h" #include "platform/WebCookieJar.h" #include "platform/WebData.h" @@ -81,9 +80,7 @@ #include "platform/android/WebThemeEngine.h" #endif -#if WEBKIT_USING_SKIA #include "NativeImageSkia.h" -#endif #include "AsyncFileSystemChromium.h" #include "BitmapImage.h" @@ -101,6 +98,7 @@ #include "Worker.h" #include "WorkerContextProxy.h" +#include <public/WebClipboard.h> #include <public/WebMimeRegistry.h> #include <wtf/Assertions.h> @@ -224,11 +222,7 @@ void PlatformSupport::clipboardWriteImage(NativeImagePtr image, const KURL& sourceURL, const String& title) { -#if WEBKIT_USING_SKIA WebImage webImage(image->bitmap()); -#else - WebImage webImage(image); -#endif webKitPlatformSupport()->clipboard()->writeImage(webImage, sourceURL, title); } @@ -404,14 +398,9 @@ int PlatformSupport::writeToFile(PlatformFileHandle handle, const char* data, in } #if ENABLE(FILE_SYSTEM) -String PlatformSupport::createIsolatedFileSystemName(const String& storageIdentifier, const String& filesystemId) +PassOwnPtr<AsyncFileSystem> PlatformSupport::createAsyncFileSystem() { - return AsyncFileSystemChromium::createIsolatedFileSystemName(storageIdentifier, filesystemId); -} - -PassOwnPtr<AsyncFileSystem> PlatformSupport::createIsolatedFileSystem(const String& originString, const String& filesystemId) -{ - return AsyncFileSystemChromium::createIsolatedFileSystem(originString, filesystemId); + return AsyncFileSystemChromium::create(); } #endif @@ -558,17 +547,6 @@ NPObject* PlatformSupport::pluginScriptableObject(Widget* widget) // Resources ------------------------------------------------------------------ -PassRefPtr<Image> PlatformSupport::loadPlatformImageResource(const char* name) -{ - const WebData& resource = webKitPlatformSupport()->loadResource(name); - if (resource.isEmpty()) - return Image::nullImage(); - - RefPtr<Image> image = BitmapImage::create(); - image->setData(resource, true); - return image; -} - #if ENABLE(WEB_AUDIO) PassOwnPtr<AudioBus> PlatformSupport::decodeAudioFileData(const char* data, size_t size, double sampleRate) @@ -688,11 +666,7 @@ void PlatformSupport::paintScrollbarThumb( webThemeScrollbarInfo.visibleSize = scrollbarInfo.visibleSize; webThemeScrollbarInfo.totalSize = scrollbarInfo.totalSize; -#if WEBKIT_USING_SKIA WebKit::WebCanvas* webCanvas = gc->platformContext()->canvas(); -#else - WebKit::WebCanvas* webCanvas = gc->platformContext(); -#endif webKitPlatformSupport()->themeEngine()->paintScrollbarThumb( webCanvas, static_cast<WebThemeEngine::State>(state), @@ -811,28 +785,6 @@ void PlatformSupport::paintThemePart( #endif -// Trace Event ---------------------------------------------------------------- - -const unsigned char* PlatformSupport::getTraceCategoryEnabledFlag(const char* categoryName) -{ - return webKitPlatformSupport()->getTraceCategoryEnabledFlag(categoryName); -} -int PlatformSupport::addTraceEvent(char phase, - const unsigned char* categoryEnabledFlag, - const char* name, - unsigned long long id, - int numArgs, - const char** argNames, - const unsigned char* argTypes, - const unsigned long long* argValues, - int thresholdBeginId, - long long threshold, - unsigned char flags) -{ - return webKitPlatformSupport()->addTraceEvent( - phase, categoryEnabledFlag, name, id, numArgs, argNames, argTypes, argValues, thresholdBeginId, threshold, flags); -} - // Visited Links -------------------------------------------------------------- LinkHash PlatformSupport::visitedLinkHash(const UChar* url, unsigned length) diff --git a/Source/WebKit/chromium/src/StorageAreaProxy.cpp b/Source/WebKit/chromium/src/StorageAreaProxy.cpp index 11eb7cec3..00cc4433b 100644 --- a/Source/WebKit/chromium/src/StorageAreaProxy.cpp +++ b/Source/WebKit/chromium/src/StorageAreaProxy.cpp @@ -80,42 +80,29 @@ String StorageAreaProxy::getItem(const String& key, Frame* frame) const return String(); } -String StorageAreaProxy::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame) +void StorageAreaProxy::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame) { - WebKit::WebStorageArea::Result result = WebKit::WebStorageArea::ResultOK; - WebKit::WebString oldValue; if (!canAccessStorage(frame)) ec = QUOTA_EXCEEDED_ERR; else { - m_storageArea->setItem(key, value, frame->document()->url(), result, oldValue); + WebKit::WebStorageArea::Result result = WebKit::WebStorageArea::ResultOK; + m_storageArea->setItem(key, value, frame->document()->url(), result); ec = (result == WebKit::WebStorageArea::ResultOK) ? 0 : QUOTA_EXCEEDED_ERR; - String oldValueString = oldValue; - if (oldValueString != value && result == WebKit::WebStorageArea::ResultOK) - storageEvent(key, oldValue, value, m_storageType, frame->document()->securityOrigin(), frame); } - return oldValue; } -String StorageAreaProxy::removeItem(const String& key, Frame* frame) +void StorageAreaProxy::removeItem(const String& key, Frame* frame) { if (!canAccessStorage(frame)) - return String(); - WebKit::WebString oldValue; - m_storageArea->removeItem(key, frame->document()->url(), oldValue); - if (!oldValue.isNull()) - storageEvent(key, oldValue, String(), m_storageType, frame->document()->securityOrigin(), frame); - return oldValue; + return; + m_storageArea->removeItem(key, frame->document()->url()); } -bool StorageAreaProxy::clear(Frame* frame) +void StorageAreaProxy::clear(Frame* frame) { if (!canAccessStorage(frame)) - return false; - bool clearedSomething; - m_storageArea->clear(frame->document()->url(), clearedSomething); - if (clearedSomething) - storageEvent(String(), String(), String(), m_storageType, frame->document()->securityOrigin(), frame); - return clearedSomething; + return; + m_storageArea->clear(frame->document()->url()); } bool StorageAreaProxy::contains(const String& key, Frame* frame) const @@ -123,54 +110,6 @@ bool StorageAreaProxy::contains(const String& key, Frame* frame) const return !getItem(key, frame).isNull(); } -// FIXME: remove this method and the calls to it from our setters after multi-side patch landing is done. -// Copied from WebCore/storage/StorageEventDispatcher.cpp out of necessity. It's probably best to keep it current. -void StorageAreaProxy::storageEvent(const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Frame* sourceFrame) -{ - Page* page = sourceFrame->page(); - if (!page) - return; - - // We need to copy all relevant frames from every page to a vector since sending the event to one frame might mutate the frame tree - // of any given page in the group or mutate the page group itself. - Vector<RefPtr<Frame> > frames; - if (storageType == SessionStorage) { - // Send events only to our page. - for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin)) - frames.append(frame); - } - - for (unsigned i = 0; i < frames.size(); ++i) { - // FIXME: maybe only raise if the window has an onstorage listener - // attached to avoid creating the Storage instance. - ExceptionCode ec = 0; - Storage* storage = frames[i]->domWindow()->sessionStorage(ec); - if (!ec) - frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage)); - } - } else { - // Send events to every page. - const HashSet<Page*>& pages = page->group().pages(); - HashSet<Page*>::const_iterator end = pages.end(); - for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) { - for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin)) - frames.append(frame); - } - } - - for (unsigned i = 0; i < frames.size(); ++i) { - // FIXME: maybe only raise if the window has an onstorage listener - // attached to avoid creating the Storage instance. - ExceptionCode ec = 0; - Storage* storage = frames[i]->domWindow()->localStorage(ec); - if (!ec) - frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage)); - } - } -} - bool StorageAreaProxy::canAccessStorage(Frame* frame) const { if (!frame->page()) @@ -180,18 +119,10 @@ bool StorageAreaProxy::canAccessStorage(Frame* frame) const return !webView->permissionClient() || webView->permissionClient()->allowStorage(webFrame, m_storageType == LocalStorage); } -void StorageAreaProxy::dispatchLocalStorageEvent(const String& pageGroupName, const String& key, const String& oldValue, const String& newValue, +void StorageAreaProxy::dispatchLocalStorageEvent(PageGroup* pageGroup, const String& key, const String& oldValue, const String& newValue, SecurityOrigin* securityOrigin, const KURL& pageURL, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess) { - // FIXME: Multi-sided patch engineering alert ! - // step 1: this method gets defined and implemented in webkit/webcore with the early return. - // step 2: this method starts getting called by chromium still with the early return. - // step 3: This class's setters are modified to no longer raise SessionStorage - // events for inprocess changes and this early return is removed. - if (originatedInProcess) - return; - - const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroupName)->pages(); + const HashSet<Page*>& pages = pageGroup->pages(); for (HashSet<Page*>::const_iterator it = pages.begin(); it != pages.end(); ++it) { for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) { if (frame->document()->securityOrigin()->equal(securityOrigin) && !isEventSource(frame->domWindow()->optionalLocalStorage(), sourceAreaInstance)) { @@ -205,9 +136,9 @@ void StorageAreaProxy::dispatchLocalStorageEvent(const String& pageGroupName, co } } -static Page* findPageWithSessionStorageNamespace(const String& pageGroupName, const WebKit::WebStorageNamespace& sessionNamespace) +static Page* findPageWithSessionStorageNamespace(PageGroup* pageGroup, const WebKit::WebStorageNamespace& sessionNamespace) { - const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroupName)->pages(); + const HashSet<Page*>& pages = pageGroup->pages(); for (HashSet<Page*>::const_iterator it = pages.begin(); it != pages.end(); ++it) { const bool createIfNeeded = true; StorageNamespaceProxy* proxy = static_cast<StorageNamespaceProxy*>((*it)->sessionStorage(createIfNeeded)); @@ -217,19 +148,11 @@ static Page* findPageWithSessionStorageNamespace(const String& pageGroupName, co return 0; } -void StorageAreaProxy::dispatchSessionStorageEvent(const String& pageGroupName, const String& key, const String& oldValue, const String& newValue, +void StorageAreaProxy::dispatchSessionStorageEvent(PageGroup* pageGroup, const String& key, const String& oldValue, const String& newValue, SecurityOrigin* securityOrigin, const KURL& pageURL, const WebKit::WebStorageNamespace& sessionNamespace, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess) { - // FIXME: Multi-sided patch engineering alert ! - // step 1: this method gets defined and implemented in webkit/webcore with the early return. - // step 2: this method starts getting called by chromium still with the early return. - // step 3: This class's setters are modified to no longer raise SessionStorage - // events for inprocess changes and this early return is removed. - if (originatedInProcess) - return; - - Page* page = findPageWithSessionStorageNamespace(pageGroupName, sessionNamespace); + Page* page = findPageWithSessionStorageNamespace(pageGroup, sessionNamespace); if (!page) return; diff --git a/Source/WebKit/chromium/src/StorageAreaProxy.h b/Source/WebKit/chromium/src/StorageAreaProxy.h index ab2357470..83f2eae17 100644 --- a/Source/WebKit/chromium/src/StorageAreaProxy.h +++ b/Source/WebKit/chromium/src/StorageAreaProxy.h @@ -38,6 +38,7 @@ namespace WebCore { class Frame; class KURL; class Page; +class PageGroup; class SecurityOrigin; class Storage; @@ -50,23 +51,22 @@ public: virtual unsigned length(Frame* sourceFrame) const; virtual String key(unsigned index, Frame* sourceFrame) const; virtual String getItem(const String& key, Frame* sourceFrame) const; - virtual String setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame); - virtual String removeItem(const String& key, Frame* sourceFrame); - virtual bool clear(Frame* sourceFrame); + virtual void setItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame); + virtual void removeItem(const String& key, Frame* sourceFrame); + virtual void clear(Frame* sourceFrame); virtual bool contains(const String& key, Frame* sourceFrame) const; virtual bool disabledByPrivateBrowsingInFrame(const Frame*) const { return false; } static void dispatchLocalStorageEvent( - const String& pageGroupName, const String& key, const String& oldValue, const String& newValue, + PageGroup*, const String& key, const String& oldValue, const String& newValue, SecurityOrigin*, const KURL& pageURL, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess); static void dispatchSessionStorageEvent( - const String& pageGroupName, const String& key, const String& oldValue, const String& newValue, + PageGroup*, const String& key, const String& oldValue, const String& newValue, SecurityOrigin*, const KURL& pageURL, const WebKit::WebStorageNamespace&, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess); private: - void storageEvent(const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Frame* sourceFrame); bool canAccessStorage(Frame*) const; static bool isEventSource(Storage*, WebKit::WebStorageArea* sourceAreaInstance); diff --git a/Source/WebKit/chromium/src/StorageEventDispatcherImpl.cpp b/Source/WebKit/chromium/src/StorageEventDispatcherImpl.cpp deleted file mode 100644 index e948b597c..000000000 --- a/Source/WebKit/chromium/src/StorageEventDispatcherImpl.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "StorageEventDispatcherImpl.h" - -#include "DOMWindow.h" -#include "Document.h" -#include "EventNames.h" -#include "Frame.h" -#include "KURL.h" -#include "Page.h" -#include "PageGroup.h" -#include "SecurityOrigin.h" -#include "StorageEvent.h" - -// FIXME: delete this almost obsolete file soon - -namespace WebCore { - -StorageEventDispatcherImpl::StorageEventDispatcherImpl(const String& groupName) - : m_pageGroup(PageGroup::pageGroup(groupName)) -{ - ASSERT(m_pageGroup); -} - -void StorageEventDispatcherImpl::dispatchStorageEvent(const String& key, const String& oldValue, - const String& newValue, SecurityOrigin* securityOrigin, - const KURL& url, StorageType storageType) -{ - // FIXME: Implement - if (storageType == SessionStorage) - return; - - // We need to copy all relevant frames from every page to a vector since sending the event to one frame might mutate the frame tree - // of any given page in the group or mutate the page group itself. - Vector<RefPtr<Frame> > frames; - - const HashSet<Page*>& pages = m_pageGroup->pages(); - HashSet<Page*>::const_iterator end = pages.end(); - for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) { - for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - if (frame->document()->securityOrigin()->equal(securityOrigin)) - frames.append(frame); - } - } - - for (unsigned i = 0; i < frames.size(); ++i) { - ExceptionCode ec = 0; - Storage* storage = frames[i]->domWindow()->localStorage(ec); - if (!ec) - frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, url, storage)); - } -} - -} // namespace WebCore diff --git a/Source/WebKit/chromium/src/StorageEventDispatcherImpl.h b/Source/WebKit/chromium/src/StorageEventDispatcherImpl.h deleted file mode 100644 index d3433851f..000000000 --- a/Source/WebKit/chromium/src/StorageEventDispatcherImpl.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef StorageEventDispatcherImpl_h -#define StorageEventDispatcherImpl_h - -#include "PlatformString.h" -#include "StorageArea.h" - -namespace WebCore { - -class KURL; -class PageGroup; -class SecurityOrigin; - -class StorageEventDispatcherImpl { -public: - StorageEventDispatcherImpl(const String& groupName); - - void dispatchStorageEvent(const String& key, const String& oldValue, - const String& newValue, SecurityOrigin*, - const KURL&, StorageType); - -private: - PageGroup* m_pageGroup; -}; - -} // namespace WebCore - -#endif // StorageEventDispatcherImpl_h diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp index 4f64d5471..4d476095d 100644 --- a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp @@ -30,9 +30,7 @@ #include "platform/WebRect.h" #include "GraphicsContext.h" #include "platform/WebCanvas.h" -#if WEBKIT_USING_SKIA #include "PlatformContextSkia.h" -#endif using namespace WebCore; @@ -64,11 +62,7 @@ void WebContentLayerImpl::paintContents(GraphicsContext& gc, const IntRect& clip { if (!m_contentClient) return; -#if WEBKIT_USING_SKIA WebCanvas* canvas = gc.platformContext()->canvas(); -#elif WEBKIT_USING_CG - WebCanvas* canvas = gc.platformContext(); -#endif m_contentClient->paintContents(canvas, WebRect(clip)); } diff --git a/Source/WebKit/chromium/src/WebDragData.cpp b/Source/WebKit/chromium/src/WebDragData.cpp index 61d86a388..f9846efd8 100644 --- a/Source/WebKit/chromium/src/WebDragData.cpp +++ b/Source/WebKit/chromium/src/WebDragData.cpp @@ -29,7 +29,6 @@ */ #include "config.h" -#include "platform/WebDragData.h" #include "ChromiumDataObject.h" #include "ClipboardMimeTypes.h" @@ -40,6 +39,7 @@ #include "platform/WebURL.h" #include "platform/WebVector.h" +#include <public/WebDragData.h> #include <wtf/HashMap.h> #include <wtf/PassRefPtr.h> diff --git a/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp b/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp index c110e7c22..06809e54b 100644 --- a/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp +++ b/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp @@ -37,19 +37,18 @@ #include "FileMetadata.h" #include "ScriptExecutionContext.h" #include "WebFileInfo.h" -#include "platform/WebFileSystem.h" #include "WebFileSystemEntry.h" #include "platform/WebString.h" #include "WorkerAsyncFileSystemChromium.h" +#include <public/WebFileSystem.h> #include <wtf/Vector.h> using namespace WebCore; namespace WebKit { -WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemType type, WebCore::ScriptExecutionContext* context, FileSystemSynchronousType synchronousType) +WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSystemCallbacks> callbacks, ScriptExecutionContext* context, FileSystemSynchronousType synchronousType) : m_callbacks(callbacks) - , m_type(type) , m_context(context) , m_synchronousType(synchronousType) { @@ -92,11 +91,11 @@ void WebFileSystemCallbacksImpl::didOpenFileSystem(const WebString& name, const #if ENABLE(WORKERS) if (m_context && m_context->isWorkerContext()) { - m_callbacks->didOpenFileSystem(name, WorkerAsyncFileSystemChromium::create(m_context, m_type, rootURL, m_synchronousType)); + m_callbacks->didOpenFileSystem(name, rootURL, WorkerAsyncFileSystemChromium::create(m_context, m_synchronousType)); return; } #endif - m_callbacks->didOpenFileSystem(name, AsyncFileSystemChromium::create(m_type, rootURL)); + m_callbacks->didOpenFileSystem(name, rootURL, AsyncFileSystemChromium::create()); } void WebFileSystemCallbacksImpl::didFail(WebFileError error) diff --git a/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h b/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h index 76e8cdf8f..e5f04081f 100644 --- a/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h +++ b/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h @@ -33,8 +33,8 @@ #include "FileSystemType.h" #include "WebFileSystemCallbacks.h" -#include "platform/WebFileSystem.h" #include "platform/WebVector.h" +#include <public/WebFileSystem.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -52,7 +52,7 @@ class WebURL; class WebFileSystemCallbacksImpl : public WebFileSystemCallbacks { public: - WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, WebCore::FileSystemType = WebCore::FileSystemTypeTemporary, WebCore::ScriptExecutionContext* = 0, WebCore::FileSystemSynchronousType = WebCore::AsynchronousFileSystem); + WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, WebCore::ScriptExecutionContext* = 0, WebCore::FileSystemSynchronousType = WebCore::AsynchronousFileSystem); virtual ~WebFileSystemCallbacksImpl(); virtual void didSucceed(); @@ -64,9 +64,6 @@ public: private: OwnPtr<WebCore::AsyncFileSystemCallbacks> m_callbacks; - // Used for openFileSystem callbacks. - WebCore::FileSystemType m_type; - // Used for worker's openFileSystem callbacks. WebCore::ScriptExecutionContext* m_context; WebCore::FileSystemSynchronousType m_synchronousType; diff --git a/Source/WebKit/chromium/src/WebFontImpl.cpp b/Source/WebKit/chromium/src/WebFontImpl.cpp index f6cf39dbe..8a05aed84 100644 --- a/Source/WebKit/chromium/src/WebFontImpl.cpp +++ b/Source/WebKit/chromium/src/WebFontImpl.cpp @@ -99,12 +99,7 @@ void WebFontImpl::drawText(WebCanvas* canvas, const WebTextRun& run, const WebFl GraphicsContextBuilder builder(canvas); GraphicsContext& gc = builder.context(); -#if WEBKIT_USING_SKIA gc.platformContext()->setDrawingToImageBuffer(!canvasIsOpaque); -#elif WEBKIT_USING_CG - // FIXME hook canvasIsOpaque up to the platform-specific indicators for - // whether subpixel AA can be used for this draw. -#endif gc.save(); gc.setFillColor(color, ColorSpaceDeviceRGB); diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index d0e6fe238..6cccb9316 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -122,6 +122,7 @@ #include "ResourceHandle.h" #include "ResourceRequest.h" #include "SchemeRegistry.h" +#include "ScriptCallStack.h" #include "ScriptController.h" #include "ScriptSourceCode.h" #include "ScriptValue.h" @@ -178,7 +179,7 @@ #include "V8DirectoryEntry.h" #include "V8DOMFileSystem.h" #include "V8FileEntry.h" -#include "platform/WebFileSystem.h" +#include <public/WebFileSystem.h> #endif using namespace WebCore; @@ -595,11 +596,6 @@ WebVector<WebIconURL> WebFrameImpl::iconURLs(int iconTypes) const return WebVector<WebIconURL>(); } -WebReferrerPolicy WebFrameImpl::referrerPolicy() const -{ - return static_cast<WebReferrerPolicy>(m_frame->document()->referrerPolicy()); -} - WebSize WebFrameImpl::scrollOffset() const { FrameView* view = frameView(); @@ -939,7 +935,7 @@ v8::Handle<v8::Value> WebFrameImpl::createFileSystem(WebFileSystem::Type type, const WebString& name, const WebString& path) { - return toV8(DOMFileSystem::create(frame()->document(), name, AsyncFileSystemChromium::create(static_cast<FileSystemType>(type), KURL(ParsedURLString, path.utf8().data())))); + return toV8(DOMFileSystem::create(frame()->document(), name, static_cast<WebCore::FileSystemType>(type), KURL(ParsedURLString, path.utf8().data()), AsyncFileSystemChromium::create())); } v8::Handle<v8::Value> WebFrameImpl::createFileEntry(WebFileSystem::Type type, @@ -948,7 +944,7 @@ v8::Handle<v8::Value> WebFrameImpl::createFileEntry(WebFileSystem::Type type, const WebString& filePath, bool isDirectory) { - RefPtr<DOMFileSystemBase> fileSystem = DOMFileSystem::create(frame()->document(), fileSystemName, AsyncFileSystemChromium::create(static_cast<FileSystemType>(type), KURL(ParsedURLString, fileSystemPath.utf8().data()))); + RefPtr<DOMFileSystemBase> fileSystem = DOMFileSystem::create(frame()->document(), fileSystemName, static_cast<WebCore::FileSystemType>(type), KURL(ParsedURLString, fileSystemPath.utf8().data()), AsyncFileSystemChromium::create()); if (isDirectory) return toV8(DirectoryEntry::create(fileSystem, filePath)); return toV8(FileEntry::create(fileSystem, filePath)); @@ -1497,9 +1493,7 @@ float WebFrameImpl::printPage(int page, WebCanvas* canvas) GraphicsContextBuilder builder(canvas); GraphicsContext& gc = builder.context(); -#if WEBKIT_USING_SKIA gc.platformContext()->setPrinting(true); -#endif return m_printContext->spoolPage(gc, page); } @@ -1865,6 +1859,14 @@ void WebFrameImpl::handleIntentFailure(int intentIdentifier, const WebString& re { } +void WebFrameImpl::sendOrientationChangeEvent(int orientation) +{ +#if ENABLE(ORIENTATION_EVENTS) + if (m_frame) + m_frame->sendOrientationChangeEvent(orientation); +#endif +} + void WebFrameImpl::addEventListener(const WebString& eventType, WebDOMEventListener* listener, bool useCapture) { DOMWindow* window = m_frame->domWindow(); @@ -1890,6 +1892,13 @@ bool WebFrameImpl::dispatchEvent(const WebDOMEvent& event) return m_frame->domWindow()->dispatchEvent(event); } +void WebFrameImpl::dispatchMessageEventWithOriginCheck(const WebSecurityOrigin& intendedTargetOrigin, const WebDOMEvent& event) +{ + ASSERT(!event.isNull()); + // Pass an empty call stack, since we don't have the one from the other process. + m_frame->domWindow()->dispatchMessageEventWithOriginCheck(intendedTargetOrigin.get(), event, 0); +} + WebString WebFrameImpl::contentAsText(size_t maxChars) const { if (!m_frame) @@ -1960,9 +1969,7 @@ void WebFrameImpl::printPagesWithBoundaries(WebCanvas* canvas, const WebSize& pa GraphicsContextBuilder builder(canvas); GraphicsContext& graphicsContext = builder.context(); -#if WEBKIT_USING_SKIA graphicsContext.platformContext()->setPrinting(true); -#endif m_printContext->spoolAllPagesWithBoundaries(graphicsContext, FloatSize(pageSizeInPixels.width, pageSizeInPixels.height)); diff --git a/Source/WebKit/chromium/src/WebFrameImpl.h b/Source/WebKit/chromium/src/WebFrameImpl.h index c3acc1afb..389946d05 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.h +++ b/Source/WebKit/chromium/src/WebFrameImpl.h @@ -72,7 +72,6 @@ public: virtual void setName(const WebString&); virtual long long identifier() const; virtual WebVector<WebIconURL> iconURLs(int iconTypes) const; - virtual WebReferrerPolicy referrerPolicy() const; virtual WebSize scrollOffset() const; virtual void setScrollOffset(const WebSize&); virtual WebSize minimumScrollOffset() const; @@ -208,11 +207,16 @@ public: virtual void handleIntentResult(int, const WebString&); virtual void handleIntentFailure(int, const WebString&); + virtual void sendOrientationChangeEvent(int orientation); + virtual void addEventListener(const WebString& eventType, WebDOMEventListener*, bool useCapture); virtual void removeEventListener(const WebString& eventType, WebDOMEventListener*, bool useCapture); virtual bool dispatchEvent(const WebDOMEvent&); + virtual void dispatchMessageEventWithOriginCheck( + const WebSecurityOrigin& intendedTargetOrigin, + const WebDOMEvent&); virtual WebString contentAsText(size_t maxChars) const; virtual WebString contentAsMarkup() const; diff --git a/Source/WebKit/chromium/src/WebGraphicsContext3D.cpp b/Source/WebKit/chromium/src/WebGraphicsContext3D.cpp index 51fbfb70d..f9e051852 100644 --- a/Source/WebKit/chromium/src/WebGraphicsContext3D.cpp +++ b/Source/WebKit/chromium/src/WebGraphicsContext3D.cpp @@ -30,8 +30,6 @@ namespace WebKit { -#if WEBKIT_USING_SKIA - namespace { void bindWebGraphicsContext3DGLContextCallback(const GrGLInterface* interface) { @@ -49,6 +47,4 @@ GrGLInterface* WebGraphicsContext3D::createGrGLInterface() return interface; } -#endif - } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebImageCG.cpp b/Source/WebKit/chromium/src/WebImageCG.cpp index 0f2c0c473..242a68304 100644 --- a/Source/WebKit/chromium/src/WebImageCG.cpp +++ b/Source/WebKit/chromium/src/WebImageCG.cpp @@ -29,7 +29,6 @@ */ #include "config.h" -#include "platform/WebImage.h" #include "Image.h" #include "ImageSource.h" @@ -40,6 +39,7 @@ #include <CoreGraphics/CGImage.h> +#include <public/WebImage.h> #include <wtf/PassRefPtr.h> #include <wtf/RetainPtr.h> diff --git a/Source/WebKit/chromium/src/WebImageDecoder.cpp b/Source/WebKit/chromium/src/WebImageDecoder.cpp index 0588314ec..ad0a67e51 100644 --- a/Source/WebKit/chromium/src/WebImageDecoder.cpp +++ b/Source/WebKit/chromium/src/WebImageDecoder.cpp @@ -35,13 +35,12 @@ #include "ICOImageDecoder.h" #include "SharedBuffer.h" #include "platform/WebData.h" -#include "platform/WebImage.h" #include "platform/WebSize.h" -#if WEBKIT_USING_SKIA +#include <public/WebImage.h> + #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> -#endif #include <wtf/PassRefPtr.h> @@ -111,13 +110,8 @@ WebImage WebImageDecoder::getFrameAtIndex(int index = 0) const ImageFrame* const frameBuffer = m_private->frameBufferAtIndex(index); if (!frameBuffer) return WebImage(); -#if WEBKIT_USING_SKIA OwnPtr<NativeImageSkia> image = adoptPtr(frameBuffer->asNewNativeImage()); return WebImage(image->bitmap()); -#elif WEBKIT_USING_CG - // FIXME: Implement CG side of this. - return WebImage(frameBuffer->asNewNativeImage()); -#endif } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebImageSkia.cpp b/Source/WebKit/chromium/src/WebImageSkia.cpp index 9755f3802..36dabac3e 100644 --- a/Source/WebKit/chromium/src/WebImageSkia.cpp +++ b/Source/WebKit/chromium/src/WebImageSkia.cpp @@ -29,7 +29,6 @@ */ #include "config.h" -#include "platform/WebImage.h" #include "Image.h" #include "ImageSource.h" @@ -39,6 +38,7 @@ #include "platform/WebData.h" #include "platform/WebSize.h" +#include <public/WebImage.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp index a4a585b96..6ee01efdd 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -34,14 +34,12 @@ #include "Chrome.h" #include "ChromeClientImpl.h" #include "ScrollbarGroup.h" -#include "platform/WebClipboard.h" #include "WebCursorInfo.h" #include "WebDataSourceImpl.h" #include "WebElement.h" #include "WebInputEvent.h" #include "WebInputEventConversion.h" #include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" #include "WebPlugin.h" #include "platform/WebRect.h" #include "platform/WebString.h" @@ -75,14 +73,14 @@ #include "ScrollbarTheme.h" #include "UserGestureIndicator.h" #include "WheelEvent.h" +#include <public/Platform.h> +#include <public/WebClipboard.h> #if ENABLE(GESTURE_EVENTS) #include "PlatformGestureEvent.h" #endif -#if WEBKIT_USING_SKIA #include "PlatformContextSkia.h" -#endif using namespace WebCore; @@ -126,11 +124,7 @@ void WebPluginContainerImpl::paint(GraphicsContext* gc, const IntRect& damageRec IntPoint origin = view->windowToContents(IntPoint(0, 0)); gc->translate(static_cast<float>(origin.x()), static_cast<float>(origin.y())); -#if WEBKIT_USING_SKIA WebCanvas* canvas = gc->platformContext()->canvas(); -#elif WEBKIT_USING_CG - WebCanvas* canvas = gc->platformContext(); -#endif IntRect windowRect = IntRect(view->contentsToWindow(damageRect.location()), damageRect.size()); @@ -259,11 +253,7 @@ bool WebPluginContainerImpl::printPage(int pageNumber, WebCore::GraphicsContext* gc) { gc->save(); -#if WEBKIT_USING_SKIA WebCanvas* canvas = gc->platformContext()->canvas(); -#elif WEBKIT_USING_CG - WebCanvas* canvas = gc->platformContext(); -#endif bool ret = m_webPlugin->printPage(pageNumber, canvas); gc->restore(); return ret; @@ -279,7 +269,7 @@ void WebPluginContainerImpl::copy() if (!m_webPlugin->hasSelection()) return; - webKitPlatformSupport()->clipboard()->writeHTML(m_webPlugin->selectionAsMarkup(), WebURL(), m_webPlugin->selectionAsText(), false); + WebKit::Platform::current()->clipboard()->writeHTML(m_webPlugin->selectionAsMarkup(), WebURL(), m_webPlugin->selectionAsText(), false); } WebElement WebPluginContainerImpl::element() @@ -714,9 +704,8 @@ WebCore::IntRect WebPluginContainerImpl::windowClipRect() const if (m_element->renderer()->document()->renderer()) { // Take our element and get the clip rect from the enclosing layer and // frame view. - RenderLayer* layer = m_element->renderer()->enclosingLayer(); clipRect.intersect( - m_element->document()->view()->windowClipRectForLayer(layer, true)); + m_element->document()->view()->windowClipRectForFrameOwner(m_element, true)); } return clipRect; diff --git a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp index c8036aa74..cd77cb46b 100644 --- a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp +++ b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp @@ -29,18 +29,19 @@ */ #include "config.h" -#include "WebStorageEventDispatcherImpl.h" +#include "WebStorageEventDispatcher.h" #include "KURL.h" #include "SecurityOrigin.h" #include "StorageAreaProxy.h" +#include "WebViewImpl.h" #include "platform/WebURL.h" #include <wtf/PassOwnPtr.h> -namespace WebKit { +// FIXME: move this file to WebStorageEventDispatcher.cpp -extern const char* pageGroupName; +namespace WebKit { void WebStorageEventDispatcher::dispatchLocalStorageEvent( const WebString& key, const WebString& oldValue, @@ -50,7 +51,7 @@ void WebStorageEventDispatcher::dispatchLocalStorageEvent( { RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::create(origin); WebCore::StorageAreaProxy::dispatchLocalStorageEvent( - pageGroupName, key, oldValue, newValue, securityOrigin.get(), pageURL, + WebViewImpl::defaultPageGroup(), key, oldValue, newValue, securityOrigin.get(), pageURL, sourceAreaInstance, originatedInProcess); } @@ -62,31 +63,8 @@ void WebStorageEventDispatcher::dispatchSessionStorageEvent( { RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::create(origin); WebCore::StorageAreaProxy::dispatchSessionStorageEvent( - pageGroupName, key, oldValue, newValue, securityOrigin.get(), pageURL, + WebViewImpl::defaultPageGroup(), key, oldValue, newValue, securityOrigin.get(), pageURL, sessionNamespace, sourceAreaInstance, originatedInProcess); } - -// FIXME: remove the WebStorageEventDispatcherImpl class soon. - -WebStorageEventDispatcher* WebStorageEventDispatcher::create() -{ - return new WebStorageEventDispatcherImpl(); -} - -WebStorageEventDispatcherImpl::WebStorageEventDispatcherImpl() - : m_eventDispatcher(adoptPtr(new WebCore::StorageEventDispatcherImpl(pageGroupName))) -{ - ASSERT(m_eventDispatcher); -} - -void WebStorageEventDispatcherImpl::dispatchStorageEvent(const WebString& key, const WebString& oldValue, - const WebString& newValue, const WebString& origin, - const WebURL& pageURL, bool isLocalStorage) -{ - WebCore::StorageType storageType = isLocalStorage ? WebCore::LocalStorage : WebCore::SessionStorage; - RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::createFromString(origin); - m_eventDispatcher->dispatchStorageEvent(key, oldValue, newValue, securityOrigin.get(), pageURL, storageType); -} - } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.h b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.h deleted file mode 100644 index b03c6b7a6..000000000 --- a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebStorageEventDispatcherImpl_h -#define WebStorageEventDispatcherImpl_h - -#include "StorageEventDispatcherImpl.h" -#include "WebStorageEventDispatcher.h" -#include <wtf/OwnPtr.h> - -namespace WebKit { - -// DEPRECATED - to be removed when removing the instance methods in the public api. -class WebStorageEventDispatcherImpl : public WebStorageEventDispatcher { -public: - WebStorageEventDispatcherImpl(); - virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue, - const WebString& newValue, const WebString& origin, - const WebURL&, bool isLocalStorage); -private: - OwnPtr<WebCore::StorageEventDispatcherImpl> m_eventDispatcher; -}; - -} // namespace WebKit - -#endif // WebStorageEventDispatcherImpl_h diff --git a/Source/WebKit/chromium/src/WebTextRun.cpp b/Source/WebKit/chromium/src/WebTextRun.cpp index d2652405c..e8037d24b 100644 --- a/Source/WebKit/chromium/src/WebTextRun.cpp +++ b/Source/WebKit/chromium/src/WebTextRun.cpp @@ -39,7 +39,7 @@ namespace WebKit { WebTextRun::operator WebCore::TextRun() const { - return TextRun(text, false, 0, 0, TextRun::AllowTrailingExpansion, rtl ? RTL : LTR, directionalOverride); + return TextRun(text, 0, 0, TextRun::AllowTrailingExpansion, rtl ? RTL : LTR, directionalOverride); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebUserMediaRequest.cpp b/Source/WebKit/chromium/src/WebUserMediaRequest.cpp index dcd270385..c9c0eccb3 100644 --- a/Source/WebKit/chromium/src/WebUserMediaRequest.cpp +++ b/Source/WebKit/chromium/src/WebUserMediaRequest.cpp @@ -36,11 +36,13 @@ #include "Document.h" #include "Frame.h" +#include "MediaStreamDescriptor.h" #include "MediaStreamSource.h" #include "Page.h" #include "SecurityOrigin.h" #include "UserMediaRequest.h" #include "WebSecurityOrigin.h" +#include "platform/WebMediaStreamDescriptor.h" #include "platform/WebMediaStreamSource.h" #include "platform/WebString.h" #include "platform/WebVector.h" @@ -95,6 +97,15 @@ void WebUserMediaRequest::requestSucceeded(const WebVector<WebMediaStreamSource> m_private->succeed(audio, video); } +void WebUserMediaRequest::requestSucceeded(const WebMediaStreamDescriptor& streamDescriptor) +{ + ASSERT(!streamDescriptor.isNull()); + if (m_private.isNull()) + return; + + m_private->succeed(streamDescriptor); +} + void WebUserMediaRequest::requestFailed() { m_private->fail(); @@ -109,10 +120,7 @@ bool WebUserMediaRequest::equals(const WebUserMediaRequest& other) const void WebUserMediaRequest::assign(const WebUserMediaRequest& other) { - UserMediaRequest* p = other.m_private.get(); - if (p) - p->ref(); - m_private = p; + m_private = other.m_private; } WebUserMediaRequest::operator UserMediaRequest*() const diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index 4318dc79d..626da8a21 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -143,14 +143,14 @@ #include "WheelEvent.h" #include "cc/CCProxy.h" #include "painting/GraphicsContextBuilder.h" -#include "platform/WebDragData.h" -#include "platform/WebImage.h" #include "platform/WebKitPlatformSupport.h" #include "platform/WebString.h" #include "platform/WebVector.h" #include <public/Platform.h> +#include <public/WebDragData.h> #include <public/WebFloatPoint.h> #include <public/WebGraphicsContext3D.h> +#include <public/WebImage.h> #include <public/WebLayer.h> #include <public/WebLayerTreeView.h> #include <public/WebPoint.h> @@ -658,12 +658,22 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) } return gestureHandled; } + case WebInputEvent::GestureLongPress: { + if (!mainFrameImpl() || !mainFrameImpl()->frameView()) + return false; + + m_page->contextMenuController()->clearContextMenu(); + m_contextMenuAllowed = true; + PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); + bool handled = mainFrameImpl()->frame()->eventHandler()->sendContextMenuEventForGesture(platformEvent); + m_contextMenuAllowed = false; + return handled; + } case WebInputEvent::GestureScrollBegin: case WebInputEvent::GestureScrollEnd: case WebInputEvent::GestureScrollUpdate: case WebInputEvent::GestureTapDown: case WebInputEvent::GestureDoubleTap: - case WebInputEvent::GestureLongPress: case WebInputEvent::GesturePinchBegin: case WebInputEvent::GesturePinchEnd: case WebInputEvent::GesturePinchUpdate: { @@ -1251,6 +1261,11 @@ WebViewImpl* WebViewImpl::fromPage(Page* page) return static_cast<WebViewImpl*>(chromeClient->webView()); } +PageGroup* WebViewImpl::defaultPageGroup() +{ + return PageGroup::pageGroup(pageGroupName); +} + // WebWidget ------------------------------------------------------------------ void WebViewImpl::close() @@ -1432,6 +1447,13 @@ void WebViewImpl::updateAnimations(double monotonicFrameBeginTime) #if ENABLE(REQUEST_ANIMATION_FRAME) TRACE_EVENT("WebViewImpl::updateAnimations", this, 0); + WebFrameImpl* webframe = mainFrameImpl(); + if (!webframe) + return; + FrameView* view = webframe->frameView(); + if (!view) + return; + // Create synthetic wheel events as necessary for fling. if (m_gestureAnimation) { if (m_gestureAnimation->animate(monotonicFrameBeginTime)) @@ -1440,9 +1462,6 @@ void WebViewImpl::updateAnimations(double monotonicFrameBeginTime) m_gestureAnimation.clear(); } - if (!m_page) - return; - PageWidgetDelegate::animate(m_page.get(), monotonicFrameBeginTime); #endif } @@ -1872,8 +1891,21 @@ WebTextInputType WebViewImpl::textInputType() return WebTextInputTypeTelephone; if (input->isURLField()) return WebTextInputTypeURL; + if (input->isDateField()) + return WebTextInputTypeDate; + if (input->isDateTimeField()) + return WebTextInputTypeDateTime; + if (input->isDateTimeLocalField()) + return WebTextInputTypeDateTimeLocal; + if (input->isMonthField()) + return WebTextInputTypeMonth; + if (input->isTimeField()) + return WebTextInputTypeTime; + if (input->isWeekField()) + return WebTextInputTypeWeek; if (input->isTextField()) return WebTextInputTypeText; + return WebTextInputTypeNone; } diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index 9383ba28d..9b44fb68d 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -69,6 +69,7 @@ class HistoryItem; class HitTestResult; class KeyboardEvent; class Page; +class PageGroup; class PagePopup; class PagePopupClient; class PlatformGestureCurveTarget; @@ -300,6 +301,12 @@ public: static WebViewImpl* fromPage(WebCore::Page*); + // A pageGroup identifies a namespace of pages. Page groups are used on PLATFORM(MAC) + // for some programs that use HTML views to display things that don't seem like + // web pages to the user (so shouldn't have visited link coloring). We only use + // one page group. + static WebCore::PageGroup* defaultPageGroup(); + WebViewClient* client() { return m_client; diff --git a/Source/WebKit/chromium/src/WebWorkerClientImpl.h b/Source/WebKit/chromium/src/WebWorkerClientImpl.h index 2a865488d..f6779083b 100644 --- a/Source/WebKit/chromium/src/WebWorkerClientImpl.h +++ b/Source/WebKit/chromium/src/WebWorkerClientImpl.h @@ -39,8 +39,8 @@ #include "WorkerMessagingProxy.h" #include "WorkerObjectProxy.h" -#include "platform/WebFileSystem.h" #include "WebWorkerBase.h" +#include <public/WebFileSystem.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/RefPtr.h> diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp index bcbca5651..09021ef44 100644 --- a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp @@ -38,7 +38,6 @@ #include "FileMetadata.h" #include "FileSystem.h" #include "NotImplemented.h" -#include "platform/WebFileSystem.h" #include "WebFileSystemCallbacksImpl.h" #include "WebFileWriter.h" #include "WebKit.h" @@ -49,6 +48,7 @@ #include "WorkerFileSystemCallbacksBridge.h" #include "WorkerScriptController.h" #include "WorkerThread.h" +#include <public/WebFileSystem.h> #include <wtf/text/CString.h> using namespace WebKit; @@ -57,9 +57,8 @@ namespace WebCore { static const char fileSystemOperationsMode[] = "fileSystemOperationsMode"; -WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium(ScriptExecutionContext* context, FileSystemType type, const WebKit::WebURL& rootURL, FileSystemSynchronousType synchronousType) - : AsyncFileSystemChromium(type, rootURL) - , m_scriptExecutionContext(context) +WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium(ScriptExecutionContext* context, FileSystemSynchronousType synchronousType) + : m_scriptExecutionContext(context) , m_workerContext(static_cast<WorkerContext*>(context)) , m_synchronousType(synchronousType) { @@ -86,54 +85,54 @@ bool WorkerAsyncFileSystemChromium::waitForOperationToComplete() return true; } -void WorkerAsyncFileSystemChromium::move(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::move(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postMoveToMainThread(m_webFileSystem, virtualPathToFileSystemURL(sourcePath), virtualPathToFileSystemURL(destinationPath), m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postMoveToMainThread(m_webFileSystem, sourcePath, destinationPath, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::copy(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::copy(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postCopyToMainThread(m_webFileSystem, virtualPathToFileSystemURL(sourcePath), virtualPathToFileSystemURL(destinationPath), m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postCopyToMainThread(m_webFileSystem, sourcePath, destinationPath, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::remove(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::remove(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postRemoveToMainThread(m_webFileSystem, virtualPathToFileSystemURL(path), m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postRemoveToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::removeRecursively(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::removeRecursively(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postRemoveRecursivelyToMainThread(m_webFileSystem, virtualPathToFileSystemURL(path), m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postRemoveRecursivelyToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::readMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::readMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postReadMetadataToMainThread(m_webFileSystem, virtualPathToFileSystemURL(path), m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postReadMetadataToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::createFile(const String& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::createFile(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postCreateFileToMainThread(m_webFileSystem, virtualPathToFileSystemURL(path), exclusive, m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postCreateFileToMainThread(m_webFileSystem, path, exclusive, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::createDirectory(const String& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::createDirectory(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postCreateDirectoryToMainThread(m_webFileSystem, virtualPathToFileSystemURL(path), exclusive, m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postCreateDirectoryToMainThread(m_webFileSystem, path, exclusive, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::fileExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::fileExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postFileExistsToMainThread(m_webFileSystem, virtualPathToFileSystemURL(path), m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postFileExistsToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::directoryExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::directoryExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postDirectoryExistsToMainThread(m_webFileSystem, virtualPathToFileSystemURL(path), m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postDirectoryExistsToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::readDirectory(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postReadDirectoryToMainThread(m_webFileSystem, virtualPathToFileSystemURL(path), m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postReadDirectoryToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); } class WorkerFileWriterHelperCallbacks : public AsyncFileSystemCallbacks { @@ -143,11 +142,6 @@ public: return adoptPtr(new WorkerFileWriterHelperCallbacks(client, path, webFileSystem, callbacks, workerContext)); } - virtual void didSucceed() - { - ASSERT_NOT_REACHED(); - } - virtual void didReadMetadata(const FileMetadata& metadata) { ASSERT(m_callbacks); @@ -159,27 +153,6 @@ public: } } - virtual void didReadDirectoryEntry(const String& name, bool isDirectory) - { - ASSERT_NOT_REACHED(); - } - - virtual void didReadDirectoryEntries(bool hasMore) - { - ASSERT_NOT_REACHED(); - } - - virtual void didOpenFileSystem(const String&, PassOwnPtr<AsyncFileSystem>) - { - ASSERT_NOT_REACHED(); - } - - // Called when an AsyncFileWrter has been created successfully. - virtual void didCreateFileWriter(PassOwnPtr<AsyncFileWriter>, long long) - { - ASSERT_NOT_REACHED(); - } - virtual void didFail(int code) { ASSERT(m_callbacks); @@ -203,18 +176,16 @@ private: WorkerContext* m_workerContext; }; -void WorkerAsyncFileSystemChromium::createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::createWriter(AsyncFileWriterClient* client, const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - KURL pathAsURL = virtualPathToFileSystemURL(path); - createWorkerFileSystemCallbacksBridge(WorkerFileWriterHelperCallbacks::create(client, pathAsURL, m_webFileSystem, callbacks, m_workerContext))->postReadMetadataToMainThread(m_webFileSystem, pathAsURL, m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(WorkerFileWriterHelperCallbacks::create(client, path, m_webFileSystem, callbacks, m_workerContext))->postReadMetadataToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - KURL pathAsURL = virtualPathToFileSystemURL(path); KURL internalBlobURL = BlobURL::createInternalURL(); - createWorkerFileSystemCallbacksBridge(createSnapshotFileCallback(internalBlobURL, callbacks))->postCreateSnapshotFileToMainThread(m_webFileSystem, internalBlobURL, pathAsURL, m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(createSnapshotFileCallback(internalBlobURL, callbacks))->postCreateSnapshotFileToMainThread(m_webFileSystem, internalBlobURL, path, m_modeForCurrentOperation); } PassRefPtr<WorkerFileSystemCallbacksBridge> WorkerAsyncFileSystemChromium::createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks> callbacks) diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h index 2618c48b9..6727d1e47 100644 --- a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h +++ b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h @@ -53,9 +53,9 @@ class WorkerContext; class WorkerAsyncFileSystemChromium : public AsyncFileSystemChromium { public: - static PassOwnPtr<AsyncFileSystem> create(ScriptExecutionContext* context, FileSystemType type, const WebKit::WebURL& rootURL, FileSystemSynchronousType synchronousType) + static PassOwnPtr<AsyncFileSystem> create(ScriptExecutionContext* context, FileSystemSynchronousType synchronousType) { - return adoptPtr(new WorkerAsyncFileSystemChromium(context, type, rootURL, synchronousType)); + return adoptPtr(new WorkerAsyncFileSystemChromium(context, synchronousType)); } virtual ~WorkerAsyncFileSystemChromium(); @@ -63,21 +63,21 @@ public: // Runs one pending operation (to wait for completion in the sync-mode). virtual bool waitForOperationToComplete(); - 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>); - virtual void removeRecursively(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void readMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void createFile(const String& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void createDirectory(const String& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void fileExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void directoryExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void move(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void copy(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void remove(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void removeRecursively(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void readMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createFile(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createDirectory(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void fileExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void directoryExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void readDirectory(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createWriter(AsyncFileWriterClient*, const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createSnapshotFileAndReadMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); private: - WorkerAsyncFileSystemChromium(ScriptExecutionContext*, FileSystemType, const WebKit::WebURL& rootURL, FileSystemSynchronousType); + WorkerAsyncFileSystemChromium(ScriptExecutionContext*, FileSystemSynchronousType); PassRefPtr<WebKit::WorkerFileSystemCallbacksBridge> createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks>); diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.cpp b/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.cpp index 054ecbb1f..6d62098a6 100644 --- a/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.cpp +++ b/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.cpp @@ -36,7 +36,6 @@ #include "AsyncFileSystem.h" #include "Blob.h" #include "ScriptExecutionContext.h" -#include "platform/WebFileSystem.h" #include "WebFileWriter.h" #include "platform/WebURL.h" #include "WebWorkerBase.h" @@ -44,6 +43,7 @@ #include "WorkerFileWriterCallbacksBridge.h" #include "WorkerLoaderProxy.h" #include "WorkerThread.h" +#include <public/WebFileSystem.h> #include <wtf/Assertions.h> using namespace WebKit; diff --git a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h index e496de2ef..fa70dd261 100644 --- a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h +++ b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h @@ -36,8 +36,8 @@ #include "PlatformString.h" #include "ScriptExecutionContext.h" #include "WebFileError.h" -#include "platform/WebFileSystem.h" #include "platform/WebVector.h" +#include <public/WebFileSystem.h> #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/Threading.h> diff --git a/Source/WebKit/chromium/src/WorkerFileWriterCallbacksBridge.cpp b/Source/WebKit/chromium/src/WorkerFileWriterCallbacksBridge.cpp index 26a0ae34f..3ffb178c5 100644 --- a/Source/WebKit/chromium/src/WorkerFileWriterCallbacksBridge.cpp +++ b/Source/WebKit/chromium/src/WorkerFileWriterCallbacksBridge.cpp @@ -36,14 +36,14 @@ #include "AsyncFileWriterClient.h" #include "CrossThreadTask.h" #include "platform/WebCString.h" -#include "platform/WebFileSystem.h" #include "WebFileWriter.h" #include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" #include "WebWorkerBase.h" #include "WorkerContext.h" #include "WorkerLoaderProxy.h" #include "WorkerThread.h" +#include <public/Platform.h> +#include <public/WebFileSystem.h> #include <wtf/MainThread.h> #include <wtf/Threading.h> @@ -104,7 +104,7 @@ void WorkerFileWriterCallbacksBridge::abortOnMainThread(ScriptExecutionContext*, void WorkerFileWriterCallbacksBridge::initOnMainThread(ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge> bridge, const KURL& path) { ASSERT(!bridge->m_writer); - bridge->m_writer = adoptPtr(webKitPlatformSupport()->fileSystem()->createFileWriter(path, bridge.get())); + bridge->m_writer = adoptPtr(WebKit::Platform::current()->fileSystem()->createFileWriter(path, bridge.get())); } void WorkerFileWriterCallbacksBridge::shutdownOnMainThread(ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge> bridge) diff --git a/Source/WebKit/chromium/src/painting/GraphicsContextBuilder.h b/Source/WebKit/chromium/src/painting/GraphicsContextBuilder.h index 5ffae8ebc..79708b396 100644 --- a/Source/WebKit/chromium/src/painting/GraphicsContextBuilder.h +++ b/Source/WebKit/chromium/src/painting/GraphicsContextBuilder.h @@ -33,33 +33,10 @@ #include "GraphicsContext.h" -#if WEBKIT_USING_CG -#include "LocalCurrentGraphicsContext.h" -#elif WEBKIT_USING_SKIA #include "PlatformContextSkia.h" -#endif namespace WebKit { -#if WEBKIT_USING_CG - -class GraphicsContextBuilder { -public: - GraphicsContextBuilder(WebCanvas* canvas) - : m_graphicsContext(canvas) - , m_localContext(&m_graphicsContext) - { - } - - WebCore::GraphicsContext& context() { return m_graphicsContext; } - -private: - WebCore::GraphicsContext m_graphicsContext; - WebCore::LocalCurrentGraphicsContext m_localContext; -}; - -#elif WEBKIT_USING_SKIA - class GraphicsContextBuilder { public: GraphicsContextBuilder(WebCanvas* canvas) @@ -75,10 +52,6 @@ private: WebCore::GraphicsContext m_graphicsContext; }; -#else -#error "Need to define GraphicsContextBuilder!" -#endif - } // namespace WebKit #endif diff --git a/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp b/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp index a1ab770b7..af9fde1d5 100644 --- a/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp +++ b/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp @@ -69,6 +69,16 @@ TEST(CCActiveAnimationTest, TrimTimeInfiniteIterations) EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1.5)); } +TEST(CCActiveAnimationTest, TrimTimeAlternating) +{ + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(-1)); + anim->setAlternatesDirection(true); + EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); + EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); + EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1)); + EXPECT_EQ(0.75, anim->trimTimeToCurrentIteration(1.25)); +} + TEST(CCActiveAnimationTest, TrimTimeStartTime) { OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); diff --git a/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp b/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp index fa95a2ac5..1d5409f98 100644 --- a/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp @@ -86,34 +86,45 @@ TEST(CCLayerAnimationControllerTest, createOpacityAnimation) EXPECT_EQ(1, curve->getValue(duration)); } -TEST(CCLayerAnimationControllerTest, ignoreUnsupportedAnimationDirections) +TEST(CCLayerAnimationControllerTest, createTransformAnimation) { FakeLayerAnimationControllerClient dummy; OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyOpacity); - values.insert(new FloatAnimationValue(0, 0)); - values.insert(new FloatAnimationValue(duration, 1)); + WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); + + TransformOperations operations1; + operations1.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(0, &operations1)); + + TransformOperations operations2; + operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(duration, &operations2)); RefPtr<Animation> animation = Animation::create(); animation->setDuration(duration); IntSize boxSize; + controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0); - animation->setDirection(Animation::AnimationDirectionAlternate); - EXPECT_FALSE(controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0)); + EXPECT_TRUE(controller->hasActiveAnimation()); - animation->setDirection(Animation::AnimationDirectionAlternateReverse); - EXPECT_FALSE(controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0)); + CCActiveAnimation* activeAnimation = controller->getActiveAnimation(0, CCActiveAnimation::Transform); + EXPECT_TRUE(activeAnimation); - animation->setDirection(Animation::AnimationDirectionReverse); - EXPECT_FALSE(controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0)); + EXPECT_EQ(1, activeAnimation->iterations()); + EXPECT_EQ(CCActiveAnimation::Transform, activeAnimation->targetProperty()); + + EXPECT_EQ(CCAnimationCurve::Transform, activeAnimation->curve()->type()); - animation->setDirection(Animation::AnimationDirectionNormal); - EXPECT_TRUE(controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0)); + const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve(); + EXPECT_TRUE(curve); + + expectTranslateX(2, curve->getValue(0, boxSize)); + expectTranslateX(4, curve->getValue(duration, boxSize)); } -TEST(CCLayerAnimationControllerTest, createTransformAnimation) +TEST(CCLayerAnimationControllerTest, createReversedAnimation) { FakeLayerAnimationControllerClient dummy; OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); @@ -130,6 +141,7 @@ TEST(CCLayerAnimationControllerTest, createTransformAnimation) RefPtr<Animation> animation = Animation::create(); animation->setDuration(duration); + animation->setDirection(Animation::AnimationDirectionReverse); IntSize boxSize; controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0); @@ -147,10 +159,92 @@ TEST(CCLayerAnimationControllerTest, createTransformAnimation) const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve(); EXPECT_TRUE(curve); + expectTranslateX(4, curve->getValue(0, boxSize)); + expectTranslateX(2, curve->getValue(duration, boxSize)); +} + +TEST(CCLayerAnimationControllerTest, createAlternatingAnimation) +{ + FakeLayerAnimationControllerClient dummy; + OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); + const double duration = 1; + WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); + + TransformOperations operations1; + operations1.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(0, &operations1)); + + TransformOperations operations2; + operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(duration, &operations2)); + + RefPtr<Animation> animation = Animation::create(); + animation->setDuration(duration); + animation->setDirection(Animation::AnimationDirectionAlternate); + animation->setIterationCount(2); + + IntSize boxSize; + controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0); + + EXPECT_TRUE(controller->hasActiveAnimation()); + + CCActiveAnimation* activeAnimation = controller->getActiveAnimation(0, CCActiveAnimation::Transform); + EXPECT_TRUE(activeAnimation); + EXPECT_TRUE(activeAnimation->alternatesDirection()); + + EXPECT_EQ(2, activeAnimation->iterations()); + EXPECT_EQ(CCActiveAnimation::Transform, activeAnimation->targetProperty()); + + EXPECT_EQ(CCAnimationCurve::Transform, activeAnimation->curve()->type()); + + const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve(); + EXPECT_TRUE(curve); + expectTranslateX(2, curve->getValue(0, boxSize)); expectTranslateX(4, curve->getValue(duration, boxSize)); } +TEST(CCLayerAnimationControllerTest, createReversedAlternatingAnimation) +{ + FakeLayerAnimationControllerClient dummy; + OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); + const double duration = 1; + WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); + + TransformOperations operations1; + operations1.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(0, &operations1)); + + TransformOperations operations2; + operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(duration, &operations2)); + + RefPtr<Animation> animation = Animation::create(); + animation->setDuration(duration); + animation->setDirection(Animation::AnimationDirectionAlternateReverse); + animation->setIterationCount(2); + + IntSize boxSize; + controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0); + + EXPECT_TRUE(controller->hasActiveAnimation()); + + CCActiveAnimation* activeAnimation = controller->getActiveAnimation(0, CCActiveAnimation::Transform); + EXPECT_TRUE(activeAnimation); + EXPECT_TRUE(activeAnimation->alternatesDirection()); + + EXPECT_EQ(2, activeAnimation->iterations()); + EXPECT_EQ(CCActiveAnimation::Transform, activeAnimation->targetProperty()); + + EXPECT_EQ(CCAnimationCurve::Transform, activeAnimation->curve()->type()); + + const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve(); + EXPECT_TRUE(curve); + + expectTranslateX(4, curve->getValue(0, boxSize)); + expectTranslateX(2, curve->getValue(duration, boxSize)); +} + TEST(CCLayerAnimationControllerTest, syncNewAnimation) { FakeLayerAnimationControllerClient dummyImpl; diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp index 51a032618..d243aee4a 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp @@ -1172,7 +1172,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBe EXPECT_INT_RECT_EQ(expected, actual); } -TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveIsClipped) +TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW) { // Test the calculateVisibleRect() function works correctly when projecting a surface // onto a layer, but the layer is partially behind the camera (not just behind the @@ -1190,7 +1190,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveIsClipped) // center of the layer. layerToSurfaceTransform.makeIdentity(); layerToSurfaceTransform.applyPerspective(1); - layerToSurfaceTransform.translate3d(0, 0, 1); + layerToSurfaceTransform.translate3d(-1, 0, 1); layerToSurfaceTransform.rotate3d(0, 45, 0); // Sanity check that this transform does indeed cause w < 0 when applying the @@ -1199,7 +1199,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveIsClipped) CCMathUtil::mapQuad(layerToSurfaceTransform, FloatQuad(FloatRect(layerContentRect)), clipped); ASSERT_TRUE(clipped); - int expectedXPosition = -10; + int expectedXPosition = 0; int expectedWidth = 10; IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_EQ(expectedXPosition, actual.x()); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp index ff2497085..58668d0ef 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp @@ -28,6 +28,7 @@ #include "CCAnimationTestCommon.h" #include "CCLayerTestCommon.h" +#include "CCTiledLayerTestCommon.h" #include "FakeWebGraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" #include "LayerRendererChromium.h" @@ -59,6 +60,8 @@ public: { CCSettings settings; m_hostImpl = CCLayerTreeHostImpl::create(settings, this); + m_hostImpl->initializeLayerRenderer(createContext(), adoptPtr(new FakeTextureUploader)); + m_hostImpl->setViewportSize(IntSize(10, 10)); } virtual void didLoseContextOnImplThread() OVERRIDE { } @@ -254,8 +257,6 @@ TEST_F(CCLayerTreeHostImplTest, nonFastScrollableRegionBasic) TEST_F(CCLayerTreeHostImplTest, nonFastScrollableRegionWithOffset) { - m_hostImpl->initializeLayerRenderer(createContext()); - OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0); root->setScrollable(true); root->setScrollPosition(IntPoint(0, 0)); @@ -440,49 +441,51 @@ private: TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) { - m_hostImpl->initializeLayerRenderer(createContext()); - - // Ensure visibleLayerRect for root layer is empty - m_hostImpl->setViewportSize(IntSize(0, 0)); - + // The root layer is always drawn, so run this test on a child layer that + // will be masked out by the root layer's bounds. m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0)); DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); + root->setMasksToBounds(true); + + root->addChild(DidDrawCheckLayer::create(1)); + DidDrawCheckLayer* layer = static_cast<DidDrawCheckLayer*>(root->children()[0].get()); + // Ensure visibleLayerRect for layer is empty + layer->setPosition(FloatPoint(100, 100)); + layer->setBounds(IntSize(10, 10)); + layer->setContentBounds(IntSize(10, 10)); CCLayerTreeHostImpl::FrameData frame; - EXPECT_FALSE(root->willDrawCalled()); - EXPECT_FALSE(root->didDrawCalled()); + EXPECT_FALSE(layer->willDrawCalled()); + EXPECT_FALSE(layer->didDrawCalled()); EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); - EXPECT_FALSE(root->willDrawCalled()); - EXPECT_FALSE(root->didDrawCalled()); + EXPECT_FALSE(layer->willDrawCalled()); + EXPECT_FALSE(layer->didDrawCalled()); - EXPECT_TRUE(root->visibleLayerRect().isEmpty()); + EXPECT_TRUE(layer->visibleLayerRect().isEmpty()); - // Ensure visibleLayerRect for root layer is not empty - m_hostImpl->setViewportSize(IntSize(10, 10)); + // Ensure visibleLayerRect for layer layer is not empty + layer->setPosition(FloatPoint(0, 0)); - EXPECT_FALSE(root->willDrawCalled()); - EXPECT_FALSE(root->didDrawCalled()); + EXPECT_FALSE(layer->willDrawCalled()); + EXPECT_FALSE(layer->didDrawCalled()); EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); - EXPECT_TRUE(root->willDrawCalled()); - EXPECT_TRUE(root->didDrawCalled()); + EXPECT_TRUE(layer->willDrawCalled()); + EXPECT_TRUE(layer->didDrawCalled()); - EXPECT_FALSE(root->visibleLayerRect().isEmpty()); + EXPECT_FALSE(layer->visibleLayerRect().isEmpty()); } TEST_F(CCLayerTreeHostImplTest, didDrawCalledOnAllLayers) { - m_hostImpl->initializeLayerRenderer(createContext()); - m_hostImpl->setViewportSize(IntSize(10, 10)); - m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0)); DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); @@ -533,9 +536,6 @@ private: TEST_F(CCLayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) { - m_hostImpl->initializeLayerRenderer(createContext()); - m_hostImpl->setViewportSize(IntSize(10, 10)); - // When the texture is not missing, we draw as usual. m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0)); DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); @@ -660,8 +660,6 @@ private: // https://bugs.webkit.org/show_bug.cgi?id=75783 TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) { - m_hostImpl->initializeLayerRenderer(createContext()); - m_hostImpl->setViewportSize(IntSize(10, 10)); { OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0); @@ -878,7 +876,7 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) TEST_F(CCLayerTreeHostImplTest, viewportCovered) { - m_hostImpl->initializeLayerRenderer(createContext()); + m_hostImpl->initializeLayerRenderer(createContext(), adoptPtr(new FakeTextureUploader)); m_hostImpl->setBackgroundColor(Color::gray); IntSize viewportSize(1000, 1000); @@ -989,8 +987,7 @@ TEST_F(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw) { ReshapeTrackerContext* reshapeTracker = new ReshapeTrackerContext(); RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(reshapeTracker), GraphicsContext3D::RenderDirectlyToHostWindow); - m_hostImpl->initializeLayerRenderer(context); - m_hostImpl->setViewportSize(IntSize(10, 10)); + m_hostImpl->initializeLayerRenderer(context, adoptPtr(new FakeTextureUploader)); CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); root->setAnchorPoint(FloatPoint(0, 0)); @@ -1039,7 +1036,7 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) CCSettings settings; settings.partialSwapEnabled = true; OwnPtr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::create(settings, this); - layerTreeHostImpl->initializeLayerRenderer(context); + layerTreeHostImpl->initializeLayerRenderer(context, adoptPtr(new FakeTextureUploader())); layerTreeHostImpl->setViewportSize(IntSize(500, 500)); CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); @@ -1125,9 +1122,6 @@ private: TEST_F(CCLayerTreeHostImplTest, contextLostAndRestoredNotificationSentToAllLayers) { - m_hostImpl->initializeLayerRenderer(createContext()); - m_hostImpl->setViewportSize(IntSize(10, 10)); - m_hostImpl->setRootLayer(ContextLostNotificationCheckLayer::create(0)); ContextLostNotificationCheckLayer* root = static_cast<ContextLostNotificationCheckLayer*>(m_hostImpl->rootLayer()); @@ -1141,7 +1135,7 @@ TEST_F(CCLayerTreeHostImplTest, contextLostAndRestoredNotificationSentToAllLayer EXPECT_FALSE(layer1->didLoseContextCalled()); EXPECT_FALSE(layer2->didLoseContextCalled()); - m_hostImpl->initializeLayerRenderer(createContext()); + m_hostImpl->initializeLayerRenderer(createContext(), adoptPtr(new FakeTextureUploader)); EXPECT_TRUE(root->didLoseContextCalled()); EXPECT_TRUE(layer1->didLoseContextCalled()); @@ -1156,7 +1150,7 @@ public: TEST_F(CCLayerTreeHostImplTest, finishAllRenderingAfterContextLost) { // The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects. - m_hostImpl->initializeLayerRenderer(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow)); + m_hostImpl->initializeLayerRenderer(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow), adoptPtr(new FakeTextureUploader)); m_hostImpl->finishAllRendering(); } @@ -1172,9 +1166,6 @@ private: TEST_F(CCLayerTreeHostImplTest, scrollbarLayerLostContext) { - m_hostImpl->initializeLayerRenderer(createContext()); - m_hostImpl->setViewportSize(IntSize(10, 10)); - m_hostImpl->setRootLayer(ScrollbarLayerFakePaint::create(0)); ScrollbarLayerFakePaint* scrollbar = static_cast<ScrollbarLayerFakePaint*>(m_hostImpl->rootLayer()); scrollbar->setBounds(IntSize(1, 1)); @@ -1189,7 +1180,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollbarLayerLostContext) // Scrollbar layer should always generate quads, even after lost context EXPECT_GT(renderPass->quadList().size(), 0u); m_hostImpl->didDrawAllLayers(frame); - m_hostImpl->initializeLayerRenderer(createContext()); + m_hostImpl->initializeLayerRenderer(createContext(), adoptPtr(new FakeTextureUploader)); } } @@ -1322,9 +1313,6 @@ private: TEST_F(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) { - m_hostImpl->initializeLayerRenderer(createContext()); - m_hostImpl->setViewportSize(IntSize(10, 10)); - OwnPtr<CCLayerImpl> rootLayer(CCLayerImpl::create(0)); rootLayer->setBounds(IntSize(10, 10)); rootLayer->setAnchorPoint(FloatPoint(0, 0)); @@ -1367,7 +1355,7 @@ TEST_F(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) // Lose the context, replacing it with a StrictWebGraphicsContext3D, that // will warn if any resource from the previous context gets used. - m_hostImpl->initializeLayerRenderer(StrictWebGraphicsContext3D::createGraphicsContext()); + m_hostImpl->initializeLayerRenderer(StrictWebGraphicsContext3D::createGraphicsContext(), adoptPtr(new FakeTextureUploader)); EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp index f2382b359..44f87c6a9 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp @@ -788,7 +788,12 @@ private: int m_numDraws; }; +#if OS(WINDOWS) +// http://webkit.org/b/74623 +TEST_F(CCLayerTreeHostTestSetNeedsCommit2, FLAKY_runMultiThread) +#else TEST_F(CCLayerTreeHostTestSetNeedsCommit2, runMultiThread) +#endif { runTestThreaded(); } @@ -840,6 +845,62 @@ TEST_F(CCLayerTreeHostTestSetNeedsRedraw, runMultiThread) runTestThreaded(); } +// If the layerTreeHost says it can't draw, then we should not try to draw. +// FIXME: Make this run in single threaded mode too. http://crbug.com/127481 +class CCLayerTreeHostTestCanDrawBlocksDrawing : public CCLayerTreeHostTestThreadOnly { +public: + CCLayerTreeHostTestCanDrawBlocksDrawing() + : m_numCommits(0) + { + } + + virtual void beginTest() + { + } + + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) + { + // Only the initial draw should bring us here. + EXPECT_TRUE(impl->canDraw()); + EXPECT_EQ(0, impl->sourceFrameNumber()); + } + + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) + { + if (m_numCommits >= 1) { + // After the first commit, we should not be able to draw. + EXPECT_FALSE(impl->canDraw()); + } + } + + virtual void didCommitAndDrawFrame() + { + m_numCommits++; + if (m_numCommits == 1) { + // Make the viewport empty so the host says it can't draw. + m_layerTreeHost->setViewportSize(IntSize(0, 0)); + + OwnArrayPtr<char> pixels(adoptArrayPtr(new char[4])); + m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get()), IntRect(0, 0, 1, 1)); + } else if (m_numCommits == 2) { + m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->finishAllRendering(); + endTest(); + } + } + + virtual void afterTest() + { + } + +private: + int m_numCommits; +}; + +TEST_F(CCLayerTreeHostTestCanDrawBlocksDrawing, runMultiThread) +{ + runTestThreaded(); +} // beginLayerWrite should prevent draws from executing until a commit occurs class CCLayerTreeHostTestWriteLayersRedraw : public CCLayerTreeHostTestThreadOnly { @@ -1096,7 +1157,12 @@ private: int m_numAnimates; }; +#if OS(WINDOWS) +// http://webkit.org/b/74623 +TEST_F(CCLayerTreeHostTestTickAnimationWhileBackgrounded, FLAKY_runMultiThread) +#else TEST_F(CCLayerTreeHostTestTickAnimationWhileBackgrounded, runMultiThread) +#endif { runTestThreaded(); } @@ -1134,7 +1200,12 @@ public: private: }; +#if OS(WINDOWS) +// http://webkit.org/b/74623 +TEST_F(CCLayerTreeHostTestAddAnimationWithTimingFunction, FLAKY_runMultiThread) +#else TEST_F(CCLayerTreeHostTestAddAnimationWithTimingFunction, runMultiThread) +#endif { runTestThreaded(); } @@ -1168,7 +1239,12 @@ public: } }; +#if OS(WINDOWS) +// http://webkit.org/b/74623 +TEST_F(CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity, FLAKY_runMultiThread) +#else TEST_F(CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity, runMultiThread) +#endif { runTestThreaded(); } @@ -1340,11 +1416,11 @@ public: virtual void beginCommitOnCCThread(CCLayerTreeHostImpl* impl) { LayerChromium* root = m_layerTreeHost->rootLayer(); - if (!m_layerTreeHost->frameNumber()) + if (!impl->sourceFrameNumber()) EXPECT_EQ(root->scrollPosition(), m_initialScroll); - else if (m_layerTreeHost->frameNumber() == 1) + else if (impl->sourceFrameNumber() == 1) EXPECT_EQ(root->scrollPosition(), m_initialScroll + m_scrollAmount + m_scrollAmount); - else if (m_layerTreeHost->frameNumber() == 2) + else if (impl->sourceFrameNumber() == 2) EXPECT_EQ(root->scrollPosition(), m_initialScroll + m_scrollAmount + m_scrollAmount); } @@ -1711,10 +1787,10 @@ public: { CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context())); - switch (impl->frameNumber()) { + switch (impl->sourceFrameNumber()) { case 0: // Number of textures should be one. - EXPECT_EQ(1, context->numTextures()); + ASSERT_EQ(1, context->numTextures()); // Number of textures used for commit should be one. EXPECT_EQ(1, context->numUsedTextures()); // Verify that used texture is correct. @@ -1725,7 +1801,7 @@ public: 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()); + ASSERT_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. @@ -1748,7 +1824,7 @@ public: // Number of textures used for draw should always be one. EXPECT_EQ(1, context->numUsedTextures()); - if (impl->frameNumber() < 2) { + if (impl->sourceFrameNumber() < 1) { context->resetUsedTextures(); postSetNeedsAnimateAndCommitToMainThread(); postSetNeedsRedrawToMainThread(); @@ -1815,10 +1891,10 @@ public: { CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context())); - switch (impl->frameNumber()) { + switch (impl->sourceFrameNumber()) { case 0: // Number of textures should be two. - EXPECT_EQ(2, context->numTextures()); + ASSERT_EQ(2, context->numTextures()); // Number of textures used for commit should be two. EXPECT_EQ(2, context->numUsedTextures()); // Verify that used textures are correct. @@ -1830,7 +1906,7 @@ public: case 1: // Number of textures should be four as the first two // textures are used by the impl thread. - EXPECT_EQ(4, context->numTextures()); + ASSERT_EQ(4, context->numTextures()); // Number of textures used for commit should still be two. EXPECT_EQ(2, context->numUsedTextures()); // First two textures should not have been used. @@ -1846,7 +1922,7 @@ public: // Number of textures should be three as we allow one // partial update and the first two textures are used by // the impl thread. - EXPECT_EQ(3, context->numTextures()); + ASSERT_EQ(3, context->numTextures()); // Number of textures used for commit should still be two. EXPECT_EQ(2, context->numUsedTextures()); // First texture should have been used. @@ -1886,12 +1962,12 @@ public: // Number of textures used for drawing should two except for frame 4 // where the viewport only contains one layer. - if (impl->frameNumber() == 4) + if (impl->sourceFrameNumber() == 3) EXPECT_EQ(1, context->numUsedTextures()); else EXPECT_EQ(2, context->numUsedTextures()); - if (impl->frameNumber() < 5) { + if (impl->sourceFrameNumber() < 4) { context->resetUsedTextures(); postSetNeedsAnimateAndCommitToMainThread(); postSetNeedsRedrawToMainThread(); diff --git a/Source/WebKit/chromium/tests/CCMathUtilTest.cpp b/Source/WebKit/chromium/tests/CCMathUtilTest.cpp index db0a4e53f..3909677a5 100644 --- a/Source/WebKit/chromium/tests/CCMathUtilTest.cpp +++ b/Source/WebKit/chromium/tests/CCMathUtilTest.cpp @@ -99,4 +99,21 @@ TEST(CCMathUtilTest, verifyBackfaceVisibilityForPerspective) EXPECT_TRUE(layerSpaceToProjectionPlane.isBackFaceVisible()); } +TEST(CCMathUtilTest, verifyProjectionOfPerpendicularPlane) +{ + // In this case, the m33() element of the transform becomes zero, which could cause a + // divide-by-zero when projecting points/quads. + + TransformationMatrix transform; + transform.makeIdentity(); + transform.setM33(0); + + FloatRect rect = FloatRect(0, 0, 1, 1); + FloatRect projectedRect = CCMathUtil::projectClippedRect(transform, rect); + + EXPECT_EQ(0, projectedRect.x()); + EXPECT_EQ(0, projectedRect.y()); + EXPECT_TRUE(projectedRect.isEmpty()); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp index 73b4d8273..891c305b0 100644 --- a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp @@ -172,6 +172,7 @@ protected: m_renderSurfaceLayerListChromium.clear(); m_renderSurfaceLayerListImpl.clear(); m_replicaLayers.clear(); + m_maskLayers.clear(); CCLayerTreeHost::setNeedsFilterContext(false); } @@ -233,6 +234,15 @@ protected: return layerPtr; } + typename Types::LayerType* createMaskLayer(typename Types::LayerType* owningLayer, const IntSize& bounds) + { + typename Types::ContentLayerPtrType layer(Types::createContentLayer()); + typename Types::ContentLayerType* layerPtr = layer.get(); + setProperties(layerPtr, identityMatrix, FloatPoint(), bounds); + setMask(owningLayer, layer.release()); + return layerPtr; + } + typename Types::ContentLayerType* createDrawingSurface(typename Types::LayerType* parent, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque) { typename Types::ContentLayerType* layer = createDrawingLayer(parent, transform, position, bounds, opaque); @@ -360,6 +370,17 @@ private: owningLayer->setReplicaLayer(layer); } + void setMask(LayerChromium* owningLayer, PassRefPtr<LayerChromium> layer) + { + owningLayer->setMaskLayer(layer.get()); + m_maskLayers.append(layer); + } + + void setMask(CCLayerImpl* owningLayer, PassOwnPtr<CCLayerImpl> layer) + { + owningLayer->setMaskLayer(layer); + } + // These hold ownership of the layers for the duration of the test. typename Types::LayerPtrType m_root; Vector<RefPtr<LayerChromium> > m_renderSurfaceLayerListChromium; @@ -368,6 +389,7 @@ private: typename Types::LayerIterator m_layerIterator; typename Types::LayerType* m_lastLayerVisited; Vector<RefPtr<LayerChromium> > m_replicaLayers; + Vector<RefPtr<LayerChromium> > m_maskLayers; }; #define RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ @@ -1330,6 +1352,38 @@ protected: ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaWithClipping); template<class Types, bool opaqueLayers> +class CCOcclusionTrackerTestReplicaWithMask : public CCOcclusionTrackerTest<Types, opaqueLayers> { +protected: + void runMyTest() + { + typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200)); + typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); + typename Types::LayerType* replica = this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), IntSize()); + this->createMaskLayer(replica, IntSize(10, 10)); + this->calcDrawEtc(parent); + + TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); + + this->visitLayer(surface, occlusion); + + EXPECT_EQ_RECT(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); + + this->visitContributingSurface(surface, occlusion); + this->enterLayer(parent, occlusion); + + // The replica should not be occluding the parent, since it has a mask applied to it. + EXPECT_EQ_RECT(IntRect(0, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); + } +}; + +ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaWithMask); + +template<class Types, bool opaqueLayers> class CCOcclusionTrackerTestLayerScissorRectOutsideChild : public CCOcclusionTrackerTest<Types, opaqueLayers> { protected: void runMyTest() diff --git a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp index 991cddc46..634a25c7a 100644 --- a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp +++ b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp @@ -91,7 +91,7 @@ static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const Tr static void appendQuads(CCQuadList& quadList, Vector<OwnPtr<CCSharedQuadState> >& sharedStateList, CCTiledLayerImpl* layer, CCLayerIteratorType& it, CCOcclusionTrackerImpl& occlusionTracker) { occlusionTracker.enterLayer(it); - CCQuadCuller quadCuller(quadList, layer, &occlusionTracker); + CCQuadCuller quadCuller(quadList, layer, &occlusionTracker, false); OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); bool hadMissingTiles = false; layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h index c028ea725..4eb875b1e 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h @@ -161,6 +161,9 @@ public: class FakeTextureUploader : public WebCore::TextureUploader { public: + virtual bool isBusy() { return false; } + virtual void beginUploads() { } + virtual void endUploads() { } virtual void uploadTexture(WebCore::GraphicsContext3D* context, WebCore::LayerTextureUpdater::Texture* texture, WebCore::TextureAllocator* allocator, const WebCore::IntRect sourceRect, const WebCore::IntRect destRect) { texture->updateRect(context, allocator, sourceRect, destRect); } }; diff --git a/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp index f464dcbbc..b42485b71 100644 --- a/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp @@ -90,6 +90,9 @@ public: class MockTextureUploader : public TextureUploader { public: + MOCK_METHOD0(isBusy, bool()); + MOCK_METHOD0(beginUploads, void()); + MOCK_METHOD0(endUploads, void()); MOCK_METHOD5(uploadTexture, void(GraphicsContext3D*, LayerTextureUpdater::Texture*, TextureAllocator*, const IntRect, const IntRect)); }; diff --git a/Source/WebKit/chromium/tests/EventListenerTest.cpp b/Source/WebKit/chromium/tests/EventListenerTest.cpp new file mode 100644 index 000000000..799ac4007 --- /dev/null +++ b/Source/WebKit/chromium/tests/EventListenerTest.cpp @@ -0,0 +1,251 @@ +/* + * 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 "FrameTestHelpers.h" +#include "WebDOMEvent.h" +#include "WebDOMEventListener.h" +#include "WebDOMMutationEvent.h" +#include "WebDocument.h" +#include "WebElement.h" +#include "WebFrame.h" +#include "WebScriptSource.h" +#include "WebView.h" +#include <gtest/gtest.h> +#include <webkit/support/webkit_support.h> + +using namespace WebKit; + +namespace { + +class TestWebDOMEventListener : public WebDOMEventListener { +public: + TestWebDOMEventListener() { } + virtual ~TestWebDOMEventListener() { } + + virtual void handleEvent(const WebDOMEvent& event) OVERRIDE + { + m_events.push_back(event); + } + + size_t eventCount() const { return m_events.size(); } + + WebDOMEvent eventAt(int index) const { return m_events.at(index); } + + void clearEvents() { m_events.clear(); } + +private: + std::vector<WebDOMEvent> m_events; +}; + +class WebDOMEventListenerTest : public testing::Test { +public: + WebDOMEventListenerTest() + : m_webView(0) + { + } + + virtual void SetUp() OVERRIDE + { + std::string baseURL("http://www.example.com/"); + std::string fileName("listener/mutation_event_listener.html"); + bool executeScript = true; + FrameTestHelpers::registerMockedURLLoad(baseURL, fileName); + m_webView = FrameTestHelpers::createWebViewAndLoad(baseURL + fileName, executeScript); + } + + virtual void TearDown() OVERRIDE + { + m_webView->close(); + webkit_support::UnregisterAllMockedURLs(); + } + + WebFrame* mainFrame() const + { + return m_webView->mainFrame(); + } + + WebDocument document() const + { + return mainFrame()->document(); + } + + void executeScript(const char* code) + { + mainFrame()->executeScript(WebScriptSource(WebString::fromUTF8(code))); + } + + + static WebString GetNodeID(const WebNode& node) + { + if (node.nodeType() != WebNode::ElementNode) + return WebString(); + WebElement element = node.toConst<WebElement>(); + return element.getAttribute("id"); + } + +protected: + WebView* m_webView; +}; + + +// Tests that the right mutation events are fired when a node is added/removed. +// Note that the DOMSubtreeModified event is fairly vage, it only tells you +// something changed for the target node. +TEST_F(WebDOMEventListenerTest, NodeAddedRemovedMutationEvent) +{ + TestWebDOMEventListener eventListener; + document().addEventListener("DOMSubtreeModified", &eventListener, false); + + // Test adding a node. + executeScript("addElement('newNode')"); + ASSERT_EQ(1U, eventListener.eventCount()); + WebDOMEvent event = eventListener.eventAt(0); + ASSERT_TRUE(event.isMutationEvent()); + // No need to check any of the MutationEvent, WebKit does not set any. + EXPECT_EQ("DIV", event.target().nodeName()); + EXPECT_EQ("topDiv", GetNodeID(event.target())); + eventListener.clearEvents(); + + // Test removing a node. + executeScript("removeNode('div1')"); + ASSERT_EQ(1U, eventListener.eventCount()); + event = eventListener.eventAt(0); + ASSERT_TRUE(event.isMutationEvent()); + EXPECT_EQ("DIV", event.target().nodeName()); + EXPECT_EQ("topDiv", GetNodeID(event.target())); +} + +// Tests the right mutation event is fired when a text node is modified. +TEST_F(WebDOMEventListenerTest, TextNodeModifiedMutationEvent) +{ + TestWebDOMEventListener eventListener; + document().addEventListener("DOMSubtreeModified", &eventListener, false); + executeScript("changeText('div2', 'Hello')"); + ASSERT_EQ(1U, eventListener.eventCount()); + WebDOMEvent event = eventListener.eventAt(0); + ASSERT_TRUE(event.isMutationEvent()); + ASSERT_EQ(WebNode::TextNode, event.target().nodeType()); +} + +// Tests the right mutation events are fired when an attribute is added/removed. +TEST_F(WebDOMEventListenerTest, AttributeMutationEvent) +{ + TestWebDOMEventListener eventListener; + document().addEventListener("DOMSubtreeModified", &eventListener, false); + executeScript("document.getElementById('div2').setAttribute('myAttr'," + "'some value')"); + ASSERT_EQ(1U, eventListener.eventCount()); + WebDOMEvent event = eventListener.eventAt(0); + ASSERT_TRUE(event.isMutationEvent()); + EXPECT_EQ("DIV", event.target().nodeName()); + EXPECT_EQ("div2", GetNodeID(event.target())); + eventListener.clearEvents(); + + executeScript("document.getElementById('div2').removeAttribute('myAttr')"); + ASSERT_EQ(1U, eventListener.eventCount()); + event = eventListener.eventAt(0); + ASSERT_TRUE(event.isMutationEvent()); + EXPECT_EQ("DIV", event.target().nodeName()); + EXPECT_EQ("div2", GetNodeID(event.target())); +} + +// Tests destroying WebDOMEventListener and triggering events, we shouldn't +// crash. +TEST_F(WebDOMEventListenerTest, FireEventDeletedListener) +{ + TestWebDOMEventListener* eventListener = new TestWebDOMEventListener(); + document().addEventListener("DOMSubtreeModified", eventListener, false); + delete eventListener; + executeScript("addElement('newNode')"); // That should fire an event. +} + +// Tests registering several events on the same WebDOMEventListener and +// triggering events. +TEST_F(WebDOMEventListenerTest, SameListenerMultipleEvents) +{ + TestWebDOMEventListener eventListener; + const WebString kDOMSubtreeModifiedType("DOMSubtreeModified"); + const WebString kDOMNodeRemovedType("DOMNodeRemoved"); + document().addEventListener(kDOMSubtreeModifiedType, &eventListener, false); + WebElement div1Elem = document().getElementById("div1"); + div1Elem.addEventListener(kDOMNodeRemovedType, &eventListener, false); + + // Trigger a DOMSubtreeModified event by adding a node. + executeScript("addElement('newNode')"); + ASSERT_EQ(1U, eventListener.eventCount()); + WebDOMEvent event = eventListener.eventAt(0); + ASSERT_TRUE(event.isMutationEvent()); + EXPECT_EQ("DIV", event.target().nodeName()); + EXPECT_EQ("topDiv", GetNodeID(event.target())); + eventListener.clearEvents(); + + // Trigger for both event listener by removing the div1 node. + executeScript("removeNode('div1')"); + ASSERT_EQ(2U, eventListener.eventCount()); + // Not sure if the order of the events is important. Assuming no specific + // order. + WebString type1 = eventListener.eventAt(0).type(); + WebString type2 = eventListener.eventAt(1).type(); + EXPECT_TRUE(type1 == kDOMSubtreeModifiedType || type1 == kDOMNodeRemovedType); + EXPECT_TRUE(type2 == kDOMSubtreeModifiedType || type2 == kDOMNodeRemovedType); + EXPECT_TRUE(type1 != type2); +} + +// Tests removing event listeners. +TEST_F(WebDOMEventListenerTest, RemoveEventListener) +{ + TestWebDOMEventListener eventListener; + const WebString kDOMSubtreeModifiedType("DOMSubtreeModified"); + // Adding twice the same listener for the same event, should be supported. + document().addEventListener(kDOMSubtreeModifiedType, &eventListener, false); + document().addEventListener(kDOMSubtreeModifiedType, &eventListener, false); + + // Add a node, that should trigger 2 events. + executeScript("addElement('newNode')"); + EXPECT_EQ(2U, eventListener.eventCount()); + eventListener.clearEvents(); + + // Remove one listener and trigger an event again. + document().removeEventListener( + kDOMSubtreeModifiedType, &eventListener, false); + executeScript("addElement('newerNode')"); + EXPECT_EQ(1U, eventListener.eventCount()); + eventListener.clearEvents(); + + // Remove the last listener and trigger yet another event. + document().removeEventListener( + kDOMSubtreeModifiedType, &eventListener, false); + executeScript("addElement('newererNode')"); + EXPECT_EQ(0U, eventListener.eventCount()); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/FrameLoaderClientImplTest.cpp b/Source/WebKit/chromium/tests/FrameLoaderClientImplTest.cpp new file mode 100644 index 000000000..8fc9e42b2 --- /dev/null +++ b/Source/WebKit/chromium/tests/FrameLoaderClientImplTest.cpp @@ -0,0 +1,115 @@ +/* + * 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 + * 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 "FrameLoaderClientImpl.h" + +#include "KURL.h" +#include "WebFrameClient.h" +#include "WebFrameImpl.h" +#include "WebView.h" + +#include <gtest/gtest.h> +#include <wtf/text/WTFString.h> + +using namespace WebKit; + +namespace { + +class TestWebFrameClient : public WebFrameClient { +public: + bool userAgent(const WebURL& url, WebString* userAgent) OVERRIDE + { + if (m_userAgentOverride.isEmpty()) + return false; + + *userAgent = m_userAgentOverride; + return true; + } + + void setUserAgentOverride(const WebString& userAgent) + { + m_userAgentOverride = userAgent; + } + +private: + WebString m_userAgentOverride; +}; + +class FrameLoaderClientImplTest : public testing::Test { +public: + void SetUp() + { + m_webView = WebView::create(0); + m_webView->initializeMainFrame(&m_webFrameClient); + WebFrameImpl* frame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); + m_frameLoaderClientImpl = static_cast<FrameLoaderClientImpl*>(frame->frame()->loader()->client()); + } + + void TearDown() + { + m_webView->close(); + } + + void setUserAgentOverride(const WebString& userAgent) + { + return m_webFrameClient.setUserAgentOverride(userAgent); + } + + const WebString userAgent() + { + // The test always returns the same user agent, regardless of the URL passed in. + WebCore::KURL dummyURL(WebCore::ParsedURLString, "about:blank"); + WTF::CString userAgent = m_frameLoaderClientImpl->userAgent(dummyURL).utf8(); + return WebString::fromUTF8(userAgent.data(), userAgent.length()); + } + +protected: + TestWebFrameClient m_webFrameClient; + FrameLoaderClientImpl* m_frameLoaderClientImpl; + WebView* m_webView; +}; + +TEST_F(FrameLoaderClientImplTest, UserAgentOverride) +{ + const WebString defaultUserAgent = userAgent(); + const WebString override = WebString::fromUTF8("dummy override"); + + // Override the user agent and make sure we get it back. + setUserAgentOverride(override); + EXPECT_TRUE(override.equals(userAgent())); + + // Remove the override and make sure we get the original back. + setUserAgentOverride(WebString()); + EXPECT_TRUE(defaultUserAgent.equals(userAgent())); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp b/Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp index 60331051f..eb9962d58 100644 --- a/Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp +++ b/Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp @@ -83,6 +83,20 @@ TEST(IDBLevelDBCodingTest, EncodeByte) EXPECT_EQ(expected, encodeByte(c)); } +TEST(IDBLevelDBCodingTest, EncodeBool) +{ + { + Vector<char> expected; + expected.append(1); + EXPECT_EQ(expected, encodeBool(true)); + } + { + Vector<char> expected; + expected.append(0); + EXPECT_EQ(expected, encodeBool(false)); + } +} + TEST(IDBLevelDBCodingTest, MaxIDBKey) { Vector<char> maxKey = maxIDBKey(); @@ -126,6 +140,20 @@ TEST(IDBLevelDBCodingTest, EncodeInt) EXPECT_EQ(static_cast<size_t>(4), encodeInt(0xffffffff).size()); } +TEST(IDBLevelDBCodingTest, DecodeBool) +{ + { + Vector<char> encoded; + encoded.append(1); + EXPECT_TRUE(decodeBool(encoded.data(), encoded.data() + encoded.size())); + } + { + Vector<char> encoded; + encoded.append(0); + EXPECT_FALSE(decodeBool(encoded.data(), encoded.data() + encoded.size())); + } +} + TEST(IDBLevelDBCodingTest, DecodeInt) { Vector<int64_t> testCases; diff --git a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp index ddab17564..69d0ff5ff 100644 --- a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "LayerRendererChromium.h" +#include "CCTiledLayerTestCommon.h" #include "FakeWebGraphicsContext3D.h" #include "GraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" @@ -35,6 +36,7 @@ using namespace WebCore; using namespace WebKit; +using namespace WebKitTests; class FrameCountingMemoryAllocationSettingContext : public FakeWebGraphicsContext3D { public: @@ -91,7 +93,7 @@ private: class FakeLayerRendererChromium : public LayerRendererChromium { public: - FakeLayerRendererChromium(LayerRendererChromiumClient* client, PassRefPtr<GraphicsContext3D> context) : LayerRendererChromium(client, context) { } + FakeLayerRendererChromium(LayerRendererChromiumClient* client, PassRefPtr<GraphicsContext3D> context, PassOwnPtr<TextureUploader> uploader) : LayerRendererChromium(client, context, uploader) { } // LayerRendererChromium methods. @@ -107,7 +109,7 @@ protected: , m_suggestHaveBackbufferNo(1, false) , m_context(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FrameCountingMemoryAllocationSettingContext()), GraphicsContext3D::RenderDirectlyToHostWindow)) , m_mockContext(*static_cast<FrameCountingMemoryAllocationSettingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_context.get()))) - , m_layerRendererChromium(&m_mockClient, m_context.release()) + , m_layerRendererChromium(&m_mockClient, m_context.release(), adoptPtr(new FakeTextureUploader())) { } @@ -271,7 +273,7 @@ public: TEST(LayerRendererChromiumTest2, initializationDoesNotMakeSynchronousCalls) { FakeLayerRendererChromiumClient mockClient; - FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ForbidSynchronousCallContext), GraphicsContext3D::RenderDirectlyToHostWindow)); + FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ForbidSynchronousCallContext), GraphicsContext3D::RenderDirectlyToHostWindow), adoptPtr(new FakeTextureUploader())); EXPECT_TRUE(layerRendererChromium.initialize()); } diff --git a/Source/WebKit/chromium/tests/LinkHighlightTest.cpp b/Source/WebKit/chromium/tests/LinkHighlightTest.cpp new file mode 100644 index 000000000..edcfd4a63 --- /dev/null +++ b/Source/WebKit/chromium/tests/LinkHighlightTest.cpp @@ -0,0 +1,87 @@ +/* + * 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 "LinkHighlight.h" + +#include "AnimationIdVendor.h" +#include "GraphicsLayerChromium.h" +#include "GraphicsLayerClient.h" +#include "IntRect.h" +#include "Path.h" +#include "TransformationMatrix.h" +#include <gtest/gtest.h> +#include <wtf/PassOwnPtr.h> + +using namespace WebCore; + +namespace { + +class MockGraphicsLayerClient : public GraphicsLayerClient { +public: + virtual void notifyAnimationStarted(const GraphicsLayer*, double time) OVERRIDE { } + virtual void notifySyncRequired(const GraphicsLayer*) OVERRIDE { } + virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip) OVERRIDE { } + virtual bool showDebugBorders(const GraphicsLayer*) const OVERRIDE { return false; } + virtual bool showRepaintCounter(const GraphicsLayer*) const OVERRIDE { return false; } +}; + +TEST(LinkHighlightTest, verifyLinkHighlightLayer) +{ + Path highlightPath; + highlightPath.addRect(FloatRect(5, 6, 12, 8)); + IntRect pathBoundingRect = enclosingIntRect(highlightPath.boundingRect()); + + RefPtr<LinkHighlight> highlight = LinkHighlight::create(0, highlightPath, AnimationIdVendor::LinkHighlightAnimationId, AnimationIdVendor::getNextGroupId()); + ASSERT_TRUE(highlight.get()); + ContentLayerChromium* contentLayer = highlight->contentLayer(); + ASSERT_TRUE(contentLayer); + + EXPECT_EQ(pathBoundingRect.size(), contentLayer->bounds()); + EXPECT_TRUE(contentLayer->transform().isIdentityOrTranslation()); + EXPECT_TRUE(contentLayer->transform().isIntegerTranslation()); + + TransformationMatrix::DecomposedType decomposition; + EXPECT_TRUE(contentLayer->transform().decompose(decomposition)); + + FloatPoint expectedTranslation(pathBoundingRect.x() + pathBoundingRect.width() / 2, pathBoundingRect.y() + pathBoundingRect.height() / 2); + EXPECT_EQ(FloatPoint(decomposition.translateX, decomposition.translateY), expectedTranslation); +} + +TEST(LinkHighlightTest, verifyGraphicsLayerChromiumEmbedding) +{ + MockGraphicsLayerClient client; + OwnPtr<GraphicsLayerChromium> graphicsLayer = static_pointer_cast<GraphicsLayerChromium>(GraphicsLayer::create(&client)); + ASSERT_TRUE(graphicsLayer.get()); + + Path highlightPath; + highlightPath.addRect(FloatRect(5, 5, 10, 8)); + + // Neither of the following operations should crash. + graphicsLayer->addLinkHighlight(highlightPath); + graphicsLayer->didFinishLinkHighlight(); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/ListenerLeakTest.cpp b/Source/WebKit/chromium/tests/ListenerLeakTest.cpp new file mode 100644 index 000000000..5e321c70d --- /dev/null +++ b/Source/WebKit/chromium/tests/ListenerLeakTest.cpp @@ -0,0 +1,125 @@ +/* + * 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 "FrameTestHelpers.h" +#include "WebView.h" +#include <gtest/gtest.h> +#include <v8/include/v8-profiler.h> +#include <v8/include/v8.h> +#include <webkit/support/webkit_support.h> + +using namespace WebKit; + +namespace { + +const v8::HeapGraphNode* GetProperty(const v8::HeapGraphNode* node, v8::HeapGraphEdge::Type type, const char* name) +{ + for (int i = 0, count = node->GetChildrenCount(); i < count; ++i) { + const v8::HeapGraphEdge* prop = node->GetChild(i); + if (prop->GetType() == type) { + v8::String::AsciiValue propName(prop->GetName()); + if (!strcmp(name, *propName)) + return prop->GetToNode(); + } + } + return 0; +} + +int GetNumObjects(const char* constructor) +{ + v8::HandleScope scope; + const v8::HeapSnapshot* snapshot = v8::HeapProfiler::TakeSnapshot(v8::String::New(""), v8::HeapSnapshot::kFull); + if (!snapshot) + return -1; + int count = 0; + for (int i = 0; i < snapshot->GetNodesCount(); ++i) { + const v8::HeapGraphNode* node = snapshot->GetNode(i); + if (node->GetType() != v8::HeapGraphNode::kObject) + continue; + v8::String::AsciiValue nodeName(node->GetName()); + if (!strcmp(constructor, *nodeName)) { + const v8::HeapGraphNode* constructorProp = GetProperty(node, v8::HeapGraphEdge::kProperty, "constructor"); + // Skip an Object instance named after the constructor. + if (constructorProp) { + v8::String::AsciiValue constructorName(constructorProp->GetName()); + if (!strcmp(constructor, *constructorName)) + continue; + } + ++count; + } + } + return count; +} + + +class ListenerLeakTest : public testing::Test { +public: + ListenerLeakTest() : m_webView(0) { } + + void RunTest(const std::string& filename) + { + std::string baseURL("http://www.example.com/"); + std::string fileName(filename); + bool executeScript = true; + FrameTestHelpers::registerMockedURLLoad(baseURL, fileName); + m_webView = FrameTestHelpers::createWebViewAndLoad(baseURL + fileName, executeScript); + } + + virtual void TearDown() OVERRIDE + { + if (m_webView) + m_webView->close(); + webkit_support::UnregisterAllMockedURLs(); + } + +protected: + WebView* m_webView; +}; + + +// This test tries to create a reference cycle between node and its listener. +// See http://crbug/17400. +TEST_F(ListenerLeakTest, ReferenceCycle) +{ + RunTest("listener/listener_leak1.html"); + ASSERT_EQ(0, GetNumObjects("EventListenerLeakTestObject1")); +} + +// This test sets node onclick many times to expose a possible memory +// leak where all listeners get referenced by the node. +TEST_F(ListenerLeakTest, HiddenReferences) +{ + RunTest("listener/listener_leak2.html"); + ASSERT_EQ(1, GetNumObjects("EventListenerLeakTestObject2")); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/MockCCQuadCuller.h b/Source/WebKit/chromium/tests/MockCCQuadCuller.h index d9cd31326..385507e2c 100644 --- a/Source/WebKit/chromium/tests/MockCCQuadCuller.h +++ b/Source/WebKit/chromium/tests/MockCCQuadCuller.h @@ -35,12 +35,12 @@ namespace WebCore { class MockCCQuadCuller : public WebCore::CCQuadCuller { public: MockCCQuadCuller() - : CCQuadCuller(m_quadListStorage, 0, 0) + : CCQuadCuller(m_quadListStorage, 0, 0, false) , m_activeQuadList(m_quadListStorage) { } explicit MockCCQuadCuller(CCQuadList& externalQuadList) - : CCQuadCuller(externalQuadList, 0, 0) + : CCQuadCuller(externalQuadList, 0, 0, false) , m_activeQuadList(externalQuadList) { } diff --git a/Source/WebKit/chromium/tests/RegionTest.cpp b/Source/WebKit/chromium/tests/RegionTest.cpp index d202ab40c..105d1c3ed 100644 --- a/Source/WebKit/chromium/tests/RegionTest.cpp +++ b/Source/WebKit/chromium/tests/RegionTest.cpp @@ -124,4 +124,271 @@ TEST(RegionTest, emptySpan) EXPECT_FALSE(rects[i].isEmpty()); } +#define TEST_NO_INTERSECT(a, b) \ +{ \ + Region ar = a; \ + Region br = b; \ + EXPECT_FALSE(ar.intersects(br)); \ + EXPECT_FALSE(br.intersects(ar)); \ +} + +#define TEST_INTERSECT(a, b) \ +{ \ + Region ar = a; \ + Region br = b; \ + EXPECT_TRUE(ar.intersects(br)); \ + EXPECT_TRUE(br.intersects(ar)); \ +} + +TEST(RegionTest, intersectsRegion) +{ + Region r; + + TEST_NO_INTERSECT(IntRect(), IntRect()); + TEST_NO_INTERSECT(IntRect(), IntRect(0, 0, 1, 1)); + TEST_NO_INTERSECT(IntRect(), IntRect(1, 1, 1, 1)); + + r.unite(IntRect(0, 0, 1, 1)); + TEST_NO_INTERSECT(r, IntRect()); + TEST_INTERSECT(r, IntRect(0, 0, 1, 1)); + TEST_INTERSECT(r, IntRect(0, 0, 2, 2)); + TEST_INTERSECT(r, IntRect(-1, 0, 2, 2)); + TEST_INTERSECT(r, IntRect(-1, -1, 2, 2)); + TEST_INTERSECT(r, IntRect(0, -1, 2, 2)); + TEST_INTERSECT(r, IntRect(-1, -1, 3, 3)); + + r.unite(IntRect(0, 0, 3, 3)); + r.unite(IntRect(10, 0, 3, 3)); + r.unite(IntRect(0, 10, 13, 3)); + TEST_NO_INTERSECT(r, IntRect()); + TEST_INTERSECT(r, IntRect(1, 1, 1, 1)); + TEST_INTERSECT(r, IntRect(0, 0, 2, 2)); + TEST_INTERSECT(r, IntRect(1, 0, 2, 2)); + TEST_INTERSECT(r, IntRect(1, 1, 2, 2)); + TEST_INTERSECT(r, IntRect(0, 1, 2, 2)); + TEST_INTERSECT(r, IntRect(0, 0, 3, 3)); + TEST_INTERSECT(r, IntRect(-1, -1, 2, 2)); + TEST_INTERSECT(r, IntRect(2, -1, 2, 2)); + TEST_INTERSECT(r, IntRect(2, 2, 2, 2)); + TEST_INTERSECT(r, IntRect(-1, 2, 2, 2)); + + TEST_INTERSECT(r, IntRect(11, 1, 1, 1)); + TEST_INTERSECT(r, IntRect(10, 0, 2, 2)); + TEST_INTERSECT(r, IntRect(11, 0, 2, 2)); + TEST_INTERSECT(r, IntRect(11, 1, 2, 2)); + TEST_INTERSECT(r, IntRect(10, 1, 2, 2)); + TEST_INTERSECT(r, IntRect(10, 0, 3, 3)); + TEST_INTERSECT(r, IntRect(9, -1, 2, 2)); + TEST_INTERSECT(r, IntRect(12, -1, 2, 2)); + TEST_INTERSECT(r, IntRect(12, 2, 2, 2)); + TEST_INTERSECT(r, IntRect(9, 2, 2, 2)); + + TEST_INTERSECT(r, IntRect(0, -1, 13, 5)); + TEST_INTERSECT(r, IntRect(1, -1, 11, 5)); + TEST_INTERSECT(r, IntRect(2, -1, 9, 5)); + TEST_INTERSECT(r, IntRect(2, -1, 8, 5)); + TEST_INTERSECT(r, IntRect(3, -1, 8, 5)); + TEST_NO_INTERSECT(r, IntRect(3, -1, 7, 5)); + + TEST_INTERSECT(r, IntRect(0, 1, 13, 1)); + TEST_INTERSECT(r, IntRect(1, 1, 11, 1)); + TEST_INTERSECT(r, IntRect(2, 1, 9, 1)); + TEST_INTERSECT(r, IntRect(2, 1, 8, 1)); + TEST_INTERSECT(r, IntRect(3, 1, 8, 1)); + TEST_NO_INTERSECT(r, IntRect(3, 1, 7, 1)); + + TEST_INTERSECT(r, IntRect(0, 0, 13, 13)); + TEST_INTERSECT(r, IntRect(0, 1, 13, 11)); + TEST_INTERSECT(r, IntRect(0, 2, 13, 9)); + TEST_INTERSECT(r, IntRect(0, 2, 13, 8)); + TEST_INTERSECT(r, IntRect(0, 3, 13, 8)); + TEST_NO_INTERSECT(r, IntRect(0, 3, 13, 7)); +} + +TEST(RegionTest, ReadPastFullSpanVectorInIntersectsTest) +{ + Region r; + + // This region has enough spans to fill its allocated Vector exactly. + r.unite(IntRect(400, 300, 1, 800)); + r.unite(IntRect(785, 585, 1, 1)); + r.unite(IntRect(787, 585, 1, 1)); + r.unite(IntRect(0, 587, 16, 162)); + r.unite(IntRect(26, 590, 300, 150)); + r.unite(IntRect(196, 750, 1, 1)); + r.unite(IntRect(0, 766, 1, 1)); + r.unite(IntRect(0, 782, 1, 1)); + r.unite(IntRect(745, 798, 1, 1)); + r.unite(IntRect(795, 882, 10, 585)); + r.unite(IntRect(100, 1499, 586, 1)); + r.unite(IntRect(100, 1500, 585, 784)); + // This query rect goes past the bottom of the Region, causing the + // test to reach the last span and try go past it. It should not read + // memory off the end of the span Vector. + TEST_NO_INTERSECT(r, IntRect(0, 2184, 1, 150)); +} + +#define TEST_NO_CONTAINS(a, b) \ +{ \ + Region ar = a; \ + Region br = b; \ + EXPECT_FALSE(ar.contains(br)); \ +} + +#define TEST_CONTAINS(a, b) \ +{ \ + Region ar = a; \ + Region br = b; \ + EXPECT_TRUE(ar.contains(br)); \ +} + +TEST(RegionTest, containsRegion) +{ + TEST_CONTAINS(IntRect(), IntRect()); + TEST_NO_CONTAINS(IntRect(), IntRect(0, 0, 1, 1)); + TEST_NO_CONTAINS(IntRect(), IntRect(1, 1, 1, 1)); + + TEST_NO_CONTAINS(IntRect(10, 10, 1, 1), IntRect(11, 10, 1, 1)); + TEST_NO_CONTAINS(IntRect(10, 10, 1, 1), IntRect(10, 11, 1, 1)); + TEST_NO_CONTAINS(IntRect(10, 10, 1, 1), IntRect(9, 10, 1, 1)); + TEST_NO_CONTAINS(IntRect(10, 10, 1, 1), IntRect(10, 9, 1, 1)); + TEST_NO_CONTAINS(IntRect(10, 10, 1, 1), IntRect(9, 9, 2, 2)); + TEST_NO_CONTAINS(IntRect(10, 10, 1, 1), IntRect(10, 9, 2, 2)); + TEST_NO_CONTAINS(IntRect(10, 10, 1, 1), IntRect(9, 10, 2, 2)); + TEST_NO_CONTAINS(IntRect(10, 10, 1, 1), IntRect(10, 10, 2, 2)); + TEST_NO_CONTAINS(IntRect(10, 10, 1, 1), IntRect(9, 9, 3, 3)); + + Region hLines; + for (int i = 10; i < 20; i += 2) + hLines.unite(IntRect(i, 10, 1, 10)); + + TEST_CONTAINS(IntRect(10, 10, 9, 10), hLines); + TEST_NO_CONTAINS(IntRect(10, 10, 9, 9), hLines); + TEST_NO_CONTAINS(IntRect(10, 11, 9, 9), hLines); + TEST_NO_CONTAINS(IntRect(10, 10, 8, 10), hLines); + TEST_NO_CONTAINS(IntRect(11, 10, 8, 10), hLines); + + Region vLines; + for (int i = 10; i < 20; i += 2) + vLines.unite(IntRect(10, i, 10, 1)); + + TEST_CONTAINS(IntRect(10, 10, 10, 9), vLines); + TEST_NO_CONTAINS(IntRect(10, 10, 9, 9), vLines); + TEST_NO_CONTAINS(IntRect(11, 10, 9, 9), vLines); + TEST_NO_CONTAINS(IntRect(10, 10, 10, 8), vLines); + TEST_NO_CONTAINS(IntRect(10, 11, 10, 8), vLines); + + Region grid; + for (int i = 10; i < 20; i += 2) + for (int j = 10; j < 20; j += 2) + grid.unite(IntRect(i, j, 1, 1)); + + TEST_CONTAINS(IntRect(10, 10, 9, 9), grid); + TEST_NO_CONTAINS(IntRect(10, 10, 9, 8), grid); + TEST_NO_CONTAINS(IntRect(10, 11, 9, 8), grid); + TEST_NO_CONTAINS(IntRect(10, 10, 8, 9), grid); + TEST_NO_CONTAINS(IntRect(11, 10, 8, 9), grid); + + TEST_CONTAINS(hLines, hLines); + TEST_CONTAINS(vLines, vLines); + TEST_NO_CONTAINS(vLines, hLines); + TEST_NO_CONTAINS(hLines, vLines); + TEST_CONTAINS(grid, grid); + TEST_CONTAINS(hLines, grid); + TEST_CONTAINS(vLines, grid); + TEST_NO_CONTAINS(grid, hLines); + TEST_NO_CONTAINS(grid, vLines); + + for (int i = 10; i < 20; i += 2) + TEST_CONTAINS(hLines, IntRect(i, 10, 1, 10)); + + for (int i = 10; i < 20; i += 2) + TEST_CONTAINS(vLines, IntRect(10, i, 10, 1)); + + for (int i = 10; i < 20; i += 2) + for (int j = 10; j < 20; j += 2) + TEST_CONTAINS(grid, IntRect(i, j, 1, 1)); + + Region container; + container.unite(IntRect(0, 0, 40, 20)); + container.unite(IntRect(0, 20, 41, 20)); + TEST_CONTAINS(container, IntRect(5, 5, 30, 30)); + + container = Region(); + container.unite(IntRect(0, 0, 10, 10)); + container.unite(IntRect(0, 30, 10, 10)); + container.unite(IntRect(30, 30, 10, 10)); + container.unite(IntRect(30, 0, 10, 10)); + TEST_NO_CONTAINS(container, IntRect(5, 5, 30, 30)); + + container = Region(); + container.unite(IntRect(0, 0, 10, 10)); + container.unite(IntRect(0, 30, 10, 10)); + container.unite(IntRect(30, 0, 10, 40)); + TEST_NO_CONTAINS(container, IntRect(5, 5, 30, 30)); + + container = Region(); + container.unite(IntRect(30, 0, 10, 10)); + container.unite(IntRect(30, 30, 10, 10)); + container.unite(IntRect(0, 0, 10, 40)); + TEST_NO_CONTAINS(container, IntRect(5, 5, 30, 30)); + + container = Region(); + container.unite(IntRect(0, 0, 10, 40)); + container.unite(IntRect(30, 0, 10, 40)); + TEST_NO_CONTAINS(container, IntRect(5, 5, 30, 30)); + + container = Region(); + container.unite(IntRect(0, 0, 40, 40)); + TEST_NO_CONTAINS(container, IntRect(10, -1, 20, 10)); + + container = Region(); + container.unite(IntRect(0, 0, 40, 40)); + TEST_NO_CONTAINS(container, IntRect(10, 31, 20, 10)); + + container = Region(); + container.unite(IntRect(0, 0, 40, 20)); + container.unite(IntRect(0, 20, 41, 20)); + TEST_NO_CONTAINS(container, IntRect(-1, 10, 10, 20)); + + container = Region(); + container.unite(IntRect(0, 0, 40, 20)); + container.unite(IntRect(0, 20, 41, 20)); + TEST_NO_CONTAINS(container, IntRect(31, 10, 10, 20)); + + container = Region(); + container.unite(IntRect(0, 0, 40, 40)); + container.subtract(IntRect(0, 20, 60, 0)); + TEST_NO_CONTAINS(container, IntRect(31, 10, 10, 20)); +} + +TEST(RegionTest, unite) +{ + Region r; + Region r2; + + // A rect uniting a contained rect does not change the region. + r2 = r = IntRect(0, 0, 50, 50); + r2.unite(IntRect(20, 20, 10, 10)); + EXPECT_EQ(r, r2); + + // A rect uniting a containing rect gives back the containing rect. + r = IntRect(0, 0, 50, 50); + r.unite(IntRect(0, 0, 100, 100)); + EXPECT_EQ(Region(IntRect(0, 0, 100, 100)), r); + + // A complex region uniting a contained rect does not change the region. + r = IntRect(0, 0, 50, 50); + r.unite(IntRect(100, 0, 50, 50)); + r2 = r; + r2.unite(IntRect(20, 20, 10, 10)); + EXPECT_EQ(r, r2); + + // A complex region uniting a containing rect gives back the containing rect. + r = IntRect(0, 0, 50, 50); + r.unite(IntRect(100, 0, 50, 50)); + r. unite(IntRect(0, 0, 500, 500)); + EXPECT_EQ(Region(IntRect(0, 0, 500, 500)), r); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp new file mode 100644 index 000000000..b60017fd9 --- /dev/null +++ b/Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp @@ -0,0 +1,136 @@ +/* + * 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 "TextureLayerChromium.h" + +#include "FakeCCLayerTreeHostClient.h" +#include "WebCompositor.h" +#include "cc/CCLayerTreeHost.h" +#include <gmock/gmock.h> +#include <gtest/gtest.h> + +using namespace WebCore; +using ::testing::Mock; +using ::testing::_; +using ::testing::AtLeast; +using ::testing::AnyNumber; + +namespace { + +class MockCCLayerTreeHost : public CCLayerTreeHost { +public: + MockCCLayerTreeHost() + : CCLayerTreeHost(&m_fakeClient, CCSettings()) + { + initialize(); + } + + MOCK_METHOD0(acquireLayerTextures, void()); + +private: + FakeCCLayerTreeHostClient m_fakeClient; +}; + + +class TextureLayerChromiumTest : public testing::Test { +protected: + virtual void SetUp() + { + // Initialize without threading support. + WebKit::WebCompositor::initialize(0); + m_layerTreeHost = adoptPtr(new MockCCLayerTreeHost); + } + + virtual void TearDown() + { + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AnyNumber()); + + m_layerTreeHost->setRootLayer(0); + m_layerTreeHost.clear(); + WebKit::WebCompositor::shutdown(); + } + + OwnPtr<MockCCLayerTreeHost> m_layerTreeHost; +}; + +TEST_F(TextureLayerChromiumTest, syncImplWhenChangingTextureId) +{ + RefPtr<TextureLayerChromium> testLayer = TextureLayerChromium::create(0); + ASSERT_TRUE(testLayer); + + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AnyNumber()); + m_layerTreeHost->setRootLayer(testLayer); + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); + EXPECT_EQ(testLayer->layerTreeHost(), m_layerTreeHost.get()); + + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); + testLayer->setTextureId(1); + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); + + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AtLeast(1)); + testLayer->setTextureId(2); + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); + + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AtLeast(1)); + testLayer->setTextureId(0); + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); +} + +TEST_F(TextureLayerChromiumTest, syncImplWhenRemovingFromTree) +{ + RefPtr<LayerChromium> rootLayer = LayerChromium::create(); + ASSERT_TRUE(rootLayer); + RefPtr<LayerChromium> childLayer = LayerChromium::create(); + ASSERT_TRUE(childLayer); + rootLayer->addChild(childLayer); + RefPtr<TextureLayerChromium> testLayer = TextureLayerChromium::create(0); + ASSERT_TRUE(testLayer); + testLayer->setTextureId(0); + childLayer->addChild(testLayer); + + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AnyNumber()); + m_layerTreeHost->setRootLayer(rootLayer); + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); + + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); + testLayer->removeFromParent(); + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); + + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); + childLayer->addChild(testLayer); + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); + + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); + testLayer->setTextureId(1); + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); + + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AtLeast(1)); + testLayer->removeFromParent(); + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); +} + +} // anonymous namespace diff --git a/Source/WebKit/chromium/tests/ThrottledTextureUploaderTest.cpp b/Source/WebKit/chromium/tests/ThrottledTextureUploaderTest.cpp new file mode 100644 index 000000000..4b0dfd059 --- /dev/null +++ b/Source/WebKit/chromium/tests/ThrottledTextureUploaderTest.cpp @@ -0,0 +1,93 @@ +/* + * 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 "ThrottledTextureUploader.h" + +#include "FakeWebGraphicsContext3D.h" +#include "GraphicsContext3DPrivate.h" + +#include <gmock/gmock.h> +#include <gtest/gtest.h> +#include <wtf/RefPtr.h> + +using namespace WebCore; +using namespace WebKit; + +namespace { + +class FakeWebGraphicsContext3DWithQueryTesting : public FakeWebGraphicsContext3D { +public: + FakeWebGraphicsContext3DWithQueryTesting() : m_resultAvailable(0) + { + } + + virtual void getQueryObjectuivEXT(WebGLId, GC3Denum type, GC3Duint* value) + { + switch (type) { + case Extensions3DChromium::QUERY_RESULT_AVAILABLE_EXT: + *value = m_resultAvailable; + break; + default: + *value = 0; + break; + } + } + + void setResultAvailable(unsigned resultAvailable) { m_resultAvailable = resultAvailable; } + +private: + unsigned m_resultAvailable; +}; + +TEST(ThrottledTextureUploaderTest, IsBusy) +{ + GraphicsContext3D::Attributes attrs; + RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DWithQueryTesting()), GraphicsContext3D::RenderDirectlyToHostWindow); + FakeWebGraphicsContext3DWithQueryTesting& fakeContext = *static_cast<FakeWebGraphicsContext3DWithQueryTesting*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get())); + OwnPtr<ThrottledTextureUploader> uploader = ThrottledTextureUploader::create(context, 2); + + fakeContext.setResultAvailable(0); + EXPECT_FALSE(uploader->isBusy()); + uploader->beginUploads(); + uploader->endUploads(); + EXPECT_FALSE(uploader->isBusy()); + uploader->beginUploads(); + uploader->endUploads(); + EXPECT_TRUE(uploader->isBusy()); + + fakeContext.setResultAvailable(1); + EXPECT_FALSE(uploader->isBusy()); + uploader->beginUploads(); + uploader->endUploads(); + EXPECT_FALSE(uploader->isBusy()); + uploader->beginUploads(); + uploader->endUploads(); + EXPECT_FALSE(uploader->isBusy()); + uploader->beginUploads(); + uploader->endUploads(); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index 5b7cb0df7..c9125a852 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -957,7 +957,7 @@ TEST(TiledLayerChromiumTest, partialUpdates) } ccLayerTreeHost->commitComplete(); - // Partail update of 6 checkerboard tiles. + // Partial update of 6 checkerboard tiles. layer->invalidateRect(IntRect(50, 50, 200, 100)); { DebugScopedSetImplThread implThread; @@ -975,6 +975,20 @@ TEST(TiledLayerChromiumTest, partialUpdates) } ccLayerTreeHost->commitComplete(); + // Partial update of 4 tiles. + layer->invalidateRect(IntRect(50, 50, 100, 100)); + { + DebugScopedSetImplThread implThread; + OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0))); + ccLayerTreeHost->updateLayers(updater); + updater.update(0, &allocator, &copier, &uploader, 4); + EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); + EXPECT_FALSE(updater.hasMoreUpdates()); + layer->fakeLayerTextureUpdater()->clearUpdateCount(); + layer->pushPropertiesTo(layerImpl.get()); + } + ccLayerTreeHost->commitComplete(); + ccLayerTreeHost->setRootLayer(0); ccLayerTreeHost.clear(); WebKit::WebCompositor::shutdown(); diff --git a/Source/WebKit/chromium/tests/TilingDataTest.cpp b/Source/WebKit/chromium/tests/TilingDataTest.cpp index 47c0361ea..060bc7767 100755 --- a/Source/WebKit/chromium/tests/TilingDataTest.cpp +++ b/Source/WebKit/chromium/tests/TilingDataTest.cpp @@ -30,6 +30,7 @@ #include "config.h" +#include "IntSize.h" #include "TilingData.h" #include <wtf/Assertions.h> @@ -41,8 +42,8 @@ namespace { class TestTiling : public TilingData { public: - TestTiling(int maxTextureSize, int totalSizeX, int totalSizeY, bool hasBorderTexels) - : TilingData(maxTextureSize, totalSizeX, totalSizeY, hasBorderTexels) + TestTiling(IntSize maxTextureSize, IntSize totalSize, bool hasBorderTexels) + : TilingData(maxTextureSize, totalSize, hasBorderTexels) { } @@ -62,402 +63,413 @@ public: TEST(TilingDataTest, numTiles_NoTiling) { - EXPECT_EQ(1, TestTiling(16, 16, 16, false).numTiles()); - EXPECT_EQ(1, TestTiling(16, 15, 15, true).numTiles()); - EXPECT_EQ(1, TestTiling(16, 16, 16, true).numTiles()); - EXPECT_EQ(1, TestTiling(16, 1, 16, false).numTiles()); - EXPECT_EQ(1, TestTiling(15, 15, 15, true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(16, 16), IntSize(16, 16), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(16, 16), IntSize(15, 15), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(16, 16), IntSize(16, 16), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(16, 16), IntSize(1, 16), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(15, 15), IntSize(15, 15), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(32, 16), IntSize(32, 16), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(32, 16), IntSize(32, 16), true).numTiles()); } TEST(TilingDataTest, numTiles_TilingNoBorders) { - EXPECT_EQ(0, TestTiling(0, 0, 0, false).numTiles()); - EXPECT_EQ(0, TestTiling(0, 4, 0, false).numTiles()); - EXPECT_EQ(0, TestTiling(0, 0, 4, false).numTiles()); - EXPECT_EQ(0, TestTiling(4, 4, 0, false).numTiles()); - EXPECT_EQ(0, TestTiling(4, 0, 4, false).numTiles()); - EXPECT_EQ(0, TestTiling(-8, 1, 1, false).numTiles()); - EXPECT_EQ(0, TestTiling(-1, 1, 1, false).numTiles()); - EXPECT_EQ(0, TestTiling(0, 1, 1, false).numTiles()); - - EXPECT_EQ(1, TestTiling(1, 1, 1, false).numTiles()); - EXPECT_EQ(2, TestTiling(1, 1, 2, false).numTiles()); - EXPECT_EQ(2, TestTiling(1, 2, 1, false).numTiles()); - EXPECT_EQ(1, TestTiling(2, 1, 1, false).numTiles()); - EXPECT_EQ(1, TestTiling(2, 1, 2, false).numTiles()); - EXPECT_EQ(1, TestTiling(2, 2, 1, false).numTiles()); - EXPECT_EQ(1, TestTiling(2, 2, 2, false).numTiles()); - EXPECT_EQ(1, TestTiling(3, 3, 3, false).numTiles()); - - EXPECT_EQ(1, TestTiling(4, 1, 4, false).numTiles()); - EXPECT_EQ(1, TestTiling(4, 2, 4, false).numTiles()); - EXPECT_EQ(1, TestTiling(4, 3, 4, false).numTiles()); - EXPECT_EQ(1, TestTiling(4, 4, 4, false).numTiles()); - EXPECT_EQ(2, TestTiling(4, 5, 4, false).numTiles()); - EXPECT_EQ(2, TestTiling(4, 6, 4, false).numTiles()); - EXPECT_EQ(2, TestTiling(4, 7, 4, false).numTiles()); - EXPECT_EQ(2, TestTiling(4, 8, 4, false).numTiles()); - EXPECT_EQ(3, TestTiling(4, 9, 4, false).numTiles()); - EXPECT_EQ(3, TestTiling(4, 10, 4, false).numTiles()); - EXPECT_EQ(3, TestTiling(4, 11, 4, false).numTiles()); - - EXPECT_EQ(1, TestTiling(5, 1, 5, false).numTiles()); - EXPECT_EQ(1, TestTiling(5, 2, 5, false).numTiles()); - EXPECT_EQ(1, TestTiling(5, 3, 5, false).numTiles()); - EXPECT_EQ(1, TestTiling(5, 4, 5, false).numTiles()); - EXPECT_EQ(1, TestTiling(5, 5, 5, false).numTiles()); - EXPECT_EQ(2, TestTiling(5, 6, 5, false).numTiles()); - EXPECT_EQ(2, TestTiling(5, 7, 5, false).numTiles()); - EXPECT_EQ(2, TestTiling(5, 8, 5, false).numTiles()); - EXPECT_EQ(2, TestTiling(5, 9, 5, false).numTiles()); - EXPECT_EQ(2, TestTiling(5, 10, 5, false).numTiles()); - EXPECT_EQ(3, TestTiling(5, 11, 5, false).numTiles()); - - EXPECT_EQ(1, TestTiling(16, 16, 16, false).numTiles()); - EXPECT_EQ(1, TestTiling(17, 16, 16, false).numTiles()); - EXPECT_EQ(4, TestTiling(15, 16, 16, false).numTiles()); - EXPECT_EQ(4, TestTiling(8, 16, 16, false).numTiles()); - EXPECT_EQ(6, TestTiling(8, 17, 16, false).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(0, 0), IntSize(0, 0), false).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(0, 0), IntSize(4, 0), false).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(0, 0), IntSize(0, 4), false).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(4, 4), IntSize(4, 0), false).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(4, 4), IntSize(0, 4), false).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(-8, -8), IntSize(1, 1), false).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(-1, -1), IntSize(1, 1), false).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(0, 0), IntSize(1, 1), false).numTiles()); + + EXPECT_EQ(1, TestTiling(IntSize(1, 1), IntSize(1, 1), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(1, 1), IntSize(1, 2), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(1, 1), IntSize(2, 1), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(2, 2), IntSize(1, 1), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(2, 2), IntSize(1, 2), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(2, 2), IntSize(2, 1), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(2, 2), IntSize(2, 2), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(3, 3), false).numTiles()); + + EXPECT_EQ(1, TestTiling(IntSize(4, 4), IntSize(1, 4), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(4, 4), IntSize(2, 4), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(4, 4), IntSize(3, 4), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(4, 4), IntSize(4, 4), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(4, 4), IntSize(5, 4), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(4, 4), IntSize(6, 4), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(4, 4), IntSize(7, 4), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(4, 4), IntSize(8, 4), false).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(4, 4), IntSize(9, 4), false).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(4, 4), IntSize(10, 4), false).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(4, 4), IntSize(11, 4), false).numTiles()); + + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(1, 5), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(2, 5), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(3, 5), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(4, 5), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(5, 5), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(6, 5), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(7, 5), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(8, 5), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(9, 5), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(10, 5), false).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(11, 5), false).numTiles()); + + EXPECT_EQ(1, TestTiling(IntSize(16, 16), IntSize(16, 16), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(17, 17), IntSize(16, 16), false).numTiles()); + EXPECT_EQ(4, TestTiling(IntSize(15, 15), IntSize(16, 16), false).numTiles()); + EXPECT_EQ(4, TestTiling(IntSize(8, 8), IntSize(16, 16), false).numTiles()); + EXPECT_EQ(6, TestTiling(IntSize(8, 8), IntSize(17, 16), false).numTiles()); + + EXPECT_EQ(8, TestTiling(IntSize(5, 8), IntSize(17, 16), false).numTiles()); } TEST(TilingDataTest, numTiles_TilingWithBorders) { - EXPECT_EQ(0, TestTiling(0, 0, 0, true).numTiles()); - EXPECT_EQ(0, TestTiling(0, 4, 0, true).numTiles()); - EXPECT_EQ(0, TestTiling(0, 0, 4, true).numTiles()); - EXPECT_EQ(0, TestTiling(4, 4, 0, true).numTiles()); - EXPECT_EQ(0, TestTiling(4, 0, 4, true).numTiles()); - EXPECT_EQ(0, TestTiling(-8, 1, 1, true).numTiles()); - EXPECT_EQ(0, TestTiling(-1, 1, 1, true).numTiles()); - EXPECT_EQ(0, TestTiling(0, 1, 1, true).numTiles()); - - EXPECT_EQ(1, TestTiling(1, 1, 1, true).numTiles()); - EXPECT_EQ(0, TestTiling(1, 1, 2, true).numTiles()); - EXPECT_EQ(0, TestTiling(1, 2, 1, true).numTiles()); - EXPECT_EQ(1, TestTiling(2, 1, 1, true).numTiles()); - EXPECT_EQ(1, TestTiling(2, 1, 2, true).numTiles()); - EXPECT_EQ(1, TestTiling(2, 2, 1, true).numTiles()); - EXPECT_EQ(1, TestTiling(2, 2, 2, true).numTiles()); - - EXPECT_EQ(1, TestTiling(3, 1, 3, true).numTiles()); - EXPECT_EQ(1, TestTiling(3, 2, 3, true).numTiles()); - EXPECT_EQ(1, TestTiling(3, 3, 3, true).numTiles()); - EXPECT_EQ(2, TestTiling(3, 4, 3, true).numTiles()); - EXPECT_EQ(3, TestTiling(3, 5, 3, true).numTiles()); - EXPECT_EQ(4, TestTiling(3, 6, 3, true).numTiles()); - EXPECT_EQ(5, TestTiling(3, 7, 3, true).numTiles()); - - EXPECT_EQ(1, TestTiling(4, 1, 4, true).numTiles()); - EXPECT_EQ(1, TestTiling(4, 2, 4, true).numTiles()); - EXPECT_EQ(1, TestTiling(4, 3, 4, true).numTiles()); - EXPECT_EQ(1, TestTiling(4, 4, 4, true).numTiles()); - EXPECT_EQ(2, TestTiling(4, 5, 4, true).numTiles()); - EXPECT_EQ(2, TestTiling(4, 6, 4, true).numTiles()); - EXPECT_EQ(3, TestTiling(4, 7, 4, true).numTiles()); - EXPECT_EQ(3, TestTiling(4, 8, 4, true).numTiles()); - EXPECT_EQ(4, TestTiling(4, 9, 4, true).numTiles()); - EXPECT_EQ(4, TestTiling(4, 10, 4, true).numTiles()); - EXPECT_EQ(5, TestTiling(4, 11, 4, true).numTiles()); - - EXPECT_EQ(1, TestTiling(5, 1, 5, true).numTiles()); - EXPECT_EQ(1, TestTiling(5, 2, 5, true).numTiles()); - EXPECT_EQ(1, TestTiling(5, 3, 5, true).numTiles()); - EXPECT_EQ(1, TestTiling(5, 4, 5, true).numTiles()); - EXPECT_EQ(1, TestTiling(5, 5, 5, true).numTiles()); - EXPECT_EQ(2, TestTiling(5, 6, 5, true).numTiles()); - EXPECT_EQ(2, TestTiling(5, 7, 5, true).numTiles()); - EXPECT_EQ(2, TestTiling(5, 8, 5, true).numTiles()); - EXPECT_EQ(3, TestTiling(5, 9, 5, true).numTiles()); - EXPECT_EQ(3, TestTiling(5, 10, 5, true).numTiles()); - EXPECT_EQ(3, TestTiling(5, 11, 5, true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(0, 0), IntSize(0, 0), true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(0, 0), IntSize(4, 0), true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(0, 0), IntSize(0, 4), true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(4, 4), IntSize(4, 0), true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(4, 4), IntSize(0, 4), true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(-8, -8), IntSize(1, 1), true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(-1, -1), IntSize(1, 1), true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(0, 0), IntSize(1, 1), true).numTiles()); + + EXPECT_EQ(1, TestTiling(IntSize(1, 1), IntSize(1, 1), true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(1, 1), IntSize(1, 2), true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(1, 1), IntSize(2, 1), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(2, 2), IntSize(1, 1), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(2, 2), IntSize(1, 2), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(2, 2), IntSize(2, 1), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(2, 2), IntSize(2, 2), true).numTiles()); + + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(1, 3), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(2, 3), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(3, 3), true).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(4, 3), true).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(5, 3), true).numTiles()); + EXPECT_EQ(4, TestTiling(IntSize(3, 3), IntSize(6, 3), true).numTiles()); + EXPECT_EQ(5, TestTiling(IntSize(3, 3), IntSize(7, 3), true).numTiles()); + + EXPECT_EQ(1, TestTiling(IntSize(4, 4), IntSize(1, 4), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(4, 4), IntSize(2, 4), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(4, 4), IntSize(3, 4), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(4, 4), IntSize(4, 4), true).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(4, 4), IntSize(5, 4), true).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(4, 4), IntSize(6, 4), true).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(4, 4), IntSize(7, 4), true).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(4, 4), IntSize(8, 4), true).numTiles()); + EXPECT_EQ(4, TestTiling(IntSize(4, 4), IntSize(9, 4), true).numTiles()); + EXPECT_EQ(4, TestTiling(IntSize(4, 4), IntSize(10, 4), true).numTiles()); + EXPECT_EQ(5, TestTiling(IntSize(4, 4), IntSize(11, 4), true).numTiles()); + + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(1, 5), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(2, 5), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(3, 5), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(4, 5), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(5, 5), true).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(6, 5), true).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(7, 5), true).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(8, 5), true).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(9, 5), true).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(10, 5), true).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(11, 5), true).numTiles()); + + EXPECT_EQ(30, TestTiling(IntSize(8, 5), IntSize(16, 32), true).numTiles()); } TEST(TilingDataTest, tileXIndexFromSrcCoord) { - EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(2)); - EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(3)); - EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(4)); - EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(5)); - EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(6)); - EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(7)); - EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(8)); - EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(9)); - EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(10)); - EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(11)); - - EXPECT_EQ(0, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(1)); - EXPECT_EQ(1, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(2)); - EXPECT_EQ(2, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(3)); - EXPECT_EQ(3, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(4)); - EXPECT_EQ(4, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(5)); - EXPECT_EQ(5, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(6)); - EXPECT_EQ(6, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(7)); - EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(8)); - EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(9)); - EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(10)); - EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(11)); - - EXPECT_EQ(0, TestTiling(1, 1, 1, false).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(2, 2, 2, false).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(2, 2, 2, false).tileXIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileXIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileXIndexFromSrcCoord(2)); - - EXPECT_EQ(0, TestTiling(3, 4, 3, false).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 4, 3, false).tileXIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 4, 3, false).tileXIndexFromSrcCoord(2)); - EXPECT_EQ(1, TestTiling(3, 4, 3, false).tileXIndexFromSrcCoord(3)); - - EXPECT_EQ(0, TestTiling(1, 1, 1, true).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(2, 2, 2, true).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(2, 2, 2, true).tileXIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileXIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileXIndexFromSrcCoord(2)); - - EXPECT_EQ(0, TestTiling(3, 4, 3, true).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 4, 3, true).tileXIndexFromSrcCoord(1)); - EXPECT_EQ(1, TestTiling(3, 4, 3, true).tileXIndexFromSrcCoord(2)); - EXPECT_EQ(1, TestTiling(3, 4, 3, true).tileXIndexFromSrcCoord(3)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(2)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(3)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(4)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(5)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(6)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(7)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(8)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(9)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(10)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(11)); + + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(1)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(2)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(3)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(4)); + EXPECT_EQ(4, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(5)); + EXPECT_EQ(5, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(6)); + EXPECT_EQ(6, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(7)); + EXPECT_EQ(7, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(8)); + EXPECT_EQ(7, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(9)); + EXPECT_EQ(7, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(10)); + EXPECT_EQ(7, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(11)); + + EXPECT_EQ(0, TestTiling(IntSize(1, 1), IntSize(1, 1), false).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(2, 2), IntSize(2, 2), false).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(2, 2), IntSize(2, 2), false).tileXIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), false).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), false).tileXIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), false).tileXIndexFromSrcCoord(2)); + + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(4, 3), false).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(4, 3), false).tileXIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(4, 3), false).tileXIndexFromSrcCoord(2)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(4, 3), false).tileXIndexFromSrcCoord(3)); + + EXPECT_EQ(0, TestTiling(IntSize(1, 1), IntSize(1, 1), true).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(2, 2), IntSize(2, 2), true).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(2, 2), IntSize(2, 2), true).tileXIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), true).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), true).tileXIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), true).tileXIndexFromSrcCoord(2)); + + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(4, 3), true).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(4, 3), true).tileXIndexFromSrcCoord(1)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(4, 3), true).tileXIndexFromSrcCoord(2)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(4, 3), true).tileXIndexFromSrcCoord(3)); } TEST(TilingDataTest, tileYIndexFromSrcCoord) { - EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(2)); - EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(3)); - EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(4)); - EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(5)); - EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(6)); - EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(7)); - EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(8)); - EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(9)); - EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(10)); - EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(11)); - - EXPECT_EQ(0, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(1)); - EXPECT_EQ(1, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(2)); - EXPECT_EQ(2, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(3)); - EXPECT_EQ(3, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(4)); - EXPECT_EQ(4, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(5)); - EXPECT_EQ(5, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(6)); - EXPECT_EQ(6, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(7)); - EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(8)); - EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(9)); - EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(10)); - EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(11)); - - EXPECT_EQ(0, TestTiling(1, 1, 1, false).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(2, 2, 2, false).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(2, 2, 2, false).tileYIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileYIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileYIndexFromSrcCoord(2)); - - EXPECT_EQ(0, TestTiling(3, 3, 4, false).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 3, 4, false).tileYIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 3, 4, false).tileYIndexFromSrcCoord(2)); - EXPECT_EQ(1, TestTiling(3, 3, 4, false).tileYIndexFromSrcCoord(3)); - - EXPECT_EQ(0, TestTiling(1, 1, 1, true).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(2, 2, 2, true).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(2, 2, 2, true).tileYIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileYIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileYIndexFromSrcCoord(2)); - - EXPECT_EQ(0, TestTiling(3, 3, 4, true).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 3, 4, true).tileYIndexFromSrcCoord(1)); - EXPECT_EQ(1, TestTiling(3, 3, 4, true).tileYIndexFromSrcCoord(2)); - EXPECT_EQ(1, TestTiling(3, 3, 4, true).tileYIndexFromSrcCoord(3)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(2)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(3)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(4)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(5)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(6)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(7)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(8)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(9)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(10)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(11)); + + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(1)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(2)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(3)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(4)); + EXPECT_EQ(4, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(5)); + EXPECT_EQ(5, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(6)); + EXPECT_EQ(6, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(7)); + EXPECT_EQ(7, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(8)); + EXPECT_EQ(7, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(9)); + EXPECT_EQ(7, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(10)); + EXPECT_EQ(7, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(11)); + + EXPECT_EQ(0, TestTiling(IntSize(1, 1), IntSize(1, 1), false).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(2, 2), IntSize(2, 2), false).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(2, 2), IntSize(2, 2), false).tileYIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), false).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), false).tileYIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), false).tileYIndexFromSrcCoord(2)); + + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 4), false).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 4), false).tileYIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 4), false).tileYIndexFromSrcCoord(2)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(3, 4), false).tileYIndexFromSrcCoord(3)); + + EXPECT_EQ(0, TestTiling(IntSize(1, 1), IntSize(1, 1), true).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(2, 2), IntSize(2, 2), true).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(2, 2), IntSize(2, 2), true).tileYIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), true).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), true).tileYIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), true).tileYIndexFromSrcCoord(2)); + + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 4), true).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 4), true).tileYIndexFromSrcCoord(1)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(3, 4), true).tileYIndexFromSrcCoord(2)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(3, 4), true).tileYIndexFromSrcCoord(3)); } TEST(TilingDataTest, tileSizeX) { - EXPECT_EQ(5, TestTiling(5, 5, 5, false).tileSizeX(0)); - EXPECT_EQ(5, TestTiling(5, 5, 5, true).tileSizeX(0)); - - EXPECT_EQ(5, TestTiling(5, 6, 6, false).tileSizeX(0)); - EXPECT_EQ(1, TestTiling(5, 6, 6, false).tileSizeX(1)); - EXPECT_EQ(4, TestTiling(5, 6, 6, true).tileSizeX(0)); - EXPECT_EQ(2, TestTiling(5, 6, 6, true).tileSizeX(1)); - - EXPECT_EQ(5, TestTiling(5, 8, 8, false).tileSizeX(0)); - EXPECT_EQ(3, TestTiling(5, 8, 8, false).tileSizeX(1)); - EXPECT_EQ(4, TestTiling(5, 8, 8, true).tileSizeX(0)); - EXPECT_EQ(4, TestTiling(5, 8, 8, true).tileSizeX(1)); - - EXPECT_EQ(5, TestTiling(5, 10, 10, false).tileSizeX(0)); - EXPECT_EQ(5, TestTiling(5, 10, 10, false).tileSizeX(1)); - EXPECT_EQ(4, TestTiling(5, 10, 10, true).tileSizeX(0)); - EXPECT_EQ(3, TestTiling(5, 10, 10, true).tileSizeX(1)); - EXPECT_EQ(3, TestTiling(5, 10, 10, true).tileSizeX(2)); - - EXPECT_EQ(4, TestTiling(5, 11, 11, true).tileSizeX(2)); - EXPECT_EQ(3, TestTiling(5, 12, 12, true).tileSizeX(2)); + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(5, 5), false).tileSizeX(0)); + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(5, 5), true).tileSizeX(0)); + + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(6, 6), false).tileSizeX(0)); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(6, 6), false).tileSizeX(1)); + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(6, 6), true).tileSizeX(0)); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(6, 6), true).tileSizeX(1)); + + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(8, 8), false).tileSizeX(0)); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(8, 8), false).tileSizeX(1)); + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(8, 8), true).tileSizeX(0)); + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(8, 8), true).tileSizeX(1)); + + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(10, 10), false).tileSizeX(0)); + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(10, 10), false).tileSizeX(1)); + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(10, 10), true).tileSizeX(0)); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(10, 10), true).tileSizeX(1)); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(10, 10), true).tileSizeX(2)); + + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(11, 11), true).tileSizeX(2)); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(12, 12), true).tileSizeX(2)); + + EXPECT_EQ(3, TestTiling(IntSize(5, 9), IntSize(12, 17), true).tileSizeX(2)); } + TEST(TilingDataTest, tileSizeY) { - EXPECT_EQ(5, TestTiling(5, 5, 5, false).tileSizeY(0)); - EXPECT_EQ(5, TestTiling(5, 5, 5, true).tileSizeY(0)); - - EXPECT_EQ(5, TestTiling(5, 6, 6, false).tileSizeY(0)); - EXPECT_EQ(1, TestTiling(5, 6, 6, false).tileSizeY(1)); - EXPECT_EQ(4, TestTiling(5, 6, 6, true).tileSizeY(0)); - EXPECT_EQ(2, TestTiling(5, 6, 6, true).tileSizeY(1)); - - EXPECT_EQ(5, TestTiling(5, 8, 8, false).tileSizeY(0)); - EXPECT_EQ(3, TestTiling(5, 8, 8, false).tileSizeY(1)); - EXPECT_EQ(4, TestTiling(5, 8, 8, true).tileSizeY(0)); - EXPECT_EQ(4, TestTiling(5, 8, 8, true).tileSizeY(1)); - - EXPECT_EQ(5, TestTiling(5, 10, 10, false).tileSizeY(0)); - EXPECT_EQ(5, TestTiling(5, 10, 10, false).tileSizeY(1)); - EXPECT_EQ(4, TestTiling(5, 10, 10, true).tileSizeY(0)); - EXPECT_EQ(3, TestTiling(5, 10, 10, true).tileSizeY(1)); - EXPECT_EQ(3, TestTiling(5, 10, 10, true).tileSizeY(2)); - - EXPECT_EQ(4, TestTiling(5, 11, 11, true).tileSizeY(2)); - EXPECT_EQ(3, TestTiling(5, 12, 12, true).tileSizeY(2)); + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(5, 5), false).tileSizeY(0)); + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(5, 5), true).tileSizeY(0)); + + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(6, 6), false).tileSizeY(0)); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(6, 6), false).tileSizeY(1)); + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(6, 6), true).tileSizeY(0)); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(6, 6), true).tileSizeY(1)); + + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(8, 8), false).tileSizeY(0)); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(8, 8), false).tileSizeY(1)); + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(8, 8), true).tileSizeY(0)); + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(8, 8), true).tileSizeY(1)); + + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(10, 10), false).tileSizeY(0)); + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(10, 10), false).tileSizeY(1)); + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(10, 10), true).tileSizeY(0)); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(10, 10), true).tileSizeY(1)); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(10, 10), true).tileSizeY(2)); + + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(11, 11), true).tileSizeY(2)); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(12, 12), true).tileSizeY(2)); + + EXPECT_EQ(3, TestTiling(IntSize(9, 5), IntSize(17, 12), true).tileSizeY(2)); } TEST(TilingDataTest, tileSizeX_and_tilePositionX) { // Single tile cases: - EXPECT_EQ(1, TestTiling(3, 1, 1, false).tileSizeX(0)); - EXPECT_EQ(0, TestTiling(3, 1, 1, false).tilePositionX(0)); - EXPECT_EQ(1, TestTiling(3, 1, 100, false).tileSizeX(0)); - EXPECT_EQ(0, TestTiling(3, 1, 100, false).tilePositionX(0)); - EXPECT_EQ(3, TestTiling(3, 3, 1, false).tileSizeX(0)); - EXPECT_EQ(0, TestTiling(3, 3, 1, false).tilePositionX(0)); - EXPECT_EQ(3, TestTiling(3, 3, 100, false).tileSizeX(0)); - EXPECT_EQ(0, TestTiling(3, 3, 100, false).tilePositionX(0)); - EXPECT_EQ(1, TestTiling(3, 1, 1, true).tileSizeX(0)); - EXPECT_EQ(0, TestTiling(3, 1, 1, true).tilePositionX(0)); - EXPECT_EQ(1, TestTiling(3, 1, 100, true).tileSizeX(0)); - EXPECT_EQ(0, TestTiling(3, 1, 100, true).tilePositionX(0)); - EXPECT_EQ(3, TestTiling(3, 3, 1, true).tileSizeX(0)); - EXPECT_EQ(0, TestTiling(3, 3, 1, true).tilePositionX(0)); - EXPECT_EQ(3, TestTiling(3, 3, 100, true).tileSizeX(0)); - EXPECT_EQ(0, TestTiling(3, 3, 100, true).tilePositionX(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(1, 1), false).tileSizeX(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 1), false).tilePositionX(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(1, 100), false).tileSizeX(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 100), false).tilePositionX(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(3, 1), false).tileSizeX(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 1), false).tilePositionX(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(3, 100), false).tileSizeX(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 100), false).tilePositionX(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(1, 1), true).tileSizeX(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 1), true).tilePositionX(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(1, 100), true).tileSizeX(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 100), true).tilePositionX(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(3, 1), true).tileSizeX(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 1), true).tilePositionX(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(3, 100), true).tileSizeX(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 100), true).tilePositionX(0)); // Multiple tiles: // no border // positions 0, 3 - EXPECT_EQ(2, TestTiling(3, 6, 1, false).numTiles()); - EXPECT_EQ(3, TestTiling(3, 6, 1, false).tileSizeX(0)); - EXPECT_EQ(3, TestTiling(3, 6, 1, false).tileSizeX(1)); - EXPECT_EQ(0, TestTiling(3, 6, 1, false).tilePositionX(0)); - EXPECT_EQ(3, TestTiling(3, 6, 1, false).tilePositionX(1)); - EXPECT_EQ(3, TestTiling(3, 6, 100, false).tileSizeX(0)); - EXPECT_EQ(3, TestTiling(3, 6, 100, false).tileSizeX(1)); - EXPECT_EQ(0, TestTiling(3, 6, 100, false).tilePositionX(0)); - EXPECT_EQ(3, TestTiling(3, 6, 100, false).tilePositionX(1)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(6, 1), false).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(6, 1), false).tileSizeX(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(6, 1), false).tileSizeX(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(6, 1), false).tilePositionX(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(6, 1), false).tilePositionX(1)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(6, 100), false).tileSizeX(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(6, 100), false).tileSizeX(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(6, 100), false).tilePositionX(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(6, 100), false).tilePositionX(1)); // Multiple tiles: // with border // positions 0, 2, 3, 4 - EXPECT_EQ(4, TestTiling(3, 6, 1, true).numTiles()); - EXPECT_EQ(2, TestTiling(3, 6, 1, true).tileSizeX(0)); - EXPECT_EQ(1, TestTiling(3, 6, 1, true).tileSizeX(1)); - EXPECT_EQ(1, TestTiling(3, 6, 1, true).tileSizeX(2)); - EXPECT_EQ(2, TestTiling(3, 6, 1, true).tileSizeX(3)); - EXPECT_EQ(0, TestTiling(3, 6, 1, true).tilePositionX(0)); - EXPECT_EQ(2, TestTiling(3, 6, 1, true).tilePositionX(1)); - EXPECT_EQ(3, TestTiling(3, 6, 1, true).tilePositionX(2)); - EXPECT_EQ(4, TestTiling(3, 6, 1, true).tilePositionX(3)); - EXPECT_EQ(2, TestTiling(3, 6, 100, true).tileSizeX(0)); - EXPECT_EQ(1, TestTiling(3, 6, 100, true).tileSizeX(1)); - EXPECT_EQ(1, TestTiling(3, 6, 100, true).tileSizeX(2)); - EXPECT_EQ(2, TestTiling(3, 6, 100, true).tileSizeX(3)); - EXPECT_EQ(0, TestTiling(3, 6, 100, true).tilePositionX(0)); - EXPECT_EQ(2, TestTiling(3, 6, 100, true).tilePositionX(1)); - EXPECT_EQ(3, TestTiling(3, 6, 100, true).tilePositionX(2)); - EXPECT_EQ(4, TestTiling(3, 6, 100, true).tilePositionX(3)); + EXPECT_EQ(4, TestTiling(IntSize(3, 3), IntSize(6, 1), true).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(6, 1), true).tileSizeX(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(6, 1), true).tileSizeX(1)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(6, 1), true).tileSizeX(2)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(6, 1), true).tileSizeX(3)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(6, 1), true).tilePositionX(0)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(6, 1), true).tilePositionX(1)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(6, 1), true).tilePositionX(2)); + EXPECT_EQ(4, TestTiling(IntSize(3, 3), IntSize(6, 1), true).tilePositionX(3)); + EXPECT_EQ(2, TestTiling(IntSize(3, 7), IntSize(6, 100), true).tileSizeX(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 7), IntSize(6, 100), true).tileSizeX(1)); + EXPECT_EQ(1, TestTiling(IntSize(3, 7), IntSize(6, 100), true).tileSizeX(2)); + EXPECT_EQ(2, TestTiling(IntSize(3, 7), IntSize(6, 100), true).tileSizeX(3)); + EXPECT_EQ(0, TestTiling(IntSize(3, 7), IntSize(6, 100), true).tilePositionX(0)); + EXPECT_EQ(2, TestTiling(IntSize(3, 7), IntSize(6, 100), true).tilePositionX(1)); + EXPECT_EQ(3, TestTiling(IntSize(3, 7), IntSize(6, 100), true).tilePositionX(2)); + EXPECT_EQ(4, TestTiling(IntSize(3, 7), IntSize(6, 100), true).tilePositionX(3)); } TEST(TilingDataTest, tileSizeY_and_tilePositionY) { // Single tile cases: - EXPECT_EQ(1, TestTiling(3, 1, 1, false).tileSizeY(0)); - EXPECT_EQ(0, TestTiling(3, 1, 1, false).tilePositionY(0)); - EXPECT_EQ(1, TestTiling(3, 100, 1, false).tileSizeY(0)); - EXPECT_EQ(0, TestTiling(3, 100, 1, false).tilePositionY(0)); - EXPECT_EQ(3, TestTiling(3, 1, 3, false).tileSizeY(0)); - EXPECT_EQ(0, TestTiling(3, 1, 3, false).tilePositionY(0)); - EXPECT_EQ(3, TestTiling(3, 100, 3, false).tileSizeY(0)); - EXPECT_EQ(0, TestTiling(3, 100, 3, false).tilePositionY(0)); - EXPECT_EQ(1, TestTiling(3, 1, 1, true).tileSizeY(0)); - EXPECT_EQ(0, TestTiling(3, 1, 1, true).tilePositionY(0)); - EXPECT_EQ(1, TestTiling(3, 100, 1, true).tileSizeY(0)); - EXPECT_EQ(0, TestTiling(3, 100, 1, true).tilePositionY(0)); - EXPECT_EQ(3, TestTiling(3, 1, 3, true).tileSizeY(0)); - EXPECT_EQ(0, TestTiling(3, 1, 3, true).tilePositionY(0)); - EXPECT_EQ(3, TestTiling(3, 100, 3, true).tileSizeY(0)); - EXPECT_EQ(0, TestTiling(3, 100, 3, true).tilePositionY(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(1, 1), false).tileSizeY(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 1), false).tilePositionY(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(100, 1), false).tileSizeY(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(100, 1), false).tilePositionY(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(1, 3), false).tileSizeY(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 3), false).tilePositionY(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(100, 3), false).tileSizeY(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(100, 3), false).tilePositionY(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(1, 1), true).tileSizeY(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 1), true).tilePositionY(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(100, 1), true).tileSizeY(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(100, 1), true).tilePositionY(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(1, 3), true).tileSizeY(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 3), true).tilePositionY(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(100, 3), true).tileSizeY(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(100, 3), true).tilePositionY(0)); // Multiple tiles: // no border // positions 0, 3 - EXPECT_EQ(2, TestTiling(3, 1, 6, false).numTiles()); - EXPECT_EQ(3, TestTiling(3, 1, 6, false).tileSizeY(0)); - EXPECT_EQ(3, TestTiling(3, 1, 6, false).tileSizeY(1)); - EXPECT_EQ(0, TestTiling(3, 1, 6, false).tilePositionY(0)); - EXPECT_EQ(3, TestTiling(3, 1, 6, false).tilePositionY(1)); - EXPECT_EQ(3, TestTiling(3, 100, 6, false).tileSizeY(0)); - EXPECT_EQ(3, TestTiling(3, 100, 6, false).tileSizeY(1)); - EXPECT_EQ(0, TestTiling(3, 100, 6, false).tilePositionY(0)); - EXPECT_EQ(3, TestTiling(3, 100, 6, false).tilePositionY(1)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(1, 6), false).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(1, 6), false).tileSizeY(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(1, 6), false).tileSizeY(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 6), false).tilePositionY(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(1, 6), false).tilePositionY(1)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(100, 6), false).tileSizeY(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(100, 6), false).tileSizeY(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(100, 6), false).tilePositionY(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(100, 6), false).tilePositionY(1)); // Multiple tiles: // with border // positions 0, 2, 3, 4 - EXPECT_EQ(4, TestTiling(3, 1, 6, true).numTiles()); - EXPECT_EQ(2, TestTiling(3, 1, 6, true).tileSizeY(0)); - EXPECT_EQ(1, TestTiling(3, 1, 6, true).tileSizeY(1)); - EXPECT_EQ(1, TestTiling(3, 1, 6, true).tileSizeY(2)); - EXPECT_EQ(2, TestTiling(3, 1, 6, true).tileSizeY(3)); - EXPECT_EQ(0, TestTiling(3, 1, 6, true).tilePositionY(0)); - EXPECT_EQ(2, TestTiling(3, 1, 6, true).tilePositionY(1)); - EXPECT_EQ(3, TestTiling(3, 1, 6, true).tilePositionY(2)); - EXPECT_EQ(4, TestTiling(3, 1, 6, true).tilePositionY(3)); - EXPECT_EQ(2, TestTiling(3, 100, 6, true).tileSizeY(0)); - EXPECT_EQ(1, TestTiling(3, 100, 6, true).tileSizeY(1)); - EXPECT_EQ(1, TestTiling(3, 100, 6, true).tileSizeY(2)); - EXPECT_EQ(2, TestTiling(3, 100, 6, true).tileSizeY(3)); - EXPECT_EQ(0, TestTiling(3, 100, 6, true).tilePositionY(0)); - EXPECT_EQ(2, TestTiling(3, 100, 6, true).tilePositionY(1)); - EXPECT_EQ(3, TestTiling(3, 100, 6, true).tilePositionY(2)); - EXPECT_EQ(4, TestTiling(3, 100, 6, true).tilePositionY(3)); + EXPECT_EQ(4, TestTiling(IntSize(3, 3), IntSize(1, 6), true).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(1, 6), true).tileSizeY(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(1, 6), true).tileSizeY(1)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(1, 6), true).tileSizeY(2)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(1, 6), true).tileSizeY(3)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 6), true).tilePositionY(0)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(1, 6), true).tilePositionY(1)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(1, 6), true).tilePositionY(2)); + EXPECT_EQ(4, TestTiling(IntSize(3, 3), IntSize(1, 6), true).tilePositionY(3)); + EXPECT_EQ(2, TestTiling(IntSize(7, 3), IntSize(100, 6), true).tileSizeY(0)); + EXPECT_EQ(1, TestTiling(IntSize(7, 3), IntSize(100, 6), true).tileSizeY(1)); + EXPECT_EQ(1, TestTiling(IntSize(7, 3), IntSize(100, 6), true).tileSizeY(2)); + EXPECT_EQ(2, TestTiling(IntSize(7, 3), IntSize(100, 6), true).tileSizeY(3)); + EXPECT_EQ(0, TestTiling(IntSize(7, 3), IntSize(100, 6), true).tilePositionY(0)); + EXPECT_EQ(2, TestTiling(IntSize(7, 3), IntSize(100, 6), true).tilePositionY(1)); + EXPECT_EQ(3, TestTiling(IntSize(7, 3), IntSize(100, 6), true).tilePositionY(2)); + EXPECT_EQ(4, TestTiling(IntSize(7, 3), IntSize(100, 6), true).tilePositionY(3)); } TEST(TilingDataTest, setTotalSize) { - TestTiling data(5, 5, 5, false); - EXPECT_EQ(5, data.totalSizeX()); - EXPECT_EQ(5, data.totalSizeY()); + TestTiling data(IntSize(5, 5), IntSize(5, 5), false); + EXPECT_EQ(5, data.totalSize().width()); + EXPECT_EQ(5, data.totalSize().height()); EXPECT_EQ(1, data.numTilesX()); EXPECT_EQ(5, data.tileSizeX(0)); EXPECT_EQ(1, data.numTilesY()); EXPECT_EQ(5, data.tileSizeY(0)); - data.setTotalSize(6, 5); - EXPECT_EQ(6, data.totalSizeX()); - EXPECT_EQ(5, data.totalSizeY()); + data.setTotalSize(IntSize(6, 5)); + EXPECT_EQ(6, data.totalSize().width()); + EXPECT_EQ(5, data.totalSize().height()); EXPECT_EQ(2, data.numTilesX()); EXPECT_EQ(5, data.tileSizeX(0)); EXPECT_EQ(1, data.tileSizeX(1)); EXPECT_EQ(1, data.numTilesY()); EXPECT_EQ(5, data.tileSizeY(0)); - data.setTotalSize(5, 12); - EXPECT_EQ(5, data.totalSizeX()); - EXPECT_EQ(12, data.totalSizeY()); + data.setTotalSize(IntSize(5, 12)); + EXPECT_EQ(5, data.totalSize().width()); + EXPECT_EQ(12, data.totalSize().height()); EXPECT_EQ(1, data.numTilesX()); EXPECT_EQ(5, data.tileSizeX(0)); EXPECT_EQ(3, data.numTilesY()); @@ -468,75 +480,85 @@ TEST(TilingDataTest, setTotalSize) TEST(TilingDataTest, setMaxTextureSizeNoBorders) { - TestTiling data(8, 16, 32, false); + TestTiling data(IntSize(8, 8), IntSize(16, 32), false); EXPECT_EQ(2, data.numTilesX()); EXPECT_EQ(4, data.numTilesY()); - data.setMaxTextureSize(32); - EXPECT_EQ(32, data.maxTextureSize()); + data.setMaxTextureSize(IntSize(32, 32)); + EXPECT_EQ(IntSize(32, 32), data.maxTextureSize()); EXPECT_EQ(1, data.numTilesX()); EXPECT_EQ(1, data.numTilesY()); - data.setMaxTextureSize(2); - EXPECT_EQ(2, data.maxTextureSize()); + data.setMaxTextureSize(IntSize(2, 2)); + EXPECT_EQ(IntSize(2, 2), data.maxTextureSize()); EXPECT_EQ(8, data.numTilesX()); EXPECT_EQ(16, data.numTilesY()); - data.setMaxTextureSize(5); - EXPECT_EQ(5, data.maxTextureSize()); + data.setMaxTextureSize(IntSize(5, 5)); + EXPECT_EQ(IntSize(5, 5), data.maxTextureSize()); EXPECT_EQ(4, data.numTilesX()); EXPECT_EQ(7, data.numTilesY()); + + data.setMaxTextureSize(IntSize(8, 5)); + EXPECT_EQ(IntSize(8, 5), data.maxTextureSize()); + EXPECT_EQ(2, data.numTilesX()); + EXPECT_EQ(7, data.numTilesY()); } TEST(TilingDataTest, setMaxTextureSizeBorders) { - TestTiling data(8, 16, 32, true); + TestTiling data(IntSize(8, 8), IntSize(16, 32), true); EXPECT_EQ(3, data.numTilesX()); EXPECT_EQ(5, data.numTilesY()); - data.setMaxTextureSize(32); - EXPECT_EQ(32, data.maxTextureSize()); + data.setMaxTextureSize(IntSize(32, 32)); + EXPECT_EQ(IntSize(32, 32), data.maxTextureSize()); EXPECT_EQ(1, data.numTilesX()); EXPECT_EQ(1, data.numTilesY()); - data.setMaxTextureSize(2); - EXPECT_EQ(2, data.maxTextureSize()); + data.setMaxTextureSize(IntSize(2, 2)); + EXPECT_EQ(IntSize(2, 2), data.maxTextureSize()); EXPECT_EQ(0, data.numTilesX()); EXPECT_EQ(0, data.numTilesY()); - data.setMaxTextureSize(5); - EXPECT_EQ(5, data.maxTextureSize()); + data.setMaxTextureSize(IntSize(5, 5)); + EXPECT_EQ(IntSize(5, 5), data.maxTextureSize()); EXPECT_EQ(5, data.numTilesX()); EXPECT_EQ(10, data.numTilesY()); + + data.setMaxTextureSize(IntSize(8, 5)); + EXPECT_EQ(IntSize(8, 5), data.maxTextureSize()); + EXPECT_EQ(3, data.numTilesX()); + EXPECT_EQ(10, data.numTilesY()); } TEST(TilingDataTest, assignment) { { - TestTiling source(8, 16, 32, true); + TestTiling source(IntSize(8, 8), IntSize(16, 32), true); TestTiling dest = source; EXPECT_EQ(source.borderTexels(), dest.borderTexels()); EXPECT_EQ(source.maxTextureSize(), dest.maxTextureSize()); EXPECT_EQ(source.numTilesX(), dest.numTilesX()); EXPECT_EQ(source.numTilesY(), dest.numTilesY()); - EXPECT_EQ(source.totalSizeX(), dest.totalSizeX()); - EXPECT_EQ(source.totalSizeY(), dest.totalSizeY()); + EXPECT_EQ(source.totalSize().width(), dest.totalSize().width()); + EXPECT_EQ(source.totalSize().height(), dest.totalSize().height()); } { - TestTiling source(3, 6, 100, false); + TestTiling source(IntSize(7, 3), IntSize(6, 100), false); TestTiling dest(source); EXPECT_EQ(source.borderTexels(), dest.borderTexels()); EXPECT_EQ(source.maxTextureSize(), dest.maxTextureSize()); EXPECT_EQ(source.numTilesX(), dest.numTilesX()); EXPECT_EQ(source.numTilesY(), dest.numTilesY()); - EXPECT_EQ(source.totalSizeX(), dest.totalSizeX()); - EXPECT_EQ(source.totalSizeY(), dest.totalSizeY()); + EXPECT_EQ(source.totalSize().width(), dest.totalSize().width()); + EXPECT_EQ(source.totalSize().height(), dest.totalSize().height()); } } TEST(TilingDataTest, setBorderTexels) { - TestTiling data(8, 16, 32, false); + TestTiling data(IntSize(8, 8), IntSize(16, 32), false); EXPECT_EQ(2, data.numTilesX()); EXPECT_EQ(4, data.numTilesY()); diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp index b8bc2e3c4..2fe01bf16 100644 --- a/Source/WebKit/chromium/tests/WebFrameTest.cpp +++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp @@ -40,6 +40,7 @@ #include "WebRange.h" #include "WebScriptSource.h" #include "WebSearchableFormData.h" +#include "WebSecurityOrigin.h" #include "WebSecurityPolicy.h" #include "WebSettings.h" #include "WebViewClient.h" @@ -136,22 +137,71 @@ TEST_F(WebFrameTest, FormWithNullFrame) WebSearchableFormData searchableDataForm(forms[0]); } +TEST_F(WebFrameTest, ChromePageJavascript) +{ + registerMockedChromeURLLoad("history.html"); + + // Pass true to enable JavaScript. + WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true); + + // Try to run JS against the chrome-style URL. + FrameTestHelpers::loadFrame(webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))"); + + // Required to see any updates in contentAsText. + webView->layout(); + + // Now retrieve the frame's text and ensure it was modified by running javascript. + std::string content = webView->mainFrame()->contentAsText(1024).utf8(); + EXPECT_NE(std::string::npos, content.find("Clobbered")); +} + TEST_F(WebFrameTest, ChromePageNoJavascript) { registerMockedChromeURLLoad("history.html"); + /// Pass true to enable JavaScript. WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true); - // Try to run JS against the chrome-style URL. + // Try to run JS against the chrome-style URL after prohibiting it. WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs("chrome"); FrameTestHelpers::loadFrame(webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))"); - // Now retrieve the frames text and see if it was clobbered. + // Required to see any updates in contentAsText. + webView->layout(); + + // Now retrieve the frame's text and ensure it wasn't modified by running javascript. std::string content = webView->mainFrame()->contentAsText(1024).utf8(); - EXPECT_NE(std::string::npos, content.find("Simulated Chromium History Page")); EXPECT_EQ(std::string::npos, content.find("Clobbered")); } +TEST_F(WebFrameTest, DispatchMessageEventWithOriginCheck) +{ + registerMockedHttpURLLoad("postmessage_test.html"); + + // Pass true to enable JavaScript. + WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "postmessage_test.html", true); + + // Send a message with the correct origin. + WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(GURL(m_baseURL))); + WebDOMEvent event = webView->mainFrame()->document().createEvent("MessageEvent"); + WebDOMMessageEvent message = event.to<WebDOMMessageEvent>(); + WebSerializedScriptValue data(WebSerializedScriptValue::fromString("foo")); + message.initMessageEvent("message", false, false, data, "http://origin.com", 0, ""); + webView->mainFrame()->dispatchMessageEventWithOriginCheck(correctOrigin, message); + + // Send another message with incorrect origin. + WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(GURL(m_chromeURL))); + webView->mainFrame()->dispatchMessageEventWithOriginCheck(incorrectOrigin, message); + + // Required to see any updates in contentAsText. + webView->layout(); + + // Verify that only the first addition is in the body of the page. + std::string content = webView->mainFrame()->contentAsText(1024).utf8(); + EXPECT_NE(std::string::npos, content.find("Message 1.")); + EXPECT_EQ(std::string::npos, content.find("Message 2.")); +} + #if ENABLE(VIEWPORT) class FixedLayoutTestWebViewClient : public WebViewClient { diff --git a/Source/WebKit/chromium/tests/WebViewTest.cpp b/Source/WebKit/chromium/tests/WebViewTest.cpp index 00d8a832d..460c62bd2 100644 --- a/Source/WebKit/chromium/tests/WebViewTest.cpp +++ b/Source/WebKit/chromium/tests/WebViewTest.cpp @@ -110,6 +110,8 @@ protected: int expectedWidth, int expectedHeight, HorizontalScrollbarState expectedHorizontalState, VerticalScrollbarState expectedVerticalState); + void testTextInputType(WebTextInputType expectedType, const std::string& htmlFile); + std::string m_baseURL; }; @@ -245,4 +247,44 @@ TEST_F(WebViewTest, AutoResizeMaxSize) expectedWidth, expectedHeight, NoHorizontalScrollbar, NoVerticalScrollbar); } +void WebViewTest::testTextInputType(WebTextInputType expectedType, const std::string& htmlFile) +{ + FrameTestHelpers::registerMockedURLLoad(m_baseURL, htmlFile); + WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile); + webView->setInitialFocus(false); + EXPECT_EQ(expectedType, webView->textInputType()); + webView->close(); +} + +// Disabled for https://bugs.webkit.org/show_bug.cgi?id=78746#c29 +TEST_F(WebViewTest, DISABLED_TextInputType) +{ + testTextInputType(WebTextInputTypeText, "input_field_default.html"); + testTextInputType(WebTextInputTypePassword, "input_field_password.html"); + testTextInputType(WebTextInputTypeEmail, "input_field_email.html"); + testTextInputType(WebTextInputTypeSearch, "input_field_search.html"); + testTextInputType(WebTextInputTypeNumber, "input_field_number.html"); + testTextInputType(WebTextInputTypeTelephone, "input_field_tel.html"); + testTextInputType(WebTextInputTypeURL, "input_field_url.html"); +#if ENABLE(INPUT_TYPE_DATE) + testTextInputType(WebTextInputTypeDate, "input_field_date.html"); +#endif +#if ENABLE(INPUT_TYPE_DATETIME) + testTextInputType(WebTextInputTypeDateTime, "input_field_datetime.html"); +#endif +#if ENABLE(INPUT_TYPE_DATETIMELOCAL) + testTextInputType(WebTextInputTypeDateTimeLocal, "input_field_datetimelocal.html"); +#endif +#if ENABLE(INPUT_TYPE_MONTH) + testTextInputType(WebTextInputTypeMonth, "input_field_month.html"); +#endif +#if ENABLE(INPUT_TYPE_TIME) + testTextInputType(WebTextInputTypeTime, "input_field_time.html"); +#endif +#if ENABLE(INPUT_TYPE_WEEK) + testTextInputType(WebTextInputTypeWeek, "input_field_week.html"); +#endif + +} + } diff --git a/Source/WebKit/chromium/tests/data/input_field_date.html b/Source/WebKit/chromium/tests/data/input_field_date.html new file mode 100644 index 000000000..72aba6db6 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_date.html @@ -0,0 +1 @@ +<input type="date" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_datetime.html b/Source/WebKit/chromium/tests/data/input_field_datetime.html new file mode 100644 index 000000000..fa9c5481b --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_datetime.html @@ -0,0 +1 @@ +<input type="datetime" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_datetimelocal.html b/Source/WebKit/chromium/tests/data/input_field_datetimelocal.html new file mode 100644 index 000000000..42f8422bf --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_datetimelocal.html @@ -0,0 +1 @@ +<input type="datetime-local" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_default.html b/Source/WebKit/chromium/tests/data/input_field_default.html new file mode 100644 index 000000000..4cf679efe --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_default.html @@ -0,0 +1 @@ +<input /> diff --git a/Source/WebKit/chromium/tests/data/input_field_email.html b/Source/WebKit/chromium/tests/data/input_field_email.html new file mode 100644 index 000000000..d12a5aab8 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_email.html @@ -0,0 +1 @@ +<input type="email" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_month.html b/Source/WebKit/chromium/tests/data/input_field_month.html new file mode 100644 index 000000000..f787e4f64 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_month.html @@ -0,0 +1 @@ +<input type="month" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_number.html b/Source/WebKit/chromium/tests/data/input_field_number.html new file mode 100644 index 000000000..2cfc5bdfa --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_number.html @@ -0,0 +1 @@ +<input type="number" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_password.html b/Source/WebKit/chromium/tests/data/input_field_password.html new file mode 100644 index 000000000..98ed14c93 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_password.html @@ -0,0 +1 @@ +<input type="password" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_search.html b/Source/WebKit/chromium/tests/data/input_field_search.html new file mode 100644 index 000000000..7f360e6bc --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_search.html @@ -0,0 +1 @@ +<input type="search" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_tel.html b/Source/WebKit/chromium/tests/data/input_field_tel.html new file mode 100644 index 000000000..3dcaae033 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_tel.html @@ -0,0 +1 @@ +<input type="tel" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_time.html b/Source/WebKit/chromium/tests/data/input_field_time.html new file mode 100644 index 000000000..b74734bd4 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_time.html @@ -0,0 +1 @@ +<input type="time" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_url.html b/Source/WebKit/chromium/tests/data/input_field_url.html new file mode 100644 index 000000000..bf2716bc6 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_url.html @@ -0,0 +1 @@ +<input type="url" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_week.html b/Source/WebKit/chromium/tests/data/input_field_week.html new file mode 100644 index 000000000..f4290cdb9 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_week.html @@ -0,0 +1 @@ +<input type="week" /> diff --git a/Source/WebKit/chromium/tests/data/listener/listener_leak1.html b/Source/WebKit/chromium/tests/data/listener/listener_leak1.html new file mode 100644 index 000000000..ef0e0ec6e --- /dev/null +++ b/Source/WebKit/chromium/tests/data/listener/listener_leak1.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html> +<head><title>Event Listener Leak Test 1</title></head> +<body onload="leak()"> +<script> +if (typeof(gc) == "undefined") gc = function() {}; + +function EventListenerLeakTestObject1() {} + +function createListener(node) { + var foo = new EventListenerLeakTestObject1(); + return function(evt) { + // This closure references |node| and an instance of leak object. + node.foo = foo; + }; +} + +function doLeak() { + for (var i = 0; i < 10000; i++) { + var node = document.createElement('span'); + node.onclick = createListener(node); + } +} + +function leak() { + doLeak(); + gc(); + gc(); +} +</script> + +<p>This page leaks memory.</p> + +<!-- Allow leaking manually. --> +<input type="button" value="Leak More" onclick="leak()"> + +</body> +</html> diff --git a/Source/WebKit/chromium/tests/data/listener/listener_leak2.html b/Source/WebKit/chromium/tests/data/listener/listener_leak2.html new file mode 100644 index 000000000..14df25a34 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/listener/listener_leak2.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<html> +<head><title>Event Listener Leak Test 2</title></head> +<body onload="leak()"> +<script> +if (typeof(gc) == "undefined") gc = function() {}; + +var node = null; + +function EventListenerLeakTestObject2() {} + +function createListener(node) { + var foo = new EventListenerLeakTestObject2(); + return function(evt) { + // This closure references |node| and an instance of leak object. + node.foo = foo; + }; +} + +function doLeak() { + if (!node) node = document.createElement('span'); + for (var i = 0; i < 10000; i++) { + node.onclick = createListener(node); + } +} + +function leak() { + doLeak(); + gc(); + gc(); +} +</script> + +<p>This page leaks memory.</p> + +<!-- Allow leaking manually. --> +<input type="button" value="Leak More" onclick="leak()"> + +</body> +</html> diff --git a/Source/WebKit/chromium/tests/data/listener/mutation_event_listener.html b/Source/WebKit/chromium/tests/data/listener/mutation_event_listener.html new file mode 100644 index 000000000..231a4f1e8 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/listener/mutation_event_listener.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html> +<head> +<script> +function removeNode(id) { + var node = document.getElementById(id); + node.parentNode.removeChild(node); + } + +function addElement(id) { + var elem = document.createElement("div"); + elem.setAttribute("id", id); + var text = document.createTextNode("Added node id=" + id); + elem.appendChild(text); + document.getElementById("topDiv").appendChild(elem); + } + +function changeText(id, newText) { + var node = document.getElementById(id); + node.childNodes[0].nodeValue = newText; +} +</script> +</head> + +<body> + +<div id="topDiv"> + <div id="div1">Div #1</div> + <div id="div2">Div #2</div> + <div id="div3">Div #3</div> +</div> + +<button onclick="removeNode('div1')">Remove node</button><br> +<button onclick="addElement('bidule')">Add node</button><br> +<button onclick="changeText('div2', 'Bijour')">Change text</button><br> + +</body> +</html> diff --git a/Source/WebKit/chromium/tests/data/postmessage_test.html b/Source/WebKit/chromium/tests/data/postmessage_test.html new file mode 100644 index 000000000..75cb8efec --- /dev/null +++ b/Source/WebKit/chromium/tests/data/postmessage_test.html @@ -0,0 +1,16 @@ +<html> +<head> +<title>PostMessage Test</title> +<script> +var messagesReceived = 0; +window.addEventListener("message", messageReceived, false); +function messageReceived(event) { + messagesReceived++; + document.body.appendChild(document.createTextNode('Message ' + messagesReceived + '.')); +} +</script> +</head> +<body> +Test page. +</body> +</html> |
