diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-30 11:37:48 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-30 11:38:52 +0200 |
| commit | 89e2486a48b739f8d771d69ede5a6a1b244a10fc (patch) | |
| tree | 503b1a7812cf97d93704c32437eb5f62dc1a1ff9 /Source/WebKit | |
| parent | 625f028249cb37c55bbbd153f3902afd0b0756d9 (diff) | |
| download | qtwebkit-89e2486a48b739f8d771d69ede5a6a1b244a10fc.tar.gz | |
Imported WebKit commit 0282df8ca7c11d8c8a66ea18543695c69f545a27 (http://svn.webkit.org/repository/webkit/trunk@124002)
New snapshot with prospective Mountain Lion build fix
Diffstat (limited to 'Source/WebKit')
131 files changed, 3413 insertions, 1299 deletions
diff --git a/Source/WebKit/CMakeLists.txt b/Source/WebKit/CMakeLists.txt index d25fb8127..03797a374 100644 --- a/Source/WebKit/CMakeLists.txt +++ b/Source/WebKit/CMakeLists.txt @@ -2,6 +2,7 @@ SET(WebKit_INCLUDE_DIRECTORIES "${WEBKIT_DIR}" "${WEBCORE_DIR}" "${WEBCORE_DIR}/Modules/intents" + "${WEBCORE_DIR}/Modules/networkinfo" "${WEBCORE_DIR}/Modules/webdatabase" "${WEBCORE_DIR}/accessibility" "${WEBCORE_DIR}/bindings/generic" @@ -28,6 +29,8 @@ SET(WebKit_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/animation" "${WEBCORE_DIR}/platform/graphics" "${WEBCORE_DIR}/platform/graphics/filters" + "${WEBCORE_DIR}/platform/graphics/harfbuzz" + "${WEBCORE_DIR}/platform/graphics/harfbuzz/ng" "${WEBCORE_DIR}/platform/graphics/transforms" "${WEBCORE_DIR}/platform/network" "${WEBCORE_DIR}/platform/sql" diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index 9a2adea37..19994d1e6 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,3 +1,68 @@ +2012-07-30 Simon Hausmann <simon.hausmann@nokia.com> + + Unreviewed Qt/Mac build fix: Use libWebKitSystemInterfaceMountainLion.a + on Mountain Lion. + + * WebKit1.pri: + +2012-07-27 Thiago Marcos P. Santos <thiago.santos@intel.com> + + [EFL] WebKit API unit tests needs a timeout + https://bugs.webkit.org/show_bug.cgi?id=92496 + + Reviewed by Antonio Gomes. + + Added the same timeout value that we have for WebKit2. + + * PlatformEfl.cmake: + +2012-07-27 Dominik Röttsches <dominik.rottsches@intel.com> + + [Cairo] Add complex font drawing using HarfbuzzNG + https://bugs.webkit.org/show_bug.cgi?id=91864 + + Reviewed by Simon Hausmann and Martin Robinson. + + Adding includes for harfbuzz folders. + + * CMakeLists.txt: + +2012-07-26 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Implement Network Information provider + https://bugs.webkit.org/show_bug.cgi?id=92343 + + Reviewed by Kenneth Rohde Christiansen. + + WebKit EFL not longer needs to link against EEZE + library since the Network Information provider + was moved to WebCore. + + * CMakeLists.txt: + * PlatformEfl.cmake: + +2012-07-26 Zoltan Nyul <zoltan.nyul@intel.com> + + [EFL] EFL port should use XDG paths + https://bugs.webkit.org/show_bug.cgi?id=91719 + + Reviewed by Kenneth Rohde Christiansen. + + Add efreet library to get the xdg paths. + + * PlatformEfl.cmake: + +2012-07-25 Kihong Kwon <kihong.kwon@samsung.com> + + [EFL] Add File Chooser API + https://bugs.webkit.org/show_bug.cgi?id=91957 + + Reviewed by Hajime Morita. + + Add ewk_file_chooser source and header. + + * PlatformEfl.cmake: + 2012-07-22 Kent Tamura <tkent@chromium.org> Rename ENABLE_METER_TAG and ENABLE_PROGRESS_TAG to ENABLE_METER_ELEMENT and ENABLE_PROGRESS_ELEMENT respectively diff --git a/Source/WebKit/PlatformEfl.cmake b/Source/WebKit/PlatformEfl.cmake index 6cdc9b775..a7005228f 100644 --- a/Source/WebKit/PlatformEfl.cmake +++ b/Source/WebKit/PlatformEfl.cmake @@ -2,6 +2,7 @@ LIST(APPEND WebKit_LINK_FLAGS ${ECORE_X_LDFLAGS} ${EDJE_LDFLAGS} ${EFLDEPS_LDFLAGS} + ${EFREET_LDFLAGS} ${EVAS_LDFLAGS} ) @@ -18,6 +19,7 @@ LIST(APPEND WebKit_INCLUDE_DIRECTORIES ${ECORE_X_INCLUDE_DIRS} ${EDJE_INCLUDE_DIRS} ${EFLDEPS_INCLUDE_DIRS} + ${EFREET_INCLUDE_DIRS} ${EVAS_INCLUDE_DIRS} ${EUKIT_INCLUDE_DIRS} ${EDBUS_INCLUDE_DIRS} @@ -68,19 +70,6 @@ IF (WTF_USE_PANGO) ) ENDIF () -IF (ENABLE_NETWORK_INFO) - LIST(APPEND WebKit_LINK_FLAGS - ${EEZE_LDFLAGS} - ) - LIST(APPEND WebKit_INCLUDE_DIRECTORIES - "${WEBCORE_DIR}/Modules/networkinfo" - ${EEZE_INCLUDE_DIRS} - ) - LIST(APPEND WebKit_LIBRARIES - ${EEZE_LIBRARIES} - ) -ENDIF () - IF (ENABLE_NOTIFICATIONS) LIST(APPEND WebKit_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/Modules/notifications" @@ -132,6 +121,7 @@ LIST(APPEND WebKit_SOURCES efl/ewk/ewk_contextmenu.cpp efl/ewk/ewk_cookies.cpp efl/ewk/ewk_custom_handler.cpp + efl/ewk/ewk_file_chooser.cpp efl/ewk/ewk_frame.cpp efl/ewk/ewk_history.cpp efl/ewk/ewk_intent.cpp @@ -158,6 +148,7 @@ LIST(APPEND WebKit_LIBRARIES ${CAIRO_LIBRARIES} ${ECORE_X_LIBRARIES} ${EFLDEPS_LIBRARIES} + ${EFREET_LIBRARIES} ${EUKIT_LIBRARIES} ${EDBUS_LIBRARIES} ${FREETYPE_LIBRARIES} @@ -274,6 +265,7 @@ SET(EWebKit_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_auth.h ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_contextmenu.h ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_cookies.h + ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_file_chooser.h ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_frame.h ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_history.h ${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_intent.h @@ -359,6 +351,7 @@ IF (ENABLE_API_TESTS) FOREACH (testName ${EWKUnitTests_BINARIES}) ADD_EXECUTABLE(${testName} ${WEBKIT_EFL_TEST_DIR}/${testName}.cpp ${WEBKIT_EFL_TEST_DIR}/test_runner.cpp) ADD_TEST(${testName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${testName}) + SET_TESTS_PROPERTIES(${testName} PROPERTIES TIMEOUT 60) TARGET_LINK_LIBRARIES(${testName} ${EWKUnitTests_LIBRARIES} ewkTestUtils) ADD_TARGET_PROPERTIES(${testName} LINK_FLAGS "${EWKUnitTests_LINK_FLAGS}") SET_TARGET_PROPERTIES(${testName} PROPERTIES FOLDER "WebKit") diff --git a/Source/WebKit/WebKit1.pri b/Source/WebKit/WebKit1.pri index cf5b2be88..b16d6f130 100644 --- a/Source/WebKit/WebKit1.pri +++ b/Source/WebKit/WebKit1.pri @@ -18,7 +18,9 @@ contains(DEFINES, ENABLE_VIDEO=1):contains(DEFINES, WTF_USE_QTKIT=1) { # We can know the Mac OS version by using the Darwin major version DARWIN_VERSION = $$split(QMAKE_HOST.version, ".") DARWIN_MAJOR_VERSION = $$first(DARWIN_VERSION) - equals(DARWIN_MAJOR_VERSION, "11") { + equals(DARWIN_MAJOR_VERSION, "12") { + LIBS += $${ROOT_WEBKIT_DIR}/WebKitLibraries/libWebKitSystemInterfaceMountainLion.a + } else:equals(DARWIN_MAJOR_VERSION, "11") { LIBS += $${ROOT_WEBKIT_DIR}/WebKitLibraries/libWebKitSystemInterfaceLion.a } else:equals(DARWIN_MAJOR_VERSION, "10") { LIBS += $${ROOT_WEBKIT_DIR}/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a diff --git a/Source/WebKit/blackberry/Api/BackingStore.cpp b/Source/WebKit/blackberry/Api/BackingStore.cpp index 78102c179..a0fa295e3 100644 --- a/Source/WebKit/blackberry/Api/BackingStore.cpp +++ b/Source/WebKit/blackberry/Api/BackingStore.cpp @@ -228,7 +228,12 @@ BackingStorePrivate::BackingStorePrivate() pthread_mutexattr_destroy(&attr); pthread_mutex_init(&m_blitGenerationLock, 0); - pthread_cond_init(&m_blitGenerationCond, 0); + + pthread_condattr_t condattr; + pthread_condattr_init(&condattr); + pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC); + pthread_cond_init(&m_blitGenerationCond, &condattr); + pthread_condattr_destroy(&condattr); } BackingStorePrivate::~BackingStorePrivate() @@ -399,8 +404,11 @@ void BackingStorePrivate::repaint(const Platform::IntRect& windowRect, #endif if (immediate) { - if (render(rect) && !shouldDirectRenderingToWindow()) - blitVisibleContents(); + if (render(rect)) { + if (!shouldDirectRenderingToWindow()) + blitVisibleContents(); + m_webPage->d->m_client->notifyContentRendered(rect); + } } else m_renderQueue->addToQueue(RenderQueue::RegularRender, rect); } @@ -921,6 +929,9 @@ void BackingStorePrivate::clearAndUpdateTileOfNotRenderedRegion(const TileIndex& const Platform::IntRect& backingStoreRect, bool update) { + if (tileNotRenderedRegion.isEmpty()) + return; + // Intersect the tile with the not rendered region to get the areas // of the tile that we need to clear. IntRectList tileNotRenderedRegionRects = tileNotRenderedRegion.rects(); @@ -933,17 +944,43 @@ void BackingStorePrivate::clearAndUpdateTileOfNotRenderedRegion(const TileIndex& // Add it again as a regular render job. m_renderQueue->addToQueue(RenderQueue::RegularRender, tileNotRenderedRegionRect); } + } - // Find the origin of this tile. - Platform::IntPoint origin = originOfTile(index, backingStoreRect); + // Find the origin of this tile. + Platform::IntPoint origin = originOfTile(index, backingStoreRect); - // Map to tile coordinates. - tileNotRenderedRegionRect.move(-origin.x(), -origin.y()); + // Map to tile coordinates. + Platform::IntRectRegion translatedRegion(tileNotRenderedRegion); + translatedRegion.move(-origin.x(), -origin.y()); - // Clear the tile of this region. - tile->frontBuffer()->clearRenderedRegion(tileNotRenderedRegionRect); - tile->backBuffer()->clearRenderedRegion(tileNotRenderedRegionRect); - } + // If the region in question is already marked as not rendered, return early + if (Platform::IntRectRegion::intersectRegions(tile->frontBuffer()->renderedRegion(), translatedRegion).isEmpty()) + return; + + // Clear the tile of this region. The back buffer region is invalid anyway, but the front + // buffer must not be manipulated without synchronization with the compositing thread, or + // we have a race. + // Instead of using the customary sequence of copy-back, modify and swap, we send a synchronous + // message to the compositing thread to avoid the copy-back step and save memory bandwidth. + // The trade-off is that the WebKit thread might wait a little longer for the compositing thread + // than it would from a waitForCurrentMessage() call. + + ASSERT(Platform::webKitThreadMessageClient()->isCurrentThread()); + if (!Platform::webKitThreadMessageClient()->isCurrentThread()) + return; + + Platform::userInterfaceThreadMessageClient()->dispatchSyncMessage( + Platform::createMethodCallMessage(&BackingStorePrivate::clearRenderedRegion, + this, tile, translatedRegion)); +} + +void BackingStorePrivate::clearRenderedRegion(BackingStoreTile* tile, const Platform::IntRectRegion& region) +{ + ASSERT(Platform::userInterfaceThreadMessageClient()->isCurrentThread()); + if (!Platform::userInterfaceThreadMessageClient()->isCurrentThread()) + return; + + tile->frontBuffer()->clearRenderedRegion(region); } bool BackingStorePrivate::isCurrentVisibleJob(const TileIndex& index, BackingStoreTile* tile, const Platform::IntRect& backingStoreRect) const @@ -1072,8 +1109,6 @@ bool BackingStorePrivate::render(const Platform::IntRect& rect) BackingStoreGeometry* currentState = frontState(); TileMap currentMap = currentState->tileMap(); - Platform::IntRect dirtyContentsRect; - for (size_t i = 0; i < tileRectList.size(); ++i) { TileRect tileRect = tileRectList[i]; TileIndex index = tileRect.first; @@ -1084,15 +1119,6 @@ bool BackingStorePrivate::render(const Platform::IntRect& rect) // transformed contents coordinates. Platform::IntRect dirtyRect = mapFromTilesToTransformedContents(tileRect); - // If we're not yet committed, then commit now by clearing the rendered region - // and setting the committed flag as well as clearing the shift. - if (!tile->isCommitted()) { - tile->setCommitted(true); - tile->frontBuffer()->clearRenderedRegion(); - tile->backBuffer()->clearRenderedRegion(); - tile->clearShift(); - } - // If the tile has been created, but this is the first time we are painting on it // then it hasn't been given a default background yet so that we can save time during // startup. That's why we are doing it here instead... @@ -1112,8 +1138,6 @@ bool BackingStorePrivate::render(const Platform::IntRect& rect) continue; } - copyPreviousContentsToBackSurfaceOfTile(dirtyTileRect, tile); - BlackBerry::Platform::Graphics::Buffer* nativeBuffer = tile->backBuffer()->nativeBuffer(); @@ -1138,6 +1162,17 @@ bool BackingStorePrivate::render(const Platform::IntRect& rect) pthread_mutex_unlock(&m_blitGenerationLock); } + // Modify the buffer only after we've waited for the buffer to become available above. + + // If we're not yet committed, then commit only after the tile has back buffer has been + // swapped in so it has some valid content. + // Otherwise the compositing thread could pick up the tile while its front buffer is still invalid. + bool wasCommitted = tile->isCommitted(); + if (wasCommitted) + copyPreviousContentsToBackSurfaceOfTile(dirtyTileRect, tile); + else + tile->backBuffer()->clearRenderedRegion(); + // FIXME: modify render to take a Vector<IntRect> parameter so we're not recreating // GraphicsContext on the stack each time. renderContents(nativeBuffer, originOfTile(index), dirtyRect); @@ -1145,23 +1180,26 @@ bool BackingStorePrivate::render(const Platform::IntRect& rect) // Add the newly rendered region to the tile so it can keep track for blits. tile->backBuffer()->addRenderedRegion(dirtyTileRect); - // Check if the contents for this tile's backbuffer are valid when - // compared to the front buffer. - bool backBufferIsValid = tile->backBuffer()->isRendered(tile->frontBuffer()->renderedRegion()); - - // Our current design demands that the backbuffer is valid after any - // rendering operation so assert that here. If we hit this assert we - // know that we're doing something bad that will result in artifacts. - ASSERT(backBufferIsValid); + // Thanks to the copyPreviousContentsToBackSurfaceOfTile() call above, we know that + // the rendered region of the back buffer contains the rendered region of the front buffer. + // Assert this just to make sure. + // For previously uncommitted tiles, the front buffer's rendered region is not relevant. + ASSERT(!wasCommitted || tile->backBuffer()->isRendered(tile->frontBuffer()->renderedRegion())); // We will need a swap here because of the shared back buffer. - if (backBufferIsValid) { - tile->swapBuffers(); - BlackBerry::Platform::userInterfaceThreadMessageClient()->syncToCurrentMessage(); - tile->backBuffer()->clearRenderedRegion(); + tile->swapBuffers(); + + if (!wasCommitted) { + // Commit the tile only after it has valid front buffer contents. Now, the compositing thread + // can finally start blitting this tile. + tile->clearShift(); + tile->setCommitted(true); } - dirtyContentsRect = Platform::unionOfRects(dirtyContentsRect, dirtyRect); + // Before clearing the render region, wait for the compositing thread to stop using the + // buffer, in order to avoid a race on its rendered region. + BlackBerry::Platform::userInterfaceThreadMessageClient()->syncToCurrentMessage(); + tile->backBuffer()->clearRenderedRegion(); } return true; @@ -2871,7 +2909,7 @@ Platform::Graphics::Buffer* BackingStorePrivate::buffer() const #if USE(ACCELERATED_COMPOSITING) if (WebPageCompositorPrivate* compositor = m_webPage->d->compositor()) - return compositor->context()->buffer(); + return compositor->context() ? compositor->context()->buffer() : 0; #endif return 0; diff --git a/Source/WebKit/blackberry/Api/BackingStore_p.h b/Source/WebKit/blackberry/Api/BackingStore_p.h index 50feb041c..67913b986 100644 --- a/Source/WebKit/blackberry/Api/BackingStore_p.h +++ b/Source/WebKit/blackberry/Api/BackingStore_p.h @@ -166,6 +166,9 @@ public: void clearAndUpdateTileOfNotRenderedRegion(const TileIndex&, BackingStoreTile*, const Platform::IntRectRegion&, const Platform::IntRect& backingStoreRect, bool update = true); bool isCurrentVisibleJob(const TileIndex&, BackingStoreTile*, const Platform::IntRect& backingStoreRect) const; + // Not thread safe. Call only when threads are in sync. + void clearRenderedRegion(BackingStoreTile*, const Platform::IntRectRegion&); + // Responsible for scrolling the backing store and updating the // tile matrix geometry. void scrollBackingStore(int deltaX, int deltaY); diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index 487a17d72..a8d44aff1 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -547,8 +547,9 @@ void WebPagePrivate::init(const WebString& pageGroupName) // so that we only get one didChangeSettings() callback when we set the page group name. This causes us // to make a copy of the WebSettings since some WebSettings method make use of the page group name. // Instead, we shouldn't be storing the page group name in WebSettings. - m_webSettings->setDelegate(this); m_webSettings->setPageGroupName(pageGroupName); + m_webSettings->setDelegate(this); + didChangeSettings(m_webSettings); RefPtr<Frame> newFrame = Frame::create(m_page, /* HTMLFrameOwnerElement* */ 0, frameLoaderClient); @@ -564,22 +565,16 @@ void WebPagePrivate::init(const WebString& pageGroupName) m_page->settings()->setCanvasUsesAcceleratedDrawing(true); m_page->settings()->setAccelerated2dCanvasEnabled(true); #endif -#if ENABLE(VIEWPORT_REFLOW) - m_page->settings()->setTextReflowEnabled(m_webSettings->textReflowMode() == WebSettings::TextReflowEnabled); -#endif m_page->settings()->setInteractiveFormValidationEnabled(true); m_page->settings()->setAllowUniversalAccessFromFileURLs(false); m_page->settings()->setAllowFileAccessFromFileURLs(false); - m_page->settings()->setShouldUseCrossOriginProtocolCheck(!m_webSettings->allowCrossSiteRequests()); - m_page->settings()->setWebSecurityEnabled(!m_webSettings->allowCrossSiteRequests()); m_backingStoreClient = BackingStoreClient::create(m_mainFrame, /* parent frame */ 0, m_webPage); // The direct access to BackingStore is left here for convenience since it // is owned by BackingStoreClient and then deleted by its destructor. m_backingStore = m_backingStoreClient->backingStore(); - m_page->settings()->setSpatialNavigationEnabled(m_webSettings->isSpatialNavigationEnabled()); blockClickRadius = int(roundf(0.35 * Platform::Graphics::Screen::primaryScreen()->pixelsPerInch(0).width())); // The clicked rectangle area should be a fixed unit of measurement. m_page->settings()->setDelegateSelectionPaint(true); @@ -979,6 +974,11 @@ void WebPage::prepareToDestroy() d->prepareToDestroy(); } +bool WebPage::dispatchBeforeUnloadEvent() +{ + return d->m_page->mainFrame()->loader()->shouldClose(); +} + static void enableCrossSiteXHRRecursively(Frame* frame) { frame->document()->securityOrigin()->grantUniversalAccess(); @@ -3653,12 +3653,14 @@ void WebPagePrivate::resumeBackingStore() m_backingStore->d->orientationChanged(); // Updates tile geometry and creates visible tile buffer. m_backingStore->d->resetTiles(true /* resetBackground */); m_backingStore->d->updateTiles(false /* updateVisible */, false /* immediate */); + // This value may have changed, so we need to update it. directRendering = m_backingStore->d->shouldDirectRenderingToWindow(); - if (m_backingStore->d->renderVisibleContents() && !m_backingStore->d->isSuspended() && !directRendering) - m_backingStore->d->blitVisibleContents(); - - m_client->notifyContentRendered(m_backingStore->d->visibleContentsRect()); + if (m_backingStore->d->renderVisibleContents()) { + if (!m_backingStore->d->isSuspended() && !directRendering) + m_backingStore->d->blitVisibleContents(); + m_client->notifyContentRendered(m_backingStore->d->visibleContentsRect()); + } } else { if (m_backingStore->d->isOpenGLCompositing()) setCompositorDrawsRootLayer(false); @@ -4596,9 +4598,14 @@ void WebPage::setSpellCheckingEnabled(bool enabled) static_cast<EditorClientBlackBerry*>(d->m_page->editorClient())->enableSpellChecking(enabled); } -void WebPage::spellCheckingRequestProcessed(int32_t id, spannable_string_t* spannableString) +void WebPage::spellCheckingRequestCancelled(int32_t transactionId) +{ + d->m_inputHandler->spellCheckingRequestCancelled(transactionId); +} + +void WebPage::spellCheckingRequestProcessed(int32_t transactionId, spannable_string_t* spannableString) { - d->m_inputHandler->spellCheckingRequestProcessed(id, spannableString); + d->m_inputHandler->spellCheckingRequestProcessed(transactionId, spannableString); } class DeferredTaskSelectionCancelled: public DeferredTask<&WebPagePrivate::m_wouldCancelSelection> { @@ -4682,6 +4689,13 @@ void WebPage::paste() d->m_inputHandler->paste(); } +void WebPage::selectAll() +{ + if (d->m_page->defersLoading()) + return; + d->m_inputHandler->selectAll(); +} + void WebPage::setSelection(const Platform::IntPoint& startPoint, const Platform::IntPoint& endPoint) { if (d->m_page->defersLoading()) @@ -5873,7 +5887,7 @@ void WebPagePrivate::setCompositor(PassRefPtr<WebPageCompositorPrivate> composit // That seems extremely likely to be the case, but let's assert just to make sure. ASSERT(webKitThreadMessageClient()->isCurrentThread()); - if (m_backingStore->d->buffer()) + if (m_compositor || m_client->window()) m_backingStore->d->suspendScreenAndBackingStoreUpdates(); // This method call always round-trips on the WebKit thread (see WebPageCompositor::WebPageCompositor() and ~WebPageCompositor()), @@ -5885,7 +5899,7 @@ void WebPagePrivate::setCompositor(PassRefPtr<WebPageCompositorPrivate> composit // safe access to m_compositor and its refcount. userInterfaceThreadMessageClient()->dispatchSyncMessage(createMethodCallMessage(&WebPagePrivate::setCompositorHelper, this, compositor, compositingContext)); - if (m_backingStore->d->buffer()) // the new compositor, if one was set + if (m_compositor || m_client->window()) // the new compositor, if one was set m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::RenderAndBlit); } @@ -6400,6 +6414,7 @@ void WebPagePrivate::didChangeSettings(WebSettings* webSettings) coreSettings->setDefaultTextEncodingName(webSettings->defaultTextEncodingName().impl()); coreSettings->setDownloadableBinaryFontsEnabled(webSettings->downloadableBinaryFontsEnabled()); coreSettings->setSpatialNavigationEnabled(m_webSettings->isSpatialNavigationEnabled()); + coreSettings->setAsynchronousSpellCheckingEnabled(m_webSettings->isAsynchronousSpellCheckingEnabled()); WebString stylesheetURL = webSettings->userStyleSheetString(); if (stylesheetURL.isEmpty()) diff --git a/Source/WebKit/blackberry/Api/WebPage.h b/Source/WebKit/blackberry/Api/WebPage.h index 026349317..c7227fe8d 100644 --- a/Source/WebKit/blackberry/Api/WebPage.h +++ b/Source/WebKit/blackberry/Api/WebPage.h @@ -111,6 +111,8 @@ public: void stopLoading(); + bool dispatchBeforeUnloadEvent(); + // This will force any unload handlers to run. void prepareToDestroy(); @@ -158,6 +160,7 @@ public: void cut(); void copy(); void paste(); + void selectAll(); // Text encoding. WebString textEncoding(); @@ -255,7 +258,8 @@ public: int32_t commitText(spannable_string_t*, int32_t relativeCursorPosition); void setSpellCheckingEnabled(bool); - void spellCheckingRequestProcessed(int32_t id, spannable_string_t*); + void spellCheckingRequestProcessed(int32_t transactionId, spannable_string_t*); + void spellCheckingRequestCancelled(int32_t transactionId); void setSelection(const Platform::IntPoint& startPoint, const Platform::IntPoint& endPoint); void setCaretPosition(const Platform::IntPoint&); diff --git a/Source/WebKit/blackberry/Api/WebPageClient.h b/Source/WebKit/blackberry/Api/WebPageClient.h index e931d6050..96fba7a52 100644 --- a/Source/WebKit/blackberry/Api/WebPageClient.h +++ b/Source/WebKit/blackberry/Api/WebPageClient.h @@ -113,6 +113,7 @@ public: virtual void runJavaScriptAlert(const unsigned short* message, unsigned messageLength, const char* origin, unsigned originLength) = 0; virtual bool runJavaScriptConfirm(const unsigned short* message, unsigned messageLength, const char* origin, unsigned originLength) = 0; virtual bool runJavaScriptPrompt(const unsigned short* message, unsigned messageLength, const unsigned short* defaultValue, unsigned defaultValueLength, const char* origin, unsigned originLength, WebString& result) = 0; + virtual bool runBeforeUnloadConfirmPanel(const unsigned short* message, unsigned messageLength, const char* origin, unsigned originLength) = 0; virtual bool shouldInterruptJavaScript() = 0; @@ -143,9 +144,7 @@ public: virtual void showVirtualKeyboard(bool) = 0; - virtual void checkSpellingOfString(const unsigned short* text, int length, int& misspellingLocation, int& misspellingLength) = 0; virtual void requestSpellingSuggestionsForString(unsigned start, unsigned end) = 0; - virtual int32_t checkSpellingOfStringAsync(wchar_t* text, int length) = 0; virtual void notifySelectionDetailsChanged(const Platform::IntRect& start, const Platform::IntRect& end, const Platform::IntRectRegion&, bool overrideTouchHandling = false) = 0; diff --git a/Source/WebKit/blackberry/Api/WebSettings.cpp b/Source/WebKit/blackberry/Api/WebSettings.cpp index 1156d741a..dd3a9c49a 100644 --- a/Source/WebKit/blackberry/Api/WebSettings.cpp +++ b/Source/WebKit/blackberry/Api/WebSettings.cpp @@ -38,6 +38,7 @@ namespace BlackBerry { namespace WebKit { DEFINE_STATIC_LOCAL(String, BlackBerryAllowCrossSiteRequests, ("BlackBerryAllowCrossSiteRequests")); +DEFINE_STATIC_LOCAL(String, BlackBerryAsynchronousSpellChecking, ("BlackBerryAsynchronousSpellChecking")); DEFINE_STATIC_LOCAL(String, BlackBerryBackgroundColor, ("BlackBerryBackgroundColor")); DEFINE_STATIC_LOCAL(String, BlackBerryCookiesEnabled, ("BlackBerryCookiesEnabled")); DEFINE_STATIC_LOCAL(String, BlackBerryDirectRenderingToWindowEnabled, ("BlackBerryDirectRenderingToWindowEnabled")); @@ -177,6 +178,7 @@ WebSettings* WebSettings::standardSettings() settings->m_private->setBoolean(BlackBerryFullScreenVideoCapable, false); settings->m_private->setBoolean(BlackBerryCredentialAutofillEnabled, false); settings->m_private->setBoolean(BlackBerryFormAutofillEnabled, false); + settings->m_private->setBoolean(BlackBerryAsynchronousSpellChecking, true); if (BlackBerry::Platform::DeviceInfo::instance()->isMobile()) { WebCore::FloatSize currentPPI = Platform::Graphics::Screen::primaryScreen()->pixelsPerInch(-1); @@ -198,10 +200,10 @@ WebSettings* WebSettings::standardSettings() settings->m_private->setInteger(WebKitMinimumFontSize, 8); settings->m_private->setBoolean(WebKitWebSocketsEnabled, true); - settings->m_private->setString(WebKitFixedFontFamily, BlackBerry::Platform::fontFamily("-webkit-monospace", "").c_str()); - settings->m_private->setString(WebKitSansSeriffFontFamily, BlackBerry::Platform::fontFamily("-webkit-sans-serif", "").c_str()); - settings->m_private->setString(WebKitSeriffFontFamily, BlackBerry::Platform::fontFamily("-webkit-serif", "").c_str()); - settings->m_private->setString(WebKitStandardFontFamily, BlackBerry::Platform::fontFamily("-webkit-standard", "").c_str()); + settings->m_private->setString(WebKitFixedFontFamily, BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-monospace", "").c_str()); + settings->m_private->setString(WebKitSansSeriffFontFamily, BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-sans-serif", "").c_str()); + settings->m_private->setString(WebKitSeriffFontFamily, BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-serif", "").c_str()); + settings->m_private->setString(WebKitStandardFontFamily, BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-standard", "").c_str()); return settings; } @@ -807,6 +809,16 @@ void WebSettings::setSpatialNavigationEnabled(bool enable) m_private->setBoolean(SpatialNavigationEnabled, enable); } +bool WebSettings::isAsynchronousSpellCheckingEnabled() const +{ + return m_private->getBoolean(BlackBerryAsynchronousSpellChecking); +} + +void WebSettings::setAsynchronousSpellCheckingEnabled(bool enable) const +{ + return m_private->setBoolean(BlackBerryAsynchronousSpellChecking, enable); +} + bool WebSettings::fullScreenVideoCapable() const { return m_private->getBoolean(BlackBerryFullScreenVideoCapable); diff --git a/Source/WebKit/blackberry/Api/WebSettings.h b/Source/WebKit/blackberry/Api/WebSettings.h index 39f7c209b..b60cb6dcf 100644 --- a/Source/WebKit/blackberry/Api/WebSettings.h +++ b/Source/WebKit/blackberry/Api/WebSettings.h @@ -228,6 +228,9 @@ public: bool isSpatialNavigationEnabled() const; void setSpatialNavigationEnabled(bool); + bool isAsynchronousSpellCheckingEnabled() const; + void setAsynchronousSpellCheckingEnabled(bool) const; + bool fullScreenVideoCapable() const; void setFullScreenVideoCapable(bool); diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index c3ec07f2f..ffaee6de6 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,446 @@ +2012-07-27 Eli Fidler <efidler@rim.com> + + [BlackBerry] Adapt to change in the FontInfo platform API. + https://bugs.webkit.org/show_bug.cgi?id=92547 + + Reviewed by Yong Li + + RIM PR 161263 + + * Api/WebSettings.cpp: + (BlackBerry::WebKit::WebSettings::standardSettings): + +2012-07-27 Yong Li <yoli@rim.com> + + [BlackBerry] Should support onbeforeunload event and show confirmation dialog + https://bugs.webkit.org/show_bug.cgi?id=92510 + + Reviewed by Antonio Gomes. + + RIM PR# 155878. + 1. Export dispatchBeforeUnloadEvent() so client can call it before going to close the page. + 2. Forward runBeforeUnloadConfirmPanel() call to client so it can show a dialog. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::dispatchBeforeUnloadEvent): + (WebKit): + * Api/WebPage.h: + * Api/WebPageClient.h: + * WebCoreSupport/ChromeClientBlackBerry.cpp: + (WebCore::ChromeClientBlackBerry::canRunBeforeUnloadConfirmPanel): + (WebCore::ChromeClientBlackBerry::runBeforeUnloadConfirmPanel): + +2012-07-27 Mike Fenton <mifenton@rim.com> + + [BlackBerry] Switch InputHandler malloc use to fastMalloc for cases that should never fail + https://bugs.webkit.org/show_bug.cgi?id=92508 + + Reviewed by Yong Li. + + Replace common uses of malloc with fastMalloc rather + than trying to recover gracefully. If we are truly + out of memory, crash before corruption occurs. + + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::InputHandler::spannableTextInRange): + (BlackBerry::WebKit::InputHandler::extractedTextRequest): + +2012-07-26 Nima Ghanavatian <nghanavatian@rim.com> + + [BlackBerry] Remove synchronous spellchecking code + https://bugs.webkit.org/show_bug.cgi?id=92415 + + Removing synchronous spellchecking code path. + + Reviewed by Rob Buis. + + Internally reviewed by Mike Fenton. + + * Api/WebPageClient.h: + * WebCoreSupport/EditorClientBlackBerry.cpp: + (WebCore::EditorClientBlackBerry::checkSpellingOfString): + +2012-07-26 Nima Ghanavatian <nghanavatian@rim.com> + + [BlackBerry] Support async spellcheck for the blackberry port + https://bugs.webkit.org/show_bug.cgi?id=92160 + + PR124517 + Implementing support for async spellcheck. + + Reviewed by Rob Buis. + + Internally reviewed by Mike Fenton. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::spellCheckingRequestCancelled): + (WebKit): + (BlackBerry::WebKit::WebPage::spellCheckingRequestProcessed): + (BlackBerry::WebKit::WebPagePrivate::didChangeSettings): + * Api/WebPage.h: + * Api/WebSettings.cpp: + (WebKit): + (BlackBerry::WebKit::WebSettings::standardSettings): + (BlackBerry::WebKit::WebSettings::isAsynchronousSpellCheckingEnabled): + (BlackBerry::WebKit::WebSettings::setAsynchronousSpellCheckingEnabled): + * Api/WebSettings.h: + * WebCoreSupport/EditorClientBlackBerry.cpp: + (WebCore): + (WebCore::EditorClientBlackBerry::requestCheckingOfString): + (WebCore::EditorClientBlackBerry::checkTextOfParagraph): + * WebCoreSupport/EditorClientBlackBerry.h: + (EditorClientBlackBerry): + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::InputHandler::requestCheckingOfString): + (BlackBerry::WebKit::InputHandler::convertTransactionIdToSequenceId): + (WebKit): + (BlackBerry::WebKit::InputHandler::spellCheckingRequestProcessed): + (BlackBerry::WebKit::InputHandler::spellCheckingRequestCancelled): + (BlackBerry::WebKit::InputHandler::getSpellChecker): + * WebKitSupport/InputHandler.h: + (WebCore): + (InputHandler): + +2012-07-26 Mike Fenton <mifenton@rim.com> + + [BlackBerry] Improve the logs in Selection Handler. + https://bugs.webkit.org/show_bug.cgi?id=92405 + + Reviewed by Rob Buis. + + Clean up selection logging, fix priority and style + of helper function. + + Reviewed Internally by Nima Ghanavatian. + + * WebKitSupport/SelectionHandler.cpp: + (BlackBerry::WebKit::SelectionHandler::cancelSelection): + (BlackBerry::WebKit::SelectionHandler::shouldUpdateSelectionOrCaretForPoint): + (BlackBerry::WebKit::SelectionHandler::setCaretPosition): + (BlackBerry::WebKit::SelectionHandler::updateOrHandleInputSelection): + (BlackBerry::WebKit::SelectionHandler::setSelection): + (BlackBerry::WebKit::SelectionHandler::selectObject): + (BlackBerry::WebKit::SelectionHandler::selectionPositionChanged): + (BlackBerry::WebKit::SelectionHandler::caretPositionChanged): + +2012-07-26 Mike Fenton <mifenton@rim.com> + + [BlackBerry] Add timing logs to SelectionHandler. + https://bugs.webkit.org/show_bug.cgi?id=92404 + + Reviewed by Rob Buis. + + Add selection timing logs. + + Reviewed Internally by Nima Ghanavatian. + + * WebKitSupport/SelectionHandler.cpp: + (BlackBerry::WebKit::SelectionHandler::setSelection): + (BlackBerry::WebKit::SelectionHandler::selectionPositionChanged): + * WebKitSupport/SelectionHandler.h: + (SelectionHandler): + +2012-07-26 Mike Fenton <mifenton@rim.com> + + [BlackBerry] InputHandler failure logs should be logAlways and critical. + https://bugs.webkit.org/show_bug.cgi?id=92403 + + Reviewed by Rob Buis. + + Update Log level for failures and fix mask in log. + + Reviewed Internally by Nima Ghanavatian. + + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::convertStringToWchar): + (BlackBerry::WebKit::convertStringToWcharVector): + (BlackBerry::WebKit::convertSpannableStringToString): + (BlackBerry::WebKit::InputHandler::spannableTextInRange): + (BlackBerry::WebKit::InputHandler::setTextAttributes): + +2012-07-26 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Refactor BackingStorePrivate::BackingStorePrivate::clearAndUpdateTileOfNotRenderedRegion() to avoid touching tile frontbuffer + https://bugs.webkit.org/show_bug.cgi?id=92095 + + Reviewed by George Staikos. + + PR: 141439 + Specifically, we want to avoid changing the rendered region of the + front buffer without proper synchronization. + + The method is trying to force checkerboard to appear on screen because + an area was invalidated but the render job was dropped, so the tile + contents are now invalid. + + Unfortunately it did this in a way which is not thread safe. Fixed by + making it thread safe, in a way that minimizes memory bandwidth usage. + + Instead of using the customary sequence of copy-back, modify and swap, + we send a synchronous message to the compositing thread to avoid the + copy-back step and save memory bandwidth. The trade-off is that the + WebKit thread might wait a little longer for the compositing thread + than it would from a waitForCurrentMessage() call. + + The way we synchronize this is rather expensive for the WebKit thread, + and this method is called rather carelessly, so add various early + returns to avoid doing it redundantly. + + Internally reviewed by Jakob Petsovits and Adam Treat. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::indexOfTile): + (BlackBerry::WebKit::BackingStorePrivate::clearAndUpdateTileOfNotRenderedRegion): + * Api/BackingStore_p.h: + (BackingStorePrivate): + +2012-07-26 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Refactor BackingStorePrivate::render() to avoid touching tile frontbuffer + https://bugs.webkit.org/show_bug.cgi?id=91989 + + Reviewed by George Staikos. + + PR: 141439 + Specifically, we want to avoid changing the rendered region of the + front buffer. The code only touched the front buffer rendered region + if the tile was not committed. + + Instead of immediately marking the tile as committed, and clearing the + front buffer's rendered region to make it appear as checkerboard, we + leave the front buffer alone and only mark the tile as committed once + the front buffer has valid content. Un-committed tiles will also be + rendered as checkerboard, so leaving it uncommitted is equivalent to + clearing the front buffer rendered region here. + + In addition to the main change, some related changes follow naturally. + + The copyPreviousContentsToBackSurfaceOfTile() call only makes sense if + the tile is committed, and the front buffer has valid content. + Otherwise, clearing the back buffer is equivalent. The code has been + updated to this effect. + + Since copyPreviousContentsToBackSurfaceOfTile() always sets the + rendered region to the union of the front and back buffer regions, + there is no point in the "backBufferIsValid" check. It has been turned + into an ASSERT instead, just to make sure. + + Internally reviewed by Jakob Petsovits. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::render): + +2012-07-25 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] Support RTSP in browser + https://bugs.webkit.org/show_bug.cgi?id=92233 + + Reviewed by Rob Buis. + + Handle URL scheme "rtsp://" before creating the DocumentLoader + and send the request to webkit. As we don't have any application + which can deal with rtsp invocation for now, we need to create + a media document to wrap the rtsp url within a video tag which + makes it load as a normal video clip. + + RIM PR: 169669 + Internally reviewed by Charles Wei <charles.wei@torchmobile.com.cn>. + + * WebCoreSupport/FrameLoaderClientBlackBerry.cpp: + (WebCore::FrameLoaderClientBlackBerry::createDocumentLoader): + +2012-07-25 Jakob Petsovits <jpetsovits@rim.com> + + [BlackBerry] Rephrase suspend/resume condition to guard against crashes + https://bugs.webkit.org/show_bug.cgi?id=92300 + PR 182125 + + Reviewed by George Staikos. + + When the compositor is removed from a WebPage, it might + already have unset its context, and issuing a call to + BackingStore::buffer() would therefore cause a crash. + Just guarding buffer() from this crash isn't fully + correct, because then we wouldn't suspend rendering + for a compositor that had been previously enabled. + + Instead, change the condition to suspend/resume in + WebPagePrivate::setCompositor() to focus on the + object that delivers us the buffer. If we can't + listen to the context or buffer being set, better + just take the compositor object itself to determine + whether we have something valid or not... and hope + that they give us a valid context & buffer in all + situations when we can actually be rendering. + + Also check compositor->context() in buffer() to be + non-zero before accessing the context's buffer, + because more defensive coding can't hurt here. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::buffer): + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::setCompositor): + +2012-07-25 Joshua Netterfield <jnetterfield@rim.com> + + [BlackBerry] Update about:config lists + https://bugs.webkit.org/show_bug.cgi?id=92118 + + Reviewed by Rob Buis. + + Remove features from list that have either been removed from WebKit + or that have been moved from one list to another. + + * WebCoreSupport/AboutDataEnableFeatures.in: + * WebCoreSupport/AboutDataHaveFeatures.in: + * WebCoreSupport/AboutDataUseFeatures.in: + +2012-07-25 Jacky Jiang <zhajiang@rim.com> + + [BlackBerry] clock_gettime() in BackingStore.cpp should use CLOCK_MONOTONIC + https://bugs.webkit.org/show_bug.cgi?id=91898 + + Reviewed by Yong Li. + + Let pthread condition variable in BackingStore.cpp use monotonic clock + to fix a regression caused by r123266. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::BackingStorePrivate): + +2012-07-25 Andy Chen <andchen@rim.com> + + [BlackBerry] Add "SelectAll" to WebPage + https://bugs.webkit.org/show_bug.cgi?id=92246 + + Reviewed by Antonio Gomes. + + Add "Select All" editor command to WebPage. + Internally reviewed by Mike Fenton. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::selectAll): + (WebKit): + * Api/WebPage.h: + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::InputHandler::selectAll): + (WebKit): + * WebKitSupport/InputHandler.h: + +2012-07-25 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Don't touch a tile buffer while it's still on its way to the GPU + https://bugs.webkit.org/show_bug.cgi?id=91992 + + Reviewed by Adam Treat. + + PR: 141439 + The copyPreviousContentsToBackSurfaceOfTile() call will also modify + buffer contents, move it after the blit generation condvar to make sure + we've waited for the buffer to become available first. + + This is done as part of some general BackingStorePrivate::render() + cleanup in PR 141439. + + Internally reviewed by Jakob Petsovits. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::render): + +2012-07-25 Jakob Petsovits <jpetsovits@rim.com> + + [BlackBerry] notifyContentRendered() call missing in two spots + https://bugs.webkit.org/show_bug.cgi?id=92153 + RIM PR 173340 + + Reviewed by Antonio Gomes. + + In dispatchDidFirstVisualLayout() and repaint() in + immediate mode, we render but don't notify the + WebPageClient that the content was modified. + + In the long run, we should probably keep track of + the modified reason from within render() itself + and use this to automatically notify the client + from within blitContents() and/or invalidateWindow(), + depending on the rendering path. That's somewhat of + a medium-size undertaking though; for now, adding + the call directly to the renderVisibleContents() + call sites will do. + + This patch also adds a blitVisibleContents() to + dispatchDidFirstVisualLayout() where it was + inexplicably missing, probably on account of + old code that was never updated. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::repaint): + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::resumeBackingStore): + * WebCoreSupport/FrameLoaderClientBlackBerry.cpp: + (WebCore::FrameLoaderClientBlackBerry::dispatchDidFirstVisuallyNonEmptyLayout): + +2012-07-24 Rob Buis <rbuis@rim.com> + + [BlackBerry] Do not call settings setters twice on page construction + https://bugs.webkit.org/show_bug.cgi?id=92157 + + Reviewed by Yong Li. + + The WebPagePrivate init method sets some settings value that were + already set in didChangeSettings. setUseHixie76WebSocketProtocol just + sets the default value, no need to set it again. + Also call didChangeSettings explicitly from init, before that we are + not calling it since the delegate is not set yet. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::init): + +2012-07-24 Mike Fenton <mifenton@rim.com> + + Throttle calls to request the virtual keyboard be shown. + https://bugs.webkit.org/show_bug.cgi?id=92138 + + Reviewed by Rob Buis. + + PR 178465. + + Do not request keyboard visibility change when + we are actively processing an input event. + + Reviewed Internally by Gen Mak. + + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::InputHandler::focusedNodeChanged): + +2012-07-24 Joshua Netterfield <jnetterfield@rim.com> + + [BlackBerry] Update about:config lists + https://bugs.webkit.org/show_bug.cgi?id=92118 + + Reviewed by Rob Buis. + + We want to have all flags which could be used / have been used by any platform. These lists were created by running: + + * WebCoreSupport/AboutDataEnableFeatures.in: `git grep "ENABLE(" | cut -d "(" -f2 | cut -d ")" -f1 | sort -u` + * WebCoreSupport/AboutDataHaveFeatures.in: `git grep "HAVE(" | cut -d "(" -f2 | cut -d ")" -f1 | sort -u` + * WebCoreSupport/AboutDataUseFeatures.in: `git grep "USE(" | cut -d "(" -f2 | cut -d ")" -f1 | sort -u` + +2012-07-24 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Remove unused variable in BackingStore.cpp + https://bugs.webkit.org/show_bug.cgi?id=91987 + + Reviewed by Antonio Gomes. + + PR: 141439 + This is done as part of some general BackingStorePrivate::render() + cleanup in PR 141439. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::render): + 2012-07-23 Yong Li <yoli@rim.com> [BlackBerry] Move about: URL handling out of WebCore diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in index 012bf0600..1c1fa37ff 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in @@ -1,49 +1,81 @@ +3D_CANVAS 3D_RENDERING ACCELERATED_2D_CANVAS -ANIMATION_API +ALL_VARIABLES_CAPTURED ASSEMBLER ASSEMBLER_WX_EXCLUSIVE BATTERY_STATUS +BLACKBERRY_CREDENTIAL_PERSIST +BLACKBERRY_DEBUG_MEMORY BLOB BRANCH_COMPACTION +CALENDAR_PICKER CHANNEL_MESSAGING CLASSIC_INTERPRETER CLIENT_BASED_GEOLOCATION +CODEBLOCK_SAMPLING COMPARE_AND_SWAP +COMPUTED_GOTO COMPUTED_GOTO_CLASSIC_INTERPRETER +COMPUTED_GOTO_INTERPRETER +CONSISTENCY_CHECK +CONTEXT_MENUS CSS_FILTERS CSS_GRID_LAYOUT CSS_IMAGE_SET +CSS_LAYOUT_GRID +CSS_REGIONS CSS_SHADERS -DASHBOARD_SUPPORT +CTI CUSTOM_SCHEME_HANDLER +DASHBOARD_SUPPORT +DATABASE +DATAGRID DATALIST DATA_TRANSFER_ITEMS -DASHBOARD_SUPPORT +DEBUG_MATH_LAYOUT +DEBUG_PROPAGATION_VERBOSE +DEBUG_VERBOSE DEBUG_WITH_BREAKPOINT +DEPRECATED_FEATURE DETAILS DEVICE_ORIENTATION +DFG_FEATURE DFG_JIT DIRECTORY_UPLOAD +DOM_STORAGE DOWNLOAD_ATTRIBUTE DRAG_SUPPORT +DFG_JIT +ENCRYPTED_MEDIA +ESOTERIC_FEATURE +EVENT_MODE_METATAGS +EVENTSOURCE EXECUTABLE_ALLOCATOR_DEMAND EXECUTABLE_ALLOCATOR_FIXED +EXPERIMENTAL_FEATURE +FAST_MALLOC_MATCH_VALIDATION FAST_MOBILE_SCROLLING FILE_SYSTEM FILTERS FIXED_REPORTED_SIZE +FLEXBOX +FOO FTPDIR FULLSCREEN_API GAMEPAD +GC_LOGGING GC_VALIDATION GEOLOCATION GESTURE_EVENTS +GESTURE_RECOGNIZER +GGC GLIB_SUPPORT GLOBAL_FASTMALLOC_NEW HIGH_DPI_CANVAS ICONDATABASE IFRAME_SEAMLESS +IGNORE_FIXED_STYLES IMAGE_DECODER_DOWN_SAMPLING INDEXED_DATABASE INPUT_SPEECH @@ -55,18 +87,31 @@ INPUT_TYPE_MONTH INPUT_TYPE_TIME INPUT_TYPE_WEEK INSPECTOR -JAVASCRIPT_DEBUGGER -JAVASCRIPT_I18N_API +INSPECTOR_SERVER +INTERPRETER JAVA_BRIDGE JAVASCRIPT_DEBUGGER +JAVASCRIPT_I18N_API JIT +JIT_ASSERT +JIT_BREAK_ON_EVERY_BLOCK +JIT_BREAK_ON_EVERY_FUNCTION +JIT_BREAK_ON_EVERY_NODE +JIT_BREAK_ON_SPECULATION_FAILURE +JIT_CONSTANT_BLINDING +JIT_OPTIMIZE_PROPERTY_ACCESS JIT_VERBOSE JIT_VERBOSE_OSR +JSC_MULTIPLE_THREADS +LARGE_HEAP +LAZY_BLOCK_FREEING +LEGACY_CSS_VENDOR_PREFIXES LEGACY_NOTIFICATIONS -LEGACY_WEBKIT_BLOB_BUILDER LINK_PREFETCH LLINT +MAC_JAVA_BRIDGE MATHML +MEDIA_CAPTURE MEDIA_SOURCE MEDIA_STATISTICS MEDIA_STREAM @@ -76,22 +121,31 @@ METER_ELEMENT MHTML MICRODATA MUTATION_OBSERVERS -NETSCAPE_PLUGIN_API +MYSTERIOUS_FEATURE NETSCAPE_PLUGIN_METADATA_CACHE NETWORK_INFO +NEW_XML +Notification NOTIFICATIONS +OFFLINE_WEB_APPLICATIONS +ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL OPCODE_SAMPLING -OPENTYPE_SANITIZER +OPCODE_STATS ORIENTATION_EVENTS +OSR_ENTRY OVERFLOW_SCROLLING +PAGE_CACHE +PAGE_POPUP PAGE_VISIBILITY_API PAN_SCROLLING -PARSED_STYLE_SHEET_CACHING -PAGE_POPUP PARALLEL_GC +PARALLEL_JOBS +PARSED_STYLE_SHEET_CACHING +PASSWORD_ECHO +PERFECT_HASH_SIZE +PERFORMANCE_TIMELINE PLUGIN_PACKAGE_SIMPLE_HASH PLUGIN_PROCESS -PLUGIN_PROXY_FOR_VIDEO POINTER_LOCK PROGRESS_ELEMENT PURGEABLE_MEMORY @@ -101,47 +155,78 @@ REGISTER_PROTOCOL_HANDLER REPAINT_THROTTLING REQUEST_ANIMATION_FRAME RUBBER_BANDING +RUBY +RUN_TIME_HEURISTICS SAMPLING_COUNTERS SAMPLING_FLAGS SAMPLING_REGIONS SAMPLING_THREAD +SANDBOX SCRIPTED_SPEECH SHADOW_DOM SHARED_WORKERS SIMPLE_HEAP_PROFILING +SINGLE_THREADED +SKIA_GPU SMOOTH_SCROLLING +SPEECH_INPUT SPELLCHECK -SUBPIXEL_LAYOUT SQL_DATABASE STYLE_SCOPED +SUBPIXEL_LAYOUT +SUCCESS_STATS SVG +SVG_ANIMATION +SVG_AS_IMAGE SVG_DOM_OBJC_BINDINGS +SVG_EXPERIMENTAL_FEATURES SVG_FONTS +SVG_FOREIGN_OBJECT TEXT_CARET TEXT_NOTIFICATIONS_ONLY THREADED_SCROLLING THREADING_GENERIC -THREADED_SCROLLING THREADING_LIBDISPATCH THREADING_OPENMP +TOUCH_ADJUSTMENT TOUCH_EVENTS TOUCH_ICON_LOADING +TRACK VALUE_PROFILER +VERBOSE_SPECULATION_FAILURE VERBOSE_VALUE_PROFILE +VERBOSE_VALUE_RECOVERIES VIBRATION VIDEO VIDEO_TRACK +VIDEO|XSLT +VIEWPORT VIEWPORT_REFLOW -WEBDOM -WEBGL -WEBKIT2 +WBXML +WCSS WEB_ARCHIVE WEB_AUDIO +WEBDOM +WEBGL WEB_INTENTS +WEB_INTENTS_TAG +WEBKIT2 +WEB_PROCESS_SANDBOX WEB_SOCKETS WEB_TIMING +WML WORKERS +WREC WRITE_BARRIER_PROFILING +WTF_MALLOC_VALIDATION +X86 +XBL +XHR_RESPONSE_BLOB +XHTMLMP +XOR_DEBUG_AID +XPATH +XP_UNIX XSLT +YARR YARR_JIT YARR_JIT_DEBUG diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in index d7e99518d..1ab9d264e 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in @@ -1,24 +1,45 @@ ACCESSIBILITY +AVCF +CA +CFNETWORK +CFNETWORK_DATA_ARRAY_CALLBACK +CG_INTERPOLATION_MEDIUM +CGINTERPOLATION_MEDIUM +CXX_NULLPTR DISPATCH_H +DTRACE +ENABLE_THREADING_LIBDISPATCH ERRNO_H +FLOAT_H +HEADER_DETECTION_H HOSTED_CORE_ANIMATION INVERTED_WHEEL_EVENTS ISDEBUGGERPRESENT +JNI LANGINFO_H LAYER_HOSTING_IN_WINDOW_SERVER MADV_DONTNEED MADV_FREE MADV_FREE_REUSE +MERGESORT MMAP NETWORK_CFDATA_ARRAY_CALLBACK +NULLPTR +PATH_BASED_BORDER_RADIUS_DRAWING +PCRE16 PTHREAD_H +PTHREAD_MACHDEP_H PTHREAD_NP_H PTHREAD_RWLOCK PTHREAD_SETNAME_NP +QRAWFONT +QT5 READLINE RUNLOOP_TIMER SBRK SIGNAL_H +STDINT_H +STRING_H STRINGS_H STRNSTR SYS_PARAM_H @@ -27,5 +48,9 @@ SYS_TIME_H TIMEGM TM_GMTOFF TM_ZONE +UNIX_DOMAIN_SOCKETS +VARIADIC_MACRO VASPRINTF VIRTUALALLOC +WINCE +WKQCA diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataUseFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataUseFeatures.in index 80ddd27d7..66f957519 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataUseFeatures.in +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataUseFeatures.in @@ -1,68 +1,105 @@ +3D_GRAPHICS +ACCELERATE ACCELERATED_COMPOSITING -ARENA_ALLOC_ALIGNMENT_INTEGER +ACCELERATED_COMPOSITING_PLUGIN_LAYER +ACCESSIBILITY_CONTEXT_MENUS +ALTERNATE_JSIMMEDIATE ATSUI AUTOCORRECTION_PANEL AUTOMATIC_TEXT_REPLACEMENT AVFOUNDATION +BACKTRACE_SYMBOLS +BUILDING_ON_SNOW_LEOPARD +BUILTIN_UTF8_CODEC CA CAIRO CF CFNETWORK +CF_NETWORK CFURLCACHE CFURLSTORAGESESSIONS CG CG_INTERPOLATION_MEDIUM -CHROME_NETWORK_STACK CHROMIUM_NET -CONCATENATED_IMPULSE_RESPONSES -CONSOLE_ENTRY_POINT +CLUTTER COREAUDIO COREMEDIA CORE_TEXT CROSS_PLATFORM_CONTEXT_MENUS +CTI_REPATCH_PIC +CURL +DLADDR DYNAMIC_ANNOTATIONS -DYNAMIC_ANNOTATIONS_NOIMPL -EGL EXPORT_MACROS -EXTERNAL_CRASH +FLOAT_LAYOUT_OFFSETS FREETYPE GCC_COMPUTED_GOTO_WORKAROUND +GLES2_RENDERING GLIB_UNICODE +GLX GOOGLEURL GRAMMAR_CHECKING +GRAPHICS_SURFACE GSTREAMER +GTK ICCJPEG ICU_UNICODE +IOSURFACE IOSURFACE_CANVAS_BACKING_STORE +JAVASCRIPTCORE_BINDINGS JSC JSVALUE32_64 JSVALUE64 LAZY_NATIVE_CURSOR +LEGACY_VIEWPORT_ADAPTION LEVELDB LIBXML2 LOCKFREE_THREADSAFEREFCOUNTED +LOCKFREE_THREADSAFESHARED +LOW_BANDWIDTH_DISPLAY MARKER_REMOVAL_UPON_EDITING MERSENNE_TWISTER_19937 +NATIVE_FULLSCREEN_VIDEO +NetworkingContext NEW_THEME +OPENGL +OPENGL_ES_2 OPENTYPE_SANITIZER +OPENVG +OPENVG_BLUR +OS OS_RANDOMNESS PANGO PLATFORM_STRATEGIES PLUGIN_HOST_PROCESS +POSIX_REGEX PROTECTION_SPACE_AUTH_CALLBACK -PTHREADS +PTHREAD_BASED_QT PTHREAD_GETSPECIFIC_DIRECT +PTHREADS +QT4_UNICODE +QTKIT +QT_MOBILE_THEME +QT_MOBILITY_SYSTEMINFO +QT_MULTIMEDIA QUERY_PERFORMANCE_COUNTER +QXMLQUERY +QXMLSTREAM REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR REQUEST_ANIMATION_FRAME_TIMER +RTL_SCROLLBAR SAFARI_THEME SCROLLBAR_PAINTER SKIA +SKIA_ON_MAC_CHROME SKIA_ON_MAC_CHROMIUM SKIA_TEXT +SOUP SYSTEM_MALLOC TEXTURE_MAPPER +TEXTURE_MAPPER_CAIRO TEXTURE_MAPPER_GL +THREADED_COMPOSITING TILED_BACKING_STORE UI_SIDE_COMPOSITING UNIFIED_TEXT_CHECKING @@ -76,7 +113,8 @@ WEBKIT_IMAGE_DECODERS WEBP WINCE_UNICODE WININET -WTFURL WK_SCROLLBAR_PAINTER +WTFURL +WX WXGC ZLIB diff --git a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp index e9741a25b..2b7c8f992 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp @@ -375,19 +375,19 @@ void ChromeClientBlackBerry::setResizable(bool) bool ChromeClientBlackBerry::canRunBeforeUnloadConfirmPanel() { - notImplemented(); - return false; + return true; } -bool ChromeClientBlackBerry::runBeforeUnloadConfirmPanel(const String& message, Frame*) +bool ChromeClientBlackBerry::runBeforeUnloadConfirmPanel(const String& message, Frame* frame) { #if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD if (m_webPagePrivate->m_dumpRenderTree) return m_webPagePrivate->m_dumpRenderTree->runBeforeUnloadConfirmPanel(message); #endif - notImplemented(); - return false; + TimerBase::fireTimersInNestedEventLoop(); + CString latinOrigin = frameOrigin(frame); + return m_webPagePrivate->m_client->runBeforeUnloadConfirmPanel(message.characters(), message.length(), latinOrigin.data(), latinOrigin.length()); } void ChromeClientBlackBerry::closeWindowSoon() diff --git a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp index dcec2deb4..95d02f7d5 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp @@ -556,7 +556,7 @@ void EditorClientBlackBerry::learnWord(const WTF::String&) void EditorClientBlackBerry::checkSpellingOfString(const UChar* text, int textLength, int* misspellLocation, int* misspellLength) { - m_webPagePrivate->m_client->checkSpellingOfString(text, textLength, *misspellLocation, *misspellLength); + notImplemented(); } WTF::String EditorClientBlackBerry::getAutoCorrectSuggestionForMisspelledWord(const WTF::String& misspelledWord) @@ -570,7 +570,12 @@ void EditorClientBlackBerry::checkGrammarOfString(const UChar*, int, WTF::Vector notImplemented(); } -void EditorClientBlackBerry::requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) +void EditorClientBlackBerry::requestCheckingOfString(PassRefPtr<TextCheckingRequest> testCheckingRequest) +{ + m_webPagePrivate->m_inputHandler->requestCheckingOfString(textCheckingRequest); +} + +void EditorClientBlackBerry::checkTextOfParagraph(const UChar*, int, TextCheckingTypeMask, Vector<TextCheckingResult>&) { notImplemented(); } diff --git a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h index 25a8728f5..abc56d1fc 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h +++ b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.h @@ -87,6 +87,7 @@ public: virtual void checkGrammarOfString(const UChar*, int, Vector<GrammarDetail, 0u>&, int*, int*); virtual void getGuessesForWord(const String&, const String&, Vector<String>&); virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>); + virtual void checkTextOfParagraph(const UChar*, int, TextCheckingTypeMask, Vector<TextCheckingResult>&); virtual TextCheckerClient* textChecker(); virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail&); diff --git a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp index 4902f60f7..cf22ab6ad 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp @@ -66,6 +66,7 @@ #include "WebPageClient.h" #include <BlackBerryPlatformLog.h> +#include <BlackBerryPlatformMediaDocument.h> #include <BlackBerryPlatformScreen.h> #include <JavaScriptCore/APICast.h> #include <network/FilterStream.h> @@ -388,10 +389,15 @@ PassRefPtr<DocumentLoader> FrameLoaderClientBlackBerry::createDocumentLoader(con } SubstituteData substituteDataLocal = substituteData; - if (isMainFrame() && request.url().protocolIs("about")) { - // The first 6 letters is "about:" - String aboutWhat = request.url().string().substring(6); - String source = aboutData(aboutWhat); + if (isMainFrame()) { + String source; + if (request.url().protocolIs("about")) { + // The first 6 letters is "about:" + String aboutWhat = request.url().string().substring(6); + source = aboutData(aboutWhat); + } else if (request.url().protocolIs("rtsp")) + source = BlackBerry::Platform::mediaDocument(request.url().string().utf8().data()).c_str(); + if (!source.isEmpty()) { // Always ignore existing substitute data if any. WTF::RefPtr<SharedBuffer> buffer = SharedBuffer::create(source.is8Bit() ? reinterpret_cast<const char*>(source.characters8()) : source.latin1().data(), source.length()); @@ -849,9 +855,14 @@ void FrameLoaderClientBlackBerry::dispatchDidFirstVisuallyNonEmptyLayout() m_webPagePrivate->setShouldZoomToInitialScaleAfterLoadFinished(true); if (m_webPagePrivate->shouldZoomToInitialScaleOnLoad()) { + BackingStorePrivate* backingStorePrivate = m_webPagePrivate->m_backingStore->d; m_webPagePrivate->zoomToInitialScaleOnLoad(); // Set the proper zoom level first. - m_webPagePrivate->m_backingStore->d->clearVisibleZoom(); // Clear the visible zoom since we're explicitly rendering+blitting below. - m_webPagePrivate->m_backingStore->d->renderVisibleContents(); + backingStorePrivate->clearVisibleZoom(); // Clear the visible zoom since we're explicitly rendering+blitting below. + if (backingStorePrivate->renderVisibleContents()) { + if (!backingStorePrivate->shouldDirectRenderingToWindow()) + backingStorePrivate->blitVisibleContents(); + m_webPagePrivate->m_client->notifyContentRendered(backingStorePrivate->visibleContentsRect()); + } } m_webPagePrivate->m_client->notifyFirstVisuallyNonEmptyLayout(); diff --git a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp index d9cb22d79..3955752a8 100644 --- a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp @@ -53,6 +53,8 @@ #include "ScopePointer.h" #include "SelectPopupClient.h" #include "SelectionHandler.h" +#include "SpellChecker.h" +#include "TextCheckerClient.h" #include "TextIterator.h" #include "WebPageClient.h" #include "WebPage_p.h" @@ -360,7 +362,8 @@ void InputHandler::focusedNodeChanged() Node* node = frame->document()->focusedNode(); if (isActiveTextEdit() && m_currentFocusElement == node) { - notifyClientOfKeyboardVisibilityChange(true); + if (!processingChange()) + notifyClientOfKeyboardVisibilityChange(true); return; } @@ -432,7 +435,7 @@ static bool convertStringToWchar(const String& string, wchar_t* dest, int destCa // wchar_t strings sent to IMF are 32 bit so casting to UChar32 is safe. u_strToUTF32(reinterpret_cast<UChar32*>(dest), destCapacity, destLength, string.characters(), string.length(), &ec); if (ec) { - InputLog(LogLevelInfo, "InputHandler::convertStringToWchar Error converting string ec (%d).", ec); + logAlways(LogLevelCritical, "InputHandler::convertStringToWchar Error converting string ec (%d).", ec); destLength = 0; return false; } @@ -448,7 +451,7 @@ static bool convertStringToWcharVector(const String& string, WTF::Vector<wchar_t return true; if (!wcharString.tryReserveCapacity(length + 1)) { - logAlways(LogLevelWarn, "InputHandler::convertStringToWcharVector Cannot allocate memory for string.\n"); + logAlways(LogLevelCritical, "InputHandler::convertStringToWcharVector Cannot allocate memory for string.\n"); return false; } @@ -468,7 +471,7 @@ static String convertSpannableStringToString(spannable_string_t* src) WTF::Vector<UChar> dest; int destCapacity = (src->length * 2) + 1; if (!dest.tryReserveCapacity(destCapacity)) { - logAlways(LogLevelWarn, "InputHandler::convertSpannableStringToString Cannot allocate memory for string.\n"); + logAlways(LogLevelCritical, "InputHandler::convertSpannableStringToString Cannot allocate memory for string.\n"); return String(); } @@ -477,7 +480,7 @@ static String convertSpannableStringToString(spannable_string_t* src) // wchar_t strings sent from IMF are 32 bit so casting to UChar32 is safe. u_strFromUTF32(dest.data(), destCapacity, &destLength, reinterpret_cast<UChar32*>(src->str), src->length, &ec); if (ec) { - InputLog(LogLevelInfo, "InputHandler::convertSpannableStringToString Error converting string ec (%d).", ec); + logAlways(LogLevelCritical, "InputHandler::convertSpannableStringToString Error converting string ec (%d).", ec); return String(); } dest.resize(destLength); @@ -517,12 +520,127 @@ void InputHandler::learnText() sendLearnTextDetails(textInField); } +void InputHandler::requestCheckingOfString(PassRefPtr<WebCore::TextCheckingRequest> textCheckingRequest) +{ + RefPtr<WebCore::TextCheckingRequest> request = textCheckingRequest; + + int32_t sequenceId = request->sequence(); + int requestLength = request->text().length(); + if (!requestLength /* || requestLength > maxSpellCheckStringLength */) { + spellCheckingRequestCancelled(sequenceId, true /* isSequenceId */); + return; + } + + wchar_t* checkingString = (wchar_t*)malloc(sizeof(wchar_t) * (requestLength + 1)); + if (!checkingString) { + BlackBerry::Platform::logAlways(BlackBerry::Platform::LogLevelCritical, "InputHandler::requestCheckingOfString Cannot allocate memory for string."); + spellCheckingRequestCancelled(sequenceId, true /* isSequenceId */); + return; + } -void InputHandler::spellCheckingRequestProcessed(int32_t id, spannable_string_t* spannableString) + int stringLength = 0; + if (!convertStringToWchar(request->text(), checkingString, requestLength + 1, &stringLength)) { + BlackBerry::Platform::logAlways(BlackBerry::Platform::LogLevelCritical, "InputHandler::requestCheckingOfString Failed to convert String to wchar type."); + free(checkingString); + spellCheckingRequestCancelled(sequenceId, true /* isSequenceId */); + return; + } + + int32_t transactionId = m_webPage->m_client->checkSpellingOfStringAsync(checkingString, stringLength); + free(checkingString); + + // If the call to the input service did not go through, then cancel the request so we don't block endlessly. + // This should still take transactionId as a parameter to maintain the same behavior as if InputMethodSupport + // were to cancel a request during processing. + if (transactionId == -1) { // Error before sending request to input service. + spellCheckingRequestCancelled(sequenceId, true /* isSequenceId */); + return; + } + + // map sequenceId to transactionId. + m_sequenceMap[transactionId] = sequenceId; +} + +int32_t InputHandler::convertTransactionIdToSequenceId(int32_t transactionId) { - UNUSED_PARAM(id); - UNUSED_PARAM(spannableString); - // TODO implement. + std::map<int32_t, int32_t>::iterator it = m_sequenceMap.find(transactionId); + + if (it == m_sequenceMap.end()) + return 0; + + int32_t sequenceId = it->second; + // We only convert this value when we have received its response, so its safe to remove it from the map. + m_sequenceMap.erase(it); + + return sequenceId; +} + +void InputHandler::spellCheckingRequestProcessed(int32_t transactionId, spannable_string_t* spannableString) +{ + if (!spannableString) { + spellCheckingRequestCancelled(transactionId, false /* isSequenceId */); + return; + } + + Vector<TextCheckingResult> results; + + // Convert the spannableString to TextCheckingResult then append to results vector. + String replacement; + TextCheckingResult textCheckingResult; + textCheckingResult.type = TextCheckingTypeSpelling; + textCheckingResult.replacement = replacement; + textCheckingResult.location = 0; + textCheckingResult.length = 0; + + span_t* span = spannableString->spans; + for (unsigned int i = 0; i < spannableString->spans_count; i++) { + if (!span) + break; + if (span->end < span->start) { + spellCheckingRequestCancelled(transactionId, false /* isSequenceId */); + return; + } + if (span->attributes_mask & MISSPELLED_WORD_ATTRIB) { + textCheckingResult.location = span->start; + // The end point includes the character that it is before. Ie, 0, 0 + // applies to the first character as the end point includes the character + // at the position. This means the endPosition is always +1. + textCheckingResult.length = span->end - span->start + 1; + results.append(textCheckingResult); + } + span++; + } + + // transactionId here is for use with the input service. We need to translate this to sequenceId used with SpellChecker. + int32_t sequenceId = convertTransactionIdToSequenceId(transactionId); + + SpellChecker* sp = getSpellChecker(); + if (!sp || !sequenceId) { + InputLog(LogLevelWarn, "InputHandler::spellCheckingRequestProcessed failed to process the request with sequenceId %d", sequenceId); + spellCheckingRequestCancelled(sequenceId, true /* isSequenceId */); + return; + } + sp->didCheckSucceeded(sequenceId, results); +} + +void InputHandler::spellCheckingRequestCancelled(int32_t id, bool isSequenceId) +{ + int32_t sequenceId = isSequenceId ? id : convertTransactionIdToSequenceId(id); + SpellChecker* sp = getSpellChecker(); + if (!sp) { + InputLog(LogLevelWarn, "InputHandler::spellCheckingRequestCancelled failed to cancel the request with sequenceId %d", sequenceId); + return; + } + sp->didCheckCanceled(sequenceId); +} + +SpellChecker* InputHandler::getSpellChecker() +{ + if (Frame* frame = m_currentFocusElement->document()->frame()) + if (Editor* editor = frame->editor()) + return editor->spellChecker(); + + return 0; } void InputHandler::setElementUnfocused(bool refocusOccuring) @@ -1167,6 +1285,11 @@ void InputHandler::paste() executeTextEditCommand("Paste"); } +void InputHandler::selectAll() +{ + executeTextEditCommand("SelectAll"); +} + void InputHandler::addAttributedTextMarker(int start, int end, const AttributeTextStyle& style) { if ((end - start) < 1 || end > static_cast<int>(elementText().length())) @@ -1463,21 +1586,20 @@ spannable_string_t* InputHandler::spannableTextInRange(int start, int end, int32 WTF::String textString = elementText().substring(start, length); - spannable_string_t* pst = (spannable_string_t*)malloc(sizeof(spannable_string_t)); - if (!pst) { - InputLog(LogLevelInfo, "InputHandler::spannableTextInRange error allocating spannable string."); - return 0; - } + spannable_string_t* pst = (spannable_string_t*)fastMalloc(sizeof(spannable_string_t)); + // Don't use fastMalloc in case the string is unreasonably long. fastMalloc will + // crash immediately on failure. pst->str = (wchar_t*)malloc(sizeof(wchar_t) * (length + 1)); if (!pst->str) { - InputLog(LogLevelInfo, "InputHandler::spannableTextInRange Cannot allocate memory for string.\n"); + logAlways(LogLevelCritical, "InputHandler::spannableTextInRange Cannot allocate memory for string.\n"); free(pst); return 0; } int stringLength = 0; if (!convertStringToWchar(textString, pst->str, length + 1, &stringLength)) { + logAlways(LogLevelCritical, "InputHandler::spannableTextInRange failed to convert string.\n"); free(pst->str); free(pst); return 0; @@ -1527,7 +1649,7 @@ extracted_text_t* InputHandler::extractedTextRequest(extracted_text_request_t* r if (!isActiveTextEdit()) return 0; - extracted_text_t* extractedText = (extracted_text_t *)malloc(sizeof(extracted_text_t)); + extracted_text_t* extractedText = (extracted_text_t *)fastMalloc(sizeof(extracted_text_t)); // 'flags' indicates whether the text is being monitored. This is not currently used. @@ -1784,7 +1906,7 @@ bool InputHandler::setTextAttributes(int insertionPoint, spannable_string_t* spa // used by IMF. When they add support for on the fly spell checking we can // use it to apply spelling markers and disable continuous spell checking. - InputLog(LogLevelInfo, "InputHandler::setTextAttributes adding marker %d to %d - %d", startPosition, endPosition, span->attributes_mask); + InputLog(LogLevelInfo, "InputHandler::setTextAttributes adding marker %d to %d - %llu", startPosition, endPosition, span->attributes_mask); addAttributedTextMarker(startPosition, endPosition, textStyleFromMask(span->attributes_mask)); span++; diff --git a/Source/WebKit/blackberry/WebKitSupport/InputHandler.h b/Source/WebKit/blackberry/WebKitSupport/InputHandler.h index ec916f824..e492c607f 100644 --- a/Source/WebKit/blackberry/WebKitSupport/InputHandler.h +++ b/Source/WebKit/blackberry/WebKitSupport/InputHandler.h @@ -22,7 +22,7 @@ #include <BlackBerryPlatformInputEvents.h> #include <imf/input_data.h> - +#include <map> #include <wtf/RefPtr.h> namespace WTF { @@ -37,6 +37,8 @@ class HTMLInputElement; class HTMLSelectElement; class IntRect; class Node; +class SpellChecker; +class TextCheckingRequest; } namespace BlackBerry { @@ -74,6 +76,7 @@ public: void cut(); void copy(); void paste(); + void selectAll(); void cancelSelection(); @@ -121,7 +124,9 @@ public: int32_t setComposingText(spannable_string_t*, int32_t relativeCursorPosition); int32_t commitText(spannable_string_t*, int32_t relativeCursorPosition); - void spellCheckingRequestProcessed(int32_t id, spannable_string_t*); + void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>); + void spellCheckingRequestProcessed(int32_t transactionId, spannable_string_t*); + void spellCheckingRequestCancelled(int32_t id, bool isSequenceId = false); private: enum PendingKeyboardStateChange { NoChange, Visible, NotVisible }; @@ -178,6 +183,8 @@ private: void learnText(); void sendLearnTextDetails(const WTF::String&); + int32_t convertTransactionIdToSequenceId(int32_t transactionId); + WebCore::SpellChecker* getSpellChecker(); WebPagePrivate* m_webPage; @@ -195,6 +202,8 @@ private: PendingKeyboardStateChange m_pendingKeyboardVisibilityChange; bool m_delayKeyboardVisibilityChange; + + std::map<int32_t, int32_t> m_sequenceMap; }; } diff --git a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp index 51c9b72c3..7047204e7 100644 --- a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp @@ -45,16 +45,23 @@ // Note: This generates a lot of logs when dumping rects lists. It will seriously // impact performance. Do not enable this during performance tests. #define SHOWDEBUG_SELECTIONHANDLER 0 +#define SHOWDEBUG_SELECTIONHANDLER_TIMING 0 using namespace BlackBerry::Platform; using namespace WebCore; #if SHOWDEBUG_SELECTIONHANDLER -#define DEBUG_SELECTION(severity, format, ...) logAlways(severity, format, ## __VA_ARGS__) +#define SelectionLog(severity, format, ...) logAlways(severity, format, ## __VA_ARGS__) #else -#define DEBUG_SELECTION(severity, format, ...) +#define SelectionLog(severity, format, ...) #endif // SHOWDEBUG_SELECTIONHANDLER +#if SHOWDEBUG_SELECTIONHANDLER_TIMING +#define SelectionTimingLog(severity, format, ...) logAlways(severity, format, ## __VA_ARGS__) +#else +#define SelectionTimingLog(severity, format, ...) +#endif // SHOWDEBUG_SELECTIONHANDLER_TIMING + namespace BlackBerry { namespace WebKit { @@ -75,7 +82,7 @@ void SelectionHandler::cancelSelection() m_selectionActive = false; m_lastSelectionRegion = IntRectRegion(); - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::cancelSelection"); + SelectionLog(LogLevelInfo, "SelectionHandler::cancelSelection"); if (m_webPage->m_inputHandler->isInputMode()) m_webPage->m_inputHandler->cancelSelection(); @@ -205,7 +212,7 @@ bool SelectionHandler::shouldUpdateSelectionOrCaretForPoint(const WebCore::IntPo bool aboveCaret = point.y() < caretRect.y(); bool belowCaret = point.y() >= caretRect.maxY(); - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::shouldUpdateSelectionOrCaretForPoint multiline = %s above = %s below = %s first line = %s last line = %s start = %s \n" + SelectionLog(LogLevelInfo, "SelectionHandler::shouldUpdateSelectionOrCaretForPoint multiline = %s above = %s below = %s first line = %s last line = %s start = %s" , m_webPage->m_inputHandler->isMultilineInputMode() ? "true" : "false", aboveCaret ? "true" : "false", belowCaret ? "true" : "false" , inSameLine(currentSelection.visibleStart(), startOfEditableContent(currentSelection.visibleStart())) ? "true" : "false" , inSameLine(currentSelection.visibleEnd(), endOfEditableContent(currentSelection.visibleEnd())) ? "true" : "false" @@ -228,7 +235,7 @@ void SelectionHandler::setCaretPosition(const WebCore::IntPoint &position) m_caretActive = true; - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::setCaretPosition requested point %d, %d", position.x(), position.y()); + SelectionLog(LogLevelInfo, "SelectionHandler::setCaretPosition requested point %d, %d", position.x(), position.y()); Frame* focusedFrame = m_webPage->focusedOrMainFrame(); FrameSelection* controller = focusedFrame->selection(); @@ -258,7 +265,7 @@ void SelectionHandler::setCaretPosition(const WebCore::IntPoint &position) controller->setSelection(newSelection); - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::setCaretPosition point valid, cursor updated"); + SelectionLog(LogLevelInfo, "SelectionHandler::setCaretPosition point valid, cursor updated"); } // This function makes sure we are not reducing the selection to a caret selection. @@ -426,7 +433,7 @@ bool SelectionHandler::updateOrHandleInputSelection(VisibleSelection& newSelecti if (!character) return false; - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::setSelection making selection change attempt using key event %d", character); + SelectionLog(LogLevelInfo, "SelectionHandler::updateOrHandleInputSelection making selection change attempt using key event %d", character); if (shouldExtendSelectionInDirection(controller->selection(), character)) m_webPage->m_inputHandler->handleKeyboardInput(Platform::KeyboardEvent(character, Platform::KeyboardEvent::KeyDown, KEYMOD_SHIFT)); @@ -448,7 +455,11 @@ void SelectionHandler::setSelection(const WebCore::IntPoint& start, const WebCor Frame* focusedFrame = m_webPage->focusedOrMainFrame(); FrameSelection* controller = focusedFrame->selection(); - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::setSelection adjusted points %d, %d, %d, %d", start.x(), start.y(), end.x(), end.y()); +#if SHOWDEBUG_SELECTIONHANDLER_TIMING + m_timer.start(); +#endif + + SelectionLog(LogLevelInfo, "SelectionHandler::setSelection adjusted points %d, %d, %d, %d", start.x(), start.y(), end.x(), end.y()); // Note that IntPoint(-1, -1) is being our sentinel so far for // clipped out selection starting or ending location. @@ -521,12 +532,12 @@ void SelectionHandler::setSelection(const WebCore::IntPoint& start, const WebCor controller->setSelection(newSelection); - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::setSelection selection points valid, selection updated\n"); + SelectionLog(LogLevelInfo, "SelectionHandler::setSelection selection points valid, selection updated."); } else { // Requested selection results in an empty selection, skip this change. selectionPositionChanged(); - DEBUG_SELECTION(LogLevelWarn, "SelectionHandler::setSelection selection points invalid, selection not updated\n"); + SelectionLog(LogLevelWarn, "SelectionHandler::setSelection selection points invalid, selection not updated."); } } @@ -606,7 +617,7 @@ void SelectionHandler::selectObject(const WebCore::IntPoint& location, TextGranu ASSERT(m_webPage && m_webPage->focusedOrMainFrame() && m_webPage->focusedOrMainFrame()->selection()); Frame* focusedFrame = m_webPage->focusedOrMainFrame(); - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::selectObject adjusted points %d, %d", location.x(), location.y()); + SelectionLog(LogLevelInfo, "SelectionHandler::selectObject adjusted points %d, %d", location.x(), location.y()); WebCore::IntPoint relativePoint = DOMSupport::convertPointToFrame(m_webPage->mainFrame(), focusedFrame, location); VisiblePosition pointLocation(focusedFrame->visiblePositionForPoint(relativePoint)); @@ -625,7 +636,7 @@ void SelectionHandler::selectObject(TextGranularity granularity) ASSERT(m_webPage->focusedOrMainFrame() && m_webPage->focusedOrMainFrame()->selection()); Frame* focusedFrame = m_webPage->focusedOrMainFrame(); - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::selectObject using current selection"); + SelectionLog(LogLevelInfo, "SelectionHandler::selectObject using current selection"); // Use the current selection as the selection point. ASSERT(focusedFrame->selection()->selectionType() != VisibleSelection::NoSelection); @@ -642,7 +653,7 @@ void SelectionHandler::selectObject(Node* node) ASSERT(m_webPage && m_webPage->focusedOrMainFrame() && m_webPage->focusedOrMainFrame()->selection()); Frame* focusedFrame = m_webPage->focusedOrMainFrame(); - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::selectNode"); + SelectionLog(LogLevelInfo, "SelectionHandler::selectNode"); VisibleSelection selection = VisibleSelection::selectionFromContentsOfNode(node); focusedFrame->selection()->setSelection(selection); @@ -829,7 +840,7 @@ bool SelectionHandler::inputNodeOverridesTouch() const // system is not entirely WebKit. void SelectionHandler::selectionPositionChanged(bool visualChangeOnly) { - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::selectionPositionChanged visibleChangeOnly = %s", visualChangeOnly ? "true" : "false"); + SelectionLog(LogLevelInfo, "SelectionHandler::selectionPositionChanged visibleChangeOnly = %s", visualChangeOnly ? "true" : "false"); // This method can get called during WebPage shutdown process. // If that is the case, just bail out since the client is not @@ -858,6 +869,8 @@ void SelectionHandler::selectionPositionChanged(bool visualChangeOnly) else if (!m_selectionActive) return; + SelectionTimingLog(LogLevelInfo, "SelectionHandler::selectionPositionChanged starting at %f", m_timer.elapsed()); + WebCore::IntRect startCaret; WebCore::IntRect endCaret; @@ -889,11 +902,11 @@ void SelectionHandler::selectionPositionChanged(bool visualChangeOnly) regionForTextQuads(quads, visibleSelectionRegion); -#if SHOWDEBUG_SELECTIONHANDLER // Don't rely just on DEBUG_SELECTION to avoid loop. +#if SHOWDEBUG_SELECTIONHANDLER // Don't rely just on SelectionLog to avoid loop. for (unsigned int i = 0; i < unclippedRegion.numRects(); i++) - DEBUG_SELECTION(LogLevelCritical, "Rect list - Unmodified #%d, (%d, %d) (%d x %d)", i, unclippedRegion.rects()[i].x(), unclippedRegion.rects()[i].y(), unclippedRegion.rects()[i].width(), unclippedRegion.rects()[i].height()); + SelectionLog(LogLevelInfo, "Rect list - Unmodified #%d, (%d, %d) (%d x %d)", i, unclippedRegion.rects()[i].x(), unclippedRegion.rects()[i].y(), unclippedRegion.rects()[i].width(), unclippedRegion.rects()[i].height()); for (unsigned int i = 0; i < visibleSelectionRegion.numRects(); i++) - DEBUG_SELECTION(LogLevelCritical, "Rect list - Clipped to Visible #%d, (%d, %d) (%d x %d)", i, visibleSelectionRegion.rects()[i].x(), visibleSelectionRegion.rects()[i].y(), visibleSelectionRegion.rects()[i].width(), visibleSelectionRegion.rects()[i].height()); + SelectionLog(LogLevelInfo, "Rect list - Clipped to Visible #%d, (%d, %d) (%d x %d)", i, visibleSelectionRegion.rects()[i].x(), visibleSelectionRegion.rects()[i].y(), visibleSelectionRegion.rects()[i].width(), visibleSelectionRegion.rects()[i].height()); #endif bool shouldCareAboutPossibleClippedOutSelection = frame != m_webPage->mainFrame() || m_webPage->m_inputHandler->isInputMode(); @@ -922,19 +935,20 @@ void SelectionHandler::selectionPositionChanged(bool visualChangeOnly) } } - DEBUG_SELECTION(BlackBerry::Platform::LogLevelInfo, "SelectionHandler::selectionPositionChanged Start Rect=(%d, %d) (%d x %d) End Rect=(%d, %d) (%d x %d)", + SelectionLog(BlackBerry::Platform::LogLevelInfo, "SelectionHandler::selectionPositionChanged Start Rect=(%d, %d) (%d x %d) End Rect=(%d, %d) (%d x %d)", startCaret.x(), startCaret.y(), startCaret.width(), startCaret.height(), endCaret.x(), endCaret.y(), endCaret.width(), endCaret.height()); if (m_webPage->m_selectionOverlay) m_webPage->m_selectionOverlay->draw(visibleSelectionRegion); m_webPage->m_client->notifySelectionDetailsChanged(startCaret, endCaret, visibleSelectionRegion, inputNodeOverridesTouch()); + SelectionTimingLog(LogLevelInfo, "SelectionHandler::selectionPositionChanged completed at %f", m_timer.elapsed()); } // NOTE: This function is not in WebKit coordinates. void SelectionHandler::caretPositionChanged() { - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::caretPositionChanged"); + SelectionLog(LogLevelInfo, "SelectionHandler::caretPositionChanged"); WebCore::IntRect caretLocation; // If the input field is empty, we always turn off the caret. @@ -965,7 +979,7 @@ void SelectionHandler::caretPositionChanged() m_caretActive = !caretLocation.isEmpty(); - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::caretPositionChanged caret Rect %d, %d, %dx%d", + SelectionLog(LogLevelInfo, "SelectionHandler::caretPositionChanged caret Rect %d, %d, %dx%d", caretLocation.x(), caretLocation.y(), caretLocation.width(), caretLocation.height()); caretLocation = m_webPage->mapToTransformed(caretLocation); @@ -984,7 +998,7 @@ void SelectionHandler::caretPositionChanged() m_webPage->clipToTransformedContentsRect(nodeBoundingBox); } - DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::single line %s single line bounding box %d, %d, %dx%d", + SelectionLog(LogLevelInfo, "SelectionHandler::single line %s single line bounding box %d, %d, %dx%d", singleLineInput ? "true" : "false", nodeBoundingBox.x(), nodeBoundingBox.y(), nodeBoundingBox.width(), nodeBoundingBox.height()); m_webPage->m_client->notifyCaretChanged(caretLocation, m_webPage->m_touchEventHandler->lastFatFingersResult().isTextInput() /* userTouchTriggered */, singleLineInput, nodeBoundingBox); diff --git a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h index f72af445c..b0833c2c1 100644 --- a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h +++ b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h @@ -21,6 +21,7 @@ #include "BlackBerryPlatformIntRectRegion.h" #include "BlackBerryPlatformPrimitives.h" +#include "BlackBerryPlatformStopWatch.h" #include "TextGranularity.h" #include <wtf/Vector.h> @@ -89,6 +90,8 @@ private: bool m_caretActive; bool m_lastUpdatedEndPointIsValid; BlackBerry::Platform::IntRectRegion m_lastSelectionRegion; + + BlackBerry::Platform::StopWatch m_timer; }; } diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index ca446fe90..c9b02eb2e 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,561 @@ +2012-07-29 Lu Guanqun <guanqun.lu@intel.com> + + [chromium] pass acceleratePainting info to settings + https://bugs.webkit.org/show_bug.cgi?id=92467 + + Reviewed by Eric Seidel. + + The acceleratePainting info is not passed into settings correctly so + that GPU composition would not use the code path of accelerated painting. + + * src/WebLayerTreeView.cpp: + (WebKit::WebLayerTreeView::Settings::operator CCLayerTreeSettings): + +2012-07-29 Rik Cabanier <cabanier@adobe.com> + + Add ENABLE_CSS_COMPOSITING flag + https://bugs.webkit.org/show_bug.cgi?id=92553 + + Reviewed by Dirk Schulze. + + Adds compiler flag CSS_COMPOSITING to build systems to enable CSS blending and compositing. See spec https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html + + * features.gypi: + +2012-07-28 Peter Kasting <pkasting@google.com> + + Sigh. Just disable all the AutoResize tests after the first three. + https://bugs.webkit.org/show_bug.cgi?id=92318 + + Unreviewed, making bots happier. + + * tests/WebViewTest.cpp: + +2012-07-28 Peter Kasting <pkasting@google.com> + + Try disabling different test in hopes of tracking down the real problem. + https://bugs.webkit.org/show_bug.cgi?id=92318 + + Unreviewed, making bots happier. + + * tests/WebViewTest.cpp: + +2012-07-27 Peter Kasting <pkasting@google.com> + + Disable failing test. + https://bugs.webkit.org/show_bug.cgi?id=92318 + + Unreviewed, making bots happier. + + * tests/WebViewTest.cpp: + +2012-07-27 Scott Graham <scottmg@chromium.org> + + Change navigator.webkitGamepads[] to navigator.webkitGetGamepads() + https://bugs.webkit.org/show_bug.cgi?id=92533 + + Reviewed by Adam Barth. + + Renames for updated access point. + + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enableGamepad): + (WebKit::WebRuntimeFeatures::isGamepadEnabled): + +2012-07-27 Kevin Ellis <kevers@chromium.org> + + [chromium] Calendar for input type=date should be larger on devices that support touch input. + https://bugs.webkit.org/show_bug.cgi?id=92424 + + Reviewed by Kent Tamura. + + Plumbs the deviceSupportsTouch setting through to the popup page so + that the Calendar popup can be enlarged on screens that support touch + input. + + * src/WebPagePopupImpl.cpp: + (WebKit::WebPagePopupImpl::initPage): + +2012-07-27 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-07-27 Oli Lan <olilan@chromium.org> + + [chromium] Fix issues in visiblePositionForWindowPoint (offscreen points / iframes). + https://bugs.webkit.org/show_bug.cgi?id=79117 + + Fix two issues in WebFrameImpl::visiblePositionForWindowPoint. + + 1) If the point is off-screen, the visiblePosition is clipped to the screen. + - The fix is to add HitTestRequest::IgnoreClipping. + + 2) The result is incorrect if the point is within an iframe. + - This is because we are calling convertFromContainingWindow twice: once in windowToContents, + and then explicitly as well. + - This patch removes the explicit call to convertFromContainingWindow. + + Reviewed by Adam Barth. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::visiblePositionForWindowPoint): + +2012-07-27 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-07-27 Alec Flett <alecflett@chromium.org> + + IndexedDB: inject index keys on cursor/objectstore/index get success handlers + https://bugs.webkit.org/show_bug.cgi?id=91123 + + Reviewed by Tony Chang. + + Remove method no longer used. + + * tests/IDBFakeBackingStore.h: + +2012-07-26 Yoshifumi Inoue <yosin@chromium.org> + + [Forms] Introduce runtime feature flags for input type datetime, datetimelocal, month, time, week + https://bugs.webkit.org/show_bug.cgi?id=92339 + + Reviewed by Kent Tamura. + + To detect compilation errors and test failure earlier, I would like + build and run tests for input type datetime, datetime-local, month, + time and week with runtime feature flags to avoid behavior changes + on chromium browser. + + This patch adds query and change functions for runtime features of + input type datetime, datetime-local, month, time and week to WebRuntimeFeatures + class for exposing DRT and chromium browser expermental flags. + + * features.gypi: Turn on ENABLE_INPUT_TYPE_DATETIME, ENABLE_INPUT_TYPE_DATETIMELOCAL, + ENABLE_INPUT_TYPE_MONTH, ENABLE_INPUT_TYPE_TIME, and ENABLE_INPUT_TYPE_WEEK for all OS. + * public/WebRuntimeFeatures.h: + (WebRuntimeFeatures): + * src/WebRuntimeFeatures.cpp: + (WebKit::WebRuntimeFeatures::enableInputTypeDateTime): Added. + (WebKit::WebRuntimeFeatures::isInputTypeDateTimeEnabled): Added. + (WebKit::WebRuntimeFeatures::enableInputTypeDateTimeLocal): Added. + (WebKit::WebRuntimeFeatures::isInputTypeDateTimeLocalEnabled): Added. + (WebKit::WebRuntimeFeatures::enableInputTypeMonth): Added. + (WebKit::WebRuntimeFeatures::isInputTypeMonthEnabled): Added. + (WebKit::WebRuntimeFeatures::enableInputTypeTime): Added. + (WebKit::WebRuntimeFeatures::isInputTypeTimeEnabled): Added. + (WebKit::WebRuntimeFeatures::enableInputTypeWeek): Added. + (WebKit::WebRuntimeFeatures::isInputTypeWeekEnabled): Added. + +2012-07-26 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123799. + http://trac.webkit.org/changeset/123799 + https://bugs.webkit.org/show_bug.cgi?id=92431 + + broke the Apple Mac build (Requested by bweinstein on + #webkit). + + * src/WebInputEventConversion.cpp: + (WebKit): + * src/WebInputEventConversion.h: + (WebKit): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::handleEvent): + * src/WebPluginContainerImpl.h: + (WebPluginContainerImpl): + +2012-07-26 Sadrul Habib Chowdhury <sadrul@chromium.org> + + Propagate gesture events to plugins. + https://bugs.webkit.org/show_bug.cgi?id=92281 + + Reviewed by Adam Barth. + + Propagate gesture events to plugins. + + * src/WebInputEventConversion.cpp: + (WebKit): + (WebKit::WebGestureEventBuilder::WebGestureEventBuilder): + * src/WebInputEventConversion.h: + (WebCore): + (WebKit): + (WebGestureEventBuilder): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::handleEvent): + * src/WebPluginContainerImpl.h: + (WebCore): + (WebPluginContainerImpl): + +2012-07-26 Adrienne Walker <enne@google.com> + + [chromium] Remove redundant surface origin transforms + https://bugs.webkit.org/show_bug.cgi?id=91815 + + Reviewed by Stephen White. + + Clean up use of origin transforms in tests. Where possible, test + against the equivalent draw transform. + + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCRenderSurfaceTest.cpp: + +2012-07-25 David Grogan <dgrogan@chromium.org> + + IndexedDB: WebKit API interfaces for "upgradeneeded" methods and events + https://bugs.webkit.org/show_bug.cgi?id=92203 + + Reviewed by Adam Barth. + + This is the beginning of our typical three-sided-patch process. + + * public/WebIDBCallbacks.h: + (WebKit::WebIDBCallbacks::onBlocked): + (WebKit::WebIDBCallbacks::onUpgradeNeeded): + * public/WebIDBDatabaseCallbacks.h: + (WebKit::WebIDBDatabaseCallbacks::onVersionChange): + * public/WebIDBFactory.h: + (WebIDBFactory): + (WebKit::WebIDBFactory::open): + * src/WebIDBFactoryImpl.cpp: + (WebKit::WebIDBFactoryImpl::open): + (WebKit): + * src/WebIDBFactoryImpl.h: + (WebIDBFactoryImpl): + +2012-07-19 Adrienne Walker <enne@google.com> + + [chromium] Make all compositor screen space transforms operate on content rects + https://bugs.webkit.org/show_bug.cgi?id=91807 + + Reviewed by Kenneth Russell. + + Update tests that deal with screen space transforms to reflect this change. + + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/TiledLayerChromiumTest.cpp: + +2012-07-25 Andrew Wilson <atwilson@chromium.org> + + Unreviewed chromium change to disable failing WebViewTest.AutoResizeInBetweenSizes. + https://bugs.webkit.org/show_bug.cgi?id=92318 + + * tests/WebViewTest.cpp: + +2012-07-25 Scott Graham <scottmg@chromium.org> + + [Chromium] fix double->float warnings in CCLayerTreeHostCommonTest.cpp + https://bugs.webkit.org/show_bug.cgi?id=92271 + + Reviewed by Adrienne Walker. + + Fix compile warnings on Windows. + + * tests/CCLayerTreeHostCommonTest.cpp: + +2012-07-25 Dana Jansens <danakj@chromium.org> + + [chromium] Move WebFilterOperations from RenderPassDrawQuad to RenderPass + https://bugs.webkit.org/show_bug.cgi?id=91885 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + * tests/LayerRendererChromiumTest.cpp: + (FakeCCRendererClient::FakeCCRendererClient): + (FakeCCRendererClient::rootRenderPass): + (FakeCCRendererClient::renderPassesInDrawOrder): + (FakeCCRendererClient::renderPasses): + (FakeCCRendererClient): + (TEST_F): + (TEST): + +2012-07-24 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Refactor CCLayerTreeHostCommon: move root layer special case initialization into internal code. + https://bugs.webkit.org/show_bug.cgi?id=88953 + + Reviewed by Adrienne Walker. + + Unit tests updated to account for the new less-special root layer setup. + - most test cases just needed to remove root->renderSurface()->setContentBounds(), createRenderSurface(), and renderSurfaceLayerList.append(). + - some test cases originally relied on setting some awkward unconventional bounds of the rootLayer that were different than the rootLayer's renderSurface. these tests are updated. + - a few minor cleanups otherwise. + + * tests/CCDamageTrackerTest.cpp: + (WebKitTests::executeCalculateDrawTransformsAndVisibility): + * tests/CCLayerIteratorTest.cpp: + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/CCOcclusionTrackerTest.cpp: + (WebKitTests::CCOcclusionTrackerTest::calcDrawEtc): + +2012-07-25 Taiju Tsuiki <tzik@chromium.org> + + FileSystem should provide a way to delete filesystem. + https://bugs.webkit.org/show_bug.cgi?id=91861 + + Reviewed by Adam Barth. + + * public/WebFrameClient.h: + (WebFrameClient): + (WebKit::WebFrameClient::deleteFileSystem): + * src/LocalFileSystemChromium.cpp: Add deleteFileSystem + (WebCore::deleteFileSystemNotAllowed): + (WebCore): + (WebCore::LocalFileSystem::deleteFileSystem): + +2012-07-25 Alok Priyadarshi <alokp@chromium.org> + + [chromium] WebViewBenchmarkSupport::paint API does not work with recording canvas + https://bugs.webkit.org/show_bug.cgi?id=92008 + + Reviewed by Darin Fisher. + + Moved the ownership of canvas to WebViewBenchmarkSupport::PaintClient. + + * public/WebViewBenchmarkSupport.h: + (PaintClient): + (WebKit::WebViewBenchmarkSupport::PaintClient::willPaint): + (WebKit::WebViewBenchmarkSupport::PaintClient::didPaint): + * src/WebViewBenchmarkSupportImpl.cpp: + (WebKit::WebViewBenchmarkSupportImpl::paintLayer): + (WebKit::WebViewBenchmarkSupportImpl::softwarePaint): + +2012-07-24 Dana Jansens <danakj@chromium.org> + + [chromium] Turn the debug HUD into a layer so that it can be drawn as a WebCompositorQuad + https://bugs.webkit.org/show_bug.cgi?id=92182 + + Reviewed by Adrienne Walker. + + * tests/LayerRendererChromiumTest.cpp: + (TEST): + +2012-07-25 Adrienne Walker <enne@google.com> + + [chromium] Unify compositor quadTransform/drawTransform/originTransform + https://bugs.webkit.org/show_bug.cgi?id=91417 + + Reviewed by Kenneth Russell. + + Clean up tests to refer to the new draw transform semantics. + + * tests/CCDamageTrackerTest.cpp: + (WebKitTests::createTestTreeWithOneSurface): + (WebKitTests::createTestTreeWithTwoSurfaces): + (WebKitTests::TEST_F): + * tests/CCLayerSorterTest.cpp: + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers::commitCompleteOnCCThread): + * tests/CCQuadCullerTest.cpp: + * tests/TiledLayerChromiumTest.cpp: + +2012-07-25 Kevin Ellis <kevers@chromium.org> + + [chromium] Calendar picker popup displays at wrong scale when deviceScaleFactor != 1. + https://bugs.webkit.org/show_bug.cgi?id=92177 + + Manually tested at deviceScaleFactor = 1 and 2. + + Reviewed by Kent Tamura. + + The device scale factor was not being set for the calendar popup. + As a result, the popup was rendered too small on hidpi displays. + This patch sets the device scale factor for any page popup. + + * src/WebPagePopupImpl.cpp: + (WebKit::WebPagePopupImpl::initPage): + +2012-07-25 MORITA Hajime <morrita@google.com> + + Another unreviewed win build fix against r123569. + + * tests/IDBAbortOnCorruptTest.cpp: + +2012-07-25 MORITA Hajime <morrita@google.com> + + Unreviewed win build fix against r123569. + + * tests/IDBAbortOnCorruptTest.cpp: + * tests/IDBDatabaseBackendTest.cpp: + +2012-07-24 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-07-24 Dave Tu <dtu@chromium.org> + + [chromium] Move renderingStats from WebView to WebWidget. + https://bugs.webkit.org/show_bug.cgi?id=92184 + + Reviewed by Adam Barth. + + We are going to add some rendering stats that work in non-composited mode, so the renderingStats() method should be moved from WebView to WebWidget. + + * public/WebView.h: + (WebKit): + (WebView): + * public/WebWidget.h: + (WebKit): + (WebWidget): + (WebKit::WebWidget::renderingStats): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-07-24 Alec Flett <alecflett@chromium.org> + + IndexedDB: fix #include dependencies so IDBRequest isn't an include root + https://bugs.webkit.org/show_bug.cgi?id=92167 + + Reviewed by Tony Chang. + + Remove implicit dependencies due to using IDBRequest.h, and fix all + places that break as a result. + + * src/IDBCallbacksProxy.cpp: + * src/WebIDBDatabaseImpl.cpp: + * src/WebIDBTransactionImpl.cpp: + +2012-07-24 Adam Barth <abarth@webkit.org> + + [Chromium] Support scrolling and zooming to focused input elements + https://bugs.webkit.org/show_bug.cgi?id=91661 + + Reviewed by Darin Fisher. + + This patch introduces saveScrollAndScaleState and + restoreScrollAndScaleState, which can be used to save and restore the + scroll and scale state of the WebView, respectively. These functions + will be used by Chromium on Android to save the scale and scrolls state + before zoom into a text field so that we can "undo" the zoom if the + user didn't mean to zoom into the text field. + + I wanted to write unit tests for these functions, but it wasn't clear + to me how to write the test because startPageScaleAnimation appears to + complete asynchronously. + + * public/WebView.h: + (WebView): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::saveScrollAndScaleState): + (WebKit): + (WebKit::WebViewImpl::restoreScrollAndScaleState): + (WebKit::WebViewImpl::resetSavedScrollAndScaleState): + (WebKit::WebViewImpl::didCommitLoad): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-07-24 Dave Tu <dtu@chromium.org> + + [chromium] Add time spent painting to GPU benchmarking renderingStats() API. + https://bugs.webkit.org/show_bug.cgi?id=90019 + + Reviewed by Adrienne Walker. + + * src/WebLayerTreeView.cpp: + (WebKit::WebLayerTreeView::renderingStats): + * tests/CCLayerTreeHostTest.cpp: + * tests/CCTiledLayerTestCommon.cpp: + (WebKitTests::FakeLayerTextureUpdater::Texture::prepareRect): + (WebKitTests::FakeTiledLayerChromium::update): + * tests/CCTiledLayerTestCommon.h: + (Texture): + (FakeTiledLayerChromium): + * tests/Canvas2DLayerBridgeTest.cpp: + * tests/ContentLayerChromiumTest.cpp: + (WebKit::TEST): + * tests/TiledLayerChromiumTest.cpp: + +2012-07-24 Jian Li <jianli@chromium.org> + + Add per-context setting for html notifications + https://bugs.webkit.org/show_bug.cgi?id=91295 + + Reviewed by Adam Barth. + + Add new per-context feature for chromium port. + + * public/WebPermissionClient.h: + (WebPermissionClient): + (WebKit::WebPermissionClient::allowHTMLNotifications): + * src/ContextFeaturesClientImpl.cpp: + (WebKit::ContextFeaturesClientImpl::askIfIsEnabled): + +2012-07-24 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123499. + http://trac.webkit.org/changeset/123499 + https://bugs.webkit.org/show_bug.cgi?id=92161 + + Android fails to compile (Requested by zhenyao on #webkit). + + * src/AssertMatchingEnums.cpp: + +2012-07-24 Terry Anderson <tdanderson@chromium.org> + + [chromium] Add a bounding box member in WebGestureEvent + https://bugs.webkit.org/show_bug.cgi?id=92144 + + Reviewed by Adam Barth. + + The new |boundingBox| member will be used to store the touch region for a WebGestureEvent. + This will be useful for gesture target fuzzing across multiple different gesture types + (tap, long press, scroll, etc.) + + * public/WebInputEvent.h: + (WebGestureEvent): + * src/WebInputEvent.cpp: + (SameSizeAsWebGestureEvent): + +2012-07-24 Nico Weber <thakis@chromium.org> + + [chromium/mac] Add cursor resource pngs to the pak file. + https://bugs.webkit.org/show_bug.cgi?id=92148 + + Reviewed by Tony Chang. + + Once https://chromiumcodereview.appspot.com/10817031/ has landed, they can be + removed from WebCore.gyp's mac_bundle_resources. Part of http://crbug.com/137588 + + * WebKit.grd: + +2012-07-24 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r123472. + http://trac.webkit.org/changeset/123472 + https://bugs.webkit.org/show_bug.cgi?id=92134 + + Revert roll to v8 version that crashes sporadically (Requested + by atwilson on #webkit). + + * DEPS: + +2012-07-24 Keishi Hattori <keishi@webkit.org> + + [Chromium] Page popup should close on mouse down + https://bugs.webkit.org/show_bug.cgi?id=92092 + + Reviewed by Kent Tamura. + + Page popup should close on mouse down because some elements(e.g. <input type=color>) don't have a blur event that + we can hook to hide the page popup when the user clicks on the page. + + * src/WebPagePopupImpl.h: + (WebKit::WebPagePopupImpl::hasSamePopupClient): Returns true if the given WebPagePopupImpl have the same popup client. + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleMouseDown): Close all popups when the page is clicked. Checks if the + mouse down event opened the same popup we just closed. + 2012-07-24 Jochen Eisinger <jochen@chromium.org> Unreviewed. Rolled DEPS. diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index 2e48b10e1..2aabb4d59 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': '148093' + 'chromium_rev': '148739' } deps = { diff --git a/Source/WebKit/chromium/WebKit.grd b/Source/WebKit/chromium/WebKit.grd index 4da7600ae..c7c251c21 100644 --- a/Source/WebKit/chromium/WebKit.grd +++ b/Source/WebKit/chromium/WebKit.grd @@ -249,6 +249,36 @@ <include name="IDR_AUDIO_SPATIALIZATION_T345_P315" file="..\..\WebCore\platform\audio\resources\IRC_Composite_C_R0195_T345_P315.wav" type="BINDATA"/> <include name="IDR_AUDIO_SPATIALIZATION_T345_P330" file="..\..\WebCore\platform\audio\resources\IRC_Composite_C_R0195_T345_P330.wav" type="BINDATA"/> <include name="IDR_AUDIO_SPATIALIZATION_T345_P345" file="..\..\WebCore\platform\audio\resources\IRC_Composite_C_R0195_T345_P345.wav" type="BINDATA"/> + <if expr="is_macosx"> + <include name="IDR_ALIAS_CURSOR" file="../../WebCore/Resources/aliasCursor.png" type="BINDATA" /> + <include name="IDR_CELL_CURSOR" file="../../WebCore/Resources/cellCursor.png" type="BINDATA" /> + <include name="IDR_CONTEXTMENU_CURSOR" file="../../WebCore/Resources/contextMenuCursor.png" type="BINDATA" /> + <include name="IDR_COPY_CURSOR" file="../../WebCore/Resources/copyCursor.png" type="BINDATA" /> + <include name="IDR_EAST_RESIZE_CURSOR" file="../../WebCore/Resources/eastResizeCursor.png" type="BINDATA" /> + <include name="IDR_EASTWEST_RESIZE_CURSOR" file="../../WebCore/Resources/eastWestResizeCursor.png" type="BINDATA" /> + <include name="IDR_HELP_CURSOR" file="../../WebCore/Resources/helpCursor.png" type="BINDATA" /> + <include name="IDR_LINK_CURSOR" file="../../WebCore/Resources/linkCursor.png" type="BINDATA" /> + <include name="IDR_MISSING_IMAGE_CURSOR" file="../../WebCore/Resources/missingImage.png" type="BINDATA" /> + <include name="IDR_MOVE_CURSOR" file="../../WebCore/Resources/moveCursor.png" type="BINDATA" /> + <include name="IDR_NODROP_CURSOR" file="../../WebCore/Resources/noDropCursor.png" type="BINDATA" /> + <include name="IDR_NONE_CURSOR" file="../../WebCore/Resources/noneCursor.png" type="BINDATA" /> + <include name="IDR_NORTHEAST_RESIZE_CURSOR" file="../../WebCore/Resources/northEastResizeCursor.png" type="BINDATA" /> + <include name="IDR_NORTHEASTSOUTHWEST_RESIZE_CURSOR" file="../../WebCore/Resources/northEastSouthWestResizeCursor.png" type="BINDATA" /> + <include name="IDR_NORTH_RESIZE_CURSOR" file="../../WebCore/Resources/northResizeCursor.png" type="BINDATA" /> + <include name="IDR_NORTHSOUTH_RESIZE_CURSOR" file="../../WebCore/Resources/northSouthResizeCursor.png" type="BINDATA" /> + <include name="IDR_NORTHWEST_RESIZE_CURSOR" file="../../WebCore/Resources/northWestResizeCursor.png" type="BINDATA" /> + <include name="IDR_NORTHWESTSOUTHEAST_RESIZE_CURSOR" file="../../WebCore/Resources/northWestSouthEastResizeCursor.png" type="BINDATA" /> + <include name="IDR_PROGRESS_CURSOR" file="../../WebCore/Resources/progressCursor.png" type="BINDATA" /> + <include name="IDR_SOUTHEAST_RESIZE_CURSOR" file="../../WebCore/Resources/southEastResizeCursor.png" type="BINDATA" /> + <include name="IDR_SOUTH_RESIZE_CURSOR" file="../../WebCore/Resources/southResizeCursor.png" type="BINDATA" /> + <include name="IDR_SOUTHWEST_RESIZE_CURSOR" file="../../WebCore/Resources/southWestResizeCursor.png" type="BINDATA" /> + <include name="IDR_VERTICALTEXT_CURSOR" file="../../WebCore/Resources/verticalTextCursor.png" type="BINDATA" /> + <include name="IDR_WAIT_CURSOR" file="../../WebCore/Resources/waitCursor.png" type="BINDATA" /> + <include name="IDR_WEST_RESIZE_CURSOR" file="../../WebCore/Resources/westResizeCursor.png" type="BINDATA" /> + <include name="IDR_ZOOMIN_CURSOR" file="../../WebCore/Resources/zoomInCursor.png" type="BINDATA" /> + <include name="IDR_ZOOMOUT_CURSOR" file="../../WebCore/Resources/zoomOutCursor.png" type="BINDATA" /> + </if> + </includes> </release> </grit> diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index 831241de4..b507189db 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -125,6 +125,7 @@ 'tests/ListenerLeakTest.cpp', 'tests/LocalizedDateICUTest.cpp', 'tests/LocalizedNumberICUTest.cpp', + 'tests/MemoryInfo.cpp', 'tests/MockCCQuadCuller.h', 'tests/OpaqueRectTrackingContentLayerDelegateTest.cpp', 'tests/OpenTypeVerticalDataTest.cpp', diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index 3432342a9..6aa57be3d 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -42,6 +42,7 @@ 'ENABLE_CSS_BOX_DECORATION_BREAK=1', 'ENABLE_CSS_EXCLUSIONS=1', 'ENABLE_CSS_FILTERS=1', + 'ENABLE_CSS_COMPOSITING=0', 'ENABLE_CSS_IMAGE_SET=1', 'ENABLE_CSS_IMAGE_RESOLUTION=0', 'ENABLE_CSS_REGIONS=1', @@ -68,6 +69,11 @@ 'ENABLE_IFRAME_SEAMLESS=1', 'ENABLE_INDEXED_DATABASE=1', 'ENABLE_INPUT_TYPE_DATE=1', + 'ENABLE_INPUT_TYPE_DATETIME=1', + 'ENABLE_INPUT_TYPE_DATETIMELOCAL=1', + 'ENABLE_INPUT_TYPE_MONTH=1', + 'ENABLE_INPUT_TYPE_TIME=1', + 'ENABLE_INPUT_TYPE_WEEK=1', 'ENABLE_JAVASCRIPT_DEBUGGER=1', 'ENABLE_LEGACY_CSS_VENDOR_PREFIXES=0', 'ENABLE_LEGACY_VIEWPORT_ADAPTION=1', @@ -143,11 +149,6 @@ 'ENABLE_CALENDAR_PICKER=0', 'ENABLE_INPUT_SPEECH=0', 'ENABLE_INPUT_TYPE_COLOR=0', - 'ENABLE_INPUT_TYPE_DATETIME=1', - 'ENABLE_INPUT_TYPE_DATETIMELOCAL=1', - 'ENABLE_INPUT_TYPE_MONTH=1', - 'ENABLE_INPUT_TYPE_TIME=1', - 'ENABLE_INPUT_TYPE_WEEK=1', 'ENABLE_JAVASCRIPT_I18N_API=0', 'ENABLE_LEGACY_NOTIFICATIONS=0', 'ENABLE_MEDIA_CAPTURE=1', diff --git a/Source/WebKit/chromium/public/WebFrameClient.h b/Source/WebKit/chromium/public/WebFrameClient.h index 62b5f0de8..bc32d6d84 100644 --- a/Source/WebKit/chromium/public/WebFrameClient.h +++ b/Source/WebKit/chromium/public/WebFrameClient.h @@ -346,6 +346,15 @@ public: WebFrame*, WebFileSystem::Type, long long size, bool create, WebFileSystemCallbacks*) { } + // Deletes FileSystem. + // WebFileSystemCallbacks::didSucceed() must be called when the operation + // is completed successfully. WebFileSystemCallbacks::didFail() must be + // called otherwise. + // All in-flight operations and following operations may fail after the + // FileSystem is deleted. + virtual void deleteFileSystem( + WebFrame*, WebFileSystem::Type, WebFileSystemCallbacks*) { } + // Quota --------------------------------------------------------- // Queries the origin's storage usage and quota information. diff --git a/Source/WebKit/chromium/public/WebIDBCallbacks.h b/Source/WebKit/chromium/public/WebIDBCallbacks.h index a63c0bc9e..ce100f295 100644 --- a/Source/WebKit/chromium/public/WebIDBCallbacks.h +++ b/Source/WebKit/chromium/public/WebIDBCallbacks.h @@ -58,7 +58,9 @@ public: virtual void onSuccess(const WebSerializedScriptValue&, const WebIDBKey&, const WebIDBKeyPath&) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onSuccessWithContinuation() { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onBlocked() { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onBlocked(long long oldVersion) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onSuccessWithPrefetch(const WebVector<WebIDBKey>& keys, const WebVector<WebIDBKey>& primaryKeys, const WebVector<WebSerializedScriptValue>& values) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onUpgradeNeeded(long long oldVersion, WebIDBTransaction*, WebIDBDatabase*) { WEBKIT_ASSERT_NOT_REACHED(); } }; } // namespace WebKit diff --git a/Source/WebKit/chromium/public/WebIDBDatabaseCallbacks.h b/Source/WebKit/chromium/public/WebIDBDatabaseCallbacks.h index 838a71ff9..0907b8bf0 100644 --- a/Source/WebKit/chromium/public/WebIDBDatabaseCallbacks.h +++ b/Source/WebKit/chromium/public/WebIDBDatabaseCallbacks.h @@ -35,6 +35,7 @@ class WebIDBDatabaseCallbacks { public: virtual ~WebIDBDatabaseCallbacks() { } + virtual void onVersionChange(long long oldVersion, long long newVersion) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onVersionChange(const WebString& requestedVersion) { WEBKIT_ASSERT_NOT_REACHED(); } }; diff --git a/Source/WebKit/chromium/public/WebIDBFactory.h b/Source/WebKit/chromium/public/WebIDBFactory.h index e956ebded..f10a8eb9a 100644 --- a/Source/WebKit/chromium/public/WebIDBFactory.h +++ b/Source/WebKit/chromium/public/WebIDBFactory.h @@ -31,6 +31,7 @@ #include "WebDOMStringList.h" #include "WebIDBCallbacks.h" +#include "WebIDBMetadata.h" #include "WebSecurityOrigin.h" #include "platform/WebCommon.h" #include "platform/WebString.h" @@ -53,8 +54,15 @@ public: virtual void getDatabaseNames(WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } + // FIXME: Delete this method when derived classes in chromium have + // implemented the other open method. + virtual void open(const WebString& name, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir) + { + open(name, WebIDBMetadata::NoIntVersion, callbacks, origin, frame, dataDir); + } + // The WebKit implementation of open ignores the WebFrame* parameter. - virtual void open(const WebString& name, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void open(const WebString& name, long long version, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void deleteDatabase(const WebString& name, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } }; diff --git a/Source/WebKit/chromium/public/WebInputEvent.h b/Source/WebKit/chromium/public/WebInputEvent.h index b7a5ecbd2..40a6fdb3e 100644 --- a/Source/WebKit/chromium/public/WebInputEvent.h +++ b/Source/WebKit/chromium/public/WebInputEvent.h @@ -33,6 +33,7 @@ #include "WebTouchPoint.h" #include "platform/WebCommon.h" +#include "platform/WebRect.h" #include <string.h> @@ -372,6 +373,7 @@ public: // NOTE: |deltaX| and |deltaY| represents the amount to scroll for Scroll gesture events. For Pinch gesture events, |deltaX| represents the scaling/magnification factor. For a GestureTap event, |deltaX| and |deltaY| represent the horizontal and vertical radii of the touch region. float deltaX; float deltaY; + WebRect boundingBox; WebGestureEvent(unsigned sizeParam = sizeof(WebGestureEvent)) : WebInputEvent(sizeParam) diff --git a/Source/WebKit/chromium/public/WebPermissionClient.h b/Source/WebKit/chromium/public/WebPermissionClient.h index 014c2c3f4..5adcde2e0 100644 --- a/Source/WebKit/chromium/public/WebPermissionClient.h +++ b/Source/WebKit/chromium/public/WebPermissionClient.h @@ -93,6 +93,9 @@ public: // Controls whether enabling Web Components API for this frame. virtual bool allowWebComponents(const WebDocument&, bool defaultValue) { return defaultValue; } + // Controls whether enabling HTML notifications for this frame. + virtual bool allowHTMLNotifications(const WebDocument&) { return true; } + // Notifies the client that the frame would have instantiated a plug-in if plug-ins were enabled. virtual void didNotAllowPlugins(WebFrame*) { } diff --git a/Source/WebKit/chromium/public/WebRuntimeFeatures.h b/Source/WebKit/chromium/public/WebRuntimeFeatures.h index a0dd04997..c3d61d85a 100644 --- a/Source/WebKit/chromium/public/WebRuntimeFeatures.h +++ b/Source/WebKit/chromium/public/WebRuntimeFeatures.h @@ -139,6 +139,21 @@ public: WEBKIT_EXPORT static void enableInputTypeDate(bool); WEBKIT_EXPORT static bool isInputTypeDateEnabled(); + WEBKIT_EXPORT static void enableInputTypeDateTime(bool); + WEBKIT_EXPORT static bool isInputTypeDateTimeEnabled(); + + WEBKIT_EXPORT static void enableInputTypeDateTimeLocal(bool); + WEBKIT_EXPORT static bool isInputTypeDateTimeLocalEnabled(); + + WEBKIT_EXPORT static void enableInputTypeMonth(bool); + WEBKIT_EXPORT static bool isInputTypeMonthEnabled(); + + WEBKIT_EXPORT static void enableInputTypeTime(bool); + WEBKIT_EXPORT static bool isInputTypeTimeEnabled(); + + WEBKIT_EXPORT static void enableInputTypeWeek(bool); + WEBKIT_EXPORT static bool isInputTypeWeekEnabled(); + WEBKIT_EXPORT static void enableDialogElement(bool); WEBKIT_EXPORT static bool isDialogElementEnabled(); diff --git a/Source/WebKit/chromium/public/WebView.h b/Source/WebKit/chromium/public/WebView.h index 0085ba51a..4da3363dd 100644 --- a/Source/WebKit/chromium/public/WebView.h +++ b/Source/WebKit/chromium/public/WebView.h @@ -63,7 +63,6 @@ struct WebActiveWheelFlingParameters; struct WebMediaPlayerAction; struct WebPluginAction; struct WebPoint; -struct WebRenderingStats; class WebView : public WebWidget { public: @@ -254,6 +253,14 @@ public: virtual float minimumPageScaleFactor() const = 0; virtual float maximumPageScaleFactor() const = 0; + // Save the WebView's current scroll and scale state. Each call to this function + // overwrites the previously saved scroll and scale state. + virtual void saveScrollAndScaleState() = 0; + + // Restore the previously saved scroll and scale state. After restroing the + // state, this function deletes any saved scroll and scale state. + virtual void restoreScrollAndScaleState() = 0; + // Prevent the web page from setting a maximum scale via the viewport meta // tag. This is an accessibility feature that lets folks zoom in to web // pages even if the web page tries to block scaling. @@ -454,10 +461,6 @@ public: virtual bool isSelectionEditable() const = 0; - // Fills in a WebRenderingStats struct containing information about the state of the compositor. - // This call is relatively expensive in threaded mode as it blocks on the compositor thread. - virtual void renderingStats(WebRenderingStats&) const { } - // Benchmarking support -------------------------------------------- virtual WebViewBenchmarkSupport* benchmarkSupport() { return 0; } diff --git a/Source/WebKit/chromium/public/WebViewBenchmarkSupport.h b/Source/WebKit/chromium/public/WebViewBenchmarkSupport.h index c8ace3622..c395e37b0 100644 --- a/Source/WebKit/chromium/public/WebViewBenchmarkSupport.h +++ b/Source/WebKit/chromium/public/WebViewBenchmarkSupport.h @@ -51,14 +51,15 @@ public: // when painting is about to occur and when painting is complete. class PaintClient { public: - virtual WebCanvas* createCanvas(const WebSize&) = 0; - - // Called by the WebViewBenchmarkSupport when painting is about to - // occur. - virtual void willPaint(const WebCanvas&) { } + // Called by the WebViewBenchmarkSupport when painting is about to occur. + // PaintClient is expected to return an appropriately-sized canvas + // for the WebViewBenchmarkSupport to paint on. + virtual WebCanvas* willPaint(const WebSize&) { return 0; } // Called by the WebViewBenchmarkSupport when painting is complete. - virtual void didPaint(const WebCanvas&) { } + // The canvas will not be used after this call and can be destroyed + // if necessary. + virtual void didPaint(WebCanvas*) { } protected: virtual ~PaintClient() { } }; diff --git a/Source/WebKit/chromium/public/WebWidget.h b/Source/WebKit/chromium/public/WebWidget.h index 600c523f8..b2a57d66e 100644 --- a/Source/WebKit/chromium/public/WebWidget.h +++ b/Source/WebKit/chromium/public/WebWidget.h @@ -48,6 +48,7 @@ class WebInputEvent; class WebMouseEvent; class WebString; struct WebPoint; +struct WebRenderingStats; template <typename T> class WebVector; class WebWidget { @@ -221,6 +222,10 @@ public: // following the call to instrumentBeginFrame(). virtual void instrumentCancelFrame() { } + // Fills in a WebRenderingStats struct containing information about the state of the compositor. + // This call is relatively expensive in threaded mode as it blocks on the compositor thread. + virtual void renderingStats(WebRenderingStats&) const { } + // The page background color. Can be used for filling in areas without // content. virtual WebColor backgroundColor() const { return 0xFFFFFFFF; /* SK_ColorWHITE */ } diff --git a/Source/WebKit/chromium/scripts/generate_devtools_extension_api.py b/Source/WebKit/chromium/scripts/generate_devtools_extension_api.py index fbb878df2..d6d9826cb 100644 --- a/Source/WebKit/chromium/scripts/generate_devtools_extension_api.py +++ b/Source/WebKit/chromium/scripts/generate_devtools_extension_api.py @@ -41,7 +41,7 @@ def write_devtools_extension_api(output, input_names): output.write(""" var tabId; var extensionInfo = {}; - platformExtensionAPI(injectedExtensionAPI("remote-" + top.frames.length)); + platformExtensionAPI(injectedExtensionAPI("remote-" + window.parent.frames.length)); })();""") diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index 789d1b623..5f250351a 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -537,6 +537,9 @@ COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStatePreview, PageVisibilityStateP #if ENABLE(MEDIA_STREAM) COMPILE_ASSERT_MATCHING_ENUM(WebMediaStreamSource::TypeAudio, MediaStreamSource::TypeAudio); COMPILE_ASSERT_MATCHING_ENUM(WebMediaStreamSource::TypeVideo, MediaStreamSource::TypeVideo); +COMPILE_ASSERT_MATCHING_ENUM(WebMediaStreamSource::ReadyStateLive, MediaStreamSource::ReadyStateLive); +COMPILE_ASSERT_MATCHING_ENUM(WebMediaStreamSource::ReadyStateMuted, MediaStreamSource::ReadyStateMuted); +COMPILE_ASSERT_MATCHING_ENUM(WebMediaStreamSource::ReadyStateEnded, MediaStreamSource::ReadyStateEnded); COMPILE_ASSERT_MATCHING_ENUM(WebICEOptions::CandidateTypeAll, IceOptions::ALL); COMPILE_ASSERT_MATCHING_ENUM(WebICEOptions::CandidateTypeNoRelay, IceOptions::NO_RELAY); diff --git a/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp b/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp index 63e16726e..bc4cfb834 100644 --- a/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp @@ -143,6 +143,8 @@ bool ContextFeaturesClientImpl::askIfIsEnabled(Document* document, ContextFeatur case ContextFeatures::ShadowDOM: case ContextFeatures::StyleScoped: return m_client->allowWebComponents(WebDocument(document), defaultValue); + case ContextFeatures::HTMLNotifications: + return m_client->allowHTMLNotifications(WebDocument(document)); default: return defaultValue; } diff --git a/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp b/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp index a544189b6..7df84d2ff 100644 --- a/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp +++ b/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp @@ -31,8 +31,12 @@ #if ENABLE(INDEXED_DATABASE) +#include "IDBCursorBackendInterface.h" +#include "IDBDatabaseBackendInterface.h" #include "IDBDatabaseBackendProxy.h" #include "IDBDatabaseError.h" +#include "IDBObjectStoreBackendInterface.h" +#include "IDBTransactionBackendInterface.h" #include "WebIDBCallbacks.h" #include "WebIDBCursorImpl.h" #include "WebIDBDatabaseImpl.h" diff --git a/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp b/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp index ca390ba90..277a665cf 100644 --- a/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp @@ -69,11 +69,6 @@ PassRefPtr<SerializedScriptValue> IDBCursorBackendProxy::value() const return m_idbCursor->value(); } -void IDBCursorBackendProxy::update(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBCallbacks> callbacks, ExceptionCode& ec) -{ - m_idbCursor->update(value, new WebIDBCallbacksImpl(callbacks), ec); -} - void IDBCursorBackendProxy::advance(unsigned long count, PassRefPtr<IDBCallbacks> callbacks, ExceptionCode& ec) { m_idbCursor->advance(count, new WebIDBCallbacksImpl(callbacks), ec); diff --git a/Source/WebKit/chromium/src/IDBCursorBackendProxy.h b/Source/WebKit/chromium/src/IDBCursorBackendProxy.h index 9e4b57008..d742f68e5 100644 --- a/Source/WebKit/chromium/src/IDBCursorBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBCursorBackendProxy.h @@ -45,7 +45,6 @@ public: virtual PassRefPtr<WebCore::IDBKey> key() const; virtual PassRefPtr<WebCore::IDBKey> primaryKey() const; virtual PassRefPtr<WebCore::SerializedScriptValue> value() const; - virtual void update(PassRefPtr<WebCore::SerializedScriptValue>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::ExceptionCode&); virtual void advance(unsigned long, PassRefPtr<WebCore::IDBCallbacks>, WebCore::ExceptionCode&); virtual void continueFunction(PassRefPtr<WebCore::IDBKey>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::ExceptionCode&); virtual void deleteFunction(PassRefPtr<WebCore::IDBCallbacks>, WebCore::ExceptionCode&); diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp index 826407330..4d1c91d07 100755 --- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp @@ -67,14 +67,6 @@ void IDBObjectStoreBackendProxy::get(PassRefPtr<IDBKeyRange> keyRange, PassRefPt m_webIDBObjectStore->get(keyRange, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec); } -void IDBObjectStoreBackendProxy::put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) -{ - // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, - // all implementations of IDB interfaces are proxy objects. - IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction); - m_webIDBObjectStore->put(value, key, static_cast<WebIDBObjectStore::PutMode>(putMode), new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec); -} - void IDBObjectStoreBackendProxy::putWithIndexKeys(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, const Vector<String>& indexNames, const Vector<IndexKeys>& indexKeys, ExceptionCode& ec) { // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h index c64028cff..0235077fa 100644 --- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h @@ -44,7 +44,6 @@ public: virtual ~IDBObjectStoreBackendProxy(); virtual void get(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); - virtual void put(PassRefPtr<WebCore::SerializedScriptValue>, PassRefPtr<WebCore::IDBKey>, PutMode, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); virtual void putWithIndexKeys(PassRefPtr<WebCore::SerializedScriptValue>, PassRefPtr<WebCore::IDBKey>, PutMode, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, const WTF::Vector<WTF::String>&, const WTF::Vector<IndexKeys>&, WebCore::ExceptionCode&); virtual void deleteFunction(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); virtual void clear(PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); diff --git a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp index 6fded29ff..d22412ac8 100644 --- a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp @@ -183,6 +183,11 @@ static void openFileSystemNotAllowed(ScriptExecutionContext*, PassOwnPtr<AsyncFi callbacks->didFail(WebKit::WebFileErrorAbort); } +static void deleteFileSystemNotAllowed(ScriptExecutionContext*, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + callbacks->didFail(WebKit::WebFileErrorAbort); +} + static void openFileSystemHelper(ScriptExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemSynchronousType synchronousType, long long size, CreationFlag create) { bool allowed = true; @@ -226,6 +231,22 @@ void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, FileSys openFileSystemHelper(context, type, callbacks, synchronousType, size, CreateIfNotPresent); } +void LocalFileSystem::deleteFileSystem(ScriptExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + ASSERT(context); + ASSERT(context->isDocument()); + + Document* document = static_cast<Document*>(context); + WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); + WebKit::WebViewImpl* webView = webFrame->viewImpl(); + if (webView->permissionClient() && !webView->permissionClient()->allowFileSystem(webFrame)) { + context->postTask(createCallbackTask(&deleteFileSystemNotAllowed, callbacks)); + return; + } + + webFrame->client()->deleteFileSystem(webFrame, static_cast<WebFileSystem::Type>(type), new WebFileSystemCallbacksImpl(callbacks)); +} + } // namespace WebCore #endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index 0cfbac209..f821562f6 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -1465,10 +1465,10 @@ VisiblePosition WebFrameImpl::visiblePositionForWindowPoint(const WebPoint& poin HitTestRequest::HitTestRequestType hitType = HitTestRequest::Move; hitType |= HitTestRequest::ReadOnly; hitType |= HitTestRequest::Active; + hitType |= HitTestRequest::IgnoreClipping; HitTestRequest request(hitType); FrameView* view = frame()->view(); - HitTestResult result(view->windowToContents( - view->convertFromContainingWindow(IntPoint(point.x, point.y)))); + HitTestResult result(view->windowToContents(IntPoint(point.x, point.y))); frame()->document()->renderView()->layer()->hitTest(request, result); diff --git a/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp b/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp index e9c0e04af..0d65a87be 100644 --- a/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp @@ -62,11 +62,6 @@ WebSerializedScriptValue WebIDBCursorImpl::value() const return m_idbCursorBackend->value(); } -void WebIDBCursorImpl::update(const WebSerializedScriptValue& value, WebIDBCallbacks* callbacks, WebExceptionCode& ec) -{ - m_idbCursorBackend->update(value, IDBCallbacksProxy::create(adoptPtr(callbacks)), ec); -} - void WebIDBCursorImpl::advance(unsigned long count, WebIDBCallbacks* callbacks, WebExceptionCode& ec) { m_idbCursorBackend->advance(count, IDBCallbacksProxy::create(adoptPtr(callbacks)), ec); diff --git a/Source/WebKit/chromium/src/WebIDBCursorImpl.h b/Source/WebKit/chromium/src/WebIDBCursorImpl.h index f0d387b62..45a229b38 100644 --- a/Source/WebKit/chromium/src/WebIDBCursorImpl.h +++ b/Source/WebKit/chromium/src/WebIDBCursorImpl.h @@ -47,7 +47,6 @@ public: virtual WebIDBKey key() const; virtual WebIDBKey primaryKey() const; virtual WebSerializedScriptValue value() const; - virtual void update(const WebSerializedScriptValue&, WebIDBCallbacks*, WebExceptionCode&); virtual void advance(unsigned long, WebIDBCallbacks*, WebExceptionCode&); virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*, WebExceptionCode&); virtual void deleteFunction(WebIDBCallbacks*, WebExceptionCode&); diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp index 18573cacf..bc6d09fa1 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp @@ -33,6 +33,7 @@ #include "IDBDatabaseBackendInterface.h" #include "IDBDatabaseCallbacksProxy.h" #include "IDBMetadata.h" +#include "IDBObjectStoreBackendInterface.h" #include "IDBTransactionBackendInterface.h" #include "WebIDBCallbacks.h" #include "WebIDBDatabaseCallbacks.h" diff --git a/Source/WebKit/chromium/src/WebIDBFactoryImpl.cpp b/Source/WebKit/chromium/src/WebIDBFactoryImpl.cpp index d875e11bc..d14ac71e1 100755 --- a/Source/WebKit/chromium/src/WebIDBFactoryImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBFactoryImpl.cpp @@ -69,6 +69,13 @@ void WebIDBFactoryImpl::open(const WebString& name, WebIDBCallbacks* callbacks, m_idbFactoryBackend->open(name, IDBCallbacksProxy::create(adoptPtr(callbacks)).get(), origin, 0, dataDir); } +void WebIDBFactoryImpl::open(const WebString& name, long long version, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*, const WebString& dataDir) +{ + // FIXME: Pass version along when WebCore::IDBFactoryBackendInterface + // has an open method that accepts it. + m_idbFactoryBackend->open(name, IDBCallbacksProxy::create(adoptPtr(callbacks)).get(), origin, 0, dataDir); +} + void WebIDBFactoryImpl::deleteDatabase(const WebString& name, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*, const WebString& dataDir) { m_idbFactoryBackend->deleteDatabase(name, IDBCallbacksProxy::create(adoptPtr(callbacks)), origin, 0, dataDir); diff --git a/Source/WebKit/chromium/src/WebIDBFactoryImpl.h b/Source/WebKit/chromium/src/WebIDBFactoryImpl.h index b3e474df9..fa438d764 100644 --- a/Source/WebKit/chromium/src/WebIDBFactoryImpl.h +++ b/Source/WebKit/chromium/src/WebIDBFactoryImpl.h @@ -46,6 +46,7 @@ public: virtual void getDatabaseNames(WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir); virtual void open(const WebString& name, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir); + virtual void open(const WebString& name, long long version, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir); virtual void deleteDatabase(const WebString& name, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir); private: diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp index 53d140f42..22a066807 100755 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp @@ -58,11 +58,6 @@ void WebIDBObjectStoreImpl::get(const WebIDBKeyRange& keyRange, WebIDBCallbacks* m_objectStore->get(keyRange, IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec); } -void WebIDBObjectStoreImpl::put(const WebSerializedScriptValue& value, const WebIDBKey& key, PutMode putMode, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec) -{ - m_objectStore->put(value, key, static_cast<IDBObjectStoreBackendInterface::PutMode>(putMode), IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec); -} - void WebIDBObjectStoreImpl::putWithIndexKeys(const WebSerializedScriptValue& value, const WebIDBKey& key, PutMode putMode, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, const WebVector<WebString>& webIndexNames, const WebVector<WebIndexKeys>& webIndexKeys, WebExceptionCode& ec) { ASSERT(webIndexNames.size() == webIndexKeys.size()); diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h index e6dc88f54..934cffa99 100644 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h @@ -46,7 +46,6 @@ public: ~WebIDBObjectStoreImpl(); void get(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); - void put(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); void putWithIndexKeys(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, const WebVector<WebString>& indexNames, const WebVector<WebIndexKeys>&, WebExceptionCode&); void deleteFunction(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); void clear(WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); diff --git a/Source/WebKit/chromium/src/WebIDBTransactionImpl.cpp b/Source/WebKit/chromium/src/WebIDBTransactionImpl.cpp index 94610eba9..5cbbee663 100644 --- a/Source/WebKit/chromium/src/WebIDBTransactionImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBTransactionImpl.cpp @@ -28,6 +28,7 @@ #if ENABLE(INDEXED_DATABASE) +#include "IDBObjectStoreBackendInterface.h" #include "IDBTransaction.h" #include "IDBTransactionCallbacksProxy.h" #include "WebIDBObjectStoreImpl.h" diff --git a/Source/WebKit/chromium/src/WebInputEvent.cpp b/Source/WebKit/chromium/src/WebInputEvent.cpp index c0690f8d7..66a0480b4 100644 --- a/Source/WebKit/chromium/src/WebInputEvent.cpp +++ b/Source/WebKit/chromium/src/WebInputEvent.cpp @@ -60,7 +60,7 @@ struct SameSizeAsWebMouseWheelEvent : public SameSizeAsWebMouseEvent { }; struct SameSizeAsWebGestureEvent : public SameSizeAsWebInputEvent { - int gestureData[6]; + int gestureData[10]; }; struct SameSizeAsWebTouchEvent : public SameSizeAsWebInputEvent { diff --git a/Source/WebKit/chromium/src/WebLayerTreeView.cpp b/Source/WebKit/chromium/src/WebLayerTreeView.cpp index 34eb952fd..b87df0f1b 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeView.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeView.cpp @@ -52,6 +52,7 @@ WebLayerTreeView::Settings::operator CCLayerTreeSettings() const settings.refreshRate = refreshRate; settings.defaultTileSize = defaultTileSize; settings.maxUntiledLayerSize = maxUntiledLayerSize; + settings.acceleratePainting = acceleratePainting; // FIXME: showFPSCounter / showPlatformLayerTree / maxPartialTextureUpdates aren't supported currently. return settings; @@ -183,6 +184,8 @@ void WebLayerTreeView::renderingStats(WebRenderingStats& stats) const stats.numAnimationFrames = ccStats.numAnimationFrames; stats.numFramesSentToScreen = ccStats.numFramesSentToScreen; stats.droppedFrameCount = ccStats.droppedFrameCount; + stats.totalPaintTimeInSeconds = ccStats.totalPaintTimeInSeconds; + stats.totalRasterizeTimeInSeconds = ccStats.totalRasterizeTimeInSeconds; } void WebLayerTreeView::loseCompositorContext(int numTimes) diff --git a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp index 6d59cc19c..fd5d2f2ad 100644 --- a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp +++ b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp @@ -190,6 +190,8 @@ bool WebPagePopupImpl::initPage() m_page = adoptPtr(new Page(pageClients)); m_page->settings()->setScriptEnabled(true); m_page->settings()->setAllowScriptsToCloseWindows(true); + m_page->setDeviceScaleFactor(m_webView->deviceScaleFactor()); + m_page->settings()->setDeviceSupportsTouch(m_webView->page()->settings()->deviceSupportsTouch()); static ContextFeaturesClient* pagePopupFeaturesClient = new PagePopupFeaturesClient(); provideContextFeaturesTo(m_page.get(), pagePopupFeaturesClient); diff --git a/Source/WebKit/chromium/src/WebPagePopupImpl.h b/Source/WebKit/chromium/src/WebPagePopupImpl.h index 2e1c8c3f3..2552bacf1 100644 --- a/Source/WebKit/chromium/src/WebPagePopupImpl.h +++ b/Source/WebKit/chromium/src/WebPagePopupImpl.h @@ -63,6 +63,7 @@ public: bool handleKeyEvent(const WebCore::PlatformKeyboardEvent&); void closePopup(); WebWidgetClient* widgetClient() const { return m_widgetClient; } + bool hasSamePopupClient(WebPagePopupImpl* other) { return other && m_popupClient == other->m_popupClient; } private: // WebWidget functions diff --git a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp index 491a30311..ec08f0a0e 100644 --- a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp +++ b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp @@ -462,7 +462,7 @@ bool WebRuntimeFeatures::isVideoTrackEnabled() void WebRuntimeFeatures::enableGamepad(bool enable) { #if ENABLE(GAMEPAD) - RuntimeEnabledFeatures::setWebkitGamepadsEnabled(enable); + RuntimeEnabledFeatures::setWebkitGetGamepadsEnabled(enable); #else UNUSED_PARAM(enable); #endif @@ -471,7 +471,7 @@ void WebRuntimeFeatures::enableGamepad(bool enable) bool WebRuntimeFeatures::isGamepadEnabled() { #if ENABLE(GAMEPAD) - return RuntimeEnabledFeatures::webkitGamepadsEnabled(); + return RuntimeEnabledFeatures::webkitGetGamepadsEnabled(); #else return false; #endif @@ -531,6 +531,96 @@ bool WebRuntimeFeatures::isInputTypeDateEnabled() #endif } +void WebRuntimeFeatures::enableInputTypeDateTime(bool enable) +{ +#if ENABLE(INPUT_TYPE_DATETIME) + RuntimeEnabledFeatures::setInputTypeDateTimeEnabled(enable); +#else + UNUSED_PARAM(enable); +#endif +} + +bool WebRuntimeFeatures::isInputTypeDateTimeEnabled() +{ +#if ENABLE(INPUT_TYPE_DATETIME) + return RuntimeEnabledFeatures::inputTypeDateTimeEnabled(); +#else + return false; +#endif +} + +void WebRuntimeFeatures::enableInputTypeDateTimeLocal(bool enable) +{ +#if ENABLE(INPUT_TYPE_DATETIMELOCAL) + RuntimeEnabledFeatures::setInputTypeDateTimeLocalEnabled(enable); +#else + UNUSED_PARAM(enable); +#endif +} + +bool WebRuntimeFeatures::isInputTypeDateTimeLocalEnabled() +{ +#if ENABLE(INPUT_TYPE_DATETIMELOCAL) + return RuntimeEnabledFeatures::inputTypeDateTimeLocalEnabled(); +#else + return false; +#endif +} + +void WebRuntimeFeatures::enableInputTypeMonth(bool enable) +{ +#if ENABLE(INPUT_TYPE_MONTH) + RuntimeEnabledFeatures::setInputTypeMonthEnabled(enable); +#else + UNUSED_PARAM(enable); +#endif +} + +bool WebRuntimeFeatures::isInputTypeMonthEnabled() +{ +#if ENABLE(INPUT_TYPE_MONTH) + return RuntimeEnabledFeatures::inputTypeMonthEnabled(); +#else + return false; +#endif +} + +void WebRuntimeFeatures::enableInputTypeTime(bool enable) +{ +#if ENABLE(INPUT_TYPE_TIME) + RuntimeEnabledFeatures::setInputTypeTimeEnabled(enable); +#else + UNUSED_PARAM(enable); +#endif +} + +bool WebRuntimeFeatures::isInputTypeTimeEnabled() +{ +#if ENABLE(INPUT_TYPE_TIME) + return RuntimeEnabledFeatures::inputTypeTimeEnabled(); +#else + return false; +#endif +} + +void WebRuntimeFeatures::enableInputTypeWeek(bool enable) +{ +#if ENABLE(INPUT_TYPE_WEEK) + RuntimeEnabledFeatures::setInputTypeWeekEnabled(enable); +#else + UNUSED_PARAM(enable); +#endif +} + +bool WebRuntimeFeatures::isInputTypeWeekEnabled() +{ +#if ENABLE(INPUT_TYPE_WEEK) + return RuntimeEnabledFeatures::inputTypeWeekEnabled(); +#else + return false; +#endif +} + void WebRuntimeFeatures::enableDialogElement(bool enable) { #if ENABLE(DIALOG_ELEMENT) diff --git a/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp b/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp index 2b11f6eb6..9764af138 100644 --- a/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp @@ -47,12 +47,11 @@ namespace WebKit { void WebViewBenchmarkSupportImpl::paintLayer(PaintClient* paintClient, GraphicsLayer& layer, const IntRect& clip) { WebSize canvasSize(clip.width(), clip.height()); - OwnPtr<WebCanvas> canvas = adoptPtr(paintClient->createCanvas(canvasSize)); - GraphicsContextBuilder builder(canvas.get()); + WebCanvas* canvas = paintClient->willPaint(canvasSize); + GraphicsContextBuilder builder(canvas); - paintClient->willPaint(*canvas.get()); layer.paintGraphicsLayerContents(builder.context(), clip); - paintClient->didPaint(*canvas.get()); + paintClient->didPaint(canvas); } void WebViewBenchmarkSupportImpl::acceleratedPaintUnclipped(PaintClient* paintClient, GraphicsLayer& layer) @@ -84,10 +83,9 @@ void WebViewBenchmarkSupportImpl::softwarePaint(PaintClient* paintClient, PaintM } WebSize canvasSize(paintSize.width, paintSize.height); - OwnPtr<WebCanvas> canvas = adoptPtr(paintClient->createCanvas(canvasSize)); - paintClient->willPaint(*canvas.get()); - m_webViewImpl->paint(canvas.get(), paintSize); - paintClient->didPaint(*canvas.get()); + WebCanvas* canvas = paintClient->willPaint(canvasSize); + m_webViewImpl->paint(canvas, paintSize); + paintClient->didPaint(canvas); } void WebViewBenchmarkSupportImpl::paint(PaintClient* paintClient, PaintMode paintMode) diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index 6a253f8e3..7c6da60d9 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -197,6 +197,8 @@ static const float doubleTapZoomContentDefaultMargin = 5; static const float doubleTapZoomContentMinimumMargin = 2; static const double doubleTabZoomAnimationDurationInSeconds = 0.25; +// Constants for zooming in on a focused text field. +static const double scrollAndScaleAnimationDurationInSeconds = 0.2; namespace WebKit { @@ -392,6 +394,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) , m_maximumPageScaleFactor(maxPageScaleFactor) , m_ignoreViewportTagMaximumScale(false) , m_pageScaleFactorIsSet(false) + , m_savedPageScaleFactor(0) , m_contextMenuAllowed(false) , m_doingDragAndDrop(false) , m_ignoreInputEvents(false) @@ -522,14 +525,23 @@ void WebViewImpl::handleMouseLeave(Frame& mainFrame, const WebMouseEvent& event) void WebViewImpl::handleMouseDown(Frame& mainFrame, const WebMouseEvent& event) { - // If there is a select popup open, close it as the user is clicking on - // the page (outside of the popup). We also save it so we can prevent a - // click on the select element from immediately reopening the popup. + // If there is a popup open, close it as the user is clicking on the page (outside of the + // popup). We also save it so we can prevent a click on an element from immediately + // reopening the same popup. RefPtr<WebCore::PopupContainer> selectPopup; +#if ENABLE(PAGE_POPUP) + RefPtr<WebPagePopupImpl> pagePopup; +#endif if (event.button == WebMouseEvent::ButtonLeft) { selectPopup = m_selectPopup; - hideSelectPopup(); +#if ENABLE(PAGE_POPUP) + pagePopup = m_pagePopup; +#endif + hidePopups(); ASSERT(!m_selectPopup); +#if ENABLE(PAGE_POPUP) + ASSERT(!m_pagePopup); +#endif } m_lastMouseDownPoint = WebPoint(event.x, event.y); @@ -555,6 +567,14 @@ void WebViewImpl::handleMouseDown(Frame& mainFrame, const WebMouseEvent& event) hideSelectPopup(); } +#if ENABLE(PAGE_POPUP) + if (m_pagePopup && pagePopup && m_pagePopup->hasSamePopupClient(pagePopup.get())) { + // That click triggered a page popup that is the same as the one we just closed. + // It needs to be closed. + closePagePopup(m_pagePopup.get()); + } +#endif + // Dispatch the contextmenu event regardless of if the click was swallowed. // On Windows, we handle it on mouse up, not down. #if OS(DARWIN) @@ -2713,6 +2733,33 @@ float WebViewImpl::maximumPageScaleFactor() const return m_maximumPageScaleFactor; } +void WebViewImpl::saveScrollAndScaleState() +{ + m_savedPageScaleFactor = pageScaleFactor(); + m_savedScrollOffset = mainFrame()->scrollOffset(); +} + +void WebViewImpl::restoreScrollAndScaleState() +{ + if (!m_savedPageScaleFactor) + return; + +#if ENABLE(GESTURE_EVENTS) + startPageScaleAnimation(IntPoint(m_savedScrollOffset), false, m_savedPageScaleFactor, scrollAndScaleAnimationDurationInSeconds); +#else + setPageScaleFactor(m_savedPageScaleFactor, WebPoint()); + mainFrame()->setScrollOffset(m_savedScrollOffset); +#endif + + resetSavedScrollAndScaleState(); +} + +void WebViewImpl::resetSavedScrollAndScaleState() +{ + m_savedPageScaleFactor = 0; + m_savedScrollOffset = IntSize(); +} + WebSize WebViewImpl::fixedLayoutSize() const { if (!page()) @@ -3246,6 +3293,7 @@ void WebViewImpl::didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPa m_pageScaleFactorIsSet = false; m_gestureAnimation.clear(); + resetSavedScrollAndScaleState(); } void WebViewImpl::layoutUpdated(WebFrameImpl* webframe) diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index 1155969fd..639d5e61a 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -174,6 +174,7 @@ public: virtual void didChangeWindowResizerRect(); virtual void instrumentBeginFrame(); virtual void instrumentCancelFrame(); + virtual void renderingStats(WebRenderingStats&) const; // WebView methods: virtual void initializeMainFrame(WebFrameClient*); @@ -220,6 +221,8 @@ public: virtual void setPageScaleFactorLimits(float minPageScale, float maxPageScale); virtual float minimumPageScaleFactor() const; virtual float maximumPageScaleFactor() const; + virtual void saveScrollAndScaleState(); + virtual void restoreScrollAndScaleState(); virtual void setIgnoreViewportTagMaximumScale(bool); virtual float deviceScaleFactor() const; @@ -296,7 +299,6 @@ public: virtual void updateBatteryStatus(const WebBatteryStatus&); #endif virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&); - virtual void renderingStats(WebRenderingStats&) const; virtual WebViewBenchmarkSupport* benchmarkSupport(); // WebLayerTreeViewClient @@ -579,6 +581,8 @@ private: float clampPageScaleFactorToLimits(float scale); WebPoint clampOffsetAtScale(const WebPoint& offset, float scale); + void resetSavedScrollAndScaleState(); + friend class WebView; // So WebView::Create can call our constructor friend class WTF::RefCounted<WebViewImpl>; @@ -707,15 +711,18 @@ private: double m_maximumZoomLevel; + // State related to the page scale float m_pageDefinedMinimumPageScaleFactor; float m_pageDefinedMaximumPageScaleFactor; float m_minimumPageScaleFactor; float m_maximumPageScaleFactor; - bool m_ignoreViewportTagMaximumScale; - bool m_pageScaleFactorIsSet; + // Saved page scale state. + float m_savedPageScaleFactor; // 0 means that no page scale factor is saved. + WebCore::IntSize m_savedScrollOffset; + bool m_contextMenuAllowed; bool m_doingDragAndDrop; diff --git a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp index 9aa412090..8294ca622 100644 --- a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp @@ -46,8 +46,6 @@ namespace { void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* root, Vector<CCLayerImpl*>& renderSurfaceLayerList) { CCLayerSorter layerSorter; - WebTransformationMatrix identityMatrix; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; // Sanity check: The test itself should create the root layer's render surface, so @@ -56,9 +54,7 @@ void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* root, Vector<CCLay ASSERT_TRUE(root->renderSurface()); ASSERT_FALSE(renderSurfaceLayerList.size()); - root->renderSurface()->clearLayerList(); - renderSurfaceLayerList.append(root); - CCLayerTreeHostCommon::calculateDrawTransforms(root, root, identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, &layerSorter, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, &layerSorter, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, root->renderSurface()->contentRect()); } @@ -99,6 +95,7 @@ PassOwnPtr<CCLayerImpl> createTestTreeWithOneSurface() root->setPosition(FloatPoint::zero()); root->setAnchorPoint(FloatPoint::zero()); root->setBounds(IntSize(500, 500)); + root->setContentBounds(IntSize(500, 500)); root->setDrawsContent(true); root->createRenderSurface(); root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(500, 500))); @@ -106,6 +103,7 @@ PassOwnPtr<CCLayerImpl> createTestTreeWithOneSurface() child->setPosition(FloatPoint(100, 100)); child->setAnchorPoint(FloatPoint::zero()); child->setBounds(IntSize(30, 30)); + child->setContentBounds(IntSize(30, 30)); child->setDrawsContent(true); root->addChild(child.release()); @@ -127,6 +125,7 @@ PassOwnPtr<CCLayerImpl> createTestTreeWithTwoSurfaces() root->setPosition(FloatPoint::zero()); root->setAnchorPoint(FloatPoint::zero()); root->setBounds(IntSize(500, 500)); + root->setContentBounds(IntSize(500, 500)); root->setDrawsContent(true); root->createRenderSurface(); root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(500, 500))); @@ -134,22 +133,26 @@ PassOwnPtr<CCLayerImpl> createTestTreeWithTwoSurfaces() child1->setPosition(FloatPoint(100, 100)); child1->setAnchorPoint(FloatPoint::zero()); child1->setBounds(IntSize(30, 30)); + child1->setContentBounds(IntSize(30, 30)); child1->setOpacity(0.5); // with a child that drawsContent, this will cause the layer to create its own renderSurface. child1->setDrawsContent(false); // this layer does not draw, but is intended to create its own renderSurface. child2->setPosition(FloatPoint(11, 11)); child2->setAnchorPoint(FloatPoint::zero()); child2->setBounds(IntSize(18, 18)); + child2->setContentBounds(IntSize(18, 18)); child2->setDrawsContent(true); grandChild1->setPosition(FloatPoint(200, 200)); grandChild1->setAnchorPoint(FloatPoint::zero()); grandChild1->setBounds(IntSize(6, 8)); + grandChild1->setContentBounds(IntSize(6, 8)); grandChild1->setDrawsContent(true); grandChild2->setPosition(FloatPoint(190, 190)); grandChild2->setAnchorPoint(FloatPoint::zero()); grandChild2->setBounds(IntSize(6, 8)); + grandChild2->setContentBounds(IntSize(6, 8)); grandChild2->setDrawsContent(true); child1->addChild(grandChild1.release()); @@ -360,6 +363,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForPerspectiveClippedLayer) // Set up the child child->setPosition(FloatPoint(0, 0)); child->setBounds(IntSize(100, 100)); + child->setContentBounds(IntSize(100, 100)); child->setTransform(transform); emulateDrawingOneFrame(root.get()); @@ -526,6 +530,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingLayer) child2->setPosition(FloatPoint(400, 380)); child2->setAnchorPoint(FloatPoint::zero()); child2->setBounds(IntSize(6, 8)); + child2->setContentBounds(IntSize(6, 8)); child2->setDrawsContent(true); root->addChild(child2.release()); } @@ -565,6 +570,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForNewUnchangedLayer) child2->setPosition(FloatPoint(400, 380)); child2->setAnchorPoint(FloatPoint::zero()); child2->setBounds(IntSize(6, 8)); + child2->setContentBounds(IntSize(6, 8)); child2->setDrawsContent(true); child2->resetAllChangeTrackingForSubtree(); // Sanity check the initial conditions of the test, if these asserts trigger, it @@ -594,6 +600,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMultipleLayers) child2->setPosition(FloatPoint(400, 380)); child2->setAnchorPoint(FloatPoint::zero()); child2->setBounds(IntSize(6, 8)); + child2->setContentBounds(IntSize(6, 8)); child2->setDrawsContent(true); root->addChild(child2.release()); } @@ -812,6 +819,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica) grandChild3->setPosition(FloatPoint(240, 240)); grandChild3->setAnchorPoint(FloatPoint::zero()); grandChild3->setBounds(IntSize(10, 10)); + grandChild3->setContentBounds(IntSize(10, 10)); grandChild3->setDrawsContent(true); child1->addChild(grandChild3.release()); } @@ -894,6 +902,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMask) maskLayer->setPosition(child->position()); maskLayer->setAnchorPoint(FloatPoint::zero()); maskLayer->setBounds(child->bounds()); + maskLayer->setContentBounds(child->bounds()); child->setMaskLayer(maskLayer.release()); } CCLayerImpl* maskLayer = child->maskLayer(); @@ -905,6 +914,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMask) grandChild->setPosition(FloatPoint(2, 2)); grandChild->setAnchorPoint(FloatPoint::zero()); grandChild->setBounds(IntSize(2, 2)); + grandChild->setContentBounds(IntSize(2, 2)); grandChild->setDrawsContent(true); child->addChild(grandChild.release()); } @@ -989,6 +999,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) replicaMaskLayer->setPosition(FloatPoint::zero()); replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); replicaMaskLayer->setBounds(grandChild1->bounds()); + replicaMaskLayer->setContentBounds(grandChild1->bounds()); grandChild1Replica->setMaskLayer(replicaMaskLayer.release()); } CCLayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); @@ -1050,6 +1061,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) replicaMaskLayer->setPosition(FloatPoint::zero()); replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); // note, this is not the anchor being tested. replicaMaskLayer->setBounds(grandChild1->bounds()); + replicaMaskLayer->setContentBounds(grandChild1->bounds()); grandChild1Replica->setMaskLayer(replicaMaskLayer.release()); } CCLayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); diff --git a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp index 76dc425aa..73fda4cb4 100644 --- a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp @@ -147,12 +147,7 @@ TEST(CCLayerIteratorTest, simpleTree) rootLayer->addChild(fourth); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > layerList; - renderSurfaceLayerList.append(rootLayer.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer.get(), - WebTransformationMatrix(), WebTransformationMatrix(), - renderSurfaceLayerList, layerList, - 256); + CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bounds(), 1, 256, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootLayer->renderSurface()->contentRect()); iterateBackToFront(&renderSurfaceLayerList); @@ -195,12 +190,7 @@ TEST(CCLayerIteratorTest, complexTree) root23->addChild(root231); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > layerList; - renderSurfaceLayerList.append(rootLayer.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer.get(), - WebTransformationMatrix(), WebTransformationMatrix(), - renderSurfaceLayerList, layerList, - 256); + CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bounds(), 1, 256, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootLayer->renderSurface()->contentRect()); iterateBackToFront(&renderSurfaceLayerList); @@ -256,13 +246,7 @@ TEST(CCLayerIteratorTest, complexTreeMultiSurface) root23->addChild(root231); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > layerList; - renderSurfaceLayerList.append(rootLayer.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer.get(), - WebTransformationMatrix(), WebTransformationMatrix(), - renderSurfaceLayerList, layerList, - 256); + CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bounds(), 1, 256, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootLayer->renderSurface()->contentRect()); iterateBackToFront(&renderSurfaceLayerList); diff --git a/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp b/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp index d231e1259..8ffcea24f 100644 --- a/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp @@ -89,9 +89,11 @@ TEST(CCLayerSorterTest, RightAngleOverlap) WebTransformationMatrix leftFaceMatrix; leftFaceMatrix.rotate3d(0, 1, 0, -90); leftFaceMatrix.translateRight3d(-1, 0, -5); + leftFaceMatrix.translate(-1, -1); CCLayerSorter::LayerShape leftFace(2, 2, perspectiveMatrix * leftFaceMatrix); WebTransformationMatrix frontFaceMatrix; frontFaceMatrix.translate3d(0, 0, -4); + frontFaceMatrix.translate(-1, -1); CCLayerSorter::LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix); overlapResult = CCLayerSorter::checkOverlap(&frontFace, &leftFace, zThreshold, weight); @@ -111,11 +113,13 @@ TEST(CCLayerSorterTest, IntersectingLayerOverlap) // values at the overlapping features but the weight returned should be zero. WebTransformationMatrix frontFaceMatrix; frontFaceMatrix.translate3d(0, 0, -4); + frontFaceMatrix.translate(-1, -1); CCLayerSorter::LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix); WebTransformationMatrix throughMatrix; throughMatrix.rotate3d(0, 1, 0, 45); throughMatrix.translateRight3d(0, 0, -4); + throughMatrix.translate(-1, -1); CCLayerSorter::LayerShape rotatedFace(2, 2, perspectiveMatrix * throughMatrix); overlapResult = CCLayerSorter::checkOverlap(&frontFace, &rotatedFace, zThreshold, weight); EXPECT_NE(CCLayerSorter::None, overlapResult); @@ -142,14 +146,17 @@ TEST(CCLayerSorterTest, LayersAtAngleOverlap) WebTransformationMatrix transformA; transformA.translate3d(-6, 0, 1); + transformA.translate(-4, -10); CCLayerSorter::LayerShape layerA(8, 20, transformA); WebTransformationMatrix transformB; transformB.translate3d(6, 0, -1); + transformB.translate(-4, -10); CCLayerSorter::LayerShape layerB(8, 20, transformB); WebTransformationMatrix transformC; transformC.rotate3d(0, 1, 0, 40); + transformC.translate(-4, -10); CCLayerSorter::LayerShape layerC(8, 20, transformC); overlapResult = CCLayerSorter::checkOverlap(&layerA, &layerC, zThreshold, weight); @@ -176,6 +183,7 @@ TEST(CCLayerSorterTest, LayersUnderPathologicalPerspectiveTransform) WebTransformationMatrix transformA; transformA.translate3d(-15, 0, -2); + transformA.translate(-5, -5); CCLayerSorter::LayerShape layerA(10, 10, perspectiveMatrix * transformA); // With this sequence of transforms, when layer B is correctly clipped, it will be @@ -185,6 +193,7 @@ TEST(CCLayerSorterTest, LayersUnderPathologicalPerspectiveTransform) WebTransformationMatrix transformB; transformB.translate3d(0, 0, 0.7); transformB.rotate3d(0, 45, 0); + transformB.translate(-5, -5); CCLayerSorter::LayerShape layerB(10, 10, perspectiveMatrix * transformB); // Sanity check that the test case actually covers the intended scenario, where part @@ -226,22 +235,27 @@ TEST(CCLayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) FrontMatrix.translate3d(0, 0, 1); layer1->setBounds(IntSize(10, 10)); + layer1->setContentBounds(IntSize(10, 10)); layer1->setDrawTransform(BehindMatrix); layer1->setDrawsContent(true); layer2->setBounds(IntSize(20, 20)); + layer2->setContentBounds(IntSize(20, 20)); layer2->setDrawTransform(BehindMatrix); layer2->setDrawsContent(true); layer3->setBounds(IntSize(30, 30)); + layer3->setContentBounds(IntSize(30, 30)); layer3->setDrawTransform(FrontMatrix); layer3->setDrawsContent(true); layer4->setBounds(IntSize(40, 40)); + layer4->setContentBounds(IntSize(40, 40)); layer4->setDrawTransform(FrontMatrix); layer4->setDrawsContent(true); layer5->setBounds(IntSize(50, 50)); + layer5->setContentBounds(IntSize(50, 50)); layer5->setDrawTransform(BehindMatrix); layer5->setDrawsContent(true); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp index 86af40a02..9e249f2d7 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp @@ -75,25 +75,25 @@ void executeCalculateDrawTransformsAndVisibility(LayerChromium* rootLayer) { WebTransformationMatrix identityMatrix; Vector<RefPtr<LayerChromium> > dummyRenderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - ASSERT(rootLayer->renderSurface()); + // We are probably not testing what is intended if the rootLayer bounds are empty. ASSERT(!rootLayer->bounds().isEmpty()); - rootLayer->renderSurface()->setContentRect(IntRect(IntPoint(), rootLayer->bounds())); - - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer, identityMatrix, identityMatrix, dummyRenderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer->bounds(), 1, dummyMaxTextureSize, dummyRenderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(dummyRenderSurfaceLayerList, rootLayer->renderSurface()->contentRect()); } void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* rootLayer) { // Note: this version skips layer sorting. + WebTransformationMatrix identityMatrix; Vector<CCLayerImpl*> dummyRenderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer, identityMatrix, identityMatrix, dummyRenderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + + // We are probably not testing what is intended if the rootLayer bounds are empty. + ASSERT(!rootLayer->bounds().isEmpty()); + CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer->bounds(), 1, 0, dummyMaxTextureSize, dummyRenderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(dummyRenderSurfaceLayerList, rootLayer->renderSurface()->contentRect()); } @@ -129,8 +129,6 @@ PassOwnPtr<CCLayerImpl> createTreeForFixedPositionTests() grandChild->addChild(greatGrandChild.release()); child->addChild(grandChild.release()); root->addChild(child.release()); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), root->bounds())); return root.release(); } @@ -155,7 +153,6 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForNoOpLayer) RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild = LayerChromium::create(); - parent->createRenderSurface(); parent->addChild(child); child->addChild(grandChild); @@ -176,7 +173,6 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) { WebTransformationMatrix identityMatrix; RefPtr<LayerChromium> layer = LayerChromium::create(); - layer->createRenderSurface(); // Case 1: setting the sublayer transform should not affect this layer's draw transform or screen-space transform. WebTransformationMatrix arbitraryTranslation; @@ -184,31 +180,29 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) setLayerPropertiesForTesting(layer.get(), identityMatrix, arbitraryTranslation, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); executeCalculateDrawTransformsAndVisibility(layer.get()); WebTransformationMatrix expectedDrawTransform = identityMatrix; - expectedDrawTransform.translate(50, 50); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedDrawTransform, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform()); - // Case 2: setting the bounds of the layer should result in a draw transform that translates to half the width and height. - // The screen-space transform should remain as the identity, because it does not deal with transforming to/from the center of the layer. + // Case 2: Setting the bounds of the layer should not affect either the draw transform or the screenspace transform. WebTransformationMatrix translationToCenter; translationToCenter.translate(5, 6); setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(translationToCenter, layer->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform()); // Case 3: The anchor point by itself (without a layer transform) should have no effect on the transforms. setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(translationToCenter, layer->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform()); // Case 4: A change in actual position affects both the draw transform and screen space transform. WebTransformationMatrix positionTransform; positionTransform.translate(0, 1.2); - setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 1.2), IntSize(10, 12), false); + setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 1.2f), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform * translationToCenter, layer->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform, layer->screenSpaceTransform()); // Case 5: In the correct sequence of transforms, the layer transform should pre-multiply the translationToCenter. This is easily tested by @@ -217,7 +211,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) layerTransform.scale3d(2, 2, 1); setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform * translationToCenter, layer->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform, layer->screenSpaceTransform()); // Case 6: The layer transform should occur with respect to the anchor point. @@ -226,16 +220,16 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer) WebTransformationMatrix expectedResult = translationToAnchor * layerTransform * translationToAnchor.inverse(); setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5, 0), FloatPoint(0, 0), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult * translationToCenter, layer->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->screenSpaceTransform()); // Case 7: Verify that position pre-multiplies the layer transform. // The current implementation of calculateDrawTransforms does this implicitly, but it is // still worth testing to detect accidental regressions. expectedResult = positionTransform * translationToAnchor * layerTransform * translationToAnchor.inverse(); - setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5, 0), FloatPoint(0, 1.2), IntSize(10, 12), false); + setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5, 0), FloatPoint(0, 1.2f), IntSize(10, 12), false); executeCalculateDrawTransformsAndVisibility(layer.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult * translationToCenter, layer->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->screenSpaceTransform()); } @@ -245,33 +239,29 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> grandChild = LayerChromium::create(); - parent->createRenderSurface(); parent->addChild(child); child->addChild(grandChild); // Case 1: parent's anchorPoint should not affect child or grandChild. - WebTransformationMatrix childTranslationToCenter, grandChildTranslationToCenter; - childTranslationToCenter.translate(8, 9); - grandChildTranslationToCenter.translate(38, 39); setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false); executeCalculateDrawTransformsAndVisibility(parent.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(childTranslationToCenter, child->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->screenSpaceTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(grandChildTranslationToCenter, grandChild->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->screenSpaceTransform()); // Case 2: parent's position affects child and grandChild. WebTransformationMatrix parentPositionTransform; parentPositionTransform.translate(0, 1.2); - setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 1.2), IntSize(10, 12), false); + setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 1.2f), IntSize(10, 12), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false); executeCalculateDrawTransformsAndVisibility(parent.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform * childTranslationToCenter, child->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, child->screenSpaceTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform * grandChildTranslationToCenter, grandChild->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, grandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, grandChild->screenSpaceTransform()); // Case 3: parent's local transform affects child and grandchild @@ -284,9 +274,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false); executeCalculateDrawTransformsAndVisibility(parent.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform * childTranslationToCenter, child->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpaceTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform * grandChildTranslationToCenter, grandChild->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, grandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, grandChild->screenSpaceTransform()); // Case 4: parent's sublayerMatrix affects child and grandchild @@ -305,9 +295,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false); executeCalculateDrawTransformsAndVisibility(parent.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform * childTranslationToCenter, child->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpaceTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(flattenedCompositeTransform * grandChildTranslationToCenter, grandChild->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(flattenedCompositeTransform, grandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(flattenedCompositeTransform, grandChild->screenSpaceTransform()); // Case 5: same as Case 4, except that child does preserve 3D, so the grandChild should receive the non-flattened composite transform. @@ -316,9 +306,9 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), true); setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false); executeCalculateDrawTransformsAndVisibility(parent.get()); - EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform * childTranslationToCenter, child->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpaceTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform * grandChildTranslationToCenter, grandChild->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, grandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, grandChild->screenSpaceTransform()); } @@ -327,7 +317,6 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> grandChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(child); child->addChild(grandChild); @@ -346,11 +335,6 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse() * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse(); - WebTransformationMatrix childTranslationToCenter; - childTranslationToCenter.translate(8, 9); - WebTransformationMatrix grandChildTranslationToCenter; - grandChildTranslationToCenter.translate(4, 5); - // Child's render surface should not exist yet. ASSERT_FALSE(child->renderSurface()); @@ -363,16 +347,13 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) ASSERT_TRUE(child->renderSurface()); ASSERT_EQ(child, child->renderTarget()); - // The child layer's draw transform should refer to its new render surface; they only differ by a translation to center. + // The child layer's draw transform should refer to its new render surface. // The screen-space transform, however, should still refer to the root. - EXPECT_TRANSFORMATION_MATRIX_EQ(childTranslationToCenter, child->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpaceTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->renderTarget()->renderSurface()->originTransform()); - // Because the grandChild is the only drawable content, the child's renderSurface will tighten its bounds to the grandChild. - // Therefore, the draw transform will have a translation of half-width, half-height of the grandChild's bounds. - EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform * grandChildTranslationToCenter, child->renderTarget()->renderSurface()->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->renderTarget()->renderSurface()->drawTransform()); // The screen space is the same as the target since the child surface draws into the root. EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->renderTarget()->renderSurface()->screenSpaceTransform()); @@ -408,22 +389,23 @@ TEST(CCLayerTreeHostCommonTest, scissorRectWithClip) IntRect childRect(10, 10, 50, 50); IntRect grandChildRect(5, 5, 150, 150); - root->createRenderSurface(); root->setAnchorPoint(FloatPoint(0, 0)); root->setPosition(FloatPoint(rootRect.x(), rootRect.y())); root->setBounds(IntSize(rootRect.width(), rootRect.height())); + root->setContentBounds(root->bounds()); root->setDrawsContent(true); - root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(rootRect.width(), rootRect.height()))); child->setAnchorPoint(FloatPoint(0, 0)); child->setPosition(FloatPoint(childRect.x(), childRect.y())); child->setOpacity(0.5); child->setBounds(IntSize(childRect.width(), childRect.height())); + child->setContentBounds(child->bounds()); child->setDrawsContent(true); grandChild->setAnchorPoint(FloatPoint(0, 0)); grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y())); grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height())); + grandChild->setContentBounds(grandChild->bounds()); grandChild->setDrawsContent(true); CCLayerImpl* childPtr = child.get(); @@ -436,14 +418,9 @@ TEST(CCLayerTreeHostCommonTest, scissorRectWithClip) Vector<CCLayerImpl*> renderSurfaceLayerList; { - WebTransformationMatrix identityMatrix; - Vector<CCLayerImpl*> layerList; int dummyMaxTextureSize = 512; CCLayerSorter layerSorter; - - renderSurfaceLayerList.append(root.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, layerList, &layerSorter, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, &layerSorter, dummyMaxTextureSize, renderSurfaceLayerList); FloatRect dummyDamageRect; CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, dummyDamageRect); @@ -575,29 +552,31 @@ TEST(CCLayerTreeHostCommonTest, scissorRectWithClipAndSpaceTransform) IntRect childRect(10, 10, 50, 50); IntRect grandChildRect(5, 5, 150, 150); - root->createRenderSurface(); root->setAnchorPoint(FloatPoint(0, 0)); root->setPosition(FloatPoint(rootRect.x(), rootRect.y())); root->setBounds(IntSize(rootRect.width(), rootRect.height())); + root->setContentBounds(root->bounds()); root->setDrawsContent(true); - root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(rootRect.width(), rootRect.height()))); child->setAnchorPoint(FloatPoint(0, 0)); child->setPosition(FloatPoint(childRect.x(), childRect.y())); child->setOpacity(0.5); child->setBounds(IntSize(childRect.width(), childRect.height())); + child->setContentBounds(child->bounds()); child->setDrawsContent(true); grandChild->setAnchorPoint(FloatPoint(0, 0)); grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y())); grandChild->setOpacity(0.5); grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height())); + grandChild->setContentBounds(grandChild->bounds()); grandChild->setDrawsContent(true); grandChild2->setAnchorPoint(FloatPoint(0, 0)); grandChild2->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y())); grandChild2->setOpacity(0.5); grandChild2->setBounds(IntSize(grandChildRect.width(), grandChildRect.height())); + grandChild2->setContentBounds(grandChild2->bounds()); grandChild2->setDrawsContent(true); CCLayerImpl* childPtr = child.get(); @@ -611,14 +590,9 @@ TEST(CCLayerTreeHostCommonTest, scissorRectWithClipAndSpaceTransform) Vector<CCLayerImpl*> renderSurfaceLayerList; { - WebTransformationMatrix identityMatrix; - Vector<CCLayerImpl*> layerList; int dummyMaxTextureSize = 512; CCLayerSorter layerSorter; - - renderSurfaceLayerList.append(root.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, layerList, &layerSorter, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, &layerSorter, dummyMaxTextureSize, renderSurfaceLayerList); FloatRect dummyDamageRect; CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, dummyDamageRect); @@ -729,7 +703,6 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForReplica) RefPtr<LayerChromium> child = LayerChromium::create(); RefPtr<LayerChromium> childReplica = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> grandChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(child); child->addChild(grandChild); child->setReplicaLayer(childReplica.get()); @@ -767,7 +740,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForReplica) ASSERT_TRUE(child->renderSurface()); ASSERT_EQ(child, child->renderTarget()); - EXPECT_TRANSFORMATION_MATRIX_EQ(replicaCompositeTransform, child->renderTarget()->renderSurface()->replicaOriginTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(replicaCompositeTransform, child->renderTarget()->renderSurface()->replicaDrawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(replicaCompositeTransform, child->renderTarget()->renderSurface()->replicaScreenSpaceTransform()); } @@ -791,7 +764,6 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) RefPtr<LayerChromium> grandChildOfRoot = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(renderSurface1); parent->addChild(childOfRoot); renderSurface1->addChild(childOfRS1); @@ -805,7 +777,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) // In combination with descendantDrawsContent, opacity != 1 forces the layer to have a new renderSurface. renderSurface1->setOpacity(0.5); - renderSurface2->setOpacity(0.33); + renderSurface2->setOpacity(0.33f); // All layers in the tree are initialized with an anchor at .25 and a size of (10,10). // matrix "A" is the composite layer transform used in all layers, centered about the anchor point @@ -828,6 +800,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) WebTransformationMatrix A = translationToAnchor * layerTransform * translationToAnchor.inverse(); WebTransformationMatrix B = translationToCenter * sublayerTransform * translationToCenter.inverse(); WebTransformationMatrix R = A * translationToAnchor * replicaLayerTransform * translationToAnchor.inverse(); + WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false); setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false); @@ -875,17 +848,17 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) // note that draw transforms are described with respect to the nearest ancestor render surface // but screen space transforms are described with respect to the root. // - EXPECT_TRANSFORMATION_MATRIX_EQ(A * translationToCenter, parent->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A * translationToCenter, childOfRoot->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A * B * A * translationToCenter, grandChildOfRoot->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(A, parent->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A, childOfRoot->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A * B * A, grandChildOfRoot->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(translationToCenter, renderSurface1->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(B * A * translationToCenter, childOfRS1->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(B * A * B * A * translationToCenter, grandChildOfRS1->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, renderSurface1->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(B * A, childOfRS1->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(B * A * B * A, grandChildOfRS1->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(translationToCenter, renderSurface2->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(B * A * translationToCenter, childOfRS2->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(B * A * B * A * translationToCenter, grandChildOfRS2->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, renderSurface2->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(B * A, childOfRS2->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(B * A * B * A, grandChildOfRS2->drawTransform()); // Verify layer screen-space transforms // @@ -903,14 +876,14 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) // Verify render surface transforms. // - // Origin transform of render surface 1 is described with respect to root. - EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A, renderSurface1->renderSurface()->originTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * R, renderSurface1->renderSurface()->replicaOriginTransform()); + // Draw transform of render surface 1 is described with respect to root. + EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A, renderSurface1->renderSurface()->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * R, renderSurface1->renderSurface()->replicaDrawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A, renderSurface1->renderSurface()->screenSpaceTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * R, renderSurface1->renderSurface()->replicaScreenSpaceTransform()); - // Origin transform of render surface 2 is described with respect to render surface 2. - EXPECT_TRANSFORMATION_MATRIX_EQ(B * A, renderSurface2->renderSurface()->originTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(B * R, renderSurface2->renderSurface()->replicaOriginTransform()); + // Draw transform of render surface 2 is described with respect to render surface 2. + EXPECT_TRANSFORMATION_MATRIX_EQ(B * A, renderSurface2->renderSurface()->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(B * R, renderSurface2->renderSurface()->replicaDrawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A * B * A, renderSurface2->renderSurface()->screenSpaceTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A * B * R, renderSurface2->renderSurface()->replicaScreenSpaceTransform()); @@ -930,37 +903,32 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) EXPECT_FLOAT_EQ(5, grandChildOfRS2->screenSpaceTransform().m42()); } -TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForClipLayer) +TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClippedLayer) { RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); - renderSurface1->setOpacity(0.9); const WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint(30, 30), IntSize(10, 10), false); - parent->createRenderSurface(); - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); parent->addChild(renderSurface1); - renderSurface1->createRenderSurface(); renderSurface1->addChild(child); + renderSurface1->setForceRenderSurface(true); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); - - FloatRect dummyDamageRect; + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect()); // The child layer's content is entirely outside the parent's clip rect, so the intermediate - // render surface should have been removed. Render surfaces without children or visible + // render surface should not be listed here, even if it was forced to be created. Render surfaces without children or visible // content are unexpected at draw time (e.g. we might try to create a content texture of size 0). + ASSERT_TRUE(parent->renderSurface()); ASSERT_FALSE(renderSurface1->renderSurface()); - EXPECT_EQ(renderSurfaceLayerList.size(), 0U); + EXPECT_EQ(1U, renderSurfaceLayerList.size()); } TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) @@ -968,29 +936,28 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) RefPtr<LayerChromium> parent = LayerChromium::create(); RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent()); - renderSurface1->setOpacity(0); const WebTransformationMatrix identityMatrix; setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); - parent->createRenderSurface(); parent->addChild(renderSurface1); - renderSurface1->createRenderSurface(); renderSurface1->addChild(child); + renderSurface1->setForceRenderSurface(true); + renderSurface1->setOpacity(0); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); - + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect()); // Since the layer is transparent, renderSurface1->renderSurface() should not have gotten added anywhere. // Also, the drawable content rect should not have been extended by the children. - EXPECT_EQ(parent->renderSurface()->layerList().size(), 0U); - EXPECT_EQ(renderSurfaceLayerList.size(), 0U); - EXPECT_EQ(parent->drawableContentRect(), IntRect()); + ASSERT_TRUE(parent->renderSurface()); + EXPECT_EQ(0U, parent->renderSurface()->layerList().size()); + EXPECT_EQ(1U, renderSurfaceLayerList.size()); + EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); + EXPECT_EQ(IntRect(), parent->drawableContentRect()); } TEST(CCLayerTreeHostCommonTest, verifyForceRenderSurface) @@ -1005,24 +972,28 @@ TEST(CCLayerTreeHostCommonTest, verifyForceRenderSurface) setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); - parent->createRenderSurface(); - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); parent->addChild(renderSurface1); renderSurface1->addChild(child); + // Sanity check before the actual test + EXPECT_FALSE(parent->renderSurface()); + EXPECT_FALSE(renderSurface1->renderSurface()); + Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); + // The root layer always creates a renderSurface + EXPECT_TRUE(parent->renderSurface()); EXPECT_TRUE(renderSurface1->renderSurface()); - EXPECT_EQ(renderSurfaceLayerList.size(), 1U); + EXPECT_EQ(2U, renderSurfaceLayerList.size()); renderSurfaceLayerList.clear(); renderSurface1->setForceRenderSurface(false); - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); + EXPECT_TRUE(parent->renderSurface()); EXPECT_FALSE(renderSurface1->renderSurface()); - EXPECT_EQ(renderSurfaceLayerList.size(), 0U); + EXPECT_EQ(1U, renderSurfaceLayerList.size()); } TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithDirectContainer) @@ -1042,10 +1013,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit child->setScrollDelta(IntSize(0, 0)); executeCalculateDrawTransformsAndVisibility(root.get()); - // The expected drawTransforms without any scroll should still include a translation to the center of the layer (i.e. translation by 50, 50). WebTransformationMatrix expectedChildTransform; - expectedChildTransform.translate(50, 50); - WebTransformationMatrix expectedGrandChildTransform = expectedChildTransform; EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); @@ -1057,7 +1025,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit // Here the child is affected by scrollDelta, but the fixed position grandChild should not be affected. expectedChildTransform.makeIdentity(); - expectedChildTransform.translate(40, 40); + expectedChildTransform.translate(-10, -10); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); @@ -1091,10 +1059,8 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit child->setScrollDelta(IntSize(0, 0)); executeCalculateDrawTransformsAndVisibility(root.get()); - // The expected drawTransforms without any scroll should still include a translation to the center of the layer (i.e. translation by 50, 50). WebTransformationMatrix expectedChildTransform; expectedChildTransform.multiply(nonUniformScale); - expectedChildTransform.translate(50, 50); WebTransformationMatrix expectedGrandChildTransform = expectedChildTransform; @@ -1109,7 +1075,6 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit expectedChildTransform.makeIdentity(); expectedChildTransform.translate(-10, -20); // scrollDelta expectedChildTransform.multiply(nonUniformScale); - expectedChildTransform.translate(50, 50); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); @@ -1135,10 +1100,8 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit executeCalculateDrawTransformsAndVisibility(root.get()); WebTransformationMatrix expectedChildTransform; - expectedChildTransform.translate(50, 50); - WebTransformationMatrix expectedGrandChildTransform; - expectedGrandChildTransform.translate(58, 56); + expectedGrandChildTransform.translate(8, 6); WebTransformationMatrix expectedGreatGrandChildTransform = expectedGrandChildTransform; @@ -1152,9 +1115,9 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit // Here the child and grandChild are affected by scrollDelta, but the fixed position greatGrandChild should not be affected. expectedChildTransform.makeIdentity(); - expectedChildTransform.translate(40, 40); + expectedChildTransform.translate(-10, -10); expectedGrandChildTransform.makeIdentity(); - expectedGrandChildTransform.translate(48, 46); + expectedGrandChildTransform.translate(-2, -4); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform()); @@ -1174,7 +1137,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit WebTransformationMatrix rotationAboutZ; rotationAboutZ.rotate3d(0, 0, 90); - + child->setIsContainerForFixedPositionLayers(true); child->setTransform(rotationAboutZ); grandChild->setPosition(FloatPoint(8, 6)); @@ -1187,13 +1150,11 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit WebTransformationMatrix expectedChildTransform; expectedChildTransform.multiply(rotationAboutZ); - expectedChildTransform.translate(50, 50); WebTransformationMatrix expectedGrandChildTransform; expectedGrandChildTransform.multiply(rotationAboutZ); // child's local transform is inherited expectedGrandChildTransform.translate(8, 6); // translation because of position occurs before layer's local transform. expectedGrandChildTransform.multiply(rotationAboutZ); // grandChild's local transform - expectedGrandChildTransform.translate(50, 50); // translation because of half-width half-height occurs after layer's local transform WebTransformationMatrix expectedGreatGrandChildTransform = expectedGrandChildTransform; @@ -1209,14 +1170,12 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit expectedChildTransform.makeIdentity(); expectedChildTransform.translate(-10, -20); // scrollDelta expectedChildTransform.multiply(rotationAboutZ); - expectedChildTransform.translate(50, 50); expectedGrandChildTransform.makeIdentity(); expectedGrandChildTransform.translate(-10, -20); // child's scrollDelta is inherited expectedGrandChildTransform.multiply(rotationAboutZ); // child's local transform is inherited expectedGrandChildTransform.translate(8, 6); // translation because of position occurs before layer's local transform. expectedGrandChildTransform.multiply(rotationAboutZ); // grandChild's local transform - expectedGrandChildTransform.translate(50, 50); // translation because of half-width half-height occurs after layer's local transform EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); @@ -1240,7 +1199,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit WebTransformationMatrix rotationAboutZ; rotationAboutZ.rotate3d(0, 0, 90); - + child->setIsContainerForFixedPositionLayers(true); child->setTransform(rotationAboutZ); grandChild->setPosition(FloatPoint(8, 6)); @@ -1253,13 +1212,11 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit WebTransformationMatrix expectedChildTransform; expectedChildTransform.multiply(rotationAboutZ); - expectedChildTransform.translate(50, 50); WebTransformationMatrix expectedGrandChildTransform; expectedGrandChildTransform.multiply(rotationAboutZ); // child's local transform is inherited expectedGrandChildTransform.translate(8, 6); // translation because of position occurs before layer's local transform. expectedGrandChildTransform.multiply(rotationAboutZ); // grandChild's local transform - expectedGrandChildTransform.translate(50, 50); // translation because of half-width half-height occurs after layer's local transform WebTransformationMatrix expectedGreatGrandChildTransform = expectedGrandChildTransform; @@ -1276,7 +1233,6 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit expectedChildTransform.makeIdentity(); expectedChildTransform.translate(-10, 0); // scrollDelta expectedChildTransform.multiply(rotationAboutZ); - expectedChildTransform.translate(50, 50); expectedGrandChildTransform.makeIdentity(); expectedGrandChildTransform.translate(-10, 0); // child's scrollDelta is inherited @@ -1284,7 +1240,6 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit expectedGrandChildTransform.translate(-5, 0); // grandChild's scrollDelta expectedGrandChildTransform.translate(8, 6); // translation because of position occurs before layer's local transform. expectedGrandChildTransform.multiply(rotationAboutZ); // grandChild's local transform - expectedGrandChildTransform.translate(50, 50); // translation because of half-width half-height occurs after layer's local transform EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); @@ -1295,7 +1250,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit { // This test checks for correct scroll compensation when the fixed-position container // contributes to a different renderSurface than the fixed-position layer. In this - // case, the surface originTransforms also have to be accounted for when checking the + // case, the surface drawTransforms also have to be accounted for when checking the // scrollDelta. DebugScopedSetImplThread scopedImplThread; @@ -1313,30 +1268,27 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit WebTransformationMatrix rotationAboutZ; rotationAboutZ.rotate3d(0, 0, 90); grandChild->setTransform(rotationAboutZ); - + // Case 1: scrollDelta of 0, 0 child->setScrollDelta(IntSize(0, 0)); executeCalculateDrawTransformsAndVisibility(root.get()); - + WebTransformationMatrix expectedChildTransform; - expectedChildTransform.translate(50, 50); - WebTransformationMatrix expectedSurfaceOriginTransform; - expectedSurfaceOriginTransform.translate(8, 6); - expectedSurfaceOriginTransform.multiply(rotationAboutZ); + WebTransformationMatrix expectedSurfaceDrawTransform; + expectedSurfaceDrawTransform.translate(8, 6); + expectedSurfaceDrawTransform.multiply(rotationAboutZ); WebTransformationMatrix expectedGrandChildTransform; - expectedGrandChildTransform.translate(50, 50); WebTransformationMatrix expectedGreatGrandChildTransform; - expectedGreatGrandChildTransform.translate(50, 50); ASSERT_TRUE(grandChild->renderSurface()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceOriginTransform, grandChild->renderSurface()->originTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, grandChild->renderSurface()->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform()); // Case 2: scrollDelta of 10, 30 child->setScrollDelta(IntSize(10, 30)); executeCalculateDrawTransformsAndVisibility(root.get()); - + // Here the grandChild remains unchanged, because it scrolls along with the // renderSurface, and the translation is actually in the renderSurface. But, the fixed // position greatGrandChild is more awkward: its actually being drawn with respect to @@ -1346,12 +1298,11 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit // transform explicitly contains the translation that cancels out the scroll. expectedChildTransform.makeIdentity(); expectedChildTransform.translate(-10, -30); // scrollDelta - expectedChildTransform.translate(50, 50); - expectedSurfaceOriginTransform.makeIdentity(); - expectedSurfaceOriginTransform.translate(-10, -30); // scrollDelta - expectedSurfaceOriginTransform.translate(8, 6); - expectedSurfaceOriginTransform.multiply(rotationAboutZ); + expectedSurfaceDrawTransform.makeIdentity(); + expectedSurfaceDrawTransform.translate(-10, -30); // scrollDelta + expectedSurfaceDrawTransform.translate(8, 6); + expectedSurfaceDrawTransform.multiply(rotationAboutZ); // The rotation and its inverse are needed to place the scrollDelta compensation in // the correct space. This test will fail if the rotation/inverse are backwards, too, @@ -1360,11 +1311,10 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit expectedGreatGrandChildTransform.multiply(rotationAboutZ.inverse()); expectedGreatGrandChildTransform.translate(10, 30); // explicit canceling out the scrollDelta that gets embedded in the fixed position layer's surface. expectedGreatGrandChildTransform.multiply(rotationAboutZ); - expectedGreatGrandChildTransform.translate(50, 50); ASSERT_TRUE(grandChild->renderSurface()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceOriginTransform, grandChild->renderSurface()->originTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, grandChild->renderSurface()->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform()); } @@ -1416,31 +1366,27 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit executeCalculateDrawTransformsAndVisibility(root.get()); WebTransformationMatrix expectedChildTransform; - expectedChildTransform.translate(50, 50); - WebTransformationMatrix expectedGrandChildSurfaceOriginTransform; - expectedGrandChildSurfaceOriginTransform.translate(8, 6); - expectedGrandChildSurfaceOriginTransform.multiply(rotationAboutZ); + WebTransformationMatrix expectedGrandChildSurfaceDrawTransform; + expectedGrandChildSurfaceDrawTransform.translate(8, 6); + expectedGrandChildSurfaceDrawTransform.multiply(rotationAboutZ); WebTransformationMatrix expectedGrandChildTransform; - expectedGrandChildTransform.translate(50, 50); - WebTransformationMatrix expectedGreatGrandChildSurfaceOriginTransform; - expectedGreatGrandChildSurfaceOriginTransform.translate(40, 60); - expectedGreatGrandChildSurfaceOriginTransform.multiply(rotationAboutZ); + WebTransformationMatrix expectedGreatGrandChildSurfaceDrawTransform; + expectedGreatGrandChildSurfaceDrawTransform.translate(40, 60); + expectedGreatGrandChildSurfaceDrawTransform.multiply(rotationAboutZ); WebTransformationMatrix expectedGreatGrandChildTransform; - expectedGreatGrandChildTransform.translate(50, 50); WebTransformationMatrix expectedFixedPositionChildTransform; - expectedFixedPositionChildTransform.translate(50, 50); ASSERT_TRUE(grandChild->renderSurface()); ASSERT_TRUE(greatGrandChild->renderSurface()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildSurfaceOriginTransform, grandChild->renderSurface()->originTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildSurfaceDrawTransform, grandChild->renderSurface()->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildSurfaceOriginTransform, greatGrandChild->renderSurface()->originTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildSurfaceDrawTransform, greatGrandChild->renderSurface()->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedFixedPositionChildTransform, fixedPositionChild->drawTransform()); @@ -1450,12 +1396,11 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit expectedChildTransform.makeIdentity(); expectedChildTransform.translate(-10, -30); // scrollDelta - expectedChildTransform.translate(50, 50); - expectedGrandChildSurfaceOriginTransform.makeIdentity(); - expectedGrandChildSurfaceOriginTransform.translate(-10, -30); // scrollDelta - expectedGrandChildSurfaceOriginTransform.translate(8, 6); - expectedGrandChildSurfaceOriginTransform.multiply(rotationAboutZ); + expectedGrandChildSurfaceDrawTransform.makeIdentity(); + expectedGrandChildSurfaceDrawTransform.translate(-10, -30); // scrollDelta + expectedGrandChildSurfaceDrawTransform.translate(8, 6); + expectedGrandChildSurfaceDrawTransform.multiply(rotationAboutZ); // grandChild, greatGrandChild, and greatGrandChild's surface are not expected to // change, since they are all not fixed, and they are all drawn with respect to @@ -1463,25 +1408,24 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit // But the great-great grandchild, "fixedPositionChild", should have a transform that explicitly cancels out the scrollDelta. // The expected transform is: - // compoundOriginTransform.inverse() * translate(positive scrollDelta) * compoundOriginTransform * half-width-half-height translation - WebTransformationMatrix compoundOriginTransform; // transform from greatGrandChildSurface's origin to the root surface. - compoundOriginTransform.translate(8, 6); // origin translation of grandChild - compoundOriginTransform.multiply(rotationAboutZ); // rotation of grandChild - compoundOriginTransform.translate(40, 60); // origin translation of greatGrandChild - compoundOriginTransform.multiply(rotationAboutZ); // rotation of greatGrandChild + // compoundDrawTransform.inverse() * translate(positive scrollDelta) * compoundOriginTransform + WebTransformationMatrix compoundDrawTransform; // transform from greatGrandChildSurface's origin to the root surface. + compoundDrawTransform.translate(8, 6); // origin translation of grandChild + compoundDrawTransform.multiply(rotationAboutZ); // rotation of grandChild + compoundDrawTransform.translate(40, 60); // origin translation of greatGrandChild + compoundDrawTransform.multiply(rotationAboutZ); // rotation of greatGrandChild expectedFixedPositionChildTransform.makeIdentity(); - expectedFixedPositionChildTransform.multiply(compoundOriginTransform.inverse()); + expectedFixedPositionChildTransform.multiply(compoundDrawTransform.inverse()); expectedFixedPositionChildTransform.translate(10, 30); // explicit canceling out the scrollDelta that gets embedded in the fixed position layer's surface. - expectedFixedPositionChildTransform.multiply(compoundOriginTransform); - expectedFixedPositionChildTransform.translate(50, 50); + expectedFixedPositionChildTransform.multiply(compoundDrawTransform); ASSERT_TRUE(grandChild->renderSurface()); ASSERT_TRUE(greatGrandChild->renderSurface()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildSurfaceOriginTransform, grandChild->renderSurface()->originTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildSurfaceDrawTransform, grandChild->renderSurface()->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildSurfaceOriginTransform, greatGrandChild->renderSurface()->originTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildSurfaceDrawTransform, greatGrandChild->renderSurface()->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedFixedPositionChildTransform, fixedPositionChild->drawTransform()); } @@ -1507,15 +1451,12 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit child->setScrollDelta(IntSize(0, 0)); executeCalculateDrawTransformsAndVisibility(root.get()); - // The expected draw transforms without any scroll should still include a translation to the center of the layer (i.e. translation by 50, 50). - WebTransformationMatrix expectedSurfaceOriginTransform; - expectedSurfaceOriginTransform.translate(0, 0); + WebTransformationMatrix expectedSurfaceDrawTransform; + expectedSurfaceDrawTransform.translate(0, 0); WebTransformationMatrix expectedChildTransform; - expectedChildTransform.translate(50, 50); WebTransformationMatrix expectedGrandChildTransform; - expectedGrandChildTransform.translate(50, 50); ASSERT_TRUE(child->renderSurface()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceOriginTransform, child->renderSurface()->originTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, child->renderSurface()->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); @@ -1526,12 +1467,13 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit // The surface is translated by scrollDelta, the child transform doesn't change // because it scrolls along with the surface, but the fixed position grandChild // needs to compensate for the scroll translation. - expectedSurfaceOriginTransform.makeIdentity(); - expectedSurfaceOriginTransform.translate(-10, -10); + expectedSurfaceDrawTransform.makeIdentity(); + expectedSurfaceDrawTransform.translate(-10, -10); expectedGrandChildTransform.makeIdentity(); - expectedGrandChildTransform.translate(60, 60); + expectedGrandChildTransform.translate(10, 10); + ASSERT_TRUE(child->renderSurface()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceOriginTransform, child->renderSurface()->originTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, child->renderSurface()->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); } @@ -1557,11 +1499,8 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha child->setScrollDelta(IntSize(0, 0)); executeCalculateDrawTransformsAndVisibility(root.get()); - // The expected draw transforms without any scroll should still include a translation to the center of the layer (i.e. translation by 50, 50). WebTransformationMatrix expectedChildTransform; - expectedChildTransform.translate(50, 50); WebTransformationMatrix expectedGrandChildTransform; - expectedGrandChildTransform.translate(50, 50); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); @@ -1571,7 +1510,7 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha // Here the child is affected by scrollDelta, but the fixed position grandChild should not be affected. expectedChildTransform.makeIdentity(); - expectedChildTransform.translate(40, 40); + expectedChildTransform.translate(-10, -10); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); } @@ -1597,14 +1536,11 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha root->setScrollDelta(IntSize(0, 0)); executeCalculateDrawTransformsAndVisibility(root.get()); - // The expected draw transforms without any scroll should still include a translation to the center of the layer (i.e. translation by 50, 50). WebTransformationMatrix expectedChildTransform; expectedChildTransform.multiply(rotationByZ); - expectedChildTransform.translate(50, 50); WebTransformationMatrix expectedGrandChildTransform; expectedGrandChildTransform.multiply(rotationByZ); - expectedGrandChildTransform.translate(50, 50); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); @@ -1617,7 +1553,6 @@ TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha expectedChildTransform.makeIdentity(); expectedChildTransform.translate(-10, -10); // the scrollDelta expectedChildTransform.multiply(rotationByZ); - expectedChildTransform.translate(50, 50); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform()); @@ -1646,7 +1581,6 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces) RefPtr<LayerChromium> greatGrandChild = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> leafNode1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> leafNode2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(child); child->addChild(grandChild); grandChild->addChild(greatGrandChild); @@ -1664,21 +1598,13 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces) setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false); child->setMasksToBounds(true); - child->setOpacity(0.4); + child->setOpacity(0.4f); grandChild->setOpacity(0.5); - greatGrandChild->setOpacity(0.4); + greatGrandChild->setOpacity(0.4f); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - - // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too. - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); - - FloatRect dummyDamageRect; + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect()); @@ -1720,18 +1646,12 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) setLayerPropertiesForTesting(leafNode.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false); parent->setMasksToBounds(true); - child->setOpacity(0.4); - grandChild->setOpacity(0.4); + child->setOpacity(0.4f); + grandChild->setOpacity(0.4f); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - - parent->createRenderSurface(); - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); // Without an animation, we should cull child and grandChild from the renderSurfaceLayerList. ASSERT_EQ(1U, renderSurfaceLayerList.size()); @@ -1744,13 +1664,8 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) child->clearRenderSurface(); grandChild->clearRenderSurface(); renderSurfaceLayerList.clear(); - dummyLayerList.clear(); - - parent->createRenderSurface(); - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); // With an animating transform, we should keep child and grandChild in the renderSurfaceLayerList. ASSERT_EQ(3U, renderSurfaceLayerList.size()); @@ -1777,7 +1692,6 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableContentRectForLayers) RefPtr<LayerChromium> grandChild3 = LayerChromium::create(); RefPtr<LayerChromium> grandChild4 = LayerChromium::create(); - parent->createRenderSurface(); parent->addChild(child); child->addChild(grandChild1); child->addChild(grandChild2); @@ -1795,21 +1709,15 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableContentRectForLayers) grandChild3->setMasksToBounds(true); // Force everyone to be a render surface. - child->setOpacity(0.4); + child->setOpacity(0.4f); grandChild1->setOpacity(0.5); grandChild2->setOpacity(0.5); grandChild3->setOpacity(0.5); grandChild4->setOpacity(0.5); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - - // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too. - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect()); @@ -1841,7 +1749,6 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) RefPtr<LayerChromiumWithForcedDrawsContent> leafNode3 = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> leafNode4 = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(child); child->addChild(grandChild1); child->addChild(grandChild2); @@ -1870,21 +1777,15 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) grandChild4->setMasksToBounds(true); // Force everyone to be a render surface. - child->setOpacity(0.4); + child->setOpacity(0.4f); grandChild1->setOpacity(0.5); grandChild2->setOpacity(0.5); grandChild3->setOpacity(0.5); grandChild4->setOpacity(0.5); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - - // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too. - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect()); @@ -1910,7 +1811,6 @@ TEST(CCLayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy) RefPtr<LayerChromium> grandChildOfRoot = LayerChromium::create(); RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(renderSurface1); parent->addChild(childOfRoot); renderSurface1->addChild(childOfRS1); @@ -2316,7 +2216,6 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) RefPtr<LayerChromiumWithForcedDrawsContent> frontFacingChildOfBackFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> backFacingChildOfBackFacingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(frontFacingChild); parent->addChild(backFacingChild); parent->addChild(frontFacingSurface); @@ -2358,12 +2257,8 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); // Verify which renderSurfaces were created. EXPECT_FALSE(frontFacingChild->renderSurface()); @@ -2415,7 +2310,6 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d) RefPtr<LayerChromiumWithForcedDrawsContent> dummyReplicaLayer1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> dummyReplicaLayer2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(frontFacingChild); parent->addChild(backFacingChild); parent->addChild(frontFacingSurface); @@ -2462,12 +2356,8 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d) setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); // Verify which renderSurfaces were created. EXPECT_FALSE(frontFacingChild->renderSurface()); @@ -2512,7 +2402,6 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) RefPtr<LayerChromiumWithForcedDrawsContent> animatingChild = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> child2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(child); parent->addChild(animatingSurface); animatingSurface->addChild(childOfAnimatingSurface); @@ -2547,13 +2436,8 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect()); @@ -2599,7 +2483,6 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin RefPtr<LayerChromiumWithForcedDrawsContent> child1 = adoptRef(new LayerChromiumWithForcedDrawsContent()); RefPtr<LayerChromiumWithForcedDrawsContent> child2 = adoptRef(new LayerChromiumWithForcedDrawsContent()); - parent->createRenderSurface(); parent->addChild(frontFacingSurface); parent->addChild(backFacingSurface); frontFacingSurface->addChild(child1); @@ -2621,12 +2504,8 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); // Verify which renderSurfaces were created. EXPECT_TRUE(frontFacingSurface->renderSurface()); @@ -2670,8 +2549,6 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayer) DebugScopedSetImplThread thisScopeIsOnImplThread; OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -2681,10 +2558,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayer) root->setDrawsContent(true); Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. @@ -2717,8 +2592,6 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform) DebugScopedSetImplThread thisScopeIsOnImplThread; OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); WebTransformationMatrix uninvertibleTransform; uninvertibleTransform.setM11(0); @@ -2735,10 +2608,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform) root->setDrawsContent(true); Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. @@ -2783,8 +2654,6 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer) DebugScopedSetImplThread thisScopeIsOnImplThread; OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -2794,10 +2663,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer) root->setDrawsContent(true); Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. @@ -2831,8 +2698,6 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer) DebugScopedSetImplThread thisScopeIsOnImplThread; OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); WebTransformationMatrix identityMatrix; WebTransformationMatrix rotation45DegreesAboutCenter; @@ -2846,10 +2711,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer) root->setDrawsContent(true); Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. @@ -2887,8 +2750,6 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) DebugScopedSetImplThread thisScopeIsOnImplThread; OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); WebTransformationMatrix identityMatrix; @@ -2907,10 +2768,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) root->setDrawsContent(true); Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. @@ -2945,8 +2804,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents // screenSpaceTransform converts from the layer's origin space to screen space. This // test makes sure that hit testing works correctly accounts for the contents scale. // A contentsScale that is not 1 effectively forces a non-identity transform between - // layer's content space and layer's origin space, which is not included in the - // screenSpaceTransform. The hit testing code must take this into account. + // layer's content space and layer's origin space. The hit testing code must take this into account. // // To test this, the layer is positioned at (25, 25), and is size (50, 50). If // contentsScale is ignored, then hit testing will mis-interpret the visibleContentRect @@ -2954,44 +2812,52 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents // DebugScopedSetImplThread thisScopeIsOnImplThread; - OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); - FloatPoint position(25, 25); - IntSize bounds(50, 50); - setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); - root->setDrawsContent(true); - root->setContentBounds(IntSize(100, 100)); + setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, FloatPoint(0, 0), IntSize(100, 100), false); + + { + FloatPoint position(25, 25); + IntSize bounds(50, 50); + OwnPtr<CCLayerImpl> testLayer = CCLayerImpl::create(12345); + setLayerPropertiesForTesting(testLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); + + // override contentBounds + testLayer->setContentBounds(IntSize(100, 100)); + + testLayer->setDrawsContent(true); + root->addChild(testLayer.release()); + } Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. - // The visibleContentRect is actually 100x100, even though the layout size of the layer is 50x50, positioned at 25x25. - EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), root->visibleContentRect()); + // The visibleContentRect for testLayer is actually 100x100, even though its layout size is 50x50, positioned at 25x25. + CCLayerImpl* testLayer = root->children()[0].get(); + EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), testLayer->visibleContentRect()); ASSERT_EQ(1u, renderSurfaceLayerList.size()); ASSERT_EQ(1u, root->renderSurface()->layerList().size()); - // Hit testing for a point outside the layer should return a null pointer. - IntPoint testPoint(24, 24); + // Hit testing for a point outside the layer should return a null pointer (the root layer does not draw content, so it will not be hit tested either). + IntPoint testPoint(101, 101); CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); - // Even though the layer exists at (101, 101), it should not be visible there since the root renderSurface would clamp it. - // This case in particular is likely to fail if contents scale is not correctly accounted for. + testPoint = IntPoint(24, 24); + resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); + EXPECT_FALSE(resultLayer); + testPoint = IntPoint(76, 76); resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); - // Hit testing for a point inside should return the root layer. + // Hit testing for a point inside should return the test layer. testPoint = IntPoint(26, 26); resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); ASSERT_TRUE(resultLayer); @@ -3009,36 +2875,37 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer) // the entire layer bounds. Here we just test the simple axis-aligned case. DebugScopedSetImplThread thisScopeIsOnImplThread; - OwnPtr<CCLayerImpl> root = CCLayerImpl::create(123); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); - WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); - FloatPoint position(25, 25); // this layer is positioned, and hit testing should correctly know where the layer is located. - IntSize bounds(50, 50); - setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); - root->setMasksToBounds(true); + + OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); + setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, FloatPoint(0, 0), IntSize(100, 100), false); { + OwnPtr<CCLayerImpl> clippingLayer = CCLayerImpl::create(123); + FloatPoint position(25, 25); // this layer is positioned, and hit testing should correctly know where the layer is located. + IntSize bounds(50, 50); + setLayerPropertiesForTesting(clippingLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); + clippingLayer->setMasksToBounds(true); + OwnPtr<CCLayerImpl> child = CCLayerImpl::create(456); position = FloatPoint(-50, -50); bounds = IntSize(300, 300); setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false); child->setDrawsContent(true); - root->addChild(child.release()); + clippingLayer->addChild(child.release()); + root->addChild(clippingLayer.release()); } Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. ASSERT_EQ(1u, renderSurfaceLayerList.size()); ASSERT_EQ(1u, root->renderSurface()->layerList().size()); + ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); // Hit testing for a point outside the layer should return a null pointer. // Despite the child layer being very large, it should be clipped to the root layer's bounds. @@ -3046,7 +2913,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer) CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); - // Even though the layer exists at (101, 101), it should not be visible there since the root renderSurface would clamp it. + // Even though the layer exists at (101, 101), it should not be visible there since the clippingLayer would clamp it. testPoint = IntPoint(76, 76); resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); EXPECT_FALSE(resultLayer); @@ -3078,8 +2945,6 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer) DebugScopedSetImplThread thisScopeIsOnImplThread; OwnPtr<CCLayerImpl> root = CCLayerImpl::create(123); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -3124,10 +2989,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer) } Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. @@ -3181,8 +3044,6 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayers) DebugScopedSetImplThread thisScopeIsOnImplThread; OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -3228,10 +3089,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayers) CCLayerImpl* grandChild1 = child1->children()[0].get(); Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. @@ -3291,8 +3150,6 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) DebugScopedSetImplThread thisScopeIsOnImplThread; OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100))); WebTransformationMatrix identityMatrix; FloatPoint anchor(0, 0); @@ -3341,10 +3198,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) CCLayerImpl* grandChild1 = child1->children()[0].get(); Vector<CCLayerImpl*> renderSurfaceLayerList; - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; - renderSurfaceLayerList.append(root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. @@ -3420,7 +3275,6 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI) // Verify draw and screen space transforms of layers not in a surface. MockContentLayerDelegate delegate; WebTransformationMatrix identityMatrix; - WebTransformationMatrix parentMatrix; RefPtr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&delegate); setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); @@ -3435,40 +3289,27 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI) parent->addChild(childNoScale); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - parent->createRenderSurface(); - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - const double deviceScaleFactor = 2.5; - parentMatrix.scale(deviceScaleFactor); parent->setContentsScale(deviceScaleFactor); child->setContentsScale(deviceScaleFactor); EXPECT_EQ(childNoScale->contentsScale(), 1); - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), parentMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), deviceScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList); EXPECT_EQ(1u, renderSurfaceLayerList.size()); // Verify parent transforms - WebTransformationMatrix expectedParentScreenSpaceTransform; - expectedParentScreenSpaceTransform.setM11(deviceScaleFactor); - expectedParentScreenSpaceTransform.setM22(deviceScaleFactor); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentScreenSpaceTransform, parent->screenSpaceTransform()); - - WebTransformationMatrix expectedParentDrawTransform = expectedParentScreenSpaceTransform; - expectedParentDrawTransform.translate(0.5 * parent->bounds().width(), 0.5 * parent->bounds().height()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentDrawTransform, parent->drawTransform()); + WebTransformationMatrix expectedParentTransform; + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpaceTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransform()); // Verify results of transformed parent rects - IntRect parentBounds(IntPoint(), parent->bounds()); - IntRect centeredParentBounds = parentBounds; - centeredParentBounds.move(-parentBounds.width() * 0.5, -parentBounds.height() * 0.5); + FloatRect parentContentBounds(FloatPoint(), FloatSize(parent->contentBounds())); - FloatRect parentDrawRect = CCMathUtil::mapClippedRect(parent->drawTransform(), FloatRect(centeredParentBounds)); - FloatRect parentScreenSpaceRect = CCMathUtil::mapClippedRect(parent->screenSpaceTransform(), FloatRect(parentBounds)); + FloatRect parentDrawRect = CCMathUtil::mapClippedRect(parent->drawTransform(), parentContentBounds); + FloatRect parentScreenSpaceRect = CCMathUtil::mapClippedRect(parent->screenSpaceTransform(), parentContentBounds); FloatRect expectedParentDrawRect(FloatPoint(), parent->bounds()); expectedParentDrawRect.scale(deviceScaleFactor); @@ -3476,23 +3317,16 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI) EXPECT_FLOAT_RECT_EQ(expectedParentDrawRect, parentScreenSpaceRect); // Verify child transforms - WebTransformationMatrix expectedChildScreenSpaceTransform; - expectedChildScreenSpaceTransform.setM11(deviceScaleFactor); - expectedChildScreenSpaceTransform.setM22(deviceScaleFactor); - expectedChildScreenSpaceTransform.translate(child->position().x(), child->position().y()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildScreenSpaceTransform, child->screenSpaceTransform()); - - WebTransformationMatrix expectedChildDrawTransform = expectedChildScreenSpaceTransform; - expectedChildDrawTransform.translate(0.5 * child->bounds().width(), 0.5 * child->bounds().height()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildDrawTransform, child->drawTransform()); + WebTransformationMatrix expectedChildTransform; + expectedChildTransform.translate(deviceScaleFactor * child->position().x(), deviceScaleFactor * child->position().y()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->screenSpaceTransform()); // Verify results of transformed child rects - IntRect childBounds(IntPoint(), child->bounds()); - IntRect centeredChildBounds = childBounds; - centeredChildBounds.move(-childBounds.width() * 0.5, -childBounds.height() * 0.5); + FloatRect childContentBounds(FloatPoint(), FloatSize(child->contentBounds())); - FloatRect childDrawRect = CCMathUtil::mapClippedRect(child->drawTransform(), FloatRect(centeredChildBounds)); - FloatRect childScreenSpaceRect = CCMathUtil::mapClippedRect(child->screenSpaceTransform(), FloatRect(childBounds)); + FloatRect childDrawRect = CCMathUtil::mapClippedRect(child->drawTransform(), childContentBounds); + FloatRect childScreenSpaceRect = CCMathUtil::mapClippedRect(child->screenSpaceTransform(), childContentBounds); FloatRect expectedChildDrawRect(FloatPoint(), child->bounds()); expectedChildDrawRect.move(child->position().x(), child->position().y()); @@ -3501,15 +3335,18 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI) EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childScreenSpaceRect); // Verify childNoScale transforms - EXPECT_TRANSFORMATION_MATRIX_EQ(child->drawTransform(), childNoScale->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(child->screenSpaceTransform(), childNoScale->screenSpaceTransform()); + WebTransformationMatrix expectedChildNoScaleTransform = child->drawTransform(); + // All transforms operate on content rects. The child's content rect + // incorporates device scale, but the childNoScale does not; add it here. + expectedChildNoScaleTransform.scale(deviceScaleFactor); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale->drawTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale->screenSpaceTransform()); } TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) { MockContentLayerDelegate delegate; WebTransformationMatrix identityMatrix; - WebTransformationMatrix parentMatrix; RefPtr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&delegate); setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(30, 30), true); @@ -3532,59 +3369,44 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) child->setReplicaLayer(replica.get()); Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; - parent->createRenderSurface(); - parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds())); - renderSurfaceLayerList.append(parent.get()); - const double deviceScaleFactor = 1.5; - parentMatrix.scale(deviceScaleFactor); parent->setContentsScale(deviceScaleFactor); child->setContentsScale(deviceScaleFactor); duplicateChildNonOwner->setContentsScale(deviceScaleFactor); replica->setContentsScale(deviceScaleFactor); - CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), parentMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), deviceScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList); // We should have two render surfaces. The root's render surface and child's // render surface (it needs one because it has a replica layer). EXPECT_EQ(2u, renderSurfaceLayerList.size()); - WebTransformationMatrix expectedParentScreenSpaceTransform; - expectedParentScreenSpaceTransform.setM11(deviceScaleFactor); - expectedParentScreenSpaceTransform.setM22(deviceScaleFactor); - WebTransformationMatrix expectedParentDrawTransform = expectedParentScreenSpaceTransform; - expectedParentDrawTransform.translate(0.5 * parent->bounds().width(), 0.5 * parent->bounds().height()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentDrawTransform, parent->drawTransform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentScreenSpaceTransform, parent->screenSpaceTransform()); + WebTransformationMatrix expectedParentTransform; + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpaceTransform()); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransform()); WebTransformationMatrix expectedDrawTransform; - expectedDrawTransform.setM11(deviceScaleFactor); - expectedDrawTransform.setM22(deviceScaleFactor); - expectedDrawTransform.setM41(0.5 * deviceScaleFactor * child->bounds().width()); - expectedDrawTransform.setM42(0.5 * deviceScaleFactor * child->bounds().height()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedDrawTransform, child->drawTransform()); WebTransformationMatrix expectedScreenSpaceTransform; - expectedScreenSpaceTransform.setM11(deviceScaleFactor); - expectedScreenSpaceTransform.setM22(deviceScaleFactor); - expectedScreenSpaceTransform.translate(child->position().x(), child->position().y()); + expectedScreenSpaceTransform.translate(deviceScaleFactor * child->position().x(), deviceScaleFactor * child->position().y()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedScreenSpaceTransform, child->screenSpaceTransform()); + WebTransformationMatrix expectedDuplicateChildDrawTransform = child->drawTransform(); EXPECT_TRANSFORMATION_MATRIX_EQ(child->drawTransform(), duplicateChildNonOwner->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(child->screenSpaceTransform(), duplicateChildNonOwner->screenSpaceTransform()); EXPECT_INT_RECT_EQ(child->drawableContentRect(), duplicateChildNonOwner->drawableContentRect()); EXPECT_EQ(child->contentBounds(), duplicateChildNonOwner->contentBounds()); WebTransformationMatrix expectedRenderSurfaceDrawTransform; - expectedRenderSurfaceDrawTransform.translate(deviceScaleFactor * (child->position().x() + 0.5 * child->bounds().width()), deviceScaleFactor * (child->position().y() + 0.5 * child->bounds().height())); + expectedRenderSurfaceDrawTransform.translate(deviceScaleFactor * child->position().x(), deviceScaleFactor * child->position().y()); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedRenderSurfaceDrawTransform, child->renderSurface()->drawTransform()); - WebTransformationMatrix expectedOriginTransform; - expectedOriginTransform.translate(deviceScaleFactor * 2, deviceScaleFactor * 2); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedOriginTransform, child->renderSurface()->originTransform()); + WebTransformationMatrix expectedSurfaceDrawTransform; + expectedSurfaceDrawTransform.translate(deviceScaleFactor * 2, deviceScaleFactor * 2); + EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, child->renderSurface()->drawTransform()); WebTransformationMatrix expectedSurfaceScreenSpaceTransform; expectedSurfaceScreenSpaceTransform.translate(deviceScaleFactor * 2, deviceScaleFactor * 2); @@ -3592,15 +3414,10 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) WebTransformationMatrix expectedReplicaDrawTransform; expectedReplicaDrawTransform.setM22(-1); - expectedReplicaDrawTransform.setM41(13.5); - expectedReplicaDrawTransform.setM42(-1.5); + expectedReplicaDrawTransform.setM41(6); + expectedReplicaDrawTransform.setM42(6); EXPECT_TRANSFORMATION_MATRIX_EQ(expectedReplicaDrawTransform, child->renderSurface()->replicaDrawTransform()); - WebTransformationMatrix expectedReplicaOriginTransform = expectedReplicaDrawTransform; - expectedReplicaOriginTransform.setM41(6); - expectedReplicaOriginTransform.setM42(6); - EXPECT_TRANSFORMATION_MATRIX_EQ(expectedReplicaOriginTransform, child->renderSurface()->replicaOriginTransform()); - WebTransformationMatrix expectedReplicaScreenSpaceTransform; expectedReplicaScreenSpaceTransform.setM22(-1); expectedReplicaScreenSpaceTransform.setM41(6); @@ -3630,17 +3447,4 @@ TEST(CCLayerTreeHostCommonTest, verifySubtreeSearch) EXPECT_EQ(0, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), nonexistentId)); } -// FIXME: -// continue working on https://bugs.webkit.org/show_bug.cgi?id=68942 -// - add a test to verify clipping that changes the "center point" -// - add a case that checks if a render surface's drawTransform is computed correctly. For the general case, and for special cases when clipping. -// - add a case that checks if a render surface's replicaTransform is computed correctly. -// - test all the conditions under which render surfaces are created -// - if possible, test all conditions under which render surfaces are not created -// - verify that the layer lists of render surfaces are correct, verify that renderTarget's RenderSurface values for each layer are correct. -// - test the computation of clip rects and content rects -// - test the special cases for mask layers and replica layers -// - test the other functions in CCLayerTreeHostCommon -// - } // namespace diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp index 1419164b5..53c312cf5 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp @@ -1038,12 +1038,12 @@ TEST_F(CCLayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly) m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); - WebTransformationMatrix pageScaleTransform; - pageScaleTransform.scale(newPageScale); - pageScaleTransform.translate(0.5 * surfaceSize.width(), 0.5 * surfaceSize.height()); - EXPECT_EQ(root->drawTransform(), pageScaleTransform); - EXPECT_EQ(child->drawTransform(), pageScaleTransform); - EXPECT_EQ(grandChild->drawTransform(), pageScaleTransform); + EXPECT_EQ(root->drawTransform().m11(), newPageScale); + EXPECT_EQ(root->drawTransform().m22(), newPageScale); + EXPECT_EQ(child->drawTransform().m11(), newPageScale); + EXPECT_EQ(child->drawTransform().m22(), newPageScale); + EXPECT_EQ(grandChild->drawTransform().m11(), newPageScale); + EXPECT_EQ(grandChild->drawTransform().m22(), newPageScale); } TEST_F(CCLayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread) @@ -1635,9 +1635,11 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) child->setPosition(FloatPoint(12, 13)); child->setAnchorPoint(FloatPoint(0, 0)); child->setBounds(IntSize(14, 15)); + child->setContentBounds(IntSize(14, 15)); child->setDrawsContent(true); root->setAnchorPoint(FloatPoint(0, 0)); root->setBounds(IntSize(500, 500)); + root->setContentBounds(IntSize(500, 500)); root->setDrawsContent(true); root->addChild(adoptPtr(child)); layerTreeHostImpl->setRootLayer(adoptPtr(root)); @@ -1695,9 +1697,11 @@ TEST_F(CCLayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) CCLayerImpl* child = new FakeDrawableCCLayerImpl(2); child->setAnchorPoint(FloatPoint(0, 0)); child->setBounds(IntSize(10, 10)); + child->setContentBounds(IntSize(10, 10)); child->setDrawsContent(true); root->setAnchorPoint(FloatPoint(0, 0)); root->setBounds(IntSize(10, 10)); + root->setContentBounds(IntSize(10, 10)); root->setDrawsContent(true); root->setOpacity(0.7f); root->addChild(adoptPtr(child)); @@ -1709,6 +1713,7 @@ TEST_F(CCLayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); EXPECT_EQ(1u, frame.renderSurfaceLayerList->size()); EXPECT_EQ(1u, frame.renderPasses.size()); + m_hostImpl->didDrawAllLayers(frame); } } // namespace @@ -3572,12 +3577,12 @@ struct RenderPassRemovalTestData : public CCLayerTreeHostImpl::FrameData { class CCTestRenderPass: public CCRenderPass { public: - static PassOwnPtr<CCRenderPass> create(CCRenderSurface* targetSurface, int id) { return adoptPtr(new CCTestRenderPass(targetSurface, id)); } + static PassOwnPtr<CCRenderPass> create(CCRenderSurface* renderSurface, int id) { return adoptPtr(new CCTestRenderPass(renderSurface, id)); } void appendQuad(PassOwnPtr<CCDrawQuad> quad) { m_quadList.append(quad); } protected: - CCTestRenderPass(CCRenderSurface* targetSurface, int id) : CCRenderPass(targetSurface, id) { } + CCTestRenderPass(CCRenderSurface* renderSurface, int id) : CCRenderPass(renderSurface, id) { } }; class CCTestRenderer : public LayerRendererChromium, public CCRendererClient { @@ -3693,7 +3698,7 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova IntRect quadRect = IntRect(0, 0, 1, 1); IntRect contentsChangedRect = contentsChanged ? quadRect : IntRect(); - OwnPtr<CCRenderPassDrawQuad> quad = CCRenderPassDrawQuad::create(testData.sharedQuadState.get(), quadRect, newRenderPassId, isReplica, WebKit::WebTransformationMatrix(), WebKit::WebFilterOperations(), WebKit::WebFilterOperations(), 1, contentsChangedRect); + OwnPtr<CCRenderPassDrawQuad> quad = CCRenderPassDrawQuad::create(testData.sharedQuadState.get(), quadRect, newRenderPassId, isReplica, 1, contentsChangedRect); static_cast<CCTestRenderPass*>(renderPass.get())->appendQuad(quad.release()); } } diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp index ca3e21c3d..ea7678b02 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp @@ -1160,9 +1160,9 @@ public: int paintContentsCount() { return m_paintContentsCount; } void resetPaintContentsCount() { m_paintContentsCount = 0; } - virtual void update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion) OVERRIDE + virtual void update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion, CCRenderingStats& stats) OVERRIDE { - ContentLayerChromium::update(updater, occlusion); + ContentLayerChromium::update(updater, occlusion, stats); m_paintContentsCount++; } @@ -1301,7 +1301,6 @@ public: // The root layer is scaled by 2x. WebTransformationMatrix rootScreenSpaceTransform = scaleTransform; WebTransformationMatrix rootDrawTransform = scaleTransform; - rootDrawTransform.translate(root->bounds().width() * 0.5, root->bounds().height() * 0.5); EXPECT_EQ(rootDrawTransform, root->drawTransform()); EXPECT_EQ(rootScreenSpaceTransform, root->screenSpaceTransform()); @@ -1311,7 +1310,6 @@ public: childScreenSpaceTransform.translate(2, 2); WebTransformationMatrix childDrawTransform = scaleTransform; childDrawTransform.translate(2, 2); - childDrawTransform.translate(child->bounds().width() * 0.5, child->bounds().height() * 0.5); EXPECT_EQ(childDrawTransform, child->drawTransform()); EXPECT_EQ(childScreenSpaceTransform, child->screenSpaceTransform()); @@ -1576,7 +1574,7 @@ class TestLayerChromium : public LayerChromium { public: static PassRefPtr<TestLayerChromium> create() { return adoptRef(new TestLayerChromium()); } - virtual void update(CCTextureUpdater&, const CCOcclusionTracker* occlusion) OVERRIDE + virtual void update(CCTextureUpdater&, const CCOcclusionTracker* occlusion, CCRenderingStats&) OVERRIDE { // Gain access to internals of the CCOcclusionTracker. const TestCCOcclusionTracker* testOcclusion = static_cast<const TestCCOcclusionTracker*>(occlusion); diff --git a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp index b559db12c..596b0692c 100644 --- a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp @@ -256,16 +256,12 @@ protected: void calcDrawEtc(TestContentLayerImpl* root) { ASSERT(root == m_root.get()); - Vector<CCLayerImpl*> dummyLayerList; int dummyMaxTextureSize = 512; CCLayerSorter layerSorter; ASSERT(!root->renderSurface()); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), root->bounds())); - m_renderSurfaceLayerListImpl.append(m_root.get()); - CCLayerTreeHostCommon::calculateDrawTransforms(root, root, identityMatrix, identityMatrix, m_renderSurfaceLayerListImpl, dummyLayerList, &layerSorter, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, &layerSorter, dummyMaxTextureSize, m_renderSurfaceLayerListImpl); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(m_renderSurfaceLayerListImpl, root->renderSurface()->contentRect()); @@ -275,15 +271,11 @@ protected: void calcDrawEtc(TestContentLayerChromium* root) { ASSERT(root == m_root.get()); - Vector<RefPtr<LayerChromium> > dummyLayerList; int dummyMaxTextureSize = 512; ASSERT(!root->renderSurface()); - root->createRenderSurface(); - root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), root->bounds())); - m_renderSurfaceLayerListChromium.append(m_root); - CCLayerTreeHostCommon::calculateDrawTransforms(root, root, identityMatrix, identityMatrix, m_renderSurfaceLayerListChromium, dummyLayerList, dummyMaxTextureSize); + CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, dummyMaxTextureSize, m_renderSurfaceLayerListChromium); CCLayerTreeHostCommon::calculateVisibleAndScissorRects(m_renderSurfaceLayerListChromium, root->renderSurface()->contentRect()); diff --git a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp index 526ab4e59..9eff157bc 100644 --- a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp +++ b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp @@ -58,17 +58,15 @@ private: typedef CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType; -static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const WebTransformationMatrix& originTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, Vector<CCLayerImpl*>& surfaceLayerList) +static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const WebTransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, Vector<CCLayerImpl*>& surfaceLayerList) { OwnPtr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(1); OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::NoBorderTexels); tiler->setBounds(layerRect.size()); layer->setTilingData(*tiler); layer->setSkipsDraw(false); - WebTransformationMatrix drawTransform = originTransform; - drawTransform.translate(0.5 * layerRect.width(), 0.5 * layerRect.height()); layer->setDrawTransform(drawTransform); - layer->setScreenSpaceTransform(originTransform); + layer->setScreenSpaceTransform(drawTransform); layer->setVisibleContentRect(layerRect); layer->setDrawOpacity(opacity); layer->setOpaque(opaque); diff --git a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp index a989cd602..c95d71e84 100644 --- a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp +++ b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp @@ -86,7 +86,6 @@ TEST(CCRenderSurfaceTest, verifySurfaceChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setDrawOpacity(0.5)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setDrawTransform(dummyMatrix)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setReplicaDrawTransform(dummyMatrix)); - EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setOriginTransform(dummyMatrix)); EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->clearLayerList()); } @@ -106,7 +105,7 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) origin.translate(30, 40); - renderSurface->setOriginTransform(origin); + renderSurface->setDrawTransform(origin); renderSurface->setContentRect(contentRect); renderSurface->setClipRect(clipRect); renderSurface->setScissorRect(clipRect); diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp index 7778549b6..ec2105327 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp @@ -46,7 +46,7 @@ void FakeLayerTextureUpdater::Texture::updateRect(CCResourceProvider* resourcePr m_layer->updateRect(); } -void FakeLayerTextureUpdater::Texture::prepareRect(const IntRect&) +void FakeLayerTextureUpdater::Texture::prepareRect(const IntRect&, WebCore::CCRenderingStats&) { m_layer->prepareRect(); } @@ -62,7 +62,7 @@ FakeLayerTextureUpdater::~FakeLayerTextureUpdater() { } -void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, float, float, IntRect& resultingOpaqueRect) +void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, float, float, IntRect& resultingOpaqueRect, CCRenderingStats&) { m_prepareCount++; m_lastUpdateRect = contentRect; @@ -115,9 +115,9 @@ void FakeTiledLayerChromium::setNeedsDisplayRect(const FloatRect& rect) TiledLayerChromium::setNeedsDisplayRect(rect); } -void FakeTiledLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion) +void FakeTiledLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion, CCRenderingStats& stats) { - updateContentRect(updater, visibleContentRect(), occlusion); + updateContentRect(updater, visibleContentRect(), occlusion, stats); } void FakeTiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& calculator) diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h index be681d71c..de1eb66c6 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h @@ -50,7 +50,7 @@ public: virtual ~Texture(); virtual void updateRect(WebCore::CCResourceProvider* , const WebCore::IntRect&, const WebCore::IntRect&) OVERRIDE; - virtual void prepareRect(const WebCore::IntRect&) OVERRIDE; + virtual void prepareRect(const WebCore::IntRect&, WebCore::CCRenderingStats&) OVERRIDE; private: FakeLayerTextureUpdater* m_layer; @@ -62,7 +62,7 @@ public: virtual PassOwnPtr<WebCore::LayerTextureUpdater::Texture> createTexture(WebCore::CCPrioritizedTextureManager*) OVERRIDE; virtual SampledTexelFormat sampledTexelFormat(GC3Denum) OVERRIDE { return SampledTexelFormatRGBA; } - virtual void prepareToUpdate(const WebCore::IntRect& contentRect, const WebCore::IntSize&, float, float, WebCore::IntRect& resultingOpaqueRect) OVERRIDE; + virtual void prepareToUpdate(const WebCore::IntRect& contentRect, const WebCore::IntSize&, float, float, WebCore::IntRect& resultingOpaqueRect, WebCore::CCRenderingStats&) OVERRIDE; // Sets the rect to invalidate during the next call to prepareToUpdate(). After the next // call to prepareToUpdate() the rect is reset. void setRectToInvalidate(const WebCore::IntRect&, FakeTiledLayerChromium*); @@ -122,7 +122,7 @@ public: const WebCore::FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; } // Updates the visibleContentRect(). - virtual void update(WebCore::CCTextureUpdater&, const WebCore::CCOcclusionTracker*) OVERRIDE; + virtual void update(WebCore::CCTextureUpdater&, const WebCore::CCOcclusionTracker*, WebCore::CCRenderingStats&) OVERRIDE; virtual void setTexturePriorities(const WebCore::CCPriorityCalculator&) OVERRIDE; diff --git a/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp b/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp index c206dda5e..ace7410c3 100644 --- a/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp +++ b/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp @@ -33,6 +33,7 @@ #include "WebCompositor.h" #include "WebKit.h" #include "cc/CCGraphicsContext.h" +#include "cc/CCRenderingStats.h" #include "cc/CCTextureUpdater.h" #include "platform/WebKitPlatformSupport.h" #include "platform/WebThread.h" @@ -151,8 +152,8 @@ TEST(Canvas2DLayerBridgeTest2, testClearClient) RefPtr<LayerChromium> layer = bridge->layer(); bridge.clear(); CCTextureUpdater updater; - layer->update(updater, 0); + CCRenderingStats stats; + layer->update(updater, 0, stats); } } // namespace - diff --git a/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp index fcfcce114..007bea446 100644 --- a/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp @@ -30,6 +30,7 @@ #include "CCLayerTreeTestCommon.h" #include "GraphicsContext.h" #include "OpaqueRectTrackingContentLayerDelegate.h" +#include "cc/CCRenderingStats.h" #include "skia/ext/platform_canvas.h" #include <gtest/gtest.h> @@ -102,7 +103,8 @@ TEST(ContentLayerChromiumTest, ContentLayerPainterWithDeviceScale) RefPtr<BitmapCanvasLayerTextureUpdater> updater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(&delegate)); IntRect resultingOpaqueRect; - updater->prepareToUpdate(contentRect, IntSize(256, 256), contentsScale, contentsScale, resultingOpaqueRect); + CCRenderingStats stats; + updater->prepareToUpdate(contentRect, IntSize(256, 256), contentsScale, contentsScale, resultingOpaqueRect, stats); EXPECT_INT_RECT_EQ(opaqueRectInContentSpace, resultingOpaqueRect); } diff --git a/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp b/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp index f53ad50d1..d9e3d697b 100644 --- a/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp +++ b/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp @@ -24,6 +24,8 @@ */ #include "config.h" +#include "IDBCursorBackendInterface.h" +#include "IDBDatabaseBackendInterface.h" #include "IDBFactoryBackendImpl.h" #include "IDBFakeBackingStore.h" #include "SecurityOrigin.h" diff --git a/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp b/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp index eb3c85abc..5c01e9ecc 100644 --- a/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp +++ b/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "IDBBackingStore.h" +#include "IDBCursorBackendInterface.h" #include "IDBDatabaseBackendImpl.h" #include "IDBFactoryBackendImpl.h" #include "IDBFakeBackingStore.h" diff --git a/Source/WebKit/chromium/tests/IDBFakeBackingStore.h b/Source/WebKit/chromium/tests/IDBFakeBackingStore.h index 08405ce0a..536d785b9 100644 --- a/Source/WebKit/chromium/tests/IDBFakeBackingStore.h +++ b/Source/WebKit/chromium/tests/IDBFakeBackingStore.h @@ -59,7 +59,6 @@ public: virtual void deleteIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId) OVERRIDE { } virtual bool putIndexDataForRecord(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&, const ObjectStoreRecordIdentifier*) OVERRIDE { return false; } virtual bool deleteIndexDataForRecord(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const ObjectStoreRecordIdentifier*) OVERRIDE { return false; } - virtual String getObjectViaIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&) OVERRIDE { return String(); } virtual PassRefPtr<IDBKey> getPrimaryKeyViaIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&) OVERRIDE { return PassRefPtr<IDBKey>(); } virtual bool keyExistsInIndex(int64_t databaseid, int64_t objectStoreId, int64_t indexId, const IDBKey& indexKey, RefPtr<IDBKey>& foundPrimaryKey) OVERRIDE { return false; } diff --git a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp index 1b6b8028b..d861164f6 100644 --- a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp @@ -80,8 +80,9 @@ public: , m_memoryAllocationLimitBytes(CCPrioritizedTextureManager::defaultMemoryAllocationLimit()) { m_rootLayer->createRenderSurface(); - m_rootRenderPass = CCRenderPass::create(m_rootLayer->renderSurface(), m_rootLayer->id()); - m_renderPasses.append(m_rootRenderPass.get()); + OwnPtr<CCRenderPass> rootRenderPass = CCRenderPass::create(m_rootLayer->renderSurface(), m_rootLayer->id()); + m_renderPassesInDrawOrder.append(rootRenderPass.get()); + m_renderPasses.set(m_rootLayer->id(), rootRenderPass.release()); } // CCRendererClient methods. @@ -96,8 +97,9 @@ public: // Methods added for test. int setFullRootLayerDamageCount() const { return m_setFullRootLayerDamageCount; } - CCRenderPass* rootRenderPass() { return m_rootRenderPass.get(); } - const CCRenderPassList& renderPasses() { return m_renderPasses; } + CCRenderPass* rootRenderPass() { return m_renderPassesInDrawOrder.last(); } + const CCRenderPassList& renderPassesInDrawOrder() const { return m_renderPassesInDrawOrder; } + const CCRenderPassIdHashMap& renderPasses() const { return m_renderPasses; } size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBytes; } @@ -105,8 +107,8 @@ private: int m_setFullRootLayerDamageCount; DebugScopedSetImplThread m_implThread; OwnPtr<CCLayerImpl> m_rootLayer; - OwnPtr<CCRenderPass> m_rootRenderPass; - CCRenderPassList m_renderPasses; + CCRenderPassList m_renderPassesInDrawOrder; + CCRenderPassIdHashMap m_renderPasses; size_t m_memoryAllocationLimitBytes; }; @@ -222,7 +224,7 @@ TEST_F(LayerRendererChromiumTest, DiscardedBackbufferIsRecreatedForScopeDuration EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); m_layerRendererChromium.setVisible(true); - m_layerRendererChromium.drawFrame(m_mockClient.renderPasses(), FloatRect()); + m_layerRendererChromium.drawFrame(m_mockClient.renderPassesInDrawOrder(), m_mockClient.renderPasses(), FloatRect()); EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded()); swapBuffers(); @@ -237,7 +239,7 @@ TEST_F(LayerRendererChromiumTest, FramebufferDiscardedAfterReadbackWhenNotVisibl EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); char pixels[4]; - m_layerRendererChromium.drawFrame(m_mockClient.renderPasses(), FloatRect()); + m_layerRendererChromium.drawFrame(m_mockClient.renderPassesInDrawOrder(), m_mockClient.renderPasses(), FloatRect()); EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded()); m_layerRendererChromium.getFramebufferPixels(pixels, IntRect(0, 0, 1, 1)); @@ -418,8 +420,7 @@ TEST(LayerRendererChromiumTest2, opaqueBackground) EXPECT_TRUE(layerRendererChromium.initialize()); - layerRendererChromium.drawFrame(mockClient.renderPasses(), FloatRect()); - layerRendererChromium.finishDrawingFrame(); + layerRendererChromium.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPasses(), FloatRect()); // On DEBUG builds, render passes with opaque background clear to blue to // easily see regions that were not drawn on the screen. @@ -442,8 +443,7 @@ TEST(LayerRendererChromiumTest2, transparentBackground) EXPECT_TRUE(layerRendererChromium.initialize()); - layerRendererChromium.drawFrame(mockClient.renderPasses(), FloatRect()); - layerRendererChromium.finishDrawingFrame(); + layerRendererChromium.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPasses(), FloatRect()); EXPECT_EQ(1, context->clearCount()); } diff --git a/Source/WebKit/chromium/tests/MemoryInfo.cpp b/Source/WebKit/chromium/tests/MemoryInfo.cpp new file mode 100644 index 000000000..0e093aee4 --- /dev/null +++ b/Source/WebKit/chromium/tests/MemoryInfo.cpp @@ -0,0 +1,61 @@ +/* + * 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 "MemoryInfo.h" + +#include <gtest/gtest.h> + +using namespace WebCore; + +namespace { + +TEST(MemoryInfo, quantizeMemorySize) +{ + EXPECT_EQ(10000000u, quantizeMemorySize(1024)); + EXPECT_EQ(10000000u, quantizeMemorySize(1024 * 1024)); + EXPECT_EQ(410000000u, quantizeMemorySize(389472983)); + EXPECT_EQ(39600000u, quantizeMemorySize(38947298)); + EXPECT_EQ(29400000u, quantizeMemorySize(28947298)); + EXPECT_EQ(19300000u, quantizeMemorySize(18947298)); + EXPECT_EQ(14300000u, quantizeMemorySize(13947298)); + EXPECT_EQ(10000000u, quantizeMemorySize(3894729)); + EXPECT_EQ(10000000u, quantizeMemorySize(389472)); + EXPECT_EQ(10000000u, quantizeMemorySize(38947)); + EXPECT_EQ(10000000u, quantizeMemorySize(3894)); + EXPECT_EQ(10000000u, quantizeMemorySize(389)); + EXPECT_EQ(10000000u, quantizeMemorySize(38)); + EXPECT_EQ(10000000u, quantizeMemorySize(3)); + EXPECT_EQ(10000000u, quantizeMemorySize(1)); + EXPECT_EQ(10000000u, quantizeMemorySize(0)); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index 11bf115b5..e39fe7e56 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -35,6 +35,7 @@ #include "LayerPainterChromium.h" #include "WebCompositor.h" #include "cc/CCOverdrawMetrics.h" +#include "cc/CCRenderingStats.h" #include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread #include <gtest/gtest.h> #include <public/WebTransformationMatrix.h> @@ -94,6 +95,7 @@ public: OwnPtr<CCGraphicsContext> m_context; OwnPtr<CCResourceProvider> m_resourceProvider; CCTextureUpdater m_updater; + CCRenderingStats m_stats; FakeTextureCopier m_copier; FakeTextureUploader m_uploader; CCPriorityCalculator m_priorityCalculator; @@ -116,7 +118,7 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -129,7 +131,7 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles) // ....but then only update one of them. layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0, m_stats); layer->pushPropertiesTo(layerImpl.get()); // We should only have the first tile since the other tile was invalidated but not painted. @@ -147,14 +149,13 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); - layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), &occluded, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -170,7 +171,7 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) layer->invalidateContentRect(IntRect(0, 0, 50, 50)); // ....but the area is occluded. occluded.setOcclusion(IntRect(0, 0, 50, 50)); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), &occluded, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -198,7 +199,7 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -220,7 +221,7 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) // This should recreate and update the deleted textures. layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -249,7 +250,7 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0, m_stats); updateTextures(); // We should need idle-painting for 3x3 tiles in the center. @@ -265,7 +266,7 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0, m_stats); EXPECT_TRUE(layer->needsIdlePaint(visibleRect)); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -316,8 +317,8 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) layer2->setTexturePriorities(m_priorityCalculator); layer1->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer1->updateContentRect(m_updater, layerRect, 0); - layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0); + layer1->updateContentRect(m_updater, layerRect, 0, m_stats); + layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0, m_stats); // We should need idle-painting for both remaining tiles in layer2. EXPECT_TRUE(layer2->needsIdlePaint(layer2Rect)); @@ -334,7 +335,7 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) layer2->setTexturePriorities(m_priorityCalculator); layer1->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0); + layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0, m_stats); // Oh well, commit the frame and push. updateTextures(); @@ -354,8 +355,8 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) layer2->setTexturePriorities(m_priorityCalculator); layer1->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer2->updateContentRect(m_updater, layer2Rect, 0); - layer1->updateContentRect(m_updater, layerRect, 0); + layer2->updateContentRect(m_updater, layer2Rect, 0, m_stats); + layer1->updateContentRect(m_updater, layerRect, 0, m_stats); updateTextures(); layer1->pushPropertiesTo(layerImpl1.get()); @@ -381,13 +382,12 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) occluded.setOcclusion(IntRect(0, 0, 100, 100)); layer->setBounds(IntSize(100, 100)); - layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleContentRect(IntRect(0, 0, 100, 100)); layer->invalidateContentRect(IntRect(0, 0, 100, 100)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), &occluded, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -412,7 +412,7 @@ TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -442,11 +442,11 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) layer2->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer1->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer1->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); // Invalidate a tile on layer1 layer2->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get()); - layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); updateTextures(); layer1->pushPropertiesTo(layer1Impl.get()); @@ -482,8 +482,8 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLay // Invalidate a tile on layer2 layer1->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get()); - layer1->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); - layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer1->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); + layer2->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); updateTextures(); layer1->pushPropertiesTo(layer1Impl.get()); layer2->pushPropertiesTo(layer2Impl.get()); @@ -517,7 +517,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0, m_stats); // Idle-painting should see no more priority tiles for painting. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -530,7 +530,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0, m_stats); // We shouldn't signal we need another idle paint. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -559,7 +559,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer) textureManager->prioritizeTextures(); // Empty layers don't paint or idle-paint. - layer->updateContentRect(m_updater, contentRect, 0); + layer->updateContentRect(m_updater, contentRect, 0, m_stats); // Empty layers don't have tiles. EXPECT_EQ(0u, layer->numPaintedTiles()); @@ -595,7 +595,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers) // Paint / idle-paint. layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0, m_stats); // Non-visible layers don't need idle paint. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -658,7 +658,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); } @@ -671,7 +671,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, visibleRect, 0); + layer->updateContentRect(m_updater, visibleRect, 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); } @@ -694,7 +694,7 @@ TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); updateTextures(1000); layer->pushPropertiesTo(layerImpl.get()); @@ -705,7 +705,7 @@ TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) layer->fakeLayerTextureUpdater()->clearPrepareCount(); // Invoke updateContentRect again. As the layer is valid updateContentRect shouldn't be invoked on // the LayerTextureUpdater. - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); updateTextures(1000); EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareCount()); @@ -713,12 +713,12 @@ TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) // setRectToInvalidate triggers invalidateContentRect() being invoked from updateContentRect. layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(25, 25, 50, 50), layer.get()); layer->fakeLayerTextureUpdater()->clearPrepareCount(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); updateTextures(1000); EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); layer->fakeLayerTextureUpdater()->clearPrepareCount(); // The layer should still be invalid as updateContentRect invoked invalidate. - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); updateTextures(1000); EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); } @@ -745,7 +745,7 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, contentBounds, 0); + layer->updateContentRect(m_updater, contentBounds, 0, m_stats); EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 300, 300 * 0.8), layer->updateRect()); updateTextures(); @@ -753,7 +753,7 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); layer->invalidateContentRect(contentBounds); - layer->updateContentRect(m_updater, contentBounds, 0); + layer->updateContentRect(m_updater, contentBounds, 0, m_stats); EXPECT_FLOAT_RECT_EQ(FloatRect(layerBounds), layer->updateRect()); updateTextures(); @@ -762,7 +762,7 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) layer->invalidateContentRect(partialDamage); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, contentBounds, 0); + layer->updateContentRect(m_updater, contentBounds, 0, m_stats); EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect()); } @@ -784,7 +784,7 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // Push the tiles to the impl side and check that there is exactly one. layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 100), 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); @@ -801,7 +801,7 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // The impl side should get 2x2 tiles now. layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 200, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 200, 200), 0, m_stats); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); @@ -813,7 +813,7 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // impl side. layer->setNeedsDisplay(); layer->setTexturePriorities(m_priorityCalculator); - layer->updateContentRect(m_updater, IntRect(1, 0, 0, 1), 0); + layer->updateContentRect(m_updater, IntRect(1, 0, 0, 1), 0, m_stats); textureManager->prioritizeTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -885,7 +885,7 @@ TEST_F(TiledLayerChromiumTest, resizeToSmaller) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 700, 700), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 700, 700), 0, m_stats); layer->setBounds(IntSize(200, 200)); layer->invalidateContentRect(IntRect(0, 0, 200, 200)); @@ -904,7 +904,7 @@ TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash) // Ensure no crash for bounds where size * size would overflow an int. layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 700, 700), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 700, 700), 0, m_stats); } TEST_F(TiledLayerChromiumTest, partialUpdates) @@ -1047,7 +1047,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(m_updater, IntRect(0, 0, 100, 200), 0, m_stats); EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->prepareRectCount()); } @@ -1060,15 +1060,14 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) // The tile size is 100x100. layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); - layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded, m_stats); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1079,7 +1078,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) occluded.setOcclusion(IntRect(250, 200, 300, 100)); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded, m_stats); EXPECT_EQ(36-2, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1090,7 +1089,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) occluded.setOcclusion(IntRect(250, 250, 300, 100)); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded, m_stats); EXPECT_EQ(36, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1107,7 +1106,6 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) // The tile size is 100x100. layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); // The partially occluded tiles (by the 150 occlusion height) are visible beyond the occlusion, so not culled. occluded.setOcclusion(IntRect(200, 200, 300, 150)); @@ -1116,7 +1114,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 360), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 360), &occluded, m_stats); EXPECT_EQ(24-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1131,7 +1129,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 350), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 350), &occluded, m_stats); EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1146,7 +1144,7 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 340), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 340), &occluded, m_stats); EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1164,14 +1162,13 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) // The tile size is 100x100. layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); layer->setVisibleContentRect(IntRect(0, 0, 600, 600)); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded, m_stats); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); { DebugScopedSetImplThread implThread; @@ -1185,7 +1182,7 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); // Repaint without marking it dirty. The 3 culled tiles will be pre-painted now. - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded, m_stats); EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1207,14 +1204,14 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) WebTransformationMatrix screenTransform; screenTransform.scale(0.5); layer->setScreenSpaceTransform(screenTransform); - layer->setDrawTransform(screenTransform * WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(screenTransform); occluded.setOcclusion(IntRect(100, 100, 150, 50)); - layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded, m_stats); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1235,14 +1232,17 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) // pixels, which means none should be occluded. layer->setContentsScale(0.5); layer->setBounds(IntSize(600, 600)); - layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + WebTransformationMatrix drawTransform; + drawTransform.scale(1 / layer->contentsScale()); + layer->setDrawTransform(drawTransform); + layer->setScreenSpaceTransform(drawTransform); occluded.setOcclusion(IntRect(200, 200, 300, 100)); - layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded, m_stats); // The content is half the size of the layer (so the number of tiles is fewer). // In this case, the content is 300x300, and since the tile size is 100, the // number of tiles 3x3. @@ -1258,11 +1258,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) // a different layer space. In this case the occluded region catches the // blown up tiles. occluded.setOcclusion(IntRect(200, 200, 300, 200)); - layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded, m_stats); EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1275,14 +1275,14 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) WebTransformationMatrix screenTransform; screenTransform.scale(0.5); layer->setScreenSpaceTransform(screenTransform); - layer->setDrawTransform(screenTransform * WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); + layer->setDrawTransform(screenTransform); occluded.setOcclusion(IntRect(100, 100, 150, 100)); - layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(m_priorityCalculator); textureManager->prioritizeTextures(); - layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(m_updater, IntRect(0, 0, 600, 600), &occluded, m_stats); EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1306,7 +1306,6 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) IntRect visibleBounds = IntRect(0, 0, 100, 150); layer->setBounds(contentBounds.size()); - layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleContentRect(visibleBounds); layer->setDrawOpacity(1); @@ -1316,7 +1315,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // If the layer doesn't paint opaque content, then the visibleContentOpaqueRegion should be empty. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(contentBounds); - layer->updateContentRect(m_updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded, m_stats); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1329,7 +1328,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) opaquePaintRect = IntRect(10, 10, 90, 190); layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect); layer->invalidateContentRect(contentBounds); - layer->updateContentRect(m_updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1342,7 +1341,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // If we paint again without invalidating, the same stuff should be opaque. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->updateContentRect(m_updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1357,7 +1356,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // not be affected. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(IntRect(0, 0, 1, 1)); - layer->updateContentRect(m_updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1372,7 +1371,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // not be affected. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(IntRect(10, 10, 1, 1)); - layer->updateContentRect(m_updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds()); @@ -1400,7 +1399,6 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) IntRect visibleBounds = IntRect(0, 0, 100, 300); layer->setBounds(contentBounds.size()); - layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); layer->setVisibleContentRect(visibleBounds); layer->setDrawOpacity(1); @@ -1410,7 +1408,7 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) // Invalidates and paints the whole layer. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(contentBounds); - layer->updateContentRect(m_updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1425,7 +1423,7 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); layer->invalidateContentRect(IntRect(0, 0, 1, 1)); layer->invalidateContentRect(IntRect(50, 200, 10, 10)); - layer->updateContentRect(m_updater, contentBounds, &occluded); + layer->updateContentRect(m_updater, contentBounds, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1653,7 +1651,7 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) textureManager->prioritizeTextures(); // Update the whole tile. - layer->updateContentRect(m_updater, contentRect, 0); + layer->updateContentRect(m_updater, contentRect, 0, m_stats); layer->trackingLayerPainter()->resetPaintedRect(); EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); @@ -1665,7 +1663,7 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) // Invalidate the entire layer in content space. When painting, the rect given to webkit should match the layer's bounds. layer->invalidateContentRect(contentRect); - layer->updateContentRect(m_updater, contentRect, 0); + layer->updateContentRect(m_updater, contentRect, 0, m_stats); EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } @@ -1688,7 +1686,7 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvali textureManager->prioritizeTextures(); // Update the whole tile. - layer->updateContentRect(m_updater, contentRect, 0); + layer->updateContentRect(m_updater, contentRect, 0, m_stats); layer->trackingLayerPainter()->resetPaintedRect(); EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); @@ -1700,7 +1698,7 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvali // Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds. layer->setNeedsDisplayRect(layerRect); - layer->updateContentRect(m_updater, contentRect, 0); + layer->updateContentRect(m_updater, contentRect, 0, m_stats); EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } diff --git a/Source/WebKit/chromium/tests/WebViewTest.cpp b/Source/WebKit/chromium/tests/WebViewTest.cpp index 33ce2f70c..3ca1094d0 100644 --- a/Source/WebKit/chromium/tests/WebViewTest.cpp +++ b/Source/WebKit/chromium/tests/WebViewTest.cpp @@ -254,7 +254,9 @@ TEST_F(WebViewTest, AutoResizeFixedHeightAndWidthOverflow) expectedWidth, expectedHeight, VisibleHorizontalScrollbar, NoVerticalScrollbar); } -TEST_F(WebViewTest, AutoResizeInBetweenSizes) +// Next three tests disabled for https://bugs.webkit.org/show_bug.cgi?id=92318 . +// It seems we can run three AutoResize tests, then the next one breaks. +TEST_F(WebViewTest, DISABLED_AutoResizeInBetweenSizes) { WebSize minAutoResize(90, 95); WebSize maxAutoResize(200, 300); @@ -266,7 +268,7 @@ TEST_F(WebViewTest, AutoResizeInBetweenSizes) expectedWidth, expectedHeight, NoHorizontalScrollbar, NoVerticalScrollbar); } -TEST_F(WebViewTest, AutoResizeOverflowSizes) +TEST_F(WebViewTest, DISABLED_AutoResizeOverflowSizes) { WebSize minAutoResize(90, 95); WebSize maxAutoResize(200, 300); @@ -278,7 +280,7 @@ TEST_F(WebViewTest, AutoResizeOverflowSizes) expectedWidth, expectedHeight, VisibleHorizontalScrollbar, VisibleVerticalScrollbar); } -TEST_F(WebViewTest, AutoResizeMaxSize) +TEST_F(WebViewTest, DISABLED_AutoResizeMaxSize) { WebSize minAutoResize(90, 95); WebSize maxAutoResize(200, 300); diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog index fe2e6c56e..8e7f0e2e2 100644 --- a/Source/WebKit/efl/ChangeLog +++ b/Source/WebKit/efl/ChangeLog @@ -1,3 +1,201 @@ +2012-07-29 YoungTaeck Song <youngtaeck.song@samsung.com> + + [WK2][EFL] TILED_BACKING_STORE support on Efl WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=91582 + + Reviewed by Noam Rosenthal. + + Add a dummy function for fixing building error when enabling TILED_BACKING_STORE. + + * WebCoreSupport/ChromeClientEfl.cpp: + (WebCore): + (WebCore::ChromeClientEfl::delegatedScrollRequested): + * WebCoreSupport/ChromeClientEfl.h: + (ChromeClientEfl): + +2012-07-27 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Regression(r123858): Default navigation policy decision was switched to "reject" + https://bugs.webkit.org/show_bug.cgi?id=92507 + + Reviewed by Kentaro Hara. + + After r92466, the default navigation policy is to reject the request if the + client does not make a decision explicitly. The default policy should be + to accept. This broke ewk_view unit tests. + + * ewk/ewk_view.cpp: + (ewk_view_navigation_policy_decision): + +2012-07-27 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [EFL] Fix wrong return value in EWK_VIEW_XXX macro. + https://bugs.webkit.org/show_bug.cgi?id=92466 + + Reviewed by Simon Hausmann. + + There are wrong return values in EWK_VIEW_XXX macros. The wrong return values + should be fixed. In addition, API description is also modified according to returned + value change. + + * ewk/ewk_view.cpp: + (ewk_view_setting_minimum_timer_interval_get): + (ewk_view_navigation_policy_decision): + (ewk_view_page_rect_get): + (ewk_view_setting_enable_xss_auditor_get): + * ewk/ewk_view.h: + +2012-07-27 Kihong Kwon <kihong.kwon@samsung.com> + + [EFL] Change prototype of run_open_panel + https://bugs.webkit.org/show_bug.cgi?id=91956 + + Reviewed by Kentaro Hara. + + In order to support all of the file chooser attributes, + change the types of parameters in run_open_panel method. + i.e., change "Eina_Bool allows_multiple_files, Eina_List *accept_types" + to "Ewk_File_Chooser *file_chooser" + In addition, Efl can support the capture attribute for HTML media capture. + + * WebCoreSupport/ChromeClientEfl.cpp: + (WebCore::ChromeClientEfl::runOpenPanel): + * ewk/ewk_view.cpp: + (ewk_view_run_open_panel): + * ewk/ewk_view.h: + * ewk/ewk_view_private.h: + +2012-07-26 Seokju Kwon <seokju.kwon@samsung.com> + + [EFL] Highlight the element under mouse on web inspector + https://bugs.webkit.org/show_bug.cgi?id=91592 + + Reviewed by Kentaro Hara. + + Implement highlighting the nodes when using the web inspector. + + * WebCoreSupport/InspectorClientEfl.cpp: + (WebCore::InspectorClientEfl::highlight): + (WebCore::InspectorClientEfl::hideHighlight): + (WebCore::InspectorClientEfl::invalidateView): + (WebCore): + * WebCoreSupport/InspectorClientEfl.h: + (InspectorClientEfl): + * ewk/ewk_paint_context.cpp: + (ewk_paint_context_paint_contents): + +2012-07-26 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][WK2] Implement Network Information provider + https://bugs.webkit.org/show_bug.cgi?id=92343 + + Reviewed by Kenneth Rohde Christiansen. + + Make NetworkInfoClientEfl use NetworkInfoProviderEfl + from WebCore to avoid code duplication with WebKit2. + + * WebCoreSupport/NetworkInfoClientEfl.cpp: + (WebCore::NetworkInfoClientEfl::startUpdating): + (WebCore::NetworkInfoClientEfl::stopUpdating): + (WebCore::NetworkInfoClientEfl::bandwidth): + (WebCore::NetworkInfoClientEfl::metered): + (WebCore): + * WebCoreSupport/NetworkInfoClientEfl.h: + (WebCore): + (NetworkInfoClientEfl): + +2012-07-26 Zoltan Nyul <zoltan.nyul@intel.com> + + [EFL] EFL port should use XDG paths + https://bugs.webkit.org/show_bug.cgi?id=91719 + + Reviewed by Kenneth Rohde Christiansen. + + Using xdg paths instead of home/.webkit directory for application + cache, web-database and local-storage. + + * ewk/ewk_main.cpp: + (_ewk_init_body): + +2012-07-26 Kaustubh Atrawalkar <kaustubh@motorola.com> + + [DRT] LTC:: pageNumberForElementById() could be moved to Internals + https://bugs.webkit.org/show_bug.cgi?id=92091 + + Reviewed by Adam Barth. + + Move the pageNumberForElementById from LayoutTestCotroller to Internals and + remove the old platform specific implementations as it exclusively tests WebCore functionality. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + +2012-07-25 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [EFL] Use eina_stringshare_add instead of strdup. + https://bugs.webkit.org/show_bug.cgi?id=92072 + + Reviewed by Kentaro Hara. + + Eina of EFL libraries supports a string functionality that replaces strdup. So, EFL port needs + to replace strdup with eina_stringshare_add function. + + In addition, some API descriptions need to be modified according to ewk APIs's parameter and + return type change. + + * WebCoreSupport/ChromeClientEfl.cpp: + (WebCore::ChromeClientEfl::runJavaScriptPrompt): + * ewk/ewk_cookies.cpp: + (ewk_cookies_get_all): + (ewk_cookies_cookie_free): + * ewk/ewk_cookies.h: + * ewk/ewk_frame.cpp: + (ewk_frame_script_execute): + (ewk_frame_selection_get): + (ewk_frame_resources_location_get): + (ewk_frame_plain_text_get): + * ewk/ewk_frame.h: + * ewk/ewk_intent.cpp: + (ewk_intent_suggestions_get): + (ewk_intent_extra_get): + (ewk_intent_extra_names_get): + * ewk/ewk_intent.h: + * ewk/ewk_js.cpp: + (ewk_js_variant_to_npvariant): + (ewk_js_object_new): + * ewk/ewk_view.cpp: + (_ewk_view_smart_run_javascript_prompt): + (ewk_view_selection_get): + (ewk_view_run_javascript_prompt): + (ewk_view_run_open_panel): + * ewk/ewk_view.h: + * ewk/ewk_view_private.h: + +2012-07-25 Kihong Kwon <kihong.kwon@samsung.com> + + [EFL] Add File Chooser API + https://bugs.webkit.org/show_bug.cgi?id=91957 + + Reviewed by Hajime Morita. + + Add APIs for file chooser. These APIs allow an application(like a browser) queries informations + about multiple files allowed, directory upload allowed, accept mimetypes list, + accept file extentions list, selected files list and capture to support HTML media capture. + + * ewk/EWebKit.h: + * ewk/ewk_file_chooser.cpp: Added. + (_Ewk_File_Chooser): + (ewk_file_chooser_allows_multiple_files_get): + (ewk_file_chooser_allows_directory_upload_get): + (ewk_file_chooser_accept_mimetypes_get): + (ewk_file_chooser_accept_file_extentions_get): + (ewk_file_chooser_selected_files_get): + (ewk_file_chooser_capture_get): + (ewk_file_chooser_new): + (ewk_file_chooser_free): + * ewk/ewk_file_chooser.h: Added. + * ewk/ewk_file_chooser_private.h: Added. + (WebCore): + 2012-07-23 Pierre Rossi <pierre.rossi@gmail.com> Unify numTouchEventHandlersChanged and needTouchEvents in the chrome client diff --git a/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp index 6a859053e..3b327ed78 100644 --- a/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp @@ -53,6 +53,7 @@ #include "ViewportArguments.h" #include "WindowFeatures.h" #include "ewk_custom_handler_private.h" +#include "ewk_file_chooser_private.h" #include "ewk_frame_private.h" #include "ewk_private.h" #include "ewk_security_origin_private.h" @@ -294,11 +295,11 @@ bool ChromeClientEfl::runJavaScriptConfirm(Frame* frame, const String& message) bool ChromeClientEfl::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result) { - char* value = 0; + const char* value = 0; ewk_view_run_javascript_prompt(m_view, kit(frame), message.utf8().data(), defaultValue.utf8().data(), &value); if (value) { result = String::fromUTF8(value); - free(value); + eina_stringshare_del(value); return true; } return false; @@ -474,17 +475,16 @@ void ChromeClientEfl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFile { RefPtr<FileChooser> chooser = prpFileChooser; Eina_List* selectedFilenames = 0; - void* filename; - Vector<String> filenames; - - const FileChooserSettings& settings = chooser->settings(); - bool confirm = ewk_view_run_open_panel(m_view, kit(frame), settings.allowsMultipleFiles, settings.acceptMIMETypes, &selectedFilenames); - + Ewk_File_Chooser* fileChooser = ewk_file_chooser_new(chooser.get()); + bool confirm = ewk_view_run_open_panel(m_view, kit(frame), fileChooser, &selectedFilenames); + ewk_file_chooser_free(fileChooser); if (!confirm) return; + void* filename; + Vector<String> filenames; EINA_LIST_FREE(selectedFilenames, filename) { - filenames.append((char*)filename); + filenames.append(String::fromUTF8(static_cast<char*>(filename))); free(filename); } @@ -650,4 +650,11 @@ void ChromeClientEfl::exitFullScreenForElement(WebCore::Element*) } #endif +#if USE(TILED_BACKING_STORE) +void ChromeClientEfl::delegatedScrollRequested(const IntPoint& point) +{ + notImplemented(); +} +#endif + } diff --git a/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h b/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h index 3cfc678ec..267f5af47 100644 --- a/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h @@ -180,6 +180,10 @@ public: virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const { return true; } virtual void numWheelEventHandlersChanged(unsigned) { } +#if USE(TILED_BACKING_STORE) + virtual void delegatedScrollRequested(const IntPoint& scrollPoint); +#endif + Evas_Object* m_view; KURL m_hoveredLinkURL; #if ENABLE(FULLSCREEN_API) diff --git a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp index bc0dc61be..4b804dd62 100644 --- a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp @@ -173,21 +173,6 @@ int DumpRenderTreeSupportEfl::numberOfPages(const Evas_Object* ewkFrame, float p return WebCore::PrintContext::numberOfPages(frame, WebCore::FloatSize(pageWidth, pageHeight)); } -int DumpRenderTreeSupportEfl::numberOfPagesForElementId(const Evas_Object* ewkFrame, const char* elementId, float pageWidth, float pageHeight) -{ - WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame); - - if (!frame) - return 0; - - WebCore::Element *element = frame->document()->getElementById(elementId); - - if (!element) - return 0; - - return WebCore::PrintContext::pageNumberForElement(element, WebCore::FloatSize(pageWidth, pageHeight)); -} - String DumpRenderTreeSupportEfl::pageSizeAndMarginsInPixels(const Evas_Object* ewkFrame, int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) { WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame); diff --git a/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp index bdc96e18d..b82039756 100644 --- a/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp @@ -37,6 +37,17 @@ static void notifyWebInspectorDestroy(void* userData, Evas_Object* webview, void inspectorFrontendClient->destroyInspectorWindow(true); } +static void invalidateView(Evas_Object* webView) +{ + Evas_Coord width, height; + Evas_Object* mainFrame = ewk_view_frame_main_get(webView); + if (mainFrame && ewk_frame_contents_size_get(mainFrame, &width, &height)) { + WebCore::Page* page = EWKPrivate::corePage(webView); + if (page) + page->mainFrame()->view()->invalidateRect(WebCore::IntRect(0, 0, width, height)); + } +} + class InspectorFrontendSettingsEfl : public InspectorFrontendClientLocal::Settings { public: virtual String getProperty(const String& name) @@ -107,12 +118,12 @@ void InspectorClientEfl::bringFrontendToFront() void InspectorClientEfl::highlight() { - notImplemented(); + invalidateView(m_inspectedView); } void InspectorClientEfl::hideHighlight() { - notImplemented(); + invalidateView(m_inspectedView); } bool InspectorClientEfl::sendMessageToFrontend(const String& message) diff --git a/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.cpp index 67e9c16bd..7a7c1c914 100644 --- a/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.cpp @@ -29,22 +29,12 @@ #include "NetworkInfoClientEfl.h" #if ENABLE(NETWORK_INFO) -#include "NetworkInfo.h" -#include "NotImplemented.h" -#include "ewk_private.h" -#include <Eeze.h> -#include <Eeze_Net.h> -#include <wtf/text/CString.h> -#include <wtf/text/WTFString.h> +#include "NotImplemented.h" namespace WebCore { -static const char* ethernetInterface = "eth0"; - NetworkInfoClientEfl::NetworkInfoClientEfl() - : m_controller(0) - , m_metered(false) { } @@ -54,52 +44,26 @@ NetworkInfoClientEfl::~NetworkInfoClientEfl() void NetworkInfoClientEfl::startUpdating() { - if (!eeze_init()) { - ERR("Fail to start network information client."); - return; - } + m_provider.startUpdating(); } void NetworkInfoClientEfl::stopUpdating() { - eeze_shutdown(); + m_provider.stopUpdating(); } double NetworkInfoClientEfl::bandwidth() const { - // FIXME : This function should consider cellular network as well. For example, 2G, 3G and 4G. - // See https://bugs.webkit.org/show_bug.cgi?id=89851 for detail. - Eeze_Net* ethNet = eeze_net_new(ethernetInterface); - if (!ethNet) - return 0; - - eeze_net_scan(ethNet); - - // FIXME : The eeze library doesn't support EEZE_NET_ADDR_TYPE_IP type yet. So, EEZE_NET_ADDR_TYPE_BROADCAST - // is used for now. - // See https://bugs.webkit.org/show_bug.cgi?id=89852 for detail. - const char* address = eeze_net_addr_get(ethNet, EEZE_NET_ADDR_TYPE_BROADCAST); - if (!address) - return 0; // If network is offline, return 0. - - double bandwidth; - const char* attribute = eeze_net_attribute_get(ethNet, "speed"); - if (attribute) { - bool ok; - bandwidth = String::fromUTF8(attribute).toUIntStrict(&ok); - } else - bandwidth = std::numeric_limits<double>::infinity(); // If bandwidth is unknown, return infinity value. - - eeze_net_free(ethNet); - - return bandwidth / 8; // MB/s + return m_provider.bandwidth(); } bool NetworkInfoClientEfl::metered() const { notImplemented(); - return m_metered; -} + return false; } + +} // namespace WebCore + #endif diff --git a/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.h b/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.h index 20e8ab756..6908737d1 100644 --- a/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.h @@ -31,10 +31,11 @@ #if ENABLE(NETWORK_INFO) -#include "NetworkInfoClient.h" -#include "NetworkInfoController.h" +#include <NetworkInfoClient.h> +#include <NetworkInfoProviderEfl.h> namespace WebCore { + class NetworkInfoClientEfl : public WebCore::NetworkInfoClient { public: NetworkInfoClientEfl(); @@ -47,11 +48,10 @@ public: virtual bool metered() const; private: - NetworkInfoController* m_controller; - - bool m_metered; + WebCore::NetworkInfoProviderEfl m_provider; }; -} + +} // namespace WebCore #endif #endif // NetworkInfoClientEfl_h diff --git a/Source/WebKit/efl/ewk/EWebKit.h b/Source/WebKit/efl/ewk/EWebKit.h index f90860373..7c91c3c9a 100644 --- a/Source/WebKit/efl/ewk/EWebKit.h +++ b/Source/WebKit/efl/ewk/EWebKit.h @@ -32,6 +32,7 @@ #include "ewk_auth.h" #include "ewk_contextmenu.h" #include "ewk_cookies.h" +#include "ewk_file_chooser.h" #include "ewk_frame.h" #include "ewk_history.h" #include "ewk_intent.h" diff --git a/Source/WebKit/efl/ewk/ewk_cookies.cpp b/Source/WebKit/efl/ewk/ewk_cookies.cpp index 546651390..bbee8e49d 100644 --- a/Source/WebKit/efl/ewk/ewk_cookies.cpp +++ b/Source/WebKit/efl/ewk/ewk_cookies.cpp @@ -77,10 +77,10 @@ Eina_List* ewk_cookies_get_all(void) for (p = list; p; p = p->next) { SoupCookie* cookie = static_cast<SoupCookie*>(p->data); Ewk_Cookie* ewkCookie = new Ewk_Cookie; - ewkCookie->name = strdup(cookie->name); - ewkCookie->value = strdup(cookie->value); - ewkCookie->domain = strdup(cookie->domain); - ewkCookie->path = strdup(cookie->path); + ewkCookie->name = eina_stringshare_add(cookie->name); + ewkCookie->value = eina_stringshare_add(cookie->value); + ewkCookie->domain = eina_stringshare_add(cookie->domain); + ewkCookie->path = eina_stringshare_add(cookie->path); ewkCookie->expires = soup_date_to_time_t(cookie->expires); ewkCookie->secure = static_cast<Eina_Bool>(cookie->secure); ewkCookie->http_only = static_cast<Eina_Bool>(cookie->http_only); @@ -117,10 +117,10 @@ void ewk_cookies_cookie_del(Ewk_Cookie* cookie) void ewk_cookies_cookie_free(Ewk_Cookie* cookie) { EINA_SAFETY_ON_NULL_RETURN(cookie); - free(cookie->name); - free(cookie->value); - free(cookie->domain); - free(cookie->path); + eina_stringshare_del(cookie->name); + eina_stringshare_del(cookie->value); + eina_stringshare_del(cookie->domain); + eina_stringshare_del(cookie->path); delete cookie; } diff --git a/Source/WebKit/efl/ewk/ewk_cookies.h b/Source/WebKit/efl/ewk/ewk_cookies.h index 939ed3da1..dba0ebe13 100644 --- a/Source/WebKit/efl/ewk/ewk_cookies.h +++ b/Source/WebKit/efl/ewk/ewk_cookies.h @@ -42,16 +42,19 @@ extern "C" { * \struct _Ewk_Cookie * * @brief Describes properties of an HTTP cookie. + * + * All the strings are guaranteed to be stringshared, so use eina_stringshare_ref() + * instead of eina_stringshare_add() or strdup(). */ struct _Ewk_Cookie { /// the cookie name - char *name; + const char *name; /// the cookie value - char *value; + const char *value; /// the "domain" attribute, or else the hostname that the cookie came from - char *domain; + const char *domain; /// the "path" attribute, or @c NULL - char *path; + const char *path; /// the cookie expiration time, or @c 0 for a session cookie time_t expires; /// @c EINA_TRUE if the cookie should only be tranferred over SSL diff --git a/Source/WebKit/efl/ewk/ewk_file_chooser.cpp b/Source/WebKit/efl/ewk/ewk_file_chooser.cpp new file mode 100644 index 000000000..686bdc542 --- /dev/null +++ b/Source/WebKit/efl/ewk/ewk_file_chooser.cpp @@ -0,0 +1,117 @@ +/* + Copyright (C) 2012 Samsung Electronics + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" +#include "ewk_file_chooser.h" + +#include "FileChooser.h" +#include "ewk_file_chooser_private.h" +#include <wtf/text/CString.h> + +struct _Ewk_File_Chooser { + RefPtr<WebCore::FileChooser> fileChooser; +}; + +Eina_Bool ewk_file_chooser_allows_multiple_files_get(const Ewk_File_Chooser* chooser) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(chooser, false); + return chooser->fileChooser->settings().allowsMultipleFiles; +} + +Eina_Bool ewk_file_chooser_allows_directory_upload_get(const Ewk_File_Chooser* chooser) +{ +#if ENABLE(DIRECTORY_UPLOAD) + EINA_SAFETY_ON_NULL_RETURN_VAL(chooser, false); + return chooser->fileChooser->settings().allowsDirectoryUpload; +#else + return false; +#endif +} + +Eina_List* ewk_file_chooser_accept_mimetypes_get(const Ewk_File_Chooser* chooser) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(chooser, 0); + + Eina_List* mimetypes = 0; + size_t count = chooser->fileChooser->settings().acceptMIMETypes.size(); + for (size_t i = 0; i < count; ++i) + mimetypes = eina_list_append(mimetypes, eina_stringshare_add(chooser->fileChooser->settings().acceptMIMETypes[i].utf8().data())); + + return mimetypes; +} + +Eina_List* ewk_file_chooser_accept_file_extentions_get(const Ewk_File_Chooser* chooser) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(chooser, 0); + + Eina_List* fileExtentions = 0; + size_t count = chooser->fileChooser->settings().acceptFileExtensions.size(); + for (size_t i = 0; i < count; ++i) + fileExtentions = eina_list_append(fileExtentions, eina_stringshare_add(chooser->fileChooser->settings().acceptFileExtensions[i].utf8().data())); + + return fileExtentions; +} + +Eina_List* ewk_file_chooser_selected_files_get(const Ewk_File_Chooser* chooser) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(chooser, 0); + + Eina_List* files = 0; + size_t count = chooser->fileChooser->settings().selectedFiles.size(); + for (size_t i = 0; i < count; ++i) + files = eina_list_append(files, eina_stringshare_add(chooser->fileChooser->settings().selectedFiles[i].utf8().data())); + + return files; +} + +Ewk_File_Chooser_Capture_Type ewk_file_chooser_capture_get(const Ewk_File_Chooser* chooser) +{ +#if ENABLE(MEDIA_CAPTURE) + EINA_SAFETY_ON_NULL_RETURN_VAL(chooser, EWK_FILE_CHOOSER_CAPTURE_TYPE_INVALID); + + String capture = chooser->fileChooser->settings().capture; + + if (capture == "camera") + return EWK_FILE_CHOOSER_CAPTURE_TYPE_CAMERA; + + if (capture == "camcorder") + return EWK_FILE_CHOOSER_CAPTURE_TYPE_CAMCORDER; + + if (capture == "microphone") + return EWK_FILE_CHOOSER_CAPTURE_TYPE_MICROPHONE; + + return EWK_FILE_CHOOSER_CAPTURE_TYPE_FILESYSTEM; +#else + return EWK_FILE_CHOOSER_CAPTURE_TYPE_INVALID; +#endif +} + +Ewk_File_Chooser* ewk_file_chooser_new(WebCore::FileChooser* fileChooser) +{ + Ewk_File_Chooser* ewkFileChooser = new Ewk_File_Chooser; + ewkFileChooser->fileChooser = fileChooser; + return ewkFileChooser; +} + +void ewk_file_chooser_free(Ewk_File_Chooser* chooser) +{ + chooser->fileChooser = 0; + delete chooser; +} + diff --git a/Source/WebKit/efl/ewk/ewk_file_chooser.h b/Source/WebKit/efl/ewk/ewk_file_chooser.h new file mode 100644 index 000000000..c4590d4dd --- /dev/null +++ b/Source/WebKit/efl/ewk/ewk_file_chooser.h @@ -0,0 +1,132 @@ +/* + Copyright (C) 2012 Samsung Electronics + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file ewk_file_chooser.h + * @brief File Chooser API. + * + * File Chooser supports APIs for file selection dialog. + * This support attributes of file chooser regarding: + * - allowance of multiple files selection + * - allowance of upload directory + * - list of accepted mime types + * - list of accepted file extensions + * - list of initial selected file names + * - capture attribute for HTML media capture + */ + +#ifndef ewk_file_chooser_h +#define ewk_file_chooser_h + +#include <Eina.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _Ewk_File_Chooser Ewk_File_Chooser; + +/** + * \enum _Ewk_File_Chooser_Capture_Type + * @brief Types of capture attribute of file chooser to support the HTML media capture. + */ +enum _Ewk_File_Chooser_Capture_Type { + EWK_FILE_CHOOSER_CAPTURE_TYPE_INVALID, + EWK_FILE_CHOOSER_CAPTURE_TYPE_FILESYSTEM, + EWK_FILE_CHOOSER_CAPTURE_TYPE_CAMERA, + EWK_FILE_CHOOSER_CAPTURE_TYPE_CAMCORDER, + EWK_FILE_CHOOSER_CAPTURE_TYPE_MICROPHONE +}; +typedef enum _Ewk_File_Chooser_Capture_Type Ewk_File_Chooser_Capture_Type; + +/** + * Query if multiple files are supported by file chooser. + * + * @param f file chooser object. + * + * It returns a boolean value which indicates if multiple file is supported or not. + * + * @return @c EINA_TRUE on support multiple files or @c EINA_FALSE otherwise. + */ +EAPI Eina_Bool ewk_file_chooser_allows_multiple_files_get(const Ewk_File_Chooser *f); + +/** + * Query if directory upload is supported by file chooser. + * + * @param f file chooser object. + * + * It returns a boolean value which indicates if directory upload is supported or not. + * + * @return @c EINA_TRUE on support directory upload or @c EINA_FALSE otherwise. + */ +EAPI Eina_Bool ewk_file_chooser_allows_directory_upload_get(const Ewk_File_Chooser *f); + +/** + * Returns the list of accepted mimetypes of the file chooser. + * + * @param f file chooser object. + * + * @return Eina_List of accepted mimetypes on success, or @c NULL on failure, + * the Eina_List and its items should be freed after use. Use eina_stringshare_del() + * to free the items. + */ +EAPI Eina_List *ewk_file_chooser_accept_mimetypes_get(const Ewk_File_Chooser *f); + +/** + * Returns the list of accepted file extensions of the file chooser. + * + * @param f file chooser object. + * + * @return @c Eina_List of accepted file extensions on success, or @c NULL on failure, + * the Eina_List and its items should be freed after use. Use eina_stringshare_del() + * to free the items. + */ +EAPI Eina_List *ewk_file_chooser_accept_file_extentions_get(const Ewk_File_Chooser *f); + +/** + * Returns the list of selected file names of the file chooser. + * + * This list indicates previously selected file names of the file chooser. + * These can be used by initial values of the file dialog. + * + * @param f file chooser object. + * + * @return @c Eina_List of selected file names on success, or @c NULL on failure, + * the Eina_List and its items should be freed after use. Use eina_stringshare_del() + * to free the items. + */ +EAPI Eina_List *ewk_file_chooser_selected_files_get(const Ewk_File_Chooser *f); + +/** + * Returns the capture attribute of the file chooser to support HTML media capture. + * + * @see http://www.w3.org/TR/html-media-capture/ for the semantics of the capture attribute. + * + * @param f file chooser object. + * + * @return @c Ewk_File_Chooser_Capture_Type on supporting HTML media capture or + * @c EWK_FILE_CHOOSER_CAPTURE_TYPE_INVALID on failure. + */ +EAPI Ewk_File_Chooser_Capture_Type ewk_file_chooser_capture_get(const Ewk_File_Chooser *f); + +#ifdef __cplusplus +} +#endif + +#endif // ewk_file_chooser_h diff --git a/Source/WebKit/efl/ewk/ewk_file_chooser_private.h b/Source/WebKit/efl/ewk/ewk_file_chooser_private.h new file mode 100644 index 000000000..519e54ae1 --- /dev/null +++ b/Source/WebKit/efl/ewk/ewk_file_chooser_private.h @@ -0,0 +1,31 @@ +/* + Copyright (C) 2012 Samsung Electronics + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef ewk_file_chooser_private_h +#define ewk_file_chooser_private_h + +namespace WebCore { +class FileChooser; +} + +Ewk_File_Chooser* ewk_file_chooser_new(WebCore::FileChooser* fileChooser); +void ewk_file_chooser_free(Ewk_File_Chooser* chooser); + +#endif // ewk_file_chooser_private_h + diff --git a/Source/WebKit/efl/ewk/ewk_frame.cpp b/Source/WebKit/efl/ewk/ewk_frame.cpp index 6a4b1a3f2..fba460ec0 100644 --- a/Source/WebKit/efl/ewk/ewk_frame.cpp +++ b/Source/WebKit/efl/ewk/ewk_frame.cpp @@ -439,7 +439,7 @@ Eina_Bool ewk_frame_contents_alternate_set(Evas_Object* ewkFrame, const char* co unreachableUri); } -char* ewk_frame_script_execute(Evas_Object* ewkFrame, const char* script) +const char* ewk_frame_script_execute(Evas_Object* ewkFrame, const char* script) { EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, 0); @@ -458,7 +458,7 @@ char* ewk_frame_script_execute(Evas_Object* ewkFrame, const char* script) JSC::ExecState* exec = smartData->frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec(); JSC::JSLockHolder lock(exec); resultString = WebCore::ustringToString(result.toString(exec)->value(exec)); - return strdup(resultString.utf8().data()); + return eina_stringshare_add(resultString.utf8().data()); #else notImplemented(); return 0; @@ -485,14 +485,14 @@ Eina_Bool ewk_frame_editable_set(Evas_Object* ewkFrame, Eina_Bool editable) return true; } -char* ewk_frame_selection_get(const Evas_Object* ewkFrame) +const char* ewk_frame_selection_get(const Evas_Object* ewkFrame) { EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, 0); WTF::CString selectedText = smartData->frame->editor()->selectedText().utf8(); if (selectedText.isNull()) return 0; - return strdup(selectedText.data()); + return eina_stringshare_add(selectedText.data()); } Eina_Bool ewk_frame_text_search(const Evas_Object* ewkFrame, const char* text, Eina_Bool caseSensitive, Eina_Bool forward, Eina_Bool wrap) @@ -1736,7 +1736,7 @@ Eina_List* ewk_frame_resources_location_get(const Evas_Object* ewkFrame) if (found) continue; - char* imageLocationCopy = strdup(imageLocation.utf8().data()); + const char* imageLocationCopy = eina_stringshare_add(imageLocation.utf8().data()); if (!imageLocationCopy) goto out_of_memory_handler; listOfImagesLocation = eina_list_append(listOfImagesLocation, imageLocationCopy); @@ -1754,7 +1754,7 @@ out_of_memory_handler: return 0; } -char* ewk_frame_plain_text_get(const Evas_Object* ewkFrame) +const char* ewk_frame_plain_text_get(const Evas_Object* ewkFrame) { EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, 0); @@ -1767,7 +1767,7 @@ char* ewk_frame_plain_text_get(const Evas_Object* ewkFrame) if (!documentElement) return 0; - return strdup(documentElement->innerText().utf8().data()); + return eina_stringshare_add(documentElement->innerText().utf8().data()); } Eina_Bool ewk_frame_mixed_content_displayed_get(const Evas_Object* ewkFrame) diff --git a/Source/WebKit/efl/ewk/ewk_frame.h b/Source/WebKit/efl/ewk/ewk_frame.h index 4498a4363..b196332f2 100644 --- a/Source/WebKit/efl/ewk/ewk_frame.h +++ b/Source/WebKit/efl/ewk/ewk_frame.h @@ -446,14 +446,14 @@ EAPI Eina_Bool ewk_frame_contents_alternate_set(Evas_Object *o, const char *c /** * Requests execution of the given script. * - * The returned string @b should be freed after use. + * The returned string @b should be freed by eina_stringshare_del() after use. * * @param o frame object to execute script * @param script Java Script to execute * * @return newly allocated string for result or @c NULL if the result cannot be converted to string or failure */ -EAPI char *ewk_frame_script_execute(Evas_Object *o, const char *script); +EAPI const char *ewk_frame_script_execute(Evas_Object *o, const char *script); /** * Queries if the frame is editable. @@ -477,13 +477,13 @@ EAPI Eina_Bool ewk_frame_editable_set(Evas_Object *o, Eina_Bool editable); /** * Gets the copy of the selected text. * - * The returned string @b should be freed after use. + * The returned string @b should be freed by eina_stringshare_del() after use. * * @param o the frame object to get selected text * * @return a newly allocated string or @c NULL if nothing is selected or on failure */ -EAPI char *ewk_frame_selection_get(const Evas_Object *o); +EAPI const char *ewk_frame_selection_get(const Evas_Object *o); /** * Searches the given string in a document. @@ -968,12 +968,14 @@ EAPI Eina_List *ewk_frame_resources_location_get(const Evas_Object *o); * This function returns the contents of the given frame converted to plain text, * removing all the HTML formatting. * + * The returned string @b should be freed by eina_stringshare_del() after use. + * * @param ewkFrame Frame object whose contents to retrieve. * * @return A newly allocated string (which must be freed by the caller with @c free()) * or @c NULL in case of failure. */ -EAPI char *ewk_frame_plain_text_get(const Evas_Object *o); +EAPI const char *ewk_frame_plain_text_get(const Evas_Object *o); /** * Returns whether the frame has displayed mixed content. diff --git a/Source/WebKit/efl/ewk/ewk_intent.cpp b/Source/WebKit/efl/ewk/ewk_intent.cpp index ef7914186..76c2d68da 100644 --- a/Source/WebKit/efl/ewk/ewk_intent.cpp +++ b/Source/WebKit/efl/ewk/ewk_intent.cpp @@ -106,21 +106,21 @@ Eina_List* ewk_intent_suggestions_get(const Ewk_Intent* intent) Eina_List* listOfSuggestions = 0; Vector<WebCore::KURL>::const_iterator it; for (it = core->suggestions().begin(); it != core->suggestions().end(); ++it) - listOfSuggestions = eina_list_append(listOfSuggestions, strdup(it->string().utf8().data())); + listOfSuggestions = eina_list_append(listOfSuggestions, eina_stringshare_add(it->string().utf8().data())); return listOfSuggestions; #else return 0; #endif } -char* ewk_intent_extra_get(const Ewk_Intent* intent, const char* key) +const char* ewk_intent_extra_get(const Ewk_Intent* intent, const char* key) { #if ENABLE(WEB_INTENTS) EWK_INTENT_CORE_GET_OR_RETURN(intent, core, 0); WTF::HashMap<String, String>::const_iterator val = core->extras().find(String::fromUTF8(key)); if (val == core->extras().end()) return 0; - return strdup(val->second.utf8().data()); + return eina_stringshare_add(val->second.utf8().data()); #else return 0; #endif @@ -133,7 +133,7 @@ Eina_List* ewk_intent_extra_names_get(const Ewk_Intent* intent) Eina_List* listOfNames = 0; WTF::HashMap<String, String>::const_iterator::Keys it = core->extras().begin().keys(); for (; it != core->extras().end().keys(); ++it) - listOfNames = eina_list_append(listOfNames, strdup(it->utf8().data())); + listOfNames = eina_list_append(listOfNames, eina_stringshare_add(it->utf8().data())); return listOfNames; #else return 0; diff --git a/Source/WebKit/efl/ewk/ewk_intent.h b/Source/WebKit/efl/ewk/ewk_intent.h index f49a76dc4..2b779cddc 100644 --- a/Source/WebKit/efl/ewk/ewk_intent.h +++ b/Source/WebKit/efl/ewk/ewk_intent.h @@ -85,12 +85,14 @@ EAPI Eina_List *ewk_intent_suggestions_get(const Ewk_Intent *intent); /** * Retrieves the value (if any) from the extra data dictionary this intent was constructed with. * + * The returned string should be freed by eina_stringshare_del() after use. + * * @param intent intent item to query. * @param key key to query in the dictionary. * * @return a newly allocated string or @c NULL in case of error or if the key does not exist. */ -EAPI char *ewk_intent_extra_get(const Ewk_Intent *intent, const char *key); +EAPI const char *ewk_intent_extra_get(const Ewk_Intent *intent, const char *key); /** * Retrieve a list of the names of extra metadata associated with the intent. @@ -98,8 +100,8 @@ EAPI char *ewk_intent_extra_get(const Ewk_Intent *intent, const char *key); * @param intent intent item to query. * * @return @c Eina_List with names of extra metadata on success, or @c NULL on failure, - * the Eina_List and its items should be freed after use. Use free() to free the - * items. + * the Eina_List and its items should be freed after use. Use eina_stringshare_del() + * to free the items. */ EAPI Eina_List *ewk_intent_extra_names_get(const Ewk_Intent *intent); diff --git a/Source/WebKit/efl/ewk/ewk_js.cpp b/Source/WebKit/efl/ewk/ewk_js.cpp index f08f98e15..0cbb18952 100644 --- a/Source/WebKit/efl/ewk/ewk_js.cpp +++ b/Source/WebKit/efl/ewk/ewk_js.cpp @@ -64,7 +64,7 @@ static Eina_Bool ewk_js_variant_to_npvariant(const Ewk_JS_Variant* data, NPVaria DOUBLE_TO_NPVARIANT(data->value.d, *result); break; case EWK_JS_VARIANT_STRING: - string_value = strdup(data->value.s); + string_value = eina_stringshare_add(data->value.s); if (string_value) STRINGZ_TO_NPVARIANT(string_value, *result); else @@ -569,7 +569,7 @@ Ewk_JS_Object* ewk_js_object_new(const Ewk_JS_Class_Meta* jsMetaClass) value->value.o = 0; break; case EWK_JS_VARIANT_STRING: - value->value.s = strdup(prop.value.value.s); + value->value.s = eina_stringshare_add(prop.value.value.s); break; case EWK_JS_VARIANT_BOOL: value->value.b = prop.value.value.b; diff --git a/Source/WebKit/efl/ewk/ewk_main.cpp b/Source/WebKit/efl/ewk/ewk_main.cpp index b48c28a6b..c2ccc6a6d 100644 --- a/Source/WebKit/efl/ewk/ewk_main.cpp +++ b/Source/WebKit/efl/ewk/ewk_main.cpp @@ -39,6 +39,7 @@ #include <Ecore.h> #include <Ecore_Evas.h> #include <Edje.h> +#include <Efreet.h> #include <Eina.h> #include <Evas.h> #include <glib-object.h> @@ -159,23 +160,17 @@ Eina_Bool _ewk_init_body(void) ewk_settings_page_cache_capacity_set(3); WebCore::PageGroup::setShouldTrackVisitedLinks(true); - String home = WebCore::homeDirectoryPath(); - struct stat state; - // check home directory first - if (stat(home.utf8().data(), &state) == -1) { - // Exit now - otherwise you may have some crash later - int errnowas = errno; - CRITICAL("Can't access HOME dir (or /tmp) - no place to save databases: %s", strerror(errnowas)); - return false; - } + String localStorageDirectory = String::fromUTF8(efreet_data_home_get()) + "/WebKitEfl/LocalStorage"; + String webDatabaseDirectory = String::fromUTF8(efreet_cache_home_get()) + "/WebKitEfl/Databases"; + String applicationCacheDirectory = String::fromUTF8(efreet_cache_home_get()) + "/WebKitEfl/Applications"; - WTF::String webkitDirectory = home + "/.webkit"; - if (WebCore::makeAllDirectories(webkitDirectory)) - ewk_settings_web_database_path_set(webkitDirectory.utf8().data()); + ewk_settings_local_storage_path_set(localStorageDirectory.utf8().data()); + ewk_settings_web_database_path_set(webDatabaseDirectory.utf8().data()); + ewk_settings_application_cache_path_set(applicationCacheDirectory.utf8().data()); ewk_network_tls_certificate_check_set(false); - WebCore::StorageTracker::initializeTracker(webkitDirectory.utf8().data(), trackerClient()); + WebCore::StorageTracker::initializeTracker(localStorageDirectory.utf8().data(), trackerClient()); SoupSession* session = WebCore::ResourceHandle::defaultSession(); SoupSessionFeature* auth_dialog = static_cast<SoupSessionFeature*>(g_object_new(EWK_TYPE_SOUP_AUTH_DIALOG, 0)); diff --git a/Source/WebKit/efl/ewk/ewk_paint_context.cpp b/Source/WebKit/efl/ewk/ewk_paint_context.cpp index 9557f0323..bdbd899bc 100644 --- a/Source/WebKit/efl/ewk/ewk_paint_context.cpp +++ b/Source/WebKit/efl/ewk/ewk_paint_context.cpp @@ -23,6 +23,11 @@ #include "ewk_paint_context_private.h" #include "ewk_private.h" +#if ENABLE(INSPECTOR) +#include "InspectorController.h" +#include "Page.h" +#endif + Ewk_Paint_Context* ewk_paint_context_new(cairo_t* cairo) { EINA_SAFETY_ON_NULL_RETURN_VAL(cairo, 0); @@ -169,4 +174,13 @@ void ewk_paint_context_paint_contents(Ewk_Paint_Context* context, WebCore::Frame if (view->isTransparent()) context->graphicContext->clearRect(paintArea); view->paintContents(context->graphicContext.get(), paintArea); + +#if ENABLE(INSPECTOR) + WebCore::Page* page = view->frame()->page(); + if (page) { + WebCore::InspectorController* controller = page->inspectorController(); + if (controller->highlightedNode()) + controller->drawHighlight(*context->graphicContext); + } +#endif } diff --git a/Source/WebKit/efl/ewk/ewk_view.cpp b/Source/WebKit/efl/ewk/ewk_view.cpp index dc8ac88ba..5309181b3 100644 --- a/Source/WebKit/efl/ewk/ewk_view.cpp +++ b/Source/WebKit/efl/ewk/ewk_view.cpp @@ -633,9 +633,9 @@ static Eina_Bool _ewk_view_smart_should_interrupt_javascript(Ewk_View_Smart_Data return false; } -static Eina_Bool _ewk_view_smart_run_javascript_prompt(Ewk_View_Smart_Data* smartData, Evas_Object* frame, const char* message, const char* defaultValue, char** value) +static Eina_Bool _ewk_view_smart_run_javascript_prompt(Ewk_View_Smart_Data* smartData, Evas_Object* frame, const char* message, const char* defaultValue, const char** value) { - *value = strdup("test"); + *value = eina_stringshare_add("test"); Eina_Bool result = true; INF("javascript prompt:\n" "\t message: %s\n" @@ -1585,14 +1585,14 @@ Eina_Bool ewk_view_editable_set(Evas_Object* ewkView, Eina_Bool editable) return ewk_frame_editable_set(smartData->main_frame, editable); } -char* ewk_view_selection_get(const Evas_Object* ewkView) +const char* ewk_view_selection_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); CString selectedString = priv->page->focusController()->focusedOrMainFrame()->editor()->selectedText().utf8(); if (selectedString.isNull()) return 0; - return strdup(selectedString.data()); + return eina_stringshare_add(selectedString.data()); } Eina_Bool ewk_view_editor_command_execute(const Evas_Object* ewkView, const Ewk_Editor_Command command, const char* value) @@ -2614,8 +2614,8 @@ Eina_Bool ewk_view_setting_minimum_timer_interval_set(Evas_Object* ewkView, doub double ewk_view_setting_minimum_timer_interval_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1.0); return priv->settings.domTimerInterval; } @@ -3481,7 +3481,7 @@ bool ewk_view_run_javascript_confirm(Evas_Object* ewkView, Evas_Object* frame, c return smartData->api->run_javascript_confirm(smartData, frame, message); } -bool ewk_view_run_javascript_prompt(Evas_Object* ewkView, Evas_Object* frame, const char* message, const char* defaultValue, char** value) +bool ewk_view_run_javascript_prompt(Evas_Object* ewkView, Evas_Object* frame, const char* message, const char* defaultValue, const char** value) { DBG("ewkView=%p frame=%p message=%s", ewkView, frame, message); EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); @@ -3578,9 +3578,9 @@ uint64_t ewk_view_exceeded_database_quota(Evas_Object* ewkView, Evas_Object* fra * * @return @false if user canceled file selection; @true if confirmed. */ -bool ewk_view_run_open_panel(Evas_Object* ewkView, Evas_Object* frame, bool allowsMultipleFiles, const WTF::Vector<WTF::String>& acceptMIMETypes, Eina_List** selectedFilenames) +bool ewk_view_run_open_panel(Evas_Object* ewkView, Evas_Object* frame, Ewk_File_Chooser* fileChooser, Eina_List** selectedFilenames) { - DBG("ewkView=%p frame=%p allows_multiple_files=%d", ewkView, frame, allowsMultipleFiles); + DBG("ewkView=%p frame=%p allows_multiple_files=%d", ewkView, frame, ewk_file_chooser_allows_multiple_files_get(fileChooser)); EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false); @@ -3588,19 +3588,10 @@ bool ewk_view_run_open_panel(Evas_Object* ewkView, Evas_Object* frame, bool allo return false; *selectedFilenames = 0; - - Eina_List* cAcceptMIMETypes = 0; - for (WTF::Vector<WTF::String>::const_iterator iterator = acceptMIMETypes.begin(); iterator != acceptMIMETypes.end(); ++iterator) - cAcceptMIMETypes = eina_list_append(cAcceptMIMETypes, strdup((*iterator).utf8().data())); - - bool confirm = smartData->api->run_open_panel(smartData, frame, allowsMultipleFiles, cAcceptMIMETypes, selectedFilenames); + bool confirm = smartData->api->run_open_panel(smartData, frame, fileChooser, selectedFilenames); if (!confirm && *selectedFilenames) ERR("Canceled file selection, but selected filenames != 0. Free names before return."); - void* item = 0; - EINA_LIST_FREE(cAcceptMIMETypes, item) - free(item); - return confirm; } @@ -4027,18 +4018,22 @@ void ewk_view_transition_to_commited_for_newpage(Evas_Object* ewkView) /** * @internal - * Reports a requeset will be loaded. It's client responsibility to decide if - * request would be used. If @return is true, loader will try to load. Else, - * Loader ignore action of request. + * Reports that a navigation policy decision should be taken. If @return + * is true, the navigation request will be accepted, otherwise it will be + * ignored. * * @param ewkView View to load * @param request Request which contain url to navigate * @param navigationType navigation type + * + * @return true if the client accepted the navigation request, false otherwise. If the + * client did not make a decision, we return true by default since the default policy + * is to accept. */ bool ewk_view_navigation_policy_decision(Evas_Object* ewkView, Ewk_Frame_Resource_Request* request, Ewk_Navigation_Type navigationType) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, true); - EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, true); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false); if (!smartData->api->navigation_policy_decision) return true; @@ -4104,12 +4099,12 @@ void ewk_view_contents_size_changed(Evas_Object* ewkView, int width, int height) * * @param ewkView view. * - * @return page size. + * @return page size, or -1.0 size on failure */ WebCore::FloatRect ewk_view_page_rect_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET(ewkView, smartData); - EWK_VIEW_PRIV_GET(smartData, priv); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, WebCore::FloatRect(-1.0, -1.0, -1.0, -1.0)); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, WebCore::FloatRect(-1.0, -1.0, -1.0, -1.0)); WebCore::Frame* main_frame = priv->page->mainFrame(); return main_frame->view()->frameRect(); @@ -4284,8 +4279,8 @@ void ewk_view_soup_session_set(Evas_Object* ewkView, SoupSession* session) Eina_Bool ewk_view_setting_enable_xss_auditor_get(const Evas_Object* ewkView) { - EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, EINA_FALSE); - EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, EINA_FALSE); + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); return priv->settings.enableXSSAuditor; } diff --git a/Source/WebKit/efl/ewk/ewk_view.h b/Source/WebKit/efl/ewk/ewk_view.h index 55ed3ee86..a570d655e 100644 --- a/Source/WebKit/efl/ewk/ewk_view.h +++ b/Source/WebKit/efl/ewk/ewk_view.h @@ -113,6 +113,7 @@ #ifndef ewk_view_h #define ewk_view_h +#include "ewk_file_chooser.h" #include "ewk_frame.h" #include "ewk_history.h" #include "ewk_js.h" @@ -182,12 +183,12 @@ struct _Ewk_View_Smart_Class { void (*add_console_message)(Ewk_View_Smart_Data *sd, const char *message, unsigned int lineNumber, const char *sourceID); void (*run_javascript_alert)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *message); Eina_Bool (*run_javascript_confirm)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *message); - Eina_Bool (*run_javascript_prompt)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *message, const char *defaultValue, char **value); + Eina_Bool (*run_javascript_prompt)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *message, const char *defaultValue, const char **value); Eina_Bool (*should_interrupt_javascript)(Ewk_View_Smart_Data *sd); int64_t (*exceeded_application_cache_quota)(Ewk_View_Smart_Data *sd, Ewk_Security_Origin* origin, int64_t defaultOriginQuota, int64_t totalSpaceNeeded); uint64_t (*exceeded_database_quota)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *databaseName, uint64_t current_size, uint64_t expected_size); - Eina_Bool (*run_open_panel)(Ewk_View_Smart_Data *sd, Evas_Object *frame, Eina_Bool allows_multiple_files, Eina_List *accept_types, Eina_List **selected_filenames); + Eina_Bool (*run_open_panel)(Ewk_View_Smart_Data *sd, Evas_Object *frame, Ewk_File_Chooser *file_chooser, Eina_List **selected_filenames); Eina_Bool (*navigation_policy_decision)(Ewk_View_Smart_Data *sd, Ewk_Frame_Resource_Request *request, Ewk_Navigation_Type navigation_type); Eina_Bool (*focus_can_cycle)(Ewk_View_Smart_Data *sd, Ewk_Focus_Direction direction); @@ -197,7 +198,7 @@ struct _Ewk_View_Smart_Class { * The version you have to put into the version field * in the @a Ewk_View_Smart_Class structure. */ -#define EWK_VIEW_SMART_CLASS_VERSION 5UL +#define EWK_VIEW_SMART_CLASS_VERSION 6UL /** * Initializes a whole @a Ewk_View_Smart_Class structure. @@ -858,13 +859,13 @@ EAPI void ewk_view_bg_color_get(const Evas_Object *o, int *r, int *g, in /** * Gets the copy of the selected text. * - * The returned string @b should be freed after use. + * The returned string @b should be freed by eina_stringshare_del() after use. * * @param o view object to get selected text * * @return a newly allocated string or @c NULL if nothing is selected or on failure */ -EAPI char *ewk_view_selection_get(const Evas_Object *o); +EAPI const char *ewk_view_selection_get(const Evas_Object *o); /** * Forwards a request of a new Context Menu to WebCore. @@ -2140,7 +2141,7 @@ EAPI Eina_Bool ewk_view_setting_minimum_timer_interval_set(Evas_Object *o, do * * @param o view object to get the minimum interval * - * @return the minimum interval on success or @c 0 on failure + * @return the minimum interval on success or @c -1.0 on failure */ EAPI double ewk_view_setting_minimum_timer_interval_get(const Evas_Object *o); diff --git a/Source/WebKit/efl/ewk/ewk_view_private.h b/Source/WebKit/efl/ewk/ewk_view_private.h index b70e755b1..daee67734 100644 --- a/Source/WebKit/efl/ewk/ewk_view_private.h +++ b/Source/WebKit/efl/ewk/ewk_view_private.h @@ -92,12 +92,12 @@ void ewk_view_add_console_message(Evas_Object* ewkView, const char* message, uns void ewk_view_run_javascript_alert(Evas_Object* ewkView, Evas_Object* frame, const char* message); bool ewk_view_run_javascript_confirm(Evas_Object* ewkView, Evas_Object* frame, const char* message); -bool ewk_view_run_javascript_prompt(Evas_Object* ewkView, Evas_Object* frame, const char* message, const char* defaultValue, char** value); +bool ewk_view_run_javascript_prompt(Evas_Object* ewkView, Evas_Object* frame, const char* message, const char* defaultValue, const char** value); bool ewk_view_should_interrupt_javascript(Evas_Object* ewkView); int64_t ewk_view_exceeded_application_cache_quota(Evas_Object* ewkView, Ewk_Security_Origin *origin, int64_t defaultOriginQuota, int64_t totalSpaceNeeded); uint64_t ewk_view_exceeded_database_quota(Evas_Object* ewkView, Evas_Object* frame, const char* databaseName, uint64_t currentSize, uint64_t expectedSize); -bool ewk_view_run_open_panel(Evas_Object* ewkView, Evas_Object* frame, bool allowsMultipleFiles, const Vector<String>& acceptMIMETypes, Eina_List** selectedFilenames); +bool ewk_view_run_open_panel(Evas_Object* ewkView, Evas_Object* frame, Ewk_File_Chooser* fileChooser, Eina_List** selectedFilenames); void ewk_view_repaint(Evas_Object* ewkView, Evas_Coord x, Evas_Coord y, Evas_Coord width, Evas_Coord height); void ewk_view_scroll(Evas_Object* ewkView, Evas_Coord deltaX, Evas_Coord deltaY, Evas_Coord scrollX, Evas_Coord scrollY, Evas_Coord scrollWidth, Evas_Coord scrollHeight, Evas_Coord centerX, Evas_Coord centerY, Evas_Coord centerW, Evas_Coord centerHeight); diff --git a/Source/WebKit/gtk/ChangeLog b/Source/WebKit/gtk/ChangeLog index 1501bd2bb..27d0d5774 100644 --- a/Source/WebKit/gtk/ChangeLog +++ b/Source/WebKit/gtk/ChangeLog @@ -1,3 +1,52 @@ +2012-07-28 Mario Sanchez Prada <msanchez@igalia.com> + + [GTK] Add a new and reusable enchant-based spellchecker in WebCore + https://bugs.webkit.org/show_bug.cgi?id=90269 + + Reviewed by Martin Robinson. + + Remove enchant specific code from WebKitSpellCheckerEnchant and + implement it relying in the new TextCheckerEnchant class in WebCore. + + * webkit/webkitspellcheckerenchant.cpp: + (_WebKitSpellCheckerEnchantPrivate): + (webkit_spell_checker_enchant_finalize): + (webkit_spell_checker_enchant_class_init): + (webkit_spell_checker_enchant_init): + (checkSpellingOfString): + (getGuessesForWord): + (updateSpellCheckingLanguages): + (learnWord): + (ignoreWord): + +2012-07-26 Kaustubh Atrawalkar <kaustubh@motorola.com> + + [DRT] LTC:: pageNumberForElementById() could be moved to Internals + https://bugs.webkit.org/show_bug.cgi?id=92091 + + Reviewed by Adam Barth. + + Move the pageNumberForElementById from LayoutTestCotroller to Internals and + remove the old platform specific implementations as it exclusively tests WebCore functionality. + + * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: + * WebCoreSupport/DumpRenderTreeSupportGtk.h: + (DumpRenderTreeSupportGtk): + +2012-07-24 Kaustubh Atrawalkar <kaustubh@motorola.com> + + [DRT] LTC:: pageNumberForElementById() could be moved to Internals + https://bugs.webkit.org/show_bug.cgi?id=92091 + + Reviewed by Adam Barth. + + Move the pageNumberForElementById from LayoutTestCotroller to Internals and + remove the old platform specific implementations as it exclusively tests WebCore functionality. + + * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: + * WebCoreSupport/DumpRenderTreeSupportGtk.h: + (DumpRenderTreeSupportGtk): + 2012-07-23 Pierre Rossi <pierre.rossi@gmail.com> Unify numTouchEventHandlersChanged and needTouchEvents in the chrome client diff --git a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp index 07aa0102b..00febc8b7 100644 --- a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp @@ -189,29 +189,6 @@ CString DumpRenderTreeSupportGtk::dumpRenderTree(WebKitWebFrame* frame) } /** - * numberForElementById - * @frame: a #WebKitWebFrame - * @id: an element ID string - * @pageWidth: width of a page - * @pageHeight: height of a page - * - * Return value: The number of page where the specified element will be put - */ -int DumpRenderTreeSupportGtk::pageNumberForElementById(WebKitWebFrame* frame, const char* id, float pageWidth, float pageHeight) -{ - g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0); - - Frame* coreFrame = core(frame); - if (!coreFrame) - return -1; - - Element* coreElement = coreFrame->document()->getElementById(AtomicString(id)); - if (!coreElement) - return -1; - return PrintContext::pageNumberForElement(coreElement, FloatSize(pageWidth, pageHeight)); -} - -/** * numberOfPagesForFrame * @frame: a #WebKitWebFrame * @pageWidth: width of a page diff --git a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h index 99be717a1..ea608d2f5 100644 --- a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h +++ b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h @@ -59,7 +59,6 @@ public: static GSList* getFrameChildren(WebKitWebFrame*); static WTF::CString getInnerText(WebKitWebFrame*); static WTF::CString dumpRenderTree(WebKitWebFrame*); - static int pageNumberForElementById(WebKitWebFrame*, const char* id, float pageWidth, float pageHeight); static int numberOfPagesForFrame(WebKitWebFrame*, float pageWidth, float pageHeight); static WTF::CString pageProperty(WebKitWebFrame*, const char* propertyName, int pageNumber); static WTF::CString pageSizeAndMarginsInPixels(WebKitWebFrame*, int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft); diff --git a/Source/WebKit/gtk/webkit/webkitspellcheckerenchant.cpp b/Source/WebKit/gtk/webkit/webkitspellcheckerenchant.cpp index 0eb4986d1..0a226928b 100644 --- a/Source/WebKit/gtk/webkit/webkitspellcheckerenchant.cpp +++ b/Source/WebKit/gtk/webkit/webkitspellcheckerenchant.cpp @@ -21,12 +21,15 @@ #if ENABLE(SPELLCHECK) +#include "TextCheckerEnchant.h" #include "webkitspellchecker.h" -#include <enchant.h> #include <gtk/gtk.h> +#include <wtf/OwnPtr.h> #include <wtf/gobject/GOwnPtr.h> #include <wtf/text/CString.h> +using namespace WebCore; + /** * SECTION:webkitspellcheckerenchant * @short_description: the default spell checking implementation for WebKitGTK+. @@ -35,10 +38,9 @@ * WebKitGTK+. It uses the Enchant dictionaries installed on the system to * correct spelling. */ -static EnchantBroker* broker = 0; struct _WebKitSpellCheckerEnchantPrivate { - GSList* enchantDicts; + OwnPtr<TextCheckerEnchant> textCheckerEnchant; }; static void webkit_spell_checker_enchant_spell_checker_interface_init(WebKitSpellCheckerInterface* interface); @@ -47,35 +49,16 @@ G_DEFINE_TYPE_WITH_CODE(WebKitSpellCheckerEnchant, webkit_spell_checker_enchant, G_IMPLEMENT_INTERFACE(WEBKIT_TYPE_SPELL_CHECKER, webkit_spell_checker_enchant_spell_checker_interface_init)) -static void createEnchantBrokerIfNeeded() -{ - if (!broker) - broker = enchant_broker_init(); -} - -static void freeSpellCheckingLanguage(gpointer data, gpointer) -{ - createEnchantBrokerIfNeeded(); - - enchant_broker_free_dict(broker, static_cast<EnchantDict*>(data)); -} - static void webkit_spell_checker_enchant_finalize(GObject* object) { WebKitSpellCheckerEnchantPrivate* priv = WEBKIT_SPELL_CHECKER_ENCHANT(object)->priv; - - g_slist_foreach(priv->enchantDicts, freeSpellCheckingLanguage, 0); - g_slist_free(priv->enchantDicts); - - WEBKIT_SPELL_CHECKER_ENCHANT(object)->priv->~WebKitSpellCheckerEnchantPrivate(); + priv->~WebKitSpellCheckerEnchantPrivate(); } static void webkit_spell_checker_enchant_class_init(WebKitSpellCheckerEnchantClass* klass) { GObjectClass* objectClass = G_OBJECT_CLASS(klass); - objectClass->finalize = webkit_spell_checker_enchant_finalize; - g_type_class_add_private(klass, sizeof(WebKitSpellCheckerEnchantPrivate)); } @@ -85,149 +68,38 @@ static void webkit_spell_checker_enchant_init(WebKitSpellCheckerEnchant* checker checker->priv = priv; new (priv) WebKitSpellCheckerEnchantPrivate(); - priv->enchantDicts = 0; -} - -static bool wordEndIsAContractionApostrophe(const char* string, long offset) -{ - if (g_utf8_get_char(g_utf8_offset_to_pointer(string, offset)) != g_utf8_get_char("'")) - return false; - - // If this is the last character in the string, it cannot be the apostrophe part of a contraction. - if (offset == g_utf8_strlen(string, -1)) - return false; - - return g_unichar_isalpha(g_utf8_get_char(g_utf8_offset_to_pointer(string, offset + 1))); + priv->textCheckerEnchant = TextCheckerEnchant::create(); } static void checkSpellingOfString(WebKitSpellChecker* checker, const char* string, int* misspellingLocation, int* misspellingLength) { WebKitSpellCheckerEnchantPrivate* priv = WEBKIT_SPELL_CHECKER_ENCHANT(checker)->priv; - - GSList* dicts = priv->enchantDicts; - if (!dicts) - return; - - int length = g_utf8_strlen(string, -1); - - PangoLanguage* language(pango_language_get_default()); - GOwnPtr<PangoLogAttr> attrs(g_new(PangoLogAttr, length + 1)); - - // pango_get_log_attrs uses an aditional position at the end of the text. - pango_get_log_attrs(string, -1, -1, language, attrs.get(), length + 1); - - for (int i = 0; i < length + 1; i++) { - // We go through each character until we find an is_word_start, - // then we get into an inner loop to find the is_word_end corresponding - // to it. - if (attrs.get()[i].is_word_start) { - int start = i; - int end = i; - int wordLength; - - while (attrs.get()[end].is_word_end < 1 || wordEndIsAContractionApostrophe(string, end)) - end++; - - wordLength = end - start; - // Set the iterator to be at the current word end, so we don't - // check characters twice. - i = end; - - gchar* cstart = g_utf8_offset_to_pointer(string, start); - gint bytes = static_cast<gint>(g_utf8_offset_to_pointer(string, end) - cstart); - GOwnPtr<gchar> word(g_new0(gchar, bytes + 1)); - - g_utf8_strncpy(word.get(), cstart, wordLength); - - for (; dicts; dicts = dicts->next) { - EnchantDict* dict = static_cast<EnchantDict*>(dicts->data); - if (enchant_dict_check(dict, word.get(), wordLength)) { - *misspellingLocation = start; - *misspellingLength = wordLength; - } else { - // Stop checking, this word is ok in at least one dict. - *misspellingLocation = -1; - *misspellingLength = 0; - break; - } - } - } - } + priv->textCheckerEnchant->checkSpellingOfString(String(string), *misspellingLocation, *misspellingLength); } static char** getGuessesForWord(WebKitSpellChecker* checker, const char* word, const char* context) { WebKitSpellCheckerEnchantPrivate* priv = WEBKIT_SPELL_CHECKER_ENCHANT(checker)->priv; - GSList* dicts = priv->enchantDicts; - char** guesses = 0; + Vector<String> guesses = priv->textCheckerEnchant->getGuessesForWord(String(word)); - for (; dicts; dicts = dicts->next) { - size_t numberOfSuggestions; - size_t i; + if (guesses.isEmpty()) + return 0; - EnchantDict* dict = static_cast<EnchantDict*>(dicts->data); - gchar** suggestions = enchant_dict_suggest(dict, word, -1, &numberOfSuggestions); + int i = 0; + int numberOfGuesses = guesses.size(); + char** guessesArray = static_cast<char**>(g_malloc0((numberOfGuesses + 1) * sizeof(char*))); + for (Vector<String>::const_iterator iter = guesses.begin(); iter != guesses.end(); ++iter) + guessesArray[i++] = g_strdup(iter->utf8().data()); + guessesArray[i] = 0; - if (numberOfSuggestions > 0) { - if (numberOfSuggestions > 10) - numberOfSuggestions = 10; - - guesses = static_cast<char**>(g_malloc0((numberOfSuggestions + 1) * sizeof(char*))); - for (i = 0; i < numberOfSuggestions && i < 10; i++) - guesses[i] = g_strdup(suggestions[i]); - - guesses[i] = 0; - - enchant_dict_free_suggestions(dict, suggestions); - } - } - - return guesses; -} - -static void getAvailableDictionariesCallback(const char* const languageTag, const char* const, const char* const, const char* const, void* data) -{ - Vector<CString>* dicts = static_cast<Vector<CString>*>(data); - - dicts->append(languageTag); + return guessesArray; } static void updateSpellCheckingLanguages(WebKitSpellChecker* checker, const char* languages) { - GSList* spellDictionaries = 0; - WebKitSpellCheckerEnchantPrivate* priv = WEBKIT_SPELL_CHECKER_ENCHANT(checker)->priv; - - createEnchantBrokerIfNeeded(); - - if (languages) { - char** langs = g_strsplit(languages, ",", -1); - for (int i = 0; langs[i]; i++) { - if (enchant_broker_dict_exists(broker, langs[i])) { - EnchantDict* dict = enchant_broker_request_dict(broker, langs[i]); - spellDictionaries = g_slist_append(spellDictionaries, dict); - } - } - g_strfreev(langs); - } else { - const char* language = pango_language_to_string(gtk_get_default_language()); - if (enchant_broker_dict_exists(broker, language)) { - EnchantDict* dict = enchant_broker_request_dict(broker, language); - spellDictionaries = g_slist_append(spellDictionaries, dict); - } else { - // No dictionaries selected, we get one from the list. - Vector<CString> allDictionaries; - enchant_broker_list_dicts(broker, getAvailableDictionariesCallback, &allDictionaries); - if (!allDictionaries.isEmpty()) { - EnchantDict* dict = enchant_broker_request_dict(broker, allDictionaries[0].data()); - spellDictionaries = g_slist_append(spellDictionaries, dict); - } - } - } - g_slist_foreach(priv->enchantDicts, freeSpellCheckingLanguage, 0); - g_slist_free(priv->enchantDicts); - priv->enchantDicts = spellDictionaries; + priv->textCheckerEnchant->updateSpellCheckingLanguages(String(languages)); } static char* getAutocorrectSuggestionsForMisspelledWord(WebKitSpellChecker* checker, const char* word) @@ -238,25 +110,13 @@ static char* getAutocorrectSuggestionsForMisspelledWord(WebKitSpellChecker* chec static void learnWord(WebKitSpellChecker* checker, const char* word) { WebKitSpellCheckerEnchantPrivate* priv = WEBKIT_SPELL_CHECKER_ENCHANT(checker)->priv; - GSList* dicts = priv->enchantDicts; - - for (; dicts; dicts = dicts->next) { - EnchantDict* dict = static_cast<EnchantDict*>(dicts->data); - - enchant_dict_add_to_personal(dict, word, -1); - } + priv->textCheckerEnchant->learnWord(String(word)); } static void ignoreWord(WebKitSpellChecker* checker, const char* word) { WebKitSpellCheckerEnchantPrivate* priv = WEBKIT_SPELL_CHECKER_ENCHANT(checker)->priv; - GSList* dicts = priv->enchantDicts; - - for (; dicts; dicts = dicts->next) { - EnchantDict* dict = static_cast<EnchantDict*>(dicts->data); - - enchant_dict_add_to_session(dict, word, -1); - } + priv->textCheckerEnchant->ignoreWord(String(word)); } static void webkit_spell_checker_enchant_spell_checker_interface_init(WebKitSpellCheckerInterface* interface) diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index 9df345021..05df0aed5 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,74 @@ +2012-07-29 Rik Cabanier <cabanier@adobe.com> + + Add ENABLE_CSS_COMPOSITING flag + https://bugs.webkit.org/show_bug.cgi?id=92553 + + Reviewed by Dirk Schulze. + + Adds compiler flag CSS_COMPOSITING to build systems to enable CSS blending and compositing. See spec https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html + + * Configurations/FeatureDefines.xcconfig: + +2012-07-27 Anders Carlsson <andersca@apple.com> + + Show the unavailable plug-in indicator for Java applets as well + https://bugs.webkit.org/show_bug.cgi?id=92521 + + Reviewed by Sam Weinig. + + Check if the Java plug-in is blocked before trying to instantiate it. + + * WebCoreSupport/WebFrameLoaderClient.mm: + +2012-07-25 Jer Noble <jer.noble@apple.com> + + Add setting to enable and disable diagnostic logging. + https://bugs.webkit.org/show_bug.cgi?id=92337 + + Reviewed by Anders Carlsson. + + Add a WebKit WebPreferences API to set set the WebCore diagnosticLoggingEnabled setting. + + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): Register the default value to false. + (-[WebPreferences diagnosticLoggingEnabled]): Simple userDefaults accessor. + (-[WebPreferences setDiagnosticLoggingEnabled:]): Ditto. + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChanged:]): Ensure this preference is propagated to Settings + whenever the preferences change. + +2012-07-25 Pratik Solanki <psolanki@apple.com> + + Remove catchesDelegateExceptions from WebViewData and related accessor methods + https://bugs.webkit.org/show_bug.cgi?id=90898 + + Reviewed by Darin Adler. + + Remove catchesDelegateException ivar from WebViewData and all its accesor methods from + WebView. All uses of this flag in WebKit set it to YES and no one calls + _setCatchesDelegateExceptions with NO. + + * WebCoreSupport/WebDragClient.mm: + (WebDragClient::startDrag): + * WebView/WebDelegateImplementationCaching.mm: + (CallDelegate): + (CallDelegateReturningFloat): + (CallDelegateReturningBoolean): + (CallResourceLoadDelegateReturningBoolean): + (CallFormDelegate): + (CallFormDelegateReturningBoolean): + * WebView/WebView.mm: + (-[WebView _commonInitializationWithFrameName:groupName:]): + (-[WebView _policyDelegateForwarder]): + (-[WebView _UIDelegateForwarder]): + (-[WebView _editingDelegateForwarder]): + (-[_WebSafeForwarder initWithTarget:defaultTarget:]): + (-[_WebSafeForwarder forwardInvocation:]): + * WebView/WebViewData.h: + * WebView/WebViewPrivate.h: + 2012-07-23 Simon Fraser <simon.fraser@apple.com> Part 2 of: Implement sticky positioning diff --git a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig index 49182f3a0..70cf60c23 100644 --- a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -44,6 +44,7 @@ ENABLE_CSS_IMAGE_ORIENTATION = ; ENABLE_CSS_IMAGE_RESOLUTION = ; ENABLE_CSS_REGIONS = ENABLE_CSS_REGIONS; ENABLE_CSS_SHADERS = ENABLE_CSS_SHADERS; +ENABLE_CSS_COMPOSITING = ; ENABLE_CSS_STICKY_POSITION = ENABLE_CSS_STICKY_POSITION; ENABLE_CSS_VARIABLES = ; ENABLE_CSS3_FLEXBOX = ENABLE_CSS3_FLEXBOX; @@ -136,4 +137,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_FLEXBOX) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm b/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm index 975580f8e..c168df8ad 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm @@ -110,14 +110,11 @@ void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& at, const id delegate = [m_webView UIDelegate]; SEL selector = @selector(webView:dragImage:at:offset:event:pasteboard:source:slideBack:forView:); if ([delegate respondsToSelector:selector]) { - if ([m_webView _catchesDelegateExceptions]) { - @try { - [delegate webView:m_webView dragImage:dragNSImage at:at offset:NSZeroSize event:event pasteboard:pasteboard source:sourceHTMLView slideBack:YES forView:topHTMLView]; - } @catch (id exception) { - ReportDiscardedDelegateException(selector, exception); - } - } else + @try { [delegate webView:m_webView dragImage:dragNSImage at:at offset:NSZeroSize event:event pasteboard:pasteboard source:sourceHTMLView slideBack:YES forView:topHTMLView]; + } @catch (id exception) { + ReportDiscardedDelegateException(selector, exception); + } } else [topHTMLView dragImage:dragNSImage at:at offset:NSZeroSize event:event pasteboard:pasteboard source:sourceHTMLView slideBack:YES]; } diff --git a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index 6364420eb..6d017afac 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -1759,47 +1759,55 @@ PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(const IntSize& s WebBasePluginPackage *pluginPackage = [webView _pluginForMIMEType:MIMEType]; + int errorCode = WebKitErrorJavaUnavailable; + if (pluginPackage) { - if ([pluginPackage isKindOfClass:[WebPluginPackage class]]) { - // For some reason, the Java plug-in requires that we pass the dimension of the plug-in as attributes. - NSMutableArray *names = kit(paramNames); - NSMutableArray *values = kit(paramValues); - if (parameterValue(paramNames, paramValues, "width").isNull()) { - [names addObject:@"width"]; - [values addObject:[NSString stringWithFormat:@"%d", size.width()]]; + if (!WKShouldBlockPlugin([pluginPackage bundleIdentifier], [pluginPackage bundleVersion])) { + if ([pluginPackage isKindOfClass:[WebPluginPackage class]]) { + // For some reason, the Java plug-in requires that we pass the dimension of the plug-in as attributes. + NSMutableArray *names = kit(paramNames); + NSMutableArray *values = kit(paramValues); + if (parameterValue(paramNames, paramValues, "width").isNull()) { + [names addObject:@"width"]; + [values addObject:[NSString stringWithFormat:@"%d", size.width()]]; + } + if (parameterValue(paramNames, paramValues, "height").isNull()) { + [names addObject:@"height"]; + [values addObject:[NSString stringWithFormat:@"%d", size.height()]]; + } + view = pluginView(m_webFrame.get(), (WebPluginPackage *)pluginPackage, names, values, baseURL, kit(element), NO); + if (view) + return adoptRef(new PluginWidget(view)); } - if (parameterValue(paramNames, paramValues, "height").isNull()) { - [names addObject:@"height"]; - [values addObject:[NSString stringWithFormat:@"%d", size.height()]]; + #if ENABLE(NETSCAPE_PLUGIN_API) + else if ([pluginPackage isKindOfClass:[WebNetscapePluginPackage class]]) { + view = [[[NETSCAPE_PLUGIN_VIEW alloc] initWithFrame:NSMakeRect(0, 0, size.width(), size.height()) + pluginPackage:(WebNetscapePluginPackage *)pluginPackage + URL:nil + baseURL:baseURL + MIMEType:MIMEType + attributeKeys:kit(paramNames) + attributeValues:kit(paramValues) + loadManually:NO + element:element] autorelease]; + if (view) + return adoptRef(new NetscapePluginWidget(static_cast<WebBaseNetscapePluginView *>(view))); + } else { + ASSERT_NOT_REACHED(); } - view = pluginView(m_webFrame.get(), (WebPluginPackage *)pluginPackage, names, values, baseURL, kit(element), NO); - if (view) - return adoptRef(new PluginWidget(view)); - } -#if ENABLE(NETSCAPE_PLUGIN_API) - else if ([pluginPackage isKindOfClass:[WebNetscapePluginPackage class]]) { - view = [[[NETSCAPE_PLUGIN_VIEW alloc] initWithFrame:NSMakeRect(0, 0, size.width(), size.height()) - pluginPackage:(WebNetscapePluginPackage *)pluginPackage - URL:nil - baseURL:baseURL - MIMEType:MIMEType - attributeKeys:kit(paramNames) - attributeValues:kit(paramValues) - loadManually:NO - element:element] autorelease]; - if (view) - return adoptRef(new NetscapePluginWidget(static_cast<WebBaseNetscapePluginView *>(view))); + #endif } else { - ASSERT_NOT_REACHED(); + errorCode = WebKitErrorBlockedPlugInVersion; + if (element->renderer()->isEmbeddedObject()) + toRenderEmbeddedObject(element->renderer())->setPluginUnavailabilityReason(RenderEmbeddedObject::InsecurePluginVersion); } -#endif } if (!view) { WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(getWebView(m_webFrame.get())); if (implementations->plugInFailedWithErrorFunc) { NSString *pluginName = pluginPackage ? (NSString *)[pluginPackage pluginInfo].name : nil; - NSError *error = [[NSError alloc] _initWithPluginErrorCode:WebKitErrorJavaUnavailable contentURL:nil pluginPageURL:nil pluginName:pluginName MIMEType:MIMEType]; + NSError *error = [[NSError alloc] _initWithPluginErrorCode:errorCode contentURL:nil pluginPageURL:nil pluginName:pluginName MIMEType:MIMEType]; CallResourceLoadDelegate(implementations->plugInFailedWithErrorFunc, [m_webFrame.get() webView], @selector(webView:plugInFailedWithError:dataSource:), error, [m_webFrame.get() _dataSource]); [error release]; diff --git a/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm b/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm index 542a48495..15f6dffa2 100644 --- a/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm +++ b/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm @@ -83,8 +83,6 @@ static inline id CallDelegate(WebView *self, id delegate, SEL selector) { if (!delegate || ![delegate respondsToSelector:selector]) return nil; - if (!self->_private->catchesDelegateExceptions) - return objc_msgSend(delegate, selector, self); @try { return objc_msgSend(delegate, selector, self); } @catch(id exception) { @@ -97,8 +95,6 @@ static inline id CallDelegate(WebView *self, id delegate, SEL selector, id objec { if (!delegate || ![delegate respondsToSelector:selector]) return nil; - if (!self->_private->catchesDelegateExceptions) - return objc_msgSend(delegate, selector, self, object); @try { return objc_msgSend(delegate, selector, self, object); } @catch(id exception) { @@ -111,8 +107,6 @@ static inline id CallDelegate(WebView *self, id delegate, SEL selector, NSRect r { if (!delegate || ![delegate respondsToSelector:selector]) return nil; - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<id (*)(id, SEL, WebView *, NSRect)>(objc_msgSend)(delegate, selector, self, rect); @try { return reinterpret_cast<id (*)(id, SEL, WebView *, NSRect)>(objc_msgSend)(delegate, selector, self, rect); } @catch(id exception) { @@ -125,8 +119,6 @@ static inline id CallDelegate(WebView *self, id delegate, SEL selector, id objec { if (!delegate || ![delegate respondsToSelector:selector]) return nil; - if (!self->_private->catchesDelegateExceptions) - return objc_msgSend(delegate, selector, self, object1, object2); @try { return objc_msgSend(delegate, selector, self, object1, object2); } @catch(id exception) { @@ -139,8 +131,6 @@ static inline id CallDelegate(WebView *self, id delegate, SEL selector, id objec { if (!delegate || ![delegate respondsToSelector:selector]) return nil; - if (!self->_private->catchesDelegateExceptions) - return objc_msgSend(delegate, selector, self, object, boolean); @try { return objc_msgSend(delegate, selector, self, object, boolean); } @catch(id exception) { @@ -153,8 +143,6 @@ static inline id CallDelegate(WebView *self, id delegate, SEL selector, id objec { if (!delegate || ![delegate respondsToSelector:selector]) return nil; - if (!self->_private->catchesDelegateExceptions) - return objc_msgSend(delegate, selector, self, object1, object2, object3); @try { return objc_msgSend(delegate, selector, self, object1, object2, object3); } @catch(id exception) { @@ -167,8 +155,6 @@ static inline id CallDelegate(WebView *self, id delegate, SEL selector, id objec { if (!delegate || ![delegate respondsToSelector:selector]) return nil; - if (!self->_private->catchesDelegateExceptions) - return objc_msgSend(delegate, selector, self, object, integer); @try { return objc_msgSend(delegate, selector, self, object, integer); } @catch(id exception) { @@ -181,8 +167,6 @@ static inline float CallDelegateReturningFloat(WebView *self, id delegate, SEL s { if (!delegate || ![delegate respondsToSelector:selector]) return 0.0f; - if (!self->_private->catchesDelegateExceptions) - return objc_msgSend_float_return(delegate, selector, self); @try { return objc_msgSend_float_return(delegate, selector, self); } @catch(id exception) { @@ -195,8 +179,6 @@ static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id d { if (!delegate || ![delegate respondsToSelector:selector]) return result; - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<BOOL (*)(id, SEL, WebView *)>(objc_msgSend)(delegate, selector, self); @try { return reinterpret_cast<BOOL (*)(id, SEL, WebView *)>(objc_msgSend)(delegate, selector, self); } @catch(id exception) { @@ -209,8 +191,6 @@ static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id d { if (!delegate || ![delegate respondsToSelector:selector]) return result; - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id)>(objc_msgSend)(delegate, selector, self, object); @try { return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id)>(objc_msgSend)(delegate, selector, self, object); } @catch(id exception) { @@ -223,8 +203,6 @@ static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id d { if (!delegate || ![delegate respondsToSelector:selector]) return result; - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL)>(objc_msgSend)(delegate, selector, self, object, boolean); @try { return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL)>(objc_msgSend)(delegate, selector, self, object, boolean); } @catch(id exception) { @@ -237,8 +215,6 @@ static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id d { if (!delegate || ![delegate respondsToSelector:selector]) return result; - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL, id)>(objc_msgSend)(delegate, selector, self, object, boolean, object2); @try { return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL, id)>(objc_msgSend)(delegate, selector, self, object, boolean, object2); } @catch(id exception) { @@ -251,8 +227,6 @@ static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id d { if (!delegate || ![delegate respondsToSelector:selector]) return result; - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id)>(objc_msgSend)(delegate, selector, self, object1, object2); @try { return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id)>(objc_msgSend)(delegate, selector, self, object1, object2); } @catch(id exception) { @@ -265,8 +239,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self); @try { return implementation(delegate, selector, self); } @catch(id exception) { @@ -279,8 +251,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object); @try { return implementation(delegate, selector, self, object); } @catch(id exception) { @@ -293,8 +263,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, object2); @try { return implementation(delegate, selector, self, object1, object2); } @catch(id exception) { @@ -307,8 +275,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, object2, object3); @try { return implementation(delegate, selector, self, object1, object2, object3); } @catch(id exception) { @@ -321,8 +287,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, object2, object3, object4); @try { return implementation(delegate, selector, self, object1, object2, object3, object4); } @catch(id exception) { @@ -335,8 +299,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, integer, object2); @try { return implementation(delegate, selector, self, object1, integer, object2); } @catch(id exception) { @@ -349,8 +311,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, integer1, integer2, object2); @try { return implementation(delegate, selector, self, object1, integer1, integer2, object2); } @catch(id exception) { @@ -363,8 +323,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, boolean, integer1, integer2, object2); @try { return implementation(delegate, selector, self, object1, boolean, integer1, integer2, object2); } @catch(id exception) { @@ -377,8 +335,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, object2, integer, object3); @try { return implementation(delegate, selector, self, object1, object2, integer, object3); } @catch(id exception) { @@ -391,8 +347,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, integer1, object2, integer2, object3); @try { return implementation(delegate, selector, self, object1, integer1, object2, integer2, object3); } @catch(id exception) { @@ -405,8 +359,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, integer, object2, object3, object4); @try { return implementation(delegate, selector, self, object1, integer, object2, object3, object4); } @catch(id exception) { @@ -419,8 +371,6 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE { if (!delegate) return nil; - if (!self->_private->catchesDelegateExceptions) - return implementation(delegate, selector, self, object1, interval, object2, object3); @try { return implementation(delegate, selector, self, object1, interval, object2, object3); } @catch(id exception) { @@ -551,8 +501,6 @@ id CallResourceLoadDelegate(IMP implementation, WebView *self, SEL selector, id BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1) { - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1); @try { return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1); } @catch(id exception) { @@ -563,8 +511,6 @@ BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, W BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1, id object2) { - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2); @try { return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2); } @catch(id exception) { @@ -575,8 +521,6 @@ BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, W BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3) { - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2, object3); @try { return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2, object3); } @catch(id exception) { @@ -632,8 +576,6 @@ id CallFormDelegate(WebView *self, SEL selector, id object1, id object2) id delegate = self->_private->formDelegate; if (!delegate || ![delegate respondsToSelector:selector]) return nil; - if (!self->_private->catchesDelegateExceptions) - return objc_msgSend(delegate, selector, object1, object2); @try { return objc_msgSend(delegate, selector, object1, object2); } @catch(id exception) { @@ -647,8 +589,6 @@ id CallFormDelegate(WebView *self, SEL selector, id object1, id object2, id obje id delegate = self->_private->formDelegate; if (!delegate || ![delegate respondsToSelector:selector]) return nil; - if (!self->_private->catchesDelegateExceptions) - return objc_msgSend(delegate, selector, object1, object2, object3, object4, object5); @try { return objc_msgSend(delegate, selector, object1, object2, object3, object4, object5); } @catch(id exception) { @@ -662,8 +602,6 @@ BOOL CallFormDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id delegate = self->_private->formDelegate; if (!delegate || ![delegate respondsToSelector:selector]) return result; - if (!self->_private->catchesDelegateExceptions) - return reinterpret_cast<BOOL (*)(id, SEL, id, SEL, id)>(objc_msgSend)(delegate, selector, object1, selectorArg, object2); @try { return reinterpret_cast<BOOL (*)(id, SEL, id, SEL, id)>(objc_msgSend)(delegate, selector, object1, selectorArg, object2); } @catch(id exception) { diff --git a/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h index 12b54e7c0..b1711bb8b 100644 --- a/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h +++ b/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h @@ -124,6 +124,7 @@ #define WebKitRegionBasedColumnsEnabledKey @"WebKitRegionBasedColumnsEnabled" #define WebKitShouldRespectImageOrientationKey @"WebKitShouldRespectImageOrientation" #define WebKitRequestAnimationFrameEnabledPreferenceKey @"WebKitRequestAnimationFrameEnabled" +#define WebKitDiagnosticLoggingEnabledKey @"WebKitDiagnosticLoggingEnabled" // These are private both because callers should be using the cover methods and because the // cover methods themselves are private. diff --git a/Source/WebKit/mac/WebView/WebPreferences.mm b/Source/WebKit/mac/WebView/WebPreferences.mm index f209ed80d..8e13f19b4 100644 --- a/Source/WebKit/mac/WebView/WebPreferences.mm +++ b/Source/WebKit/mac/WebView/WebPreferences.mm @@ -398,6 +398,7 @@ public: [NSNumber numberWithBool:NO], WebKitShouldRespectImageOrientationKey, [NSNumber numberWithBool:YES], WebKitRequestAnimationFrameEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitWantsBalancedSetDefersLoadingBehaviorKey, + [NSNumber numberWithBool:NO], WebKitDiagnosticLoggingEnabledKey, [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota, [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota, @@ -1728,6 +1729,16 @@ static NSString *classIBCreatorID = nil; return [self _floatValueForKey:WebKitIncrementalRenderingSuppressionTimeoutInSecondsKey]; } +- (BOOL)diagnosticLoggingEnabled +{ + return [self _boolValueForKey:WebKitDiagnosticLoggingEnabledKey]; +} + +- (void)setDiagnosticLoggingEnabled:(BOOL)enabled +{ + [self _setBoolValue:enabled forKey:WebKitDiagnosticLoggingEnabledKey]; +} + @end @implementation WebPreferences (WebInternal) diff --git a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h index 5db85cf55..513540d5d 100644 --- a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -302,4 +302,7 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification; - (void)setIncrementalRenderingSuppressionTimeoutInSeconds:(NSTimeInterval)timeout; - (NSTimeInterval)incrementalRenderingSuppressionTimeoutInSeconds; +- (BOOL)diagnosticLoggingEnabled; +- (void)setDiagnosticLoggingEnabled:(BOOL)enabled; + @end diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm index b85d8f36b..a62f27ecb 100644 --- a/Source/WebKit/mac/WebView/WebView.mm +++ b/Source/WebKit/mac/WebView/WebView.mm @@ -375,9 +375,8 @@ static const char webViewIsOpen[] = "At least one WebView is still open."; { id target; // Non-retained. Don't retain delegates. id defaultTarget; - BOOL catchExceptions; } -- (id)initWithTarget:(id)target defaultTarget:(id)defaultTarget catchExceptions:(BOOL)catchExceptions; +- (id)initWithTarget:(id)target defaultTarget:(id)defaultTarget; @end FindOptions coreOptions(WebFindOptions options) @@ -709,7 +708,6 @@ static bool shouldRespectPriorityInCSSAttributeSetters() [standardPreferences willAddToWebView]; _private->preferences = [standardPreferences retain]; - _private->catchesDelegateExceptions = YES; _private->mainFrameDocumentReady = NO; _private->drawsBackground = YES; _private->backgroundColor = [[NSColor colorWithDeviceWhite:1 alpha:1] retain]; @@ -1543,6 +1541,7 @@ static bool needsSelfRetainWhileLoadingQuirk() settings->setNeedsIsLoadingInAPISenseQuirk([self _needsIsLoadingInAPISenseQuirk]); settings->setRequestAnimationFrameEnabled([preferences requestAnimationFrameEnabled]); settings->setNeedsDidFinishLoadOrderQuirk(needsDidFinishLoadOrderQuirk()); + settings->setDiagnosticLoggingEnabled([preferences diagnosticLoggingEnabled]); NSTimeInterval timeout = [preferences incrementalRenderingSuppressionTimeoutInSeconds]; if (timeout > 0) @@ -1679,14 +1678,14 @@ static inline IMP getMethod(id o, SEL s) - (id)_policyDelegateForwarder { if (!_private->policyDelegateForwarder) - _private->policyDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->policyDelegate defaultTarget:[WebDefaultPolicyDelegate sharedPolicyDelegate] catchExceptions:_private->catchesDelegateExceptions]; + _private->policyDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->policyDelegate defaultTarget:[WebDefaultPolicyDelegate sharedPolicyDelegate]]; return _private->policyDelegateForwarder; } - (id)_UIDelegateForwarder { if (!_private->UIDelegateForwarder) - _private->UIDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->UIDelegate defaultTarget:[WebDefaultUIDelegate sharedUIDelegate] catchExceptions:_private->catchesDelegateExceptions]; + _private->UIDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->UIDelegate defaultTarget:[WebDefaultUIDelegate sharedUIDelegate]]; return _private->UIDelegateForwarder; } @@ -1698,7 +1697,7 @@ static inline IMP getMethod(id o, SEL s) return nil; if (!_private->editingDelegateForwarder) - _private->editingDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->editingDelegate defaultTarget:[WebDefaultEditingDelegate sharedEditingDelegate] catchExceptions:_private->catchesDelegateExceptions]; + _private->editingDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->editingDelegate defaultTarget:[WebDefaultEditingDelegate sharedEditingDelegate]]; return _private->editingDelegateForwarder; } @@ -2361,16 +2360,6 @@ static inline IMP getMethod(id o, SEL s) _private->page->clearUndoRedoOperations(); } -- (void)_setCatchesDelegateExceptions:(BOOL)f -{ - _private->catchesDelegateExceptions = f; -} - -- (BOOL)_catchesDelegateExceptions -{ - return _private->catchesDelegateExceptions; -} - - (void)_executeCoreCommandByName:(NSString *)name value:(NSString *)value { Frame* coreFrame = [self _mainCoreFrame]; @@ -2987,28 +2976,24 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) // Used to send messages to delegates that implement informal protocols. -- (id)initWithTarget:(id)t defaultTarget:(id)dt catchExceptions:(BOOL)c +- (id)initWithTarget:(id)t defaultTarget:(id)dt { self = [super init]; if (!self) return nil; target = t; // Non retained. defaultTarget = dt; - catchExceptions = c; return self; } - (void)forwardInvocation:(NSInvocation *)invocation { if ([target respondsToSelector:[invocation selector]]) { - if (catchExceptions) { - @try { - [invocation invokeWithTarget:target]; - } @catch(id exception) { - ReportDiscardedDelegateException([invocation selector], exception); - } - } else + @try { [invocation invokeWithTarget:target]; + } @catch(id exception) { + ReportDiscardedDelegateException([invocation selector], exception); + } return; } diff --git a/Source/WebKit/mac/WebView/WebViewData.h b/Source/WebKit/mac/WebView/WebViewData.h index 2ad4200d7..04d7e057a 100644 --- a/Source/WebKit/mac/WebView/WebViewData.h +++ b/Source/WebKit/mac/WebView/WebViewData.h @@ -137,7 +137,6 @@ private: BOOL becomingFirstResponder; BOOL becomingFirstResponderFromOutside; BOOL usesPageCache; - BOOL catchesDelegateExceptions; BOOL cssAnimationsSuspended; NSColor *backgroundColor; diff --git a/Source/WebKit/mac/WebView/WebViewPrivate.h b/Source/WebKit/mac/WebView/WebViewPrivate.h index 0a9808dbc..c20daabfb 100644 --- a/Source/WebKit/mac/WebView/WebViewPrivate.h +++ b/Source/WebKit/mac/WebView/WebViewPrivate.h @@ -361,9 +361,6 @@ Could be worth adding to the API. + (void)_setShouldUseFontSmoothing:(BOOL)f; + (BOOL)_shouldUseFontSmoothing; -- (void)_setCatchesDelegateExceptions:(BOOL)f; -- (BOOL)_catchesDelegateExceptions; - // These two methods are useful for a test harness that needs a consistent appearance for the focus rings // regardless of OS X version. + (void)_setUsesTestModeFocusRingColor:(BOOL)f; diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index fbfcf398c..3262f75a1 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,73 @@ +2012-07-27 Csaba Osztrogonác <ossy@webkit.org> + + [Qt][WK2] REGRESSION(r119127): resetting window.internals settings between tests doesn't work properly + https://bugs.webkit.org/show_bug.cgi?id=88064 + + Reviewed by Zoltan Herczeg. + + Add missing DumpRenderTreeSupportQt::resetInternalsObject(JSContextRef context) function. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::resetInternalsObject): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + +2012-07-26 Zeno Albisser <zeno@webkit.org> + + Unreviewed Qt buildfix after r123786. + + Qt-minimal builds with ENABLE_REQUEST_ANIMATION_FRAME=0. + Therefore adding #ifdefs to allow for that configuration. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore): + * WebCoreSupport/ChromeClientQt.h: + (ChromeClientQt): + +2012-07-26 Zeno Albisser <zeno@webkit.org> + + [Qt] requestAnimationFrame should only trigger when a new frame can be displayed. + https://bugs.webkit.org/show_bug.cgi?id=88638 + + Disable REQUEST_ANIMATION_FRAME_TIMER for the Qt port and tie + the servicing of scripted animations to the renderNextFrame call for WK2. + For WK1 we rely on the RefreshAnimation that is based on QAbstractAnimation. + + Reviewed by Jocelyn Turcotte. + + * WebCoreSupport/ChromeClientQt.cpp: + (RefreshAnimation): + Add a RefreshAnimation that is based on QAbstractAnimation + and drives the servicing of the scripted animations for WK1. + (WebCore::RefreshAnimation::RefreshAnimation): + (WebCore::RefreshAnimation::duration): + (WebCore::RefreshAnimation::scheduleAnimation): + Set m_animationScheduled to true and start the animation + timer in case it is not running yet. + (WebCore::RefreshAnimation::updateCurrentTime): + Call serviceScriptedAnimations if m_animationScheduled is true. + If this is not the case, the animation timer can be stopped, + because no animation needs to be scheduled anymore. + (WebCore): + (WebCore::ChromeClientQt::scheduleAnimation): + Create and start the RefreshAnimation instance with the + first call to scheduleAnimation. + * WebCoreSupport/ChromeClientQt.h: + (WebCore): + (ChromeClientQt): + +2012-07-26 Kaustubh Atrawalkar <kaustubh@motorola.com> + + [DRT] LTC:: pageNumberForElementById() could be moved to Internals + https://bugs.webkit.org/show_bug.cgi?id=92091 + + Reviewed by Adam Barth. + + Move the pageNumberForElementById from LayoutTestCotroller to Internals and + remove the old platform specific implementations as it exclusively tests WebCore functionality. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + * WebCoreSupport/DumpRenderTreeSupportQt.h: + 2012-07-24 Pierre Rossi <pierre.rossi@gmail.com> [Qt][WK1] color input type support diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index 43b105ef3..92814429b 100644 --- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -70,6 +70,7 @@ #include "qwebsecurityorigin.h" #include "qwebsecurityorigin_p.h" #include "qwebview.h" +#include <qabstractanimation.h> #include <qdebug.h> #include <qeventloop.h> #include <qtooltip.h> @@ -88,6 +89,40 @@ namespace WebCore { +#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) +class RefreshAnimation : public QAbstractAnimation { +public: + RefreshAnimation(ChromeClientQt* chromeClient) + : QAbstractAnimation() + , m_chromeClient(chromeClient) + , m_animationScheduled(false) + { } + + virtual int duration() const { return -1; } + + void scheduleAnimation() + { + m_animationScheduled = true; + if (state() != QAbstractAnimation::Running) + start(); + } + +protected: + virtual void updateCurrentTime(int currentTime) + { + UNUSED_PARAM(currentTime); + if (m_animationScheduled) { + m_animationScheduled = false; + m_chromeClient->serviceScriptedAnimations(); + } else + stop(); + } +private: + ChromeClientQt* m_chromeClient; + bool m_animationScheduled; +}; +#endif + bool ChromeClientQt::dumpVisitedLinksCallbacks = false; ChromeClientQt::ChromeClientQt(QWebPage* webPage) @@ -618,6 +653,19 @@ void ChromeClientQt::setCursor(const Cursor& cursor) #endif } +#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) +void ChromeClientQt::scheduleAnimation() +{ + if (!m_refreshAnimation) + m_refreshAnimation = adoptPtr(new RefreshAnimation(this)); + m_refreshAnimation->scheduleAnimation(); +} + +void ChromeClientQt::serviceScriptedAnimations() +{ + m_webPage->mainFrame()->d->frame->view()->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(currentTime())); +} +#endif #if USE(ACCELERATED_COMPOSITING) void ChromeClientQt::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer) diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h index af1fff6d4..79d43b3f7 100644 --- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h @@ -49,6 +49,7 @@ class FileChooser; class FileIconLoader; class FloatRect; class Page; +class RefreshAnimation; struct FrameLoadRequest; class QtAbstractWebPopup; struct ViewportArguments; @@ -176,6 +177,11 @@ public: virtual void setCursor(const Cursor&); virtual void setCursorHiddenUntilMouseMoves(bool) { } +#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) + virtual void scheduleAnimation(); + virtual void serviceScriptedAnimations(); +#endif + virtual void scrollRectIntoView(const LayoutRect) const { } virtual bool selectItemWritingDirectionIsNatural(); @@ -201,6 +207,9 @@ public: bool statusBarVisible; bool menuBarVisible; QEventLoop* m_eventLoop; +#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) + OwnPtr<RefreshAnimation> m_refreshAnimation; +#endif #if ENABLE(VIDEO) && (USE(GSTREAMER) || USE(QT_MULTIMEDIA) || USE(QTKIT)) FullScreenVideoQt* m_fullScreenVideo; diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index c02e66e66..714f560f0 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -386,19 +386,6 @@ void DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread(bool wait gcController().garbageCollectOnAlternateThreadForDebugging(waitUntilDone); } -int DumpRenderTreeSupportQt::pageNumberForElementById(QWebFrame* frame, const QString& id, float width, float height) -{ - Frame* coreFrame = QWebFramePrivate::core(frame); - if (!coreFrame) - return -1; - - Element* element = coreFrame->document()->getElementById(AtomicString(id)); - if (!element) - return -1; - - return PrintContext::pageNumberForElement(element, FloatSize(width, height)); -} - int DumpRenderTreeSupportQt::numberOfPages(QWebFrame* frame, float width, float height) { Frame* coreFrame = QWebFramePrivate::core(frame); @@ -1090,6 +1077,11 @@ void DumpRenderTreeSupportQt::resetInternalsObject(QWebFrame* frame) WebCoreTestSupport::resetInternalsObject(context); } +void DumpRenderTreeSupportQt::resetInternalsObject(JSContextRef context) +{ + WebCoreTestSupport::resetInternalsObject(context); +} + QImage DumpRenderTreeSupportQt::paintPagesWithBoundaries(QWebFrame* qframe) { Frame* frame = QWebFramePrivate::core(qframe); diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h index 0184ee4da..34041ddfa 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -128,7 +128,6 @@ public: static void overwritePluginDirectories(); static int numberOfActiveAnimations(QWebFrame*); static int numberOfPages(QWebFrame* frame, float width, float height); - static int pageNumberForElementById(QWebFrame* frame, const QString& id, float width, float height); static bool hasDocumentElement(QWebFrame* frame); static bool elementDoesAutoCompleteForElementWithId(QWebFrame* frame, const QString& elementId); static void setWindowsBehaviorAsEditingBehavior(QWebPage*); @@ -205,6 +204,7 @@ public: static void injectInternalsObject(QWebFrame*); static void injectInternalsObject(JSContextRef); static void resetInternalsObject(QWebFrame*); + static void resetInternalsObject(JSContextRef); static void setInteractiveFormValidationEnabled(QWebPage*, bool); diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog index 5eb1be3f8..86942ca6a 100644 --- a/Source/WebKit/win/ChangeLog +++ b/Source/WebKit/win/ChangeLog @@ -1,3 +1,52 @@ +2012-07-26 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [Mac] Fix build break on Apple win bot after r123711 + https://bugs.webkit.org/show_bug.cgi?id=92354 + + Reviewed by Adam Barth. + + Missing return value. + + * WebFrame.cpp: + (WebFrame::pageNumberForElementById): + +2012-07-26 Kaustubh Atrawalkar <kaustubh@motorola.com> + + [DRT] LTC:: pageNumberForElementById() could be moved to Internals + https://bugs.webkit.org/show_bug.cgi?id=92091 + + Reviewed by Adam Barth. + + Moved the pageNumberForElementById from LayoutTestCotroller to Internals and + remove the old platform specific implementations as it exclusively tests WebCore functionality. + + * WebFrame.cpp: Added comment for removing the function. Removed implementation. + +2012-07-25 Roger Fong <roger_fong@apple.com> + + Changes to the WebFrame API cause dependent apps to crash. + https://bugs.webkit.org/show_bug.cgi?id=91656 + <rdar://problem/11904605> + + Reviewed by Jon Honeycutt. + + Changes to the WebFrame API cause certain apps to crash because of inconsistencies in the COM interface. + The resumeAnimations and suspendAnimations are removed, which are still needed. + The counterValueByElementId method was also removed, although is not needed there. + However, for all of these methods, no method stubs were added where appropriate after removal. + + * Interfaces/IWebFramePrivate.idl: + Added resumeAnimations() and suspendAnimations() methods back in. Added unused method stub for counterValueByElementId method. + + * WebFrame.cpp: + (WebFrame::resumeAnimations): + Added this method back in. + (WebFrame::suspendAnimations): + Added this method back in. + + * WebFrame.h: + (Re)added methods and unused method stubs. + 2012-07-23 Patrick Gansterer <paroga@webkit.org> Build fix if NOMINMAX is defined by the build system. diff --git a/Source/WebKit/win/Interfaces/IWebFramePrivate.idl b/Source/WebKit/win/Interfaces/IWebFramePrivate.idl index 146c300d8..b2dfce8a6 100644 --- a/Source/WebKit/win/Interfaces/IWebFramePrivate.idl +++ b/Source/WebKit/win/Interfaces/IWebFramePrivate.idl @@ -96,6 +96,8 @@ interface IWebFramePrivate : IUnknown [local] JSGlobalContextRef globalContextForScriptWorld([in] IWebScriptWorld*); + HRESULT unused3([in] BSTR, [out, retval] BSTR*); + HRESULT visibleContentRect([out, retval] RECT*); HRESULT pageNumberForElementById([in] BSTR id, [in] float pageWidthInPixels, [in] float pageHeightInPixels, [out, retval] int* pageNumber); @@ -108,9 +110,13 @@ interface IWebFramePrivate : IUnknown HRESULT renderTreeAsExternalRepresentation([in] BOOL forPrinting, [out, retval] BSTR* result); + HRESULT suspendAnimations(); + HRESULT resumeAnimations(); + HRESULT loadPlainTextString([in] BSTR string, [in] BSTR url); HRESULT clearOpener(); HRESULT setTextDirection([in] BSTR direction); + } diff --git a/Source/WebKit/win/WebFrame.cpp b/Source/WebKit/win/WebFrame.cpp index 9ce1c7811..ff560c67b 100644 --- a/Source/WebKit/win/WebFrame.cpp +++ b/Source/WebKit/win/WebFrame.cpp @@ -883,20 +883,10 @@ HRESULT STDMETHODCALLTYPE WebFrame::pageNumberForElementById( /* [in] */ float pageHeightInPixels, /* [retval][out] */ int* result) { - if (!result) - return E_POINTER; - - Frame* coreFrame = core(this); - if (!coreFrame) - return E_FAIL; - - String coreId = String(id, SysStringLen(id)); - - Element* element = coreFrame->document()->getElementById(coreId); - if (!element) - return E_FAIL; - *result = PrintContext::pageNumberForElement(element, FloatSize(pageWidthInPixels, pageHeightInPixels)); - return S_OK; + // TODO: Please remove this function if not needed as this is LTC specific function + // and has been moved to Internals. + notImplemented(); + return E_FAIL; } HRESULT STDMETHODCALLTYPE WebFrame::numberOfPages( @@ -1198,6 +1188,26 @@ HRESULT WebFrame::elementDoesAutoComplete(IDOMElement *element, BOOL *result) return S_OK; } +HRESULT STDMETHODCALLTYPE WebFrame::resumeAnimations() +{ + Frame* frame = core(this); + if (!frame) + return E_FAIL; + + frame->animation()->resumeAnimations(); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebFrame::suspendAnimations() +{ + Frame* frame = core(this); + if (!frame) + return E_FAIL; + + frame->animation()->suspendAnimations(); + return S_OK; +} + HRESULT WebFrame::pauseAnimation(BSTR animationName, IDOMNode* node, double secondsFromNow, BOOL* animationWasRunning) { if (!node || !animationWasRunning) diff --git a/Source/WebKit/win/WebFrame.h b/Source/WebKit/win/WebFrame.h index c2fbe36a2..d80193dd2 100644 --- a/Source/WebKit/win/WebFrame.h +++ b/Source/WebKit/win/WebFrame.h @@ -280,6 +280,12 @@ public: virtual HRESULT STDMETHODCALLTYPE setTextDirection(BSTR); + virtual HRESULT STDMETHODCALLTYPE unused3(BSTR, BSTR*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE resumeAnimations(); + + virtual HRESULT STDMETHODCALLTYPE suspendAnimations(); + // IWebDocumentText virtual HRESULT STDMETHODCALLTYPE supportsTextEncoding( /* [retval][out] */ BOOL* result); |
