diff options
Diffstat (limited to 'Source/WebKit')
171 files changed, 5394 insertions, 1842 deletions
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index 5c7dafc88..020355f3f 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,3 +1,66 @@ +2012-05-10 Sam D <dsam2912@gmail.com> + + Web Inspector: rename InspectorBackendStub.js to InspectorBackendCommands.js + https://bugs.webkit.org/show_bug.cgi?id=72306 + + Changed name for InspectorBackendStub.js to + InspectorBackendCommands.js + + Reviewed by Yury Semikhatsky. + + * PlatformBlackBerry.cmake: + +2012-05-08 Crystal Zhang <haizhang@rim.com> + + [BlackBerry] Implement a popup client for HTML controls + https://bugs.webkit.org/show_bug.cgi?id=85670 + + Reviewed by Rob Buis. + + Add popup client file to build system. + + * PlatformBlackBerry.cmake: + +2012-05-08 Raphael Kubo da Costa <rakuco@webkit.org> + + [CMake] Rewrite FindGStreamer.cmake. + https://bugs.webkit.org/show_bug.cgi?id=85857 + + Reviewed by Daniel Bates. + + We are currently kind of duplicating the same + FindGStreamer-Foo.cmake file whenever a new GStreamer plugin needs + to be found. Besides this approach not scaling very well, it + relies on pkg-config for version checking, uses the LibFindMacros + package that we should deprecate and all the find files could be + merged into one, with users using the COMPONENTS feature of the + FIND_PACKAGE() call to find the desired plugins. + + FindGStreamer.cmake has then been rewritten to take all that into + account: + - The LibFindMacros.cmake package is not used anymore. + - Version check is performed in the CMake file itself by parsing + the gstversion.h header. + - All GStreamer plugins are searched and the COMPONENTS keyword + used in the FIND_PACKAGE() call is used to check which plugins are + required. + - The plugins-base and base GStreamer plugins are not searched, as + they were not used anywhere in the build system. + + * PlatformEfl.cmake: Update GStreamer-related variable names. + +2012-05-08 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] AutofillManager implementation upstream + https://bugs.webkit.org/show_bug.cgi?id=85576 + + Reviewed by Rob Buis. + + Added WebKit/blackberry/WebCoreSupport/AutofillManager.cpp + into building system of BlackBerry porting. + + * PlatformBlackBerry.cmake: + 2012-05-03 Jer Noble <jer.noble@apple.com> Move WebKitFullScreenListener into its own file. diff --git a/Source/WebKit/PlatformBlackBerry.cmake b/Source/WebKit/PlatformBlackBerry.cmake index fcff9cb67..ae287dfb5 100644 --- a/Source/WebKit/PlatformBlackBerry.cmake +++ b/Source/WebKit/PlatformBlackBerry.cmake @@ -56,6 +56,7 @@ LIST(APPEND WebKit_SOURCES blackberry/Api/WebSettings.cpp blackberry/Api/WebViewportArguments.cpp blackberry/WebCoreSupport/AboutData.cpp + blackberry/WebCoreSupport/AutofillManager.cpp blackberry/WebCoreSupport/CacheClientBlackBerry.cpp blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp blackberry/WebCoreSupport/ClientExtension.cpp @@ -74,6 +75,7 @@ LIST(APPEND WebKit_SOURCES blackberry/WebCoreSupport/JavaScriptDebuggerBlackBerry.cpp blackberry/WebCoreSupport/NotificationPresenterImpl.cpp blackberry/WebCoreSupport/VibrationClientBlackBerry.cpp + blackberry/WebCoreSupport/PagePopupBlackBerry.cpp blackberry/WebKitSupport/BackingStoreCompositingSurface.cpp blackberry/WebKitSupport/BackingStoreTile.cpp blackberry/WebKitSupport/BackingStoreClient.cpp @@ -186,9 +188,9 @@ FILE (STRINGS ${WEBCORE_DIR}/inspector/front-end/inspector.html SCRIPT_TAGS REGE FOREACH (_line IN LISTS SCRIPT_TAGS) STRING (STRIP ${_line} _stripped_line) STRING (REGEX REPLACE "<script.* src=\"(.*\\.js)\".*></script>" "\\1" _js_file ${_stripped_line}) - STRING (COMPARE EQUAL ${_js_file} "InspectorBackendStub.js" _comp_result) + STRING (COMPARE EQUAL ${_js_file} "InspectorBackendCommands.js" _comp_result) IF ( ${_comp_result} ) - # InspectorBackendStub.js was generated with the build, should get it from DERIVED_SOURCES_WEBCORE_DIR. + # InspectorBackendCommands.js was generated with the build, should get it from DERIVED_SOURCES_WEBCORE_DIR. SET (_js_file "${DERIVED_SOURCES_WEBCORE_DIR}/${_js_file}") ELSE () SET (_js_file "${WEBCORE_DIR}/inspector/front-end/${_js_file}") diff --git a/Source/WebKit/PlatformEfl.cmake b/Source/WebKit/PlatformEfl.cmake index c4d20cc70..fc43b467c 100644 --- a/Source/WebKit/PlatformEfl.cmake +++ b/Source/WebKit/PlatformEfl.cmake @@ -37,10 +37,10 @@ ENDIF () IF (ENABLE_VIDEO) LIST(APPEND WebKit_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/graphics/gstreamer" - ${GStreamer-App_INCLUDE_DIRS} - ${GStreamer-Interfaces_INCLUDE_DIRS} - ${GStreamer-Pbutils_INCLUDE_DIRS} - ${GStreamer-Video_INCLUDE_DIRS} + ${GSTREAMER_APP_INCLUDE_DIRS} + ${GSTREAMER_INTERFACES_INCLUDE_DIRS} + ${GSTREAMER_PBUTILS_INCLUDE_DIRS} + ${GSTREAMER_VIDEO_INCLUDE_DIRS} ) ENDIF() diff --git a/Source/WebKit/blackberry/Api/BackingStore.cpp b/Source/WebKit/blackberry/Api/BackingStore.cpp index eeda7dd8a..ddc873fe0 100644 --- a/Source/WebKit/blackberry/Api/BackingStore.cpp +++ b/Source/WebKit/blackberry/Api/BackingStore.cpp @@ -79,6 +79,7 @@ const int s_renderTimerTimeout = 1.0; WebPage* BackingStorePrivate::s_currentBackingStoreOwner = 0; Platform::Graphics::Buffer* BackingStorePrivate::s_overScrollImage = 0; std::string BackingStorePrivate::s_overScrollImagePath; +Platform::IntSize BackingStorePrivate::s_overScrollImageSize; typedef std::pair<int, int> Divisor; typedef Vector<Divisor> DivisorList; @@ -1207,43 +1208,38 @@ bool BackingStorePrivate::ensureOverScrollImage() if (s_overScrollImage && path == s_overScrollImagePath) return true; - std::string imagePath = Platform::Client::get()->getApplicationDirectory() + path; + std::string imagePath = Platform::Client::get()->getApplicationLocalDirectory() + path; SkBitmap bitmap; - if (!SkImageDecoder::DecodeFile(imagePath.c_str(), &bitmap)) { BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical, "BackingStorePrivate::ensureOverScrollImage could not decode overscroll image: %s", imagePath.c_str()); return false; } - // FIXME: Make it orientation and resolution agnostic - if (bitmap.width() != surfaceSize().width() || bitmap.height() != surfaceSize().height()) - return false; - - // FIXME: For now we fallback to solid color if sizes don't match, later we can implement tiling + destroyBuffer(s_overScrollImage); s_overScrollImage = createBuffer(Platform::IntSize(bitmap.width(), bitmap.height()), Platform::Graphics::TemporaryBuffer); SkCanvas* canvas = Platform::Graphics::lockBufferDrawable(s_overScrollImage); - if (!canvas) { destroyBuffer(s_overScrollImage); s_overScrollImage = 0; return false; } + SkPaint paint; paint.setXfermodeMode(SkXfermode::kSrc_Mode); paint.setFlags(SkPaint::kAntiAlias_Flag); paint.setFilterBitmap(true); SkRect rect = SkRect::MakeXYWH(0, 0, bitmap.width(), bitmap.height()); - canvas->save(); canvas->drawBitmapRect(bitmap, 0, rect, &paint); canvas->restore(); Platform::Graphics::releaseBufferDrawable(s_overScrollImage); + s_overScrollImageSize = Platform::IntSize(bitmap.width(), bitmap.height()); s_overScrollImagePath = path; return true; @@ -1278,9 +1274,20 @@ void BackingStorePrivate::paintDefaultBackground(const Platform::IntRect& conten overScrollRect.intersect(Platform::IntRect(Platform::IntPoint(0, 0), surfaceSize())); } - if (ensureOverScrollImage()) - blitToWindow(overScrollRect, s_overScrollImage, overScrollRect, false, 255); - else + if (ensureOverScrollImage()) { + // Tile the image on the window region. + Platform::IntRect dstRect; + for (int y = overScrollRect.y(); y < overScrollRect.y() + overScrollRect.height(); y += dstRect.height()) { + for (int x = overScrollRect.x(); x < overScrollRect.x() + overScrollRect.width(); x += dstRect.width()) { + Platform::IntRect imageRect = Platform::IntRect(Platform::IntPoint(x - (x % s_overScrollImageSize.width()), + y - (y % s_overScrollImageSize.height())), s_overScrollImageSize); + dstRect = imageRect; + dstRect.intersect(overScrollRect); + Platform::IntRect srcRect = Platform::IntRect(x - imageRect.x(), y - imageRect.y(), dstRect.width(), dstRect.height()); + blitToWindow(dstRect, s_overScrollImage, srcRect, false, 255); + } + } + } else clearWindow(overScrollRect, color.red(), color.green(), color.blue(), color.alpha()); } } diff --git a/Source/WebKit/blackberry/Api/BackingStore_p.h b/Source/WebKit/blackberry/Api/BackingStore_p.h index 25b6c8c6b..24e94659b 100644 --- a/Source/WebKit/blackberry/Api/BackingStore_p.h +++ b/Source/WebKit/blackberry/Api/BackingStore_p.h @@ -371,6 +371,7 @@ public: static Platform::Graphics::Buffer* s_overScrollImage; static std::string s_overScrollImagePath; + static Platform::IntSize s_overScrollImageSize; protected: virtual ~BackingStorePrivate(); diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index 21e906a3b..b1255d1ba 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -20,6 +20,7 @@ #include "WebPage.h" #include "ApplicationCacheStorage.h" +#include "AutofillManager.h" #include "BackForwardController.h" #include "BackForwardListImpl.h" #include "BackingStoreClient.h" @@ -35,6 +36,7 @@ #include "ContextMenuClientBlackBerry.h" #include "CookieManager.h" #include "CredentialManager.h" +#include "CredentialStorage.h" #include "CredentialTransformData.h" #include "DOMSupport.h" #include "Database.h" @@ -82,6 +84,7 @@ #include "Page.h" #include "PageCache.h" #include "PageGroup.h" +#include "PagePopupBlackBerry.h" #include "PlatformTouchEvent.h" #include "PlatformWheelEvent.h" #include "PluginDatabase.h" @@ -304,6 +307,11 @@ protected: typedef DeferredTask<isActive> DeferredTaskType; }; +void WebPage::autofillTextField(const string& item) +{ + d->m_autofillManager->autofillTextField(item.c_str()); +} + WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const IntRect& rect) : m_webPage(webPage) , m_client(client) @@ -372,6 +380,9 @@ WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const In , m_hasInRegionScrollableAreas(false) , m_updateDelegatedOverlaysDispatched(false) , m_deferredTasksTimer(this, &WebPagePrivate::deferredTasksTimerFired) + , m_selectPopup(0) + , m_parentPopup(0) + , m_autofillManager(AutofillManager::create(this)) { static bool isInitialized = false; if (!isInitialized) { @@ -2121,6 +2132,14 @@ PageClientBlackBerry::SaveCredentialType WebPagePrivate::notifyShouldSaveCredent return static_cast<PageClientBlackBerry::SaveCredentialType>(m_client->notifyShouldSaveCredential(isNew)); } +void WebPagePrivate::notifyPopupAutofillDialog(const Vector<String>& candidates, const WebCore::IntRect& screenRect) +{ + vector<string> textItems; + for (size_t i = 0; i < candidates.size(); i++) + textItems.push_back(candidates[i].utf8().data()); + m_client->notifyPopupAutofillDialog(textItems, screenRect); +} + bool WebPagePrivate::useFixedLayout() const { return true; @@ -3806,6 +3825,9 @@ bool WebPagePrivate::handleMouseEvent(PlatformMouseEvent& mouseEvent) if (mouseEvent.type() == WebCore::PlatformEvent::MouseScroll) return true; + if (m_parentPopup) + m_parentPopup->handleMouseEvent(mouseEvent); + Node* node = 0; if (mouseEvent.inputMethod() == TouchScreen) { const FatFingersResult lastFatFingersResult = m_touchEventHandler->lastFatFingersResult(); @@ -5171,6 +5193,11 @@ void WebPage::clearCredentials() #endif } +void WebPage::clearAutofillData() +{ + AutofillManager::clear(); +} + void WebPage::clearNeverRememberSites() { #if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST) @@ -5277,6 +5304,11 @@ bool WebPage::nodeHasHover(const WebDOMNode& node) } #endif +void WebPage::initPopupWebView(BlackBerry::WebKit::WebPage* webPage) +{ + d->m_selectPopup->init(webPage); +} + String WebPagePrivate::findPatternStringForUrl(const KURL& url) const { if ((m_webSettings->shouldHandlePatternUrls() && protocolIs(url, "pattern")) @@ -5994,6 +6026,8 @@ void WebPagePrivate::didChangeSettings(WebSettings* webSettings) cookieManager().setPrivateMode(webSettings->isPrivateBrowsingEnabled()); + CredentialStorage::setPrivateMode(webSettings->isPrivateBrowsingEnabled()); + if (m_mainFrame && m_mainFrame->view()) { Color backgroundColor(webSettings->backgroundColor()); m_mainFrame->view()->updateBackgroundRecursively(backgroundColor, backgroundColor.hasAlpha()); @@ -6077,5 +6111,32 @@ const String& WebPagePrivate::defaultUserAgent() return *defaultUserAgent; } +void WebPage::popupOpened(PagePopupBlackBerry* webPopup) +{ + ASSERT(!d->m_selectPopup); + d->m_selectPopup = webPopup; +} + +void WebPage::popupClosed() +{ + ASSERT(d->m_selectPopup); + d->m_selectPopup = 0; +} + +bool WebPage::hasOpenedPopup() const +{ + return d->m_selectPopup; +} + +PagePopupBlackBerry* WebPage::popup() +{ + return d->m_selectPopup; +} + +void WebPagePrivate::setParentPopup(PagePopupBlackBerry* webPopup) +{ + m_parentPopup = webPopup; +} + } } diff --git a/Source/WebKit/blackberry/Api/WebPage.h b/Source/WebKit/blackberry/Api/WebPage.h index 82d4ef6ea..b01e66424 100644 --- a/Source/WebKit/blackberry/Api/WebPage.h +++ b/Source/WebKit/blackberry/Api/WebPage.h @@ -38,6 +38,7 @@ namespace WebCore { class ChromeClientBlackBerry; class Frame; class FrameLoaderClientBlackBerry; +class PagePopupBlackBerry; } class WebDOMDocument; @@ -195,6 +196,7 @@ public: void clearCache(); void clearLocalStorage(); void clearCredentials(); + void clearAutofillData(); void clearNeverRememberSites(); void runLayoutTests(); @@ -332,6 +334,14 @@ public: void setUserViewportArguments(const WebViewportArguments&); void resetUserViewportArguments(); + // Popup client + void initPopupWebView(BlackBerry::WebKit::WebPage*); + void popupOpened(WebCore::PagePopupBlackBerry* webPopup); + void popupClosed(); + bool hasOpenedPopup() const; + WebCore::PagePopupBlackBerry* popup(); + + void autofillTextField(const std::string&); private: virtual ~WebPage(); @@ -344,6 +354,7 @@ private: friend class WebKit::WebPagePrivate; friend class WebCore::ChromeClientBlackBerry; friend class WebCore::FrameLoaderClientBlackBerry; + friend class WebCore::PagePopupBlackBerry; WebPagePrivate* d; }; } diff --git a/Source/WebKit/blackberry/Api/WebPageClient.h b/Source/WebKit/blackberry/Api/WebPageClient.h index 329660963..2ae973fdd 100644 --- a/Source/WebKit/blackberry/Api/WebPageClient.h +++ b/Source/WebKit/blackberry/Api/WebPageClient.h @@ -213,6 +213,7 @@ public: virtual void setPreventsScreenIdleDimming(bool noDimming) = 0; virtual void authenticationChallenge(const unsigned short* realm, unsigned int realmLength, WebString& username, WebString& password) = 0; virtual SaveCredentialType notifyShouldSaveCredential(bool isNew) = 0; + virtual void notifyPopupAutofillDialog(const std::vector<std::string>&, const Platform::IntRect&) = 0; virtual bool shouldPluginEnterFullScreen() = 0; virtual void didPluginEnterFullScreen() = 0; @@ -251,6 +252,8 @@ public: virtual void clearCache() = 0; virtual bool hasKeyboardFocus() = 0; + virtual void createPopupWebView(const Platform::IntRect& webViewRect) = 0; + virtual void closePopupWebView() = 0; }; } // namespace WebKit } // namespace BlackBerry diff --git a/Source/WebKit/blackberry/Api/WebPage_p.h b/Source/WebKit/blackberry/Api/WebPage_p.h index 1c86c1a4a..c688c6de6 100644 --- a/Source/WebKit/blackberry/Api/WebPage_p.h +++ b/Source/WebKit/blackberry/Api/WebPage_p.h @@ -36,6 +36,7 @@ #include <BlackBerryPlatformMessage.h> namespace WebCore { +class AutofillManager; class DOMWrapperWorld; class Document; class Frame; @@ -48,6 +49,7 @@ class RenderLayer; class RenderObject; class ScrollView; class TransformationMatrix; +class PagePopupBlackBerry; template<typename T> class Timer; } @@ -189,6 +191,7 @@ public: void overflowExceedsContentsSize() { m_overflowExceedsContentsSize = true; } void layoutFinished(); void setNeedTouchEvents(bool); + void notifyPopupAutofillDialog(const Vector<String>&, const WebCore::IntRect&); // Called according to our heuristic or from setLoadState depending on whether we have a virtual viewport. void zoomToInitialScaleOnLoad(); @@ -398,6 +401,8 @@ public: void addBackingStoreClientForFrame(const WebCore::Frame*, BackingStoreClient*); void removeBackingStoreClientForFrame(const WebCore::Frame*); + void setParentPopup(WebCore::PagePopupBlackBerry* webPopup); + // Clean up any document related data we might be holding. void clearDocumentData(const WebCore::Document*); @@ -579,6 +584,12 @@ public: Vector<OwnPtr<DeferredTaskBase> > m_deferredTasks; WebCore::Timer<WebPagePrivate> m_deferredTasksTimer; + // The popup that opened in this webpage + WebCore::PagePopupBlackBerry* m_selectPopup; + // The popup that owned this webpage + WebCore::PagePopupBlackBerry* m_parentPopup; + + RefPtr<WebCore::AutofillManager> m_autofillManager; protected: virtual ~WebPagePrivate(); }; diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index 49f6d0909..e401ed012 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,256 @@ +2012-05-10 Mike Fenton <mifenton@rim.com> + + Caret node boundary should be adjusted to account for the visible region. + https://bugs.webkit.org/show_bug.cgi?id=86116 + + Reviewed by Antonio Gomes. + + PR 138988. + + Update the node bounding box to be clipped and adjusted + for the visible region of the frame. + + Reviewed Internally by Gen Mak. + + * WebKitSupport/SelectionHandler.cpp: + (BlackBerry::WebKit::SelectionHandler::caretPositionChanged): + +2012-05-10 Antonio Gomes <agomes@rim.com> + + [BlackBerry] Assertions and assumptions in BackingStoreClient around m_frame and m_frame->view() are invalid + https://bugs.webkit.org/show_bug.cgi?id=86096 + + Reviewed by Rob Buis. + + A Frame's FrameView has always to be checked since it is + a volatile object, and gets created and destroyed all the time. + + We have been facing a particular issue, where during our automated + interaction tests, the main frame object was being pinch zoomed in + the middle of it creation, and WebKit thread was blocked by a mutex. + In practice, it is a case that would not be possible in a real + world scenario, but shows that the ASSERTs are bogus regardless. + + * WebKitSupport/BackingStoreClient.cpp: + (BlackBerry::WebKit::BackingStoreClient::scrollPosition): + (BlackBerry::WebKit::BackingStoreClient::setScrollPosition): + (BlackBerry::WebKit::BackingStoreClient::maximumScrollPosition): + (BlackBerry::WebKit::BackingStoreClient::viewportSize): + (BlackBerry::WebKit::BackingStoreClient::transformedViewportSize): + (BlackBerry::WebKit::BackingStoreClient::visibleContentsRect): + (BlackBerry::WebKit::BackingStoreClient::contentsSize): + +2012-05-09 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] Autofill feature implementation for BlackBerry porting + https://bugs.webkit.org/show_bug.cgi?id=85577 + + Reviewed by Rob Buis. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::autofillTextField): Added this interface + function to auto fill the inputting text field when user selects + a autofill candidate value from autofill context dialog. + (WebKit): + (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate): + (BlackBerry::WebKit::WebPagePrivate::notifyPopupAutofillDialog): Added + this interface function to notify WebPageClient to pop up the autofill + context dialog with the suggested input items. + (BlackBerry::WebKit::WebPage::clearAutofillData): + * Api/WebPage.h: + * Api/WebPageClient.h: + * Api/WebPage_p.h: + (WebCore): + (WebPagePrivate): + * WebCoreSupport/AutofillManager.cpp: + (WebCore::AutofillManager::didChangeInTextField): + * WebCoreSupport/EditorClientBlackBerry.cpp: + (WebCore::EditorClientBlackBerry::textDidChangeInTextField): Implemented + this function to listen to the notification of text field change, and + notify AutofillManager to handle the autofill. + * WebCoreSupport/FrameLoaderClientBlackBerry.cpp: + (WebCore::FrameLoaderClientBlackBerry::dispatchWillSubmitForm): + (WebCore::FrameLoaderClientBlackBerry::dispatchWillSendSubmitEvent): + Save the name and value pair of every autofillable input text field when + user submitting a form. + +2012-05-09 Crystal Zhang <haizhang@rim.com> + + [BlackBerry] Enable PAGE_POPUP in make file, and implement required methods + https://bugs.webkit.org/show_bug.cgi?id=85907 + + Reviewed by Rob Buis. + + Internal reviewed by Yong Li. + + Enable PAGE_POPUP so we can use WebCore::PagePopup and WebCore::PagePopupClient interface. + Implement virtual methods in WebCore::ChromeClientBlackBerry that required for the + implementation and add methods in WebKit::WebPage that needed for PagePopupClient. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate): + (BlackBerry::WebKit::WebPagePrivate::handleMouseEvent): + (BlackBerry::WebKit::WebPage::initPopupWebView): + (WebKit): + (BlackBerry::WebKit::WebPage::popupOpened): + (BlackBerry::WebKit::WebPage::popupClosed): + (BlackBerry::WebKit::WebPage::hasOpenedPopup): + (BlackBerry::WebKit::WebPage::popup): + (BlackBerry::WebKit::WebPagePrivate::setParentPopup): + * Api/WebPage.h: + (WebCore): + * Api/WebPage_p.h: + (WebCore): + (WebPagePrivate): + * WebCoreSupport/ChromeClientBlackBerry.cpp: + (WebCore::ChromeClientBlackBerry::hasOpenedPopup): + (WebCore::ChromeClientBlackBerry::openPagePopup): + (WebCore): + (WebCore::ChromeClientBlackBerry::closePagePopup): + * WebCoreSupport/ChromeClientBlackBerry.h: + (WebCore): + (ChromeClientBlackBerry): + +2012-05-08 Jason Liu <jason.liu@torchmobile.com.cn> + + [BlackBerry] Auth credentials set in private mode are reused in public mode. + https://bugs.webkit.org/show_bug.cgi?id=84697 + + Reviewed by Rob Buis. + + Add setPrivateMode function for CredentialStorage. + + We have to change Private Browsing to test, so have to write a manual test case. + Test: ManualTests/blackberry/http-auth-private-mode-changed.html + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::didChangeSettings): + +2012-05-08 Crystal Zhang <haizhang@rim.com> + + [BlackBerry] Implement a popup client for HTML controls + https://bugs.webkit.org/show_bug.cgi?id=85670 + + Reviewed by Rob Buis. + + Implement a popup client for HTML controls, which would be used to load + different popups according to popup type. + + * WebCoreSupport/PagePopupBlackBerry.cpp: Added. + (WebCore): + (PagePopupChromeClient): + (WebCore::PagePopupChromeClient::PagePopupChromeClient): + (WebCore::PagePopupChromeClient::closeWindowSoon): + (WebCore::PagePopupChromeClient::webPage): + (WebCore::PagePopupBlackBerry::PagePopupBlackBerry): + (WebCore::PagePopupBlackBerry::~PagePopupBlackBerry): + (WebCore::PagePopupBlackBerry::sendCreatePopupWebViewRequest): + (WebCore::PagePopupBlackBerry::init): + (WebCore::setValueAndClosePopupCallback): + (WebCore::popUpExtensionInitialize): + (WebCore::popUpExtensionFinalize): + (WebCore::PagePopupBlackBerry::installDomFunction): + (WebCore::PagePopupBlackBerry::handleMouseEvent): + (WebCore::PagePopupBlackBerry::closePopup): + (WebCore::PagePopupBlackBerry::closeWebPage): + * WebCoreSupport/PagePopupBlackBerry.h: Added. + (WebKit): + (WebCore): + (PagePopupBlackBerry): + +2012-05-08 Andrew Lo <anlo@rim.com> + + [BlackBerry] Over-scroll image should be tiled + https://bugs.webkit.org/show_bug.cgi?id=85860 + + Reviewed by Rob Buis. + + Implement tiling for over-scroll image if image dimension don't match + the surface dimensions. + + * Api/BackingStore.cpp: + (WebKit): + (BlackBerry::WebKit::BackingStorePrivate::ensureOverScrollImage): + (BlackBerry::WebKit::BackingStorePrivate::paintDefaultBackground): + * Api/BackingStore_p.h: + (BackingStorePrivate): + +2012-05-08 Chris Guan <chris.guan@torchmobile.com.cn> + + [Blackberry] remove m_isRequestedByPlugin in ResourceRequest + https://bugs.webkit.org/show_bug.cgi?id=84559 + + Reviewed by Antonio Gomes. + + * WebCoreSupport/FrameLoaderClientBlackBerry.cpp: + (WebCore::FrameLoaderClientBlackBerry::dispatchDecidePolicyForNewWindowAction): + +2012-05-08 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] AutofillManager implementation upstream + https://bugs.webkit.org/show_bug.cgi?id=85576 + + Reviewed by Rob Buis. + + RIM PR: 136405 + Implemented class AutofillManager to handle the form autofill + interactions. + It listens to text changed notification from text input, searches + autofill database for the suggested autofill candidate value, + and notifies WebPageClient to pop up a context dialog for user; + it also responds to user's choice by autofilling the text input. + + * WebCoreSupport/AutofillManager.cpp: Added. + (WebCore): + (WebCore::AutofillManager::create): + (WebCore::AutofillManager::didChangeInTextField): + (WebCore::AutofillManager::autofillTextField): + (WebCore::AutofillManager::saveTextFields): + (WebCore::AutofillManager::clear): + * WebCoreSupport/AutofillManager.h: Added. + (WTF): + (WebKit): + (WebCore): + (AutofillManager): + (WebCore::AutofillManager::m_element): + +2012-05-07 Andrew Lo <anlo@rim.com> + + [BlackBerry] Delete previous buffer when new over-scroll image path is set + https://bugs.webkit.org/show_bug.cgi?id=85812 + + Reviewed by Rob Buis. + + When a new over-scroll image path is set, delete old buffer before creating + a new one. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::ensureOverScrollImage): + +2012-05-07 Andrew Lo <anlo@rim.com> + + [BlackBerry] Over-scroll image path property should be relative to local application directory + https://bugs.webkit.org/show_bug.cgi?id=85814 + + Reviewed by Rob Buis. + + Over-scroll image path web setting should be relative to the local directory. + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::ensureOverScrollImage): + +2012-05-07 Crystal Zhang <haizhang@rim.com> + + [BlackBerry] Add methods need by client side + https://bugs.webkit.org/show_bug.cgi?id=85661 + + Reviewed by Antonio Gomes. + + Add methods needed by client side when create and close HTML popup dialogs. + PR 154360 + + * Api/WebPageClient.h: + 2012-05-06 Mary Wu <mary.wu@torchmobile.com.cn> [BlackBerry] Support html5 download attribute. diff --git a/Source/WebKit/blackberry/WebCoreSupport/AutofillManager.cpp b/Source/WebKit/blackberry/WebCoreSupport/AutofillManager.cpp new file mode 100644 index 000000000..e3fc27d32 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/AutofillManager.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "AutofillManager.h" + +#include "AutofillBackingStore.h" +#include "HTMLCollection.h" +#include "HTMLFormElement.h" +#include "HTMLInputElement.h" +#include "WebPage_p.h" + +namespace WebCore { + +static bool isAutofillable(HTMLInputElement* element) +{ + return element && element->isTextField() && !element->isPasswordField() + && !element->isAutofilled() && element->shouldAutocomplete(); +} + +PassRefPtr<AutofillManager> AutofillManager::create(BlackBerry::WebKit::WebPagePrivate* page) +{ + return adoptRef(new AutofillManager(page)); +} + +void AutofillManager::didChangeInTextField(HTMLInputElement* element) +{ + if (!isAutofillable(element)) + return; + + if (m_element != element) + m_element = element; + + Vector<String> candidates = autofillBackingStore().get(element->getAttribute(HTMLNames::nameAttr).string(), element->value()); + m_webPagePrivate->notifyPopupAutofillDialog(candidates, element->screenRect()); +} + +void AutofillManager::autofillTextField(const String& value) +{ + if (!m_element) + return; + + m_element->setValue(value); + m_element->setAutofilled(); +} + +void AutofillManager::saveTextFields(HTMLFormElement* form) +{ + RefPtr<HTMLCollection> elements = form->elements(); + size_t itemCount = elements->length(); + for (size_t i = 0; i < itemCount; ++i) { + HTMLInputElement* element = form->item(i)->toInputElement(); + if (!isAutofillable(element)) + continue; + autofillBackingStore().add(element->getAttribute(HTMLNames::nameAttr).string(), element->value()); + } +} + +void AutofillManager::clear() +{ + autofillBackingStore().clear(); +} + +} // namespace WebCore diff --git a/Source/WebKit/blackberry/WebCoreSupport/AutofillManager.h b/Source/WebKit/blackberry/WebCoreSupport/AutofillManager.h new file mode 100644 index 000000000..397f17f65 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/AutofillManager.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AutofillManager_h +#define AutofillManager_h + +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WTF { +class String; +} + +namespace BlackBerry { +namespace WebKit { +class WebPagePrivate; +} +} + +namespace WebCore { +class HTMLFormElement; +class HTMLInputElement; + +class AutofillManager : public RefCounted<AutofillManager> { +public: + static PassRefPtr<AutofillManager> create(BlackBerry::WebKit::WebPagePrivate*); + + void didChangeInTextField(HTMLInputElement*); + void autofillTextField(const WTF::String&); + void saveTextFields(HTMLFormElement*); + + static void clear(); + +private: + AutofillManager(BlackBerry::WebKit::WebPagePrivate* page) : m_webPagePrivate(page), m_element(0) { } + + BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate; + HTMLInputElement* m_element; +}; + +} // WebCore + +#endif // AutofillManager_h diff --git a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp index 23368d5bf..df89aa52a 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp @@ -47,6 +47,8 @@ #include "Page.h" #include "PageGroup.h" #include "PageGroupLoadDeferrer.h" +#include "PagePopupBlackBerry.h" +#include "PagePopupClient.h" #include "PlatformString.h" #include "PopupMenuBlackBerry.h" #include "RenderView.h" @@ -58,6 +60,7 @@ #include "WebPage.h" #include "WebPageClient.h" #include "WebPage_p.h" +#include "WebPopupType.h" #include "WebSettings.h" #include "WebString.h" #include "WindowFeatures.h" @@ -282,8 +285,7 @@ bool ChromeClientBlackBerry::selectItemAlignmentFollowsMenuWritingDirection() bool ChromeClientBlackBerry::hasOpenedPopup() const { - notImplemented(); - return false; + return m_webPagePrivate->m_webPage->hasOpenedPopup(); } PassRefPtr<PopupMenu> ChromeClientBlackBerry::createPopupMenu(PopupMenuClient* client) const @@ -296,6 +298,31 @@ PassRefPtr<SearchPopupMenu> ChromeClientBlackBerry::createSearchPopupMenu(PopupM return adoptRef(new SearchPopupMenuBlackBerry(client)); } +PagePopup* ChromeClientBlackBerry::openPagePopup(PagePopupClient* client, const IntRect& originBoundsInRootView) +{ + PagePopupBlackBerry* webPopup; + + if (!hasOpenedPopup()) { + webPopup = new PagePopupBlackBerry(m_webPagePrivate, client, + rootViewToScreen(originBoundsInRootView)); + m_webPagePrivate->m_webPage->popupOpened(webPopup); + } else { + webPopup = m_webPagePrivate->m_webPage->popup(); + webPopup->closeWebPage(); + } + webPopup->sendCreatePopupWebViewRequest(); + return webPopup; +} + +void ChromeClientBlackBerry::closePagePopup(PagePopup* popup) +{ + if (!popup) + return; + + PagePopupBlackBerry* webPopup = m_webPagePrivate->m_webPage->popup(); + webPopup->closePopup(); + m_webPagePrivate->m_webPage->popupClosed(); +} void ChromeClientBlackBerry::setToolbarsVisible(bool) { diff --git a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h index d1e6b3de4..904c4187b 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h +++ b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h @@ -28,6 +28,8 @@ class WebPagePrivate; } namespace WebCore { +class PagePopup; +class PagePopupClient; class ChromeClientBlackBerry : public ChromeClient { public: @@ -137,6 +139,9 @@ public: virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const; virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const; + virtual WebCore::PagePopup* openPagePopup(WebCore::PagePopupClient*, const WebCore::IntRect&); + virtual void closePagePopup(WebCore::PagePopup*); + #if USE(ACCELERATED_COMPOSITING) virtual void attachRootGraphicsLayer(Frame*, GraphicsLayer*); virtual void setNeedsOneShotDrawingSynchronization(); diff --git a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp index 148be1663..b576c0396 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp @@ -20,6 +20,7 @@ #include "config.h" #include "EditorClientBlackBerry.h" +#include "AutofillManager.h" #include "DOMSupport.h" #include "DumpRenderTreeClient.h" #include "EditCommand.h" @@ -511,9 +512,10 @@ void EditorClientBlackBerry::textFieldDidEndEditing(Element*) notImplemented(); } -void EditorClientBlackBerry::textDidChangeInTextField(Element*) +void EditorClientBlackBerry::textDidChangeInTextField(Element* element) { - notImplemented(); + if (HTMLInputElement* inputElement = element->toInputElement()) + m_webPagePrivate->m_autofillManager->didChangeInTextField(inputElement); } bool EditorClientBlackBerry::doTextFieldCommandFromEvent(Element*, KeyboardEvent*) diff --git a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp index b2de76e39..6ef4e4490 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp @@ -19,6 +19,7 @@ #include "config.h" #include "FrameLoaderClientBlackBerry.h" +#include "AutofillManager.h" #include "BackForwardController.h" #include "BackForwardListImpl.h" #include "BackingStoreClient.h" @@ -276,8 +277,10 @@ void FrameLoaderClientBlackBerry::doPendingFragmentScroll() void FrameLoaderClientBlackBerry::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest& request, PassRefPtr<FormState>, const String& frameName) { - if (request.isRequestedByPlugin() && ScriptController::processingUserGesture() && !m_webPagePrivate->m_pluginMayOpenNewTab) + if (ScriptController::processingUserGesture() && !m_webPagePrivate->m_pluginMayOpenNewTab) { (m_frame->loader()->policyChecker()->*function)(PolicyIgnore); + return; + } // A new window can never be a fragment scroll. PolicyAction decision = decidePolicyForExternalLoad(request, false); @@ -702,10 +705,12 @@ void FrameLoaderClientBlackBerry::dispatchDidFailProvisionalLoad(const ResourceE void FrameLoaderClientBlackBerry::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState> formState) { + if (!m_webPagePrivate->m_webSettings->isPrivateBrowsingEnabled()) { + m_webPagePrivate->m_autofillManager->saveTextFields(formState->form()); #if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST) - if (!m_webPagePrivate->m_webSettings->isPrivateBrowsingEnabled()) credentialManager().saveCredentialIfConfirmed(m_webPagePrivate, CredentialTransformData(formState->form())); #endif + } // FIXME: Stub. (m_frame->loader()->policyChecker()->*function)(PolicyUse); @@ -713,12 +718,12 @@ void FrameLoaderClientBlackBerry::dispatchWillSubmitForm(FramePolicyFunction fun void FrameLoaderClientBlackBerry::dispatchWillSendSubmitEvent(PassRefPtr<FormState> prpFormState) { + if (!m_webPagePrivate->m_webSettings->isPrivateBrowsingEnabled()) { + m_webPagePrivate->m_autofillManager->saveTextFields(prpFormState->form()); #if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST) - if (!m_webPagePrivate->m_webSettings->isPrivateBrowsingEnabled()) - credentialManager().saveCredentialIfConfirmed(m_webPagePrivate, CredentialTransformData(prpFormState->form())); -#else - notImplemented(); + credentialManager().saveCredentialIfConfirmed(m_webPagePrivate, CredentialTransformData(prpFormState->form())); #endif + } } PassRefPtr<Frame> FrameLoaderClientBlackBerry::createFrame(const KURL& url, const String& name diff --git a/Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.cpp new file mode 100644 index 000000000..b570c5b35 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.cpp @@ -0,0 +1,254 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include "config.h" + +#include "PagePopupBlackBerry.h" + +#include "ChromeClientBlackBerry.h" +#include "EmptyClients.h" +#include "FrameView.h" +#include "InspectorClientBlackBerry.h" +#include "JSDOMBinding.h" +#include "JSDOMWindowBase.h" +#include "JSObject.h" +#include "JSRetainPtr.h" +#include "Page.h" +#include "PageGroup.h" +#include "PagePopupClient.h" +#include "PlatformMouseEvent.h" +#include "Settings.h" +#include "WebPage.h" +#include "WebPage_p.h" + +#include <JavaScriptCore/API/JSCallbackObject.h> +#include <JavaScriptCore/JSObjectRef.h> +#include <JavaScriptCore/JSStringRef.h> +#include <JavaScriptCore/JSValueRef.h> + +// Fixme: should get the height from runtime. +#define URL_BAR_HEIGHT 70 + +using namespace BlackBerry::Platform::Graphics; +using namespace BlackBerry::WebKit; +namespace WebCore { + +class PagePopupChromeClient : public ChromeClientBlackBerry { +public: + explicit PagePopupChromeClient(WebPagePrivate* webpage, PagePopupBlackBerry* popup) + : ChromeClientBlackBerry(webpage) + , m_popup(popup) + , m_webPage(webpage) + { + } + + virtual void closeWindowSoon() + { + m_popup->closePopup(); + } + + WebPagePrivate* webPage() + { + return m_webPage; + } + + PagePopupBlackBerry* m_popup; + WebPagePrivate* m_webPage; + IntRect m_rect; +}; + +PagePopupBlackBerry::PagePopupBlackBerry(BlackBerry::WebKit::WebPagePrivate* webPage, PagePopupClient* client, const IntRect& rect) + : m_webPagePrivate(webPage) + , m_client(adoptPtr(client)) +{ + m_rect = IntRect(rect.x(), rect.y() - URL_BAR_HEIGHT, client->contentSize().width(), client->contentSize().height()); +} + +PagePopupBlackBerry::~PagePopupBlackBerry() +{ +} + +void PagePopupBlackBerry::sendCreatePopupWebViewRequest() +{ + m_webPagePrivate->client()->createPopupWebView(m_rect); +} + +bool PagePopupBlackBerry::init(WebPage* webpage) +{ + static FrameLoaderClient* emptyFrameLoaderClient = new EmptyFrameLoaderClient; + Page::PageClients pageClients; + m_chromeClient = adoptPtr(new PagePopupChromeClient(webpage->d, this)); + static EditorClient* emptyEditorClient = new EmptyEditorClient; + pageClients.chromeClient = m_chromeClient.get(); + pageClients.editorClient = emptyEditorClient; +#if ENABLE(CONTEXT_MENUS) + static ContextMenuClient* emptyContextMenuClient = new EmptyContextMenuClient; + pageClients.contextMenuClient = emptyContextMenuClient; +#endif +#if ENABLE(DRAG_SUPPORT) + static DragClient* emptyDragClient = new EmptyDragClient; + pageClients.dragClient = emptyDragClient; +#endif +#if ENABLE(INSPECTOR) + static InspectorClient* emptyInspectorClient = new EmptyInspectorClient; + pageClients.inspectorClient = emptyInspectorClient; +#endif + + m_page = adoptPtr(new Page(pageClients)); + m_page->settings()->setScriptEnabled(true); + m_page->settings()->setAllowScriptsToCloseWindows(true); + + RefPtr<Frame> frame = Frame::create(m_page.get(), 0, + emptyFrameLoaderClient); + frame->setView(FrameView::create(frame.get())); + frame->init(); + frame->view()->resize(m_client->contentSize()); + + CString htmlSource = m_client->htmlSource().utf8(); + DocumentWriter* writer = frame->loader()->activeDocumentLoader()->writer(); + m_client->writeDocument(*writer); + + installDomFunction(frame.get()); + + webpage->d->setParentPopup(this); + + return true; +} + +static JSValueRef setValueAndClosePopupCallback(JSContextRef context, + JSObjectRef, JSObjectRef, size_t argumentCount, + const JSValueRef arguments[], JSValueRef*) +{ + JSValueRef jsRetVal = JSValueMakeUndefined(context); + if (argumentCount <= 0) + return jsRetVal; + + JSStringRef string = JSValueToStringCopy(context, arguments[0], 0); + size_t sizeUTF8 = JSStringGetMaximumUTF8CStringSize(string); + WTF::Vector<char> strArgs(sizeUTF8 + 1); + strArgs[sizeUTF8] = 0; + JSStringGetUTF8CString(string, strArgs.data(), sizeUTF8); + JSStringRelease(string); + JSObjectRef popUpObject = JSValueToObject(context, + arguments[argumentCount - 1], 0); + PagePopupClient* client = + reinterpret_cast<PagePopupClient*>(JSObjectGetPrivate(popUpObject)); + + ASSERT(client); + client->setValueAndClosePopup(0, strArgs.data()); + + return jsRetVal; +} + +static void popUpExtensionInitialize(JSContextRef context, JSObjectRef object) +{ + UNUSED_PARAM(context); + UNUSED_PARAM(object); +} + +static void popUpExtensionFinalize(JSObjectRef object) +{ + UNUSED_PARAM(object); +} + +static JSStaticFunction popUpExtensionStaticFunctions[] = +{ +{ 0, 0, 0 }, +{ 0, 0, 0 } +}; + +static JSStaticValue popUpExtensionStaticValues[] = +{ +{ 0, 0, 0, 0 } +}; + +void PagePopupBlackBerry::installDomFunction(Frame* frame) +{ + JSC::JSLock lock(JSC::SilenceAssertionsOnly); + + JSDOMWindow* window = toJSDOMWindow(frame, mainThreadNormalWorld()); + ASSERT(window); + + JSC::ExecState* exec = window->globalExec(); + ASSERT(exec); + + JSContextRef context = ::toRef(exec); + JSObjectRef globalObject = JSContextGetGlobalObject(context); + JSStringRef functionName = JSStringCreateWithUTF8CString( + "setValueAndClosePopup"); + JSObjectRef function = JSObjectMakeFunctionWithCallback(context, + functionName, setValueAndClosePopupCallback); + JSObjectSetProperty(context, globalObject, functionName, function, + kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly, 0); + + // Register client into DOM + JSClassDefinition definition = kJSClassDefinitionEmpty; + definition.staticValues = popUpExtensionStaticValues; + definition.staticFunctions = popUpExtensionStaticFunctions; + definition.initialize = popUpExtensionInitialize; + definition.finalize = popUpExtensionFinalize; + JSClassRef clientClass = JSClassCreate(&definition); + + JSObjectRef clientClassObject = JSObjectMake(context, clientClass, 0); + JSObjectSetPrivate(clientClassObject, reinterpret_cast<void*>(m_client.get())); + + JSC::UString name("popUp"); + + JSC::PutPropertySlot slot; + window->put(window, exec, JSC::Identifier(exec, name), + toJS(clientClassObject), slot); + + JSClassRelease(clientClass); +} + +bool PagePopupBlackBerry::handleMouseEvent(PlatformMouseEvent& event) +{ + if (!m_page->mainFrame() || !m_page->mainFrame()->view()) + return false; + + switch (event.type()) { + case PlatformEvent::MouseMoved: + return m_page->mainFrame()->eventHandler()->handleMouseMoveEvent(event); + case PlatformEvent::MousePressed: + return m_page->mainFrame()->eventHandler()->handleMousePressEvent(event); + case PlatformEvent::MouseReleased: + return m_page->mainFrame()->eventHandler()->handleMouseReleaseEvent(event); + default: + return false; + } +} + +void PagePopupBlackBerry::closePopup() +{ + closeWebPage(); + m_client->didClosePopup(); + m_webPagePrivate->client()->closePopupWebView(); +} + +void PagePopupBlackBerry::closeWebPage() +{ + if (!m_page) + return; + + m_page->setGroupName(String()); + m_page->mainFrame()->loader()->stopAllLoaders(); + m_page->mainFrame()->loader()->stopLoading(UnloadEventPolicyNone); + m_page->mainFrame()->view()->clear(); + m_page.clear(); +} +} + diff --git a/Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.h new file mode 100644 index 000000000..d5c72cee5 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/PagePopupBlackBerry.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef PagePopupBlackBerry_h +#define PagePopupBlackBerry_h + +#include "IntRect.h" +#include "PagePopup.h" + + +namespace BlackBerry { +namespace WebKit { +class WebPage; +class WebPagePrivate; +} +} + +namespace WebCore { +class Frame; +class Page; +class PagePopupChromeClient; +class PagePopupClient; +class PlatformMouseEvent; + +class PagePopupBlackBerry : public PagePopup { +public: + PagePopupBlackBerry(BlackBerry::WebKit::WebPagePrivate*, PagePopupClient*, const IntRect&); + ~PagePopupBlackBerry(); + + void sendCreatePopupWebViewRequest(); + bool init(BlackBerry::WebKit::WebPage*); + void closePopup(); + void installDomFunction(Frame*); + void setRect(); + void closeWebPage(); + + bool handleMouseEvent(PlatformMouseEvent&); + + +private: + BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate; + OwnPtr<PagePopupClient> m_client; + IntRect m_rect; + OwnPtr<WebCore::Page> m_page; + OwnPtr<PagePopupChromeClient> m_chromeClient; + + friend class PagePopupChromeClient; +}; + +} + +#endif // PagePopupBlackBerry_h diff --git a/Source/WebKit/blackberry/WebKitSupport/BackingStoreClient.cpp b/Source/WebKit/blackberry/WebKitSupport/BackingStoreClient.cpp index c7de7716c..e7e4d6539 100644 --- a/Source/WebKit/blackberry/WebKitSupport/BackingStoreClient.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/BackingStoreClient.cpp @@ -168,6 +168,9 @@ IntPoint BackingStoreClient::transformedAbsoluteLocation() const IntPoint BackingStoreClient::scrollPosition() const { ASSERT(m_frame); + if (!m_frame->view()) + return IntPoint(); + return m_frame->view()->scrollPosition() - pointToSize(m_frame->view()->minimumScrollPosition()); } @@ -178,7 +181,10 @@ IntPoint BackingStoreClient::transformedScrollPosition() const void BackingStoreClient::setScrollPosition(const IntPoint& pos) { - ASSERT(m_frame->view()); + ASSERT(m_frame); + if (!m_frame->view()) + return; + if (pos == scrollPosition()) return; @@ -196,7 +202,10 @@ void BackingStoreClient::setScrollPosition(const IntPoint& pos) IntPoint BackingStoreClient::maximumScrollPosition() const { - ASSERT(m_frame->view()); + ASSERT(m_frame); + if (!m_frame->view()) + return IntPoint(); + return m_frame->view()->maximumScrollPosition() - pointToSize(m_frame->view()->minimumScrollPosition()); } @@ -220,7 +229,10 @@ IntSize BackingStoreClient::transformedActualVisibleSize() const IntSize BackingStoreClient::viewportSize() const { - ASSERT(m_frame->view()); + ASSERT(m_frame); + if (!m_frame->view()) + return IntSize(); + if (isMainFrame()) return m_webPage->d->viewportSize(); @@ -229,10 +241,13 @@ IntSize BackingStoreClient::viewportSize() const IntSize BackingStoreClient::transformedViewportSize() const { + ASSERT(m_frame); + if (!m_frame->view()) + return IntSize(); + if (isMainFrame()) return m_webPage->d->transformedViewportSize(); - ASSERT(m_frame->view()); const IntSize untransformedViewportSize = m_frame->view()->visibleContentRect().size(); const FloatPoint transformedBottomRight = m_webPage->d->m_transformationMatrix->mapPoint( FloatPoint(untransformedViewportSize.width(), untransformedViewportSize.height())); @@ -241,7 +256,10 @@ IntSize BackingStoreClient::transformedViewportSize() const IntRect BackingStoreClient::visibleContentsRect() const { - ASSERT(m_frame->view()); + ASSERT(m_frame); + if (!m_frame->view()) + return IntRect(); + IntRect visibleContentRect = m_frame->view()->visibleContentRect(); if (isMainFrame()) return visibleContentRect; @@ -273,7 +291,10 @@ IntRect BackingStoreClient::transformedVisibleContentsRect() const IntSize BackingStoreClient::contentsSize() const { - ASSERT(m_frame->view()); + ASSERT(m_frame); + if (!m_frame->view()) + return IntSize(); + return m_frame->view()->contentsSize(); } diff --git a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp index b65babaee..1d4cbb9a5 100644 --- a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp @@ -955,14 +955,14 @@ void SelectionHandler::caretPositionChanged() // This function should only reach this point if input mode is active. ASSERT(m_webPage->m_inputHandler->isInputMode()); + WebCore::IntPoint frameOffset(m_webPage->frameOffset(m_webPage->focusedOrMainFrame())); + WebCore::IntRect clippingRectForContent(clippingRectForVisibleContent()); if (m_webPage->focusedOrMainFrame()->selection()->selectionType() == VisibleSelection::CaretSelection) { - WebCore::IntPoint frameOffset = m_webPage->frameOffset(m_webPage->focusedOrMainFrame()); - caretLocation = m_webPage->focusedOrMainFrame()->selection()->selection().visibleStart().absoluteCaretBounds(); caretLocation.move(frameOffset.x(), frameOffset.y()); // Clip against the containing frame and node boundaries. - caretLocation.intersect(clippingRectForVisibleContent()); + caretLocation.intersect(clippingRectForContent); } m_caretActive = !caretLocation.isEmpty(); @@ -976,6 +976,19 @@ void SelectionHandler::caretPositionChanged() bool singleLineInput = !m_webPage->m_inputHandler->isMultilineInputMode(); WebCore::IntRect nodeBoundingBox = singleLineInput ? m_webPage->m_inputHandler->boundingBoxForInputField() : WebCore::IntRect(); + if (!nodeBoundingBox.isEmpty()) { + nodeBoundingBox.move(frameOffset.x(), frameOffset.y()); + + // Clip against the containing frame and node boundaries. + nodeBoundingBox.intersect(clippingRectForContent); + + nodeBoundingBox = m_webPage->mapToTransformed(nodeBoundingBox); + m_webPage->clipToTransformedContentsRect(nodeBoundingBox); + } + + DEBUG_SELECTION(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/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index 4b8508c40..b373ff1c0 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,1099 @@ +2012-05-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r116727. + http://trac.webkit.org/changeset/116727 + https://bugs.webkit.org/show_bug.cgi?id=86181 + + Build error on Chromium-Android (Requested by tkent on + #webkit). + + * public/WebMediaPlayer.h: + (WebMediaPlayer): + (WebKit::WebMediaPlayer::enterFullscreen): + (WebKit::WebMediaPlayer::exitFullscreen): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::enterFullscreen): + (WebKit::WebMediaPlayerClientImpl::exitFullscreen): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::enterFullScreenForElement): + +2012-05-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r116731. + http://trac.webkit.org/changeset/116731 + https://bugs.webkit.org/show_bug.cgi?id=86178 + + Build failure on Chromium-mac (Requested by tkent on #webkit). + + * tests/CCLayerTreeHostImplTest.cpp: + (WebKitTests::CCLayerTreeHostImplTest::CCLayerTreeHostImplTest): + (WebKitTests::TEST_F): + * tests/LayerRendererChromiumTest.cpp: + (FakeLayerRendererChromium::FakeLayerRendererChromium): + (LayerRendererChromiumTest::LayerRendererChromiumTest): + (TEST): + +2012-05-10 David Reveman <reveman@chromium.org> + + [Chromium] Move instantiation of texture uploader to LayerRendererChromium. + https://bugs.webkit.org/show_bug.cgi?id=85893 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + (WebKitTests::CCLayerTreeHostImplTest::CCLayerTreeHostImplTest): + (WebKitTests::TEST_F): + * tests/LayerRendererChromiumTest.cpp: + (FakeLayerRendererChromium::FakeLayerRendererChromium): + (LayerRendererChromiumTest::LayerRendererChromiumTest): + (TEST): + +2012-05-10 Min Qin <qinmin@google.com> + + split MediaPlayer::enterFullscreen into 2 seperate functions + https://bugs.webkit.org/show_bug.cgi?id=86052 + + Reviewed by Benjamin Poulain. + + It is confusing that enterFullscreen returns a boolean while exitFullscreen does + not do the same. And ios does not need the return value. + So remove the return value on enterFullscreen and make a seperate canEnterFullscreen() + function for android. + No behavior change, just refactoring. + + * public/WebMediaPlayer.h: + (WebMediaPlayer): + (WebKit::WebMediaPlayer::enterFullscreen): + (WebKit::WebMediaPlayer::canEnterFullscreen): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::enterFullscreen): + (WebKit): + (WebKit::WebMediaPlayerClientImpl::exitFullscreen): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::enterFullScreenForElement): + +2012-05-10 Hajime Morrita <morrita@google.com> + + WebKit should support tab-size. + https://bugs.webkit.org/show_bug.cgi?id=52994 + + Reviewed by Simon Fraser. + + * src/WebTextRun.cpp: + (WebKit::WebTextRun::operator WebCore::TextRun): + +2012-05-10 Kent Tamura <tkent@chromium.org> + + Unreviewed, rolling out r116594. + http://trac.webkit.org/changeset/116594 + https://bugs.webkit.org/show_bug.cgi?id=86013 + + r116594 might have made some composition tests flaky. + + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTestTickAnimationWhileBackgrounded::animateLayers): + (WTF): + (WTF::TEST_F): + +2012-05-10 Jian Li <jianli@chromium.org> + + Unreviewed. Fix chromium build break. + + * src/LocalizedStrings.cpp: + (WebCore::insecurePluginVersionText): + +2012-05-10 Michael Nordman <michaeln@google.com> + + [chromium] DomStorage events handling needs TLC (2) + https://bugs.webkit.org/show_bug.cgi?id=85221 + Alter the WebStorageArea virtual interface such that the mutators no longer + return old values. This is to allow implementations of the interface to operate + more asynchronously. + + Also clean up from the last patch, remove support for the DEPRECATED event + dispatching API. + + Reviewed by Adam Barth. + + * WebKit.gyp: delete three files indicated below + * public/WebStorageArea.h: + (WebKit::WebStorageArea::setItem): no longer returns the old value + (WebKit::WebStorageArea::removeItem): no longer returns the old value + (WebKit::WebStorageArea::clear): no longer returns a bool indicated if something was cleared + * public/WebStorageEventDispatcher.h: removed the DEPRECATED instance methods + * public/WebStorageNamespace.h: removed the DEPRECATED close() method + * public/platform/WebKitPlatformSupport.h: removed the DEPRECATED dispatchStorageEvent() method + * src/StorageAreaProxy.cpp: removed the DEPREACTED storageEvent() method + (WebCore::StorageAreaProxy::setItem): no return value + (WebCore::StorageAreaProxy::removeItem): no return value + (WebCore::StorageAreaProxy::clear): no return value + (WebCore::StorageAreaProxy::dispatchLocalStorageEvent): remove an early return thats no longer needed + (WebCore::findPageWithSessionStorageNamespace): switched to passing pageGroup by ptr value instead of by name + (WebCore::StorageAreaProxy::dispatchSessionStorageEvent): remove an early return thats no longer needed + * src/StorageAreaProxy.h: + (WebCore): + (StorageAreaProxy): + * src/StorageEventDispatcherImpl.cpp: Deleted the file. + * src/StorageEventDispatcherImpl.h: Deleted the file. + * src/WebStorageEventDispatcherImpl.cpp: Deleted the DEPRECATED instance methods. + (WebKit::WebStorageEventDispatcher::dispatchLocalStorageEvent): use WebViewImpl::defaultPageGroup + (WebKit::WebStorageEventDispatcher::dispatchSessionStorageEvent): use WebViewImpl::defaultPageGroup + * src/WebStorageEventDispatcherImpl.h: Deleted the file. + * src/WebViewImpl.cpp: added a static method to retrieve a ptr to the default page group, + (WebKit::WebViewImpl::defaultPageGroup): + * src/WebViewImpl.h: + + +2012-05-10 Anders Carlsson <andersca@apple.com> + + Add insecurePluginVersionText stub here too. + + * src/LocalizedStrings.cpp: + +2012-05-10 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Call addTraceEvent and getTraceCategoryEnabledFlag directly + https://bugs.webkit.org/show_bug.cgi?id=85399 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * src/PlatformSupport.cpp: + (WebCore): + +2012-05-10 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Remove WEBKIT_USING_SKIA ifdefs that are always true + https://bugs.webkit.org/show_bug.cgi?id=86121 + + Reviewed by Adam Barth. + + Chromium always uses Skia now, so this just removes the barriers + around code that was previously #if'd. + + * README: + * src/DragClientImpl.cpp: + (WebKit::DragClientImpl::startDrag): + * src/PageOverlay.cpp: + * src/PlatformSupport.cpp: + (WebCore::PlatformSupport::clipboardWriteImage): + (WebCore::PlatformSupport::paintScrollbarThumb): + * src/WebContentLayerImpl.cpp: + (WebKit::WebContentLayerImpl::paintContents): + * src/WebFontImpl.cpp: + (WebKit::WebFontImpl::drawText): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::printPage): + (WebKit::WebFrameImpl::printPagesWithBoundaries): + * src/WebGraphicsContext3D.cpp: + (WebKit::WebGraphicsContext3D::createGrGLInterface): + * src/WebImageDecoder.cpp: + (WebKit::WebImageDecoder::getFrameAtIndex): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::paint): + (WebKit::WebPluginContainerImpl::printPage): + * src/painting/GraphicsContextBuilder.h: + (WebKit): + +2012-05-10 Tom Sepez <tsepez@chromium.org> + + [Chromium] WebFrameTest.ChromePageNoJavascript isn't catching regressions + https://bugs.webkit.org/show_bug.cgi?id=86046 + + Reviewed by Adam Barth. + + Test both cases for registerURLSchemeAsNotAllowingJavascriptURLs. Also add + a call to layout() to ensure the javascript result is seen. + + * tests/WebFrameTest.cpp: + (WebKit::TEST_F): + (WebKit): + +2012-05-10 Varun Jain <varunjain@google.com> + + [chromium] Trigger context menu for long press gesture + https://bugs.webkit.org/show_bug.cgi?id=85919 + + Reviewed by Adam Barth. + + * src/PageWidgetDelegate.cpp: + (WebKit::PageWidgetDelegate::handleInputEvent): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleGestureEvent): + +2012-05-10 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Remove dead code behind unused WEBKIT_USING_CG + https://bugs.webkit.org/show_bug.cgi?id=86018 + + Reviewed by Adam Barth. + + We never use CoreGraphics as the backend for GraphicsContext in + Chromium, so this is all dead code. + + * README: + * src/PageOverlay.cpp: + * src/WebContentLayerImpl.cpp: + (WebKit::WebContentLayerImpl::paintContents): + * src/WebFontImpl.cpp: + (WebKit::WebFontImpl::drawText): + * src/WebImageDecoder.cpp: + (WebKit::WebImageDecoder::getFrameAtIndex): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::paint): + (WebKit::WebPluginContainerImpl::printPage): + * src/painting/GraphicsContextBuilder.h: + (WebKit): + +2012-05-10 Sam D <dsam2912@gmail.com> + + Web Inspector: rename InspectorBackendStub.js to InspectorBackendCommands.js + https://bugs.webkit.org/show_bug.cgi?id=72306 + + Changed name for InspectorBackendStub.js to InspectorBackendCommands.js + + Reviewed by Yury Semikhatsky. + + * WebKit.gyp: + +2012-05-09 Kent Tamura <tkent@chromium.org> + + [Chromium] Mark CCLayerTreeHostTestSetNeedsCommit2.runMultiThread and + CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity.runMultiThread flaky. + + * tests/CCLayerTreeHostTest.cpp: + +2012-05-09 Dan Alcantara <dfalcantara@chromium.org> + + [chromium] Add ability to override user agent string per-WebFrameClient + https://bugs.webkit.org/show_bug.cgi?id=83959 + + Reviewed by Adam Barth. + + Adds a method that can be used to override the normal user agent in + chromium. Also adds a unit test to check if the override is taking effect. + + * WebKit.gypi: + * public/WebFrameClient.h: + (WebFrameClient): + (WebKit::WebFrameClient::userAgent): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::userAgent): + * tests/FrameLoaderClientImplTest.cpp: Added. + (WebKit): + (TestWebFrameClient): + (WebKit::TestWebFrameClient::setUserAgentOverride): + (FrameLoaderClientImplTest): + (WebKit::FrameLoaderClientImplTest::SetUp): + (WebKit::FrameLoaderClientImplTest::TearDown): + (WebKit::FrameLoaderClientImplTest::setUserAgentOverride): + (WebKit::FrameLoaderClientImplTest::userAgent): + (WebKit::TEST_F): + +2012-05-09 Charlie Reis <creis@chromium.org> + + Add dispatchMessageEventWithOriginCheck to WebFrame + https://bugs.webkit.org/show_bug.cgi?id=85815 + + Reviewed by Adam Barth. + + Tested by WebFrameTest.DispatchMessageEventWithOriginCheck. + Also fixes source frame bug in willCheckAndDispatchMessageEvent. + + * public/WebFrame.h: + (WebFrame): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::willCheckAndDispatchMessageEvent): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::checkAndDispatchMessageEvent): + (WebKit): + * src/WebFrameImpl.h: + (WebFrameImpl): + +2012-05-09 Hironori Bono <hbono@chromium.org> + + Fix a crash in ContextMenuClientImpl::getCustomMenuFromDefaultItems + https://bugs.webkit.org/show_bug.cgi?id=85866 + + Reviewed by Ryosuke Niwa. + + DocumentMarkerController::markersInRange crashes if the input range is NULL. + This change adds a NULL check before getCustomMenuFromDefaultItems() calls this + function to avoid this crash. + + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): Added a NULL check. + +2012-05-09 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r116602. + http://trac.webkit.org/changeset/116602 + https://bugs.webkit.org/show_bug.cgi?id=86057 + + Build error on Windows (Requested by tkent on #webkit). + + * WebKit.gypi: + * public/WebFrameClient.h: + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::userAgent): + * tests/FrameLoaderClientImplTest.cpp: Removed. + +2012-05-09 Kent Tamura <tkent@chromium.org> + + [Chromium] Fix compilation warning on Android. + https://bugs.webkit.org/show_bug.cgi?id=85958 + + * features.gypi: Move ENABLE_MEDIA_CAPTURE=0 to non-Android block. + +2012-05-09 Dan Alcantara <dfalcantara@chromium.org> + + [chromium] Add ability to override user agent string per-WebFrameClient + https://bugs.webkit.org/show_bug.cgi?id=83959 + + Reviewed by Adam Barth. + + Adds a method that can be used to override the normal user agent in + chromium. Also adds a unit test to check if the override is taking effect. + + * WebKit.gypi: + * public/WebFrameClient.h: + (WebFrameClient): + (WebKit::WebFrameClient::userAgent): + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::userAgent): + * tests/FrameLoaderClientImplTest.cpp: Added. + (WebKit): + (TestWebFrameClient): + (WebKit::TestWebFrameClient::setUserAgentOverride): + (FrameLoaderClientImplTest): + (WebKit::FrameLoaderClientImplTest::SetUp): + (WebKit::FrameLoaderClientImplTest::TearDown): + (WebKit::FrameLoaderClientImplTest::setUserAgentOverride): + (WebKit::FrameLoaderClientImplTest::userAgent): + (WebKit::TEST_F): + +2012-05-09 Ian Vollick <vollick@chromium.org> + + [chromium] Ensure animations get ticked at least once when added. + https://bugs.webkit.org/show_bug.cgi?id=86013 + + Reviewed by James Robinson. + + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTestTickAnimationWhileBackgrounded::animateLayers): + (WTF): + +2012-05-09 Adam Barth <abarth@webkit.org> + + Implement HTML Media Capture + https://bugs.webkit.org/show_bug.cgi?id=85958 + + Reviewed by Eric Seidel. + + * features.gypi: + * public/WebFileChooserParams.h: + (WebFileChooserParams): + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::runOpenPanel): + +2012-05-09 Dana Jansens <danakj@chromium.org> + + [chromium] Don't draw when canDraw() is false + https://bugs.webkit.org/show_bug.cgi?id=85829 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + (WebKitTests::CCLayerTreeHostImplTest::CCLayerTreeHostImplTest): + (WebKitTests::TEST_F): + * tests/CCLayerTreeHostTest.cpp: + (WTF): + (CCLayerTreeHostTestCanDrawBlocksDrawing): + (WTF::CCLayerTreeHostTestCanDrawBlocksDrawing::CCLayerTreeHostTestCanDrawBlocksDrawing): + (WTF::CCLayerTreeHostTestCanDrawBlocksDrawing::beginTest): + (WTF::CCLayerTreeHostTestCanDrawBlocksDrawing::commitCompleteOnCCThread): + (WTF::CCLayerTreeHostTestCanDrawBlocksDrawing::drawLayersOnCCThread): + (WTF::CCLayerTreeHostTestCanDrawBlocksDrawing::didCommitAndDrawFrame): + (WTF::CCLayerTreeHostTestCanDrawBlocksDrawing::afterTest): + (WTF::TEST_F): + +2012-05-09 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r116573. + http://trac.webkit.org/changeset/116573 + https://bugs.webkit.org/show_bug.cgi?id=86038 + + Broke the Chromium Mac compile (Requested by ojan_gardening on + #webkit). + + * public/WebPlugin.h: + (WebPlugin): + +2012-05-09 Fady Samuel <fsamuel@chromium.org> + + [Chromium] Expose WebPluginContainer of WebPlugin to embedder + https://bugs.webkit.org/show_bug.cgi?id=85916 + + Reviewed by Darin Fisher. + + The browser plugin needs to access its current guest's WebPluginContainer + so that it can replace the guest with another guest WebPlugin when navigating + across processes. + + * public/WebPlugin.h: + (WebPlugin): + (WebKit::WebPlugin::container): + +2012-05-09 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Move clipboard to Platform.h + https://bugs.webkit.org/show_bug.cgi?id=85758 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * WebKit.gyp: + * public/platform/WebClipboard.h: + * public/platform/WebDragData.h: + * public/platform/WebImage.h: + * public/platform/WebKitPlatformSupport.h: + (WebKit): + (WebKitPlatformSupport): + * src/AssertMatchingEnums.cpp: + * src/DragClientImpl.cpp: + * src/PlatformSupport.cpp: + * src/WebDragData.cpp: + * src/WebImageCG.cpp: + * src/WebImageDecoder.cpp: + * src/WebImageSkia.cpp: + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::copy): + * src/WebViewImpl.cpp: + +2012-05-09 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Remove PlatformSupport::loadPlatformImageResource, call loadResource directly + https://bugs.webkit.org/show_bug.cgi?id=84417 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * src/PlatformSupport.cpp: + (WebCore): + +2012-05-09 Jochen Eisinger <jochen@chromium.org> + + [chromium] remove the obsolete WebFrame::referrerPolicy method + https://bugs.webkit.org/show_bug.cgi?id=86003 + + Reviewed by Adam Barth. + + * public/WebFrame.h: + * src/WebFrameImpl.cpp: + * src/WebFrameImpl.h: + (WebFrameImpl): + +2012-05-09 Jochen Eisinger <jochen@chromium.org> + + [chromium] Check whether an active document loader exists before accessing it + https://bugs.webkit.org/show_bug.cgi?id=85892 + + Reviewed by Eric Seidel. + + Although FrameLoader::loadInSameDocument which invokes this + method does not have a provisional document loader, we're seeing crashes + where the FrameLoader is in provisional state, and thus + activeDocumentLoader returns 0. Lacking any understanding of how this + can happen, we do this check here to avoid crashing. + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchDidNavigateWithinPage): + +2012-05-09 Ian Vollick <vollick@chromium.org> + + [chromium] Add impl-thread support for fill-mode and direction css animation properties + https://bugs.webkit.org/show_bug.cgi?id=77662 + + Reviewed by James Robinson. + + * tests/CCActiveAnimationTest.cpp: + (WebCore::TEST): + (WebCore): + * tests/CCLayerAnimationControllerTest.cpp: + (WebKitTests::TEST): + (WebKitTests): + +2012-05-09 Ojan Vafai <ojan@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-05-09 Marcus Bulach <bulach@chromium.org> + + [chromium] Exposes OrientationChangeEvent. + https://bugs.webkit.org/show_bug.cgi?id=85976 + + Reviewed by Adam Barth. + + This is used by the android port, we need to expose the existing + WebCore API. + + * public/WebFrame.h: + (WebFrame): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::sendOrientationChangeEvent): + (WebKit): + * src/WebFrameImpl.h: + (WebFrameImpl): + +2012-05-09 Dana Jansens <danakj@chromium.org> + + Early-out and avoid any copying when possible for Region operations + https://bugs.webkit.org/show_bug.cgi?id=85260 + + Reviewed by Anders Carlsson. + + * tests/RegionTest.cpp: + (WebCore::TEST): + (WebCore): + +2012-05-09 Tommy Widenflycht <tommyw@google.com> + + [chromium] MediaStream API: Fixing a memory leak in WebUserMediaRequest + https://bugs.webkit.org/show_bug.cgi?id=85992 + + Reviewed by Adam Barth. + + * src/WebUserMediaRequest.cpp: + (WebKit::WebUserMediaRequest::assign): + +2012-05-09 Kent Tamura <tkent@chromium.org> + + [Chromium] Disable WebViewTest.TextInputType because the test is incomplete. + + * tests/WebViewTest.cpp: + +2012-05-09 Kent Tamura <tkent@chromium.org> + + [Chromium] Some of *.runMultiThread tests intermittently crash. + Mark them flaky. + + * tests/CCLayerTreeHostTest.cpp: + +2012-05-09 Oli Lan <olilan@chromium.org> + + Adds date/time input types to WebTextInputType, and adds support for these + to WebViewImpl.textInputType(). + + Adds a new test WebViewTest.TextInputType to test WebViewImpl.textInputType(), + including the new types. + + https://bugs.webkit.org/show_bug.cgi?id=78746 + + Reviewed by Kent Tamura. + + * public/WebTextInputType.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::textInputType): + * tests/WebViewTest.cpp: + (WebViewTest): + (WebKit::WebViewTest::testTextInputType): + (WebKit): + (WebKit::TEST_F): + * tests/data/input_field_date.html: Added. + * tests/data/input_field_datetime.html: Added. + * tests/data/input_field_default.html: Added. + * tests/data/input_field_email.html: Added. + * tests/data/input_field_number.html: Added. + * tests/data/input_field_search.html: Added. + * tests/data/input_field_time.html: Added. + * tests/data/input_field_week.html: Added. + +2012-05-08 Jochen Eisinger <jochen@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-05-08 Dana Jansens <danakj@chromium.org> + + [chromium] Show borders for partial-draw-culled quads to visualize culling behaviour + https://bugs.webkit.org/show_bug.cgi?id=85414 + + Reviewed by Adrienne Walker. + + * tests/CCQuadCullerTest.cpp: + (WebCore::appendQuads): + * tests/MockCCQuadCuller.h: + (WebCore::MockCCQuadCuller::MockCCQuadCuller): + +2012-05-08 Tony Chang <tony@chromium.org> + + [chromium] force ENABLE_REGISTER_PROTOCOL_HANDLER=1 in features.gypi + https://bugs.webkit.org/show_bug.cgi?id=85924 + + Reviewed by Adam Barth. + + This has been enabled for a few months on Chromium trunk so remove the + ability to turn it off via a gyp flag. This simplifies features.gypi. + + * features.gypi: + +2012-05-08 Dana Jansens <danakj@chromium.org> + + [chromium] Reflections with masks should not occlude + https://bugs.webkit.org/show_bug.cgi?id=85927 + + Reviewed by James Robinson. + + * tests/CCOcclusionTrackerTest.cpp: + (WebKitTests::CCOcclusionTrackerTest::TearDown): + (WebKitTests::CCOcclusionTrackerTest::createMaskLayer): + (CCOcclusionTrackerTest): + (WebKitTests::CCOcclusionTrackerTest::setMask): + (CCOcclusionTrackerTestReplicaWithMask): + (WebKitTests::CCOcclusionTrackerTestReplicaWithMask::runMyTest): + (WebKitTests): + +2012-05-08 Dana Jansens <danakj@chromium.org> + + Region reads past end of spans + https://bugs.webkit.org/show_bug.cgi?id=85909 + + Reviewed by Anders Carlsson. + + * tests/RegionTest.cpp: + (WebCore::TEST): + (WebCore): + +2012-05-08 Tony Chang <tony@chromium.org> + + move listener_leak_test to webkit_unit_tests + https://bugs.webkit.org/show_bug.cgi?id=85922 + + Reviewed by Ojan Vafai. + + Porting the test from src/webkit/tools/test_shell/listener_leak_test.cc. + All I did was change the style and use the FrameTestHelper to load the file. + + * WebKit.gyp: Exclude file in components build. + * WebKit.gypi: Add new file. + * tests/ListenerLeakTest.cpp: Added. + (WebKit): + (WebKit::GetProperty): + (WebKit::GetNumObjects): + (ListenerLeakTest): + (WebKit::ListenerLeakTest::ListenerLeakTest): + (WebKit::ListenerLeakTest::RunTest): + (WebKit::TEST_F): + * tests/data/listener/listener_leak1.html: Added. + * tests/data/listener/listener_leak2.html: Added. + +2012-05-08 W. James MacLean <wjmaclean@chromium.org> + + [chromium] Create LinkHighlightLayerChromium class to provide link-highlight preview animations for GraphicsLayerChromium. + https://bugs.webkit.org/show_bug.cgi?id=85084 + + Reviewed by James Robinson. + + * WebKit.gypi: + * tests/LinkHighlightTest.cpp: Added. + (WebCore): + (MockGraphicsLayerClient): + (WebCore::MockGraphicsLayerClient::notifyAnimationStarted): + (WebCore::MockGraphicsLayerClient::notifySyncRequired): + (WebCore::MockGraphicsLayerClient::paintContents): + (WebCore::MockGraphicsLayerClient::showDebugBorders): + (WebCore::MockGraphicsLayerClient::showRepaintCounter): + (WebCore::TEST): + +2012-05-08 Tony Chang <tony@chromium.org> + + [chromium] move event_listener_unittest to webkit_unit_tests + https://bugs.webkit.org/show_bug.cgi?id=85836 + + Reviewed by James Robinson. + + Porting the test from src/webkit/tools/test_shell/event_listener_unittest.cc. + All I did was change the style and use the FrameTestHelper to load the file. + + * WebKit.gyp: Exclude file in components build. + * WebKit.gypi: Add new file. + * tests/EventListenerTest.cpp: Added. + (WebKit): + (TestWebDOMEventListener): + (WebKit::TestWebDOMEventListener::TestWebDOMEventListener): + (WebKit::TestWebDOMEventListener::~TestWebDOMEventListener): + (WebKit::TestWebDOMEventListener::eventCount): + (WebKit::TestWebDOMEventListener::eventAt): + (WebKit::TestWebDOMEventListener::clearEvents): + (WebDOMEventListenerTest): + (WebKit::WebDOMEventListenerTest::WebDOMEventListenerTest): + (WebKit::WebDOMEventListenerTest::SetUp): + (WebKit::WebDOMEventListenerTest::TearDown): + (WebKit::WebDOMEventListenerTest::mainFrame): + (WebKit::WebDOMEventListenerTest::document): + (WebKit::WebDOMEventListenerTest::executeScript): + (WebKit::WebDOMEventListenerTest::GetNodeID): + (WebKit::TEST_F): + * tests/data/listener/mutation_event_listener.html: Added. + +2012-05-07 Kinuko Yasuda <kinuko@chromium.org> + + Unreviewed build fix: didOpenFileSystem hides overloaded virtual function + + * src/WorkerAsyncFileSystemChromium.cpp: + +2012-05-07 Kinuko Yasuda <kinuko@chromium.org> + + Unreviewed build fix: adding missing include. + + * src/AsyncFileSystemChromium.cpp: + +2012-05-07 Kinuko Yasuda <kinuko@chromium.org> + + Support cross-filesystem operations in FileSystem API + https://bugs.webkit.org/show_bug.cgi?id=84135 + + Reviewed by David Levin. + + Currently we pass Entry's fullPath to AsyncFileSystem layer where + we convert the given path to filesystem URL which includes origin and + filesystem type information, but in that way we cannot handle + cross-filesystem operations (e.g. cross-filesystem copy and move) + well since we end up with always attaching the source filesystem's + origin and type information for argument paths. + + This patch does: + - move filesystem-type related code out of AsyncFileSystemChromium.cpp + (moving into DOMFileSystemChromium.cpp) + - change AsyncFileSystemChromium's methods implementation not to take + entry paths but complete filesystem URLs. + + * src/AsyncFileSystemChromium.cpp: + (WebCore::AsyncFileSystemChromium::AsyncFileSystemChromium): + (WebCore::AsyncFileSystemChromium::move): + (WebCore::AsyncFileSystemChromium::copy): + (WebCore::AsyncFileSystemChromium::remove): + (WebCore::AsyncFileSystemChromium::removeRecursively): + (WebCore::AsyncFileSystemChromium::readMetadata): + (WebCore::AsyncFileSystemChromium::createFile): + (WebCore::AsyncFileSystemChromium::createDirectory): + (WebCore::AsyncFileSystemChromium::fileExists): + (WebCore::AsyncFileSystemChromium::directoryExists): + (WebCore::AsyncFileSystemChromium::readDirectory): + (WebCore::AsyncFileSystemChromium::createWriter): + (WebCore::AsyncFileSystemChromium::createSnapshotFileAndReadMetadata): + * src/AsyncFileSystemChromium.h: + (WebCore::AsyncFileSystemChromium::create): + (AsyncFileSystemChromium): + * src/LocalFileSystemChromium.cpp: + (WebCore::openFileSystemHelper): + * src/PlatformSupport.cpp: + (WebCore::PlatformSupport::createAsyncFileSystem): + * src/WebFileSystemCallbacksImpl.cpp: + (WebKit::WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl): + (WebKit::WebFileSystemCallbacksImpl::didOpenFileSystem): + * src/WebFileSystemCallbacksImpl.h: + (WebFileSystemCallbacksImpl): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::createFileSystem): + (WebKit::WebFrameImpl::createFileEntry): + * src/WorkerAsyncFileSystemChromium.cpp: + (WebCore::WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium): + (WebCore::WorkerAsyncFileSystemChromium::move): + (WebCore::WorkerAsyncFileSystemChromium::copy): + (WebCore::WorkerAsyncFileSystemChromium::remove): + (WebCore::WorkerAsyncFileSystemChromium::removeRecursively): + (WebCore::WorkerAsyncFileSystemChromium::readMetadata): + (WebCore::WorkerAsyncFileSystemChromium::createFile): + (WebCore::WorkerAsyncFileSystemChromium::createDirectory): + (WebCore::WorkerAsyncFileSystemChromium::fileExists): + (WebCore::WorkerAsyncFileSystemChromium::directoryExists): + (WebCore::WorkerAsyncFileSystemChromium::readDirectory): + (WebCore::WorkerAsyncFileSystemChromium::createWriter): + (WebCore::WorkerAsyncFileSystemChromium::createSnapshotFileAndReadMetadata): + * src/WorkerAsyncFileSystemChromium.h: + (WebCore::WorkerAsyncFileSystemChromium::create): + (WorkerAsyncFileSystemChromium): + +2012-05-07 Greg Billock <gbillock@google.com> + + [Web Intents] Flagged-off implementation of an intent tag for registration. + https://bugs.webkit.org/show_bug.cgi?id=73039 + + Reviewed by Adam Barth. + + The intent tag allows web pages to mark themselves declaratively as accepting + web intent delivery of particular characteristics (action/type). + See the spec at: + http://dvcs.w3.org/hg/web-intents/raw-file/tip/spec/Overview.html + + * WebKit.gyp: + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::registerIntentService): + * src/FrameLoaderClientImpl.h: + +2012-05-07 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r116375. + http://trac.webkit.org/changeset/116375 + https://bugs.webkit.org/show_bug.cgi?id=85850 + + Build break on Chromium-win and Chromium-mac. (Requested by + tkent on #webkit). + + * WebKit.gyp: + * WebKit.gypi: + * tests/EventListenerTest.cpp: Removed. + * tests/data/listener/mutation_event_listener.html: Removed. + +2012-05-07 Dana Jansens <danakj@chromium.org> + + Region::intersects() and Region::contains() are slow due to copy overhead + https://bugs.webkit.org/show_bug.cgi?id=81076 + + Reviewed by Anders Carlsson. + + * tests/RegionTest.cpp: + (WebCore): + (WebCore::TEST): + +2012-05-07 Tony Chang <tony@chromium.org> + + [chromium] move event_listener_unittest to webkit_unit_tests + https://bugs.webkit.org/show_bug.cgi?id=85836 + + Reviewed by James Robinson. + + Porting the test from src/webkit/tools/test_shell/event_listener_unittest.cc. + All I did was change the style and use the FrameTestHelper to load the file. + + * WebKit.gyp: Exclude file in components build. + * WebKit.gypi: Add new file. + * tests/EventListenerTest.cpp: Added. + (WebKit): + (TestWebDOMEventListener): + (WebKit::TestWebDOMEventListener::TestWebDOMEventListener): + (WebKit::TestWebDOMEventListener::~TestWebDOMEventListener): + (WebKit::TestWebDOMEventListener::eventCount): + (WebKit::TestWebDOMEventListener::eventAt): + (WebKit::TestWebDOMEventListener::clearEvents): + (WebDOMEventListenerTest): + (WebKit::WebDOMEventListenerTest::WebDOMEventListenerTest): + (WebKit::WebDOMEventListenerTest::SetUp): + (WebKit::WebDOMEventListenerTest::TearDown): + (WebKit::WebDOMEventListenerTest::mainFrame): + (WebKit::WebDOMEventListenerTest::document): + (WebKit::WebDOMEventListenerTest::executeScript): + (WebKit::WebDOMEventListenerTest::GetNodeID): + (WebKit::TEST_F): + * tests/data/listener/mutation_event_listener.html: Added. + +2012-05-07 Julien Chaffraix <jchaffraix@webkit.org> + + Refactor windowClipRectForLayer to remove the explicit RenderLayer dependency + https://bugs.webkit.org/show_bug.cgi?id=84090 + + Reviewed by David Hyatt. + + * src/WebPluginContainerImpl.cpp: + Updated after windowClipRectForLayer name and signature change. + +2012-05-07 Dana Jansens <danakj@chromium.org> + + [chromium] Ensure synchronization in threaded unit tests by checking the sourceFrameNumber() to count commits + https://bugs.webkit.org/show_bug.cgi?id=85390 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTestScrollMultipleRedraw::beginCommitOnCCThread): + (WTF::CCLayerTreeHostTestAtomicCommit::commitCompleteOnCCThread): + (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::commitCompleteOnCCThread): + (WTF::CCLayerTreeHostTestScrollChildLayer::beginCommitOnCCThread): + +2012-05-07 Adrienne Walker <enne@google.com> + + [chromium] Allow for asymmetric tile sizes on composited tiled layers + https://bugs.webkit.org/show_bug.cgi?id=85687 + + Reviewed by James Robinson. + + Update tests for new constructor and function args. Add a few more + tests that use non-square tile sizes. + + * tests/TilingDataTest.cpp: + (WebCore::TestTiling::TestTiling): + (WebCore::TEST): + (WebCore): + +2012-05-07 David Reveman <reveman@chromium.org> + + [Chromium] Use GL_CHROMIUM_command_buffer_query to throttle texture uploads. + https://bugs.webkit.org/show_bug.cgi?id=81004 + + Reviewed by Adrienne Walker. + + * WebKit.gypi: + * tests/CCLayerTreeHostImplTest.cpp: + (WebKitTests::TEST_F): + * tests/CCTiledLayerTestCommon.h: + (WebKitTests::FakeTextureUploader::isBusy): + (WebKitTests::FakeTextureUploader::beginUploads): + (WebKitTests::FakeTextureUploader::endUploads): + * tests/Canvas2DLayerChromiumTest.cpp: + * tests/LayerRendererChromiumTest.cpp: + (FakeLayerRendererChromium::FakeLayerRendererChromium): + (LayerRendererChromiumTest::LayerRendererChromiumTest): + (TEST): + * tests/ThrottledTextureUploaderTest.cpp: Added. + (WebKit): + (FakeWebGraphicsContext3DWithQueryTesting): + (WebKit::FakeWebGraphicsContext3DWithQueryTesting::FakeWebGraphicsContext3DWithQueryTesting): + (WebKit::FakeWebGraphicsContext3DWithQueryTesting::getQueryObjectuivEXT): + (WebKit::FakeWebGraphicsContext3DWithQueryTesting::setResultAvailable): + (WebKit::TEST): + * tests/TiledLayerChromiumTest.cpp: + (WTF::TEST): + +2012-05-07 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r116334. + http://trac.webkit.org/changeset/116334 + https://bugs.webkit.org/show_bug.cgi?id=85816 + + Broke the Chromium Win/Mac compile (Requested by + ojan_gardening on #webkit). + + * WebKit.gypi: + * tests/LinkHighlightLayerDelegateTest.cpp: Removed. + +2012-05-07 Mark Pilgrim <pilgrim@chromium.org> + + [Chromium] Move fileSystem to Platform.h + https://bugs.webkit.org/show_bug.cgi?id=85760 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * WebKit.gyp: + * public/platform/WebFileSystem.h: + * public/platform/WebKitPlatformSupport.h: + (WebKit): + (WebKitPlatformSupport): + * src/AssertMatchingEnums.cpp: + * src/AsyncFileSystemChromium.cpp: + (WebCore::AsyncFileSystemChromium::AsyncFileSystemChromium): + * src/LocalFileSystemChromium.cpp: + * src/WebFileSystemCallbacksImpl.cpp: + * src/WebFileSystemCallbacksImpl.h: + * src/WebFrameImpl.cpp: + * src/WebWorkerClientImpl.h: + * src/WorkerAsyncFileSystemChromium.cpp: + * src/WorkerAsyncFileWriterChromium.cpp: + * src/WorkerFileSystemCallbacksBridge.h: + * src/WorkerFileWriterCallbacksBridge.cpp: + (WebKit::WorkerFileWriterCallbacksBridge::initOnMainThread): + +2012-05-07 W. James MacLean <wjmaclean@chromium.org> + + [chromium] Create LinkHighlightLayerChromium class to provide link-highlight preview animations for GraphicsLayerChromium. + https://bugs.webkit.org/show_bug.cgi?id=85084 + + Reviewed by Adrienne Walker. + + * WebKit.gypi: + * tests/LinkHighlightLayerDelegateTest.cpp: Added. + (WebCore): + (MockGraphicsLayerClient): + (WebCore::MockGraphicsLayerClient::notifyAnimationStarted): + (WebCore::MockGraphicsLayerClient::notifySyncRequired): + (WebCore::MockGraphicsLayerClient::paintContents): + (WebCore::MockGraphicsLayerClient::showDebugBorders): + (WebCore::MockGraphicsLayerClient::showRepaintCounter): + (WebCore::TEST): + +2012-05-07 Joshua Bell <jsbell@chromium.org> + + IndexedDB: LevelDB coding for bools is broken + https://bugs.webkit.org/show_bug.cgi?id=85810 + + Reviewed by Tony Chang. + + Added tests for encodeBool/decodeBool. + + * tests/IDBLevelDBCodingTest.cpp: + (IDBLevelDBCoding::TEST): + (IDBLevelDBCoding): + +2012-05-07 Shawn Singh <shawnsingh@chromium.org> + + [chromium] CCMathUtil projectPoint needs to avoid divide-by-zero + https://bugs.webkit.org/show_bug.cgi?id=85560 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostCommonTest.cpp: + (WebKitTests::TEST): + * tests/CCMathUtilTest.cpp: + (WebCore::TEST): + (WebCore): + +2012-05-07 Nat Duca <nduca@chromium.org> + + Unreviewed, rolling out r115525. + http://trac.webkit.org/changeset/115525 + https://bugs.webkit.org/show_bug.cgi?id=66683 + + Too many pages rely on DOMTimeStamp as first argument. + Reverting while we consider next steps. + + * src/PageWidgetDelegate.cpp: + (WebKit::PageWidgetDelegate::animate): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::updateAnimations): + +2012-05-07 Tommy Widenflycht <tommyw@google.com> + + MediaStream API: Allow UserMediaRequest::succeed to take an MediaStreamDescriptor + https://bugs.webkit.org/show_bug.cgi?id=85798 + + Reviewed by Adam Barth. + + Adding another WebUserMediaRequest::requestSucceed function that takes an + WebMediaStreamDescriptor instead of the two WebMediaStreamSource arrays. + + * public/WebUserMediaRequest.h: + (WebKit): + (WebUserMediaRequest): + * src/WebUserMediaRequest.cpp: + (WebKit::WebUserMediaRequest::requestSucceeded): + +2012-05-07 Kinuko Yasuda <kinuko@chromium.org> + + Unreviewed: the same fix in another file for chromium win build. Adding WebCore namespace to FileSystemTypes. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::createFileSystem): + (WebKit::WebFrameImpl::createFileEntry): + +2012-05-07 Kinuko Yasuda <kinuko@chromium.org> + + Not reviewed: chromium win build fix attempt; adding WebCore namespace to ambiguous type name. + + * src/WebFileSystemCallbacksImpl.cpp: + (WebKit::WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl): + 2012-05-06 Kinuko Yasuda <kinuko@chromium.org> Cleanup: Change boolean synchronous flag argument into enum in FileSystem API code diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index 15044b59e..1346d5045 100644 --- a/Source/WebKit/chromium/DEPS +++ b/Source/WebKit/chromium/DEPS @@ -32,7 +32,7 @@ vars = { 'chromium_svn': 'http://src.chromium.org/svn/trunk/src', - 'chromium_rev': '135601' + 'chromium_rev': '136044' } deps = { diff --git a/Source/WebKit/chromium/README b/Source/WebKit/chromium/README index f540d343a..bbb1748bb 100644 --- a/Source/WebKit/chromium/README +++ b/Source/WebKit/chromium/README @@ -35,10 +35,6 @@ DEFINES called by a public inline-defined method should be annotated with WEBKIT_EXPORT. WEBKIT_EXPORT is not used to export whole classes. - WEBKIT_USING_SKIA is defined when using Skia as the graphics library. - - WEBKIT_USING_CG is defined when using CG as the graphics library. - WEBKIT_USING_V8 is defined when using V8 as the JavaScript library. WEBKIT_USING_JSC is defined when using JSC as the JavaScript library. diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp index ea966b1f1..a775f545d 100644 --- a/Source/WebKit/chromium/WebKit.gyp +++ b/Source/WebKit/chromium/WebKit.gyp @@ -299,7 +299,6 @@ 'public/platform/WebBlobData.h', 'public/platform/WebBlobRegistry.h', 'public/platform/WebCanvas.h', - 'public/platform/WebClipboard.h', 'public/platform/WebColor.h', 'public/platform/WebCommon.h', 'public/platform/WebContentLayer.h', @@ -307,9 +306,7 @@ 'public/platform/WebCookie.h', 'public/platform/WebCookieJar.h', 'public/platform/WebData.h', - 'public/platform/WebDragData.h', 'public/platform/WebExternalTextureLayer.h', - 'public/platform/WebFileSystem.h', 'public/platform/WebFloatPoint.h', 'public/platform/WebFloatQuad.h', 'public/platform/WebFloatRect.h', @@ -319,7 +316,6 @@ 'public/platform/WebHTTPBody.h', 'public/platform/WebHTTPHeaderVisitor.h', 'public/platform/WebHTTPLoadInfo.h', - 'public/platform/WebImage.h', 'public/platform/WebKitPlatformSupport.h', 'public/platform/WebLayer.h', 'public/platform/WebLayerTreeView.h', @@ -477,8 +473,6 @@ 'src/SpeechRecognitionClientProxy.h', 'src/StorageAreaProxy.cpp', 'src/StorageAreaProxy.h', - 'src/StorageEventDispatcherImpl.cpp', - 'src/StorageEventDispatcherImpl.h', 'src/StorageInfoChromium.cpp', 'src/StorageNamespaceProxy.cpp', 'src/StorageNamespaceProxy.h', @@ -656,7 +650,6 @@ 'src/WebSpeechRecognitionHandle.cpp', 'src/WebSpeechRecognitionResult.cpp', 'src/WebStorageEventDispatcherImpl.cpp', - 'src/WebStorageEventDispatcherImpl.h', 'src/WebStorageQuotaCallbacksImpl.cpp', 'src/WebStorageQuotaCallbacksImpl.h', 'src/WebSurroundingText.cpp', @@ -736,8 +729,10 @@ # These tests depend on webkit_support and # functions defined only in !WEBKIT_IMPLEMENTATION. 'tests/AssociatedURLLoaderTest.cpp', + 'tests/EventListenerTest.cpp', 'tests/FrameTestHelpers.cpp', 'tests/LevelDBTest.cpp', + 'tests/ListenerLeakTest.cpp', 'tests/PopupMenuTest.cpp', 'tests/RenderTableCellTest.cpp', 'tests/RenderTableRowTest.cpp', @@ -883,7 +878,7 @@ 'files': [ '<@(devtools_files)', '<@(webinspector_files)', - '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendStub.js', + '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendCommands.js', ], 'conditions': [ ['debug_devtools==0', { @@ -1014,7 +1009,7 @@ '<@(_inspector_html)', '<@(devtools_files)', '<@(webinspector_files)', - '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendStub.js', + '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendCommands.js', '<@(_workers_files)', '<@(webinspector_image_files)', '<@(devtools_image_files)', @@ -1077,7 +1072,7 @@ '<@(_input_page)', '<@(webinspector_files)', '<@(devtools_files)', - '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendStub.js' + '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendCommands.js' ], 'search_path': [ '../../WebCore/inspector/front-end', diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index f85d97920..f40951afe 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -97,10 +97,12 @@ 'tests/CompositorFakeWebGraphicsContext3D.h', 'tests/DragImageTest.cpp', 'tests/DrawingBufferChromiumTest.cpp', + 'tests/EventListenerTest.cpp', 'tests/FakeCCLayerTreeHostClient.h', 'tests/FakeGraphicsContext3DTest.cpp', 'tests/FakeWebGraphicsContext3D.h', 'tests/FloatQuadTest.cpp', + 'tests/FrameLoaderClientImplTest.cpp', 'tests/FrameTestHelpers.cpp', 'tests/FrameTestHelpers.h', 'tests/IDBBindingUtilitiesTest.cpp', @@ -113,6 +115,8 @@ 'tests/LayerRendererChromiumTest.cpp', 'tests/LayerTextureUpdaterTest.cpp', 'tests/LevelDBTest.cpp', + 'tests/LinkHighlightTest.cpp', + 'tests/ListenerLeakTest.cpp', 'tests/LocalizedNumberICUTest.cpp', 'tests/MockCCQuadCuller.h', 'tests/PaintAggregatorTest.cpp', @@ -126,7 +130,9 @@ 'tests/RenderTableRowTest.cpp', 'tests/ScrollbarLayerChromiumTest.cpp', 'tests/TextureCopierTest.cpp', + 'tests/TextureLayerChromiumTest.cpp', 'tests/TextureManagerTest.cpp', + 'tests/ThrottledTextureUploaderTest.cpp', 'tests/TiledLayerChromiumTest.cpp', 'tests/TilingDataTest.cpp', 'tests/TreeSynchronizerTest.cpp', diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index 86054fac1..3947a3826 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -55,6 +55,7 @@ 'ENABLE_GEOLOCATION=1', 'ENABLE_GESTURE_EVENTS=1', 'ENABLE_ICONDATABASE=0', + 'ENABLE_IFRAME_SEAMLESS=1', 'ENABLE_INDEXED_DATABASE=1', 'ENABLE_INPUT_SPEECH=1', 'ENABLE_INPUT_TYPE_DATE=1', @@ -84,6 +85,7 @@ 'ENABLE_POINTER_LOCK=1', 'ENABLE_PROGRESS_TAG=1', 'ENABLE_QUOTA=1', + 'ENABLE_REGISTER_PROTOCOL_HANDLER=1', 'ENABLE_REQUEST_ANIMATION_FRAME=1', 'ENABLE_RUBY=1', 'ENABLE_SANDBOX=1', @@ -137,6 +139,7 @@ ['OS=="android"', { 'feature_defines': [ 'ENABLE_CALENDAR_PICKER=0', + 'ENABLE_MEDIA_CAPTURE=1', 'ENABLE_PAGE_POPUP=0', 'ENABLE_WEB_AUDIO=0', 'WTF_USE_NATIVE_FULLSCREEN_VIDEO=1', @@ -144,6 +147,7 @@ }, { 'feature_defines': [ 'ENABLE_CALENDAR_PICKER=1', + 'ENABLE_MEDIA_CAPTURE=0', 'ENABLE_PAGE_POPUP=1', 'ENABLE_WEB_AUDIO=1', ], @@ -174,14 +178,14 @@ 'WTF_USE_WEBAUDIO_FFMPEG=1', ], }], - ['enable_register_protocol_handler==1', { + ['enable_web_intents==1', { 'feature_defines': [ - 'ENABLE_REGISTER_PROTOCOL_HANDLER=1', + 'ENABLE_WEB_INTENTS=1', ], }], - ['enable_web_intents==1', { + ['enable_web_intents_tag==1', { 'feature_defines': [ - 'ENABLE_WEB_INTENTS=1', + 'ENABLE_WEB_INTENTS_TAG=1', ], }], ['OS=="mac"', { diff --git a/Source/WebKit/chromium/public/WebFileChooserParams.h b/Source/WebKit/chromium/public/WebFileChooserParams.h index da462ef98..31e37b55e 100644 --- a/Source/WebKit/chromium/public/WebFileChooserParams.h +++ b/Source/WebKit/chromium/public/WebFileChooserParams.h @@ -62,6 +62,14 @@ struct WebFileChooserParams { // - replacing with other files // before opening a file chooser dialog. WebVector<WebString> selectedFiles; + // See http://www.w3.org/TR/html-media-capture/ for the semantics of the + // capture attribute. This string will either be empty (meaning the feature + // is disabled) or one of the following values: + // - filesystem (default) + // - camera + // - camcorder + // - microphone + WebString capture; WebFileChooserParams() : multiSelect(false) diff --git a/Source/WebKit/chromium/public/WebFrame.h b/Source/WebKit/chromium/public/WebFrame.h index da795ae8d..017cb0de8 100644 --- a/Source/WebKit/chromium/public/WebFrame.h +++ b/Source/WebKit/chromium/public/WebFrame.h @@ -143,9 +143,6 @@ public: // URLs virtual WebVector<WebIconURL> iconURLs(int iconTypes) const = 0; - // The referrer policy of the document associated with this frame. - virtual WebReferrerPolicy referrerPolicy() const = 0; - // Geometry ----------------------------------------------------------- @@ -565,6 +562,13 @@ public: // of matches found during the scoping effort. virtual void resetMatchCount() = 0; + // OrientationChange event --------------------------------------------- + + // Orientation is the interface orientation in degrees. + // Some examples are: + // 0 is straight up; -90 is when the device is rotated 90 clockwise; + // 90 is when rotated counter clockwise. + virtual void sendOrientationChangeEvent(int orientation) = 0; // Events -------------------------------------------------------------- @@ -577,6 +581,9 @@ public: virtual void removeEventListener(const WebString& eventType, WebDOMEventListener*, bool useCapture) = 0; virtual bool dispatchEvent(const WebDOMEvent&) = 0; + virtual void dispatchMessageEventWithOriginCheck( + const WebSecurityOrigin& intendedTargetOrigin, + const WebDOMEvent&) = 0; // Web Intents --------------------------------------------------------- diff --git a/Source/WebKit/chromium/public/WebFrameClient.h b/Source/WebKit/chromium/public/WebFrameClient.h index 9270d1ab9..662c7c1c5 100644 --- a/Source/WebKit/chromium/public/WebFrameClient.h +++ b/Source/WebKit/chromium/public/WebFrameClient.h @@ -397,6 +397,11 @@ public: WebSecurityOrigin target, WebDOMMessageEvent) { return false; } + // Asks the embedder if a specific user agent should be used for the given + // URL. Returns true if it should, along with the user agent. If false, + // WebKitPlatformSupport::userAgent() will be called to provide one. + virtual bool userAgent(const WebURL& url, WebString* userAgent) { return false; } + protected: ~WebFrameClient() { } }; diff --git a/Source/WebKit/chromium/public/WebStorageArea.h b/Source/WebKit/chromium/public/WebStorageArea.h index cb5ee8d36..23b799af1 100644 --- a/Source/WebKit/chromium/public/WebStorageArea.h +++ b/Source/WebKit/chromium/public/WebStorageArea.h @@ -38,9 +38,6 @@ namespace WebKit { class WebURL; -// In WebCore, there's one distinct StorageArea per origin per StorageNamespace. This -// class wraps a StorageArea. All the methods have obvious connections to the spec: -// http://dev.w3.org/html5/webstorage/ class WebStorageArea { public: virtual ~WebStorageArea() { } @@ -63,16 +60,34 @@ public: virtual WebString getItem(const WebString& key) = 0; // Set the value that corresponds to a specific key. Result will either be ResultOK - // or some particular error. The value is NOT set when there's an error. url is the + // or some particular error. The value is NOT set when there's an error. |pageUrl| is the // url that should be used if a storage event fires. - virtual void setItem(const WebString& key, const WebString& newValue, const WebURL&, Result&, WebString& oldValue) = 0; + virtual void setItem(const WebString& key, const WebString& newValue, const WebURL& pageUrl, Result& result) + { + WebString unused; + setItem(key, newValue, pageUrl, result, unused); + } + - // Remove the value associated with a particular key. url is the url that should be used + // Remove the value associated with a particular key. |pageUrl| is the url that should be used // if a storage event fires. - virtual void removeItem(const WebString& key, const WebURL& url, WebString& oldValue) = 0; + virtual void removeItem(const WebString& key, const WebURL& pageUrl) + { + WebString unused; + removeItem(key, pageUrl, unused); + } - // Clear all key/value pairs. url is the url that should be used if a storage event fires. - virtual void clear(const WebURL& url, bool& somethingCleared) = 0; + // Clear all key/value pairs. |pageUrl| is the url that should be used if a storage event fires. + virtual void clear(const WebURL& pageUrl) + { + bool unused; + clear(pageUrl, unused); + } + + // DEPRECATED - being replaced by the async variants above which do not return oldValues or block until completion. + virtual void setItem(const WebString& key, const WebString& newValue, const WebURL&, Result&, WebString& oldValue) = 0; + virtual void removeItem(const WebString& key, const WebURL& pageUrl, WebString& oldValue) = 0; + virtual void clear(const WebURL& pageUrl, bool& somethingCleared) = 0; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/public/WebStorageEventDispatcher.h b/Source/WebKit/chromium/public/WebStorageEventDispatcher.h index 4fbc596b2..b321bf0e9 100644 --- a/Source/WebKit/chromium/public/WebStorageEventDispatcher.h +++ b/Source/WebKit/chromium/public/WebStorageEventDispatcher.h @@ -55,13 +55,8 @@ public: const WebURL& pageUrl, const WebStorageNamespace&, WebStorageArea* sourceAreaInstance, bool originatedInProcess); - // DEPRECATED - The instance methods are going away soon in favor - // of the two static dispatch methods above. - WEBKIT_EXPORT static WebStorageEventDispatcher* create(); - virtual ~WebStorageEventDispatcher() { } - virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue, - const WebString& newValue, const WebString& origin, - const WebURL& url, bool isLocalStorage) = 0; + private: + WebStorageEventDispatcher() { } }; } // namespace WebKit diff --git a/Source/WebKit/chromium/public/WebStorageNamespace.h b/Source/WebKit/chromium/public/WebStorageNamespace.h index 894330717..dd4a8fd44 100644 --- a/Source/WebKit/chromium/public/WebStorageNamespace.h +++ b/Source/WebKit/chromium/public/WebStorageNamespace.h @@ -55,9 +55,6 @@ public: // Returns true of the two instances represent the same storage namespace. virtual bool isSameNamespace(const WebStorageNamespace&) const { return false; } - - // DEPRECATED - virtual void close() { } }; } // namespace WebKit diff --git a/Source/WebKit/chromium/public/WebTextInputType.h b/Source/WebKit/chromium/public/WebTextInputType.h index 428cf5549..b7212758e 100644 --- a/Source/WebKit/chromium/public/WebTextInputType.h +++ b/Source/WebKit/chromium/public/WebTextInputType.h @@ -48,6 +48,12 @@ enum WebTextInputType { WebTextInputTypeNumber, WebTextInputTypeTelephone, WebTextInputTypeURL, + WebTextInputTypeDate, + WebTextInputTypeDateTime, + WebTextInputTypeDateTimeLocal, + WebTextInputTypeMonth, + WebTextInputTypeTime, + WebTextInputTypeWeek, }; } // namespace WebKit diff --git a/Source/WebKit/chromium/public/WebUserMediaRequest.h b/Source/WebKit/chromium/public/WebUserMediaRequest.h index 54b534e7b..54949407f 100644 --- a/Source/WebKit/chromium/public/WebUserMediaRequest.h +++ b/Source/WebKit/chromium/public/WebUserMediaRequest.h @@ -41,6 +41,7 @@ class UserMediaRequest; namespace WebKit { +class WebMediaStreamDescriptor; class WebMediaStreamSource; class WebString; template <typename T> class WebVector; @@ -67,7 +68,11 @@ public: WEBKIT_EXPORT WebSecurityOrigin securityOrigin() const; + // DEPRECATED WEBKIT_EXPORT void requestSucceeded(const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources); + + WEBKIT_EXPORT void requestSucceeded(const WebMediaStreamDescriptor&); + WEBKIT_EXPORT void requestFailed(); #if WEBKIT_IMPLEMENTATION diff --git a/Source/WebKit/chromium/public/platform/WebClipboard.h b/Source/WebKit/chromium/public/platform/WebClipboard.h index 503213952..5f8822336 100644 --- a/Source/WebKit/chromium/public/platform/WebClipboard.h +++ b/Source/WebKit/chromium/public/platform/WebClipboard.h @@ -28,71 +28,4 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebClipboard_h -#define WebClipboard_h - -#include "WebCommon.h" -#include "WebData.h" -#include "WebString.h" -#include "WebVector.h" - -namespace WebKit { - -class WebDragData; -class WebImage; -class WebURL; - -class WebClipboard { -public: - enum Format { - FormatPlainText, - FormatHTML, - FormatBookmark, - FormatSmartPaste - }; - - enum Buffer { - BufferStandard, - // Used on platforms like the X Window System that treat selection - // as a type of clipboard. - BufferSelection, - }; - - // Returns an identifier which can be used to determine whether the data - // contained within the clipboard has changed. - virtual uint64 sequenceNumber(Buffer) { return 0; } - - virtual bool isFormatAvailable(Format, Buffer) { return false; } - - virtual WebVector<WebString> readAvailableTypes( - Buffer, bool* containsFilenames) { return WebVector<WebString>(); } - virtual WebString readPlainText(Buffer) { return WebString(); } - // fragmentStart and fragmentEnd are indexes into the returned markup that - // indicate the start and end of the fragment if the returned markup - // contains additional context. If there is no additional context, - // fragmentStart will be zero and fragmentEnd will be the same as the length - // of the returned markup. - virtual WebString readHTML( - Buffer buffer, WebURL* pageURL, unsigned* fragmentStart, - unsigned* fragmentEnd) { return WebString(); } - virtual WebData readImage(Buffer) { return WebData(); } - virtual WebString readCustomData( - Buffer, const WebString& type) { return WebString(); } - - virtual void writePlainText(const WebString&) { } - virtual void writeHTML( - const WebString& htmlText, const WebURL&, - const WebString& plainText, bool writeSmartPaste) { } - virtual void writeURL( - const WebURL&, const WebString& title) { } - virtual void writeImage( - const WebImage&, const WebURL&, const WebString& title) { } - virtual void writeDataObject(const WebDragData&) { } - -protected: - ~WebClipboard() {} -}; - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/WebClipboard.h" diff --git a/Source/WebKit/chromium/public/platform/WebDragData.h b/Source/WebKit/chromium/public/platform/WebDragData.h index 9666fe4b1..80cada276 100644 --- a/Source/WebKit/chromium/public/platform/WebDragData.h +++ b/Source/WebKit/chromium/public/platform/WebDragData.h @@ -28,96 +28,4 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebDragData_h -#define WebDragData_h - -#include "WebCommon.h" -#include "WebData.h" -#include "WebString.h" -#include "WebURL.h" - -#if WEBKIT_IMPLEMENTATION -namespace WebCore { class ChromiumDataObject; } -namespace WTF { template <typename T> class PassRefPtr; } -#endif - -namespace WebKit { - -class WebDragDataPrivate; -template <typename T> class WebVector; - -// Holds data that may be exchanged through a drag-n-drop operation. It is -// inexpensive to copy a WebDragData object. -class WebDragData { -public: - struct Item { - enum StorageType { - // String data with an associated MIME type. Depending on the MIME type, there may be - // optional metadata attributes as well. - StorageTypeString, - // Stores the name of one file being dragged into the renderer. - StorageTypeFilename, - // An image being dragged out of the renderer. Contains a buffer holding the image data - // as well as the suggested name for saving the image to. - StorageTypeBinaryData, - }; - - StorageType storageType; - - // Only valid when storageType == StorageTypeString. - WebString stringType; - WebString stringData; - - // Only valid when storageType == StorageTypeFilename. - WebString filenameData; - WebString displayNameData; - - // Only valid when storageType == StorageTypeBinaryData. - WebData binaryData; - - // Title associated with a link when stringType == "text/uri-list". - // Filename when storageType == StorageTypeBinaryData. - WebString title; - - // Only valid when stringType == "text/html". - WebURL baseURL; - }; - - ~WebDragData() { reset(); } - - WebDragData() : m_private(0) { } - WebDragData(const WebDragData& d) : m_private(0) { assign(d); } - WebDragData& operator=(const WebDragData& d) - { - assign(d); - return *this; - } - - WEBKIT_EXPORT void initialize(); - WEBKIT_EXPORT void reset(); - WEBKIT_EXPORT void assign(const WebDragData&); - - bool isNull() const { return !m_private; } - - WEBKIT_EXPORT WebVector<Item> items() const; - WEBKIT_EXPORT void setItems(const WebVector<Item>&); - WEBKIT_EXPORT void addItem(const Item&); - - WEBKIT_EXPORT WebString filesystemId() const; - WEBKIT_EXPORT void setFilesystemId(const WebString&); - -#if WEBKIT_IMPLEMENTATION - WebDragData(const WTF::PassRefPtr<WebCore::ChromiumDataObject>&); - WebDragData& operator=(const WTF::PassRefPtr<WebCore::ChromiumDataObject>&); - operator WTF::PassRefPtr<WebCore::ChromiumDataObject>() const; -#endif - -private: - void assign(WebDragDataPrivate*); - void ensureMutable(); - WebDragDataPrivate* m_private; -}; - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/WebDragData.h" diff --git a/Source/WebKit/chromium/public/platform/WebFileSystem.h b/Source/WebKit/chromium/public/platform/WebFileSystem.h index 25afb49f0..ad651e77c 100644 --- a/Source/WebKit/chromium/public/platform/WebFileSystem.h +++ b/Source/WebKit/chromium/public/platform/WebFileSystem.h @@ -28,111 +28,4 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebFileSystem_h -#define WebFileSystem_h - -#include "WebCommon.h" -#include "WebURL.h" - -namespace WebKit { - -// FIXME: Move these classes into platform. -class WebFileSystemCallbacks; -class WebFileWriter; -class WebFileWriterClient; - -class WebFileSystem { -public: - enum Type { - TypeTemporary, - TypePersistent, - - // Indicates an isolated filesystem which only exposes a set of files. - TypeIsolated, - - // Indicates a non-sandboxed filesystem. - TypeExternal, - }; - - // Moves a file or directory at |srcPath| to |destPath|. - // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void move(const WebURL& srcPath, const WebURL& destPath, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Copies a file or directory at |srcPath| to |destPath|. - // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void copy(const WebURL& srcPath, const WebURL& destPath, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Deletes a file or directory at a given |path|. - // It is an error to try to remove a directory that is not empty. - // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void remove(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Deletes a file or directory recursively at a given |path|. - // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void removeRecursively(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Retrieves the metadata information of the file or directory at the given |path|. - // This may not always return the local platform path in remote filesystem cases. - // WebFileSystemCallbacks::didReadMetadata() must be called with a valid metadata when the retrieval is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void readMetadata(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Creates a file at given |path|. - // If the |path| doesn't exist, it creates a new file at |path|. - // If |exclusive| is true, it fails if the |path| already exists. - // If |exclusive| is false, it succeeds if the |path| already exists or - // it has successfully created a new file at |path|. - // - // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void createFile(const WebURL& path, bool exclusive, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Creates a directory at a given |path|. - // If the |path| doesn't exist, it creates a new directory at |path|. - // If |exclusive| is true, it fails if the |path| already exists. - // If |exclusive| is false, it succeeds if the |path| already exists or it has successfully created a new directory at |path|. - // - // WebFileSystemCallbacks::didSucceed() must be called when - // the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void createDirectory(const WebURL& path, bool exclusive, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Checks if a file exists at a given |path|. - // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void fileExists(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Checks if a directory exists at a given |path|. - // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void directoryExists(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Reads directory entries of a given directory at |path|. - // WebFileSystemCallbacks::didReadDirectory() must be called when the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void readDirectory(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - - // Creates a WebFileWriter that can be used to write to the given file. - // This is a fast, synchronous call, and should not stat the filesystem. - virtual WebFileWriter* createFileWriter(const WebURL& path, WebFileWriterClient*) { WEBKIT_ASSERT_NOT_REACHED(); return 0; } - - // Creates a snapshot file for a given file specified by |path| and registers the file with the |blobURL|. It returns the metadata of the created snapshot file. - // The returned metadata should include a local platform path to the snapshot image. - // In local filesystem cases the backend may simply return the metadata of the file itself (as well as readMetadata does), while in remote filesystem case the backend may download the file into a temporary snapshot file and return the metadata of the temporary file. - // The returned metadata is used to create a File object for the |path|. - // The snapshot file is supposed to be deleted when the last reference to the |blobURL| is dropped. - // WebFileSystemCallbacks::didReadMetadata() with the metadata of the snapshot file must be called when the operation is completed successfully. - // WebFileSystemCallbacks::didFail() must be called otherwise. - virtual void createSnapshotFileAndReadMetadata(const WebURL& blobURL, const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } - -protected: - virtual ~WebFileSystem() { } -}; - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/WebFileSystem.h" diff --git a/Source/WebKit/chromium/public/platform/WebImage.h b/Source/WebKit/chromium/public/platform/WebImage.h index bf0e9722e..2593f6b3a 100644 --- a/Source/WebKit/chromium/public/platform/WebImage.h +++ b/Source/WebKit/chromium/public/platform/WebImage.h @@ -28,99 +28,4 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebImage_h -#define WebImage_h - -#include "WebCommon.h" - -#if WEBKIT_USING_SKIA -#include <SkBitmap.h> -#elif WEBKIT_USING_CG -typedef struct CGImage* CGImageRef; -#endif - -#if WEBKIT_IMPLEMENTATION -namespace WebCore { class Image; } -namespace WTF { template <typename T> class PassRefPtr; } -#endif - -namespace WebKit { - -class WebData; -struct WebSize; - -// A container for an ARGB bitmap. -class WebImage { -public: - ~WebImage() { reset(); } - - WebImage() { init(); } - WebImage(const WebImage& image) - { - init(); - assign(image); - } - - WebImage& operator=(const WebImage& image) - { - assign(image); - return *this; - } - - // Decodes the given image data. If the image has multiple frames, - // then the frame whose size is desiredSize is returned. Otherwise, - // the first frame is returned. - WEBKIT_EXPORT static WebImage fromData(const WebData&, const WebSize& desiredSize); - - WEBKIT_EXPORT void reset(); - WEBKIT_EXPORT void assign(const WebImage&); - - WEBKIT_EXPORT bool isNull() const; - WEBKIT_EXPORT WebSize size() const; - -#if WEBKIT_IMPLEMENTATION - WebImage(const WTF::PassRefPtr<WebCore::Image>&); - WebImage& operator=(const WTF::PassRefPtr<WebCore::Image>&); -#endif - -#if WEBKIT_USING_SKIA - WebImage(const SkBitmap& bitmap) : m_bitmap(bitmap) { } - - WebImage& operator=(const SkBitmap& bitmap) - { - m_bitmap = bitmap; - return *this; - } - - SkBitmap& getSkBitmap() { return m_bitmap; } - const SkBitmap& getSkBitmap() const { return m_bitmap; } - -private: - void init() { } - SkBitmap m_bitmap; - -#elif WEBKIT_USING_CG - WebImage(CGImageRef imageRef) - { - init(); - assign(imageRef); - } - - WebImage& operator=(CGImageRef imageRef) - { - assign(imageRef); - return *this; - } - - CGImageRef getCGImageRef() const { return m_imageRef; } - -private: - void init() { m_imageRef = 0; } - WEBKIT_EXPORT void assign(CGImageRef); - CGImageRef m_imageRef; -#endif -}; - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/WebImage.h" diff --git a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h index ca3762dcb..cc5571ea6 100644 --- a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h +++ b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h @@ -51,9 +51,7 @@ namespace WebKit { class WebApplicationCacheHost; // FIXME: Does this belong in platform? class WebApplicationCacheHostClient; // FIXME: Does this belong in platform? class WebBlobRegistry; -class WebClipboard; class WebCookieJar; -class WebFileSystem; class WebFileUtilities; class WebIDBFactory; // FIXME: Does this belong in platform? class WebIDBKey; // FIXME: Does this belong in platform? @@ -69,9 +67,6 @@ class WebWorkerRunLoop; class WebKitPlatformSupport : public Platform { public: // Must return non-null. - virtual WebClipboard* clipboard() { return 0; } - - // Must return non-null. virtual WebFileUtilities* fileUtilities() { return 0; } // May return null if sandbox support is not necessary @@ -93,11 +88,6 @@ public: // Return a LocalStorage namespace that corresponds to the following path. virtual WebStorageNamespace* createLocalStorageNamespace(const WebString& path, unsigned quota) { return 0; } - // DEPRECATED - virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue, - const WebString& newValue, const WebString& origin, - const WebURL& url, bool isLocalStorage) { } - // HTML5 Database ------------------------------------------------------ @@ -177,11 +167,6 @@ public: virtual bool canAccelerate2dCanvas() { return false; } - // FileSystem ---------------------------------------------------------- - - // Must return non-null. - virtual WebFileSystem* fileSystem() { return 0; } - // WebWorker ---------------------------------------------------------- virtual void didStartWorkerRunLoop(const WebWorkerRunLoop&) { } diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index 9f39fc372..322f15046 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -99,12 +99,12 @@ #include "WebTextCheckingResult.h" #include "WebTextCheckingType.h" #include "WebView.h" -#include "platform/WebClipboard.h" -#include "platform/WebFileSystem.h" #include "platform/WebICEOptions.h" #include "platform/WebMediaStreamSource.h" #include "platform/WebPeerConnection00Handler.h" #include "platform/WebPeerConnection00HandlerClient.h" +#include <public/WebClipboard.h> +#include <public/WebFileSystem.h> #include <public/WebFilterOperation.h> #include <public/WebReferrerPolicy.h> #include <wtf/Assertions.h> diff --git a/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp b/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp index d2026d330..eb5021003 100644 --- a/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp @@ -44,6 +44,8 @@ #include "WebKit.h" #include "platform/WebFileSystem.h" #include "platform/WebKitPlatformSupport.h" +#include <public/Platform.h> +#include <public/WebFileSystem.h> #include <wtf/text/CString.h> #include <wtf/text/StringBuilder.h> @@ -51,12 +53,6 @@ namespace WebCore { namespace { -// For isolated filesystem. -const char isolatedPathPrefix[] = "isolated"; - -// For external filesystem. -const char externalPathPrefix[] = "external"; - // Specialized callback class for createSnapshotFileAndReadMetadata. class SnapshotFileCallbacks : public AsyncFileSystemCallbacks { public: @@ -101,149 +97,64 @@ bool AsyncFileSystem::isAvailable() return true; } -// static -bool AsyncFileSystem::crackFileSystemURL(const KURL& url, FileSystemType& type, String& filePath) -{ - if (!url.protocolIs("filesystem")) - return false; - - if (url.innerURL()) { - String typeString = url.innerURL()->path().substring(1); - if (typeString == temporaryPathPrefix) - type = FileSystemTypeTemporary; - else if (typeString == persistentPathPrefix) - type = FileSystemTypePersistent; - else if (typeString == externalPathPrefix) - type = FileSystemTypeExternal; - else - return false; - - filePath = decodeURLEscapeSequences(url.path()); - } - return true; -} - -// static -bool AsyncFileSystem::isValidType(FileSystemType type) -{ - return type == FileSystemTypeTemporary || type == FileSystemTypePersistent || type == FileSystemTypeExternal; -} - -AsyncFileSystemChromium::AsyncFileSystemChromium(FileSystemType type, const KURL& rootURL) - : AsyncFileSystem(type) - , m_webFileSystem(WebKit::webKitPlatformSupport()->fileSystem()) - , m_filesystemRootURL(rootURL) +AsyncFileSystemChromium::AsyncFileSystemChromium() + : m_webFileSystem(WebKit::webKitPlatformSupport()->fileSystem()) { ASSERT(m_webFileSystem); } -// static -String AsyncFileSystemChromium::createIsolatedFileSystemName(const String& storageIdentifier, const String& filesystemId) -{ - StringBuilder filesystemName; - filesystemName.append(storageIdentifier); - filesystemName.append(":"); - filesystemName.append(isolatedPathPrefix); - filesystemName.append("_"); - filesystemName.append(filesystemId); - return filesystemName.toString(); -} - -// static -PassOwnPtr<AsyncFileSystem> AsyncFileSystemChromium::createIsolatedFileSystem(const String& originString, const String& filesystemId) -{ - // The rootURL is used in succeeding filesystem requests sent to the - // chromium and is validated each time in the browser process. - StringBuilder rootURL; - rootURL.append("filesystem:"); - rootURL.append(originString); - rootURL.append("/"); - rootURL.append(isolatedPathPrefix); - rootURL.append("/"); - rootURL.append(filesystemId); - rootURL.append("/"); - - return AsyncFileSystemChromium::create(FileSystemTypeIsolated, KURL(ParsedURLString, rootURL.toString())); -} - AsyncFileSystemChromium::~AsyncFileSystemChromium() { } -KURL AsyncFileSystemChromium::toURL(const String& originString, const String& fullPath) const -{ - ASSERT(!originString.isEmpty()); - if (originString == "null") - return KURL(); - - // For now we don't support toURL for isolated filesystem (until we resolve the isolated filesystem lifetime issue). - if (type() == FileSystemTypeIsolated) - return KURL(); - - if (type() == FileSystemTypeExternal) { - // For external filesystem originString could be different from what we have in m_filesystemRootURL. - StringBuilder result; - result.append("filesystem:"); - result.append(originString); - result.append("/"); - result.append(externalPathPrefix); - result.append(encodeWithURLEscapeSequences(fullPath)); - return KURL(ParsedURLString, result.toString()); - } - - // For regular types we can just call virtualPathToFileSystemURL which appends the fullPath to the m_filesystemRootURL that should look like 'filesystem:<origin>/<typePrefix>'. - ASSERT(SecurityOrigin::create(m_filesystemRootURL)->toString() == originString); - return KURL(ParsedURLString, virtualPathToFileSystemURL(fullPath)); -} - -void AsyncFileSystemChromium::move(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::move(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->move(virtualPathToFileSystemURL(sourcePath), virtualPathToFileSystemURL(destinationPath), new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->move(sourcePath, destinationPath, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } -void AsyncFileSystemChromium::copy(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::copy(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->copy(virtualPathToFileSystemURL(sourcePath), virtualPathToFileSystemURL(destinationPath), new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->copy(sourcePath, destinationPath, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } -void AsyncFileSystemChromium::remove(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::remove(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->remove(virtualPathToFileSystemURL(path), new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->remove(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } -void AsyncFileSystemChromium::removeRecursively(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::removeRecursively(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->removeRecursively(virtualPathToFileSystemURL(path), new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->removeRecursively(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } -void AsyncFileSystemChromium::readMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::readMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->readMetadata(virtualPathToFileSystemURL(path), new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->readMetadata(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } -void AsyncFileSystemChromium::createFile(const String& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::createFile(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->createFile(virtualPathToFileSystemURL(path), exclusive, new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->createFile(path, exclusive, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } -void AsyncFileSystemChromium::createDirectory(const String& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::createDirectory(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->createDirectory(virtualPathToFileSystemURL(path), exclusive, new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->createDirectory(path, exclusive, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } -void AsyncFileSystemChromium::fileExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::fileExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->fileExists(virtualPathToFileSystemURL(path), new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->fileExists(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } -void AsyncFileSystemChromium::directoryExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::directoryExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->directoryExists(virtualPathToFileSystemURL(path), new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->directoryExists(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } -void AsyncFileSystemChromium::readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::readDirectory(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - m_webFileSystem->readDirectory(virtualPathToFileSystemURL(path), new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->readDirectory(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } class FileWriterHelperCallbacks : public WebKit::WebFileSystemCallbacks { @@ -300,28 +211,17 @@ private: OwnPtr<WebCore::AsyncFileSystemCallbacks> m_callbacks; }; -void AsyncFileSystemChromium::createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::createWriter(AsyncFileWriterClient* client, const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - KURL pathAsURL = virtualPathToFileSystemURL(path); - m_webFileSystem->readMetadata(pathAsURL, new FileWriterHelperCallbacks(client, pathAsURL, m_webFileSystem, callbacks)); + m_webFileSystem->readMetadata(path, new FileWriterHelperCallbacks(client, path, m_webFileSystem, callbacks)); } -void AsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void AsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - KURL pathAsURL = virtualPathToFileSystemURL(path); KURL internalBlobURL = BlobURL::createInternalURL(); // This will create a snapshot file and register the file to a blob using the given internalBlobURL. - m_webFileSystem->createSnapshotFileAndReadMetadata(internalBlobURL, pathAsURL, new WebKit::WebFileSystemCallbacksImpl(createSnapshotFileCallback(internalBlobURL, callbacks))); -} - -KURL AsyncFileSystemChromium::virtualPathToFileSystemURL(const String& virtualPath) const -{ - ASSERT(!m_filesystemRootURL.isEmpty()); - KURL url = m_filesystemRootURL; - // Remove the extra leading slash. - url.setPath(url.path() + encodeWithURLEscapeSequences(virtualPath.substring(1))); - return url; + m_webFileSystem->createSnapshotFileAndReadMetadata(internalBlobURL, path, new WebKit::WebFileSystemCallbacksImpl(createSnapshotFileCallback(internalBlobURL, callbacks))); } PassOwnPtr<AsyncFileSystemCallbacks> AsyncFileSystemChromium::createSnapshotFileCallback(const KURL& internalBlobURL, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) const diff --git a/Source/WebKit/chromium/src/AsyncFileSystemChromium.h b/Source/WebKit/chromium/src/AsyncFileSystemChromium.h index e827855a0..7e1af3278 100644 --- a/Source/WebKit/chromium/src/AsyncFileSystemChromium.h +++ b/Source/WebKit/chromium/src/AsyncFileSystemChromium.h @@ -43,45 +43,35 @@ class WebFileSystem; namespace WebCore { class AsyncFileSystemCallbacks; -class KURL; class AsyncFileSystemChromium : public AsyncFileSystem { public: - static PassOwnPtr<AsyncFileSystem> create(FileSystemType type, const KURL& rootURL) + static PassOwnPtr<AsyncFileSystem> create() { - return adoptPtr(new AsyncFileSystemChromium(type, rootURL)); + return adoptPtr(new AsyncFileSystemChromium()); } - static String createIsolatedFileSystemName(const String& storageIdentifier, const String& filesystemId); - static PassOwnPtr<AsyncFileSystem> createIsolatedFileSystem(const String& originString, const String& filesystemId); - virtual ~AsyncFileSystemChromium(); - virtual KURL toURL(const String& originString, const String& fullPath) const; - virtual void move(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void copy(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void remove(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void removeRecursively(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void readMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void createFile(const String& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void createDirectory(const String& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void fileExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void directoryExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void move(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void copy(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void remove(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void removeRecursively(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void readMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createFile(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createDirectory(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void fileExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void directoryExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void readDirectory(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createWriter(AsyncFileWriterClient*, const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createSnapshotFileAndReadMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); protected: - AsyncFileSystemChromium(FileSystemType, const KURL& rootURL); + AsyncFileSystemChromium(); PassOwnPtr<AsyncFileSystemCallbacks> createSnapshotFileCallback(const KURL& internalBlobURL, PassOwnPtr<AsyncFileSystemCallbacks>) const; WebKit::WebFileSystem* m_webFileSystem; - - // Converts a given absolute virtual path to a full origin-qualified FileSystem URL. - KURL virtualPathToFileSystemURL(const String& virtualPath) const; - - KURL m_filesystemRootURL; }; } // namespace WebCore diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index fac80d993..8808e5d6a 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -738,6 +738,11 @@ void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileCh params.selectedFiles = fileChooser->settings().selectedFiles; if (params.selectedFiles.size() > 0) params.initialValue = params.selectedFiles[0]; +#if ENABLE(MEDIA_CAPTURE) + params.capture = fileChooser->settings().capture; +#else + params.capture = WebString(); +#endif WebFileChooserCompletionImpl* chooserCompletion = new WebFileChooserCompletionImpl(fileChooser); diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp index 4491ea1ca..d35eb0e6c 100644 --- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -279,18 +279,20 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( // a mouse on a word, Chrome just needs to find a spelling marker on the word instread of spellchecking it. if (selectedFrame->settings() && selectedFrame->settings()->asynchronousSpellCheckingEnabled()) { RefPtr<Range> range = selectedFrame->selection()->toNormalizedRange(); - Vector<DocumentMarker*> markers = selectedFrame->document()->markers()->markersInRange(range.get(), DocumentMarker::Spelling); - if (!markers.isEmpty()) { - Vector<String> suggestions; - for (size_t i = 0; i < markers.size(); ++i) { - if (!markers[i]->description().isEmpty()) { - Vector<String> descriptions; - markers[i]->description().split('\n', descriptions); - suggestions.append(descriptions); + if (range.get()) { + Vector<DocumentMarker*> markers = selectedFrame->document()->markers()->markersInRange(range.get(), DocumentMarker::Spelling); + if (!markers.isEmpty()) { + Vector<String> suggestions; + for (size_t i = 0; i < markers.size(); ++i) { + if (!markers[i]->description().isEmpty()) { + Vector<String> descriptions; + markers[i]->description().split('\n', descriptions); + suggestions.append(descriptions); + } } + data.dictionarySuggestions = suggestions; + data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame); } - data.dictionarySuggestions = suggestions; - data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame); } } else if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) { data.isSpellCheckingEnabled = true; diff --git a/Source/WebKit/chromium/src/DragClientImpl.cpp b/Source/WebKit/chromium/src/DragClientImpl.cpp index f4b9e160d..afa570611 100644 --- a/Source/WebKit/chromium/src/DragClientImpl.cpp +++ b/Source/WebKit/chromium/src/DragClientImpl.cpp @@ -36,11 +36,12 @@ #include "Frame.h" #include "NativeImageSkia.h" #include "platform/WebCommon.h" -#include "platform/WebDragData.h" #include "platform/WebImage.h" #include "WebViewClient.h" #include "WebViewImpl.h" +#include <public/WebDragData.h> + using namespace WebCore; namespace WebKit { @@ -88,11 +89,7 @@ void DragClientImpl::startDrag(DragImageRef dragImage, WebPoint offsetPoint(offsetSize.width(), offsetSize.height()); m_webView->startDragging( dragData, static_cast<WebDragOperationsMask>(dragOperationMask), -#if WEBKIT_USING_SKIA dragImage ? WebImage(*dragImage) : WebImage(), -#else - dragImage ? WebImage(dragImage) : WebImage(), -#endif offsetPoint); } diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp index abe1e98b4..d0602a9a0 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -68,6 +68,7 @@ #include "WebFrameClient.h" #include "WebFrameImpl.h" #include "WebIntentRequest.h" +#include "WebIntentServiceInfo.h" #include "WebKit.h" #include "WebNode.h" #include "WebPermissionClient.h" @@ -634,8 +635,14 @@ void FrameLoaderClientImpl::dispatchDidNavigateWithinPage() // didStopLoading only when loader is completed so that we don't fire // them for fragment redirection that happens in window.onload handler. // See https://bugs.webkit.org/show_bug.cgi?id=31838 - bool loaderCompleted = - !webView->page()->mainFrame()->loader()->activeDocumentLoader()->isLoadingInAPISense(); + // + // FIXME: Although FrameLoader::loadInSameDocument which invokes this + // method does not have a provisional document loader, we're seeing crashes + // where the FrameLoader is in provisional state, and thus + // activeDocumentLoader returns 0. Lacking any understanding of how this + // can happen, we do this check here to avoid crashing. + FrameLoader* loader = webView->page()->mainFrame()->loader(); + bool loaderCompleted = !(loader->activeDocumentLoader() && loader->activeDocumentLoader()->isLoadingInAPISense()); // Generate didStartLoading if loader is completed. if (webView->client() && loaderCompleted) @@ -1376,6 +1383,10 @@ void FrameLoaderClientImpl::setTitle(const StringWithDirection& title, const KUR String FrameLoaderClientImpl::userAgent(const KURL& url) { + WebString override; + if (m_webFrame->client()->userAgent(WebURL(url), &override)) + return override; + return WebKit::Platform::current()->userAgent(url); } @@ -1591,10 +1602,28 @@ bool FrameLoaderClientImpl::willCheckAndDispatchMessageEvent( if (!m_webFrame->client()) return false; + WebFrame* source = 0; + if (event && event->source() && event->source()->document()) + source = WebFrameImpl::fromFrame(event->source()->document()->frame()); return m_webFrame->client()->willCheckAndDispatchMessageEvent( - m_webFrame, WebSecurityOrigin(target), WebDOMMessageEvent(event)); + source, WebSecurityOrigin(target), WebDOMMessageEvent(event)); } +#if ENABLE(WEB_INTENTS_TAG) +void FrameLoaderClientImpl::registerIntentService( + const String& action, + const String& type, + const KURL& href, + const String& title, + const String& disposition) { + if (!m_webFrame->client()) + return; + + WebIntentServiceInfo service(action, type, href, title, disposition); + m_webFrame->client()->registerIntentService(m_webFrame, service); +} +#endif + #if ENABLE(WEB_INTENTS) void FrameLoaderClientImpl::dispatchIntent(PassRefPtr<WebCore::IntentRequest> intentRequest) { diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h index df7e0f123..ecb20a2fb 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -205,6 +205,13 @@ public: virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext(); virtual bool willCheckAndDispatchMessageEvent(WebCore::SecurityOrigin* target, WebCore::MessageEvent*) const; +#if ENABLE(WEB_INTENTS_TAG) + virtual void registerIntentService(const String& action, + const String& type, + const WebCore::KURL& href, + const String& title, + const String& disposition); +#endif #if ENABLE(WEB_INTENTS) virtual void dispatchIntent(PassRefPtr<WebCore::IntentRequest>) OVERRIDE; #endif diff --git a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp index 5f6d52750..6fded29ff 100644 --- a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp @@ -41,7 +41,6 @@ #include "FileSystemType.h" #include "PlatformString.h" #include "WebFileError.h" -#include "platform/WebFileSystem.h" #include "WebFileSystemCallbacksImpl.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" @@ -51,6 +50,7 @@ #include "WorkerContext.h" #include "WorkerFileSystemCallbacksBridge.h" #include "WorkerThread.h" +#include <public/WebFileSystem.h> #include <wtf/Threading.h> using namespace WebKit; @@ -194,7 +194,7 @@ static void openFileSystemHelper(ScriptExecutionContext* context, FileSystemType if (webView->permissionClient() && !webView->permissionClient()->allowFileSystem(webFrame)) allowed = false; else - webFrame->client()->openFileSystem(webFrame, static_cast<WebFileSystem::Type>(type), size, create == CreateIfNotPresent, new WebFileSystemCallbacksImpl(callbacks, type)); + webFrame->client()->openFileSystem(webFrame, static_cast<WebFileSystem::Type>(type), size, create == CreateIfNotPresent, new WebFileSystemCallbacksImpl(callbacks)); } else { #if ENABLE(WORKERS) WorkerContext* workerContext = static_cast<WorkerContext*>(context); @@ -203,7 +203,7 @@ static void openFileSystemHelper(ScriptExecutionContext* context, FileSystemType if (!allowFileSystemForWorker(webWorker->commonClient())) allowed = false; else - openFileSystemForWorker(webWorker->commonClient(), static_cast<WebFileSystem::Type>(type), size, create == CreateIfNotPresent, new WebFileSystemCallbacksImpl(callbacks, type, context, synchronousType), synchronousType); + openFileSystemForWorker(webWorker->commonClient(), static_cast<WebFileSystem::Type>(type), size, create == CreateIfNotPresent, new WebFileSystemCallbacksImpl(callbacks, context, synchronousType), synchronousType); #else ASSERT_NOT_REACHED(); diff --git a/Source/WebKit/chromium/src/LocalizedStrings.cpp b/Source/WebKit/chromium/src/LocalizedStrings.cpp index 6af49515f..75b3a2847 100644 --- a/Source/WebKit/chromium/src/LocalizedStrings.cpp +++ b/Source/WebKit/chromium/src/LocalizedStrings.cpp @@ -215,6 +215,12 @@ String crashedPluginText() return String("Plug-in Failure"); } +String insecurePluginVersionText() +{ + notImplemented(); + return String(); +} + String multipleFileUploadText(unsigned numberOfFiles) { return query(WebLocalizedString::MultipleFileUploadText, String::number(numberOfFiles)); diff --git a/Source/WebKit/chromium/src/PageOverlay.cpp b/Source/WebKit/chromium/src/PageOverlay.cpp index 5f16d29c2..b5d157a4b 100644 --- a/Source/WebKit/chromium/src/PageOverlay.cpp +++ b/Source/WebKit/chromium/src/PageOverlay.cpp @@ -46,11 +46,7 @@ namespace { WebCanvas* ToWebCanvas(GraphicsContext* gc) { -#if WEBKIT_USING_SKIA return gc->platformContext()->canvas(); -#elif WEBKIT_USING_CG - return gc->platformContext(); -#endif } } // namespace diff --git a/Source/WebKit/chromium/src/PageWidgetDelegate.cpp b/Source/WebKit/chromium/src/PageWidgetDelegate.cpp index 058bae024..cb9e95fc3 100644 --- a/Source/WebKit/chromium/src/PageWidgetDelegate.cpp +++ b/Source/WebKit/chromium/src/PageWidgetDelegate.cpp @@ -59,7 +59,8 @@ void PageWidgetDelegate::animate(Page* page, double monotonicFrameBeginTime) FrameView* view = mainFrameView(page); if (!view) return; - view->serviceScriptedAnimations(monotonicFrameBeginTime); + double timeShift = currentTime() - monotonicallyIncreasingTime(); + view->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(monotonicFrameBeginTime + timeShift)); #endif } @@ -152,6 +153,7 @@ bool PageWidgetDelegate::handleInputEvent(Page* page, PageWidgetEventHandler& ha case WebInputEvent::GestureTap: case WebInputEvent::GestureTapDown: case WebInputEvent::GestureDoubleTap: + case WebInputEvent::GestureLongPress: return handler.handleGestureEvent(*static_cast<const WebGestureEvent*>(&event)); #endif diff --git a/Source/WebKit/chromium/src/PlatformSupport.cpp b/Source/WebKit/chromium/src/PlatformSupport.cpp index de9810dbd..717455688 100644 --- a/Source/WebKit/chromium/src/PlatformSupport.cpp +++ b/Source/WebKit/chromium/src/PlatformSupport.cpp @@ -50,7 +50,6 @@ #include "WebWorkerClientImpl.h" #include "WebWorkerRunLoop.h" #include "platform/WebAudioBus.h" -#include "platform/WebClipboard.h" #include "platform/WebCookie.h" #include "platform/WebCookieJar.h" #include "platform/WebData.h" @@ -81,9 +80,7 @@ #include "platform/android/WebThemeEngine.h" #endif -#if WEBKIT_USING_SKIA #include "NativeImageSkia.h" -#endif #include "AsyncFileSystemChromium.h" #include "BitmapImage.h" @@ -101,6 +98,7 @@ #include "Worker.h" #include "WorkerContextProxy.h" +#include <public/WebClipboard.h> #include <public/WebMimeRegistry.h> #include <wtf/Assertions.h> @@ -224,11 +222,7 @@ void PlatformSupport::clipboardWriteImage(NativeImagePtr image, const KURL& sourceURL, const String& title) { -#if WEBKIT_USING_SKIA WebImage webImage(image->bitmap()); -#else - WebImage webImage(image); -#endif webKitPlatformSupport()->clipboard()->writeImage(webImage, sourceURL, title); } @@ -404,14 +398,9 @@ int PlatformSupport::writeToFile(PlatformFileHandle handle, const char* data, in } #if ENABLE(FILE_SYSTEM) -String PlatformSupport::createIsolatedFileSystemName(const String& storageIdentifier, const String& filesystemId) +PassOwnPtr<AsyncFileSystem> PlatformSupport::createAsyncFileSystem() { - return AsyncFileSystemChromium::createIsolatedFileSystemName(storageIdentifier, filesystemId); -} - -PassOwnPtr<AsyncFileSystem> PlatformSupport::createIsolatedFileSystem(const String& originString, const String& filesystemId) -{ - return AsyncFileSystemChromium::createIsolatedFileSystem(originString, filesystemId); + return AsyncFileSystemChromium::create(); } #endif @@ -558,17 +547,6 @@ NPObject* PlatformSupport::pluginScriptableObject(Widget* widget) // Resources ------------------------------------------------------------------ -PassRefPtr<Image> PlatformSupport::loadPlatformImageResource(const char* name) -{ - const WebData& resource = webKitPlatformSupport()->loadResource(name); - if (resource.isEmpty()) - return Image::nullImage(); - - RefPtr<Image> image = BitmapImage::create(); - image->setData(resource, true); - return image; -} - #if ENABLE(WEB_AUDIO) PassOwnPtr<AudioBus> PlatformSupport::decodeAudioFileData(const char* data, size_t size, double sampleRate) @@ -688,11 +666,7 @@ void PlatformSupport::paintScrollbarThumb( webThemeScrollbarInfo.visibleSize = scrollbarInfo.visibleSize; webThemeScrollbarInfo.totalSize = scrollbarInfo.totalSize; -#if WEBKIT_USING_SKIA WebKit::WebCanvas* webCanvas = gc->platformContext()->canvas(); -#else - WebKit::WebCanvas* webCanvas = gc->platformContext(); -#endif webKitPlatformSupport()->themeEngine()->paintScrollbarThumb( webCanvas, static_cast<WebThemeEngine::State>(state), @@ -811,28 +785,6 @@ void PlatformSupport::paintThemePart( #endif -// Trace Event ---------------------------------------------------------------- - -const unsigned char* PlatformSupport::getTraceCategoryEnabledFlag(const char* categoryName) -{ - return webKitPlatformSupport()->getTraceCategoryEnabledFlag(categoryName); -} -int PlatformSupport::addTraceEvent(char phase, - const unsigned char* categoryEnabledFlag, - const char* name, - unsigned long long id, - int numArgs, - const char** argNames, - const unsigned char* argTypes, - const unsigned long long* argValues, - int thresholdBeginId, - long long threshold, - unsigned char flags) -{ - return webKitPlatformSupport()->addTraceEvent( - phase, categoryEnabledFlag, name, id, numArgs, argNames, argTypes, argValues, thresholdBeginId, threshold, flags); -} - // Visited Links -------------------------------------------------------------- LinkHash PlatformSupport::visitedLinkHash(const UChar* url, unsigned length) diff --git a/Source/WebKit/chromium/src/StorageAreaProxy.cpp b/Source/WebKit/chromium/src/StorageAreaProxy.cpp index 11eb7cec3..00cc4433b 100644 --- a/Source/WebKit/chromium/src/StorageAreaProxy.cpp +++ b/Source/WebKit/chromium/src/StorageAreaProxy.cpp @@ -80,42 +80,29 @@ String StorageAreaProxy::getItem(const String& key, Frame* frame) const return String(); } -String StorageAreaProxy::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame) +void StorageAreaProxy::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame) { - WebKit::WebStorageArea::Result result = WebKit::WebStorageArea::ResultOK; - WebKit::WebString oldValue; if (!canAccessStorage(frame)) ec = QUOTA_EXCEEDED_ERR; else { - m_storageArea->setItem(key, value, frame->document()->url(), result, oldValue); + WebKit::WebStorageArea::Result result = WebKit::WebStorageArea::ResultOK; + m_storageArea->setItem(key, value, frame->document()->url(), result); ec = (result == WebKit::WebStorageArea::ResultOK) ? 0 : QUOTA_EXCEEDED_ERR; - String oldValueString = oldValue; - if (oldValueString != value && result == WebKit::WebStorageArea::ResultOK) - storageEvent(key, oldValue, value, m_storageType, frame->document()->securityOrigin(), frame); } - return oldValue; } -String StorageAreaProxy::removeItem(const String& key, Frame* frame) +void StorageAreaProxy::removeItem(const String& key, Frame* frame) { if (!canAccessStorage(frame)) - return String(); - WebKit::WebString oldValue; - m_storageArea->removeItem(key, frame->document()->url(), oldValue); - if (!oldValue.isNull()) - storageEvent(key, oldValue, String(), m_storageType, frame->document()->securityOrigin(), frame); - return oldValue; + return; + m_storageArea->removeItem(key, frame->document()->url()); } -bool StorageAreaProxy::clear(Frame* frame) +void StorageAreaProxy::clear(Frame* frame) { if (!canAccessStorage(frame)) - return false; - bool clearedSomething; - m_storageArea->clear(frame->document()->url(), clearedSomething); - if (clearedSomething) - storageEvent(String(), String(), String(), m_storageType, frame->document()->securityOrigin(), frame); - return clearedSomething; + return; + m_storageArea->clear(frame->document()->url()); } bool StorageAreaProxy::contains(const String& key, Frame* frame) const @@ -123,54 +110,6 @@ bool StorageAreaProxy::contains(const String& key, Frame* frame) const return !getItem(key, frame).isNull(); } -// FIXME: remove this method and the calls to it from our setters after multi-side patch landing is done. -// Copied from WebCore/storage/StorageEventDispatcher.cpp out of necessity. It's probably best to keep it current. -void StorageAreaProxy::storageEvent(const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Frame* sourceFrame) -{ - Page* page = sourceFrame->page(); - if (!page) - return; - - // We need to copy all relevant frames from every page to a vector since sending the event to one frame might mutate the frame tree - // of any given page in the group or mutate the page group itself. - Vector<RefPtr<Frame> > frames; - if (storageType == SessionStorage) { - // Send events only to our page. - for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin)) - frames.append(frame); - } - - for (unsigned i = 0; i < frames.size(); ++i) { - // FIXME: maybe only raise if the window has an onstorage listener - // attached to avoid creating the Storage instance. - ExceptionCode ec = 0; - Storage* storage = frames[i]->domWindow()->sessionStorage(ec); - if (!ec) - frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage)); - } - } else { - // Send events to every page. - const HashSet<Page*>& pages = page->group().pages(); - HashSet<Page*>::const_iterator end = pages.end(); - for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) { - for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin)) - frames.append(frame); - } - } - - for (unsigned i = 0; i < frames.size(); ++i) { - // FIXME: maybe only raise if the window has an onstorage listener - // attached to avoid creating the Storage instance. - ExceptionCode ec = 0; - Storage* storage = frames[i]->domWindow()->localStorage(ec); - if (!ec) - frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage)); - } - } -} - bool StorageAreaProxy::canAccessStorage(Frame* frame) const { if (!frame->page()) @@ -180,18 +119,10 @@ bool StorageAreaProxy::canAccessStorage(Frame* frame) const return !webView->permissionClient() || webView->permissionClient()->allowStorage(webFrame, m_storageType == LocalStorage); } -void StorageAreaProxy::dispatchLocalStorageEvent(const String& pageGroupName, const String& key, const String& oldValue, const String& newValue, +void StorageAreaProxy::dispatchLocalStorageEvent(PageGroup* pageGroup, const String& key, const String& oldValue, const String& newValue, SecurityOrigin* securityOrigin, const KURL& pageURL, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess) { - // FIXME: Multi-sided patch engineering alert ! - // step 1: this method gets defined and implemented in webkit/webcore with the early return. - // step 2: this method starts getting called by chromium still with the early return. - // step 3: This class's setters are modified to no longer raise SessionStorage - // events for inprocess changes and this early return is removed. - if (originatedInProcess) - return; - - const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroupName)->pages(); + const HashSet<Page*>& pages = pageGroup->pages(); for (HashSet<Page*>::const_iterator it = pages.begin(); it != pages.end(); ++it) { for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) { if (frame->document()->securityOrigin()->equal(securityOrigin) && !isEventSource(frame->domWindow()->optionalLocalStorage(), sourceAreaInstance)) { @@ -205,9 +136,9 @@ void StorageAreaProxy::dispatchLocalStorageEvent(const String& pageGroupName, co } } -static Page* findPageWithSessionStorageNamespace(const String& pageGroupName, const WebKit::WebStorageNamespace& sessionNamespace) +static Page* findPageWithSessionStorageNamespace(PageGroup* pageGroup, const WebKit::WebStorageNamespace& sessionNamespace) { - const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroupName)->pages(); + const HashSet<Page*>& pages = pageGroup->pages(); for (HashSet<Page*>::const_iterator it = pages.begin(); it != pages.end(); ++it) { const bool createIfNeeded = true; StorageNamespaceProxy* proxy = static_cast<StorageNamespaceProxy*>((*it)->sessionStorage(createIfNeeded)); @@ -217,19 +148,11 @@ static Page* findPageWithSessionStorageNamespace(const String& pageGroupName, co return 0; } -void StorageAreaProxy::dispatchSessionStorageEvent(const String& pageGroupName, const String& key, const String& oldValue, const String& newValue, +void StorageAreaProxy::dispatchSessionStorageEvent(PageGroup* pageGroup, const String& key, const String& oldValue, const String& newValue, SecurityOrigin* securityOrigin, const KURL& pageURL, const WebKit::WebStorageNamespace& sessionNamespace, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess) { - // FIXME: Multi-sided patch engineering alert ! - // step 1: this method gets defined and implemented in webkit/webcore with the early return. - // step 2: this method starts getting called by chromium still with the early return. - // step 3: This class's setters are modified to no longer raise SessionStorage - // events for inprocess changes and this early return is removed. - if (originatedInProcess) - return; - - Page* page = findPageWithSessionStorageNamespace(pageGroupName, sessionNamespace); + Page* page = findPageWithSessionStorageNamespace(pageGroup, sessionNamespace); if (!page) return; diff --git a/Source/WebKit/chromium/src/StorageAreaProxy.h b/Source/WebKit/chromium/src/StorageAreaProxy.h index ab2357470..83f2eae17 100644 --- a/Source/WebKit/chromium/src/StorageAreaProxy.h +++ b/Source/WebKit/chromium/src/StorageAreaProxy.h @@ -38,6 +38,7 @@ namespace WebCore { class Frame; class KURL; class Page; +class PageGroup; class SecurityOrigin; class Storage; @@ -50,23 +51,22 @@ public: virtual unsigned length(Frame* sourceFrame) const; virtual String key(unsigned index, Frame* sourceFrame) const; virtual String getItem(const String& key, Frame* sourceFrame) const; - virtual String setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame); - virtual String removeItem(const String& key, Frame* sourceFrame); - virtual bool clear(Frame* sourceFrame); + virtual void setItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame); + virtual void removeItem(const String& key, Frame* sourceFrame); + virtual void clear(Frame* sourceFrame); virtual bool contains(const String& key, Frame* sourceFrame) const; virtual bool disabledByPrivateBrowsingInFrame(const Frame*) const { return false; } static void dispatchLocalStorageEvent( - const String& pageGroupName, const String& key, const String& oldValue, const String& newValue, + PageGroup*, const String& key, const String& oldValue, const String& newValue, SecurityOrigin*, const KURL& pageURL, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess); static void dispatchSessionStorageEvent( - const String& pageGroupName, const String& key, const String& oldValue, const String& newValue, + PageGroup*, const String& key, const String& oldValue, const String& newValue, SecurityOrigin*, const KURL& pageURL, const WebKit::WebStorageNamespace&, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess); private: - void storageEvent(const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Frame* sourceFrame); bool canAccessStorage(Frame*) const; static bool isEventSource(Storage*, WebKit::WebStorageArea* sourceAreaInstance); diff --git a/Source/WebKit/chromium/src/StorageEventDispatcherImpl.cpp b/Source/WebKit/chromium/src/StorageEventDispatcherImpl.cpp deleted file mode 100644 index e948b597c..000000000 --- a/Source/WebKit/chromium/src/StorageEventDispatcherImpl.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "StorageEventDispatcherImpl.h" - -#include "DOMWindow.h" -#include "Document.h" -#include "EventNames.h" -#include "Frame.h" -#include "KURL.h" -#include "Page.h" -#include "PageGroup.h" -#include "SecurityOrigin.h" -#include "StorageEvent.h" - -// FIXME: delete this almost obsolete file soon - -namespace WebCore { - -StorageEventDispatcherImpl::StorageEventDispatcherImpl(const String& groupName) - : m_pageGroup(PageGroup::pageGroup(groupName)) -{ - ASSERT(m_pageGroup); -} - -void StorageEventDispatcherImpl::dispatchStorageEvent(const String& key, const String& oldValue, - const String& newValue, SecurityOrigin* securityOrigin, - const KURL& url, StorageType storageType) -{ - // FIXME: Implement - if (storageType == SessionStorage) - return; - - // We need to copy all relevant frames from every page to a vector since sending the event to one frame might mutate the frame tree - // of any given page in the group or mutate the page group itself. - Vector<RefPtr<Frame> > frames; - - const HashSet<Page*>& pages = m_pageGroup->pages(); - HashSet<Page*>::const_iterator end = pages.end(); - for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) { - for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - if (frame->document()->securityOrigin()->equal(securityOrigin)) - frames.append(frame); - } - } - - for (unsigned i = 0; i < frames.size(); ++i) { - ExceptionCode ec = 0; - Storage* storage = frames[i]->domWindow()->localStorage(ec); - if (!ec) - frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, url, storage)); - } -} - -} // namespace WebCore diff --git a/Source/WebKit/chromium/src/StorageEventDispatcherImpl.h b/Source/WebKit/chromium/src/StorageEventDispatcherImpl.h deleted file mode 100644 index d3433851f..000000000 --- a/Source/WebKit/chromium/src/StorageEventDispatcherImpl.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef StorageEventDispatcherImpl_h -#define StorageEventDispatcherImpl_h - -#include "PlatformString.h" -#include "StorageArea.h" - -namespace WebCore { - -class KURL; -class PageGroup; -class SecurityOrigin; - -class StorageEventDispatcherImpl { -public: - StorageEventDispatcherImpl(const String& groupName); - - void dispatchStorageEvent(const String& key, const String& oldValue, - const String& newValue, SecurityOrigin*, - const KURL&, StorageType); - -private: - PageGroup* m_pageGroup; -}; - -} // namespace WebCore - -#endif // StorageEventDispatcherImpl_h diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp index 4f64d5471..4d476095d 100644 --- a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp @@ -30,9 +30,7 @@ #include "platform/WebRect.h" #include "GraphicsContext.h" #include "platform/WebCanvas.h" -#if WEBKIT_USING_SKIA #include "PlatformContextSkia.h" -#endif using namespace WebCore; @@ -64,11 +62,7 @@ void WebContentLayerImpl::paintContents(GraphicsContext& gc, const IntRect& clip { if (!m_contentClient) return; -#if WEBKIT_USING_SKIA WebCanvas* canvas = gc.platformContext()->canvas(); -#elif WEBKIT_USING_CG - WebCanvas* canvas = gc.platformContext(); -#endif m_contentClient->paintContents(canvas, WebRect(clip)); } diff --git a/Source/WebKit/chromium/src/WebDragData.cpp b/Source/WebKit/chromium/src/WebDragData.cpp index 61d86a388..f9846efd8 100644 --- a/Source/WebKit/chromium/src/WebDragData.cpp +++ b/Source/WebKit/chromium/src/WebDragData.cpp @@ -29,7 +29,6 @@ */ #include "config.h" -#include "platform/WebDragData.h" #include "ChromiumDataObject.h" #include "ClipboardMimeTypes.h" @@ -40,6 +39,7 @@ #include "platform/WebURL.h" #include "platform/WebVector.h" +#include <public/WebDragData.h> #include <wtf/HashMap.h> #include <wtf/PassRefPtr.h> diff --git a/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp b/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp index c110e7c22..06809e54b 100644 --- a/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp +++ b/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp @@ -37,19 +37,18 @@ #include "FileMetadata.h" #include "ScriptExecutionContext.h" #include "WebFileInfo.h" -#include "platform/WebFileSystem.h" #include "WebFileSystemEntry.h" #include "platform/WebString.h" #include "WorkerAsyncFileSystemChromium.h" +#include <public/WebFileSystem.h> #include <wtf/Vector.h> using namespace WebCore; namespace WebKit { -WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemType type, WebCore::ScriptExecutionContext* context, FileSystemSynchronousType synchronousType) +WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSystemCallbacks> callbacks, ScriptExecutionContext* context, FileSystemSynchronousType synchronousType) : m_callbacks(callbacks) - , m_type(type) , m_context(context) , m_synchronousType(synchronousType) { @@ -92,11 +91,11 @@ void WebFileSystemCallbacksImpl::didOpenFileSystem(const WebString& name, const #if ENABLE(WORKERS) if (m_context && m_context->isWorkerContext()) { - m_callbacks->didOpenFileSystem(name, WorkerAsyncFileSystemChromium::create(m_context, m_type, rootURL, m_synchronousType)); + m_callbacks->didOpenFileSystem(name, rootURL, WorkerAsyncFileSystemChromium::create(m_context, m_synchronousType)); return; } #endif - m_callbacks->didOpenFileSystem(name, AsyncFileSystemChromium::create(m_type, rootURL)); + m_callbacks->didOpenFileSystem(name, rootURL, AsyncFileSystemChromium::create()); } void WebFileSystemCallbacksImpl::didFail(WebFileError error) diff --git a/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h b/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h index 76e8cdf8f..e5f04081f 100644 --- a/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h +++ b/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h @@ -33,8 +33,8 @@ #include "FileSystemType.h" #include "WebFileSystemCallbacks.h" -#include "platform/WebFileSystem.h" #include "platform/WebVector.h" +#include <public/WebFileSystem.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -52,7 +52,7 @@ class WebURL; class WebFileSystemCallbacksImpl : public WebFileSystemCallbacks { public: - WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, WebCore::FileSystemType = WebCore::FileSystemTypeTemporary, WebCore::ScriptExecutionContext* = 0, WebCore::FileSystemSynchronousType = WebCore::AsynchronousFileSystem); + WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, WebCore::ScriptExecutionContext* = 0, WebCore::FileSystemSynchronousType = WebCore::AsynchronousFileSystem); virtual ~WebFileSystemCallbacksImpl(); virtual void didSucceed(); @@ -64,9 +64,6 @@ public: private: OwnPtr<WebCore::AsyncFileSystemCallbacks> m_callbacks; - // Used for openFileSystem callbacks. - WebCore::FileSystemType m_type; - // Used for worker's openFileSystem callbacks. WebCore::ScriptExecutionContext* m_context; WebCore::FileSystemSynchronousType m_synchronousType; diff --git a/Source/WebKit/chromium/src/WebFontImpl.cpp b/Source/WebKit/chromium/src/WebFontImpl.cpp index f6cf39dbe..8a05aed84 100644 --- a/Source/WebKit/chromium/src/WebFontImpl.cpp +++ b/Source/WebKit/chromium/src/WebFontImpl.cpp @@ -99,12 +99,7 @@ void WebFontImpl::drawText(WebCanvas* canvas, const WebTextRun& run, const WebFl GraphicsContextBuilder builder(canvas); GraphicsContext& gc = builder.context(); -#if WEBKIT_USING_SKIA gc.platformContext()->setDrawingToImageBuffer(!canvasIsOpaque); -#elif WEBKIT_USING_CG - // FIXME hook canvasIsOpaque up to the platform-specific indicators for - // whether subpixel AA can be used for this draw. -#endif gc.save(); gc.setFillColor(color, ColorSpaceDeviceRGB); diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index d0e6fe238..6cccb9316 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -122,6 +122,7 @@ #include "ResourceHandle.h" #include "ResourceRequest.h" #include "SchemeRegistry.h" +#include "ScriptCallStack.h" #include "ScriptController.h" #include "ScriptSourceCode.h" #include "ScriptValue.h" @@ -178,7 +179,7 @@ #include "V8DirectoryEntry.h" #include "V8DOMFileSystem.h" #include "V8FileEntry.h" -#include "platform/WebFileSystem.h" +#include <public/WebFileSystem.h> #endif using namespace WebCore; @@ -595,11 +596,6 @@ WebVector<WebIconURL> WebFrameImpl::iconURLs(int iconTypes) const return WebVector<WebIconURL>(); } -WebReferrerPolicy WebFrameImpl::referrerPolicy() const -{ - return static_cast<WebReferrerPolicy>(m_frame->document()->referrerPolicy()); -} - WebSize WebFrameImpl::scrollOffset() const { FrameView* view = frameView(); @@ -939,7 +935,7 @@ v8::Handle<v8::Value> WebFrameImpl::createFileSystem(WebFileSystem::Type type, const WebString& name, const WebString& path) { - return toV8(DOMFileSystem::create(frame()->document(), name, AsyncFileSystemChromium::create(static_cast<FileSystemType>(type), KURL(ParsedURLString, path.utf8().data())))); + return toV8(DOMFileSystem::create(frame()->document(), name, static_cast<WebCore::FileSystemType>(type), KURL(ParsedURLString, path.utf8().data()), AsyncFileSystemChromium::create())); } v8::Handle<v8::Value> WebFrameImpl::createFileEntry(WebFileSystem::Type type, @@ -948,7 +944,7 @@ v8::Handle<v8::Value> WebFrameImpl::createFileEntry(WebFileSystem::Type type, const WebString& filePath, bool isDirectory) { - RefPtr<DOMFileSystemBase> fileSystem = DOMFileSystem::create(frame()->document(), fileSystemName, AsyncFileSystemChromium::create(static_cast<FileSystemType>(type), KURL(ParsedURLString, fileSystemPath.utf8().data()))); + RefPtr<DOMFileSystemBase> fileSystem = DOMFileSystem::create(frame()->document(), fileSystemName, static_cast<WebCore::FileSystemType>(type), KURL(ParsedURLString, fileSystemPath.utf8().data()), AsyncFileSystemChromium::create()); if (isDirectory) return toV8(DirectoryEntry::create(fileSystem, filePath)); return toV8(FileEntry::create(fileSystem, filePath)); @@ -1497,9 +1493,7 @@ float WebFrameImpl::printPage(int page, WebCanvas* canvas) GraphicsContextBuilder builder(canvas); GraphicsContext& gc = builder.context(); -#if WEBKIT_USING_SKIA gc.platformContext()->setPrinting(true); -#endif return m_printContext->spoolPage(gc, page); } @@ -1865,6 +1859,14 @@ void WebFrameImpl::handleIntentFailure(int intentIdentifier, const WebString& re { } +void WebFrameImpl::sendOrientationChangeEvent(int orientation) +{ +#if ENABLE(ORIENTATION_EVENTS) + if (m_frame) + m_frame->sendOrientationChangeEvent(orientation); +#endif +} + void WebFrameImpl::addEventListener(const WebString& eventType, WebDOMEventListener* listener, bool useCapture) { DOMWindow* window = m_frame->domWindow(); @@ -1890,6 +1892,13 @@ bool WebFrameImpl::dispatchEvent(const WebDOMEvent& event) return m_frame->domWindow()->dispatchEvent(event); } +void WebFrameImpl::dispatchMessageEventWithOriginCheck(const WebSecurityOrigin& intendedTargetOrigin, const WebDOMEvent& event) +{ + ASSERT(!event.isNull()); + // Pass an empty call stack, since we don't have the one from the other process. + m_frame->domWindow()->dispatchMessageEventWithOriginCheck(intendedTargetOrigin.get(), event, 0); +} + WebString WebFrameImpl::contentAsText(size_t maxChars) const { if (!m_frame) @@ -1960,9 +1969,7 @@ void WebFrameImpl::printPagesWithBoundaries(WebCanvas* canvas, const WebSize& pa GraphicsContextBuilder builder(canvas); GraphicsContext& graphicsContext = builder.context(); -#if WEBKIT_USING_SKIA graphicsContext.platformContext()->setPrinting(true); -#endif m_printContext->spoolAllPagesWithBoundaries(graphicsContext, FloatSize(pageSizeInPixels.width, pageSizeInPixels.height)); diff --git a/Source/WebKit/chromium/src/WebFrameImpl.h b/Source/WebKit/chromium/src/WebFrameImpl.h index c3acc1afb..389946d05 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.h +++ b/Source/WebKit/chromium/src/WebFrameImpl.h @@ -72,7 +72,6 @@ public: virtual void setName(const WebString&); virtual long long identifier() const; virtual WebVector<WebIconURL> iconURLs(int iconTypes) const; - virtual WebReferrerPolicy referrerPolicy() const; virtual WebSize scrollOffset() const; virtual void setScrollOffset(const WebSize&); virtual WebSize minimumScrollOffset() const; @@ -208,11 +207,16 @@ public: virtual void handleIntentResult(int, const WebString&); virtual void handleIntentFailure(int, const WebString&); + virtual void sendOrientationChangeEvent(int orientation); + virtual void addEventListener(const WebString& eventType, WebDOMEventListener*, bool useCapture); virtual void removeEventListener(const WebString& eventType, WebDOMEventListener*, bool useCapture); virtual bool dispatchEvent(const WebDOMEvent&); + virtual void dispatchMessageEventWithOriginCheck( + const WebSecurityOrigin& intendedTargetOrigin, + const WebDOMEvent&); virtual WebString contentAsText(size_t maxChars) const; virtual WebString contentAsMarkup() const; diff --git a/Source/WebKit/chromium/src/WebGraphicsContext3D.cpp b/Source/WebKit/chromium/src/WebGraphicsContext3D.cpp index 51fbfb70d..f9e051852 100644 --- a/Source/WebKit/chromium/src/WebGraphicsContext3D.cpp +++ b/Source/WebKit/chromium/src/WebGraphicsContext3D.cpp @@ -30,8 +30,6 @@ namespace WebKit { -#if WEBKIT_USING_SKIA - namespace { void bindWebGraphicsContext3DGLContextCallback(const GrGLInterface* interface) { @@ -49,6 +47,4 @@ GrGLInterface* WebGraphicsContext3D::createGrGLInterface() return interface; } -#endif - } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebImageCG.cpp b/Source/WebKit/chromium/src/WebImageCG.cpp index 0f2c0c473..242a68304 100644 --- a/Source/WebKit/chromium/src/WebImageCG.cpp +++ b/Source/WebKit/chromium/src/WebImageCG.cpp @@ -29,7 +29,6 @@ */ #include "config.h" -#include "platform/WebImage.h" #include "Image.h" #include "ImageSource.h" @@ -40,6 +39,7 @@ #include <CoreGraphics/CGImage.h> +#include <public/WebImage.h> #include <wtf/PassRefPtr.h> #include <wtf/RetainPtr.h> diff --git a/Source/WebKit/chromium/src/WebImageDecoder.cpp b/Source/WebKit/chromium/src/WebImageDecoder.cpp index 0588314ec..ad0a67e51 100644 --- a/Source/WebKit/chromium/src/WebImageDecoder.cpp +++ b/Source/WebKit/chromium/src/WebImageDecoder.cpp @@ -35,13 +35,12 @@ #include "ICOImageDecoder.h" #include "SharedBuffer.h" #include "platform/WebData.h" -#include "platform/WebImage.h" #include "platform/WebSize.h" -#if WEBKIT_USING_SKIA +#include <public/WebImage.h> + #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> -#endif #include <wtf/PassRefPtr.h> @@ -111,13 +110,8 @@ WebImage WebImageDecoder::getFrameAtIndex(int index = 0) const ImageFrame* const frameBuffer = m_private->frameBufferAtIndex(index); if (!frameBuffer) return WebImage(); -#if WEBKIT_USING_SKIA OwnPtr<NativeImageSkia> image = adoptPtr(frameBuffer->asNewNativeImage()); return WebImage(image->bitmap()); -#elif WEBKIT_USING_CG - // FIXME: Implement CG side of this. - return WebImage(frameBuffer->asNewNativeImage()); -#endif } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebImageSkia.cpp b/Source/WebKit/chromium/src/WebImageSkia.cpp index 9755f3802..36dabac3e 100644 --- a/Source/WebKit/chromium/src/WebImageSkia.cpp +++ b/Source/WebKit/chromium/src/WebImageSkia.cpp @@ -29,7 +29,6 @@ */ #include "config.h" -#include "platform/WebImage.h" #include "Image.h" #include "ImageSource.h" @@ -39,6 +38,7 @@ #include "platform/WebData.h" #include "platform/WebSize.h" +#include <public/WebImage.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp index a4a585b96..6ee01efdd 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -34,14 +34,12 @@ #include "Chrome.h" #include "ChromeClientImpl.h" #include "ScrollbarGroup.h" -#include "platform/WebClipboard.h" #include "WebCursorInfo.h" #include "WebDataSourceImpl.h" #include "WebElement.h" #include "WebInputEvent.h" #include "WebInputEventConversion.h" #include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" #include "WebPlugin.h" #include "platform/WebRect.h" #include "platform/WebString.h" @@ -75,14 +73,14 @@ #include "ScrollbarTheme.h" #include "UserGestureIndicator.h" #include "WheelEvent.h" +#include <public/Platform.h> +#include <public/WebClipboard.h> #if ENABLE(GESTURE_EVENTS) #include "PlatformGestureEvent.h" #endif -#if WEBKIT_USING_SKIA #include "PlatformContextSkia.h" -#endif using namespace WebCore; @@ -126,11 +124,7 @@ void WebPluginContainerImpl::paint(GraphicsContext* gc, const IntRect& damageRec IntPoint origin = view->windowToContents(IntPoint(0, 0)); gc->translate(static_cast<float>(origin.x()), static_cast<float>(origin.y())); -#if WEBKIT_USING_SKIA WebCanvas* canvas = gc->platformContext()->canvas(); -#elif WEBKIT_USING_CG - WebCanvas* canvas = gc->platformContext(); -#endif IntRect windowRect = IntRect(view->contentsToWindow(damageRect.location()), damageRect.size()); @@ -259,11 +253,7 @@ bool WebPluginContainerImpl::printPage(int pageNumber, WebCore::GraphicsContext* gc) { gc->save(); -#if WEBKIT_USING_SKIA WebCanvas* canvas = gc->platformContext()->canvas(); -#elif WEBKIT_USING_CG - WebCanvas* canvas = gc->platformContext(); -#endif bool ret = m_webPlugin->printPage(pageNumber, canvas); gc->restore(); return ret; @@ -279,7 +269,7 @@ void WebPluginContainerImpl::copy() if (!m_webPlugin->hasSelection()) return; - webKitPlatformSupport()->clipboard()->writeHTML(m_webPlugin->selectionAsMarkup(), WebURL(), m_webPlugin->selectionAsText(), false); + WebKit::Platform::current()->clipboard()->writeHTML(m_webPlugin->selectionAsMarkup(), WebURL(), m_webPlugin->selectionAsText(), false); } WebElement WebPluginContainerImpl::element() @@ -714,9 +704,8 @@ WebCore::IntRect WebPluginContainerImpl::windowClipRect() const if (m_element->renderer()->document()->renderer()) { // Take our element and get the clip rect from the enclosing layer and // frame view. - RenderLayer* layer = m_element->renderer()->enclosingLayer(); clipRect.intersect( - m_element->document()->view()->windowClipRectForLayer(layer, true)); + m_element->document()->view()->windowClipRectForFrameOwner(m_element, true)); } return clipRect; diff --git a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp index c8036aa74..cd77cb46b 100644 --- a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp +++ b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp @@ -29,18 +29,19 @@ */ #include "config.h" -#include "WebStorageEventDispatcherImpl.h" +#include "WebStorageEventDispatcher.h" #include "KURL.h" #include "SecurityOrigin.h" #include "StorageAreaProxy.h" +#include "WebViewImpl.h" #include "platform/WebURL.h" #include <wtf/PassOwnPtr.h> -namespace WebKit { +// FIXME: move this file to WebStorageEventDispatcher.cpp -extern const char* pageGroupName; +namespace WebKit { void WebStorageEventDispatcher::dispatchLocalStorageEvent( const WebString& key, const WebString& oldValue, @@ -50,7 +51,7 @@ void WebStorageEventDispatcher::dispatchLocalStorageEvent( { RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::create(origin); WebCore::StorageAreaProxy::dispatchLocalStorageEvent( - pageGroupName, key, oldValue, newValue, securityOrigin.get(), pageURL, + WebViewImpl::defaultPageGroup(), key, oldValue, newValue, securityOrigin.get(), pageURL, sourceAreaInstance, originatedInProcess); } @@ -62,31 +63,8 @@ void WebStorageEventDispatcher::dispatchSessionStorageEvent( { RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::create(origin); WebCore::StorageAreaProxy::dispatchSessionStorageEvent( - pageGroupName, key, oldValue, newValue, securityOrigin.get(), pageURL, + WebViewImpl::defaultPageGroup(), key, oldValue, newValue, securityOrigin.get(), pageURL, sessionNamespace, sourceAreaInstance, originatedInProcess); } - -// FIXME: remove the WebStorageEventDispatcherImpl class soon. - -WebStorageEventDispatcher* WebStorageEventDispatcher::create() -{ - return new WebStorageEventDispatcherImpl(); -} - -WebStorageEventDispatcherImpl::WebStorageEventDispatcherImpl() - : m_eventDispatcher(adoptPtr(new WebCore::StorageEventDispatcherImpl(pageGroupName))) -{ - ASSERT(m_eventDispatcher); -} - -void WebStorageEventDispatcherImpl::dispatchStorageEvent(const WebString& key, const WebString& oldValue, - const WebString& newValue, const WebString& origin, - const WebURL& pageURL, bool isLocalStorage) -{ - WebCore::StorageType storageType = isLocalStorage ? WebCore::LocalStorage : WebCore::SessionStorage; - RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::createFromString(origin); - m_eventDispatcher->dispatchStorageEvent(key, oldValue, newValue, securityOrigin.get(), pageURL, storageType); -} - } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.h b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.h deleted file mode 100644 index b03c6b7a6..000000000 --- a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebStorageEventDispatcherImpl_h -#define WebStorageEventDispatcherImpl_h - -#include "StorageEventDispatcherImpl.h" -#include "WebStorageEventDispatcher.h" -#include <wtf/OwnPtr.h> - -namespace WebKit { - -// DEPRECATED - to be removed when removing the instance methods in the public api. -class WebStorageEventDispatcherImpl : public WebStorageEventDispatcher { -public: - WebStorageEventDispatcherImpl(); - virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue, - const WebString& newValue, const WebString& origin, - const WebURL&, bool isLocalStorage); -private: - OwnPtr<WebCore::StorageEventDispatcherImpl> m_eventDispatcher; -}; - -} // namespace WebKit - -#endif // WebStorageEventDispatcherImpl_h diff --git a/Source/WebKit/chromium/src/WebTextRun.cpp b/Source/WebKit/chromium/src/WebTextRun.cpp index d2652405c..e8037d24b 100644 --- a/Source/WebKit/chromium/src/WebTextRun.cpp +++ b/Source/WebKit/chromium/src/WebTextRun.cpp @@ -39,7 +39,7 @@ namespace WebKit { WebTextRun::operator WebCore::TextRun() const { - return TextRun(text, false, 0, 0, TextRun::AllowTrailingExpansion, rtl ? RTL : LTR, directionalOverride); + return TextRun(text, 0, 0, TextRun::AllowTrailingExpansion, rtl ? RTL : LTR, directionalOverride); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebUserMediaRequest.cpp b/Source/WebKit/chromium/src/WebUserMediaRequest.cpp index dcd270385..c9c0eccb3 100644 --- a/Source/WebKit/chromium/src/WebUserMediaRequest.cpp +++ b/Source/WebKit/chromium/src/WebUserMediaRequest.cpp @@ -36,11 +36,13 @@ #include "Document.h" #include "Frame.h" +#include "MediaStreamDescriptor.h" #include "MediaStreamSource.h" #include "Page.h" #include "SecurityOrigin.h" #include "UserMediaRequest.h" #include "WebSecurityOrigin.h" +#include "platform/WebMediaStreamDescriptor.h" #include "platform/WebMediaStreamSource.h" #include "platform/WebString.h" #include "platform/WebVector.h" @@ -95,6 +97,15 @@ void WebUserMediaRequest::requestSucceeded(const WebVector<WebMediaStreamSource> m_private->succeed(audio, video); } +void WebUserMediaRequest::requestSucceeded(const WebMediaStreamDescriptor& streamDescriptor) +{ + ASSERT(!streamDescriptor.isNull()); + if (m_private.isNull()) + return; + + m_private->succeed(streamDescriptor); +} + void WebUserMediaRequest::requestFailed() { m_private->fail(); @@ -109,10 +120,7 @@ bool WebUserMediaRequest::equals(const WebUserMediaRequest& other) const void WebUserMediaRequest::assign(const WebUserMediaRequest& other) { - UserMediaRequest* p = other.m_private.get(); - if (p) - p->ref(); - m_private = p; + m_private = other.m_private; } WebUserMediaRequest::operator UserMediaRequest*() const diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index 4318dc79d..626da8a21 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -143,14 +143,14 @@ #include "WheelEvent.h" #include "cc/CCProxy.h" #include "painting/GraphicsContextBuilder.h" -#include "platform/WebDragData.h" -#include "platform/WebImage.h" #include "platform/WebKitPlatformSupport.h" #include "platform/WebString.h" #include "platform/WebVector.h" #include <public/Platform.h> +#include <public/WebDragData.h> #include <public/WebFloatPoint.h> #include <public/WebGraphicsContext3D.h> +#include <public/WebImage.h> #include <public/WebLayer.h> #include <public/WebLayerTreeView.h> #include <public/WebPoint.h> @@ -658,12 +658,22 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) } return gestureHandled; } + case WebInputEvent::GestureLongPress: { + if (!mainFrameImpl() || !mainFrameImpl()->frameView()) + return false; + + m_page->contextMenuController()->clearContextMenu(); + m_contextMenuAllowed = true; + PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); + bool handled = mainFrameImpl()->frame()->eventHandler()->sendContextMenuEventForGesture(platformEvent); + m_contextMenuAllowed = false; + return handled; + } case WebInputEvent::GestureScrollBegin: case WebInputEvent::GestureScrollEnd: case WebInputEvent::GestureScrollUpdate: case WebInputEvent::GestureTapDown: case WebInputEvent::GestureDoubleTap: - case WebInputEvent::GestureLongPress: case WebInputEvent::GesturePinchBegin: case WebInputEvent::GesturePinchEnd: case WebInputEvent::GesturePinchUpdate: { @@ -1251,6 +1261,11 @@ WebViewImpl* WebViewImpl::fromPage(Page* page) return static_cast<WebViewImpl*>(chromeClient->webView()); } +PageGroup* WebViewImpl::defaultPageGroup() +{ + return PageGroup::pageGroup(pageGroupName); +} + // WebWidget ------------------------------------------------------------------ void WebViewImpl::close() @@ -1432,6 +1447,13 @@ void WebViewImpl::updateAnimations(double monotonicFrameBeginTime) #if ENABLE(REQUEST_ANIMATION_FRAME) TRACE_EVENT("WebViewImpl::updateAnimations", this, 0); + WebFrameImpl* webframe = mainFrameImpl(); + if (!webframe) + return; + FrameView* view = webframe->frameView(); + if (!view) + return; + // Create synthetic wheel events as necessary for fling. if (m_gestureAnimation) { if (m_gestureAnimation->animate(monotonicFrameBeginTime)) @@ -1440,9 +1462,6 @@ void WebViewImpl::updateAnimations(double monotonicFrameBeginTime) m_gestureAnimation.clear(); } - if (!m_page) - return; - PageWidgetDelegate::animate(m_page.get(), monotonicFrameBeginTime); #endif } @@ -1872,8 +1891,21 @@ WebTextInputType WebViewImpl::textInputType() return WebTextInputTypeTelephone; if (input->isURLField()) return WebTextInputTypeURL; + if (input->isDateField()) + return WebTextInputTypeDate; + if (input->isDateTimeField()) + return WebTextInputTypeDateTime; + if (input->isDateTimeLocalField()) + return WebTextInputTypeDateTimeLocal; + if (input->isMonthField()) + return WebTextInputTypeMonth; + if (input->isTimeField()) + return WebTextInputTypeTime; + if (input->isWeekField()) + return WebTextInputTypeWeek; if (input->isTextField()) return WebTextInputTypeText; + return WebTextInputTypeNone; } diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index 9383ba28d..9b44fb68d 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -69,6 +69,7 @@ class HistoryItem; class HitTestResult; class KeyboardEvent; class Page; +class PageGroup; class PagePopup; class PagePopupClient; class PlatformGestureCurveTarget; @@ -300,6 +301,12 @@ public: static WebViewImpl* fromPage(WebCore::Page*); + // A pageGroup identifies a namespace of pages. Page groups are used on PLATFORM(MAC) + // for some programs that use HTML views to display things that don't seem like + // web pages to the user (so shouldn't have visited link coloring). We only use + // one page group. + static WebCore::PageGroup* defaultPageGroup(); + WebViewClient* client() { return m_client; diff --git a/Source/WebKit/chromium/src/WebWorkerClientImpl.h b/Source/WebKit/chromium/src/WebWorkerClientImpl.h index 2a865488d..f6779083b 100644 --- a/Source/WebKit/chromium/src/WebWorkerClientImpl.h +++ b/Source/WebKit/chromium/src/WebWorkerClientImpl.h @@ -39,8 +39,8 @@ #include "WorkerMessagingProxy.h" #include "WorkerObjectProxy.h" -#include "platform/WebFileSystem.h" #include "WebWorkerBase.h" +#include <public/WebFileSystem.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/RefPtr.h> diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp index bcbca5651..09021ef44 100644 --- a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp @@ -38,7 +38,6 @@ #include "FileMetadata.h" #include "FileSystem.h" #include "NotImplemented.h" -#include "platform/WebFileSystem.h" #include "WebFileSystemCallbacksImpl.h" #include "WebFileWriter.h" #include "WebKit.h" @@ -49,6 +48,7 @@ #include "WorkerFileSystemCallbacksBridge.h" #include "WorkerScriptController.h" #include "WorkerThread.h" +#include <public/WebFileSystem.h> #include <wtf/text/CString.h> using namespace WebKit; @@ -57,9 +57,8 @@ namespace WebCore { static const char fileSystemOperationsMode[] = "fileSystemOperationsMode"; -WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium(ScriptExecutionContext* context, FileSystemType type, const WebKit::WebURL& rootURL, FileSystemSynchronousType synchronousType) - : AsyncFileSystemChromium(type, rootURL) - , m_scriptExecutionContext(context) +WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium(ScriptExecutionContext* context, FileSystemSynchronousType synchronousType) + : m_scriptExecutionContext(context) , m_workerContext(static_cast<WorkerContext*>(context)) , m_synchronousType(synchronousType) { @@ -86,54 +85,54 @@ bool WorkerAsyncFileSystemChromium::waitForOperationToComplete() return true; } -void WorkerAsyncFileSystemChromium::move(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::move(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postMoveToMainThread(m_webFileSystem, virtualPathToFileSystemURL(sourcePath), virtualPathToFileSystemURL(destinationPath), m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postMoveToMainThread(m_webFileSystem, sourcePath, destinationPath, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::copy(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::copy(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postCopyToMainThread(m_webFileSystem, virtualPathToFileSystemURL(sourcePath), virtualPathToFileSystemURL(destinationPath), m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postCopyToMainThread(m_webFileSystem, sourcePath, destinationPath, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::remove(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::remove(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postRemoveToMainThread(m_webFileSystem, virtualPathToFileSystemURL(path), m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postRemoveToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::removeRecursively(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::removeRecursively(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postRemoveRecursivelyToMainThread(m_webFileSystem, virtualPathToFileSystemURL(path), m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postRemoveRecursivelyToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::readMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::readMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postReadMetadataToMainThread(m_webFileSystem, virtualPathToFileSystemURL(path), m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postReadMetadataToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::createFile(const String& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::createFile(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postCreateFileToMainThread(m_webFileSystem, virtualPathToFileSystemURL(path), exclusive, m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postCreateFileToMainThread(m_webFileSystem, path, exclusive, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::createDirectory(const String& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::createDirectory(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postCreateDirectoryToMainThread(m_webFileSystem, virtualPathToFileSystemURL(path), exclusive, m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postCreateDirectoryToMainThread(m_webFileSystem, path, exclusive, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::fileExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::fileExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postFileExistsToMainThread(m_webFileSystem, virtualPathToFileSystemURL(path), m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postFileExistsToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::directoryExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::directoryExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postDirectoryExistsToMainThread(m_webFileSystem, virtualPathToFileSystemURL(path), m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postDirectoryExistsToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::readDirectory(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - createWorkerFileSystemCallbacksBridge(callbacks)->postReadDirectoryToMainThread(m_webFileSystem, virtualPathToFileSystemURL(path), m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(callbacks)->postReadDirectoryToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); } class WorkerFileWriterHelperCallbacks : public AsyncFileSystemCallbacks { @@ -143,11 +142,6 @@ public: return adoptPtr(new WorkerFileWriterHelperCallbacks(client, path, webFileSystem, callbacks, workerContext)); } - virtual void didSucceed() - { - ASSERT_NOT_REACHED(); - } - virtual void didReadMetadata(const FileMetadata& metadata) { ASSERT(m_callbacks); @@ -159,27 +153,6 @@ public: } } - virtual void didReadDirectoryEntry(const String& name, bool isDirectory) - { - ASSERT_NOT_REACHED(); - } - - virtual void didReadDirectoryEntries(bool hasMore) - { - ASSERT_NOT_REACHED(); - } - - virtual void didOpenFileSystem(const String&, PassOwnPtr<AsyncFileSystem>) - { - ASSERT_NOT_REACHED(); - } - - // Called when an AsyncFileWrter has been created successfully. - virtual void didCreateFileWriter(PassOwnPtr<AsyncFileWriter>, long long) - { - ASSERT_NOT_REACHED(); - } - virtual void didFail(int code) { ASSERT(m_callbacks); @@ -203,18 +176,16 @@ private: WorkerContext* m_workerContext; }; -void WorkerAsyncFileSystemChromium::createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::createWriter(AsyncFileWriterClient* client, const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - KURL pathAsURL = virtualPathToFileSystemURL(path); - createWorkerFileSystemCallbacksBridge(WorkerFileWriterHelperCallbacks::create(client, pathAsURL, m_webFileSystem, callbacks, m_workerContext))->postReadMetadataToMainThread(m_webFileSystem, pathAsURL, m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(WorkerFileWriterHelperCallbacks::create(client, path, m_webFileSystem, callbacks, m_workerContext))->postReadMetadataToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); } -void WorkerAsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void WorkerAsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - KURL pathAsURL = virtualPathToFileSystemURL(path); KURL internalBlobURL = BlobURL::createInternalURL(); - createWorkerFileSystemCallbacksBridge(createSnapshotFileCallback(internalBlobURL, callbacks))->postCreateSnapshotFileToMainThread(m_webFileSystem, internalBlobURL, pathAsURL, m_modeForCurrentOperation); + createWorkerFileSystemCallbacksBridge(createSnapshotFileCallback(internalBlobURL, callbacks))->postCreateSnapshotFileToMainThread(m_webFileSystem, internalBlobURL, path, m_modeForCurrentOperation); } PassRefPtr<WorkerFileSystemCallbacksBridge> WorkerAsyncFileSystemChromium::createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks> callbacks) diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h index 2618c48b9..6727d1e47 100644 --- a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h +++ b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h @@ -53,9 +53,9 @@ class WorkerContext; class WorkerAsyncFileSystemChromium : public AsyncFileSystemChromium { public: - static PassOwnPtr<AsyncFileSystem> create(ScriptExecutionContext* context, FileSystemType type, const WebKit::WebURL& rootURL, FileSystemSynchronousType synchronousType) + static PassOwnPtr<AsyncFileSystem> create(ScriptExecutionContext* context, FileSystemSynchronousType synchronousType) { - return adoptPtr(new WorkerAsyncFileSystemChromium(context, type, rootURL, synchronousType)); + return adoptPtr(new WorkerAsyncFileSystemChromium(context, synchronousType)); } virtual ~WorkerAsyncFileSystemChromium(); @@ -63,21 +63,21 @@ public: // Runs one pending operation (to wait for completion in the sync-mode). virtual bool waitForOperationToComplete(); - virtual void move(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void copy(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void remove(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void removeRecursively(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void readMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void createFile(const String& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void createDirectory(const String& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void fileExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void directoryExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); - virtual void createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void move(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void copy(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void remove(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void removeRecursively(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void readMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createFile(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createDirectory(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void fileExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void directoryExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void readDirectory(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createWriter(AsyncFileWriterClient*, const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createSnapshotFileAndReadMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); private: - WorkerAsyncFileSystemChromium(ScriptExecutionContext*, FileSystemType, const WebKit::WebURL& rootURL, FileSystemSynchronousType); + WorkerAsyncFileSystemChromium(ScriptExecutionContext*, FileSystemSynchronousType); PassRefPtr<WebKit::WorkerFileSystemCallbacksBridge> createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks>); diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.cpp b/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.cpp index 054ecbb1f..6d62098a6 100644 --- a/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.cpp +++ b/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.cpp @@ -36,7 +36,6 @@ #include "AsyncFileSystem.h" #include "Blob.h" #include "ScriptExecutionContext.h" -#include "platform/WebFileSystem.h" #include "WebFileWriter.h" #include "platform/WebURL.h" #include "WebWorkerBase.h" @@ -44,6 +43,7 @@ #include "WorkerFileWriterCallbacksBridge.h" #include "WorkerLoaderProxy.h" #include "WorkerThread.h" +#include <public/WebFileSystem.h> #include <wtf/Assertions.h> using namespace WebKit; diff --git a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h index e496de2ef..fa70dd261 100644 --- a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h +++ b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h @@ -36,8 +36,8 @@ #include "PlatformString.h" #include "ScriptExecutionContext.h" #include "WebFileError.h" -#include "platform/WebFileSystem.h" #include "platform/WebVector.h" +#include <public/WebFileSystem.h> #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/Threading.h> diff --git a/Source/WebKit/chromium/src/WorkerFileWriterCallbacksBridge.cpp b/Source/WebKit/chromium/src/WorkerFileWriterCallbacksBridge.cpp index 26a0ae34f..3ffb178c5 100644 --- a/Source/WebKit/chromium/src/WorkerFileWriterCallbacksBridge.cpp +++ b/Source/WebKit/chromium/src/WorkerFileWriterCallbacksBridge.cpp @@ -36,14 +36,14 @@ #include "AsyncFileWriterClient.h" #include "CrossThreadTask.h" #include "platform/WebCString.h" -#include "platform/WebFileSystem.h" #include "WebFileWriter.h" #include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" #include "WebWorkerBase.h" #include "WorkerContext.h" #include "WorkerLoaderProxy.h" #include "WorkerThread.h" +#include <public/Platform.h> +#include <public/WebFileSystem.h> #include <wtf/MainThread.h> #include <wtf/Threading.h> @@ -104,7 +104,7 @@ void WorkerFileWriterCallbacksBridge::abortOnMainThread(ScriptExecutionContext*, void WorkerFileWriterCallbacksBridge::initOnMainThread(ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge> bridge, const KURL& path) { ASSERT(!bridge->m_writer); - bridge->m_writer = adoptPtr(webKitPlatformSupport()->fileSystem()->createFileWriter(path, bridge.get())); + bridge->m_writer = adoptPtr(WebKit::Platform::current()->fileSystem()->createFileWriter(path, bridge.get())); } void WorkerFileWriterCallbacksBridge::shutdownOnMainThread(ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge> bridge) diff --git a/Source/WebKit/chromium/src/painting/GraphicsContextBuilder.h b/Source/WebKit/chromium/src/painting/GraphicsContextBuilder.h index 5ffae8ebc..79708b396 100644 --- a/Source/WebKit/chromium/src/painting/GraphicsContextBuilder.h +++ b/Source/WebKit/chromium/src/painting/GraphicsContextBuilder.h @@ -33,33 +33,10 @@ #include "GraphicsContext.h" -#if WEBKIT_USING_CG -#include "LocalCurrentGraphicsContext.h" -#elif WEBKIT_USING_SKIA #include "PlatformContextSkia.h" -#endif namespace WebKit { -#if WEBKIT_USING_CG - -class GraphicsContextBuilder { -public: - GraphicsContextBuilder(WebCanvas* canvas) - : m_graphicsContext(canvas) - , m_localContext(&m_graphicsContext) - { - } - - WebCore::GraphicsContext& context() { return m_graphicsContext; } - -private: - WebCore::GraphicsContext m_graphicsContext; - WebCore::LocalCurrentGraphicsContext m_localContext; -}; - -#elif WEBKIT_USING_SKIA - class GraphicsContextBuilder { public: GraphicsContextBuilder(WebCanvas* canvas) @@ -75,10 +52,6 @@ private: WebCore::GraphicsContext m_graphicsContext; }; -#else -#error "Need to define GraphicsContextBuilder!" -#endif - } // namespace WebKit #endif diff --git a/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp b/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp index a1ab770b7..af9fde1d5 100644 --- a/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp +++ b/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp @@ -69,6 +69,16 @@ TEST(CCActiveAnimationTest, TrimTimeInfiniteIterations) EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1.5)); } +TEST(CCActiveAnimationTest, TrimTimeAlternating) +{ + OwnPtr<CCActiveAnimation> anim(createActiveAnimation(-1)); + anim->setAlternatesDirection(true); + EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0)); + EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5)); + EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1)); + EXPECT_EQ(0.75, anim->trimTimeToCurrentIteration(1.25)); +} + TEST(CCActiveAnimationTest, TrimTimeStartTime) { OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1)); diff --git a/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp b/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp index fa95a2ac5..1d5409f98 100644 --- a/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp @@ -86,34 +86,45 @@ TEST(CCLayerAnimationControllerTest, createOpacityAnimation) EXPECT_EQ(1, curve->getValue(duration)); } -TEST(CCLayerAnimationControllerTest, ignoreUnsupportedAnimationDirections) +TEST(CCLayerAnimationControllerTest, createTransformAnimation) { FakeLayerAnimationControllerClient dummy; OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); const double duration = 1; - WebCore::KeyframeValueList values(AnimatedPropertyOpacity); - values.insert(new FloatAnimationValue(0, 0)); - values.insert(new FloatAnimationValue(duration, 1)); + WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); + + TransformOperations operations1; + operations1.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(0, &operations1)); + + TransformOperations operations2; + operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(duration, &operations2)); RefPtr<Animation> animation = Animation::create(); animation->setDuration(duration); IntSize boxSize; + controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0); - animation->setDirection(Animation::AnimationDirectionAlternate); - EXPECT_FALSE(controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0)); + EXPECT_TRUE(controller->hasActiveAnimation()); - animation->setDirection(Animation::AnimationDirectionAlternateReverse); - EXPECT_FALSE(controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0)); + CCActiveAnimation* activeAnimation = controller->getActiveAnimation(0, CCActiveAnimation::Transform); + EXPECT_TRUE(activeAnimation); - animation->setDirection(Animation::AnimationDirectionReverse); - EXPECT_FALSE(controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0)); + EXPECT_EQ(1, activeAnimation->iterations()); + EXPECT_EQ(CCActiveAnimation::Transform, activeAnimation->targetProperty()); + + EXPECT_EQ(CCAnimationCurve::Transform, activeAnimation->curve()->type()); - animation->setDirection(Animation::AnimationDirectionNormal); - EXPECT_TRUE(controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0)); + const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve(); + EXPECT_TRUE(curve); + + expectTranslateX(2, curve->getValue(0, boxSize)); + expectTranslateX(4, curve->getValue(duration, boxSize)); } -TEST(CCLayerAnimationControllerTest, createTransformAnimation) +TEST(CCLayerAnimationControllerTest, createReversedAnimation) { FakeLayerAnimationControllerClient dummy; OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); @@ -130,6 +141,7 @@ TEST(CCLayerAnimationControllerTest, createTransformAnimation) RefPtr<Animation> animation = Animation::create(); animation->setDuration(duration); + animation->setDirection(Animation::AnimationDirectionReverse); IntSize boxSize; controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0); @@ -147,10 +159,92 @@ TEST(CCLayerAnimationControllerTest, createTransformAnimation) const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve(); EXPECT_TRUE(curve); + expectTranslateX(4, curve->getValue(0, boxSize)); + expectTranslateX(2, curve->getValue(duration, boxSize)); +} + +TEST(CCLayerAnimationControllerTest, createAlternatingAnimation) +{ + FakeLayerAnimationControllerClient dummy; + OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); + const double duration = 1; + WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); + + TransformOperations operations1; + operations1.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(0, &operations1)); + + TransformOperations operations2; + operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(duration, &operations2)); + + RefPtr<Animation> animation = Animation::create(); + animation->setDuration(duration); + animation->setDirection(Animation::AnimationDirectionAlternate); + animation->setIterationCount(2); + + IntSize boxSize; + controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0); + + EXPECT_TRUE(controller->hasActiveAnimation()); + + CCActiveAnimation* activeAnimation = controller->getActiveAnimation(0, CCActiveAnimation::Transform); + EXPECT_TRUE(activeAnimation); + EXPECT_TRUE(activeAnimation->alternatesDirection()); + + EXPECT_EQ(2, activeAnimation->iterations()); + EXPECT_EQ(CCActiveAnimation::Transform, activeAnimation->targetProperty()); + + EXPECT_EQ(CCAnimationCurve::Transform, activeAnimation->curve()->type()); + + const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve(); + EXPECT_TRUE(curve); + expectTranslateX(2, curve->getValue(0, boxSize)); expectTranslateX(4, curve->getValue(duration, boxSize)); } +TEST(CCLayerAnimationControllerTest, createReversedAlternatingAnimation) +{ + FakeLayerAnimationControllerClient dummy; + OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy)); + const double duration = 1; + WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); + + TransformOperations operations1; + operations1.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(0, &operations1)); + + TransformOperations operations2; + operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); + values.insert(new TransformAnimationValue(duration, &operations2)); + + RefPtr<Animation> animation = Animation::create(); + animation->setDuration(duration); + animation->setDirection(Animation::AnimationDirectionAlternateReverse); + animation->setIterationCount(2); + + IntSize boxSize; + controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0); + + EXPECT_TRUE(controller->hasActiveAnimation()); + + CCActiveAnimation* activeAnimation = controller->getActiveAnimation(0, CCActiveAnimation::Transform); + EXPECT_TRUE(activeAnimation); + EXPECT_TRUE(activeAnimation->alternatesDirection()); + + EXPECT_EQ(2, activeAnimation->iterations()); + EXPECT_EQ(CCActiveAnimation::Transform, activeAnimation->targetProperty()); + + EXPECT_EQ(CCAnimationCurve::Transform, activeAnimation->curve()->type()); + + const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve(); + EXPECT_TRUE(curve); + + expectTranslateX(4, curve->getValue(0, boxSize)); + expectTranslateX(2, curve->getValue(duration, boxSize)); +} + TEST(CCLayerAnimationControllerTest, syncNewAnimation) { FakeLayerAnimationControllerClient dummyImpl; diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp index 51a032618..d243aee4a 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp @@ -1172,7 +1172,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBe EXPECT_INT_RECT_EQ(expected, actual); } -TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveIsClipped) +TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW) { // Test the calculateVisibleRect() function works correctly when projecting a surface // onto a layer, but the layer is partially behind the camera (not just behind the @@ -1190,7 +1190,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveIsClipped) // center of the layer. layerToSurfaceTransform.makeIdentity(); layerToSurfaceTransform.applyPerspective(1); - layerToSurfaceTransform.translate3d(0, 0, 1); + layerToSurfaceTransform.translate3d(-1, 0, 1); layerToSurfaceTransform.rotate3d(0, 45, 0); // Sanity check that this transform does indeed cause w < 0 when applying the @@ -1199,7 +1199,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveIsClipped) CCMathUtil::mapQuad(layerToSurfaceTransform, FloatQuad(FloatRect(layerContentRect)), clipped); ASSERT_TRUE(clipped); - int expectedXPosition = -10; + int expectedXPosition = 0; int expectedWidth = 10; IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); EXPECT_EQ(expectedXPosition, actual.x()); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp index ff2497085..58668d0ef 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp @@ -28,6 +28,7 @@ #include "CCAnimationTestCommon.h" #include "CCLayerTestCommon.h" +#include "CCTiledLayerTestCommon.h" #include "FakeWebGraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" #include "LayerRendererChromium.h" @@ -59,6 +60,8 @@ public: { CCSettings settings; m_hostImpl = CCLayerTreeHostImpl::create(settings, this); + m_hostImpl->initializeLayerRenderer(createContext(), adoptPtr(new FakeTextureUploader)); + m_hostImpl->setViewportSize(IntSize(10, 10)); } virtual void didLoseContextOnImplThread() OVERRIDE { } @@ -254,8 +257,6 @@ TEST_F(CCLayerTreeHostImplTest, nonFastScrollableRegionBasic) TEST_F(CCLayerTreeHostImplTest, nonFastScrollableRegionWithOffset) { - m_hostImpl->initializeLayerRenderer(createContext()); - OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0); root->setScrollable(true); root->setScrollPosition(IntPoint(0, 0)); @@ -440,49 +441,51 @@ private: TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) { - m_hostImpl->initializeLayerRenderer(createContext()); - - // Ensure visibleLayerRect for root layer is empty - m_hostImpl->setViewportSize(IntSize(0, 0)); - + // The root layer is always drawn, so run this test on a child layer that + // will be masked out by the root layer's bounds. m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0)); DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); + root->setMasksToBounds(true); + + root->addChild(DidDrawCheckLayer::create(1)); + DidDrawCheckLayer* layer = static_cast<DidDrawCheckLayer*>(root->children()[0].get()); + // Ensure visibleLayerRect for layer is empty + layer->setPosition(FloatPoint(100, 100)); + layer->setBounds(IntSize(10, 10)); + layer->setContentBounds(IntSize(10, 10)); CCLayerTreeHostImpl::FrameData frame; - EXPECT_FALSE(root->willDrawCalled()); - EXPECT_FALSE(root->didDrawCalled()); + EXPECT_FALSE(layer->willDrawCalled()); + EXPECT_FALSE(layer->didDrawCalled()); EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); - EXPECT_FALSE(root->willDrawCalled()); - EXPECT_FALSE(root->didDrawCalled()); + EXPECT_FALSE(layer->willDrawCalled()); + EXPECT_FALSE(layer->didDrawCalled()); - EXPECT_TRUE(root->visibleLayerRect().isEmpty()); + EXPECT_TRUE(layer->visibleLayerRect().isEmpty()); - // Ensure visibleLayerRect for root layer is not empty - m_hostImpl->setViewportSize(IntSize(10, 10)); + // Ensure visibleLayerRect for layer layer is not empty + layer->setPosition(FloatPoint(0, 0)); - EXPECT_FALSE(root->willDrawCalled()); - EXPECT_FALSE(root->didDrawCalled()); + EXPECT_FALSE(layer->willDrawCalled()); + EXPECT_FALSE(layer->didDrawCalled()); EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); - EXPECT_TRUE(root->willDrawCalled()); - EXPECT_TRUE(root->didDrawCalled()); + EXPECT_TRUE(layer->willDrawCalled()); + EXPECT_TRUE(layer->didDrawCalled()); - EXPECT_FALSE(root->visibleLayerRect().isEmpty()); + EXPECT_FALSE(layer->visibleLayerRect().isEmpty()); } TEST_F(CCLayerTreeHostImplTest, didDrawCalledOnAllLayers) { - m_hostImpl->initializeLayerRenderer(createContext()); - m_hostImpl->setViewportSize(IntSize(10, 10)); - m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0)); DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); @@ -533,9 +536,6 @@ private: TEST_F(CCLayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) { - m_hostImpl->initializeLayerRenderer(createContext()); - m_hostImpl->setViewportSize(IntSize(10, 10)); - // When the texture is not missing, we draw as usual. m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0)); DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer()); @@ -660,8 +660,6 @@ private: // https://bugs.webkit.org/show_bug.cgi?id=75783 TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) { - m_hostImpl->initializeLayerRenderer(createContext()); - m_hostImpl->setViewportSize(IntSize(10, 10)); { OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0); @@ -878,7 +876,7 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) TEST_F(CCLayerTreeHostImplTest, viewportCovered) { - m_hostImpl->initializeLayerRenderer(createContext()); + m_hostImpl->initializeLayerRenderer(createContext(), adoptPtr(new FakeTextureUploader)); m_hostImpl->setBackgroundColor(Color::gray); IntSize viewportSize(1000, 1000); @@ -989,8 +987,7 @@ TEST_F(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw) { ReshapeTrackerContext* reshapeTracker = new ReshapeTrackerContext(); RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(reshapeTracker), GraphicsContext3D::RenderDirectlyToHostWindow); - m_hostImpl->initializeLayerRenderer(context); - m_hostImpl->setViewportSize(IntSize(10, 10)); + m_hostImpl->initializeLayerRenderer(context, adoptPtr(new FakeTextureUploader)); CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); root->setAnchorPoint(FloatPoint(0, 0)); @@ -1039,7 +1036,7 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) CCSettings settings; settings.partialSwapEnabled = true; OwnPtr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::create(settings, this); - layerTreeHostImpl->initializeLayerRenderer(context); + layerTreeHostImpl->initializeLayerRenderer(context, adoptPtr(new FakeTextureUploader())); layerTreeHostImpl->setViewportSize(IntSize(500, 500)); CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); @@ -1125,9 +1122,6 @@ private: TEST_F(CCLayerTreeHostImplTest, contextLostAndRestoredNotificationSentToAllLayers) { - m_hostImpl->initializeLayerRenderer(createContext()); - m_hostImpl->setViewportSize(IntSize(10, 10)); - m_hostImpl->setRootLayer(ContextLostNotificationCheckLayer::create(0)); ContextLostNotificationCheckLayer* root = static_cast<ContextLostNotificationCheckLayer*>(m_hostImpl->rootLayer()); @@ -1141,7 +1135,7 @@ TEST_F(CCLayerTreeHostImplTest, contextLostAndRestoredNotificationSentToAllLayer EXPECT_FALSE(layer1->didLoseContextCalled()); EXPECT_FALSE(layer2->didLoseContextCalled()); - m_hostImpl->initializeLayerRenderer(createContext()); + m_hostImpl->initializeLayerRenderer(createContext(), adoptPtr(new FakeTextureUploader)); EXPECT_TRUE(root->didLoseContextCalled()); EXPECT_TRUE(layer1->didLoseContextCalled()); @@ -1156,7 +1150,7 @@ public: TEST_F(CCLayerTreeHostImplTest, finishAllRenderingAfterContextLost) { // The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects. - m_hostImpl->initializeLayerRenderer(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow)); + m_hostImpl->initializeLayerRenderer(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow), adoptPtr(new FakeTextureUploader)); m_hostImpl->finishAllRendering(); } @@ -1172,9 +1166,6 @@ private: TEST_F(CCLayerTreeHostImplTest, scrollbarLayerLostContext) { - m_hostImpl->initializeLayerRenderer(createContext()); - m_hostImpl->setViewportSize(IntSize(10, 10)); - m_hostImpl->setRootLayer(ScrollbarLayerFakePaint::create(0)); ScrollbarLayerFakePaint* scrollbar = static_cast<ScrollbarLayerFakePaint*>(m_hostImpl->rootLayer()); scrollbar->setBounds(IntSize(1, 1)); @@ -1189,7 +1180,7 @@ TEST_F(CCLayerTreeHostImplTest, scrollbarLayerLostContext) // Scrollbar layer should always generate quads, even after lost context EXPECT_GT(renderPass->quadList().size(), 0u); m_hostImpl->didDrawAllLayers(frame); - m_hostImpl->initializeLayerRenderer(createContext()); + m_hostImpl->initializeLayerRenderer(createContext(), adoptPtr(new FakeTextureUploader)); } } @@ -1322,9 +1313,6 @@ private: TEST_F(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) { - m_hostImpl->initializeLayerRenderer(createContext()); - m_hostImpl->setViewportSize(IntSize(10, 10)); - OwnPtr<CCLayerImpl> rootLayer(CCLayerImpl::create(0)); rootLayer->setBounds(IntSize(10, 10)); rootLayer->setAnchorPoint(FloatPoint(0, 0)); @@ -1367,7 +1355,7 @@ TEST_F(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) // Lose the context, replacing it with a StrictWebGraphicsContext3D, that // will warn if any resource from the previous context gets used. - m_hostImpl->initializeLayerRenderer(StrictWebGraphicsContext3D::createGraphicsContext()); + m_hostImpl->initializeLayerRenderer(StrictWebGraphicsContext3D::createGraphicsContext(), adoptPtr(new FakeTextureUploader)); EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp index f2382b359..44f87c6a9 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp @@ -788,7 +788,12 @@ private: int m_numDraws; }; +#if OS(WINDOWS) +// http://webkit.org/b/74623 +TEST_F(CCLayerTreeHostTestSetNeedsCommit2, FLAKY_runMultiThread) +#else TEST_F(CCLayerTreeHostTestSetNeedsCommit2, runMultiThread) +#endif { runTestThreaded(); } @@ -840,6 +845,62 @@ TEST_F(CCLayerTreeHostTestSetNeedsRedraw, runMultiThread) runTestThreaded(); } +// If the layerTreeHost says it can't draw, then we should not try to draw. +// FIXME: Make this run in single threaded mode too. http://crbug.com/127481 +class CCLayerTreeHostTestCanDrawBlocksDrawing : public CCLayerTreeHostTestThreadOnly { +public: + CCLayerTreeHostTestCanDrawBlocksDrawing() + : m_numCommits(0) + { + } + + virtual void beginTest() + { + } + + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) + { + // Only the initial draw should bring us here. + EXPECT_TRUE(impl->canDraw()); + EXPECT_EQ(0, impl->sourceFrameNumber()); + } + + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) + { + if (m_numCommits >= 1) { + // After the first commit, we should not be able to draw. + EXPECT_FALSE(impl->canDraw()); + } + } + + virtual void didCommitAndDrawFrame() + { + m_numCommits++; + if (m_numCommits == 1) { + // Make the viewport empty so the host says it can't draw. + m_layerTreeHost->setViewportSize(IntSize(0, 0)); + + OwnArrayPtr<char> pixels(adoptArrayPtr(new char[4])); + m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get()), IntRect(0, 0, 1, 1)); + } else if (m_numCommits == 2) { + m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->finishAllRendering(); + endTest(); + } + } + + virtual void afterTest() + { + } + +private: + int m_numCommits; +}; + +TEST_F(CCLayerTreeHostTestCanDrawBlocksDrawing, runMultiThread) +{ + runTestThreaded(); +} // beginLayerWrite should prevent draws from executing until a commit occurs class CCLayerTreeHostTestWriteLayersRedraw : public CCLayerTreeHostTestThreadOnly { @@ -1096,7 +1157,12 @@ private: int m_numAnimates; }; +#if OS(WINDOWS) +// http://webkit.org/b/74623 +TEST_F(CCLayerTreeHostTestTickAnimationWhileBackgrounded, FLAKY_runMultiThread) +#else TEST_F(CCLayerTreeHostTestTickAnimationWhileBackgrounded, runMultiThread) +#endif { runTestThreaded(); } @@ -1134,7 +1200,12 @@ public: private: }; +#if OS(WINDOWS) +// http://webkit.org/b/74623 +TEST_F(CCLayerTreeHostTestAddAnimationWithTimingFunction, FLAKY_runMultiThread) +#else TEST_F(CCLayerTreeHostTestAddAnimationWithTimingFunction, runMultiThread) +#endif { runTestThreaded(); } @@ -1168,7 +1239,12 @@ public: } }; +#if OS(WINDOWS) +// http://webkit.org/b/74623 +TEST_F(CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity, FLAKY_runMultiThread) +#else TEST_F(CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity, runMultiThread) +#endif { runTestThreaded(); } @@ -1340,11 +1416,11 @@ public: virtual void beginCommitOnCCThread(CCLayerTreeHostImpl* impl) { LayerChromium* root = m_layerTreeHost->rootLayer(); - if (!m_layerTreeHost->frameNumber()) + if (!impl->sourceFrameNumber()) EXPECT_EQ(root->scrollPosition(), m_initialScroll); - else if (m_layerTreeHost->frameNumber() == 1) + else if (impl->sourceFrameNumber() == 1) EXPECT_EQ(root->scrollPosition(), m_initialScroll + m_scrollAmount + m_scrollAmount); - else if (m_layerTreeHost->frameNumber() == 2) + else if (impl->sourceFrameNumber() == 2) EXPECT_EQ(root->scrollPosition(), m_initialScroll + m_scrollAmount + m_scrollAmount); } @@ -1711,10 +1787,10 @@ public: { CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context())); - switch (impl->frameNumber()) { + switch (impl->sourceFrameNumber()) { case 0: // Number of textures should be one. - EXPECT_EQ(1, context->numTextures()); + ASSERT_EQ(1, context->numTextures()); // Number of textures used for commit should be one. EXPECT_EQ(1, context->numUsedTextures()); // Verify that used texture is correct. @@ -1725,7 +1801,7 @@ public: case 1: // Number of textures should be two as the first texture // is used by impl thread and cannot by used for update. - EXPECT_EQ(2, context->numTextures()); + ASSERT_EQ(2, context->numTextures()); // Number of textures used for commit should still be one. EXPECT_EQ(1, context->numUsedTextures()); // First texture should not have been used. @@ -1748,7 +1824,7 @@ public: // Number of textures used for draw should always be one. EXPECT_EQ(1, context->numUsedTextures()); - if (impl->frameNumber() < 2) { + if (impl->sourceFrameNumber() < 1) { context->resetUsedTextures(); postSetNeedsAnimateAndCommitToMainThread(); postSetNeedsRedrawToMainThread(); @@ -1815,10 +1891,10 @@ public: { CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context())); - switch (impl->frameNumber()) { + switch (impl->sourceFrameNumber()) { case 0: // Number of textures should be two. - EXPECT_EQ(2, context->numTextures()); + ASSERT_EQ(2, context->numTextures()); // Number of textures used for commit should be two. EXPECT_EQ(2, context->numUsedTextures()); // Verify that used textures are correct. @@ -1830,7 +1906,7 @@ public: case 1: // Number of textures should be four as the first two // textures are used by the impl thread. - EXPECT_EQ(4, context->numTextures()); + ASSERT_EQ(4, context->numTextures()); // Number of textures used for commit should still be two. EXPECT_EQ(2, context->numUsedTextures()); // First two textures should not have been used. @@ -1846,7 +1922,7 @@ public: // Number of textures should be three as we allow one // partial update and the first two textures are used by // the impl thread. - EXPECT_EQ(3, context->numTextures()); + ASSERT_EQ(3, context->numTextures()); // Number of textures used for commit should still be two. EXPECT_EQ(2, context->numUsedTextures()); // First texture should have been used. @@ -1886,12 +1962,12 @@ public: // Number of textures used for drawing should two except for frame 4 // where the viewport only contains one layer. - if (impl->frameNumber() == 4) + if (impl->sourceFrameNumber() == 3) EXPECT_EQ(1, context->numUsedTextures()); else EXPECT_EQ(2, context->numUsedTextures()); - if (impl->frameNumber() < 5) { + if (impl->sourceFrameNumber() < 4) { context->resetUsedTextures(); postSetNeedsAnimateAndCommitToMainThread(); postSetNeedsRedrawToMainThread(); diff --git a/Source/WebKit/chromium/tests/CCMathUtilTest.cpp b/Source/WebKit/chromium/tests/CCMathUtilTest.cpp index db0a4e53f..3909677a5 100644 --- a/Source/WebKit/chromium/tests/CCMathUtilTest.cpp +++ b/Source/WebKit/chromium/tests/CCMathUtilTest.cpp @@ -99,4 +99,21 @@ TEST(CCMathUtilTest, verifyBackfaceVisibilityForPerspective) EXPECT_TRUE(layerSpaceToProjectionPlane.isBackFaceVisible()); } +TEST(CCMathUtilTest, verifyProjectionOfPerpendicularPlane) +{ + // In this case, the m33() element of the transform becomes zero, which could cause a + // divide-by-zero when projecting points/quads. + + TransformationMatrix transform; + transform.makeIdentity(); + transform.setM33(0); + + FloatRect rect = FloatRect(0, 0, 1, 1); + FloatRect projectedRect = CCMathUtil::projectClippedRect(transform, rect); + + EXPECT_EQ(0, projectedRect.x()); + EXPECT_EQ(0, projectedRect.y()); + EXPECT_TRUE(projectedRect.isEmpty()); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp index 73b4d8273..891c305b0 100644 --- a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp @@ -172,6 +172,7 @@ protected: m_renderSurfaceLayerListChromium.clear(); m_renderSurfaceLayerListImpl.clear(); m_replicaLayers.clear(); + m_maskLayers.clear(); CCLayerTreeHost::setNeedsFilterContext(false); } @@ -233,6 +234,15 @@ protected: return layerPtr; } + typename Types::LayerType* createMaskLayer(typename Types::LayerType* owningLayer, const IntSize& bounds) + { + typename Types::ContentLayerPtrType layer(Types::createContentLayer()); + typename Types::ContentLayerType* layerPtr = layer.get(); + setProperties(layerPtr, identityMatrix, FloatPoint(), bounds); + setMask(owningLayer, layer.release()); + return layerPtr; + } + typename Types::ContentLayerType* createDrawingSurface(typename Types::LayerType* parent, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque) { typename Types::ContentLayerType* layer = createDrawingLayer(parent, transform, position, bounds, opaque); @@ -360,6 +370,17 @@ private: owningLayer->setReplicaLayer(layer); } + void setMask(LayerChromium* owningLayer, PassRefPtr<LayerChromium> layer) + { + owningLayer->setMaskLayer(layer.get()); + m_maskLayers.append(layer); + } + + void setMask(CCLayerImpl* owningLayer, PassOwnPtr<CCLayerImpl> layer) + { + owningLayer->setMaskLayer(layer); + } + // These hold ownership of the layers for the duration of the test. typename Types::LayerPtrType m_root; Vector<RefPtr<LayerChromium> > m_renderSurfaceLayerListChromium; @@ -368,6 +389,7 @@ private: typename Types::LayerIterator m_layerIterator; typename Types::LayerType* m_lastLayerVisited; Vector<RefPtr<LayerChromium> > m_replicaLayers; + Vector<RefPtr<LayerChromium> > m_maskLayers; }; #define RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ @@ -1330,6 +1352,38 @@ protected: ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaWithClipping); template<class Types, bool opaqueLayers> +class CCOcclusionTrackerTestReplicaWithMask : public CCOcclusionTrackerTest<Types, opaqueLayers> { +protected: + void runMyTest() + { + typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200)); + typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); + typename Types::LayerType* replica = this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), IntSize()); + this->createMaskLayer(replica, IntSize(10, 10)); + this->calcDrawEtc(parent); + + TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); + occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); + + this->visitLayer(surface, occlusion); + + EXPECT_EQ_RECT(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); + EXPECT_EQ_RECT(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); + + this->visitContributingSurface(surface, occlusion); + this->enterLayer(parent, occlusion); + + // The replica should not be occluding the parent, since it has a mask applied to it. + EXPECT_EQ_RECT(IntRect(0, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); + } +}; + +ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaWithMask); + +template<class Types, bool opaqueLayers> class CCOcclusionTrackerTestLayerScissorRectOutsideChild : public CCOcclusionTrackerTest<Types, opaqueLayers> { protected: void runMyTest() diff --git a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp index 991cddc46..634a25c7a 100644 --- a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp +++ b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp @@ -91,7 +91,7 @@ static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const Tr static void appendQuads(CCQuadList& quadList, Vector<OwnPtr<CCSharedQuadState> >& sharedStateList, CCTiledLayerImpl* layer, CCLayerIteratorType& it, CCOcclusionTrackerImpl& occlusionTracker) { occlusionTracker.enterLayer(it); - CCQuadCuller quadCuller(quadList, layer, &occlusionTracker); + CCQuadCuller quadCuller(quadList, layer, &occlusionTracker, false); OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); bool hadMissingTiles = false; layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h index c028ea725..4eb875b1e 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h @@ -161,6 +161,9 @@ public: class FakeTextureUploader : public WebCore::TextureUploader { public: + virtual bool isBusy() { return false; } + virtual void beginUploads() { } + virtual void endUploads() { } virtual void uploadTexture(WebCore::GraphicsContext3D* context, WebCore::LayerTextureUpdater::Texture* texture, WebCore::TextureAllocator* allocator, const WebCore::IntRect sourceRect, const WebCore::IntRect destRect) { texture->updateRect(context, allocator, sourceRect, destRect); } }; diff --git a/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp index f464dcbbc..b42485b71 100644 --- a/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp @@ -90,6 +90,9 @@ public: class MockTextureUploader : public TextureUploader { public: + MOCK_METHOD0(isBusy, bool()); + MOCK_METHOD0(beginUploads, void()); + MOCK_METHOD0(endUploads, void()); MOCK_METHOD5(uploadTexture, void(GraphicsContext3D*, LayerTextureUpdater::Texture*, TextureAllocator*, const IntRect, const IntRect)); }; diff --git a/Source/WebKit/chromium/tests/EventListenerTest.cpp b/Source/WebKit/chromium/tests/EventListenerTest.cpp new file mode 100644 index 000000000..799ac4007 --- /dev/null +++ b/Source/WebKit/chromium/tests/EventListenerTest.cpp @@ -0,0 +1,251 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "FrameTestHelpers.h" +#include "WebDOMEvent.h" +#include "WebDOMEventListener.h" +#include "WebDOMMutationEvent.h" +#include "WebDocument.h" +#include "WebElement.h" +#include "WebFrame.h" +#include "WebScriptSource.h" +#include "WebView.h" +#include <gtest/gtest.h> +#include <webkit/support/webkit_support.h> + +using namespace WebKit; + +namespace { + +class TestWebDOMEventListener : public WebDOMEventListener { +public: + TestWebDOMEventListener() { } + virtual ~TestWebDOMEventListener() { } + + virtual void handleEvent(const WebDOMEvent& event) OVERRIDE + { + m_events.push_back(event); + } + + size_t eventCount() const { return m_events.size(); } + + WebDOMEvent eventAt(int index) const { return m_events.at(index); } + + void clearEvents() { m_events.clear(); } + +private: + std::vector<WebDOMEvent> m_events; +}; + +class WebDOMEventListenerTest : public testing::Test { +public: + WebDOMEventListenerTest() + : m_webView(0) + { + } + + virtual void SetUp() OVERRIDE + { + std::string baseURL("http://www.example.com/"); + std::string fileName("listener/mutation_event_listener.html"); + bool executeScript = true; + FrameTestHelpers::registerMockedURLLoad(baseURL, fileName); + m_webView = FrameTestHelpers::createWebViewAndLoad(baseURL + fileName, executeScript); + } + + virtual void TearDown() OVERRIDE + { + m_webView->close(); + webkit_support::UnregisterAllMockedURLs(); + } + + WebFrame* mainFrame() const + { + return m_webView->mainFrame(); + } + + WebDocument document() const + { + return mainFrame()->document(); + } + + void executeScript(const char* code) + { + mainFrame()->executeScript(WebScriptSource(WebString::fromUTF8(code))); + } + + + static WebString GetNodeID(const WebNode& node) + { + if (node.nodeType() != WebNode::ElementNode) + return WebString(); + WebElement element = node.toConst<WebElement>(); + return element.getAttribute("id"); + } + +protected: + WebView* m_webView; +}; + + +// Tests that the right mutation events are fired when a node is added/removed. +// Note that the DOMSubtreeModified event is fairly vage, it only tells you +// something changed for the target node. +TEST_F(WebDOMEventListenerTest, NodeAddedRemovedMutationEvent) +{ + TestWebDOMEventListener eventListener; + document().addEventListener("DOMSubtreeModified", &eventListener, false); + + // Test adding a node. + executeScript("addElement('newNode')"); + ASSERT_EQ(1U, eventListener.eventCount()); + WebDOMEvent event = eventListener.eventAt(0); + ASSERT_TRUE(event.isMutationEvent()); + // No need to check any of the MutationEvent, WebKit does not set any. + EXPECT_EQ("DIV", event.target().nodeName()); + EXPECT_EQ("topDiv", GetNodeID(event.target())); + eventListener.clearEvents(); + + // Test removing a node. + executeScript("removeNode('div1')"); + ASSERT_EQ(1U, eventListener.eventCount()); + event = eventListener.eventAt(0); + ASSERT_TRUE(event.isMutationEvent()); + EXPECT_EQ("DIV", event.target().nodeName()); + EXPECT_EQ("topDiv", GetNodeID(event.target())); +} + +// Tests the right mutation event is fired when a text node is modified. +TEST_F(WebDOMEventListenerTest, TextNodeModifiedMutationEvent) +{ + TestWebDOMEventListener eventListener; + document().addEventListener("DOMSubtreeModified", &eventListener, false); + executeScript("changeText('div2', 'Hello')"); + ASSERT_EQ(1U, eventListener.eventCount()); + WebDOMEvent event = eventListener.eventAt(0); + ASSERT_TRUE(event.isMutationEvent()); + ASSERT_EQ(WebNode::TextNode, event.target().nodeType()); +} + +// Tests the right mutation events are fired when an attribute is added/removed. +TEST_F(WebDOMEventListenerTest, AttributeMutationEvent) +{ + TestWebDOMEventListener eventListener; + document().addEventListener("DOMSubtreeModified", &eventListener, false); + executeScript("document.getElementById('div2').setAttribute('myAttr'," + "'some value')"); + ASSERT_EQ(1U, eventListener.eventCount()); + WebDOMEvent event = eventListener.eventAt(0); + ASSERT_TRUE(event.isMutationEvent()); + EXPECT_EQ("DIV", event.target().nodeName()); + EXPECT_EQ("div2", GetNodeID(event.target())); + eventListener.clearEvents(); + + executeScript("document.getElementById('div2').removeAttribute('myAttr')"); + ASSERT_EQ(1U, eventListener.eventCount()); + event = eventListener.eventAt(0); + ASSERT_TRUE(event.isMutationEvent()); + EXPECT_EQ("DIV", event.target().nodeName()); + EXPECT_EQ("div2", GetNodeID(event.target())); +} + +// Tests destroying WebDOMEventListener and triggering events, we shouldn't +// crash. +TEST_F(WebDOMEventListenerTest, FireEventDeletedListener) +{ + TestWebDOMEventListener* eventListener = new TestWebDOMEventListener(); + document().addEventListener("DOMSubtreeModified", eventListener, false); + delete eventListener; + executeScript("addElement('newNode')"); // That should fire an event. +} + +// Tests registering several events on the same WebDOMEventListener and +// triggering events. +TEST_F(WebDOMEventListenerTest, SameListenerMultipleEvents) +{ + TestWebDOMEventListener eventListener; + const WebString kDOMSubtreeModifiedType("DOMSubtreeModified"); + const WebString kDOMNodeRemovedType("DOMNodeRemoved"); + document().addEventListener(kDOMSubtreeModifiedType, &eventListener, false); + WebElement div1Elem = document().getElementById("div1"); + div1Elem.addEventListener(kDOMNodeRemovedType, &eventListener, false); + + // Trigger a DOMSubtreeModified event by adding a node. + executeScript("addElement('newNode')"); + ASSERT_EQ(1U, eventListener.eventCount()); + WebDOMEvent event = eventListener.eventAt(0); + ASSERT_TRUE(event.isMutationEvent()); + EXPECT_EQ("DIV", event.target().nodeName()); + EXPECT_EQ("topDiv", GetNodeID(event.target())); + eventListener.clearEvents(); + + // Trigger for both event listener by removing the div1 node. + executeScript("removeNode('div1')"); + ASSERT_EQ(2U, eventListener.eventCount()); + // Not sure if the order of the events is important. Assuming no specific + // order. + WebString type1 = eventListener.eventAt(0).type(); + WebString type2 = eventListener.eventAt(1).type(); + EXPECT_TRUE(type1 == kDOMSubtreeModifiedType || type1 == kDOMNodeRemovedType); + EXPECT_TRUE(type2 == kDOMSubtreeModifiedType || type2 == kDOMNodeRemovedType); + EXPECT_TRUE(type1 != type2); +} + +// Tests removing event listeners. +TEST_F(WebDOMEventListenerTest, RemoveEventListener) +{ + TestWebDOMEventListener eventListener; + const WebString kDOMSubtreeModifiedType("DOMSubtreeModified"); + // Adding twice the same listener for the same event, should be supported. + document().addEventListener(kDOMSubtreeModifiedType, &eventListener, false); + document().addEventListener(kDOMSubtreeModifiedType, &eventListener, false); + + // Add a node, that should trigger 2 events. + executeScript("addElement('newNode')"); + EXPECT_EQ(2U, eventListener.eventCount()); + eventListener.clearEvents(); + + // Remove one listener and trigger an event again. + document().removeEventListener( + kDOMSubtreeModifiedType, &eventListener, false); + executeScript("addElement('newerNode')"); + EXPECT_EQ(1U, eventListener.eventCount()); + eventListener.clearEvents(); + + // Remove the last listener and trigger yet another event. + document().removeEventListener( + kDOMSubtreeModifiedType, &eventListener, false); + executeScript("addElement('newererNode')"); + EXPECT_EQ(0U, eventListener.eventCount()); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/FrameLoaderClientImplTest.cpp b/Source/WebKit/chromium/tests/FrameLoaderClientImplTest.cpp new file mode 100644 index 000000000..8fc9e42b2 --- /dev/null +++ b/Source/WebKit/chromium/tests/FrameLoaderClientImplTest.cpp @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2011, 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "FrameLoaderClientImpl.h" + +#include "KURL.h" +#include "WebFrameClient.h" +#include "WebFrameImpl.h" +#include "WebView.h" + +#include <gtest/gtest.h> +#include <wtf/text/WTFString.h> + +using namespace WebKit; + +namespace { + +class TestWebFrameClient : public WebFrameClient { +public: + bool userAgent(const WebURL& url, WebString* userAgent) OVERRIDE + { + if (m_userAgentOverride.isEmpty()) + return false; + + *userAgent = m_userAgentOverride; + return true; + } + + void setUserAgentOverride(const WebString& userAgent) + { + m_userAgentOverride = userAgent; + } + +private: + WebString m_userAgentOverride; +}; + +class FrameLoaderClientImplTest : public testing::Test { +public: + void SetUp() + { + m_webView = WebView::create(0); + m_webView->initializeMainFrame(&m_webFrameClient); + WebFrameImpl* frame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); + m_frameLoaderClientImpl = static_cast<FrameLoaderClientImpl*>(frame->frame()->loader()->client()); + } + + void TearDown() + { + m_webView->close(); + } + + void setUserAgentOverride(const WebString& userAgent) + { + return m_webFrameClient.setUserAgentOverride(userAgent); + } + + const WebString userAgent() + { + // The test always returns the same user agent, regardless of the URL passed in. + WebCore::KURL dummyURL(WebCore::ParsedURLString, "about:blank"); + WTF::CString userAgent = m_frameLoaderClientImpl->userAgent(dummyURL).utf8(); + return WebString::fromUTF8(userAgent.data(), userAgent.length()); + } + +protected: + TestWebFrameClient m_webFrameClient; + FrameLoaderClientImpl* m_frameLoaderClientImpl; + WebView* m_webView; +}; + +TEST_F(FrameLoaderClientImplTest, UserAgentOverride) +{ + const WebString defaultUserAgent = userAgent(); + const WebString override = WebString::fromUTF8("dummy override"); + + // Override the user agent and make sure we get it back. + setUserAgentOverride(override); + EXPECT_TRUE(override.equals(userAgent())); + + // Remove the override and make sure we get the original back. + setUserAgentOverride(WebString()); + EXPECT_TRUE(defaultUserAgent.equals(userAgent())); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp b/Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp index 60331051f..eb9962d58 100644 --- a/Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp +++ b/Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp @@ -83,6 +83,20 @@ TEST(IDBLevelDBCodingTest, EncodeByte) EXPECT_EQ(expected, encodeByte(c)); } +TEST(IDBLevelDBCodingTest, EncodeBool) +{ + { + Vector<char> expected; + expected.append(1); + EXPECT_EQ(expected, encodeBool(true)); + } + { + Vector<char> expected; + expected.append(0); + EXPECT_EQ(expected, encodeBool(false)); + } +} + TEST(IDBLevelDBCodingTest, MaxIDBKey) { Vector<char> maxKey = maxIDBKey(); @@ -126,6 +140,20 @@ TEST(IDBLevelDBCodingTest, EncodeInt) EXPECT_EQ(static_cast<size_t>(4), encodeInt(0xffffffff).size()); } +TEST(IDBLevelDBCodingTest, DecodeBool) +{ + { + Vector<char> encoded; + encoded.append(1); + EXPECT_TRUE(decodeBool(encoded.data(), encoded.data() + encoded.size())); + } + { + Vector<char> encoded; + encoded.append(0); + EXPECT_FALSE(decodeBool(encoded.data(), encoded.data() + encoded.size())); + } +} + TEST(IDBLevelDBCodingTest, DecodeInt) { Vector<int64_t> testCases; diff --git a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp index ddab17564..69d0ff5ff 100644 --- a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "LayerRendererChromium.h" +#include "CCTiledLayerTestCommon.h" #include "FakeWebGraphicsContext3D.h" #include "GraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" @@ -35,6 +36,7 @@ using namespace WebCore; using namespace WebKit; +using namespace WebKitTests; class FrameCountingMemoryAllocationSettingContext : public FakeWebGraphicsContext3D { public: @@ -91,7 +93,7 @@ private: class FakeLayerRendererChromium : public LayerRendererChromium { public: - FakeLayerRendererChromium(LayerRendererChromiumClient* client, PassRefPtr<GraphicsContext3D> context) : LayerRendererChromium(client, context) { } + FakeLayerRendererChromium(LayerRendererChromiumClient* client, PassRefPtr<GraphicsContext3D> context, PassOwnPtr<TextureUploader> uploader) : LayerRendererChromium(client, context, uploader) { } // LayerRendererChromium methods. @@ -107,7 +109,7 @@ protected: , m_suggestHaveBackbufferNo(1, false) , m_context(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FrameCountingMemoryAllocationSettingContext()), GraphicsContext3D::RenderDirectlyToHostWindow)) , m_mockContext(*static_cast<FrameCountingMemoryAllocationSettingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_context.get()))) - , m_layerRendererChromium(&m_mockClient, m_context.release()) + , m_layerRendererChromium(&m_mockClient, m_context.release(), adoptPtr(new FakeTextureUploader())) { } @@ -271,7 +273,7 @@ public: TEST(LayerRendererChromiumTest2, initializationDoesNotMakeSynchronousCalls) { FakeLayerRendererChromiumClient mockClient; - FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ForbidSynchronousCallContext), GraphicsContext3D::RenderDirectlyToHostWindow)); + FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ForbidSynchronousCallContext), GraphicsContext3D::RenderDirectlyToHostWindow), adoptPtr(new FakeTextureUploader())); EXPECT_TRUE(layerRendererChromium.initialize()); } diff --git a/Source/WebKit/chromium/tests/LinkHighlightTest.cpp b/Source/WebKit/chromium/tests/LinkHighlightTest.cpp new file mode 100644 index 000000000..edcfd4a63 --- /dev/null +++ b/Source/WebKit/chromium/tests/LinkHighlightTest.cpp @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "LinkHighlight.h" + +#include "AnimationIdVendor.h" +#include "GraphicsLayerChromium.h" +#include "GraphicsLayerClient.h" +#include "IntRect.h" +#include "Path.h" +#include "TransformationMatrix.h" +#include <gtest/gtest.h> +#include <wtf/PassOwnPtr.h> + +using namespace WebCore; + +namespace { + +class MockGraphicsLayerClient : public GraphicsLayerClient { +public: + virtual void notifyAnimationStarted(const GraphicsLayer*, double time) OVERRIDE { } + virtual void notifySyncRequired(const GraphicsLayer*) OVERRIDE { } + virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip) OVERRIDE { } + virtual bool showDebugBorders(const GraphicsLayer*) const OVERRIDE { return false; } + virtual bool showRepaintCounter(const GraphicsLayer*) const OVERRIDE { return false; } +}; + +TEST(LinkHighlightTest, verifyLinkHighlightLayer) +{ + Path highlightPath; + highlightPath.addRect(FloatRect(5, 6, 12, 8)); + IntRect pathBoundingRect = enclosingIntRect(highlightPath.boundingRect()); + + RefPtr<LinkHighlight> highlight = LinkHighlight::create(0, highlightPath, AnimationIdVendor::LinkHighlightAnimationId, AnimationIdVendor::getNextGroupId()); + ASSERT_TRUE(highlight.get()); + ContentLayerChromium* contentLayer = highlight->contentLayer(); + ASSERT_TRUE(contentLayer); + + EXPECT_EQ(pathBoundingRect.size(), contentLayer->bounds()); + EXPECT_TRUE(contentLayer->transform().isIdentityOrTranslation()); + EXPECT_TRUE(contentLayer->transform().isIntegerTranslation()); + + TransformationMatrix::DecomposedType decomposition; + EXPECT_TRUE(contentLayer->transform().decompose(decomposition)); + + FloatPoint expectedTranslation(pathBoundingRect.x() + pathBoundingRect.width() / 2, pathBoundingRect.y() + pathBoundingRect.height() / 2); + EXPECT_EQ(FloatPoint(decomposition.translateX, decomposition.translateY), expectedTranslation); +} + +TEST(LinkHighlightTest, verifyGraphicsLayerChromiumEmbedding) +{ + MockGraphicsLayerClient client; + OwnPtr<GraphicsLayerChromium> graphicsLayer = static_pointer_cast<GraphicsLayerChromium>(GraphicsLayer::create(&client)); + ASSERT_TRUE(graphicsLayer.get()); + + Path highlightPath; + highlightPath.addRect(FloatRect(5, 5, 10, 8)); + + // Neither of the following operations should crash. + graphicsLayer->addLinkHighlight(highlightPath); + graphicsLayer->didFinishLinkHighlight(); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/ListenerLeakTest.cpp b/Source/WebKit/chromium/tests/ListenerLeakTest.cpp new file mode 100644 index 000000000..5e321c70d --- /dev/null +++ b/Source/WebKit/chromium/tests/ListenerLeakTest.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "FrameTestHelpers.h" +#include "WebView.h" +#include <gtest/gtest.h> +#include <v8/include/v8-profiler.h> +#include <v8/include/v8.h> +#include <webkit/support/webkit_support.h> + +using namespace WebKit; + +namespace { + +const v8::HeapGraphNode* GetProperty(const v8::HeapGraphNode* node, v8::HeapGraphEdge::Type type, const char* name) +{ + for (int i = 0, count = node->GetChildrenCount(); i < count; ++i) { + const v8::HeapGraphEdge* prop = node->GetChild(i); + if (prop->GetType() == type) { + v8::String::AsciiValue propName(prop->GetName()); + if (!strcmp(name, *propName)) + return prop->GetToNode(); + } + } + return 0; +} + +int GetNumObjects(const char* constructor) +{ + v8::HandleScope scope; + const v8::HeapSnapshot* snapshot = v8::HeapProfiler::TakeSnapshot(v8::String::New(""), v8::HeapSnapshot::kFull); + if (!snapshot) + return -1; + int count = 0; + for (int i = 0; i < snapshot->GetNodesCount(); ++i) { + const v8::HeapGraphNode* node = snapshot->GetNode(i); + if (node->GetType() != v8::HeapGraphNode::kObject) + continue; + v8::String::AsciiValue nodeName(node->GetName()); + if (!strcmp(constructor, *nodeName)) { + const v8::HeapGraphNode* constructorProp = GetProperty(node, v8::HeapGraphEdge::kProperty, "constructor"); + // Skip an Object instance named after the constructor. + if (constructorProp) { + v8::String::AsciiValue constructorName(constructorProp->GetName()); + if (!strcmp(constructor, *constructorName)) + continue; + } + ++count; + } + } + return count; +} + + +class ListenerLeakTest : public testing::Test { +public: + ListenerLeakTest() : m_webView(0) { } + + void RunTest(const std::string& filename) + { + std::string baseURL("http://www.example.com/"); + std::string fileName(filename); + bool executeScript = true; + FrameTestHelpers::registerMockedURLLoad(baseURL, fileName); + m_webView = FrameTestHelpers::createWebViewAndLoad(baseURL + fileName, executeScript); + } + + virtual void TearDown() OVERRIDE + { + if (m_webView) + m_webView->close(); + webkit_support::UnregisterAllMockedURLs(); + } + +protected: + WebView* m_webView; +}; + + +// This test tries to create a reference cycle between node and its listener. +// See http://crbug/17400. +TEST_F(ListenerLeakTest, ReferenceCycle) +{ + RunTest("listener/listener_leak1.html"); + ASSERT_EQ(0, GetNumObjects("EventListenerLeakTestObject1")); +} + +// This test sets node onclick many times to expose a possible memory +// leak where all listeners get referenced by the node. +TEST_F(ListenerLeakTest, HiddenReferences) +{ + RunTest("listener/listener_leak2.html"); + ASSERT_EQ(1, GetNumObjects("EventListenerLeakTestObject2")); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/MockCCQuadCuller.h b/Source/WebKit/chromium/tests/MockCCQuadCuller.h index d9cd31326..385507e2c 100644 --- a/Source/WebKit/chromium/tests/MockCCQuadCuller.h +++ b/Source/WebKit/chromium/tests/MockCCQuadCuller.h @@ -35,12 +35,12 @@ namespace WebCore { class MockCCQuadCuller : public WebCore::CCQuadCuller { public: MockCCQuadCuller() - : CCQuadCuller(m_quadListStorage, 0, 0) + : CCQuadCuller(m_quadListStorage, 0, 0, false) , m_activeQuadList(m_quadListStorage) { } explicit MockCCQuadCuller(CCQuadList& externalQuadList) - : CCQuadCuller(externalQuadList, 0, 0) + : CCQuadCuller(externalQuadList, 0, 0, false) , m_activeQuadList(externalQuadList) { } diff --git a/Source/WebKit/chromium/tests/RegionTest.cpp b/Source/WebKit/chromium/tests/RegionTest.cpp index d202ab40c..105d1c3ed 100644 --- a/Source/WebKit/chromium/tests/RegionTest.cpp +++ b/Source/WebKit/chromium/tests/RegionTest.cpp @@ -124,4 +124,271 @@ TEST(RegionTest, emptySpan) EXPECT_FALSE(rects[i].isEmpty()); } +#define TEST_NO_INTERSECT(a, b) \ +{ \ + Region ar = a; \ + Region br = b; \ + EXPECT_FALSE(ar.intersects(br)); \ + EXPECT_FALSE(br.intersects(ar)); \ +} + +#define TEST_INTERSECT(a, b) \ +{ \ + Region ar = a; \ + Region br = b; \ + EXPECT_TRUE(ar.intersects(br)); \ + EXPECT_TRUE(br.intersects(ar)); \ +} + +TEST(RegionTest, intersectsRegion) +{ + Region r; + + TEST_NO_INTERSECT(IntRect(), IntRect()); + TEST_NO_INTERSECT(IntRect(), IntRect(0, 0, 1, 1)); + TEST_NO_INTERSECT(IntRect(), IntRect(1, 1, 1, 1)); + + r.unite(IntRect(0, 0, 1, 1)); + TEST_NO_INTERSECT(r, IntRect()); + TEST_INTERSECT(r, IntRect(0, 0, 1, 1)); + TEST_INTERSECT(r, IntRect(0, 0, 2, 2)); + TEST_INTERSECT(r, IntRect(-1, 0, 2, 2)); + TEST_INTERSECT(r, IntRect(-1, -1, 2, 2)); + TEST_INTERSECT(r, IntRect(0, -1, 2, 2)); + TEST_INTERSECT(r, IntRect(-1, -1, 3, 3)); + + r.unite(IntRect(0, 0, 3, 3)); + r.unite(IntRect(10, 0, 3, 3)); + r.unite(IntRect(0, 10, 13, 3)); + TEST_NO_INTERSECT(r, IntRect()); + TEST_INTERSECT(r, IntRect(1, 1, 1, 1)); + TEST_INTERSECT(r, IntRect(0, 0, 2, 2)); + TEST_INTERSECT(r, IntRect(1, 0, 2, 2)); + TEST_INTERSECT(r, IntRect(1, 1, 2, 2)); + TEST_INTERSECT(r, IntRect(0, 1, 2, 2)); + TEST_INTERSECT(r, IntRect(0, 0, 3, 3)); + TEST_INTERSECT(r, IntRect(-1, -1, 2, 2)); + TEST_INTERSECT(r, IntRect(2, -1, 2, 2)); + TEST_INTERSECT(r, IntRect(2, 2, 2, 2)); + TEST_INTERSECT(r, IntRect(-1, 2, 2, 2)); + + TEST_INTERSECT(r, IntRect(11, 1, 1, 1)); + TEST_INTERSECT(r, IntRect(10, 0, 2, 2)); + TEST_INTERSECT(r, IntRect(11, 0, 2, 2)); + TEST_INTERSECT(r, IntRect(11, 1, 2, 2)); + TEST_INTERSECT(r, IntRect(10, 1, 2, 2)); + TEST_INTERSECT(r, IntRect(10, 0, 3, 3)); + TEST_INTERSECT(r, IntRect(9, -1, 2, 2)); + TEST_INTERSECT(r, IntRect(12, -1, 2, 2)); + TEST_INTERSECT(r, IntRect(12, 2, 2, 2)); + TEST_INTERSECT(r, IntRect(9, 2, 2, 2)); + + TEST_INTERSECT(r, IntRect(0, -1, 13, 5)); + TEST_INTERSECT(r, IntRect(1, -1, 11, 5)); + TEST_INTERSECT(r, IntRect(2, -1, 9, 5)); + TEST_INTERSECT(r, IntRect(2, -1, 8, 5)); + TEST_INTERSECT(r, IntRect(3, -1, 8, 5)); + TEST_NO_INTERSECT(r, IntRect(3, -1, 7, 5)); + + TEST_INTERSECT(r, IntRect(0, 1, 13, 1)); + TEST_INTERSECT(r, IntRect(1, 1, 11, 1)); + TEST_INTERSECT(r, IntRect(2, 1, 9, 1)); + TEST_INTERSECT(r, IntRect(2, 1, 8, 1)); + TEST_INTERSECT(r, IntRect(3, 1, 8, 1)); + TEST_NO_INTERSECT(r, IntRect(3, 1, 7, 1)); + + TEST_INTERSECT(r, IntRect(0, 0, 13, 13)); + TEST_INTERSECT(r, IntRect(0, 1, 13, 11)); + TEST_INTERSECT(r, IntRect(0, 2, 13, 9)); + TEST_INTERSECT(r, IntRect(0, 2, 13, 8)); + TEST_INTERSECT(r, IntRect(0, 3, 13, 8)); + TEST_NO_INTERSECT(r, IntRect(0, 3, 13, 7)); +} + +TEST(RegionTest, ReadPastFullSpanVectorInIntersectsTest) +{ + Region r; + + // This region has enough spans to fill its allocated Vector exactly. + r.unite(IntRect(400, 300, 1, 800)); + r.unite(IntRect(785, 585, 1, 1)); + r.unite(IntRect(787, 585, 1, 1)); + r.unite(IntRect(0, 587, 16, 162)); + r.unite(IntRect(26, 590, 300, 150)); + r.unite(IntRect(196, 750, 1, 1)); + r.unite(IntRect(0, 766, 1, 1)); + r.unite(IntRect(0, 782, 1, 1)); + r.unite(IntRect(745, 798, 1, 1)); + r.unite(IntRect(795, 882, 10, 585)); + r.unite(IntRect(100, 1499, 586, 1)); + r.unite(IntRect(100, 1500, 585, 784)); + // This query rect goes past the bottom of the Region, causing the + // test to reach the last span and try go past it. It should not read + // memory off the end of the span Vector. + TEST_NO_INTERSECT(r, IntRect(0, 2184, 1, 150)); +} + +#define TEST_NO_CONTAINS(a, b) \ +{ \ + Region ar = a; \ + Region br = b; \ + EXPECT_FALSE(ar.contains(br)); \ +} + +#define TEST_CONTAINS(a, b) \ +{ \ + Region ar = a; \ + Region br = b; \ + EXPECT_TRUE(ar.contains(br)); \ +} + +TEST(RegionTest, containsRegion) +{ + TEST_CONTAINS(IntRect(), IntRect()); + TEST_NO_CONTAINS(IntRect(), IntRect(0, 0, 1, 1)); + TEST_NO_CONTAINS(IntRect(), IntRect(1, 1, 1, 1)); + + TEST_NO_CONTAINS(IntRect(10, 10, 1, 1), IntRect(11, 10, 1, 1)); + TEST_NO_CONTAINS(IntRect(10, 10, 1, 1), IntRect(10, 11, 1, 1)); + TEST_NO_CONTAINS(IntRect(10, 10, 1, 1), IntRect(9, 10, 1, 1)); + TEST_NO_CONTAINS(IntRect(10, 10, 1, 1), IntRect(10, 9, 1, 1)); + TEST_NO_CONTAINS(IntRect(10, 10, 1, 1), IntRect(9, 9, 2, 2)); + TEST_NO_CONTAINS(IntRect(10, 10, 1, 1), IntRect(10, 9, 2, 2)); + TEST_NO_CONTAINS(IntRect(10, 10, 1, 1), IntRect(9, 10, 2, 2)); + TEST_NO_CONTAINS(IntRect(10, 10, 1, 1), IntRect(10, 10, 2, 2)); + TEST_NO_CONTAINS(IntRect(10, 10, 1, 1), IntRect(9, 9, 3, 3)); + + Region hLines; + for (int i = 10; i < 20; i += 2) + hLines.unite(IntRect(i, 10, 1, 10)); + + TEST_CONTAINS(IntRect(10, 10, 9, 10), hLines); + TEST_NO_CONTAINS(IntRect(10, 10, 9, 9), hLines); + TEST_NO_CONTAINS(IntRect(10, 11, 9, 9), hLines); + TEST_NO_CONTAINS(IntRect(10, 10, 8, 10), hLines); + TEST_NO_CONTAINS(IntRect(11, 10, 8, 10), hLines); + + Region vLines; + for (int i = 10; i < 20; i += 2) + vLines.unite(IntRect(10, i, 10, 1)); + + TEST_CONTAINS(IntRect(10, 10, 10, 9), vLines); + TEST_NO_CONTAINS(IntRect(10, 10, 9, 9), vLines); + TEST_NO_CONTAINS(IntRect(11, 10, 9, 9), vLines); + TEST_NO_CONTAINS(IntRect(10, 10, 10, 8), vLines); + TEST_NO_CONTAINS(IntRect(10, 11, 10, 8), vLines); + + Region grid; + for (int i = 10; i < 20; i += 2) + for (int j = 10; j < 20; j += 2) + grid.unite(IntRect(i, j, 1, 1)); + + TEST_CONTAINS(IntRect(10, 10, 9, 9), grid); + TEST_NO_CONTAINS(IntRect(10, 10, 9, 8), grid); + TEST_NO_CONTAINS(IntRect(10, 11, 9, 8), grid); + TEST_NO_CONTAINS(IntRect(10, 10, 8, 9), grid); + TEST_NO_CONTAINS(IntRect(11, 10, 8, 9), grid); + + TEST_CONTAINS(hLines, hLines); + TEST_CONTAINS(vLines, vLines); + TEST_NO_CONTAINS(vLines, hLines); + TEST_NO_CONTAINS(hLines, vLines); + TEST_CONTAINS(grid, grid); + TEST_CONTAINS(hLines, grid); + TEST_CONTAINS(vLines, grid); + TEST_NO_CONTAINS(grid, hLines); + TEST_NO_CONTAINS(grid, vLines); + + for (int i = 10; i < 20; i += 2) + TEST_CONTAINS(hLines, IntRect(i, 10, 1, 10)); + + for (int i = 10; i < 20; i += 2) + TEST_CONTAINS(vLines, IntRect(10, i, 10, 1)); + + for (int i = 10; i < 20; i += 2) + for (int j = 10; j < 20; j += 2) + TEST_CONTAINS(grid, IntRect(i, j, 1, 1)); + + Region container; + container.unite(IntRect(0, 0, 40, 20)); + container.unite(IntRect(0, 20, 41, 20)); + TEST_CONTAINS(container, IntRect(5, 5, 30, 30)); + + container = Region(); + container.unite(IntRect(0, 0, 10, 10)); + container.unite(IntRect(0, 30, 10, 10)); + container.unite(IntRect(30, 30, 10, 10)); + container.unite(IntRect(30, 0, 10, 10)); + TEST_NO_CONTAINS(container, IntRect(5, 5, 30, 30)); + + container = Region(); + container.unite(IntRect(0, 0, 10, 10)); + container.unite(IntRect(0, 30, 10, 10)); + container.unite(IntRect(30, 0, 10, 40)); + TEST_NO_CONTAINS(container, IntRect(5, 5, 30, 30)); + + container = Region(); + container.unite(IntRect(30, 0, 10, 10)); + container.unite(IntRect(30, 30, 10, 10)); + container.unite(IntRect(0, 0, 10, 40)); + TEST_NO_CONTAINS(container, IntRect(5, 5, 30, 30)); + + container = Region(); + container.unite(IntRect(0, 0, 10, 40)); + container.unite(IntRect(30, 0, 10, 40)); + TEST_NO_CONTAINS(container, IntRect(5, 5, 30, 30)); + + container = Region(); + container.unite(IntRect(0, 0, 40, 40)); + TEST_NO_CONTAINS(container, IntRect(10, -1, 20, 10)); + + container = Region(); + container.unite(IntRect(0, 0, 40, 40)); + TEST_NO_CONTAINS(container, IntRect(10, 31, 20, 10)); + + container = Region(); + container.unite(IntRect(0, 0, 40, 20)); + container.unite(IntRect(0, 20, 41, 20)); + TEST_NO_CONTAINS(container, IntRect(-1, 10, 10, 20)); + + container = Region(); + container.unite(IntRect(0, 0, 40, 20)); + container.unite(IntRect(0, 20, 41, 20)); + TEST_NO_CONTAINS(container, IntRect(31, 10, 10, 20)); + + container = Region(); + container.unite(IntRect(0, 0, 40, 40)); + container.subtract(IntRect(0, 20, 60, 0)); + TEST_NO_CONTAINS(container, IntRect(31, 10, 10, 20)); +} + +TEST(RegionTest, unite) +{ + Region r; + Region r2; + + // A rect uniting a contained rect does not change the region. + r2 = r = IntRect(0, 0, 50, 50); + r2.unite(IntRect(20, 20, 10, 10)); + EXPECT_EQ(r, r2); + + // A rect uniting a containing rect gives back the containing rect. + r = IntRect(0, 0, 50, 50); + r.unite(IntRect(0, 0, 100, 100)); + EXPECT_EQ(Region(IntRect(0, 0, 100, 100)), r); + + // A complex region uniting a contained rect does not change the region. + r = IntRect(0, 0, 50, 50); + r.unite(IntRect(100, 0, 50, 50)); + r2 = r; + r2.unite(IntRect(20, 20, 10, 10)); + EXPECT_EQ(r, r2); + + // A complex region uniting a containing rect gives back the containing rect. + r = IntRect(0, 0, 50, 50); + r.unite(IntRect(100, 0, 50, 50)); + r. unite(IntRect(0, 0, 500, 500)); + EXPECT_EQ(Region(IntRect(0, 0, 500, 500)), r); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp new file mode 100644 index 000000000..b60017fd9 --- /dev/null +++ b/Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp @@ -0,0 +1,136 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "TextureLayerChromium.h" + +#include "FakeCCLayerTreeHostClient.h" +#include "WebCompositor.h" +#include "cc/CCLayerTreeHost.h" +#include <gmock/gmock.h> +#include <gtest/gtest.h> + +using namespace WebCore; +using ::testing::Mock; +using ::testing::_; +using ::testing::AtLeast; +using ::testing::AnyNumber; + +namespace { + +class MockCCLayerTreeHost : public CCLayerTreeHost { +public: + MockCCLayerTreeHost() + : CCLayerTreeHost(&m_fakeClient, CCSettings()) + { + initialize(); + } + + MOCK_METHOD0(acquireLayerTextures, void()); + +private: + FakeCCLayerTreeHostClient m_fakeClient; +}; + + +class TextureLayerChromiumTest : public testing::Test { +protected: + virtual void SetUp() + { + // Initialize without threading support. + WebKit::WebCompositor::initialize(0); + m_layerTreeHost = adoptPtr(new MockCCLayerTreeHost); + } + + virtual void TearDown() + { + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AnyNumber()); + + m_layerTreeHost->setRootLayer(0); + m_layerTreeHost.clear(); + WebKit::WebCompositor::shutdown(); + } + + OwnPtr<MockCCLayerTreeHost> m_layerTreeHost; +}; + +TEST_F(TextureLayerChromiumTest, syncImplWhenChangingTextureId) +{ + RefPtr<TextureLayerChromium> testLayer = TextureLayerChromium::create(0); + ASSERT_TRUE(testLayer); + + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AnyNumber()); + m_layerTreeHost->setRootLayer(testLayer); + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); + EXPECT_EQ(testLayer->layerTreeHost(), m_layerTreeHost.get()); + + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); + testLayer->setTextureId(1); + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); + + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AtLeast(1)); + testLayer->setTextureId(2); + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); + + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AtLeast(1)); + testLayer->setTextureId(0); + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); +} + +TEST_F(TextureLayerChromiumTest, syncImplWhenRemovingFromTree) +{ + RefPtr<LayerChromium> rootLayer = LayerChromium::create(); + ASSERT_TRUE(rootLayer); + RefPtr<LayerChromium> childLayer = LayerChromium::create(); + ASSERT_TRUE(childLayer); + rootLayer->addChild(childLayer); + RefPtr<TextureLayerChromium> testLayer = TextureLayerChromium::create(0); + ASSERT_TRUE(testLayer); + testLayer->setTextureId(0); + childLayer->addChild(testLayer); + + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AnyNumber()); + m_layerTreeHost->setRootLayer(rootLayer); + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); + + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); + testLayer->removeFromParent(); + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); + + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); + childLayer->addChild(testLayer); + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); + + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); + testLayer->setTextureId(1); + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); + + EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AtLeast(1)); + testLayer->removeFromParent(); + Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); +} + +} // anonymous namespace diff --git a/Source/WebKit/chromium/tests/ThrottledTextureUploaderTest.cpp b/Source/WebKit/chromium/tests/ThrottledTextureUploaderTest.cpp new file mode 100644 index 000000000..4b0dfd059 --- /dev/null +++ b/Source/WebKit/chromium/tests/ThrottledTextureUploaderTest.cpp @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "ThrottledTextureUploader.h" + +#include "FakeWebGraphicsContext3D.h" +#include "GraphicsContext3DPrivate.h" + +#include <gmock/gmock.h> +#include <gtest/gtest.h> +#include <wtf/RefPtr.h> + +using namespace WebCore; +using namespace WebKit; + +namespace { + +class FakeWebGraphicsContext3DWithQueryTesting : public FakeWebGraphicsContext3D { +public: + FakeWebGraphicsContext3DWithQueryTesting() : m_resultAvailable(0) + { + } + + virtual void getQueryObjectuivEXT(WebGLId, GC3Denum type, GC3Duint* value) + { + switch (type) { + case Extensions3DChromium::QUERY_RESULT_AVAILABLE_EXT: + *value = m_resultAvailable; + break; + default: + *value = 0; + break; + } + } + + void setResultAvailable(unsigned resultAvailable) { m_resultAvailable = resultAvailable; } + +private: + unsigned m_resultAvailable; +}; + +TEST(ThrottledTextureUploaderTest, IsBusy) +{ + GraphicsContext3D::Attributes attrs; + RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DWithQueryTesting()), GraphicsContext3D::RenderDirectlyToHostWindow); + FakeWebGraphicsContext3DWithQueryTesting& fakeContext = *static_cast<FakeWebGraphicsContext3DWithQueryTesting*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get())); + OwnPtr<ThrottledTextureUploader> uploader = ThrottledTextureUploader::create(context, 2); + + fakeContext.setResultAvailable(0); + EXPECT_FALSE(uploader->isBusy()); + uploader->beginUploads(); + uploader->endUploads(); + EXPECT_FALSE(uploader->isBusy()); + uploader->beginUploads(); + uploader->endUploads(); + EXPECT_TRUE(uploader->isBusy()); + + fakeContext.setResultAvailable(1); + EXPECT_FALSE(uploader->isBusy()); + uploader->beginUploads(); + uploader->endUploads(); + EXPECT_FALSE(uploader->isBusy()); + uploader->beginUploads(); + uploader->endUploads(); + EXPECT_FALSE(uploader->isBusy()); + uploader->beginUploads(); + uploader->endUploads(); +} + +} // namespace diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index 5b7cb0df7..c9125a852 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -957,7 +957,7 @@ TEST(TiledLayerChromiumTest, partialUpdates) } ccLayerTreeHost->commitComplete(); - // Partail update of 6 checkerboard tiles. + // Partial update of 6 checkerboard tiles. layer->invalidateRect(IntRect(50, 50, 200, 100)); { DebugScopedSetImplThread implThread; @@ -975,6 +975,20 @@ TEST(TiledLayerChromiumTest, partialUpdates) } ccLayerTreeHost->commitComplete(); + // Partial update of 4 tiles. + layer->invalidateRect(IntRect(50, 50, 100, 100)); + { + DebugScopedSetImplThread implThread; + OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0))); + ccLayerTreeHost->updateLayers(updater); + updater.update(0, &allocator, &copier, &uploader, 4); + EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); + EXPECT_FALSE(updater.hasMoreUpdates()); + layer->fakeLayerTextureUpdater()->clearUpdateCount(); + layer->pushPropertiesTo(layerImpl.get()); + } + ccLayerTreeHost->commitComplete(); + ccLayerTreeHost->setRootLayer(0); ccLayerTreeHost.clear(); WebKit::WebCompositor::shutdown(); diff --git a/Source/WebKit/chromium/tests/TilingDataTest.cpp b/Source/WebKit/chromium/tests/TilingDataTest.cpp index 47c0361ea..060bc7767 100755 --- a/Source/WebKit/chromium/tests/TilingDataTest.cpp +++ b/Source/WebKit/chromium/tests/TilingDataTest.cpp @@ -30,6 +30,7 @@ #include "config.h" +#include "IntSize.h" #include "TilingData.h" #include <wtf/Assertions.h> @@ -41,8 +42,8 @@ namespace { class TestTiling : public TilingData { public: - TestTiling(int maxTextureSize, int totalSizeX, int totalSizeY, bool hasBorderTexels) - : TilingData(maxTextureSize, totalSizeX, totalSizeY, hasBorderTexels) + TestTiling(IntSize maxTextureSize, IntSize totalSize, bool hasBorderTexels) + : TilingData(maxTextureSize, totalSize, hasBorderTexels) { } @@ -62,402 +63,413 @@ public: TEST(TilingDataTest, numTiles_NoTiling) { - EXPECT_EQ(1, TestTiling(16, 16, 16, false).numTiles()); - EXPECT_EQ(1, TestTiling(16, 15, 15, true).numTiles()); - EXPECT_EQ(1, TestTiling(16, 16, 16, true).numTiles()); - EXPECT_EQ(1, TestTiling(16, 1, 16, false).numTiles()); - EXPECT_EQ(1, TestTiling(15, 15, 15, true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(16, 16), IntSize(16, 16), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(16, 16), IntSize(15, 15), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(16, 16), IntSize(16, 16), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(16, 16), IntSize(1, 16), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(15, 15), IntSize(15, 15), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(32, 16), IntSize(32, 16), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(32, 16), IntSize(32, 16), true).numTiles()); } TEST(TilingDataTest, numTiles_TilingNoBorders) { - EXPECT_EQ(0, TestTiling(0, 0, 0, false).numTiles()); - EXPECT_EQ(0, TestTiling(0, 4, 0, false).numTiles()); - EXPECT_EQ(0, TestTiling(0, 0, 4, false).numTiles()); - EXPECT_EQ(0, TestTiling(4, 4, 0, false).numTiles()); - EXPECT_EQ(0, TestTiling(4, 0, 4, false).numTiles()); - EXPECT_EQ(0, TestTiling(-8, 1, 1, false).numTiles()); - EXPECT_EQ(0, TestTiling(-1, 1, 1, false).numTiles()); - EXPECT_EQ(0, TestTiling(0, 1, 1, false).numTiles()); - - EXPECT_EQ(1, TestTiling(1, 1, 1, false).numTiles()); - EXPECT_EQ(2, TestTiling(1, 1, 2, false).numTiles()); - EXPECT_EQ(2, TestTiling(1, 2, 1, false).numTiles()); - EXPECT_EQ(1, TestTiling(2, 1, 1, false).numTiles()); - EXPECT_EQ(1, TestTiling(2, 1, 2, false).numTiles()); - EXPECT_EQ(1, TestTiling(2, 2, 1, false).numTiles()); - EXPECT_EQ(1, TestTiling(2, 2, 2, false).numTiles()); - EXPECT_EQ(1, TestTiling(3, 3, 3, false).numTiles()); - - EXPECT_EQ(1, TestTiling(4, 1, 4, false).numTiles()); - EXPECT_EQ(1, TestTiling(4, 2, 4, false).numTiles()); - EXPECT_EQ(1, TestTiling(4, 3, 4, false).numTiles()); - EXPECT_EQ(1, TestTiling(4, 4, 4, false).numTiles()); - EXPECT_EQ(2, TestTiling(4, 5, 4, false).numTiles()); - EXPECT_EQ(2, TestTiling(4, 6, 4, false).numTiles()); - EXPECT_EQ(2, TestTiling(4, 7, 4, false).numTiles()); - EXPECT_EQ(2, TestTiling(4, 8, 4, false).numTiles()); - EXPECT_EQ(3, TestTiling(4, 9, 4, false).numTiles()); - EXPECT_EQ(3, TestTiling(4, 10, 4, false).numTiles()); - EXPECT_EQ(3, TestTiling(4, 11, 4, false).numTiles()); - - EXPECT_EQ(1, TestTiling(5, 1, 5, false).numTiles()); - EXPECT_EQ(1, TestTiling(5, 2, 5, false).numTiles()); - EXPECT_EQ(1, TestTiling(5, 3, 5, false).numTiles()); - EXPECT_EQ(1, TestTiling(5, 4, 5, false).numTiles()); - EXPECT_EQ(1, TestTiling(5, 5, 5, false).numTiles()); - EXPECT_EQ(2, TestTiling(5, 6, 5, false).numTiles()); - EXPECT_EQ(2, TestTiling(5, 7, 5, false).numTiles()); - EXPECT_EQ(2, TestTiling(5, 8, 5, false).numTiles()); - EXPECT_EQ(2, TestTiling(5, 9, 5, false).numTiles()); - EXPECT_EQ(2, TestTiling(5, 10, 5, false).numTiles()); - EXPECT_EQ(3, TestTiling(5, 11, 5, false).numTiles()); - - EXPECT_EQ(1, TestTiling(16, 16, 16, false).numTiles()); - EXPECT_EQ(1, TestTiling(17, 16, 16, false).numTiles()); - EXPECT_EQ(4, TestTiling(15, 16, 16, false).numTiles()); - EXPECT_EQ(4, TestTiling(8, 16, 16, false).numTiles()); - EXPECT_EQ(6, TestTiling(8, 17, 16, false).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(0, 0), IntSize(0, 0), false).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(0, 0), IntSize(4, 0), false).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(0, 0), IntSize(0, 4), false).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(4, 4), IntSize(4, 0), false).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(4, 4), IntSize(0, 4), false).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(-8, -8), IntSize(1, 1), false).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(-1, -1), IntSize(1, 1), false).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(0, 0), IntSize(1, 1), false).numTiles()); + + EXPECT_EQ(1, TestTiling(IntSize(1, 1), IntSize(1, 1), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(1, 1), IntSize(1, 2), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(1, 1), IntSize(2, 1), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(2, 2), IntSize(1, 1), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(2, 2), IntSize(1, 2), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(2, 2), IntSize(2, 1), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(2, 2), IntSize(2, 2), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(3, 3), false).numTiles()); + + EXPECT_EQ(1, TestTiling(IntSize(4, 4), IntSize(1, 4), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(4, 4), IntSize(2, 4), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(4, 4), IntSize(3, 4), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(4, 4), IntSize(4, 4), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(4, 4), IntSize(5, 4), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(4, 4), IntSize(6, 4), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(4, 4), IntSize(7, 4), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(4, 4), IntSize(8, 4), false).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(4, 4), IntSize(9, 4), false).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(4, 4), IntSize(10, 4), false).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(4, 4), IntSize(11, 4), false).numTiles()); + + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(1, 5), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(2, 5), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(3, 5), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(4, 5), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(5, 5), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(6, 5), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(7, 5), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(8, 5), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(9, 5), false).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(10, 5), false).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(11, 5), false).numTiles()); + + EXPECT_EQ(1, TestTiling(IntSize(16, 16), IntSize(16, 16), false).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(17, 17), IntSize(16, 16), false).numTiles()); + EXPECT_EQ(4, TestTiling(IntSize(15, 15), IntSize(16, 16), false).numTiles()); + EXPECT_EQ(4, TestTiling(IntSize(8, 8), IntSize(16, 16), false).numTiles()); + EXPECT_EQ(6, TestTiling(IntSize(8, 8), IntSize(17, 16), false).numTiles()); + + EXPECT_EQ(8, TestTiling(IntSize(5, 8), IntSize(17, 16), false).numTiles()); } TEST(TilingDataTest, numTiles_TilingWithBorders) { - EXPECT_EQ(0, TestTiling(0, 0, 0, true).numTiles()); - EXPECT_EQ(0, TestTiling(0, 4, 0, true).numTiles()); - EXPECT_EQ(0, TestTiling(0, 0, 4, true).numTiles()); - EXPECT_EQ(0, TestTiling(4, 4, 0, true).numTiles()); - EXPECT_EQ(0, TestTiling(4, 0, 4, true).numTiles()); - EXPECT_EQ(0, TestTiling(-8, 1, 1, true).numTiles()); - EXPECT_EQ(0, TestTiling(-1, 1, 1, true).numTiles()); - EXPECT_EQ(0, TestTiling(0, 1, 1, true).numTiles()); - - EXPECT_EQ(1, TestTiling(1, 1, 1, true).numTiles()); - EXPECT_EQ(0, TestTiling(1, 1, 2, true).numTiles()); - EXPECT_EQ(0, TestTiling(1, 2, 1, true).numTiles()); - EXPECT_EQ(1, TestTiling(2, 1, 1, true).numTiles()); - EXPECT_EQ(1, TestTiling(2, 1, 2, true).numTiles()); - EXPECT_EQ(1, TestTiling(2, 2, 1, true).numTiles()); - EXPECT_EQ(1, TestTiling(2, 2, 2, true).numTiles()); - - EXPECT_EQ(1, TestTiling(3, 1, 3, true).numTiles()); - EXPECT_EQ(1, TestTiling(3, 2, 3, true).numTiles()); - EXPECT_EQ(1, TestTiling(3, 3, 3, true).numTiles()); - EXPECT_EQ(2, TestTiling(3, 4, 3, true).numTiles()); - EXPECT_EQ(3, TestTiling(3, 5, 3, true).numTiles()); - EXPECT_EQ(4, TestTiling(3, 6, 3, true).numTiles()); - EXPECT_EQ(5, TestTiling(3, 7, 3, true).numTiles()); - - EXPECT_EQ(1, TestTiling(4, 1, 4, true).numTiles()); - EXPECT_EQ(1, TestTiling(4, 2, 4, true).numTiles()); - EXPECT_EQ(1, TestTiling(4, 3, 4, true).numTiles()); - EXPECT_EQ(1, TestTiling(4, 4, 4, true).numTiles()); - EXPECT_EQ(2, TestTiling(4, 5, 4, true).numTiles()); - EXPECT_EQ(2, TestTiling(4, 6, 4, true).numTiles()); - EXPECT_EQ(3, TestTiling(4, 7, 4, true).numTiles()); - EXPECT_EQ(3, TestTiling(4, 8, 4, true).numTiles()); - EXPECT_EQ(4, TestTiling(4, 9, 4, true).numTiles()); - EXPECT_EQ(4, TestTiling(4, 10, 4, true).numTiles()); - EXPECT_EQ(5, TestTiling(4, 11, 4, true).numTiles()); - - EXPECT_EQ(1, TestTiling(5, 1, 5, true).numTiles()); - EXPECT_EQ(1, TestTiling(5, 2, 5, true).numTiles()); - EXPECT_EQ(1, TestTiling(5, 3, 5, true).numTiles()); - EXPECT_EQ(1, TestTiling(5, 4, 5, true).numTiles()); - EXPECT_EQ(1, TestTiling(5, 5, 5, true).numTiles()); - EXPECT_EQ(2, TestTiling(5, 6, 5, true).numTiles()); - EXPECT_EQ(2, TestTiling(5, 7, 5, true).numTiles()); - EXPECT_EQ(2, TestTiling(5, 8, 5, true).numTiles()); - EXPECT_EQ(3, TestTiling(5, 9, 5, true).numTiles()); - EXPECT_EQ(3, TestTiling(5, 10, 5, true).numTiles()); - EXPECT_EQ(3, TestTiling(5, 11, 5, true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(0, 0), IntSize(0, 0), true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(0, 0), IntSize(4, 0), true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(0, 0), IntSize(0, 4), true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(4, 4), IntSize(4, 0), true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(4, 4), IntSize(0, 4), true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(-8, -8), IntSize(1, 1), true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(-1, -1), IntSize(1, 1), true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(0, 0), IntSize(1, 1), true).numTiles()); + + EXPECT_EQ(1, TestTiling(IntSize(1, 1), IntSize(1, 1), true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(1, 1), IntSize(1, 2), true).numTiles()); + EXPECT_EQ(0, TestTiling(IntSize(1, 1), IntSize(2, 1), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(2, 2), IntSize(1, 1), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(2, 2), IntSize(1, 2), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(2, 2), IntSize(2, 1), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(2, 2), IntSize(2, 2), true).numTiles()); + + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(1, 3), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(2, 3), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(3, 3), true).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(4, 3), true).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(5, 3), true).numTiles()); + EXPECT_EQ(4, TestTiling(IntSize(3, 3), IntSize(6, 3), true).numTiles()); + EXPECT_EQ(5, TestTiling(IntSize(3, 3), IntSize(7, 3), true).numTiles()); + + EXPECT_EQ(1, TestTiling(IntSize(4, 4), IntSize(1, 4), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(4, 4), IntSize(2, 4), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(4, 4), IntSize(3, 4), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(4, 4), IntSize(4, 4), true).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(4, 4), IntSize(5, 4), true).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(4, 4), IntSize(6, 4), true).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(4, 4), IntSize(7, 4), true).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(4, 4), IntSize(8, 4), true).numTiles()); + EXPECT_EQ(4, TestTiling(IntSize(4, 4), IntSize(9, 4), true).numTiles()); + EXPECT_EQ(4, TestTiling(IntSize(4, 4), IntSize(10, 4), true).numTiles()); + EXPECT_EQ(5, TestTiling(IntSize(4, 4), IntSize(11, 4), true).numTiles()); + + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(1, 5), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(2, 5), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(3, 5), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(4, 5), true).numTiles()); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(5, 5), true).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(6, 5), true).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(7, 5), true).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(8, 5), true).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(9, 5), true).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(10, 5), true).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(11, 5), true).numTiles()); + + EXPECT_EQ(30, TestTiling(IntSize(8, 5), IntSize(16, 32), true).numTiles()); } TEST(TilingDataTest, tileXIndexFromSrcCoord) { - EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(2)); - EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(3)); - EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(4)); - EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(5)); - EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(6)); - EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(7)); - EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(8)); - EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(9)); - EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(10)); - EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(11)); - - EXPECT_EQ(0, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(1)); - EXPECT_EQ(1, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(2)); - EXPECT_EQ(2, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(3)); - EXPECT_EQ(3, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(4)); - EXPECT_EQ(4, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(5)); - EXPECT_EQ(5, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(6)); - EXPECT_EQ(6, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(7)); - EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(8)); - EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(9)); - EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(10)); - EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(11)); - - EXPECT_EQ(0, TestTiling(1, 1, 1, false).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(2, 2, 2, false).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(2, 2, 2, false).tileXIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileXIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileXIndexFromSrcCoord(2)); - - EXPECT_EQ(0, TestTiling(3, 4, 3, false).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 4, 3, false).tileXIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 4, 3, false).tileXIndexFromSrcCoord(2)); - EXPECT_EQ(1, TestTiling(3, 4, 3, false).tileXIndexFromSrcCoord(3)); - - EXPECT_EQ(0, TestTiling(1, 1, 1, true).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(2, 2, 2, true).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(2, 2, 2, true).tileXIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileXIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileXIndexFromSrcCoord(2)); - - EXPECT_EQ(0, TestTiling(3, 4, 3, true).tileXIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 4, 3, true).tileXIndexFromSrcCoord(1)); - EXPECT_EQ(1, TestTiling(3, 4, 3, true).tileXIndexFromSrcCoord(2)); - EXPECT_EQ(1, TestTiling(3, 4, 3, true).tileXIndexFromSrcCoord(3)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(2)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(3)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(4)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(5)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(6)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(7)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(8)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(9)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(10)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileXIndexFromSrcCoord(11)); + + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(1)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(2)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(3)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(4)); + EXPECT_EQ(4, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(5)); + EXPECT_EQ(5, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(6)); + EXPECT_EQ(6, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(7)); + EXPECT_EQ(7, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(8)); + EXPECT_EQ(7, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(9)); + EXPECT_EQ(7, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(10)); + EXPECT_EQ(7, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileXIndexFromSrcCoord(11)); + + EXPECT_EQ(0, TestTiling(IntSize(1, 1), IntSize(1, 1), false).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(2, 2), IntSize(2, 2), false).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(2, 2), IntSize(2, 2), false).tileXIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), false).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), false).tileXIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), false).tileXIndexFromSrcCoord(2)); + + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(4, 3), false).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(4, 3), false).tileXIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(4, 3), false).tileXIndexFromSrcCoord(2)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(4, 3), false).tileXIndexFromSrcCoord(3)); + + EXPECT_EQ(0, TestTiling(IntSize(1, 1), IntSize(1, 1), true).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(2, 2), IntSize(2, 2), true).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(2, 2), IntSize(2, 2), true).tileXIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), true).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), true).tileXIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), true).tileXIndexFromSrcCoord(2)); + + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(4, 3), true).tileXIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(4, 3), true).tileXIndexFromSrcCoord(1)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(4, 3), true).tileXIndexFromSrcCoord(2)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(4, 3), true).tileXIndexFromSrcCoord(3)); } TEST(TilingDataTest, tileYIndexFromSrcCoord) { - EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(2)); - EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(3)); - EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(4)); - EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(5)); - EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(6)); - EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(7)); - EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(8)); - EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(9)); - EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(10)); - EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(11)); - - EXPECT_EQ(0, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(1)); - EXPECT_EQ(1, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(2)); - EXPECT_EQ(2, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(3)); - EXPECT_EQ(3, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(4)); - EXPECT_EQ(4, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(5)); - EXPECT_EQ(5, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(6)); - EXPECT_EQ(6, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(7)); - EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(8)); - EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(9)); - EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(10)); - EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(11)); - - EXPECT_EQ(0, TestTiling(1, 1, 1, false).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(2, 2, 2, false).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(2, 2, 2, false).tileYIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileYIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileYIndexFromSrcCoord(2)); - - EXPECT_EQ(0, TestTiling(3, 3, 4, false).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 3, 4, false).tileYIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 3, 4, false).tileYIndexFromSrcCoord(2)); - EXPECT_EQ(1, TestTiling(3, 3, 4, false).tileYIndexFromSrcCoord(3)); - - EXPECT_EQ(0, TestTiling(1, 1, 1, true).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(2, 2, 2, true).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(2, 2, 2, true).tileYIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileYIndexFromSrcCoord(1)); - EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileYIndexFromSrcCoord(2)); - - EXPECT_EQ(0, TestTiling(3, 3, 4, true).tileYIndexFromSrcCoord(0)); - EXPECT_EQ(0, TestTiling(3, 3, 4, true).tileYIndexFromSrcCoord(1)); - EXPECT_EQ(1, TestTiling(3, 3, 4, true).tileYIndexFromSrcCoord(2)); - EXPECT_EQ(1, TestTiling(3, 3, 4, true).tileYIndexFromSrcCoord(3)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(2)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(3)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(4)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(5)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(6)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(7)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(8)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(9)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(10)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(10, 10), false).tileYIndexFromSrcCoord(11)); + + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(1)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(2)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(3)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(4)); + EXPECT_EQ(4, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(5)); + EXPECT_EQ(5, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(6)); + EXPECT_EQ(6, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(7)); + EXPECT_EQ(7, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(8)); + EXPECT_EQ(7, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(9)); + EXPECT_EQ(7, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(10)); + EXPECT_EQ(7, TestTiling(IntSize(3, 3), IntSize(10, 10), true).tileYIndexFromSrcCoord(11)); + + EXPECT_EQ(0, TestTiling(IntSize(1, 1), IntSize(1, 1), false).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(2, 2), IntSize(2, 2), false).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(2, 2), IntSize(2, 2), false).tileYIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), false).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), false).tileYIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), false).tileYIndexFromSrcCoord(2)); + + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 4), false).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 4), false).tileYIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 4), false).tileYIndexFromSrcCoord(2)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(3, 4), false).tileYIndexFromSrcCoord(3)); + + EXPECT_EQ(0, TestTiling(IntSize(1, 1), IntSize(1, 1), true).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(2, 2), IntSize(2, 2), true).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(2, 2), IntSize(2, 2), true).tileYIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), true).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), true).tileYIndexFromSrcCoord(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 3), true).tileYIndexFromSrcCoord(2)); + + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 4), true).tileYIndexFromSrcCoord(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 4), true).tileYIndexFromSrcCoord(1)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(3, 4), true).tileYIndexFromSrcCoord(2)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(3, 4), true).tileYIndexFromSrcCoord(3)); } TEST(TilingDataTest, tileSizeX) { - EXPECT_EQ(5, TestTiling(5, 5, 5, false).tileSizeX(0)); - EXPECT_EQ(5, TestTiling(5, 5, 5, true).tileSizeX(0)); - - EXPECT_EQ(5, TestTiling(5, 6, 6, false).tileSizeX(0)); - EXPECT_EQ(1, TestTiling(5, 6, 6, false).tileSizeX(1)); - EXPECT_EQ(4, TestTiling(5, 6, 6, true).tileSizeX(0)); - EXPECT_EQ(2, TestTiling(5, 6, 6, true).tileSizeX(1)); - - EXPECT_EQ(5, TestTiling(5, 8, 8, false).tileSizeX(0)); - EXPECT_EQ(3, TestTiling(5, 8, 8, false).tileSizeX(1)); - EXPECT_EQ(4, TestTiling(5, 8, 8, true).tileSizeX(0)); - EXPECT_EQ(4, TestTiling(5, 8, 8, true).tileSizeX(1)); - - EXPECT_EQ(5, TestTiling(5, 10, 10, false).tileSizeX(0)); - EXPECT_EQ(5, TestTiling(5, 10, 10, false).tileSizeX(1)); - EXPECT_EQ(4, TestTiling(5, 10, 10, true).tileSizeX(0)); - EXPECT_EQ(3, TestTiling(5, 10, 10, true).tileSizeX(1)); - EXPECT_EQ(3, TestTiling(5, 10, 10, true).tileSizeX(2)); - - EXPECT_EQ(4, TestTiling(5, 11, 11, true).tileSizeX(2)); - EXPECT_EQ(3, TestTiling(5, 12, 12, true).tileSizeX(2)); + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(5, 5), false).tileSizeX(0)); + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(5, 5), true).tileSizeX(0)); + + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(6, 6), false).tileSizeX(0)); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(6, 6), false).tileSizeX(1)); + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(6, 6), true).tileSizeX(0)); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(6, 6), true).tileSizeX(1)); + + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(8, 8), false).tileSizeX(0)); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(8, 8), false).tileSizeX(1)); + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(8, 8), true).tileSizeX(0)); + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(8, 8), true).tileSizeX(1)); + + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(10, 10), false).tileSizeX(0)); + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(10, 10), false).tileSizeX(1)); + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(10, 10), true).tileSizeX(0)); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(10, 10), true).tileSizeX(1)); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(10, 10), true).tileSizeX(2)); + + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(11, 11), true).tileSizeX(2)); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(12, 12), true).tileSizeX(2)); + + EXPECT_EQ(3, TestTiling(IntSize(5, 9), IntSize(12, 17), true).tileSizeX(2)); } + TEST(TilingDataTest, tileSizeY) { - EXPECT_EQ(5, TestTiling(5, 5, 5, false).tileSizeY(0)); - EXPECT_EQ(5, TestTiling(5, 5, 5, true).tileSizeY(0)); - - EXPECT_EQ(5, TestTiling(5, 6, 6, false).tileSizeY(0)); - EXPECT_EQ(1, TestTiling(5, 6, 6, false).tileSizeY(1)); - EXPECT_EQ(4, TestTiling(5, 6, 6, true).tileSizeY(0)); - EXPECT_EQ(2, TestTiling(5, 6, 6, true).tileSizeY(1)); - - EXPECT_EQ(5, TestTiling(5, 8, 8, false).tileSizeY(0)); - EXPECT_EQ(3, TestTiling(5, 8, 8, false).tileSizeY(1)); - EXPECT_EQ(4, TestTiling(5, 8, 8, true).tileSizeY(0)); - EXPECT_EQ(4, TestTiling(5, 8, 8, true).tileSizeY(1)); - - EXPECT_EQ(5, TestTiling(5, 10, 10, false).tileSizeY(0)); - EXPECT_EQ(5, TestTiling(5, 10, 10, false).tileSizeY(1)); - EXPECT_EQ(4, TestTiling(5, 10, 10, true).tileSizeY(0)); - EXPECT_EQ(3, TestTiling(5, 10, 10, true).tileSizeY(1)); - EXPECT_EQ(3, TestTiling(5, 10, 10, true).tileSizeY(2)); - - EXPECT_EQ(4, TestTiling(5, 11, 11, true).tileSizeY(2)); - EXPECT_EQ(3, TestTiling(5, 12, 12, true).tileSizeY(2)); + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(5, 5), false).tileSizeY(0)); + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(5, 5), true).tileSizeY(0)); + + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(6, 6), false).tileSizeY(0)); + EXPECT_EQ(1, TestTiling(IntSize(5, 5), IntSize(6, 6), false).tileSizeY(1)); + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(6, 6), true).tileSizeY(0)); + EXPECT_EQ(2, TestTiling(IntSize(5, 5), IntSize(6, 6), true).tileSizeY(1)); + + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(8, 8), false).tileSizeY(0)); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(8, 8), false).tileSizeY(1)); + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(8, 8), true).tileSizeY(0)); + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(8, 8), true).tileSizeY(1)); + + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(10, 10), false).tileSizeY(0)); + EXPECT_EQ(5, TestTiling(IntSize(5, 5), IntSize(10, 10), false).tileSizeY(1)); + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(10, 10), true).tileSizeY(0)); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(10, 10), true).tileSizeY(1)); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(10, 10), true).tileSizeY(2)); + + EXPECT_EQ(4, TestTiling(IntSize(5, 5), IntSize(11, 11), true).tileSizeY(2)); + EXPECT_EQ(3, TestTiling(IntSize(5, 5), IntSize(12, 12), true).tileSizeY(2)); + + EXPECT_EQ(3, TestTiling(IntSize(9, 5), IntSize(17, 12), true).tileSizeY(2)); } TEST(TilingDataTest, tileSizeX_and_tilePositionX) { // Single tile cases: - EXPECT_EQ(1, TestTiling(3, 1, 1, false).tileSizeX(0)); - EXPECT_EQ(0, TestTiling(3, 1, 1, false).tilePositionX(0)); - EXPECT_EQ(1, TestTiling(3, 1, 100, false).tileSizeX(0)); - EXPECT_EQ(0, TestTiling(3, 1, 100, false).tilePositionX(0)); - EXPECT_EQ(3, TestTiling(3, 3, 1, false).tileSizeX(0)); - EXPECT_EQ(0, TestTiling(3, 3, 1, false).tilePositionX(0)); - EXPECT_EQ(3, TestTiling(3, 3, 100, false).tileSizeX(0)); - EXPECT_EQ(0, TestTiling(3, 3, 100, false).tilePositionX(0)); - EXPECT_EQ(1, TestTiling(3, 1, 1, true).tileSizeX(0)); - EXPECT_EQ(0, TestTiling(3, 1, 1, true).tilePositionX(0)); - EXPECT_EQ(1, TestTiling(3, 1, 100, true).tileSizeX(0)); - EXPECT_EQ(0, TestTiling(3, 1, 100, true).tilePositionX(0)); - EXPECT_EQ(3, TestTiling(3, 3, 1, true).tileSizeX(0)); - EXPECT_EQ(0, TestTiling(3, 3, 1, true).tilePositionX(0)); - EXPECT_EQ(3, TestTiling(3, 3, 100, true).tileSizeX(0)); - EXPECT_EQ(0, TestTiling(3, 3, 100, true).tilePositionX(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(1, 1), false).tileSizeX(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 1), false).tilePositionX(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(1, 100), false).tileSizeX(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 100), false).tilePositionX(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(3, 1), false).tileSizeX(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 1), false).tilePositionX(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(3, 100), false).tileSizeX(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 100), false).tilePositionX(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(1, 1), true).tileSizeX(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 1), true).tilePositionX(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(1, 100), true).tileSizeX(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 100), true).tilePositionX(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(3, 1), true).tileSizeX(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 1), true).tilePositionX(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(3, 100), true).tileSizeX(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(3, 100), true).tilePositionX(0)); // Multiple tiles: // no border // positions 0, 3 - EXPECT_EQ(2, TestTiling(3, 6, 1, false).numTiles()); - EXPECT_EQ(3, TestTiling(3, 6, 1, false).tileSizeX(0)); - EXPECT_EQ(3, TestTiling(3, 6, 1, false).tileSizeX(1)); - EXPECT_EQ(0, TestTiling(3, 6, 1, false).tilePositionX(0)); - EXPECT_EQ(3, TestTiling(3, 6, 1, false).tilePositionX(1)); - EXPECT_EQ(3, TestTiling(3, 6, 100, false).tileSizeX(0)); - EXPECT_EQ(3, TestTiling(3, 6, 100, false).tileSizeX(1)); - EXPECT_EQ(0, TestTiling(3, 6, 100, false).tilePositionX(0)); - EXPECT_EQ(3, TestTiling(3, 6, 100, false).tilePositionX(1)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(6, 1), false).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(6, 1), false).tileSizeX(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(6, 1), false).tileSizeX(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(6, 1), false).tilePositionX(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(6, 1), false).tilePositionX(1)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(6, 100), false).tileSizeX(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(6, 100), false).tileSizeX(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(6, 100), false).tilePositionX(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(6, 100), false).tilePositionX(1)); // Multiple tiles: // with border // positions 0, 2, 3, 4 - EXPECT_EQ(4, TestTiling(3, 6, 1, true).numTiles()); - EXPECT_EQ(2, TestTiling(3, 6, 1, true).tileSizeX(0)); - EXPECT_EQ(1, TestTiling(3, 6, 1, true).tileSizeX(1)); - EXPECT_EQ(1, TestTiling(3, 6, 1, true).tileSizeX(2)); - EXPECT_EQ(2, TestTiling(3, 6, 1, true).tileSizeX(3)); - EXPECT_EQ(0, TestTiling(3, 6, 1, true).tilePositionX(0)); - EXPECT_EQ(2, TestTiling(3, 6, 1, true).tilePositionX(1)); - EXPECT_EQ(3, TestTiling(3, 6, 1, true).tilePositionX(2)); - EXPECT_EQ(4, TestTiling(3, 6, 1, true).tilePositionX(3)); - EXPECT_EQ(2, TestTiling(3, 6, 100, true).tileSizeX(0)); - EXPECT_EQ(1, TestTiling(3, 6, 100, true).tileSizeX(1)); - EXPECT_EQ(1, TestTiling(3, 6, 100, true).tileSizeX(2)); - EXPECT_EQ(2, TestTiling(3, 6, 100, true).tileSizeX(3)); - EXPECT_EQ(0, TestTiling(3, 6, 100, true).tilePositionX(0)); - EXPECT_EQ(2, TestTiling(3, 6, 100, true).tilePositionX(1)); - EXPECT_EQ(3, TestTiling(3, 6, 100, true).tilePositionX(2)); - EXPECT_EQ(4, TestTiling(3, 6, 100, true).tilePositionX(3)); + EXPECT_EQ(4, TestTiling(IntSize(3, 3), IntSize(6, 1), true).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(6, 1), true).tileSizeX(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(6, 1), true).tileSizeX(1)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(6, 1), true).tileSizeX(2)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(6, 1), true).tileSizeX(3)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(6, 1), true).tilePositionX(0)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(6, 1), true).tilePositionX(1)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(6, 1), true).tilePositionX(2)); + EXPECT_EQ(4, TestTiling(IntSize(3, 3), IntSize(6, 1), true).tilePositionX(3)); + EXPECT_EQ(2, TestTiling(IntSize(3, 7), IntSize(6, 100), true).tileSizeX(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 7), IntSize(6, 100), true).tileSizeX(1)); + EXPECT_EQ(1, TestTiling(IntSize(3, 7), IntSize(6, 100), true).tileSizeX(2)); + EXPECT_EQ(2, TestTiling(IntSize(3, 7), IntSize(6, 100), true).tileSizeX(3)); + EXPECT_EQ(0, TestTiling(IntSize(3, 7), IntSize(6, 100), true).tilePositionX(0)); + EXPECT_EQ(2, TestTiling(IntSize(3, 7), IntSize(6, 100), true).tilePositionX(1)); + EXPECT_EQ(3, TestTiling(IntSize(3, 7), IntSize(6, 100), true).tilePositionX(2)); + EXPECT_EQ(4, TestTiling(IntSize(3, 7), IntSize(6, 100), true).tilePositionX(3)); } TEST(TilingDataTest, tileSizeY_and_tilePositionY) { // Single tile cases: - EXPECT_EQ(1, TestTiling(3, 1, 1, false).tileSizeY(0)); - EXPECT_EQ(0, TestTiling(3, 1, 1, false).tilePositionY(0)); - EXPECT_EQ(1, TestTiling(3, 100, 1, false).tileSizeY(0)); - EXPECT_EQ(0, TestTiling(3, 100, 1, false).tilePositionY(0)); - EXPECT_EQ(3, TestTiling(3, 1, 3, false).tileSizeY(0)); - EXPECT_EQ(0, TestTiling(3, 1, 3, false).tilePositionY(0)); - EXPECT_EQ(3, TestTiling(3, 100, 3, false).tileSizeY(0)); - EXPECT_EQ(0, TestTiling(3, 100, 3, false).tilePositionY(0)); - EXPECT_EQ(1, TestTiling(3, 1, 1, true).tileSizeY(0)); - EXPECT_EQ(0, TestTiling(3, 1, 1, true).tilePositionY(0)); - EXPECT_EQ(1, TestTiling(3, 100, 1, true).tileSizeY(0)); - EXPECT_EQ(0, TestTiling(3, 100, 1, true).tilePositionY(0)); - EXPECT_EQ(3, TestTiling(3, 1, 3, true).tileSizeY(0)); - EXPECT_EQ(0, TestTiling(3, 1, 3, true).tilePositionY(0)); - EXPECT_EQ(3, TestTiling(3, 100, 3, true).tileSizeY(0)); - EXPECT_EQ(0, TestTiling(3, 100, 3, true).tilePositionY(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(1, 1), false).tileSizeY(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 1), false).tilePositionY(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(100, 1), false).tileSizeY(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(100, 1), false).tilePositionY(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(1, 3), false).tileSizeY(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 3), false).tilePositionY(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(100, 3), false).tileSizeY(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(100, 3), false).tilePositionY(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(1, 1), true).tileSizeY(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 1), true).tilePositionY(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(100, 1), true).tileSizeY(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(100, 1), true).tilePositionY(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(1, 3), true).tileSizeY(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 3), true).tilePositionY(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(100, 3), true).tileSizeY(0)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(100, 3), true).tilePositionY(0)); // Multiple tiles: // no border // positions 0, 3 - EXPECT_EQ(2, TestTiling(3, 1, 6, false).numTiles()); - EXPECT_EQ(3, TestTiling(3, 1, 6, false).tileSizeY(0)); - EXPECT_EQ(3, TestTiling(3, 1, 6, false).tileSizeY(1)); - EXPECT_EQ(0, TestTiling(3, 1, 6, false).tilePositionY(0)); - EXPECT_EQ(3, TestTiling(3, 1, 6, false).tilePositionY(1)); - EXPECT_EQ(3, TestTiling(3, 100, 6, false).tileSizeY(0)); - EXPECT_EQ(3, TestTiling(3, 100, 6, false).tileSizeY(1)); - EXPECT_EQ(0, TestTiling(3, 100, 6, false).tilePositionY(0)); - EXPECT_EQ(3, TestTiling(3, 100, 6, false).tilePositionY(1)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(1, 6), false).numTiles()); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(1, 6), false).tileSizeY(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(1, 6), false).tileSizeY(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 6), false).tilePositionY(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(1, 6), false).tilePositionY(1)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(100, 6), false).tileSizeY(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(100, 6), false).tileSizeY(1)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(100, 6), false).tilePositionY(0)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(100, 6), false).tilePositionY(1)); // Multiple tiles: // with border // positions 0, 2, 3, 4 - EXPECT_EQ(4, TestTiling(3, 1, 6, true).numTiles()); - EXPECT_EQ(2, TestTiling(3, 1, 6, true).tileSizeY(0)); - EXPECT_EQ(1, TestTiling(3, 1, 6, true).tileSizeY(1)); - EXPECT_EQ(1, TestTiling(3, 1, 6, true).tileSizeY(2)); - EXPECT_EQ(2, TestTiling(3, 1, 6, true).tileSizeY(3)); - EXPECT_EQ(0, TestTiling(3, 1, 6, true).tilePositionY(0)); - EXPECT_EQ(2, TestTiling(3, 1, 6, true).tilePositionY(1)); - EXPECT_EQ(3, TestTiling(3, 1, 6, true).tilePositionY(2)); - EXPECT_EQ(4, TestTiling(3, 1, 6, true).tilePositionY(3)); - EXPECT_EQ(2, TestTiling(3, 100, 6, true).tileSizeY(0)); - EXPECT_EQ(1, TestTiling(3, 100, 6, true).tileSizeY(1)); - EXPECT_EQ(1, TestTiling(3, 100, 6, true).tileSizeY(2)); - EXPECT_EQ(2, TestTiling(3, 100, 6, true).tileSizeY(3)); - EXPECT_EQ(0, TestTiling(3, 100, 6, true).tilePositionY(0)); - EXPECT_EQ(2, TestTiling(3, 100, 6, true).tilePositionY(1)); - EXPECT_EQ(3, TestTiling(3, 100, 6, true).tilePositionY(2)); - EXPECT_EQ(4, TestTiling(3, 100, 6, true).tilePositionY(3)); + EXPECT_EQ(4, TestTiling(IntSize(3, 3), IntSize(1, 6), true).numTiles()); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(1, 6), true).tileSizeY(0)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(1, 6), true).tileSizeY(1)); + EXPECT_EQ(1, TestTiling(IntSize(3, 3), IntSize(1, 6), true).tileSizeY(2)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(1, 6), true).tileSizeY(3)); + EXPECT_EQ(0, TestTiling(IntSize(3, 3), IntSize(1, 6), true).tilePositionY(0)); + EXPECT_EQ(2, TestTiling(IntSize(3, 3), IntSize(1, 6), true).tilePositionY(1)); + EXPECT_EQ(3, TestTiling(IntSize(3, 3), IntSize(1, 6), true).tilePositionY(2)); + EXPECT_EQ(4, TestTiling(IntSize(3, 3), IntSize(1, 6), true).tilePositionY(3)); + EXPECT_EQ(2, TestTiling(IntSize(7, 3), IntSize(100, 6), true).tileSizeY(0)); + EXPECT_EQ(1, TestTiling(IntSize(7, 3), IntSize(100, 6), true).tileSizeY(1)); + EXPECT_EQ(1, TestTiling(IntSize(7, 3), IntSize(100, 6), true).tileSizeY(2)); + EXPECT_EQ(2, TestTiling(IntSize(7, 3), IntSize(100, 6), true).tileSizeY(3)); + EXPECT_EQ(0, TestTiling(IntSize(7, 3), IntSize(100, 6), true).tilePositionY(0)); + EXPECT_EQ(2, TestTiling(IntSize(7, 3), IntSize(100, 6), true).tilePositionY(1)); + EXPECT_EQ(3, TestTiling(IntSize(7, 3), IntSize(100, 6), true).tilePositionY(2)); + EXPECT_EQ(4, TestTiling(IntSize(7, 3), IntSize(100, 6), true).tilePositionY(3)); } TEST(TilingDataTest, setTotalSize) { - TestTiling data(5, 5, 5, false); - EXPECT_EQ(5, data.totalSizeX()); - EXPECT_EQ(5, data.totalSizeY()); + TestTiling data(IntSize(5, 5), IntSize(5, 5), false); + EXPECT_EQ(5, data.totalSize().width()); + EXPECT_EQ(5, data.totalSize().height()); EXPECT_EQ(1, data.numTilesX()); EXPECT_EQ(5, data.tileSizeX(0)); EXPECT_EQ(1, data.numTilesY()); EXPECT_EQ(5, data.tileSizeY(0)); - data.setTotalSize(6, 5); - EXPECT_EQ(6, data.totalSizeX()); - EXPECT_EQ(5, data.totalSizeY()); + data.setTotalSize(IntSize(6, 5)); + EXPECT_EQ(6, data.totalSize().width()); + EXPECT_EQ(5, data.totalSize().height()); EXPECT_EQ(2, data.numTilesX()); EXPECT_EQ(5, data.tileSizeX(0)); EXPECT_EQ(1, data.tileSizeX(1)); EXPECT_EQ(1, data.numTilesY()); EXPECT_EQ(5, data.tileSizeY(0)); - data.setTotalSize(5, 12); - EXPECT_EQ(5, data.totalSizeX()); - EXPECT_EQ(12, data.totalSizeY()); + data.setTotalSize(IntSize(5, 12)); + EXPECT_EQ(5, data.totalSize().width()); + EXPECT_EQ(12, data.totalSize().height()); EXPECT_EQ(1, data.numTilesX()); EXPECT_EQ(5, data.tileSizeX(0)); EXPECT_EQ(3, data.numTilesY()); @@ -468,75 +480,85 @@ TEST(TilingDataTest, setTotalSize) TEST(TilingDataTest, setMaxTextureSizeNoBorders) { - TestTiling data(8, 16, 32, false); + TestTiling data(IntSize(8, 8), IntSize(16, 32), false); EXPECT_EQ(2, data.numTilesX()); EXPECT_EQ(4, data.numTilesY()); - data.setMaxTextureSize(32); - EXPECT_EQ(32, data.maxTextureSize()); + data.setMaxTextureSize(IntSize(32, 32)); + EXPECT_EQ(IntSize(32, 32), data.maxTextureSize()); EXPECT_EQ(1, data.numTilesX()); EXPECT_EQ(1, data.numTilesY()); - data.setMaxTextureSize(2); - EXPECT_EQ(2, data.maxTextureSize()); + data.setMaxTextureSize(IntSize(2, 2)); + EXPECT_EQ(IntSize(2, 2), data.maxTextureSize()); EXPECT_EQ(8, data.numTilesX()); EXPECT_EQ(16, data.numTilesY()); - data.setMaxTextureSize(5); - EXPECT_EQ(5, data.maxTextureSize()); + data.setMaxTextureSize(IntSize(5, 5)); + EXPECT_EQ(IntSize(5, 5), data.maxTextureSize()); EXPECT_EQ(4, data.numTilesX()); EXPECT_EQ(7, data.numTilesY()); + + data.setMaxTextureSize(IntSize(8, 5)); + EXPECT_EQ(IntSize(8, 5), data.maxTextureSize()); + EXPECT_EQ(2, data.numTilesX()); + EXPECT_EQ(7, data.numTilesY()); } TEST(TilingDataTest, setMaxTextureSizeBorders) { - TestTiling data(8, 16, 32, true); + TestTiling data(IntSize(8, 8), IntSize(16, 32), true); EXPECT_EQ(3, data.numTilesX()); EXPECT_EQ(5, data.numTilesY()); - data.setMaxTextureSize(32); - EXPECT_EQ(32, data.maxTextureSize()); + data.setMaxTextureSize(IntSize(32, 32)); + EXPECT_EQ(IntSize(32, 32), data.maxTextureSize()); EXPECT_EQ(1, data.numTilesX()); EXPECT_EQ(1, data.numTilesY()); - data.setMaxTextureSize(2); - EXPECT_EQ(2, data.maxTextureSize()); + data.setMaxTextureSize(IntSize(2, 2)); + EXPECT_EQ(IntSize(2, 2), data.maxTextureSize()); EXPECT_EQ(0, data.numTilesX()); EXPECT_EQ(0, data.numTilesY()); - data.setMaxTextureSize(5); - EXPECT_EQ(5, data.maxTextureSize()); + data.setMaxTextureSize(IntSize(5, 5)); + EXPECT_EQ(IntSize(5, 5), data.maxTextureSize()); EXPECT_EQ(5, data.numTilesX()); EXPECT_EQ(10, data.numTilesY()); + + data.setMaxTextureSize(IntSize(8, 5)); + EXPECT_EQ(IntSize(8, 5), data.maxTextureSize()); + EXPECT_EQ(3, data.numTilesX()); + EXPECT_EQ(10, data.numTilesY()); } TEST(TilingDataTest, assignment) { { - TestTiling source(8, 16, 32, true); + TestTiling source(IntSize(8, 8), IntSize(16, 32), true); TestTiling dest = source; EXPECT_EQ(source.borderTexels(), dest.borderTexels()); EXPECT_EQ(source.maxTextureSize(), dest.maxTextureSize()); EXPECT_EQ(source.numTilesX(), dest.numTilesX()); EXPECT_EQ(source.numTilesY(), dest.numTilesY()); - EXPECT_EQ(source.totalSizeX(), dest.totalSizeX()); - EXPECT_EQ(source.totalSizeY(), dest.totalSizeY()); + EXPECT_EQ(source.totalSize().width(), dest.totalSize().width()); + EXPECT_EQ(source.totalSize().height(), dest.totalSize().height()); } { - TestTiling source(3, 6, 100, false); + TestTiling source(IntSize(7, 3), IntSize(6, 100), false); TestTiling dest(source); EXPECT_EQ(source.borderTexels(), dest.borderTexels()); EXPECT_EQ(source.maxTextureSize(), dest.maxTextureSize()); EXPECT_EQ(source.numTilesX(), dest.numTilesX()); EXPECT_EQ(source.numTilesY(), dest.numTilesY()); - EXPECT_EQ(source.totalSizeX(), dest.totalSizeX()); - EXPECT_EQ(source.totalSizeY(), dest.totalSizeY()); + EXPECT_EQ(source.totalSize().width(), dest.totalSize().width()); + EXPECT_EQ(source.totalSize().height(), dest.totalSize().height()); } } TEST(TilingDataTest, setBorderTexels) { - TestTiling data(8, 16, 32, false); + TestTiling data(IntSize(8, 8), IntSize(16, 32), false); EXPECT_EQ(2, data.numTilesX()); EXPECT_EQ(4, data.numTilesY()); diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp index b8bc2e3c4..2fe01bf16 100644 --- a/Source/WebKit/chromium/tests/WebFrameTest.cpp +++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp @@ -40,6 +40,7 @@ #include "WebRange.h" #include "WebScriptSource.h" #include "WebSearchableFormData.h" +#include "WebSecurityOrigin.h" #include "WebSecurityPolicy.h" #include "WebSettings.h" #include "WebViewClient.h" @@ -136,22 +137,71 @@ TEST_F(WebFrameTest, FormWithNullFrame) WebSearchableFormData searchableDataForm(forms[0]); } +TEST_F(WebFrameTest, ChromePageJavascript) +{ + registerMockedChromeURLLoad("history.html"); + + // Pass true to enable JavaScript. + WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true); + + // Try to run JS against the chrome-style URL. + FrameTestHelpers::loadFrame(webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))"); + + // Required to see any updates in contentAsText. + webView->layout(); + + // Now retrieve the frame's text and ensure it was modified by running javascript. + std::string content = webView->mainFrame()->contentAsText(1024).utf8(); + EXPECT_NE(std::string::npos, content.find("Clobbered")); +} + TEST_F(WebFrameTest, ChromePageNoJavascript) { registerMockedChromeURLLoad("history.html"); + /// Pass true to enable JavaScript. WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true); - // Try to run JS against the chrome-style URL. + // Try to run JS against the chrome-style URL after prohibiting it. WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs("chrome"); FrameTestHelpers::loadFrame(webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))"); - // Now retrieve the frames text and see if it was clobbered. + // Required to see any updates in contentAsText. + webView->layout(); + + // Now retrieve the frame's text and ensure it wasn't modified by running javascript. std::string content = webView->mainFrame()->contentAsText(1024).utf8(); - EXPECT_NE(std::string::npos, content.find("Simulated Chromium History Page")); EXPECT_EQ(std::string::npos, content.find("Clobbered")); } +TEST_F(WebFrameTest, DispatchMessageEventWithOriginCheck) +{ + registerMockedHttpURLLoad("postmessage_test.html"); + + // Pass true to enable JavaScript. + WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "postmessage_test.html", true); + + // Send a message with the correct origin. + WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(GURL(m_baseURL))); + WebDOMEvent event = webView->mainFrame()->document().createEvent("MessageEvent"); + WebDOMMessageEvent message = event.to<WebDOMMessageEvent>(); + WebSerializedScriptValue data(WebSerializedScriptValue::fromString("foo")); + message.initMessageEvent("message", false, false, data, "http://origin.com", 0, ""); + webView->mainFrame()->dispatchMessageEventWithOriginCheck(correctOrigin, message); + + // Send another message with incorrect origin. + WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(GURL(m_chromeURL))); + webView->mainFrame()->dispatchMessageEventWithOriginCheck(incorrectOrigin, message); + + // Required to see any updates in contentAsText. + webView->layout(); + + // Verify that only the first addition is in the body of the page. + std::string content = webView->mainFrame()->contentAsText(1024).utf8(); + EXPECT_NE(std::string::npos, content.find("Message 1.")); + EXPECT_EQ(std::string::npos, content.find("Message 2.")); +} + #if ENABLE(VIEWPORT) class FixedLayoutTestWebViewClient : public WebViewClient { diff --git a/Source/WebKit/chromium/tests/WebViewTest.cpp b/Source/WebKit/chromium/tests/WebViewTest.cpp index 00d8a832d..460c62bd2 100644 --- a/Source/WebKit/chromium/tests/WebViewTest.cpp +++ b/Source/WebKit/chromium/tests/WebViewTest.cpp @@ -110,6 +110,8 @@ protected: int expectedWidth, int expectedHeight, HorizontalScrollbarState expectedHorizontalState, VerticalScrollbarState expectedVerticalState); + void testTextInputType(WebTextInputType expectedType, const std::string& htmlFile); + std::string m_baseURL; }; @@ -245,4 +247,44 @@ TEST_F(WebViewTest, AutoResizeMaxSize) expectedWidth, expectedHeight, NoHorizontalScrollbar, NoVerticalScrollbar); } +void WebViewTest::testTextInputType(WebTextInputType expectedType, const std::string& htmlFile) +{ + FrameTestHelpers::registerMockedURLLoad(m_baseURL, htmlFile); + WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile); + webView->setInitialFocus(false); + EXPECT_EQ(expectedType, webView->textInputType()); + webView->close(); +} + +// Disabled for https://bugs.webkit.org/show_bug.cgi?id=78746#c29 +TEST_F(WebViewTest, DISABLED_TextInputType) +{ + testTextInputType(WebTextInputTypeText, "input_field_default.html"); + testTextInputType(WebTextInputTypePassword, "input_field_password.html"); + testTextInputType(WebTextInputTypeEmail, "input_field_email.html"); + testTextInputType(WebTextInputTypeSearch, "input_field_search.html"); + testTextInputType(WebTextInputTypeNumber, "input_field_number.html"); + testTextInputType(WebTextInputTypeTelephone, "input_field_tel.html"); + testTextInputType(WebTextInputTypeURL, "input_field_url.html"); +#if ENABLE(INPUT_TYPE_DATE) + testTextInputType(WebTextInputTypeDate, "input_field_date.html"); +#endif +#if ENABLE(INPUT_TYPE_DATETIME) + testTextInputType(WebTextInputTypeDateTime, "input_field_datetime.html"); +#endif +#if ENABLE(INPUT_TYPE_DATETIMELOCAL) + testTextInputType(WebTextInputTypeDateTimeLocal, "input_field_datetimelocal.html"); +#endif +#if ENABLE(INPUT_TYPE_MONTH) + testTextInputType(WebTextInputTypeMonth, "input_field_month.html"); +#endif +#if ENABLE(INPUT_TYPE_TIME) + testTextInputType(WebTextInputTypeTime, "input_field_time.html"); +#endif +#if ENABLE(INPUT_TYPE_WEEK) + testTextInputType(WebTextInputTypeWeek, "input_field_week.html"); +#endif + +} + } diff --git a/Source/WebKit/chromium/tests/data/input_field_date.html b/Source/WebKit/chromium/tests/data/input_field_date.html new file mode 100644 index 000000000..72aba6db6 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_date.html @@ -0,0 +1 @@ +<input type="date" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_datetime.html b/Source/WebKit/chromium/tests/data/input_field_datetime.html new file mode 100644 index 000000000..fa9c5481b --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_datetime.html @@ -0,0 +1 @@ +<input type="datetime" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_datetimelocal.html b/Source/WebKit/chromium/tests/data/input_field_datetimelocal.html new file mode 100644 index 000000000..42f8422bf --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_datetimelocal.html @@ -0,0 +1 @@ +<input type="datetime-local" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_default.html b/Source/WebKit/chromium/tests/data/input_field_default.html new file mode 100644 index 000000000..4cf679efe --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_default.html @@ -0,0 +1 @@ +<input /> diff --git a/Source/WebKit/chromium/tests/data/input_field_email.html b/Source/WebKit/chromium/tests/data/input_field_email.html new file mode 100644 index 000000000..d12a5aab8 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_email.html @@ -0,0 +1 @@ +<input type="email" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_month.html b/Source/WebKit/chromium/tests/data/input_field_month.html new file mode 100644 index 000000000..f787e4f64 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_month.html @@ -0,0 +1 @@ +<input type="month" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_number.html b/Source/WebKit/chromium/tests/data/input_field_number.html new file mode 100644 index 000000000..2cfc5bdfa --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_number.html @@ -0,0 +1 @@ +<input type="number" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_password.html b/Source/WebKit/chromium/tests/data/input_field_password.html new file mode 100644 index 000000000..98ed14c93 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_password.html @@ -0,0 +1 @@ +<input type="password" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_search.html b/Source/WebKit/chromium/tests/data/input_field_search.html new file mode 100644 index 000000000..7f360e6bc --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_search.html @@ -0,0 +1 @@ +<input type="search" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_tel.html b/Source/WebKit/chromium/tests/data/input_field_tel.html new file mode 100644 index 000000000..3dcaae033 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_tel.html @@ -0,0 +1 @@ +<input type="tel" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_time.html b/Source/WebKit/chromium/tests/data/input_field_time.html new file mode 100644 index 000000000..b74734bd4 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_time.html @@ -0,0 +1 @@ +<input type="time" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_url.html b/Source/WebKit/chromium/tests/data/input_field_url.html new file mode 100644 index 000000000..bf2716bc6 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_url.html @@ -0,0 +1 @@ +<input type="url" /> diff --git a/Source/WebKit/chromium/tests/data/input_field_week.html b/Source/WebKit/chromium/tests/data/input_field_week.html new file mode 100644 index 000000000..f4290cdb9 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/input_field_week.html @@ -0,0 +1 @@ +<input type="week" /> diff --git a/Source/WebKit/chromium/tests/data/listener/listener_leak1.html b/Source/WebKit/chromium/tests/data/listener/listener_leak1.html new file mode 100644 index 000000000..ef0e0ec6e --- /dev/null +++ b/Source/WebKit/chromium/tests/data/listener/listener_leak1.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html> +<head><title>Event Listener Leak Test 1</title></head> +<body onload="leak()"> +<script> +if (typeof(gc) == "undefined") gc = function() {}; + +function EventListenerLeakTestObject1() {} + +function createListener(node) { + var foo = new EventListenerLeakTestObject1(); + return function(evt) { + // This closure references |node| and an instance of leak object. + node.foo = foo; + }; +} + +function doLeak() { + for (var i = 0; i < 10000; i++) { + var node = document.createElement('span'); + node.onclick = createListener(node); + } +} + +function leak() { + doLeak(); + gc(); + gc(); +} +</script> + +<p>This page leaks memory.</p> + +<!-- Allow leaking manually. --> +<input type="button" value="Leak More" onclick="leak()"> + +</body> +</html> diff --git a/Source/WebKit/chromium/tests/data/listener/listener_leak2.html b/Source/WebKit/chromium/tests/data/listener/listener_leak2.html new file mode 100644 index 000000000..14df25a34 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/listener/listener_leak2.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<html> +<head><title>Event Listener Leak Test 2</title></head> +<body onload="leak()"> +<script> +if (typeof(gc) == "undefined") gc = function() {}; + +var node = null; + +function EventListenerLeakTestObject2() {} + +function createListener(node) { + var foo = new EventListenerLeakTestObject2(); + return function(evt) { + // This closure references |node| and an instance of leak object. + node.foo = foo; + }; +} + +function doLeak() { + if (!node) node = document.createElement('span'); + for (var i = 0; i < 10000; i++) { + node.onclick = createListener(node); + } +} + +function leak() { + doLeak(); + gc(); + gc(); +} +</script> + +<p>This page leaks memory.</p> + +<!-- Allow leaking manually. --> +<input type="button" value="Leak More" onclick="leak()"> + +</body> +</html> diff --git a/Source/WebKit/chromium/tests/data/listener/mutation_event_listener.html b/Source/WebKit/chromium/tests/data/listener/mutation_event_listener.html new file mode 100644 index 000000000..231a4f1e8 --- /dev/null +++ b/Source/WebKit/chromium/tests/data/listener/mutation_event_listener.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html> +<head> +<script> +function removeNode(id) { + var node = document.getElementById(id); + node.parentNode.removeChild(node); + } + +function addElement(id) { + var elem = document.createElement("div"); + elem.setAttribute("id", id); + var text = document.createTextNode("Added node id=" + id); + elem.appendChild(text); + document.getElementById("topDiv").appendChild(elem); + } + +function changeText(id, newText) { + var node = document.getElementById(id); + node.childNodes[0].nodeValue = newText; +} +</script> +</head> + +<body> + +<div id="topDiv"> + <div id="div1">Div #1</div> + <div id="div2">Div #2</div> + <div id="div3">Div #3</div> +</div> + +<button onclick="removeNode('div1')">Remove node</button><br> +<button onclick="addElement('bidule')">Add node</button><br> +<button onclick="changeText('div2', 'Bijour')">Change text</button><br> + +</body> +</html> diff --git a/Source/WebKit/chromium/tests/data/postmessage_test.html b/Source/WebKit/chromium/tests/data/postmessage_test.html new file mode 100644 index 000000000..75cb8efec --- /dev/null +++ b/Source/WebKit/chromium/tests/data/postmessage_test.html @@ -0,0 +1,16 @@ +<html> +<head> +<title>PostMessage Test</title> +<script> +var messagesReceived = 0; +window.addEventListener("message", messageReceived, false); +function messageReceived(event) { + messagesReceived++; + document.body.appendChild(document.createTextNode('Message ' + messagesReceived + '.')); +} +</script> +</head> +<body> +Test page. +</body> +</html> diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog index b251653b7..c7d6d8c42 100644 --- a/Source/WebKit/efl/ChangeLog +++ b/Source/WebKit/efl/ChangeLog @@ -1,3 +1,221 @@ +2012-05-10 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Move resumeAnimations to use Internals interface + https://bugs.webkit.org/show_bug.cgi?id=86063 + + Reviewed by Alexey Proskuryakov. + + Remove resumeAnimations functions, because it is able to work in the + cross-port way through the Internals interface. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + * WebCoreSupport/DumpRenderTreeSupportEfl.h: + +2012-05-10 Kangil Han <kangil.han@samsung.com> + + [EFL][DRT] Editor doesn't cancel composition as change of value + https://bugs.webkit.org/show_bug.cgi?id=85122 + + Reviewed by Martin Robinson. + + IME composition should be cancelled when the value of input element is changed programmatically. + However, EFL port doesn't cancel as change of value. + Therefore, this patch will fix the bug. + + * WebCoreSupport/EditorClientEfl.cpp: + (WebCore::EditorClientEfl::respondToChangedSelection): + +2012-05-10 Dominik Röttsches <dominik.rottsches@intel.com> + + [EFL][DRT] ewk_view_paint_contents may trigger assertion failure + https://bugs.webkit.org/show_bug.cgi?id=85058 + + Reviewed by Gustavo Noronha Silva. + + Fixing assertion failure triggered in media/media-fragment cases. + The assertion is hit because of a race between scheduleRelayout() and + the EWK's idle tiling painting. This is exposed by test cases + that rapidly insert child nodes to the document which lead to + scheduleRelayout() calls. Using the general purpose defensive + layout function, not causing any extra relayout work if there's + nothing to be done, but still avoiding the assertion failure if + layout is needed. + + * ewk/ewk_view.cpp: + (ewk_view_paint): + (ewk_view_paint_contents): + +2012-05-10 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r116633. + http://trac.webkit.org/changeset/116633 + https://bugs.webkit.org/show_bug.cgi?id=86093 + + Breaks EFL tests (Requested by kov on #webkit). + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + * WebCoreSupport/DumpRenderTreeSupportEfl.h: + +2012-05-10 Alexander Shalamov <alexander.shalamov@intel.com> + + [EFL] LayoutTestController needs implementation of setTabKeyCyclesThroughElements + https://bugs.webkit.org/show_bug.cgi?id=82864 + + Reviewed by Gustavo Noronha Silva. + + Add missing implementation for setTabKeyCyclesThroughElements to EFL's + DumpRenderTreeSupport. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + (DumpRenderTreeSupportEfl::setTabKeyCyclesThroughElements): + * WebCoreSupport/DumpRenderTreeSupportEfl.h: + +2012-05-10 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][DRT] Clear added user style sheets before a new testcase execution. + https://bugs.webkit.org/show_bug.cgi?id=84792 + + Reviewed by Gustavo Noronha Silva. + + Add a helper function for clearing of the added user style sheets. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + (DumpRenderTreeSupportEfl::clearUserStyleSheets): + * WebCoreSupport/DumpRenderTreeSupportEfl.h: + +2012-05-09 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Move suspendAnimations to use Internals interface. + https://bugs.webkit.org/show_bug.cgi?id=85986 + + Reviewed by Ryosuke Niwa. + + Remove suspendAnimations functions, because it is able to work in the + cross-port way through the Internals interface. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + * WebCoreSupport/DumpRenderTreeSupportEfl.h: + +2012-05-09 Christophe Dumez <christophe.dumez@intel.com> + + [EFL][DRT] EFL's DRT needs to support LayoutTestController.dumpIconChanges() + https://bugs.webkit.org/show_bug.cgi?id=84435 + + Reviewed by Antonio Gomes. + + Emit a "icon,changed" signal on the frame when its favion changed. + Clarify that the "icon,loaded" signal is only emitted for the main + frame. + + * WebCoreSupport/FrameLoaderClientEfl.cpp: + (WebCore::FrameLoaderClientEfl::dispatchDidReceiveIcon): + (WebCore::FrameLoaderClientEfl::dispatchDidChangeIcons): + * ewk/ewk_frame.cpp: + (ewk_frame_icon_changed): + * ewk/ewk_frame.h: + * ewk/ewk_private.h: + +2012-05-09 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL][DRT] LayoutTestController addUserScript implementation + https://bugs.webkit.org/show_bug.cgi?id=84718 + + Reviewed by Antonio Gomes. + + Added helper functions for adding/clearing of user scripts. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + (DumpRenderTreeSupportEfl::addUserScript): + (DumpRenderTreeSupportEfl::clearUserScripts): + * WebCoreSupport/DumpRenderTreeSupportEfl.h: + +2012-05-08 Kangil Han <kangil.han@samsung.com> + + [EFL][DRT] Implement TextInputController. + https://bugs.webkit.org/show_bug.cgi?id=78559 + + Reviewed by Martin Robinson. + + TextInputController has been created for an input emulation purpose in DRT. + However, not like other ports, EFL doesn't have it. + Therefore, this patch will enable EFL port to have an input emulation in DRT. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + (DumpRenderTreeSupportEfl::setComposition): + (DumpRenderTreeSupportEfl::hasComposition): + (DumpRenderTreeSupportEfl::compositionRange): + (DumpRenderTreeSupportEfl::confirmComposition): + (DumpRenderTreeSupportEfl::firstRectForCharacterRange): + (DumpRenderTreeSupportEfl::selectedRange): + * WebCoreSupport/DumpRenderTreeSupportEfl.h: + +2012-04-23 Raphael Kubo da Costa <rakuco@webkit.org> + + [EFL] Pass a WTF::String directly from DRT to ewebkit when possible + https://bugs.webkit.org/show_bug.cgi?id=84634 + + Reviewed by Gustavo Noronha Silva. + + Drop unnecessary const char* -> WTF::String conversions by + creating String objects directly in LayoutTestController out of + JSStringRef's and passing them to DumpRenderTreeSupportEfl. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + (DumpRenderTreeSupportEfl::setValueForUser): + (DumpRenderTreeSupportEfl::addUserStyleSheet): + (DumpRenderTreeSupportEfl::findString): + * WebCoreSupport/DumpRenderTreeSupportEfl.h: + +2012-05-08 Krzysztof Czech <k.czech@samsung.com> + + [EFL] Update documentation of ewk_frame_contents_alternate_set and ewk_view_zoom_range_set. + https://bugs.webkit.org/show_bug.cgi?id=84588 + + Reviewed by Eric Seidel. + + In ewk_frame_contents_alternate_set, param unreachableUri is required, must not be 0. + In ewk_view_zoom_range_set, function returns EINA_FALSE only on failure, + not when zoom range is changed. + + * ewk/ewk_frame.h: + * ewk/ewk_view.h: + +2012-05-07 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> + + [EFL] Page caching permission from EFL's FrameLoaderClient + https://bugs.webkit.org/show_bug.cgi?id=85620 + + Reviewed by Gustavo Noronha Silva. + + FrameLoaderClientEfl::canCachePage() returns true. + + * WebCoreSupport/FrameLoaderClientEfl.cpp: + (WebCore::FrameLoaderClientEfl::canCachePage): + +2012-05-07 Grzegorz Czajkowski <g.czajkowski@samsung.com> + + [EFL] Icon database path may be NULL when a new path was set. + https://bugs.webkit.org/show_bug.cgi?id=82456 + + Reviewed by Andreas Kling. + + ewk_settings_icon_database_path_set calls asynchronous method WebCore::iconDatabase().open(). + There is no notification when the new path is set by WebCore. + Moreover ewk_settings_icon_database_path_set keeps the new path in a local variable. + + To retrieve path to icon database ewk_settings_icon_database_path_get can be called. + It first checks flags whether icon databse is opened and enabled. There is possibility + that icon database has been set through API but it hasn't been opened by WebCore yet. + So as a result ewk_settings_icon_database_path_get returns NULL because WebCore hasn't + set an appropriate flag yet. + + It may happen while icon database set/get sequences. + Information whether icon database is opened/enabled should be exposed by separate API. + + * ewk/ewk_settings.cpp: + (ewk_settings_icon_database_path_get): Skip checking whether icon database is opened, enabled. + * ewk/ewk_settings.h: + 2012-05-07 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> [EFL][DRT] Implement LayoutTestController::execCommand diff --git a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp index 9b28046f8..1486cbc60 100644 --- a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp @@ -43,12 +43,11 @@ #include <PrintContext.h> #include <RenderTreeAsText.h> #include <Settings.h> +#include <TextIterator.h> #include <WebKitMutationObserver.h> #include <bindings/js/GCController.h> #include <history/HistoryItem.h> #include <workers/WorkerThread.h> -#include <wtf/OwnArrayPtr.h> -#include <wtf/text/AtomicString.h> unsigned DumpRenderTreeSupportEfl::activeAnimationsCount(const Evas_Object* ewkFrame) { @@ -279,18 +278,6 @@ String DumpRenderTreeSupportEfl::responseMimeType(const Evas_Object* ewkFrame) return documentLoader->responseMIMEType(); } -void DumpRenderTreeSupportEfl::resumeAnimations(Evas_Object* ewkFrame) -{ - WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame); - - if (!frame) - return; - - WebCore::AnimationController *animationController = frame->animation(); - if (animationController) - animationController->resumeAnimations(); -} - WebCore::IntRect DumpRenderTreeSupportEfl::selectionRectangle(const Evas_Object* ewkFrame) { WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame); @@ -324,19 +311,7 @@ String DumpRenderTreeSupportEfl::suitableDRTFrameName(const Evas_Object* ewkFram return String("frame (anonymous)"); } -void DumpRenderTreeSupportEfl::suspendAnimations(Evas_Object* ewkFrame) -{ - WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame); - - if (!frame) - return; - - WebCore::AnimationController *animationController = frame->animation(); - if (animationController) - animationController->suspendAnimations(); -} - -void DumpRenderTreeSupportEfl::setValueForUser(JSContextRef context, JSValueRef nodeObject, JSStringRef value) +void DumpRenderTreeSupportEfl::setValueForUser(JSContextRef context, JSValueRef nodeObject, const String& value) { JSC::ExecState* exec = toJS(context); WebCore::Element* element = WebCore::toElement(toJS(exec, nodeObject)); @@ -346,10 +321,7 @@ void DumpRenderTreeSupportEfl::setValueForUser(JSContextRef context, JSValueRef if (!inputElement) return; - size_t bufferSize = JSStringGetMaximumUTF8CStringSize(value); - OwnArrayPtr<char> valueBuffer = adoptArrayPtr(new char[bufferSize]); - JSStringGetUTF8CString(value, valueBuffer.get(), bufferSize); - inputElement->setValueForUser(String::fromUTF8(valueBuffer.get())); + inputElement->setValueForUser(value); } void DumpRenderTreeSupportEfl::setAutofilled(JSContextRef context, JSValueRef nodeObject, bool autofilled) @@ -384,7 +356,27 @@ void DumpRenderTreeSupportEfl::setLoadsSiteIconsIgnoringImageLoadingSetting(Evas page->settings()->setLoadsSiteIconsIgnoringImageLoadingSetting(loadsSiteIconsIgnoringImageLoadingPreferences); } -void DumpRenderTreeSupportEfl::addUserStyleSheet(const Evas_Object* ewkView, const char* sourceCode, bool allFrames) +void DumpRenderTreeSupportEfl::addUserScript(const Evas_Object* ewkView, const String& sourceCode, bool runAtStart, bool allFrames) +{ + WebCore::Page* page = EWKPrivate::corePage(ewkView); + if (!page) + return; + + page->group().addUserScriptToWorld(WebCore::mainThreadNormalWorld(), sourceCode, WebCore::KURL(), + nullptr, nullptr, runAtStart ? WebCore::InjectAtDocumentStart : WebCore::InjectAtDocumentEnd, + allFrames ? WebCore::InjectInAllFrames : WebCore::InjectInTopFrameOnly); +} + +void DumpRenderTreeSupportEfl::clearUserScripts(const Evas_Object* ewkView) +{ + WebCore::Page* page = EWKPrivate::corePage(ewkView); + if (!page) + return; + + page->group().removeUserScriptsFromWorld(WebCore::mainThreadNormalWorld()); +} + +void DumpRenderTreeSupportEfl::addUserStyleSheet(const Evas_Object* ewkView, const String& sourceCode, bool allFrames) { WebCore::Page* page = EWKPrivate::corePage(ewkView); if (!page) @@ -393,6 +385,15 @@ void DumpRenderTreeSupportEfl::addUserStyleSheet(const Evas_Object* ewkView, con page->group().addUserStyleSheetToWorld(WebCore::mainThreadNormalWorld(), sourceCode, WebCore::KURL(), nullptr, nullptr, allFrames ? WebCore::InjectInAllFrames : WebCore::InjectInTopFrameOnly); } +void DumpRenderTreeSupportEfl::clearUserStyleSheets(const Evas_Object* ewkView) +{ + WebCore::Page* page = EWKPrivate::corePage(ewkView); + if (!page) + return; + + page->group().removeUserStyleSheetsFromWorld(WebCore::mainThreadNormalWorld()); +} + void DumpRenderTreeSupportEfl::executeCoreCommandByName(const Evas_Object* ewkView, const char* name, const char* value) { WebCore::Page* page = EWKPrivate::corePage(ewkView); @@ -402,14 +403,14 @@ void DumpRenderTreeSupportEfl::executeCoreCommandByName(const Evas_Object* ewkVi page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value); } -bool DumpRenderTreeSupportEfl::findString(const Evas_Object* ewkView, const char* text, WebCore::FindOptions options) +bool DumpRenderTreeSupportEfl::findString(const Evas_Object* ewkView, const String& text, WebCore::FindOptions options) { WebCore::Page* page = EWKPrivate::corePage(ewkView); if (!page) return false; - return page->findString(String::fromUTF8(text), options); + return page->findString(text, options); } void DumpRenderTreeSupportEfl::setJavaScriptProfilingEnabled(const Evas_Object* ewkView, bool enabled) @@ -620,3 +621,117 @@ void DumpRenderTreeSupportEfl::setAuthorAndUserStylesEnabled(Evas_Object* ewkVie corePage->settings()->setAuthorAndUserStylesEnabled(enabled); } + +void DumpRenderTreeSupportEfl::setComposition(Evas_Object* ewkView, const char* text, int start, int length) +{ + WebCore::Page* page = EWKPrivate::corePage(ewkView); + if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame()) + return; + + WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor(); + if (!editor || (!editor->canEdit() && !editor->hasComposition())) + return; + + const String compositionString = String::fromUTF8(text); + Vector<WebCore::CompositionUnderline> underlines; + underlines.append(WebCore::CompositionUnderline(0, compositionString.length(), WebCore::Color(0, 0, 0), false)); + editor->setComposition(compositionString, underlines, start, start + length); +} + +bool DumpRenderTreeSupportEfl::hasComposition(const Evas_Object* ewkView) +{ + const WebCore::Page* page = EWKPrivate::corePage(ewkView); + if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame()) + return false; + + const WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor(); + if (!editor) + return false; + + return editor->hasComposition(); +} + +bool DumpRenderTreeSupportEfl::compositionRange(Evas_Object* ewkView, int* start, int* length) +{ + *start = *length = 0; + + WebCore::Page* page = EWKPrivate::corePage(ewkView); + if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame()) + return false; + + WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor(); + if (!editor || !editor->hasComposition()) + return false; + + *start = editor->compositionStart(); + *length = editor->compositionEnd() - *start; + return true; +} + +void DumpRenderTreeSupportEfl::confirmComposition(Evas_Object* ewkView, const char* text) +{ + WebCore::Page* page = EWKPrivate::corePage(ewkView); + if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame()) + return; + + WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor(); + if (!editor) + return; + + if (!editor->hasComposition()) { + editor->insertText(String::fromUTF8(text), 0); + return; + } + + if (text) { + editor->confirmComposition(String::fromUTF8(text)); + return; + } + editor->confirmComposition(); +} + +WebCore::IntRect DumpRenderTreeSupportEfl::firstRectForCharacterRange(Evas_Object* ewkView, int location, int length) +{ + WebCore::Page* page = EWKPrivate::corePage(ewkView); + if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame() || !page->focusController()->focusedOrMainFrame()->editor()) + return WebCore::IntRect(); + + if ((location + length < location) && (location + length)) + length = 0; + + WebCore::Frame* frame = page->focusController()->focusedOrMainFrame(); + WebCore::Editor* editor = frame->editor(); + + RefPtr<WebCore::Range> range = WebCore::TextIterator::rangeFromLocationAndLength(frame->selection()->rootEditableElementOrDocumentElement(), location, length); + if (!range) + return WebCore::IntRect(); + + return editor->firstRectForRange(range.get()); +} + +bool DumpRenderTreeSupportEfl::selectedRange(Evas_Object* ewkView, int* start, int* length) +{ + if (!(start && length)) + return false; + + WebCore::Page* page = EWKPrivate::corePage(ewkView); + if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame()) + return false; + + WebCore::Frame* frame = page->focusController()->focusedOrMainFrame(); + RefPtr<WebCore::Range> range = frame->selection()->toNormalizedRange().get(); + if (!range) + return false; + + WebCore::Element* selectionRoot = frame->selection()->rootEditableElement(); + WebCore::Element* scope = selectionRoot ? selectionRoot : frame->document()->documentElement(); + + RefPtr<WebCore::Range> testRange = WebCore::Range::create(scope->document(), scope, 0, range->startContainer(), range->startOffset()); + *start = WebCore::TextIterator::rangeLength(testRange.get()); + + WebCore::ExceptionCode ec; + testRange->setEnd(range->endContainer(), range->endOffset(), ec); + *length = WebCore::TextIterator::rangeLength(testRange.get()); + + return true; +} diff --git a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h index d65fa74c4..5328f6776 100644 --- a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h @@ -62,18 +62,19 @@ public: static unsigned pendingUnloadEventCount(const Evas_Object* ewkFrame); static String renderTreeDump(Evas_Object* ewkFrame); static String responseMimeType(const Evas_Object* ewkFrame); - static void resumeAnimations(Evas_Object* ewkFrame); static WebCore::IntRect selectionRectangle(const Evas_Object* ewkFrame); static String suitableDRTFrameName(const Evas_Object* ewkFrame); - static void suspendAnimations(Evas_Object* ewkFrame); - static void setValueForUser(JSContextRef, JSValueRef nodeObject, JSStringRef value); + static void setValueForUser(JSContextRef, JSValueRef nodeObject, const String& value); static void setAutofilled(JSContextRef, JSValueRef nodeObject, bool autofilled); static void setDefersLoading(Evas_Object* ewkView, bool defers); static void setLoadsSiteIconsIgnoringImageLoadingSetting(Evas_Object* ewkView, bool loadsSiteIconsIgnoringImageLoadingPreferences); - static void addUserStyleSheet(const Evas_Object* ewkView, const char* sourceCode, bool allFrames); + static void addUserScript(const Evas_Object* ewkView, const String& sourceCode, bool runAtStart, bool allFrames); + static void clearUserScripts(const Evas_Object* ewkView); + static void addUserStyleSheet(const Evas_Object* ewkView, const String& sourceCode, bool allFrames); + static void clearUserStyleSheets(const Evas_Object* ewkView); static void executeCoreCommandByName(const Evas_Object* ewkView, const char* name, const char* value); - static bool findString(const Evas_Object* ewkView, const char* text, WebCore::FindOptions); + static bool findString(const Evas_Object* ewkView, const String& text, WebCore::FindOptions); static bool isCommandEnabled(const Evas_Object* ewkView, const char* name); static void setJavaScriptProfilingEnabled(const Evas_Object* ewkView, bool enabled); static void setSmartInsertDeleteEnabled(Evas_Object* ewkView, bool enabled); @@ -98,6 +99,14 @@ public: static void setInteractiveFormValidationEnabled(Evas_Object* ewkView, bool enabled); static JSValueRef computedStyleIncludingVisitedInfo(JSContextRef, JSValueRef); static void setAuthorAndUserStylesEnabled(Evas_Object* ewkView, bool); + + // TextInputController + static void setComposition(Evas_Object*, const char*, int, int); + static bool hasComposition(const Evas_Object*); + static bool compositionRange(Evas_Object*, int*, int*); + static void confirmComposition(Evas_Object*, const char*); + static WebCore::IntRect firstRectForCharacterRange(Evas_Object*, int, int); + static bool selectedRange(Evas_Object*, int*, int*); }; #endif // DumpRenderTreeSupportEfl_h diff --git a/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp index 8b9bc9fd4..9217cc1a5 100644 --- a/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp @@ -144,6 +144,15 @@ void EditorClientEfl::respondToChangedSelection(Frame* coreFrame) Evas_Object* webFrame = EWKPrivate::kitFrame(coreFrame); ewk_frame_editor_client_selection_changed(webFrame); + + if (!coreFrame->editor()->hasComposition() || coreFrame->editor()->ignoreCompositionSelectionChange()) + return; + + unsigned start; + unsigned end; + + if (!coreFrame->editor()->getCompositionSelection(start, end)) + coreFrame->editor()->cancelComposition(); } void EditorClientEfl::didEndEditing() diff --git a/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp index ea930222d..5185d1eb0 100644 --- a/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp @@ -596,9 +596,8 @@ void FrameLoaderClientEfl::dispatchWillClose() void FrameLoaderClientEfl::dispatchDidReceiveIcon() { - /* report received favicon only for main frame. */ - if (ewk_view_frame_main_get(m_view) != m_frame) - return; + // IconController loads icons only for the main frame. + ASSERT(ewk_view_frame_main_get(m_view) == m_frame); ewk_view_frame_main_icon_received(m_view); } @@ -621,9 +620,11 @@ void FrameLoaderClientEfl::dispatchDidReceiveTitle(const StringWithDirection& ti ewk_view_title_set(m_view, cs.data()); } -void FrameLoaderClientEfl::dispatchDidChangeIcons(WebCore::IconType) +void FrameLoaderClientEfl::dispatchDidChangeIcons(WebCore::IconType iconType) { - notImplemented(); + // Other touch types are apple-specific + ASSERT(iconType == WebCore::Favicon); + ewk_frame_icon_changed(m_frame); } void FrameLoaderClientEfl::dispatchDidCommitLoad() @@ -884,7 +885,7 @@ bool FrameLoaderClientEfl::shouldFallBack(const ResourceError& error) bool FrameLoaderClientEfl::canCachePage() const { - return false; + return true; } Frame* FrameLoaderClientEfl::dispatchCreatePage(const NavigationAction&) diff --git a/Source/WebKit/efl/ewk/ewk_frame.cpp b/Source/WebKit/efl/ewk/ewk_frame.cpp index 24a12eac9..964b69288 100644 --- a/Source/WebKit/efl/ewk/ewk_frame.cpp +++ b/Source/WebKit/efl/ewk/ewk_frame.cpp @@ -1724,6 +1724,20 @@ Ewk_Certificate_Status ewk_frame_certificate_status_get(Evas_Object* ewkFrame) /** * @internal + * Reports frame favicon changed. + * + * @param ewkFrame Frame. + * + * Emits signal: "icon,changed" with no parameters. + */ +void ewk_frame_icon_changed(Evas_Object* ewkFrame) +{ + DBG("ewkFrame=%p", ewkFrame); + evas_object_smart_callback_call(ewkFrame, "icon,changed", 0); +} + +/** + * @internal * Reports uri changed and swap internal string reference. * * Emits signal: "uri,changed" with new uri as parameter. diff --git a/Source/WebKit/efl/ewk/ewk_frame.h b/Source/WebKit/efl/ewk/ewk_frame.h index 08b4bc067..f5bba1b9a 100644 --- a/Source/WebKit/efl/ewk/ewk_frame.h +++ b/Source/WebKit/efl/ewk/ewk_frame.h @@ -39,6 +39,7 @@ * were changed due new layout, script actions or any other events. * - "editorclient,contents,changed", void: reports that editor client's * contents were changed + * - "icon,changed", void: frame favicon changed. * - "load,committed", void: reports load committed. * - "load,document,finished", void: frame finished loading the document. * - "load,error", const Ewk_Frame_Load_Error*: reports load failed @@ -396,7 +397,7 @@ EAPI Eina_Bool ewk_frame_contents_set(Evas_Object *o, const char *contents, s * @param base_uri base URI to use for relative resources, may be @c 0, * if provided must be an absolute uri * @param unreachable_uri the URI that failed to load and is getting the - * alternative representation + * alternative representation, must @b not be @c 0 * * @return @c EINA_TRUE on successful request, @c EINA_FALSE on errors */ diff --git a/Source/WebKit/efl/ewk/ewk_private.h b/Source/WebKit/efl/ewk/ewk_private.h index 26d448d0e..fa284f3de 100644 --- a/Source/WebKit/efl/ewk/ewk_private.h +++ b/Source/WebKit/efl/ewk/ewk_private.h @@ -241,6 +241,7 @@ void ewk_frame_title_set(Evas_Object* ewkFrame, const char* title); void ewk_frame_view_create_for_view(Evas_Object* ewkFrame, Evas_Object* view); bool ewk_frame_uri_changed(Evas_Object* ewkFrame); void ewk_frame_force_layout(Evas_Object* ewkFrame); +void ewk_frame_icon_changed(Evas_Object* ewkFrame); WTF::PassRefPtr<WebCore::Widget> ewk_frame_plugin_create(Evas_Object* ewkFrame, const WebCore::IntSize& pluginSize, WebCore::HTMLPlugInElement* element, const WebCore::KURL& url, const WTF::Vector<WTF::String>& paramNames, const WTF::Vector<WTF::String>& paramValues, const WTF::String& mimeType, bool loadManually); diff --git a/Source/WebKit/efl/ewk/ewk_settings.cpp b/Source/WebKit/efl/ewk/ewk_settings.cpp index 7866cde47..842930a7e 100644 --- a/Source/WebKit/efl/ewk/ewk_settings.cpp +++ b/Source/WebKit/efl/ewk/ewk_settings.cpp @@ -194,11 +194,6 @@ Eina_Bool ewk_settings_icon_database_path_set(const char* directory) const char* ewk_settings_icon_database_path_get(void) { - if (!WebCore::iconDatabase().isEnabled()) - return 0; - if (!WebCore::iconDatabase().isOpen()) - return 0; - return _ewk_icon_database_path; } diff --git a/Source/WebKit/efl/ewk/ewk_settings.h b/Source/WebKit/efl/ewk/ewk_settings.h index 8c2200e07..8aa2c31d9 100644 --- a/Source/WebKit/efl/ewk/ewk_settings.h +++ b/Source/WebKit/efl/ewk/ewk_settings.h @@ -147,7 +147,7 @@ EAPI Eina_Bool ewk_settings_icon_database_path_set(const char *path); * save yourself some cpu cycles and use eina_stringshare_ref() * instead of eina_stringshare_add() or strdup(). * - * @return database path or @c 0 if none is set or database is closed + * @return database path or @c 0 if none is set */ EAPI const char *ewk_settings_icon_database_path_get(void); diff --git a/Source/WebKit/efl/ewk/ewk_view.cpp b/Source/WebKit/efl/ewk/ewk_view.cpp index 7a0ee1ed6..8ec867d21 100644 --- a/Source/WebKit/efl/ewk/ewk_view.cpp +++ b/Source/WebKit/efl/ewk/ewk_view.cpp @@ -2778,8 +2778,7 @@ Eina_Bool ewk_view_paint(Ewk_View_Private_Data* priv, cairo_t* cr, const Eina_Re WebCore::FrameView* view = priv->mainFrame->view(); EINA_SAFETY_ON_NULL_RETURN_VAL(view, false); - if (view->needsLayout()) - view->forceLayout(); + view->updateLayoutAndStyleIfNeededRecursive(); WebCore::GraphicsContext graphicsContext(cr); WebCore::IntRect rect(*area); @@ -2806,6 +2805,7 @@ Eina_Bool ewk_view_paint_contents(Ewk_View_Private_Data* priv, cairo_t* cr, cons WebCore::GraphicsContext graphicsContext(cr); WebCore::IntRect rect(*area); + view->updateLayoutAndStyleIfNeededRecursive(); cairo_save(cr); graphicsContext.save(); graphicsContext.clip(rect); diff --git a/Source/WebKit/efl/ewk/ewk_view.h b/Source/WebKit/efl/ewk/ewk_view.h index 4d87724da..98210f828 100644 --- a/Source/WebKit/efl/ewk/ewk_view.h +++ b/Source/WebKit/efl/ewk/ewk_view.h @@ -2325,7 +2325,7 @@ EAPI void ewk_view_viewport_attributes_get(const Evas_Object *o, int *w, int *h, * @param min_scale the minimum value of the zoom range * @param max_scale the maximum value of the zoom range * - * @return @c EINA_TRUE if zoom range is changed, @c EINA_FALSE if not or on failure + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure */ EAPI Eina_Bool ewk_view_zoom_range_set(Evas_Object *o, float min_scale, float max_scale); diff --git a/Source/WebKit/gtk/ChangeLog b/Source/WebKit/gtk/ChangeLog index 770526e53..d9d0eb5d4 100644 --- a/Source/WebKit/gtk/ChangeLog +++ b/Source/WebKit/gtk/ChangeLog @@ -1,3 +1,68 @@ +2012-05-10 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Move resumeAnimations to use Internals interface + https://bugs.webkit.org/show_bug.cgi?id=86063 + + Reviewed by Alexey Proskuryakov. + + Remove resumeAnimations functions, because it is able to work in the + cross-port way through the Internals interface. + + * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: + * WebCoreSupport/DumpRenderTreeSupportGtk.h: + (DumpRenderTreeSupportGtk): + +2012-05-09 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Move suspendAnimations to use Internals interface. + https://bugs.webkit.org/show_bug.cgi?id=85986 + + Reviewed by Ryosuke Niwa. + + Remove suspendAnimations functions, because it is able to work in the + cross-port way through the Internals interface. + + * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: + * WebCoreSupport/DumpRenderTreeSupportGtk.h: + (DumpRenderTreeSupportGtk): + +2012-05-09 Simon Pena <spena@igalia.com> + + [GTK] Missing WebPreferences for media playback requiring user gestures and inline playback + https://bugs.webkit.org/show_bug.cgi?id=85194 + + Reviewed by Martin Robinson. + + Expose WebPreferences for media playback requires user gesture and + media playback allows inline to GTK side. + + This adds two properties (mediaPlaybackRequiresUserGesture and + mediaPlaybackAllowsInline) to GTK WebKit WebSettings, and connects + them to the WebKit WebView, so clients can programmatically modify + them. + + * webkit/webkitwebsettings.cpp: install new properties and update + setter and getter + (webkit_web_settings_class_init): + (webkit_web_settings_set_property): + (webkit_web_settings_get_property): + * webkit/webkitwebsettingsprivate.h: add media playback related + properties + * webkit/webkitwebview.cpp: connect newly added properties + (webkit_web_view_update_settings): + (webkit_web_view_settings_notify): + +2012-05-09 Dan Winship <danw@gnome.org> + + [GTK] don't use soup_session_pause_message in webkitdownload + https://bugs.webkit.org/show_bug.cgi?id=85931 + + Reviewed by Martin Robinson. + + * webkit/webkitdownload.cpp: + (webkit_download_new_with_handle): + (webkit_download_start): + 2012-05-06 Gyuyoung Kim <gyuyoung.kim@samsung.com> Convert isPageBoxVisible to use Internals interface. diff --git a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp index 1a0f32f2d..03827b4b7 100644 --- a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp @@ -363,24 +363,6 @@ unsigned int DumpRenderTreeSupportGtk::numberOfActiveAnimations(WebKitWebFrame* return coreFrame->animation()->numberOfActiveAnimations(coreFrame->document()); } -void DumpRenderTreeSupportGtk::suspendAnimations(WebKitWebFrame* frame) -{ - Frame* coreFrame = core(frame); - if (!coreFrame) - return; - - return coreFrame->animation()->suspendAnimations(); -} - -void DumpRenderTreeSupportGtk::resumeAnimations(WebKitWebFrame* frame) -{ - Frame* coreFrame = core(frame); - if (!coreFrame) - return; - - return coreFrame->animation()->resumeAnimations(); -} - void DumpRenderTreeSupportGtk::clearMainFrameName(WebKitWebFrame* frame) { g_return_if_fail(WEBKIT_IS_WEB_FRAME(frame)); diff --git a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h index 7db85cffe..a0fd1a567 100644 --- a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h +++ b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h @@ -72,8 +72,6 @@ public: static bool pauseTransition(WebKitWebFrame*, const char* name, double time, const char* element); static WTF::CString markerTextForListItem(WebKitWebFrame*, JSContextRef, JSValueRef nodeObject); static unsigned int numberOfActiveAnimations(WebKitWebFrame*); - static void suspendAnimations(WebKitWebFrame*); - static void resumeAnimations(WebKitWebFrame*); static void clearMainFrameName(WebKitWebFrame*); static AtkObject* getFocusedAccessibleElement(WebKitWebFrame*); static AtkObject* getRootAccessibleElement(WebKitWebFrame*); diff --git a/Source/WebKit/gtk/webkit/webkitdownload.cpp b/Source/WebKit/gtk/webkit/webkitdownload.cpp index 871db2c62..e698ed505 100644 --- a/Source/WebKit/gtk/webkit/webkitdownload.cpp +++ b/Source/WebKit/gtk/webkit/webkitdownload.cpp @@ -421,14 +421,11 @@ WebKitDownload* webkit_download_new_with_handle(WebKitNetworkRequest* request, W { g_return_val_if_fail(request, NULL); - ResourceHandleInternal* d = handle->getInternal(); - if (d->m_soupMessage) - soup_session_pause_message(webkit_get_default_session(), d->m_soupMessage.get()); - WebKitDownload* download = WEBKIT_DOWNLOAD(g_object_new(WEBKIT_TYPE_DOWNLOAD, "network-request", request, NULL)); WebKitDownloadPrivate* priv = download->priv; handle->ref(); + handle->setDefersLoading(true); priv->resourceHandle = handle; webkit_download_set_response(download, response); @@ -513,10 +510,7 @@ void webkit_download_start(WebKitDownload* download) priv->resourceHandle = ResourceHandle::create(/* Null NetworkingContext */ NULL, core(priv->networkRequest), priv->downloadClient, false, false); else { priv->resourceHandle->setClient(priv->downloadClient); - - ResourceHandleInternal* d = priv->resourceHandle->getInternal(); - if (d->m_soupMessage) - soup_session_unpause_message(webkit_get_default_session(), d->m_soupMessage.get()); + priv->resourceHandle->setDefersLoading(false); } priv->timer = g_timer_new(); diff --git a/Source/WebKit/gtk/webkit/webkitwebsettings.cpp b/Source/WebKit/gtk/webkit/webkitwebsettings.cpp index 1a3a27eb4..ce877e4f0 100644 --- a/Source/WebKit/gtk/webkit/webkitwebsettings.cpp +++ b/Source/WebKit/gtk/webkit/webkitwebsettings.cpp @@ -121,7 +121,9 @@ enum { PROP_ENABLE_WEBGL, PROP_ENABLE_WEB_AUDIO, PROP_ENABLE_ACCELERATED_COMPOSITING, - PROP_ENABLE_SMOOTH_SCROLLING + PROP_ENABLE_SMOOTH_SCROLLING, + PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE, + PROP_MEDIA_PLAYBACK_ALLOWS_INLINE }; // Create a default user agent string @@ -972,6 +974,43 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass) _("Whether to enable smooth scrolling"), FALSE, flags)); + + /** + * WebKitWebSettings:media-playback-requires-user-gesture + * + * Whether a user gesture (such as clicking the play button) would + * be required to start media playback or load media. This is off + * by default, so media playback could start automatically. Setting + * it on requires a gesture by the user to start playback, or to load + * the media. + * + * Since: 1.10.0 + */ + g_object_class_install_property(gobject_class, + PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE, + g_param_spec_boolean("media-playback-requires-user-gesture", + _("Media playback requires user gesture"), + _("Whether media playback requires user gesture"), + FALSE, + flags)); + + /** + * WebKitWebSettings:media-playback-allows-inline + * + * Whether media playback is full-screen only or inline playback is allowed. + * This is true by default, so media playback can be inline. Setting it to + * false allows specifying that media playback should be always fullscreen. + * + * Since: 1.10.0 + */ + g_object_class_install_property(gobject_class, + PROP_MEDIA_PLAYBACK_ALLOWS_INLINE, + g_param_spec_boolean("media-playback-allows-inline", + _("Media playback allows inline"), + _("Whether media playback allows inline"), + TRUE, + flags)); + } static void webkit_web_settings_init(WebKitWebSettings* web_settings) @@ -1150,6 +1189,12 @@ static void webkit_web_settings_set_property(GObject* object, guint prop_id, con case PROP_ENABLE_SMOOTH_SCROLLING: priv->enableSmoothScrolling = g_value_get_boolean(value); break; + case PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE: + priv->mediaPlaybackRequiresUserGesture = g_value_get_boolean(value); + break; + case PROP_MEDIA_PLAYBACK_ALLOWS_INLINE: + priv->mediaPlaybackAllowsInline = g_value_get_boolean(value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -1318,6 +1363,12 @@ static void webkit_web_settings_get_property(GObject* object, guint prop_id, GVa case PROP_ENABLE_SMOOTH_SCROLLING: g_value_set_boolean(value, priv->enableSmoothScrolling); break; + case PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE: + g_value_set_boolean(value, priv->mediaPlaybackRequiresUserGesture); + break; + case PROP_MEDIA_PLAYBACK_ALLOWS_INLINE: + g_value_set_boolean(value, priv->mediaPlaybackAllowsInline); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; diff --git a/Source/WebKit/gtk/webkit/webkitwebsettingsprivate.h b/Source/WebKit/gtk/webkit/webkitwebsettingsprivate.h index 45f822371..5ed24a537 100644 --- a/Source/WebKit/gtk/webkit/webkitwebsettingsprivate.h +++ b/Source/WebKit/gtk/webkit/webkitwebsettingsprivate.h @@ -81,6 +81,8 @@ struct _WebKitWebSettingsPrivate { gboolean enableWebAudio; gboolean enableAcceleratedCompositing; gboolean enableSmoothScrolling; + gboolean mediaPlaybackRequiresUserGesture; + gboolean mediaPlaybackAllowsInline; }; WEBKIT_API void webkit_web_settings_add_extra_plugin_directory(WebKitWebView*, const gchar* directory); diff --git a/Source/WebKit/gtk/webkit/webkitwebview.cpp b/Source/WebKit/gtk/webkit/webkitwebview.cpp index 80e2fc3a3..300ea8c99 100644 --- a/Source/WebKit/gtk/webkit/webkitwebview.cpp +++ b/Source/WebKit/gtk/webkit/webkitwebview.cpp @@ -3334,6 +3334,8 @@ static void webkit_web_view_update_settings(WebKitWebView* webView) coreSettings->setJavaEnabled(settingsPrivate->enableJavaApplet); coreSettings->setHyperlinkAuditingEnabled(settingsPrivate->enableHyperlinkAuditing); coreSettings->setDNSPrefetchingEnabled(settingsPrivate->enableDNSPrefetching); + coreSettings->setMediaPlaybackRequiresUserGesture(settingsPrivate->mediaPlaybackRequiresUserGesture); + coreSettings->setMediaPlaybackAllowsInline(settingsPrivate->mediaPlaybackAllowsInline); #if ENABLE(SQL_DATABASE) AbstractDatabase::setIsAvailable(settingsPrivate->enableHTML5Database); @@ -3475,6 +3477,10 @@ static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GPar settings->setJavaEnabled(g_value_get_boolean(&value)); else if (name == g_intern_string("enable-hyperlink-auditing")) settings->setHyperlinkAuditingEnabled(g_value_get_boolean(&value)); + else if (name == g_intern_string("media-playback-requires-user-gesture")) + settings->setMediaPlaybackRequiresUserGesture(g_value_get_boolean(&value)); + else if (name == g_intern_string("media-playback-allows-inline")) + settings->setMediaPlaybackAllowsInline(g_value_get_boolean(&value)); #if ENABLE(SPELLCHECK) else if (name == g_intern_string("spell-checking-languages")) { diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index e103b9942..f35e19a6e 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,109 @@ +2012-05-10 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Move resumeAnimations to use Internals interface + https://bugs.webkit.org/show_bug.cgi?id=86063 + + Reviewed by Alexey Proskuryakov. + + Remove resumeAnimations functions, because it is able to work in the + cross-port way through the Internals interface. + + * WebKit.order: + * WebView/WebFrame.mm: + * WebView/WebFramePrivate.h: + +2012-05-10 Anders Carlsson <andersca@apple.com> + + WebKit1: Add a way to blacklist specific plug-ins/plug-in versions + https://bugs.webkit.org/show_bug.cgi?id=86150 + <rdar://problem/9551196> + + Reviewed by Sam Weinig. + + * Misc/WebKitErrors.h: + Add WebKitErrorInsecurePlugInVersion enum. + + * Plugins/WebBasePluginPackage.h: + * Plugins/WebBasePluginPackage.mm: + (-[WebBasePluginPackage bundleIdentifier]): + (-[WebBasePluginPackage bundleVersion]): + Add bundleIdentifier and bundleVersion getters. + + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::createPlugin): + Check if the plug-in is blocked. If it is, set the unavailability reason and the error code. + +2012-05-10 Anders Carlsson <andersca@apple.com> + + Rename the missing plug-in indicator to the unavailable plug-in indicator + https://bugs.webkit.org/show_bug.cgi?id=86136 + + Reviewed by Sam Weinig. + + * Plugins/Hosted/WebHostedNetscapePluginView.mm: + (-[WebHostedNetscapePluginView pluginHostDied]): + * WebCoreSupport/WebChromeClient.h: + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::shouldUnavailablePluginMessageBeButton): + (WebChromeClient::unavailablePluginButtonClicked): + +2012-05-09 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Move suspendAnimations to use Internals interface. + https://bugs.webkit.org/show_bug.cgi?id=85986 + + Reviewed by Ryosuke Niwa. + + Remove suspendAnimations functions, because it is able to work in the + cross-port way through the Internals interface. + + * WebKit.order: + * WebView/WebFrame.mm: + * WebView/WebFramePrivate.h: + +2012-05-08 Kent Tamura <tkent@chromium.org> + + Fixe Chromium build, and add a FIXME comment about a layering violation. + + * WebCoreSupport/WebSystemInterface.mm: + (InitWebCoreSystemInterface): + +2012-05-08 Jon Lee <jonlee@apple.com> + + Safari warns that it needs to resend the form in an iFrame when going back + https://bugs.webkit.org/show_bug.cgi?id=82658 + <rdar://problem/11292558> + + Reviewed by Darin Adler. + + * WebCoreSupport/WebSystemInterface.mm: + (InitWebCoreSystemInterface): Add wkCFURLRequestAllowAllPostCaching. + +2012-05-08 Timothy Hatcher <timothy@apple.com> + + Fix the SOFT_LINK_STAGED_FRAMEWORK_OPTIONAL macro so it passes the full path to dlopen. + + <rdar://problem/11406517> + + Reviewed by Mark Rowe. + + * WebCoreSupport/WebInspectorClient.mm: Pass A to SOFT_LINK_STAGED_FRAMEWORK_OPTIONAL for the version. + +2012-05-07 Andy Estes <aestes@apple.com> + + ENABLE_IFRAME_SEAMLESS should be part of FEATURE_DEFINES. + + * Configurations/FeatureDefines.xcconfig: + +2012-05-07 Eric Seidel <eric@webkit.org> + + Add ENABLE_IFRAME_SEAMLESS so Apple can turn off SEAMLESS if needed + https://bugs.webkit.org/show_bug.cgi?id=85822 + + Reviewed by Adam Barth. + + * Configurations/FeatureDefines.xcconfig: + 2012-05-05 Dean Jackson <dino@apple.com> Add new Setting/Preference to disable requestAnimationFrame diff --git a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig index 2dc145f36..91d688b53 100644 --- a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -54,6 +54,7 @@ ENABLE_GEOLOCATION = ENABLE_GEOLOCATION; ENABLE_HIGH_DPI_CANVAS = ENABLE_HIGH_DPI_CANVAS; ENABLE_ICONDATABASE = $(ENABLE_ICONDATABASE_$(REAL_PLATFORM_NAME)); ENABLE_ICONDATABASE_macosx = ENABLE_ICONDATABASE; +ENABLE_IFRAME_SEAMLESS = ENABLE_IFRAME_SEAMLESS; ENABLE_INDEXED_DATABASE = ; ENABLE_INPUT_SPEECH = ; ENABLE_INPUT_TYPE_COLOR = ; @@ -121,4 +122,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_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_SHADERS) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(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_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_SHADERS) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(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_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebKit/mac/Configurations/Version.xcconfig b/Source/WebKit/mac/Configurations/Version.xcconfig index 011c8bc6a..4404b895a 100644 --- a/Source/WebKit/mac/Configurations/Version.xcconfig +++ b/Source/WebKit/mac/Configurations/Version.xcconfig @@ -21,8 +21,8 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -MAJOR_VERSION = 536; -MINOR_VERSION = 11; +MAJOR_VERSION = 537; +MINOR_VERSION = 1; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebKit/mac/Misc/WebKitErrors.h b/Source/WebKit/mac/Misc/WebKitErrors.h index e4cbdcc72..ec47fe6a2 100644 --- a/Source/WebKit/mac/Misc/WebKitErrors.h +++ b/Source/WebKit/mac/Misc/WebKitErrors.h @@ -56,4 +56,5 @@ enum { WebKitErrorCannotFindPlugIn = 200, WebKitErrorCannotLoadPlugIn = 201, WebKitErrorJavaUnavailable = 202, + WebKitErrorInsecurePlugInVersion = 203, }; diff --git a/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm index 8ad8fe0cf..165a00662 100644 --- a/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm +++ b/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm @@ -392,7 +392,7 @@ extern "C" { if (_element->renderer() && _element->renderer()->isEmbeddedObject()) { // FIXME: The renderer could also be a RenderApplet, we should handle that. RenderEmbeddedObject* renderer = toRenderEmbeddedObject(_element->renderer()); - renderer->setShowsCrashedPluginIndicator(); + renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::PluginCrashed); } _pluginLayer = nil; diff --git a/Source/WebKit/mac/Plugins/WebBasePluginPackage.h b/Source/WebKit/mac/Plugins/WebBasePluginPackage.h index a42a82ef3..cf8846410 100644 --- a/Source/WebKit/mac/Plugins/WebBasePluginPackage.h +++ b/Source/WebKit/mac/Plugins/WebBasePluginPackage.h @@ -77,7 +77,8 @@ typedef void (*BP_CreatePluginMIMETypesPreferencesFuncPtr)(void); - (const WebCore::PluginInfo&)pluginInfo; -- (WTF::String)bundleIdentifier; +- (String)bundleIdentifier; +- (String)bundleVersion; - (BOOL)supportsExtension:(const WTF::String&)extension; - (BOOL)supportsMIMEType:(const WTF::String&)MIMEType; diff --git a/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm b/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm index 1d1409ec8..e4cd8584d 100644 --- a/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm +++ b/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm @@ -463,11 +463,24 @@ static inline void swapIntsInHeader(uint32_t* rawData, size_t length) [pluginDatabases removeObject:database]; } -- (WTF::String)bundleIdentifier +- (String)bundleIdentifier { return CFBundleGetIdentifier(cfBundle.get()); } +- (String)bundleVersion +{ + CFDictionaryRef infoDictionary = CFBundleGetInfoDictionary(cfBundle.get()); + if (!infoDictionary) + return String(); + + CFTypeRef bundleVersionString = CFDictionaryGetValue(infoDictionary, kCFBundleVersionKey); + if (!bundleVersionString || CFGetTypeID(bundleVersionString) != CFStringGetTypeID()) + return String(); + + return reinterpret_cast<CFStringRef>(bundleVersionString); +} + @end @implementation NSArray (WebPluginExtensions) diff --git a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h index 0576aff83..16041b0cc 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h +++ b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h @@ -102,8 +102,8 @@ public: virtual void setStatusbarText(const WTF::String&) OVERRIDE; virtual void scrollbarsModeDidChange() const OVERRIDE { } - virtual bool shouldMissingPluginMessageBeButton() const OVERRIDE; - virtual void missingPluginButtonClicked(WebCore::Element*) const OVERRIDE; + virtual bool shouldUnavailablePluginMessageBeButton(WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const OVERRIDE; + virtual void unavailablePluginButtonClicked(WebCore::Element*, WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const OVERRIDE; virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags) OVERRIDE; virtual void setToolTip(const WTF::String&, WebCore::TextDirection) OVERRIDE; diff --git a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm index 98f5c5d1b..2ea0d6672 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm @@ -590,13 +590,17 @@ void WebChromeClient::scrollRectIntoView(const IntRect& r) const // End host window methods. -bool WebChromeClient::shouldMissingPluginMessageBeButton() const +bool WebChromeClient::shouldUnavailablePluginMessageBeButton(RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason) const { - return [[m_webView UIDelegate] respondsToSelector:@selector(webView:didPressMissingPluginButton:)]; + if (pluginUnavailabilityReason == RenderEmbeddedObject::PluginMissing) + return [[m_webView UIDelegate] respondsToSelector:@selector(webView:didPressMissingPluginButton:)]; + + return false; } -void WebChromeClient::missingPluginButtonClicked(Element* element) const +void WebChromeClient::unavailablePluginButtonClicked(Element* element, RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason) const { + ASSERT_UNUSED(pluginUnavailabilityReason, pluginUnavailabilityReason == RenderEmbeddedObject::PluginMissing); CallUIDelegate(m_webView, @selector(webView:didPressMissingPluginButton:), kit(element)); } diff --git a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index b8ac274e9..f787bfb77 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -1665,25 +1665,31 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize& size, HTMLP NSView *view = nil; if (pluginPackage) { - if ([pluginPackage isKindOfClass:[WebPluginPackage class]]) - view = pluginView(m_webFrame.get(), (WebPluginPackage *)pluginPackage, attributeKeys, kit(paramValues), baseURL, kit(element), loadManually); - + if (!WKShouldBlockPlugin([pluginPackage bundleIdentifier], [pluginPackage bundleVersion])) { + if ([pluginPackage isKindOfClass:[WebPluginPackage class]]) + view = pluginView(m_webFrame.get(), (WebPluginPackage *)pluginPackage, attributeKeys, kit(paramValues), baseURL, kit(element), loadManually); + #if ENABLE(NETSCAPE_PLUGIN_API) - else if ([pluginPackage isKindOfClass:[WebNetscapePluginPackage class]]) { - WebBaseNetscapePluginView *pluginView = [[[NETSCAPE_PLUGIN_VIEW alloc] - initWithFrame:NSMakeRect(0, 0, size.width(), size.height()) - pluginPackage:(WebNetscapePluginPackage *)pluginPackage - URL:pluginURL - baseURL:baseURL - MIMEType:MIMEType - attributeKeys:attributeKeys - attributeValues:kit(paramValues) - loadManually:loadManually - element:element] autorelease]; - - return adoptRef(new NetscapePluginWidget(pluginView)); - } + else if ([pluginPackage isKindOfClass:[WebNetscapePluginPackage class]]) { + WebBaseNetscapePluginView *pluginView = [[[NETSCAPE_PLUGIN_VIEW alloc] + initWithFrame:NSMakeRect(0, 0, size.width(), size.height()) + pluginPackage:(WebNetscapePluginPackage *)pluginPackage + URL:pluginURL + baseURL:baseURL + MIMEType:MIMEType + attributeKeys:attributeKeys + attributeValues:kit(paramValues) + loadManually:loadManually + element:element] autorelease]; + + return adoptRef(new NetscapePluginWidget(pluginView)); + } #endif + } else { + errorCode = WebKitErrorInsecurePlugInVersion; + if (element->renderer()->isEmbeddedObject()) + toRenderEmbeddedObject(element->renderer())->setPluginUnavailabilityReason(RenderEmbeddedObject::InsecurePluginVersion); + } } else errorCode = WebKitErrorCannotFindPlugIn; diff --git a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm index edee884c9..bd7b600a9 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm @@ -47,7 +47,7 @@ #import <WebKitSystemInterface.h> #import <wtf/PassOwnPtr.h> -SOFT_LINK_STAGED_FRAMEWORK_OPTIONAL(WebInspector, PrivateFrameworks) +SOFT_LINK_STAGED_FRAMEWORK_OPTIONAL(WebInspector, PrivateFrameworks, A) using namespace WebCore; diff --git a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm index 06a3ea37c..00f79b546 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm @@ -170,21 +170,28 @@ void InitWebCoreSystemInterface(void) INIT(SetCFURLResponseMIMEType); INIT(SetMetadataURL); - + +#if PLATFORM(MAC) + // FIXME: We should stop using this file in Chromium. + #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) INIT(CreateVMPressureDispatchOnMainQueue); #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) INIT(GetMacOSXVersionString); INIT(ExecutableWasLinkedOnOrBeforeLion); #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) INIT(CGPathAddRoundedRect); #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if !defined(BUILDING_ON_SNOW_LEOPARD) + INIT(CFURLRequestAllowAllPostCaching); +#endif + +#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) INIT(FilterIsManagedSession); INIT(FilterCreateInstance); INIT(FilterRelease); @@ -192,5 +199,6 @@ void InitWebCoreSystemInterface(void) INIT(FilterAddData); INIT(FilterDataComplete); #endif +#endif didInit = true; } diff --git a/Source/WebKit/mac/WebKit.order b/Source/WebKit/mac/WebKit.order index 514881484..1a1eb0c72 100644 --- a/Source/WebKit/mac/WebKit.order +++ b/Source/WebKit/mac/WebKit.order @@ -1221,8 +1221,6 @@ _WKExecutableWasLinkedOnOrBeforeSnowLeopard __ZNK7WebCore12ChromeClient29dispatchViewportDataDidChangeERKNS_17ViewportArgumentsE -[WebView(WebPrivate) setFrameSize:] -[WebFrame(WebKitDebug) renderTreeAsExternalRepresentationForPrinting:] --[WebFrame(WebPrivate) _suspendAnimations] --[WebFrame(WebPrivate) _resumeAnimations] +[WebView(WebPrivate) _pointingHandCursor] _WKGetCFURLResponseURL _WKGetCFURLResponseHTTPResponse diff --git a/Source/WebKit/mac/WebView/WebFrame.mm b/Source/WebKit/mac/WebView/WebFrame.mm index 02f4a3c68..416bd7dfe 100644 --- a/Source/WebKit/mac/WebView/WebFrame.mm +++ b/Source/WebKit/mac/WebView/WebFrame.mm @@ -998,24 +998,6 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return controller->numberOfActiveAnimations(frame->document()); } -- (void) _suspendAnimations -{ - Frame* frame = core(self); - if (!frame) - return; - - frame->animation()->suspendAnimations(); -} - -- (void) _resumeAnimations -{ - Frame* frame = core(self); - if (!frame) - return; - - frame->animation()->resumeAnimations(); -} - - (void)_replaceSelectionWithFragment:(DOMDocumentFragment *)fragment selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace matchStyle:(BOOL)matchStyle { if (_private->coreFrame->selection()->isNone() || !fragment) diff --git a/Source/WebKit/mac/WebView/WebFramePrivate.h b/Source/WebKit/mac/WebView/WebFramePrivate.h index cb521c3ea..9dea7e1b4 100644 --- a/Source/WebKit/mac/WebView/WebFramePrivate.h +++ b/Source/WebKit/mac/WebView/WebFramePrivate.h @@ -107,10 +107,6 @@ typedef enum { // Returns the total number of currently running animations (includes both CSS transitions and CSS animations). - (unsigned)_numberOfActiveAnimations; -// Suspend and resume animations (includes both CSS transitions and CSS animations). -- (void)_suspendAnimations; -- (void)_resumeAnimations; - - (void)_replaceSelectionWithFragment:(DOMDocumentFragment *)fragment selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace matchStyle:(BOOL)matchStyle; - (void)_replaceSelectionWithText:(NSString *)text selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace; - (void)_replaceSelectionWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace; diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp index e85dfd282..2e330acff 100644 --- a/Source/WebKit/qt/Api/qwebpage.cpp +++ b/Source/WebKit/qt/Api/qwebpage.cpp @@ -3407,7 +3407,7 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) \inmodule QtWebKit - \sa QWebPage::extension() QWebPage::ExtensionReturn + \sa QWebPage::extension(), QWebPage::ExtensionReturn */ @@ -3418,7 +3418,7 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) \inmodule QtWebKit - \sa QWebPage::extension() QWebPage::ExtensionOption + \sa QWebPage::extension(), QWebPage::ExtensionOption */ /*! @@ -3434,7 +3434,7 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) The error itself is reported by an error \a domain, the \a error code as well as \a errorString. - \sa QWebPage::extension() QWebPage::ErrorPageExtensionReturn + \sa QWebPage::extension(), QWebPage::ErrorPageExtensionReturn */ /*! @@ -3481,7 +3481,7 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) External objects such as stylesheets or images referenced in the HTML are located relative to \a baseUrl. - \sa QWebPage::extension() QWebPage::ErrorPageExtensionOption, QString::toUtf8() + \sa QWebPage::extension(), QWebPage::ErrorPageExtensionOption, QString::toUtf8() */ /*! @@ -3524,7 +3524,7 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) The ChooseMultipleFilesExtensionOption class holds the frame originating the request and the suggested filenames which might be provided. - \sa QWebPage::extension() QWebPage::chooseFile(), QWebPage::ChooseMultipleFilesExtensionReturn + \sa QWebPage::extension(), QWebPage::chooseFile(), QWebPage::ChooseMultipleFilesExtensionReturn */ /*! @@ -3553,7 +3553,7 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) The ChooseMultipleFilesExtensionReturn class holds the filenames selected by the user when the extension is invoked. - \sa QWebPage::extension() QWebPage::ChooseMultipleFilesExtensionOption + \sa QWebPage::extension(), QWebPage::ChooseMultipleFilesExtensionOption */ /*! diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp index ca264c8af..4e01836f7 100644 --- a/Source/WebKit/qt/Api/qwebsettings.cpp +++ b/Source/WebKit/qt/Api/qwebsettings.cpp @@ -1174,7 +1174,11 @@ void QWebSettings::enablePersistentStorage(const QString& path) #if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE) // All applications can share the common QtWebkit cache file(s). // Path is not configurable and uses QDesktopServices::CacheLocation by default. +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + QString cachePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); +#else QString cachePath = QDesktopServices::storageLocation(QDesktopServices::CacheLocation); +#endif WebCore::makeAllDirectories(cachePath); QFileInfo info(cachePath); diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index 9bb4acc99..6881af4a1 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,60 @@ +2012-05-10 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Move resumeAnimations to use Internals interface + https://bugs.webkit.org/show_bug.cgi?id=86063 + + Reviewed by Alexey Proskuryakov. + + Remove resumeAnimations functions, because it is able to work in the + cross-port way through the Internals interface. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + * WebCoreSupport/DumpRenderTreeSupportQt.h: + +2012-05-10 Marius Storm-Olsen <marius.storm-olsen@nokia.com> + + [Qt] Fix \sa usage in documentation + + Ensure comma between elements (6 missing). + + Reviewed by Tor Arne Vestbø. + + * Api/qwebpage.cpp: + +2012-05-09 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Move suspendAnimations to use Internals interface. + https://bugs.webkit.org/show_bug.cgi?id=85986 + + Reviewed by Ryosuke Niwa. + + Remove suspendAnimations functions, because it is able to work in the + cross-port way through the Internals interface. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + * WebCoreSupport/DumpRenderTreeSupportQt.h: + +2012-05-08 Balazs Kelemen <kbalazs@webkit.org> + + [Qt] X11 plugins need to be reworked for Qt5+WK1 + https://bugs.webkit.org/show_bug.cgi?id=80691 + + Reviewed by Simon Hausmann. + + * Api/qwebsettings.cpp: + (QWebSettings::enablePersistentStorage): + Build fix for Qt5. + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::createPlugin): + Inject the wmode parameter for flash so it will + work in windowless, non-transparent mode which + is the only one we support currently. + * WebCoreSupport/PageClientQt.cpp: + (WebCore): + (WebCore::QWebPageClient::ownerWindow): + Added a getter for the top level window so the PluginView + can get it without calling into QtWidgets code. + 2012-05-06 Gyuyoung Kim <gyuyoung.kim@samsung.com> Convert isPageBoxVisible to use Internals interface. diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index f55e25667..2d4fb5057 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -384,32 +384,6 @@ int DumpRenderTreeSupportQt::numberOfActiveAnimations(QWebFrame *frame) return controller->numberOfActiveAnimations(coreFrame->document()); } -void DumpRenderTreeSupportQt::suspendAnimations(QWebFrame *frame) -{ - Frame* coreFrame = QWebFramePrivate::core(frame); - if (!coreFrame) - return; - - AnimationController* controller = coreFrame->animation(); - if (!controller) - return; - - controller->suspendAnimations(); -} - -void DumpRenderTreeSupportQt::resumeAnimations(QWebFrame *frame) -{ - Frame* coreFrame = QWebFramePrivate::core(frame); - if (!coreFrame) - return; - - AnimationController* controller = coreFrame->animation(); - if (!controller) - return; - - controller->resumeAnimations(); -} - void DumpRenderTreeSupportQt::clearFrameName(QWebFrame* frame) { Frame* coreFrame = QWebFramePrivate::core(frame); diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h index eadc1af35..373f60e70 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -141,8 +141,6 @@ public: static void clearFrameName(QWebFrame* frame); static void overwritePluginDirectories(); static int numberOfActiveAnimations(QWebFrame*); - static void suspendAnimations(QWebFrame*); - static void resumeAnimations(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); diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 85b609185..c23311daa 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -1603,9 +1603,14 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, Vector<String> params = paramNames; Vector<String> values = paramValues; if (mimeType == "application/x-shockwave-flash") { +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + const bool shouldInjectWmode = true; +#else + // Inject wmode=opaque when there is no client or the client is not a QWebView. QWebPageClient* client = m_webFrame->page()->d->client.get(); - const bool isQWebView = client && qobject_cast<QWidget*>(client->pluginParent()); - if (!isQWebView) { + const bool shouldInjectWmode = !(client && qobject_cast<QWidget*>(client->pluginParent())); +#endif + if (shouldInjectWmode) { // Inject wmode=opaque when there is no client or the client is not a QWebView. size_t wmodeIndex = params.find("wmode"); if (wmodeIndex == WTF::notFound) { diff --git a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp index 6f96ce1ba..ed61d1f96 100644 --- a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp @@ -69,6 +69,20 @@ static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformG #include "texmap/TextureMapperLayer.h" #endif +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +QWindow* QWebPageClient::ownerWindow() const +{ + QWidget* widget = ownerWidget(); + if (!widget) + return 0; + if (QWindow *window = widget->windowHandle()) + return window; + if (const QWidget *nativeParent = widget->nativeParentWidget()) + return nativeParent->windowHandle(); + return 0; +} +#endif + namespace WebCore { #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog index 56dea8721..c2a96b080 100644 --- a/Source/WebKit/win/ChangeLog +++ b/Source/WebKit/win/ChangeLog @@ -1,3 +1,62 @@ +2012-05-10 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Move resumeAnimations to use Internals interface + https://bugs.webkit.org/show_bug.cgi?id=86063 + + Reviewed by Alexey Proskuryakov. + + Remove resumeAnimations functions, because it is able to work in the + cross-port way through the Internals interface. + + * Interfaces/IWebFramePrivate.idl: + * WebFrame.cpp: + * WebFrame.h: + +2012-05-10 Anders Carlsson <andersca@apple.com> + + Rename the missing plug-in indicator to the unavailable plug-in indicator + https://bugs.webkit.org/show_bug.cgi?id=86136 + + Reviewed by Sam Weinig. + + * WebCoreSupport/WebChromeClient.cpp: + (WebChromeClient::shouldUnavailablePluginMessageBeButton): + (WebChromeClient::unavailablePluginButtonClicked): + * WebCoreSupport/WebChromeClient.h: + (WebChromeClient): + +2012-05-09 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Move suspendAnimations to use Internals interface. + https://bugs.webkit.org/show_bug.cgi?id=85986 + + Reviewed by Ryosuke Niwa. + + Remove suspendAnimations functions, because it is able to work in the + cross-port way through the Internals interface. + + * Interfaces/IWebFramePrivate.idl: + * WebFrame.cpp: + * WebFrame.h: + +2012-05-07 Julien Chaffraix <jchaffraix@webkit.org> + + Refactor windowClipRectForLayer to remove the explicit RenderLayer dependency + https://bugs.webkit.org/show_bug.cgi?id=84090 + + Reviewed by David Hyatt. + + * WebCoreSupport/EmbeddedWidget.cpp: + (EmbeddedWidget::windowClipRect): + Updated after windowClipRectForLayer name and signature change. + + * WebCoreSupport/EmbeddedWidget.h: + (EmbeddedWidget): + (EmbeddedWidget::EmbeddedWidget): + Updated the internal DOM pointer to be an HTMLPlugInElement + as it was what was passed in anyway. Also fixed some style + issues detected by our tools. + 2012-05-05 Dean Jackson <dino@apple.com> Add new Setting/Preference to disable requestAnimationFrame diff --git a/Source/WebKit/win/Interfaces/IWebFramePrivate.idl b/Source/WebKit/win/Interfaces/IWebFramePrivate.idl index cb7a46997..dea1123b0 100644 --- a/Source/WebKit/win/Interfaces/IWebFramePrivate.idl +++ b/Source/WebKit/win/Interfaces/IWebFramePrivate.idl @@ -110,9 +110,6 @@ 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(); diff --git a/Source/WebKit/win/WebCoreSupport/EmbeddedWidget.cpp b/Source/WebKit/win/WebCoreSupport/EmbeddedWidget.cpp index fb2b564fe..00442291c 100644 --- a/Source/WebKit/win/WebCoreSupport/EmbeddedWidget.cpp +++ b/Source/WebKit/win/WebCoreSupport/EmbeddedWidget.cpp @@ -27,8 +27,8 @@ #include "EmbeddedWidget.h" #include <WebCore/Document.h> -#include <WebCore/Element.h> #include <WebCore/FrameView.h> +#include <WebCore/HTMLPlugInElement.h> #include <WebCore/RenderObject.h> #include "MemoryStream.h" @@ -37,7 +37,7 @@ using namespace WebCore; -PassRefPtr<EmbeddedWidget> EmbeddedWidget::create(IWebEmbeddedView* view, Element* element, HWND parentWindow, const IntSize& size) +PassRefPtr<EmbeddedWidget> EmbeddedWidget::create(IWebEmbeddedView* view, HTMLPlugInElement* element, HWND parentWindow, const IntSize& size) { RefPtr<EmbeddedWidget> widget = adoptRef(new EmbeddedWidget(view, element)); @@ -167,9 +167,8 @@ IntRect EmbeddedWidget::windowClipRect() const IntRect clipRect(m_windowRect); // Take our element and get the clip rect from the enclosing layer and frame view. - RenderLayer* layer = m_element->renderer()->enclosingLayer(); FrameView* parentView = m_element->document()->view(); - clipRect.intersect(parentView->windowClipRectForLayer(layer, true)); + clipRect.intersect(parentView->windowClipRectForFrameOwner(m_element, true)); return clipRect; } diff --git a/Source/WebKit/win/WebCoreSupport/EmbeddedWidget.h b/Source/WebKit/win/WebCoreSupport/EmbeddedWidget.h index abfe76ed4..a5276bf57 100644 --- a/Source/WebKit/win/WebCoreSupport/EmbeddedWidget.h +++ b/Source/WebKit/win/WebCoreSupport/EmbeddedWidget.h @@ -32,19 +32,19 @@ #include <WebCore/PluginView.h> namespace WebCore { - class Element; - class IntSize; +class HTMLPlugInElement; +class IntSize; } interface IWebEmbeddedView; class EmbeddedWidget : public WebCore::Widget, public WebCore::PluginManualLoader { public: - static PassRefPtr<EmbeddedWidget> create(IWebEmbeddedView*, WebCore::Element* element, HWND parentWindow, const WebCore::IntSize&); + static PassRefPtr<EmbeddedWidget> create(IWebEmbeddedView*, WebCore::HTMLPlugInElement*, HWND parentWindow, const WebCore::IntSize&); ~EmbeddedWidget(); private: - EmbeddedWidget(IWebEmbeddedView* view, WebCore::Element* element) + EmbeddedWidget(IWebEmbeddedView* view, WebCore::HTMLPlugInElement* element) : m_view(view) , m_element(element) , m_window(0) @@ -73,7 +73,7 @@ private: virtual void detachFromWindow(); COMPtr<IWebEmbeddedView> m_view; - WebCore::Element* m_element; + WebCore::HTMLPlugInElement* m_element; HWND m_window; bool m_isVisible; diff --git a/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp index 4435b48d6..381dbb021 100644 --- a/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp @@ -539,8 +539,11 @@ void WebChromeClient::mouseDidMoveOverElement(const HitTestResult& result, unsig uiDelegate->mouseDidMoveOverElement(m_webView, element.get(), modifierFlags); } -bool WebChromeClient::shouldMissingPluginMessageBeButton() const +bool WebChromeClient::shouldUnavailablePluginMessageBeButton(RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason) const { + if (pluginUnavailabilityReason != RenderEmbeddedObject::PluginMissing) + return false; + COMPtr<IWebUIDelegate> uiDelegate; if (FAILED(m_webView->uiDelegate(&uiDelegate))) return false; @@ -551,8 +554,10 @@ bool WebChromeClient::shouldMissingPluginMessageBeButton() const return uiDelegatePrivate3; } -void WebChromeClient::missingPluginButtonClicked(Element* element) const +void WebChromeClient::unavailablePluginButtonClicked(Element* element, RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason) const { + ASSERT_UNUSED(pluginUnavailabilityReason, pluginUnavailabilityReason == RenderEmbeddedObject::PluginMissing); + COMPtr<IWebUIDelegate> uiDelegate; if (FAILED(m_webView->uiDelegate(&uiDelegate))) return; diff --git a/Source/WebKit/win/WebCoreSupport/WebChromeClient.h b/Source/WebKit/win/WebCoreSupport/WebChromeClient.h index f22d6f3ab..9a5af3893 100644 --- a/Source/WebKit/win/WebCoreSupport/WebChromeClient.h +++ b/Source/WebKit/win/WebCoreSupport/WebChromeClient.h @@ -106,8 +106,8 @@ public: virtual void scrollbarsModeDidChange() const { } virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags); - virtual bool shouldMissingPluginMessageBeButton() const; - virtual void missingPluginButtonClicked(WebCore::Element*) const; + virtual bool shouldUnavailablePluginMessageBeButton(WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const; + virtual void unavailablePluginButtonClicked(WebCore::Element*, WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const; virtual void setToolTip(const WTF::String&, WebCore::TextDirection); diff --git a/Source/WebKit/win/WebFrame.cpp b/Source/WebKit/win/WebFrame.cpp index 1a4b676a0..3a3715b3b 100644 --- a/Source/WebKit/win/WebFrame.cpp +++ b/Source/WebKit/win/WebFrame.cpp @@ -1311,26 +1311,6 @@ HRESULT WebFrame::numberOfActiveAnimations(UINT* number) return S_OK; } -HRESULT WebFrame::suspendAnimations() -{ - Frame* frame = core(this); - if (!frame) - return E_FAIL; - - frame->animation()->suspendAnimations(); - return S_OK; -} - -HRESULT WebFrame::resumeAnimations() -{ - Frame* frame = core(this); - if (!frame) - return E_FAIL; - - frame->animation()->resumeAnimations(); - return S_OK; -} - HRESULT WebFrame::isDisplayingStandaloneImage(BOOL* result) { if (!result) diff --git a/Source/WebKit/win/WebFrame.h b/Source/WebKit/win/WebFrame.h index c7ddfe860..b63438b50 100644 --- a/Source/WebKit/win/WebFrame.h +++ b/Source/WebKit/win/WebFrame.h @@ -260,8 +260,6 @@ public: virtual HRESULT STDMETHODCALLTYPE pauseAnimation(BSTR animationName, IDOMNode*, double secondsFromNow, BOOL* animationWasRunning); virtual HRESULT STDMETHODCALLTYPE pauseTransition(BSTR propertyName, IDOMNode*, double secondsFromNow, BOOL* transitionWasRunning); virtual HRESULT STDMETHODCALLTYPE numberOfActiveAnimations(UINT*); - virtual HRESULT STDMETHODCALLTYPE suspendAnimations(); - virtual HRESULT STDMETHODCALLTYPE resumeAnimations(); virtual HRESULT STDMETHODCALLTYPE loadPlainTextString(BSTR string, BSTR url); virtual HRESULT STDMETHODCALLTYPE isDisplayingStandaloneImage(BOOL*); |