diff options
Diffstat (limited to 'Source/WebKit')
69 files changed, 2492 insertions, 1210 deletions
diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index 137bc23cb..c50c39829 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -331,6 +331,11 @@ void WebPage::autofillTextField(const string& item) d->m_autofillManager->autofillTextField(item.c_str()); } +void WebPage::enableQnxJavaScriptObject(bool enabled) +{ + d->m_enableQnxJavaScriptObject = enabled; +} + WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const IntRect& rect) : m_webPage(webPage) , m_client(client) @@ -404,6 +409,7 @@ WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const In , m_fullscreenVideoNode(0) , m_hasInRegionScrollableAreas(false) , m_updateDelegatedOverlaysDispatched(false) + , m_enableQnxJavaScriptObject(true) , m_deferredTasksTimer(this, &WebPagePrivate::deferredTasksTimerFired) , m_selectPopup(0) , m_autofillManager(AutofillManager::create(this)) @@ -1497,17 +1503,17 @@ bool WebPage::scrollBy(const Platform::IntSize& delta, bool scrollMainFrame) return b; } -void WebPagePrivate::notifyInRegionScrollStatusChanged(bool status) +void WebPagePrivate::notifyInRegionScrollStopped() { - if (!status && m_inRegionScroller->d->hasNode()) { + if (m_inRegionScroller->d->hasNode()) { enqueueRenderingOfClippedContentOfScrollableNodeAfterInRegionScrolling(m_inRegionScroller->d->node()); m_inRegionScroller->d->reset(); } } -void WebPage::notifyInRegionScrollStatusChanged(bool status) +void WebPage::notifyInRegionScrollStopped() { - d->notifyInRegionScrollStatusChanged(status); + d->notifyInRegionScrollStopped(); } void WebPagePrivate::enqueueRenderingOfClippedContentOfScrollableNodeAfterInRegionScrolling(Node* scrolledNode) diff --git a/Source/WebKit/blackberry/Api/WebPage.h b/Source/WebKit/blackberry/Api/WebPage.h index 06aabeb94..dc4cf165d 100644 --- a/Source/WebKit/blackberry/Api/WebPage.h +++ b/Source/WebKit/blackberry/Api/WebPage.h @@ -176,7 +176,7 @@ public: // Scroll position provided should be in transformed coordinates. void setScrollPosition(const Platform::IntPoint&); bool scrollBy(const Platform::IntSize&, bool scrollMainFrame = true); - void notifyInRegionScrollStatusChanged(bool status); + void notifyInRegionScrollStopped(); void setScrollOriginPoint(const Platform::IntPoint&); BackingStore* backingStore() const; @@ -380,6 +380,8 @@ public: void autofillTextField(const std::string&); + void enableQnxJavaScriptObject(bool); + private: virtual ~WebPage(); diff --git a/Source/WebKit/blackberry/Api/WebPage_p.h b/Source/WebKit/blackberry/Api/WebPage_p.h index 04eb1b7fc..2ee4d6a04 100644 --- a/Source/WebKit/blackberry/Api/WebPage_p.h +++ b/Source/WebKit/blackberry/Api/WebPage_p.h @@ -150,7 +150,7 @@ public: bool scrollBy(int deltaX, int deltaY, bool scrollMainFrame = true); void enqueueRenderingOfClippedContentOfScrollableNodeAfterInRegionScrolling(WebCore::Node*); - void notifyInRegionScrollStatusChanged(bool status); + void notifyInRegionScrollStopped(); void setScrollOriginPoint(const Platform::IntPoint&); void setHasInRegionScrollableAreas(bool); @@ -615,6 +615,8 @@ public: WebCore::KURL m_cachedManualScript; bool m_cachedFocused; + bool m_enableQnxJavaScriptObject; + class DeferredTaskBase { public: void perform(WebPagePrivate* webPagePrivate) diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index 253f13964..0db79e222 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,131 @@ +2012-08-21 Benjamin C Meyer <bmeyer@rim.com> + + [BlackBerry] Add option to only add JavaScript object 'qnx' to private webviews + https://bugs.webkit.org/show_bug.cgi?id=94621 + + Reviewed by Yong Li. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::enableQnxJavaScriptObject): + (WebKit): + (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate): + * Api/WebPage.h: + * Api/WebPage_p.h: + (WebPagePrivate): + * WebCoreSupport/FrameLoaderClientBlackBerry.cpp: + (WebCore::FrameLoaderClientBlackBerry::dispatchDidClearWindowObjectInWorld): + +2012-08-21 Robin Cao <robin.cao@torchmobile.com.cn> + + [BlackBerry] Add support for getUserMedia + https://bugs.webkit.org/show_bug.cgi?id=94591 + + Reviewed by George Staikos. + + Implement getUserMedia feature using the platform API. + + PR #153571 + + Reviewed internally by George Staikos. + + * WebCoreSupport/UserMediaClientImpl.cpp: + (WebCore): + (WebCore::userMediaRequestsMap): + (WebCore::toMediaStreamSource): + (WebCore::toMediaStreamDescriptor): + (WebUserMediaRequestClientImpl): + (WebCore::WebUserMediaRequestClientImpl::WebUserMediaRequestClientImpl): + (WebCore::WebUserMediaRequestClientImpl::requestSucceeded): + (WebCore::WebUserMediaRequestClientImpl::requestFailed): + (WebCore::UserMediaClientImpl::UserMediaClientImpl): + (WebCore::UserMediaClientImpl::~UserMediaClientImpl): + (WebCore::UserMediaClientImpl::requestUserMedia): + (WebCore::UserMediaClientImpl::cancelUserMediaRequest): + (WebCore::UserMediaClientImpl::webUserMedia): + * WebCoreSupport/UserMediaClientImpl.h: + (BlackBerry): + (Platform): + (UserMediaClientImpl): + +2012-08-21 Kihong Kwon <kihong.kwon@samsung.com> + + [EFL][GTK][BlackBerry] Fix build error in the DeviceOrientationClient + https://bugs.webkit.org/show_bug.cgi?id=94586 + + Reviewed by Kentaro Hara. + + Fix build error in the DeviceOrientationClientBlackBerry.cpp. + It is occured because DeviceOrientation is changed to DeviceOrientationData in the WebCore. + + * WebCoreSupport/DeviceOrientationClientBlackBerry.cpp: + (DeviceOrientationClientBlackBerry::lastOrientation): + +2012-08-21 Jacky Jiang <zhajiang@rim.com> + + [BlackBerry] about:memory and about:memory-live should show numbers for the chrome process + https://bugs.webkit.org/show_bug.cgi?id=94531 + + Reviewed by Rob Buis. + Patch by Jacky Jiang <zhajiang@rim.com> + + PR: 190504 + Add total committed memory of chrome process into about:memory and add + its peak into about:memory-live. + + Internally reviewed by Yong Li and George Staikos. + + * WebKitSupport/AboutData.cpp: + (BlackBerry::WebKit::memoryPage): + (BlackBerry::WebKit::MemoryTracker::clear): + (MemoryTracker): + (BlackBerry::WebKit::MemoryTracker::peakTotalCommittedMemoryOfCurrentProcess): + (BlackBerry::WebKit::MemoryTracker::peakTotalCommittedMemoryOfChromeProcess): + (BlackBerry::WebKit::MemoryTracker::MemoryTracker): + (BlackBerry::WebKit::MemoryTracker::updateMemoryPeaks): + (BlackBerry::WebKit::memoryPeaksToHtmlTable): + +2012-08-21 Antonio Gomes <agomes@rim.com> + + [BlackBerry] Accelerated In-Region Scrolling does not render correctly on rotation + https://bugs.webkit.org/show_bug.cgi?id=94608 + PR #194754 + + Reviewed by Goerge Staikos. + + When one translates/scrolls a HW accelerated scrollable layer, it makes use of + the OVERRIDE mechanism. Suppose the following scenario: + + - In landscape, the overflow menu is scrollable. Then the user scrolls it so + that is has scroll position of 0, -100. + - when he rotates to portrait, the menus fit well to the available space but it + still has the OVERRIDE set, so it keeps the layer translated at 0, -100. + + Fix is simple: clear the override when we stop scrolling a HW accelerated layer, + when we destroy the objects. + + * WebKitSupport/InRegionScrollableArea.cpp: + (BlackBerry::WebKit::InRegionScrollableArea::~InRegionScrollableArea): + +2012-08-21 Antonio Gomes <agomes@rim.com> + + [BlackBerry] Properly notify WebKit when Client stops in-region scrolling + https://bugs.webkit.org/show_bug.cgi?id=94603 + PR #195813 + + Reviewed by Goerge Staikos. + + Simplify the API to get a notification of when a in-region + scrolling has finished. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::notifyInRegionScrollStopped): + Removed an unneeded parameter. + (BlackBerry::WebKit::WebPage::notifyInRegionScrollStopped): + Ditto. + * Api/WebPage.h: + * Api/WebPage_p.h: + (WebPagePrivate): + 2012-08-20 Sean Wang <Xuewen.Wang@torchmobile.com.cn> [BlackBerry] Select popup shows blank content when its option tags contain '\' characters diff --git a/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp index 2970a4f5b..683647506 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp @@ -62,7 +62,7 @@ void DeviceOrientationClientBlackBerry::stopUpdating() m_tracker->suspend(); } -DeviceOrientation* DeviceOrientationClientBlackBerry::lastOrientation() const +DeviceOrientationData* DeviceOrientationClientBlackBerry::lastOrientation() const { return m_currentOrientation.get(); } diff --git a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp index 320c639ec..bbaf2cecb 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp @@ -903,9 +903,8 @@ void FrameLoaderClientBlackBerry::dispatchDidClearWindowObjectInWorld(DOMWrapper return; // Provide the extension object first in case the client or others want to use it. - // FIXME: Conditionally attach extension object based on some flag or whether or not we - // are browser or something else. - attachExtensionObjectToFrame(m_frame, m_webPagePrivate->m_client); + if (m_webPagePrivate->m_enableQnxJavaScriptObject) + attachExtensionObjectToFrame(m_frame, m_webPagePrivate->m_client); m_webPagePrivate->m_client->notifyWindowObjectCleared(); diff --git a/Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.cpp b/Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.cpp index 57f0fe79e..a4e45c2e5 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.cpp @@ -20,18 +20,89 @@ #include "UserMediaClientImpl.h" #if ENABLE(MEDIA_STREAM) +#include "MediaStreamDescriptor.h" #include "WebPage.h" +#include <BlackBerryPlatformWebMediaStreamDescriptor.h> +#include <BlackBerryPlatformWebUserMedia.h> +#include <wtf/HashMap.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> #include <wtf/RefPtr.h> +using namespace BlackBerry::Platform; + namespace WebCore { +class WebUserMediaRequestClientImpl; + +typedef HashMap<UserMediaRequest*, OwnPtr<WebUserMediaRequestClientImpl> > UserMediaRequestsMap; + +static UserMediaRequestsMap& userMediaRequestsMap() +{ + DEFINE_STATIC_LOCAL(UserMediaRequestsMap, requests, ()); + return requests; +} + +static PassRefPtr<MediaStreamSource> toMediaStreamSource(const WebMediaStreamSource& src) +{ + return MediaStreamSource::create(String::fromUTF8(src.id().c_str()), static_cast<MediaStreamSource::Type>(src.type()), String::fromUTF8(src.name().c_str())); +} + +static PassRefPtr<MediaStreamDescriptor> toMediaStreamDescriptor(const WebMediaStreamDescriptor& d) +{ + MediaStreamSourceVector audioSources; + for (size_t i = 0; i < d.audios().size(); i++) { + RefPtr<MediaStreamSource> src = toMediaStreamSource(d.audios()[i]); + audioSources.append(src.release()); + } + + MediaStreamSourceVector videoSources; + for (size_t i = 0; i < d.videos().size(); i++) { + RefPtr<MediaStreamSource> src = toMediaStreamSource(d.videos()[i]); + videoSources.append(src.release()); + } + + return MediaStreamDescriptor::create(String::fromUTF8(d.label().c_str()), audioSources, videoSources); +} + +class WebUserMediaRequestClientImpl : public WebUserMediaRequestClient { +public: + WebUserMediaRequestClientImpl(PassRefPtr<UserMediaRequest> prpRequest) + : m_request(prpRequest) + { + } + + void requestSucceeded(const WebMediaStreamDescriptor& d) + { + if (m_request) { + RefPtr<MediaStreamDescriptor> descriptor = toMediaStreamDescriptor(d); + m_request->succeed(descriptor); + + userMediaRequestsMap().remove(m_request.get()); + } + } + + void requestFailed() + { + if (m_request) { + m_request->fail(); + userMediaRequestsMap().remove(m_request.get()); + } + } + +private: + RefPtr<UserMediaRequest> m_request; +}; + UserMediaClientImpl::UserMediaClientImpl(BlackBerry::WebKit::WebPage*) + : m_webUserMedia(0) { } UserMediaClientImpl::~UserMediaClientImpl() { + BlackBerry::Platform::deleteGuardedObject(m_webUserMedia); } void UserMediaClientImpl::pageDestroyed() @@ -40,12 +111,29 @@ void UserMediaClientImpl::pageDestroyed() void UserMediaClientImpl::requestUserMedia(PassRefPtr<UserMediaRequest> prpRequest, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) { + UserMediaRequest* request = prpRequest.get(); + OwnPtr<WebUserMediaRequestClientImpl> requestClient = adoptPtr(new WebUserMediaRequestClientImpl(prpRequest)); + + webUserMedia()->requestUserMedia(WebUserMediaRequest(request->audio(), request->video(), requestClient.get())); + userMediaRequestsMap().add(request, requestClient.release()); } -void UserMediaClientImpl::cancelUserMediaRequest(UserMediaRequest*) +void UserMediaClientImpl::cancelUserMediaRequest(UserMediaRequest* request) { + UserMediaRequestsMap::iterator it = userMediaRequestsMap().find(request); + if (it == userMediaRequestsMap().end()) + return; + + webUserMedia()->cancelUserMediaRequest(WebUserMediaRequest(request->audio(), request->video(), it->second.get())); + userMediaRequestsMap().remove(it); } +BlackBerry::Platform::WebUserMedia* UserMediaClientImpl::webUserMedia() +{ + if (!m_webUserMedia) + m_webUserMedia = new WebUserMedia; + return m_webUserMedia; } +} #endif diff --git a/Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.h b/Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.h index 6a9a01708..a31233b86 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.h +++ b/Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.h @@ -30,6 +30,10 @@ namespace BlackBerry { namespace WebKit { class WebPage; } + +namespace Platform { +class WebUserMedia; +} } namespace WebCore { @@ -47,6 +51,9 @@ public: private: UserMediaClientImpl(); + BlackBerry::Platform::WebUserMedia* webUserMedia(); + + BlackBerry::Platform::WebUserMedia* m_webUserMedia; }; } diff --git a/Source/WebKit/blackberry/WebKitSupport/AboutData.cpp b/Source/WebKit/blackberry/WebKitSupport/AboutData.cpp index 1502e3db3..a6772ccb5 100644 --- a/Source/WebKit/blackberry/WebKitSupport/AboutData.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/AboutData.cpp @@ -257,7 +257,11 @@ static String memoryPage() page += numberToHTMLTr("Total used memory (malloc + JSC)", mallocInfo.usmblks + mallocInfo.uordblks + jscMemoryStat.stackBytes + jscMemoryStat.JITBytes + mainHeap.capacity()); - page += numberToHTMLTr("Total committed memory", BlackBerry::Platform::totalCommittedMemory()); + if (unsigned totalCommittedMemoryOfChromeProcess = BlackBerry::Platform::totalCommittedMemoryOfChromeProcess()) { + page += numberToHTMLTr("Total committed memory of tab process", BlackBerry::Platform::totalCommittedMemoryOfCurrentProcess()); + page += numberToHTMLTr("Total committed memory of chrome process", totalCommittedMemoryOfChromeProcess); + } else + page += numberToHTMLTr("Total committed memory", BlackBerry::Platform::totalCommittedMemoryOfCurrentProcess()); struct stat processInfo; if (!stat(String::format("/proc/%u/as", getpid()).latin1().data(), &processInfo)) @@ -316,24 +320,34 @@ public: void start(); void stop(); bool isActive() const { return m_memoryTrackingTimer.isActive(); } - void clear() { m_peakTotalUsedMemory = 0; m_peakTotalCommittedMemory = 0; m_peakTotalMappedMemory = 0; } + void clear() + { + m_peakTotalUsedMemory = 0; + m_peakTotalCommittedMemoryOfCurrentProcess = 0; + m_peakTotalCommittedMemoryOfChromeProcess = 0; + m_peakTotalMappedMemory = 0; + } + void updateMemoryPeaks(Timer<MemoryTracker>*); unsigned peakTotalUsedMemory() const { return m_peakTotalUsedMemory; } - unsigned peakTotalCommittedMemory() const {return m_peakTotalCommittedMemory; } + unsigned peakTotalCommittedMemoryOfCurrentProcess() const { return m_peakTotalCommittedMemoryOfCurrentProcess; } + unsigned peakTotalCommittedMemoryOfChromeProcess() const { return m_peakTotalCommittedMemoryOfChromeProcess; } unsigned peakTotalMappedMemory() const { return m_peakTotalMappedMemory; } private: MemoryTracker(); Timer<MemoryTracker> m_memoryTrackingTimer; unsigned m_peakTotalUsedMemory; - unsigned m_peakTotalCommittedMemory; + unsigned m_peakTotalCommittedMemoryOfCurrentProcess; + unsigned m_peakTotalCommittedMemoryOfChromeProcess; unsigned m_peakTotalMappedMemory; }; MemoryTracker::MemoryTracker() : m_memoryTrackingTimer(this, &MemoryTracker::updateMemoryPeaks) , m_peakTotalUsedMemory(0) - , m_peakTotalCommittedMemory(0) + , m_peakTotalCommittedMemoryOfCurrentProcess(0) + , m_peakTotalCommittedMemoryOfChromeProcess(0) , m_peakTotalMappedMemory(0) { } @@ -370,9 +384,13 @@ void MemoryTracker::updateMemoryPeaks(Timer<MemoryTracker>*) if (totalUsedMemory > m_peakTotalUsedMemory) m_peakTotalUsedMemory = totalUsedMemory; - unsigned totalCommittedMemory = BlackBerry::Platform::totalCommittedMemory(); - if (totalCommittedMemory > m_peakTotalCommittedMemory) - m_peakTotalCommittedMemory = totalCommittedMemory; + unsigned totalCommittedMemoryOfCurrentProcess = BlackBerry::Platform::totalCommittedMemoryOfCurrentProcess(); + if (totalCommittedMemoryOfCurrentProcess > m_peakTotalCommittedMemoryOfCurrentProcess) + m_peakTotalCommittedMemoryOfCurrentProcess = totalCommittedMemoryOfCurrentProcess; + + unsigned totalCommittedMemoryOfChromeProcess = BlackBerry::Platform::totalCommittedMemoryOfChromeProcess(); + if (totalCommittedMemoryOfChromeProcess > m_peakTotalCommittedMemoryOfChromeProcess) + m_peakTotalCommittedMemoryOfChromeProcess = totalCommittedMemoryOfChromeProcess; struct stat processInfo; if (!stat(String::format("/proc/%u/as", getpid()).latin1().data(), &processInfo)) { @@ -384,11 +402,17 @@ void MemoryTracker::updateMemoryPeaks(Timer<MemoryTracker>*) static String memoryPeaksToHtmlTable(MemoryTracker& memoryTracker) { - return String("<table class='fixed-table'><col width=75%><col width=25%>") - + numberToHTMLTr("Total used memory(malloc + JSC):", memoryTracker.peakTotalUsedMemory()) - + numberToHTMLTr("Total committed memory:", memoryTracker.peakTotalCommittedMemory()) - + numberToHTMLTr("Total mapped memory:", memoryTracker.peakTotalMappedMemory()) - + "</table>"; + String htmlTable = String("<table class='fixed-table'><col width=75%><col width=25%>") + + numberToHTMLTr("Total used memory(malloc + JSC):", memoryTracker.peakTotalUsedMemory()); + + if (unsigned peakTotalCommittedMemoryOfChromeProcess = memoryTracker.peakTotalCommittedMemoryOfChromeProcess()) { + htmlTable += numberToHTMLTr("Total committed memory of tab process:", memoryTracker.peakTotalCommittedMemoryOfCurrentProcess()); + htmlTable += numberToHTMLTr("Total committed memory of chrome process:", peakTotalCommittedMemoryOfChromeProcess); + } else + htmlTable += numberToHTMLTr("Total committed memory:", memoryTracker.peakTotalCommittedMemoryOfCurrentProcess()); + + htmlTable += numberToHTMLTr("Total mapped memory:", memoryTracker.peakTotalMappedMemory()) + "</table>"; + return htmlTable; } static String memoryLivePage(String memoryLiveCommand) diff --git a/Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.cpp b/Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.cpp index 18a750a89..44e7b49a9 100644 --- a/Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.cpp @@ -42,6 +42,8 @@ InRegionScrollableArea::InRegionScrollableArea() InRegionScrollableArea::~InRegionScrollableArea() { + if (m_cachedCompositedScrollableLayer) + m_cachedCompositedScrollableLayer->clearOverride(); } InRegionScrollableArea::InRegionScrollableArea(WebPagePrivate* webPage, RenderLayer* layer) diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index 3d42baa97..7804ecd97 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,718 @@ +2012-08-22 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r126202. + http://trac.webkit.org/changeset/126202 + https://bugs.webkit.org/show_bug.cgi?id=94657 + + Causes assertion failures on Chromium Linux dbg compositing + layout tests (Requested by dominicc on #webkit). + + * tests/CCResourceProviderTest.cpp: + (WebKit::CCResourceProviderTest::CCResourceProviderTest): + (WebKit::CCResourceProviderTest::getResourcePixels): + (WebKit::TEST_F): + +2012-08-21 Leandro Gracia Gil <leandrogracia@chromium.org> + + [Chromium] Find-in-page coordinates should use containingBlock + https://bugs.webkit.org/show_bug.cgi?id=94343 + + Reviewed by Julien Chaffraix. + + The current implementation uses the container method to climb the render tree. + However, it would be more correct and convenient to use containingBlock instead. + Also, this patch introduces new tests for find-in-page coordinates in tables. + + * src/FindInPageCoordinates.cpp: + (WebKit::toNormalizedRect): use containingBlock and get rid of the output parameter as it's not required now. + (WebKit::findInPageRectFromAbsoluteRect): use containingBlock introduce some simplifications. + * tests/WebFrameTest.cpp: add new tests for tables. + * tests/data/find_in_page.html: + * tests/data/find_in_page_frame.html: new tests for tables. + +2012-08-21 Alexandre Elias <aelias@google.com> + + [chromium] Add software bitmap resources to CCResourceProvider + https://bugs.webkit.org/show_bug.cgi?id=93677 + + Reviewed by Adrienne Walker. + + This adds the ability to CCResourceProvider to use software bitmaps. + They are allocated as plain-old-memory, and exposed as Skia objects. + + We want the ResourceProvider to be able to handle different resource + types at the same time. In practice, a default resource type is + desired for most uses within a single compositor instance, which is + specified by the default resource type. Default resource types are + expected to be mostly 1-to-1 with CCRenderer types. + + New tests added by parametrizing existing CCResourceProvider tests. + + * tests/CCResourceProviderTest.cpp: + (WebKit::CCResourceProviderTest::getResourcePixels): + +2012-08-21 Oli Lan <olilan@chromium.org> + + [chromium] Add WebView methods setCompositionFromExistingText and extendSelectionAndDelete. + https://bugs.webkit.org/show_bug.cgi?id=93724 + + Reviewed by Ryosuke Niwa. + + This adds two new methods to WebViewImpl. + + 1) setCompositionFromExistingText creates a new composition from the existing text + in the currently focused input field. The new composition is between the two offsets + provided, relative to the rootEditableElement. The current selection is left unchanged. + + 2) extendSelectionAndDelete extends the selection by the specified number of characters + before and after, and then deletes the selection. If the selection is just a caret, the effect + is to delete the specified number of characters before and after the current editing point. + + These methods will be used e.g. by the Android port to implement IME functionality. + + New tests WebViewTest.ExtendSelectionAndDelete and WebViewTest.SetCompositionFromExistingText + test the two new methods. + + * public/WebView.h: + (WebView): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::setComposingRegion): + (WebKit): + (WebKit::extendSelectionAndDelete): + * src/WebViewImpl.h: + (WebViewImpl): + * tests/WebViewTest.cpp: + +2012-08-21 Alec Flett <alecflett@chromium.org> + + IndexedDB: remove old update/openCursor glue + https://bugs.webkit.org/show_bug.cgi?id=94378 + + Reviewed by Tony Chang. + + Remove Chromium/WebKit API for old methods that have now been + removed from chromium proper. + + * public/WebIDBObjectStore.h: + * src/IDBObjectStoreBackendProxy.cpp: + * src/IDBObjectStoreBackendProxy.h: + (IDBObjectStoreBackendProxy): + * src/WebIDBObjectStoreImpl.h: + (WebIDBObjectStoreImpl): + +2012-08-21 James Robinson <jamesr@chromium.org> + + [chromium] Should be able to destroy a CCLayerTreeHost without manually setting the root layer + https://bugs.webkit.org/show_bug.cgi?id=94631 + + Reviewed by Adrienne Walker. + + Tests that destroying a CCLayerTreeHost that still points to a non-null root doesn't crash. + + * tests/LayerChromiumTest.cpp: + +2012-08-21 James Robinson <jamesr@chromium.org> + + Unreviewed, rolling out r126170. + http://trac.webkit.org/changeset/126170 + https://bugs.webkit.org/show_bug.cgi?id=94614 + + I spoke too soon + + * WebKit.gypi: + * src/NonCompositedContentHost.cpp: + (WebKit::NonCompositedContentHost::NonCompositedContentHost): + (WebKit::NonCompositedContentHost::setScrollLayer): + (WebKit::NonCompositedContentHost::setViewport): + (WebKit::NonCompositedContentHost::scrollLayer): + * src/NonCompositedContentHost.h: + * src/WebContentLayer.cpp: Renamed from Source/WebKit/chromium/src/WebVideoLayerImpl.cpp. + (WebKit): + (WebKit::WebContentLayer::create): + (WebKit::WebContentLayer::clearClient): + (WebKit::WebContentLayer::setDoubleSided): + (WebKit::WebContentLayer::setContentsScale): + (WebKit::WebContentLayer::setUseLCDText): + (WebKit::WebContentLayer::setDrawCheckerboardForMissingTiles): + (WebKit::WebContentLayer::WebContentLayer): + (WebKit::WebContentLayer::operator=): + (WebKit::WebContentLayer::operator PassRefPtr<ContentLayerChromium>): + * src/WebContentLayerImpl.cpp: + (WebKit::WebContentLayerImpl::create): + (WebKit::WebContentLayerImpl::WebContentLayerImpl): + (WebKit::WebContentLayerImpl::~WebContentLayerImpl): + (WebKit::WebContentLayerImpl::paintContents): + * src/WebContentLayerImpl.h: + (WebContentLayerImpl): + * src/WebExternalTextureLayer.cpp: Renamed from Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp. + (WebKit): + (WebTextureUpdaterImpl): + (WebKit::WebTextureUpdaterImpl::WebTextureUpdaterImpl): + (WebExternalTextureLayerImpl): + (WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl): + (WebKit::WebExternalTextureLayer::create): + (WebKit::WebExternalTextureLayer::clearClient): + (WebKit::WebExternalTextureLayer::setTextureId): + (WebKit::WebExternalTextureLayer::setFlipped): + (WebKit::WebExternalTextureLayer::setUVRect): + (WebKit::WebExternalTextureLayer::setOpaque): + (WebKit::WebExternalTextureLayer::setPremultipliedAlpha): + (WebKit::WebExternalTextureLayer::willModifyTexture): + (WebKit::WebExternalTextureLayer::setRateLimitContext): + (WebKit::WebExternalTextureLayer::WebExternalTextureLayer): + * src/WebExternalTextureLayerImpl.h: Removed. + * src/WebIOSurfaceLayer.cpp: Renamed from Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp. + (WebKit): + (WebKit::WebIOSurfaceLayer::create): + (WebKit::WebIOSurfaceLayer::setIOSurfaceProperties): + (WebKit::WebIOSurfaceLayer::WebIOSurfaceLayer): + * src/WebIOSurfaceLayerImpl.h: Removed. + * src/WebImageLayer.cpp: Renamed from Source/WebKit/chromium/src/WebImageLayerImpl.h. + (WebKit): + (WebKit::WebImageLayer::create): + (WebKit::WebImageLayer::WebImageLayer): + (WebKit::WebImageLayer::setBitmap): + * src/WebLayer.cpp: Added. + (WebKit): + (WebKit::WebLayer::create): + (WebKit::WebLayer::reset): + (WebKit::WebLayer::assign): + (WebKit::WebLayer::equals): + (WebKit::WebLayer::invalidateRect): + (WebKit::WebLayer::invalidate): + (WebKit::WebLayer::addChild): + (WebKit::WebLayer::insertChild): + (WebKit::WebLayer::replaceChild): + (WebKit::WebLayer::setChildren): + (WebKit::WebLayer::removeFromParent): + (WebKit::WebLayer::removeAllChildren): + (WebKit::WebLayer::setAnchorPoint): + (WebKit::WebLayer::anchorPoint): + (WebKit::WebLayer::setAnchorPointZ): + (WebKit::WebLayer::anchorPointZ): + (WebKit::WebLayer::setBounds): + (WebKit::WebLayer::bounds): + (WebKit::WebLayer::setMasksToBounds): + (WebKit::WebLayer::masksToBounds): + (WebKit::WebLayer::setMaskLayer): + (WebKit::WebLayer::setReplicaLayer): + (WebKit::WebLayer::setOpacity): + (WebKit::WebLayer::opacity): + (WebKit::WebLayer::setOpaque): + (WebKit::WebLayer::opaque): + (WebKit::WebLayer::setPosition): + (WebKit::WebLayer::position): + (WebKit::WebLayer::setSublayerTransform): + (WebKit::WebLayer::sublayerTransform): + (WebKit::WebLayer::setTransform): + (WebKit::WebLayer::transform): + (WebKit::WebLayer::setDrawsContent): + (WebKit::WebLayer::drawsContent): + (WebKit::WebLayer::setPreserves3D): + (WebKit::WebLayer::setUseParentBackfaceVisibility): + (WebKit::WebLayer::setBackgroundColor): + (WebKit::WebLayer::setFilters): + (WebKit::WebLayer::setBackgroundFilters): + (WebKit::WebLayer::setDebugBorderColor): + (WebKit::WebLayer::setDebugBorderWidth): + (WebKit::WebLayer::setDebugName): + (WebKit::WebLayer::setAnimationDelegate): + (WebKit::WebLayer::addAnimation): + (WebKit::WebLayer::removeAnimation): + (WebKit::WebLayer::pauseAnimation): + (WebKit::WebLayer::suspendAnimations): + (WebKit::WebLayer::resumeAnimations): + (WebKit::WebLayer::hasActiveAnimation): + (WebKit::WebLayer::transferAnimationsTo): + (WebKit::WebLayer::setForceRenderSurface): + (WebKit::WebLayer::clearRenderSurface): + (WebKit::WebLayer::WebLayer): + (WebKit::WebLayer::operator=): + (WebKit::WebLayer::operator PassRefPtr<LayerChromium>): + * src/WebLayerImpl.cpp: + (WebKit::WebLayerImpl::create): + (WebKit::WebLayerImpl::WebLayerImpl): + (WebKit::WebLayerImpl::~WebLayerImpl): + * src/WebLayerImpl.h: + (WebLayerImpl): + * src/WebLayerTreeView.cpp: + (WebKit::WebLayerTreeView::setRootLayer): + * src/WebLayerTreeViewImpl.cpp: + (WebKit::WebLayerTreeViewImpl::create): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::readyStateChanged): + (WebKit::WebMediaPlayerClientImpl::repaint): + (WebKit::WebMediaPlayerClientImpl::setOpaque): + (WebKit::WebMediaPlayerClientImpl::platformLayer): + (WebKit::WebMediaPlayerClientImpl::acceleratedRenderingInUse): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::setBackingTextureId): + (WebKit::WebPluginContainerImpl::setBackingIOSurfaceId): + (WebKit::WebPluginContainerImpl::commitBackingTexture): + (WebKit::WebPluginContainerImpl::setOpaque): + (WebKit::WebPluginContainerImpl::platformLayer): + * src/WebPluginContainerImpl.h: + (WebPluginContainerImpl): + * src/WebScrollableLayer.cpp: Renamed from Source/WebKit/chromium/src/WebImageLayerImpl.cpp. + (WebKit): + (WebKit::WebScrollableLayer::setScrollPosition): + (WebKit::WebScrollableLayer::setScrollable): + (WebKit::WebScrollableLayer::setHaveWheelEventHandlers): + (WebKit::WebScrollableLayer::setShouldScrollOnMainThread): + (WebKit::WebScrollableLayer::setNonFastScrollableRegion): + (WebKit::WebScrollableLayer::setIsContainerForFixedPositionLayers): + (WebKit::WebScrollableLayer::setFixedToContainerLayer): + * src/WebScrollbarLayer.cpp: Renamed from Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp. + (WebKit): + (WebKit::WebScrollbarLayer::setScrollLayer): + (WebKit::WebScrollbarLayer::create): + (WebKit::WebScrollbarLayer::WebScrollbarLayer): + (WebKit::WebScrollbarLayer::operator=): + (WebKit::WebScrollbarLayer::operator PassRefPtr<ScrollbarLayerChromium>): + * src/WebScrollbarLayerImpl.h: Removed. + * src/WebSolidColorLayer.cpp: Copied from Source/Platform/chromium/public/WebSolidColorLayer.h. + (WebKit): + (WebKit::WebSolidColorLayer::create): + (WebKit::WebSolidColorLayer::WebSolidColorLayer): + (WebKit::WebSolidColorLayer::setBackgroundColor): + * src/WebSolidColorLayerImpl.cpp: + (WebKit::WebSolidColorLayerImpl::create): + (WebKit::WebSolidColorLayerImpl::WebSolidColorLayerImpl): + * src/WebSolidColorLayerImpl.h: + (WebSolidColorLayerImpl): + * src/WebVideoLayer.cpp: Renamed from Source/WebKit/chromium/src/WebVideoLayerImpl.h. + (WebKit): + (WebKit::WebVideoLayer::create): + (WebKit::WebVideoLayer::WebVideoLayer): + (WebKit::WebVideoLayer::active): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::setRootGraphicsLayer): + (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): + (WebKit): + * src/WebViewImpl.h: + * tests/ImageLayerChromiumTest.cpp: + (WebCore::TEST): + * tests/WebLayerTest.cpp: + * tests/WebLayerTreeViewTest.cpp: + +2012-08-21 James Robinson <jamesr@chromium.org> + + Unreviewed, rolling out r126169. + http://trac.webkit.org/changeset/126169 + https://bugs.webkit.org/show_bug.cgi?id=94614 + + Crashes already fixed downstream + + * WebKit.gypi: + * src/NonCompositedContentHost.cpp: + (WebKit::NonCompositedContentHost::NonCompositedContentHost): + (WebKit::NonCompositedContentHost::setScrollLayer): + (WebKit::NonCompositedContentHost::setViewport): + (WebKit::NonCompositedContentHost::scrollLayer): + * src/NonCompositedContentHost.h: + * src/WebContentLayer.cpp: Removed. + * src/WebContentLayerImpl.cpp: + (WebKit::WebContentLayer::create): + (WebKit::WebContentLayerImpl::WebContentLayerImpl): + (WebKit::WebContentLayerImpl::~WebContentLayerImpl): + (WebKit::WebContentLayerImpl::layer): + (WebKit): + (WebKit::WebContentLayerImpl::setDoubleSided): + (WebKit::WebContentLayerImpl::setContentsScale): + (WebKit::WebContentLayerImpl::setUseLCDText): + (WebKit::WebContentLayerImpl::setDrawCheckerboardForMissingTiles): + (WebKit::WebContentLayerImpl::paintContents): + * src/WebContentLayerImpl.h: + (WebContentLayerImpl): + * src/WebExternalTextureLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebExternalTextureLayer.cpp. + (WebKit): + (WebKit::WebExternalTextureLayer::create): + (WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl): + (WebKit::WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl): + (WebKit::WebExternalTextureLayerImpl::layer): + (WebKit::WebExternalTextureLayerImpl::setTextureId): + (WebKit::WebExternalTextureLayerImpl::setFlipped): + (WebKit::WebExternalTextureLayerImpl::setUVRect): + (WebKit::WebExternalTextureLayerImpl::setOpaque): + (WebKit::WebExternalTextureLayerImpl::setPremultipliedAlpha): + (WebKit::WebExternalTextureLayerImpl::willModifyTexture): + (WebKit::WebExternalTextureLayerImpl::setRateLimitContext): + (WebTextureUpdaterImpl): + (WebKit::WebTextureUpdaterImpl::WebTextureUpdaterImpl): + (WebKit::WebExternalTextureLayerImpl::prepareTexture): + (WebKit::WebExternalTextureLayerImpl::context): + * src/WebExternalTextureLayerImpl.h: Copied from Source/Platform/chromium/public/WebVideoLayer.h. + (WebKit): + (WebExternalTextureLayerImpl): + * src/WebIOSurfaceLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp. + (WebKit): + (WebKit::WebIOSurfaceLayer::create): + (WebKit::WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl): + (WebKit::WebIOSurfaceLayerImpl::~WebIOSurfaceLayerImpl): + (WebKit::WebIOSurfaceLayerImpl::setIOSurfaceProperties): + (WebKit::WebIOSurfaceLayerImpl::layer): + * src/WebIOSurfaceLayerImpl.h: Copied from Source/Platform/chromium/public/WebImageLayer.h. + (WebCore): + (WebKit): + (WebIOSurfaceLayerImpl): + * src/WebImageLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebSolidColorLayer.cpp. + (WebKit): + (WebKit::WebImageLayer::create): + (WebKit::WebImageLayerImpl::WebImageLayerImpl): + (WebKit::WebImageLayerImpl::~WebImageLayerImpl): + (WebKit::WebImageLayerImpl::layer): + (WebKit::WebImageLayerImpl::setBitmap): + * src/WebImageLayerImpl.h: Renamed from Source/WebKit/chromium/src/WebImageLayer.cpp. + (WebCore): + (WebKit): + (WebImageLayerImpl): + * src/WebLayer.cpp: Removed. + * src/WebLayerImpl.cpp: + (WebKit::WebLayer::create): + (WebKit::WebLayerImpl::WebLayerImpl): + (WebKit::WebLayerImpl::~WebLayerImpl): + (WebKit): + (WebKit::WebLayerImpl::id): + (WebKit::WebLayerImpl::invalidateRect): + (WebKit::WebLayerImpl::invalidate): + (WebKit::WebLayerImpl::addChild): + (WebKit::WebLayerImpl::insertChild): + (WebKit::WebLayerImpl::replaceChild): + (WebKit::WebLayerImpl::setChildren): + (WebKit::WebLayerImpl::removeFromParent): + (WebKit::WebLayerImpl::removeAllChildren): + (WebKit::WebLayerImpl::setAnchorPoint): + (WebKit::WebLayerImpl::anchorPoint): + (WebKit::WebLayerImpl::setAnchorPointZ): + (WebKit::WebLayerImpl::anchorPointZ): + (WebKit::WebLayerImpl::setBounds): + (WebKit::WebLayerImpl::bounds): + (WebKit::WebLayerImpl::setMasksToBounds): + (WebKit::WebLayerImpl::masksToBounds): + (WebKit::WebLayerImpl::setMaskLayer): + (WebKit::WebLayerImpl::setReplicaLayer): + (WebKit::WebLayerImpl::setOpacity): + (WebKit::WebLayerImpl::opacity): + (WebKit::WebLayerImpl::setOpaque): + (WebKit::WebLayerImpl::opaque): + (WebKit::WebLayerImpl::setPosition): + (WebKit::WebLayerImpl::position): + (WebKit::WebLayerImpl::setSublayerTransform): + (WebKit::WebLayerImpl::sublayerTransform): + (WebKit::WebLayerImpl::setTransform): + (WebKit::WebLayerImpl::transform): + (WebKit::WebLayerImpl::setDrawsContent): + (WebKit::WebLayerImpl::drawsContent): + (WebKit::WebLayerImpl::setPreserves3D): + (WebKit::WebLayerImpl::setUseParentBackfaceVisibility): + (WebKit::WebLayerImpl::setBackgroundColor): + (WebKit::WebLayerImpl::setFilters): + (WebKit::WebLayerImpl::setBackgroundFilters): + (WebKit::WebLayerImpl::setDebugBorderColor): + (WebKit::WebLayerImpl::setDebugBorderWidth): + (WebKit::WebLayerImpl::setDebugName): + (WebKit::WebLayerImpl::setAnimationDelegate): + (WebKit::WebLayerImpl::addAnimation): + (WebKit::WebLayerImpl::removeAnimation): + (WebKit::WebLayerImpl::pauseAnimation): + (WebKit::WebLayerImpl::suspendAnimations): + (WebKit::WebLayerImpl::resumeAnimations): + (WebKit::WebLayerImpl::hasActiveAnimation): + (WebKit::WebLayerImpl::transferAnimationsTo): + (WebKit::WebLayerImpl::setForceRenderSurface): + (WebKit::WebLayerImpl::setScrollPosition): + (WebKit::WebLayerImpl::setScrollable): + (WebKit::WebLayerImpl::setHaveWheelEventHandlers): + (WebKit::WebLayerImpl::setShouldScrollOnMainThread): + (WebKit::WebLayerImpl::setNonFastScrollableRegion): + (WebKit::WebLayerImpl::setIsContainerForFixedPositionLayers): + (WebKit::WebLayerImpl::setFixedToContainerLayer): + (WebKit::WebLayerImpl::layer): + * src/WebLayerImpl.h: + (WebCore): + (WebLayerImpl): + * src/WebLayerTreeView.cpp: + (WebKit::WebLayerTreeView::setRootLayer): + * src/WebLayerTreeViewImpl.cpp: + (WebKit::WebLayerTreeViewImpl::create): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::readyStateChanged): + (WebKit::WebMediaPlayerClientImpl::repaint): + (WebKit::WebMediaPlayerClientImpl::setOpaque): + (WebKit::WebMediaPlayerClientImpl::platformLayer): + (WebKit::WebMediaPlayerClientImpl::acceleratedRenderingInUse): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::setBackingTextureId): + (WebKit::WebPluginContainerImpl::setBackingIOSurfaceId): + (WebKit::WebPluginContainerImpl::commitBackingTexture): + (WebKit::WebPluginContainerImpl::setOpaque): + (WebKit::WebPluginContainerImpl::platformLayer): + * src/WebPluginContainerImpl.h: + (WebPluginContainerImpl): + * src/WebScrollableLayer.cpp: Removed. + * src/WebScrollbarLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebScrollbarLayer.cpp. + (WebKit): + (WebKit::WebScrollbarLayer::create): + (WebKit::WebScrollbarLayerImpl::WebScrollbarLayerImpl): + (WebKit::WebScrollbarLayerImpl::~WebScrollbarLayerImpl): + (WebKit::WebScrollbarLayerImpl::layer): + (WebKit::WebScrollbarLayerImpl::setScrollLayer): + * src/WebScrollbarLayerImpl.h: Copied from Source/WebKit/chromium/src/WebSolidColorLayerImpl.h. + (WebCore): + (WebKit): + (WebScrollbarLayerImpl): + * src/WebSolidColorLayerImpl.cpp: + (WebKit::WebSolidColorLayer::create): + (WebKit::WebSolidColorLayerImpl::WebSolidColorLayerImpl): + (WebKit::WebSolidColorLayerImpl::layer): + (WebKit): + (WebKit::WebSolidColorLayerImpl::setBackgroundColor): + * src/WebSolidColorLayerImpl.h: + (WebCore): + (WebKit): + (WebSolidColorLayerImpl): + * src/WebVideoLayerImpl.cpp: Copied from Source/WebKit/chromium/src/WebVideoLayer.cpp. + (WebKit): + (WebKit::WebVideoLayer::create): + (WebKit::WebVideoLayerImpl::WebVideoLayerImpl): + (WebKit::WebVideoLayerImpl::~WebVideoLayerImpl): + (WebKit::WebVideoLayerImpl::layer): + (WebKit::WebVideoLayerImpl::active): + * src/WebVideoLayerImpl.h: Renamed from Source/WebKit/chromium/src/WebVideoLayer.cpp. + (WebCore): + (WebKit): + (WebVideoLayerImpl): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::setRootGraphicsLayer): + (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): + (WebKit): + * src/WebViewImpl.h: + * tests/ImageLayerChromiumTest.cpp: + (WebCore::TEST): + * tests/WebLayerTest.cpp: + * tests/WebLayerTreeViewTest.cpp: + +2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r126076, r126099, and r126106. + http://trac.webkit.org/changeset/126076 + http://trac.webkit.org/changeset/126099 + http://trac.webkit.org/changeset/126106 + https://bugs.webkit.org/show_bug.cgi?id=94614 + + Caused crashes during compositor shutdown in Aura builds of + Chromium (Requested by kbr_google on #webkit). + + * WebKit.gypi: + * src/NonCompositedContentHost.cpp: + (WebKit::NonCompositedContentHost::NonCompositedContentHost): + (WebKit::NonCompositedContentHost::setScrollLayer): + (WebKit::NonCompositedContentHost::setViewport): + (WebKit::NonCompositedContentHost::scrollLayer): + * src/NonCompositedContentHost.h: + * src/WebContentLayer.cpp: Renamed from Source/WebKit/chromium/src/WebVideoLayerImpl.cpp. + (WebKit): + (WebKit::WebContentLayer::create): + (WebKit::WebContentLayer::clearClient): + (WebKit::WebContentLayer::setDoubleSided): + (WebKit::WebContentLayer::setContentsScale): + (WebKit::WebContentLayer::setUseLCDText): + (WebKit::WebContentLayer::setDrawCheckerboardForMissingTiles): + (WebKit::WebContentLayer::WebContentLayer): + (WebKit::WebContentLayer::operator=): + (WebKit::WebContentLayer::operator PassRefPtr<ContentLayerChromium>): + * src/WebContentLayerImpl.cpp: + (WebKit::WebContentLayerImpl::create): + (WebKit::WebContentLayerImpl::WebContentLayerImpl): + (WebKit::WebContentLayerImpl::~WebContentLayerImpl): + (WebKit::WebContentLayerImpl::paintContents): + * src/WebContentLayerImpl.h: + (WebContentLayerImpl): + * src/WebExternalTextureLayer.cpp: Renamed from Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp. + (WebKit): + (WebTextureUpdaterImpl): + (WebKit::WebTextureUpdaterImpl::WebTextureUpdaterImpl): + (WebExternalTextureLayerImpl): + (WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl): + (WebKit::WebExternalTextureLayer::create): + (WebKit::WebExternalTextureLayer::clearClient): + (WebKit::WebExternalTextureLayer::setTextureId): + (WebKit::WebExternalTextureLayer::setFlipped): + (WebKit::WebExternalTextureLayer::setUVRect): + (WebKit::WebExternalTextureLayer::setOpaque): + (WebKit::WebExternalTextureLayer::setPremultipliedAlpha): + (WebKit::WebExternalTextureLayer::willModifyTexture): + (WebKit::WebExternalTextureLayer::setRateLimitContext): + (WebKit::WebExternalTextureLayer::WebExternalTextureLayer): + * src/WebExternalTextureLayerImpl.h: Removed. + * src/WebIOSurfaceLayer.cpp: Renamed from Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp. + (WebKit): + (WebKit::WebIOSurfaceLayer::create): + (WebKit::WebIOSurfaceLayer::setIOSurfaceProperties): + (WebKit::WebIOSurfaceLayer::WebIOSurfaceLayer): + * src/WebIOSurfaceLayerImpl.h: Removed. + * src/WebImageLayer.cpp: Renamed from Source/WebKit/chromium/src/WebImageLayerImpl.h. + (WebKit): + (WebKit::WebImageLayer::create): + (WebKit::WebImageLayer::WebImageLayer): + (WebKit::WebImageLayer::setBitmap): + * src/WebLayer.cpp: Added. + (WebKit): + (WebKit::WebLayer::create): + (WebKit::WebLayer::reset): + (WebKit::WebLayer::assign): + (WebKit::WebLayer::equals): + (WebKit::WebLayer::invalidateRect): + (WebKit::WebLayer::invalidate): + (WebKit::WebLayer::addChild): + (WebKit::WebLayer::insertChild): + (WebKit::WebLayer::replaceChild): + (WebKit::WebLayer::setChildren): + (WebKit::WebLayer::removeFromParent): + (WebKit::WebLayer::removeAllChildren): + (WebKit::WebLayer::setAnchorPoint): + (WebKit::WebLayer::anchorPoint): + (WebKit::WebLayer::setAnchorPointZ): + (WebKit::WebLayer::anchorPointZ): + (WebKit::WebLayer::setBounds): + (WebKit::WebLayer::bounds): + (WebKit::WebLayer::setMasksToBounds): + (WebKit::WebLayer::masksToBounds): + (WebKit::WebLayer::setMaskLayer): + (WebKit::WebLayer::setReplicaLayer): + (WebKit::WebLayer::setOpacity): + (WebKit::WebLayer::opacity): + (WebKit::WebLayer::setOpaque): + (WebKit::WebLayer::opaque): + (WebKit::WebLayer::setPosition): + (WebKit::WebLayer::position): + (WebKit::WebLayer::setSublayerTransform): + (WebKit::WebLayer::sublayerTransform): + (WebKit::WebLayer::setTransform): + (WebKit::WebLayer::transform): + (WebKit::WebLayer::setDrawsContent): + (WebKit::WebLayer::drawsContent): + (WebKit::WebLayer::setPreserves3D): + (WebKit::WebLayer::setUseParentBackfaceVisibility): + (WebKit::WebLayer::setBackgroundColor): + (WebKit::WebLayer::setFilters): + (WebKit::WebLayer::setBackgroundFilters): + (WebKit::WebLayer::setDebugBorderColor): + (WebKit::WebLayer::setDebugBorderWidth): + (WebKit::WebLayer::setDebugName): + (WebKit::WebLayer::setAnimationDelegate): + (WebKit::WebLayer::addAnimation): + (WebKit::WebLayer::removeAnimation): + (WebKit::WebLayer::pauseAnimation): + (WebKit::WebLayer::suspendAnimations): + (WebKit::WebLayer::resumeAnimations): + (WebKit::WebLayer::hasActiveAnimation): + (WebKit::WebLayer::transferAnimationsTo): + (WebKit::WebLayer::setForceRenderSurface): + (WebKit::WebLayer::clearRenderSurface): + (WebKit::WebLayer::WebLayer): + (WebKit::WebLayer::operator=): + (WebKit::WebLayer::operator PassRefPtr<LayerChromium>): + * src/WebLayerImpl.cpp: + (WebKit::WebLayerImpl::create): + (WebKit::WebLayerImpl::WebLayerImpl): + (WebKit::WebLayerImpl::~WebLayerImpl): + * src/WebLayerImpl.h: + (WebLayerImpl): + * src/WebLayerTreeView.cpp: + (WebKit::WebLayerTreeView::setRootLayer): + * src/WebLayerTreeViewImpl.cpp: + (WebKit::WebLayerTreeViewImpl::create): + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::readyStateChanged): + (WebKit::WebMediaPlayerClientImpl::repaint): + (WebKit::WebMediaPlayerClientImpl::setOpaque): + (WebKit::WebMediaPlayerClientImpl::platformLayer): + (WebKit::WebMediaPlayerClientImpl::acceleratedRenderingInUse): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::setBackingTextureId): + (WebKit::WebPluginContainerImpl::setBackingIOSurfaceId): + (WebKit::WebPluginContainerImpl::commitBackingTexture): + (WebKit::WebPluginContainerImpl::setOpaque): + (WebKit::WebPluginContainerImpl::platformLayer): + * src/WebPluginContainerImpl.h: + (WebPluginContainerImpl): + * src/WebScrollableLayer.cpp: Renamed from Source/WebKit/chromium/src/WebImageLayerImpl.cpp. + (WebKit): + (WebKit::WebScrollableLayer::setScrollPosition): + (WebKit::WebScrollableLayer::setScrollable): + (WebKit::WebScrollableLayer::setHaveWheelEventHandlers): + (WebKit::WebScrollableLayer::setShouldScrollOnMainThread): + (WebKit::WebScrollableLayer::setNonFastScrollableRegion): + (WebKit::WebScrollableLayer::setIsContainerForFixedPositionLayers): + (WebKit::WebScrollableLayer::setFixedToContainerLayer): + * src/WebScrollbarLayer.cpp: Renamed from Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp. + (WebKit): + (WebKit::WebScrollbarLayer::setScrollLayer): + (WebKit::WebScrollbarLayer::create): + (WebKit::WebScrollbarLayer::WebScrollbarLayer): + (WebKit::WebScrollbarLayer::operator=): + (WebKit::WebScrollbarLayer::operator PassRefPtr<ScrollbarLayerChromium>): + * src/WebScrollbarLayerImpl.h: Removed. + * src/WebSolidColorLayer.cpp: Copied from Source/Platform/chromium/public/WebSolidColorLayer.h. + (WebKit): + (WebKit::WebSolidColorLayer::create): + (WebKit::WebSolidColorLayer::WebSolidColorLayer): + (WebKit::WebSolidColorLayer::setBackgroundColor): + * src/WebSolidColorLayerImpl.cpp: + (WebKit::WebSolidColorLayerImpl::create): + (WebKit::WebSolidColorLayerImpl::WebSolidColorLayerImpl): + * src/WebSolidColorLayerImpl.h: + (WebSolidColorLayerImpl): + * src/WebVideoLayer.cpp: Renamed from Source/WebKit/chromium/src/WebVideoLayerImpl.h. + (WebKit): + (WebKit::WebVideoLayer::create): + (WebKit::WebVideoLayer::WebVideoLayer): + (WebKit::WebVideoLayer::active): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::setRootGraphicsLayer): + (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): + (WebKit): + * src/WebViewImpl.h: + * tests/ImageLayerChromiumTest.cpp: + (WebCore::TEST): + * tests/WebLayerTest.cpp: + * tests/WebLayerTreeViewTest.cpp: + +2012-08-21 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: NMI: rename addMember for strings and KURL to addInstrumentedMember. + https://bugs.webkit.org/show_bug.cgi?id=94580 + + Reviewed by Yury Semikhatsky. + + Drive by fix: immutable ElementAttrybuteData uses the same trick with placement new as in StylePropertySet. + + * tests/MemoryInstrumentationTest.cpp: + (WebCore::TEST): + (WebCore): + +2012-08-21 Peter Beverloo <peter@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + 2012-08-20 Kent Tamura <tkent@chromium.org> [Chromium-win] Use native digits in parsing/formatting dates in the textfield part of input[type=date] diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index eb01ba514..e232a71c2 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': '152373' + 'chromium_rev': '152728' } deps = { diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index fc86f83b3..7fb0c0f70 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -183,27 +183,26 @@ 'src/WebAnimationImpl.h', 'src/WebCompositorInputHandlerImpl.cpp', 'src/WebCompositorInputHandlerImpl.h', + 'src/WebContentLayer.cpp', 'src/WebContentLayerImpl.cpp', 'src/WebContentLayerImpl.h', - 'src/WebExternalTextureLayerImpl.cpp', - 'src/WebExternalTextureLayerImpl.h', + 'src/WebExternalTextureLayer.cpp', 'src/WebFloatAnimationCurve.cpp', - 'src/WebIOSurfaceLayerImpl.cpp', - 'src/WebIOSurfaceLayerImpl.h', - 'src/WebImageLayerImpl.cpp', - 'src/WebImageLayerImpl.h', + 'src/WebIOSurfaceLayer.cpp', + 'src/WebImageLayer.cpp', + 'src/WebLayer.cpp', 'src/WebLayerImpl.cpp', 'src/WebLayerImpl.h', 'src/WebLayerTreeView.cpp', 'src/WebLayerTreeViewImpl.cpp', 'src/WebLayerTreeViewImpl.h', - 'src/WebScrollbarLayerImpl.cpp', - 'src/WebScrollbarLayerImpl.h', + 'src/WebScrollableLayer.cpp', + 'src/WebScrollbarLayer.cpp', + 'src/WebSolidColorLayer.cpp', 'src/WebSolidColorLayerImpl.cpp', 'src/WebSolidColorLayerImpl.h', 'src/WebTransformAnimationCurve.cpp', - 'src/WebVideoLayerImpl.cpp', - 'src/WebVideoLayerImpl.h', + 'src/WebVideoLayer.cpp', ], 'conditions': [ diff --git a/Source/WebKit/chromium/public/WebIDBObjectStore.h b/Source/WebKit/chromium/public/WebIDBObjectStore.h index 826965c0d..a2b87da81 100644 --- a/Source/WebKit/chromium/public/WebIDBObjectStore.h +++ b/Source/WebKit/chromium/public/WebIDBObjectStore.h @@ -72,11 +72,6 @@ public: return 0; } virtual void deleteIndex(const WebString& name, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } - // FIXME: Remove this version of openCursor when TaskType is plumbed through chromium. - virtual void openCursor(const WebIDBKeyRange& range, unsigned short direction, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec) - { - openCursor(range, static_cast<WebIDBCursor::Direction>(direction), callbacks, WebIDBTransaction::NormalTask, transaction, ec); - } virtual void openCursor(const WebIDBKeyRange&, WebIDBCursor::Direction direction, WebIDBCallbacks*, WebIDBTransaction::TaskType, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void count(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } diff --git a/Source/WebKit/chromium/public/WebView.h b/Source/WebKit/chromium/public/WebView.h index 45d3dd3c3..e95ec6b53 100644 --- a/Source/WebKit/chromium/public/WebView.h +++ b/Source/WebKit/chromium/public/WebView.h @@ -460,6 +460,8 @@ public: virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&) = 0; virtual bool setEditableSelectionOffsets(int start, int end) = 0; + virtual bool setCompositionFromExistingText(int compositionStart, int compositionEnd, const WebVector<WebCompositionUnderline>& underlines) = 0; + virtual void extendSelectionAndDelete(int before, int after) = 0; virtual bool isSelectionEditable() const = 0; diff --git a/Source/WebKit/chromium/src/FindInPageCoordinates.cpp b/Source/WebKit/chromium/src/FindInPageCoordinates.cpp index b00a30c23..643848868 100644 --- a/Source/WebKit/chromium/src/FindInPageCoordinates.cpp +++ b/Source/WebKit/chromium/src/FindInPageCoordinates.cpp @@ -38,6 +38,7 @@ #include "IntPoint.h" #include "Node.h" #include "Range.h" +#include "RenderBlock.h" #include "RenderBox.h" #include "RenderObject.h" #include "RenderPart.h" @@ -48,39 +49,32 @@ using namespace WebCore; namespace WebKit { -static FloatRect toNormalizedRect(const FloatRect& absoluteRect, const RenderObject* renderer, FloatRect& containerBoundingBox) +static FloatRect toNormalizedRect(const FloatRect& absoluteRect, const RenderObject* renderer) { ASSERT(renderer); - const RenderObject* container = renderer->container(); - if (!container) { - containerBoundingBox = FloatRect(); + const RenderBlock* container = renderer->containingBlock(); + ASSERT(container || renderer->isRenderView()); + if (!container) return FloatRect(); - } - - FloatRect normalizedRect = absoluteRect; - FloatRect containerRect = container->absoluteBoundingBoxRect(); - containerBoundingBox = containerRect; - // For RenderBoxes we want to normalize by the max layout overflow size instead of only the visible bounding box. + // We want to normalize by the max layout overflow size instead of only the visible bounding box. // Quads and their enclosing bounding boxes need to be used in order to keep results transform-friendly. - if (container->isBox()) { - const RenderBox* containerBox = toRenderBox(container); - FloatPoint scrolledOrigin; + FloatPoint scrolledOrigin; - // For overflow:scroll we need to get where the actual origin is independently of the scroll. - if (container->hasOverflowClip()) - scrolledOrigin = -IntPoint(containerBox->scrolledContentOffset()); + // For overflow:scroll we need to get where the actual origin is independently of the scroll. + if (container->hasOverflowClip()) + scrolledOrigin = -IntPoint(container->scrolledContentOffset()); - FloatRect overflowRect(scrolledOrigin, containerBox->maxLayoutOverflow()); - containerRect = containerBox->localToAbsoluteQuad(FloatQuad(overflowRect), false).enclosingBoundingBox(); - } + FloatRect overflowRect(scrolledOrigin, container->maxLayoutOverflow()); + FloatRect containerRect = container->localToAbsoluteQuad(FloatQuad(overflowRect), false).enclosingBoundingBox(); if (containerRect.isEmpty()) return FloatRect(); // Make the coordinates relative to the container enclosing bounding box. // Since we work with rects enclosing quad unions this is still transform-friendly. + FloatRect normalizedRect = absoluteRect; normalizedRect.moveBy(-containerRect.location()); // Fixed positions do not make sense in this coordinate system, but need to leave consistent tickmarks. @@ -89,29 +83,26 @@ static FloatRect toNormalizedRect(const FloatRect& absoluteRect, const RenderObj normalizedRect.move(-toRenderView(container)->frameView()->scrollOffsetForFixedPosition()); normalizedRect.scale(1 / containerRect.width(), 1 / containerRect.height()); - return normalizedRect; } -FloatRect findInPageRectFromAbsoluteRect(const FloatRect& inputRect, const RenderObject* renderer) +FloatRect findInPageRectFromAbsoluteRect(const FloatRect& inputRect, const RenderObject* baseRenderer) { - if (!renderer || inputRect.isEmpty()) + if (!baseRenderer || inputRect.isEmpty()) return FloatRect(); - // Normalize the input rect to its container, saving the container bounding box for the incoming loop. - FloatRect rendererBoundingBox; - FloatRect normalizedRect = toNormalizedRect(inputRect, renderer, rendererBoundingBox); - renderer = renderer->container(); + // Normalize the input rect to its container block. + FloatRect normalizedRect = toNormalizedRect(inputRect, baseRenderer); // Go up across frames. - while (renderer) { + for (const RenderObject* renderer = baseRenderer->containingBlock(); renderer; ) { // Go up the render tree until we reach the root of the current frame (the RenderView). - for (const RenderObject* container = renderer->container(); container; renderer = container, container = container->container()) { + for (const RenderBlock* container = renderer->containingBlock(); container; + renderer = container, container = container->containingBlock()) { - // Compose the normalized rects. The absolute bounding box of the container is calculated in toNormalizedRect - // and can be reused for the next iteration of the loop. - FloatRect normalizedBoxRect = toNormalizedRect(rendererBoundingBox, renderer, rendererBoundingBox); + // Compose the normalized rects. + FloatRect normalizedBoxRect = toNormalizedRect(renderer->absoluteBoundingBoxRect(), renderer); normalizedRect.scale(normalizedBoxRect.width(), normalizedBoxRect.height()); normalizedRect.moveBy(normalizedBoxRect.location()); @@ -122,10 +113,6 @@ FloatRect findInPageRectFromAbsoluteRect(const FloatRect& inputRect, const Rende // Jump to the renderer owning the frame, if any. ASSERT(renderer->isRenderView()); renderer = renderer->frame() ? renderer->frame()->ownerRenderer() : 0; - - // Update the absolute coordinates to the new frame. - if (renderer) - rendererBoundingBox = renderer->absoluteBoundingBoxRect(); } return normalizedRect; diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp index b8fb074ea..b53eb2c3a 100755 --- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp @@ -138,14 +138,6 @@ void IDBObjectStoreBackendProxy::deleteIndex(const String& name, IDBTransactionB m_webIDBObjectStore->deleteIndex(name, *transactionProxy->getWebIDBTransaction(), ec); } -void IDBObjectStoreBackendProxy::openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) -{ - // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, - // all implementations of IDB interfaces are proxy objects. - IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction); - m_webIDBObjectStore->openCursor(range, static_cast<WebIDBCursor::Direction>(direction), new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec); -} - void IDBObjectStoreBackendProxy::openCursor(PassRefPtr<IDBKeyRange> range, IDBCursor::Direction direction, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface::TaskType taskType, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) { // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h index fb0f2af37..74cb0bd57 100644 --- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h @@ -55,8 +55,6 @@ public: PassRefPtr<WebCore::IDBIndexBackendInterface> index(const String& name, WebCore::ExceptionCode&); void deleteIndex(const String& name, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); - // FIXME: Remove this version of openCursor when TaskType is plumbed through chromium. - virtual void openCursor(PassRefPtr<WebCore::IDBKeyRange>, unsigned short direction, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); virtual void openCursor(PassRefPtr<WebCore::IDBKeyRange>, WebCore::IDBCursor::Direction, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface::TaskType, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); virtual void count(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp index 4df4204b3..65dac62ca 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp @@ -30,7 +30,6 @@ #include "FloatPoint.h" #include "FloatRect.h" #include "GraphicsLayer.h" -#include "GraphicsLayerChromium.h" #include "PlatformContextSkia.h" #include "WebViewImpl.h" #include <public/WebContentLayer.h> @@ -49,11 +48,11 @@ NonCompositedContentHost::NonCompositedContentHost(WebViewImpl* webView) m_graphicsLayer->setName("non-composited content"); #endif m_graphicsLayer->setDrawsContent(true); - WebContentLayer* layer = static_cast<WebCore::GraphicsLayerChromium*>(m_graphicsLayer.get())->contentLayer(); - layer->setUseLCDText(true); - layer->layer()->setOpaque(true); + WebContentLayer layer = m_graphicsLayer->platformLayer()->to<WebContentLayer>(); + layer.setUseLCDText(true); + layer.setOpaque(true); #if !OS(ANDROID) - layer->setDrawCheckerboardForMissingTiles(true); + layer.setDrawCheckerboardForMissingTiles(true); #endif } @@ -81,7 +80,7 @@ void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer) return; } - if (layer->platformLayer() == scrollLayer()) + if (*layer->platformLayer() == scrollLayer()) return; layer->addChildAtIndex(m_graphicsLayer.get(), 0); @@ -96,12 +95,12 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, bool visibleRectChanged = m_viewportSize != viewportSize; m_viewportSize = viewportSize; - WebLayer* layer = scrollLayer(); - layer->setScrollPosition(scrollPosition + scrollOrigin); - layer->setPosition(WebFloatPoint(-scrollPosition)); + WebScrollableLayer layer = scrollLayer(); + layer.setScrollPosition(scrollPosition + scrollOrigin); + layer.setPosition(WebFloatPoint(-scrollPosition)); // Due to the possibility of pinch zoom, the noncomposited layer is always // assumed to be scrollable. - layer->setScrollable(true); + layer.setScrollable(true); m_deviceScaleFactor = deviceScale; m_graphicsLayer->deviceOrPageScaleFactorChanged(); m_graphicsLayer->setSize(contentsSize); @@ -128,11 +127,11 @@ bool NonCompositedContentHost::haveScrollLayer() return m_graphicsLayer->parent(); } -WebLayer* NonCompositedContentHost::scrollLayer() +WebScrollableLayer NonCompositedContentHost::scrollLayer() { if (!m_graphicsLayer->parent()) - return 0; - return m_graphicsLayer->parent()->platformLayer(); + return WebScrollableLayer(); + return m_graphicsLayer->parent()->platformLayer()->to<WebScrollableLayer>(); } void NonCompositedContentHost::invalidateRect(const WebCore::IntRect& rect) diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.h b/Source/WebKit/chromium/src/NonCompositedContentHost.h index 08b5f6a41..e60e9ef48 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.h +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.h @@ -29,7 +29,7 @@ #include "GraphicsLayerClient.h" #include "IntSize.h" -#include <public/WebLayer.h> +#include <public/WebScrollableLayer.h> #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -80,7 +80,7 @@ private: virtual float deviceScaleFactor() const OVERRIDE { return m_deviceScaleFactor; } bool haveScrollLayer(); - WebLayer* scrollLayer(); + WebScrollableLayer scrollLayer(); OwnPtr<WebCore::GraphicsLayer> m_graphicsLayer; WebViewImpl* m_webView; diff --git a/Source/WebKit/chromium/src/WebVideoLayerImpl.cpp b/Source/WebKit/chromium/src/WebContentLayer.cpp index 5bfed6742..efa7465b1 100644 --- a/Source/WebKit/chromium/src/WebVideoLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebContentLayer.cpp @@ -24,35 +24,59 @@ */ #include "config.h" -#include "WebVideoLayerImpl.h" +#include <public/WebContentLayer.h> -#include "VideoLayerChromium.h" -#include "WebLayerImpl.h" +#include "ContentLayerChromium.h" +#include "WebContentLayerImpl.h" + +using namespace WebCore; namespace WebKit { -WebVideoLayer* WebVideoLayer::create(WebVideoFrameProvider* provider) +WebContentLayer WebContentLayer::create(WebContentLayerClient* contentClient) +{ + return WebContentLayer(WebContentLayerImpl::create(contentClient)); +} + +void WebContentLayer::clearClient() +{ + unwrap<ContentLayerChromium>()->clearDelegate(); +} + +void WebContentLayer::setDoubleSided(bool doubleSided) +{ + m_private->setDoubleSided(doubleSided); +} + +void WebContentLayer::setContentsScale(float scale) +{ + m_private->setContentsScale(scale); +} + +void WebContentLayer::setUseLCDText(bool enable) { - return new WebVideoLayerImpl(WebCore::VideoLayerChromium::create(provider)); + m_private->setUseLCDText(enable); } -WebVideoLayerImpl::WebVideoLayerImpl(PassRefPtr<WebCore::VideoLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +void WebContentLayer::setDrawCheckerboardForMissingTiles(bool enable) { + m_private->setDrawCheckerboardForMissingTiles(enable); } -WebVideoLayerImpl::~WebVideoLayerImpl() +WebContentLayer::WebContentLayer(const PassRefPtr<ContentLayerChromium>& node) + : WebScrollableLayer(node) { } -WebLayer* WebVideoLayerImpl::layer() +WebContentLayer& WebContentLayer::operator=(const PassRefPtr<ContentLayerChromium>& node) { - return m_layer.get(); + m_private = node; + return *this; } -bool WebVideoLayerImpl::active() const +WebContentLayer::operator PassRefPtr<ContentLayerChromium>() const { - return m_layer->layer()->layerTreeHost(); + return static_cast<ContentLayerChromium*>(m_private.get()); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp index fa21e8974..69da1ea3f 100644 --- a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp @@ -26,66 +26,37 @@ #include "config.h" #include "WebContentLayerImpl.h" -#include "SkMatrix44.h" #include <public/WebContentLayerClient.h> -#include <public/WebFloatPoint.h> #include <public/WebFloatRect.h> #include <public/WebRect.h> -#include <public/WebSize.h> using namespace WebCore; namespace WebKit { -WebContentLayer* WebContentLayer::create(WebContentLayerClient* client) +PassRefPtr<WebContentLayerImpl> WebContentLayerImpl::create(WebContentLayerClient* contentClient) { - return new WebContentLayerImpl(client); + return adoptRef(new WebContentLayerImpl(contentClient)); } -WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* client) - : m_webLayerImpl(adoptPtr(new WebLayerImpl(ContentLayerChromium::create(this)))) - , m_client(client) +WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* contentClient) + : ContentLayerChromium(this) + , m_contentClient(contentClient) { - m_webLayerImpl->layer()->setIsDrawable(true); + setIsDrawable(true); } WebContentLayerImpl::~WebContentLayerImpl() { - static_cast<ContentLayerChromium*>(m_webLayerImpl->layer())->clearDelegate(); + clearDelegate(); } -WebLayer* WebContentLayerImpl::layer() -{ - return m_webLayerImpl.get(); -} - -void WebContentLayerImpl::setDoubleSided(bool doubleSided) -{ - m_webLayerImpl->layer()->setDoubleSided(doubleSided); -} - -void WebContentLayerImpl::setContentsScale(float scale) -{ - m_webLayerImpl->layer()->setContentsScale(scale); -} - -void WebContentLayerImpl::setUseLCDText(bool enable) -{ - m_webLayerImpl->layer()->setUseLCDText(enable); -} - -void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) -{ - m_webLayerImpl->layer()->setDrawCheckerboardForMissingTiles(enable); -} - - void WebContentLayerImpl::paintContents(SkCanvas* canvas, const IntRect& clip, FloatRect& opaque) { - if (!m_client) + if (!m_contentClient) return; WebFloatRect webOpaque; - m_client->paintContents(canvas, WebRect(clip), webOpaque); + m_contentClient->paintContents(canvas, WebRect(clip), webOpaque); opaque = webOpaque; } diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.h b/Source/WebKit/chromium/src/WebContentLayerImpl.h index 511f8e0ba..97729ea1e 100644 --- a/Source/WebKit/chromium/src/WebContentLayerImpl.h +++ b/Source/WebKit/chromium/src/WebContentLayerImpl.h @@ -27,33 +27,23 @@ #define WebContentLayerImpl_h #include "ContentLayerChromium.h" -#include "WebLayerImpl.h" -#include <public/WebContentLayer.h> #include <wtf/PassRefPtr.h> namespace WebKit { class WebContentLayerClient; -class WebContentLayerImpl : public WebContentLayer, - public WebCore::ContentLayerDelegate { +class WebContentLayerImpl : public WebCore::ContentLayerChromium, public WebCore::ContentLayerDelegate { public: - explicit WebContentLayerImpl(WebContentLayerClient*); - - // WebContentLayer implementation. - virtual WebLayer* layer() OVERRIDE; - virtual void setDoubleSided(bool) OVERRIDE; - virtual void setContentsScale(float) OVERRIDE; - virtual void setUseLCDText(bool) OVERRIDE; - virtual void setDrawCheckerboardForMissingTiles(bool) OVERRIDE; + static PassRefPtr<WebContentLayerImpl> create(WebContentLayerClient* contentClient); protected: + explicit WebContentLayerImpl(WebContentLayerClient* contentClient); virtual ~WebContentLayerImpl(); // ContentLayerDelegate implementation. virtual void paintContents(SkCanvas*, const WebCore::IntRect& clip, WebCore::FloatRect& opaque) OVERRIDE; - OwnPtr<WebLayerImpl> m_webLayerImpl; - WebContentLayerClient* m_client; + WebContentLayerClient* m_contentClient; bool m_drawsContent; }; diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp b/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp index d62166f44..d4aff5721 100644 --- a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp @@ -24,11 +24,10 @@ */ #include "config.h" -#include "WebExternalTextureLayerImpl.h" +#include <public/WebExternalTextureLayer.h> #include "CCTextureUpdateQueue.h" #include "TextureLayerChromium.h" -#include "WebLayerImpl.h" #include <public/WebExternalTextureLayerClient.h> #include <public/WebFloatRect.h> #include <public/WebSize.h> @@ -37,96 +36,96 @@ using namespace WebCore; namespace WebKit { -WebExternalTextureLayer* WebExternalTextureLayer::create(WebExternalTextureLayerClient* client) -{ - return new WebExternalTextureLayerImpl(client); -} +class WebTextureUpdaterImpl : public WebTextureUpdater { +public: + explicit WebTextureUpdaterImpl(CCTextureUpdateQueue& queue) + : m_queue(queue) + { + } -WebExternalTextureLayerImpl::WebExternalTextureLayerImpl(WebExternalTextureLayerClient* client) - : m_client(client) -{ - RefPtr<TextureLayerChromium> layer; - if (m_client) - layer = TextureLayerChromium::create(this); - else - layer = TextureLayerChromium::create(0); - layer->setIsDrawable(true); - m_layer = adoptPtr(new WebLayerImpl(layer.release())); -} + virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture, WebSize size) OVERRIDE + { + TextureCopier::Parameters copy = { sourceTexture, destinationTexture, size }; + m_queue.appendCopy(copy); + } -WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl() -{ - static_cast<TextureLayerChromium*>(m_layer->layer())->clearClient(); -} +private: + CCTextureUpdateQueue& m_queue; +}; + +class WebExternalTextureLayerImpl : public TextureLayerChromiumClient, public TextureLayerChromium { +public: + explicit WebExternalTextureLayerImpl(WebExternalTextureLayerClient* client) + : TextureLayerChromium(client ? this : 0) + , m_client(client) + { + } + + virtual unsigned prepareTexture(CCTextureUpdateQueue& queue) OVERRIDE + { + WebTextureUpdaterImpl updaterImpl(queue); + return m_client->prepareTexture(updaterImpl); + } -WebLayer* WebExternalTextureLayerImpl::layer() + virtual WebKit::WebGraphicsContext3D* context() OVERRIDE + { + return m_client->context(); + } + +private: + WebExternalTextureLayerClient* m_client; +}; + +WebExternalTextureLayer WebExternalTextureLayer::create(WebExternalTextureLayerClient* client) { - return m_layer.get(); + RefPtr<TextureLayerChromium> layer = adoptRef(new WebExternalTextureLayerImpl(client)); + layer->setIsDrawable(true); + return WebExternalTextureLayer(layer.release()); } -void WebExternalTextureLayerImpl::setTextureId(unsigned id) +void WebExternalTextureLayer::clearClient() { - static_cast<TextureLayerChromium*>(m_layer->layer())->setTextureId(id); + unwrap<TextureLayerChromium>()->clearClient(); } -void WebExternalTextureLayerImpl::setFlipped(bool flipped) +void WebExternalTextureLayer::setTextureId(unsigned id) { - static_cast<TextureLayerChromium*>(m_layer->layer())->setFlipped(flipped); + unwrap<TextureLayerChromium>()->setTextureId(id); } -void WebExternalTextureLayerImpl::setUVRect(const WebFloatRect& rect) +void WebExternalTextureLayer::setFlipped(bool flipped) { - static_cast<TextureLayerChromium*>(m_layer->layer())->setUVRect(rect); + unwrap<TextureLayerChromium>()->setFlipped(flipped); } -void WebExternalTextureLayerImpl::setOpaque(bool opaque) +void WebExternalTextureLayer::setUVRect(const WebFloatRect& rect) { - static_cast<TextureLayerChromium*>(m_layer->layer())->setOpaque(opaque); + unwrap<TextureLayerChromium>()->setUVRect(rect); } -void WebExternalTextureLayerImpl::setPremultipliedAlpha(bool premultipliedAlpha) +void WebExternalTextureLayer::setOpaque(bool opaque) { - static_cast<TextureLayerChromium*>(m_layer->layer())->setPremultipliedAlpha(premultipliedAlpha); + unwrap<TextureLayerChromium>()->setOpaque(opaque); } -void WebExternalTextureLayerImpl::willModifyTexture() +void WebExternalTextureLayer::setPremultipliedAlpha(bool premultipliedAlpha) { - static_cast<TextureLayerChromium*>(m_layer->layer())->willModifyTexture(); + unwrap<TextureLayerChromium>()->setPremultipliedAlpha(premultipliedAlpha); } -void WebExternalTextureLayerImpl::setRateLimitContext(bool rateLimit) +void WebExternalTextureLayer::willModifyTexture() { - static_cast<TextureLayerChromium*>(m_layer->layer())->setRateLimitContext(rateLimit); + unwrap<TextureLayerChromium>()->willModifyTexture(); } -class WebTextureUpdaterImpl : public WebTextureUpdater { -public: - explicit WebTextureUpdaterImpl(CCTextureUpdateQueue& queue) - : m_queue(queue) - { - } - - virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture, WebSize size) OVERRIDE - { - TextureCopier::Parameters copy = { sourceTexture, destinationTexture, size }; - m_queue.appendCopy(copy); - } - -private: - CCTextureUpdateQueue& m_queue; -}; - -unsigned WebExternalTextureLayerImpl::prepareTexture(CCTextureUpdateQueue& queue) +void WebExternalTextureLayer::setRateLimitContext(bool rateLimit) { - ASSERT(m_client); - WebTextureUpdaterImpl updaterImpl(queue); - return m_client->prepareTexture(updaterImpl); + unwrap<TextureLayerChromium>()->setRateLimitContext(rateLimit); } -WebGraphicsContext3D* WebExternalTextureLayerImpl::context() +WebExternalTextureLayer::WebExternalTextureLayer(PassRefPtr<TextureLayerChromium> layer) + : WebLayer(layer) { - ASSERT(m_client); - return m_client->context(); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h deleted file mode 100644 index 5348895bf..000000000 --- a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebExternalTextureLayerImpl_h -#define WebExternalTextureLayerImpl_h - -#include "TextureLayerChromium.h" -#include <public/WebExternalTextureLayer.h> - -namespace WebKit { - -class WebLayerImpl; - -class WebExternalTextureLayerImpl : public WebExternalTextureLayer, - public WebCore::TextureLayerChromiumClient { -public: - explicit WebExternalTextureLayerImpl(WebExternalTextureLayerClient*); - virtual ~WebExternalTextureLayerImpl(); - - // WebExternalTextureLayer implementation. - virtual WebLayer* layer() OVERRIDE; - virtual void setTextureId(unsigned) OVERRIDE; - virtual void setFlipped(bool) OVERRIDE; - virtual void setUVRect(const WebFloatRect&) OVERRIDE; - virtual void setOpaque(bool) OVERRIDE; - virtual void setPremultipliedAlpha(bool) OVERRIDE; - virtual void willModifyTexture() OVERRIDE; - virtual void setRateLimitContext(bool) OVERRIDE; - - // TextureLayerChromiumClient implementation. - virtual unsigned prepareTexture(WebCore::CCTextureUpdateQueue&) OVERRIDE; - virtual WebGraphicsContext3D* context() OVERRIDE; - -private: - WebExternalTextureLayerClient* m_client; - OwnPtr<WebLayerImpl> m_layer; -}; - -} - -#endif // WebExternalTextureLayerImpl_h - diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h index 95879b5d0..04020e558 100644 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h @@ -56,10 +56,6 @@ public: WebIDBIndex* index(const WebString& name, WebExceptionCode&); void deleteIndex(const WebString& name, const WebIDBTransaction&, WebExceptionCode&); - void openCursor(const WebIDBKeyRange& range, unsigned short direction, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec) - { - openCursor(range, static_cast<WebIDBCursor::Direction>(direction), callbacks, WebIDBTransaction::NormalTask, transaction, ec); - } void openCursor(const WebIDBKeyRange&, WebIDBCursor::Direction, WebIDBCallbacks*, WebIDBTransaction::TaskType, const WebIDBTransaction&, WebExceptionCode&); void count(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); diff --git a/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp b/Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp index bab70c61d..77db0c877 100644 --- a/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp @@ -24,39 +24,30 @@ */ #include "config.h" -#include "WebIOSurfaceLayerImpl.h" +#include <public/WebIOSurfaceLayer.h> #include "IOSurfaceLayerChromium.h" -#include "WebLayerImpl.h" +#include <public/WebSize.h> -using WebCore::IOSurfaceLayerChromium; +using namespace WebCore; namespace WebKit { -WebIOSurfaceLayer* WebIOSurfaceLayer::create() +WebIOSurfaceLayer WebIOSurfaceLayer::create() { RefPtr<IOSurfaceLayerChromium> layer = IOSurfaceLayerChromium::create(); layer->setIsDrawable(true); - return new WebIOSurfaceLayerImpl(layer.release()); + return WebIOSurfaceLayer(layer.release()); } -WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl(PassRefPtr<IOSurfaceLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +void WebIOSurfaceLayer::setIOSurfaceProperties(unsigned ioSurfaceId, WebSize size) { + unwrap<IOSurfaceLayerChromium>()->setIOSurfaceProperties(ioSurfaceId, size); } -WebIOSurfaceLayerImpl::~WebIOSurfaceLayerImpl() +WebIOSurfaceLayer::WebIOSurfaceLayer(PassRefPtr<IOSurfaceLayerChromium> layer) + : WebLayer(layer) { } -void WebIOSurfaceLayerImpl::setIOSurfaceProperties(unsigned ioSurfaceId, WebSize size) -{ - static_cast<IOSurfaceLayerChromium*>(m_layer->layer())->setIOSurfaceProperties(ioSurfaceId, size); -} - -WebLayer* WebIOSurfaceLayerImpl::layer() -{ - return m_layer.get(); -} - } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h b/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h deleted file mode 100644 index 3dbb02759..000000000 --- a/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebIOSurfaceLayerImpl_h -#define WebIOSurfaceLayerImpl_h - -#include <public/WebIOSurfaceLayer.h> -#include <wtf/OwnPtr.h> - -namespace WebCore { -class IOSurfaceLayerChromium; -} - -namespace WebKit { - -class WebIOSurfaceLayerImpl : public WebIOSurfaceLayer { -public: - explicit WebIOSurfaceLayerImpl(PassRefPtr<WebCore::IOSurfaceLayerChromium>); - virtual ~WebIOSurfaceLayerImpl(); - - // WebIOSurfaceLayer implementation. - virtual WebLayer* layer() OVERRIDE; - virtual void setIOSurfaceProperties(unsigned ioSurfaceId, WebSize) OVERRIDE; - -private: - OwnPtr<WebLayerImpl> m_layer; -}; - -} - -#endif // WebIOSurfaceLayerImpl_h - diff --git a/Source/WebKit/chromium/src/WebImageLayerImpl.h b/Source/WebKit/chromium/src/WebImageLayer.cpp index 9a4b8b3eb..f76151530 100644 --- a/Source/WebKit/chromium/src/WebImageLayerImpl.h +++ b/Source/WebKit/chromium/src/WebImageLayer.cpp @@ -23,32 +23,26 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebImageLayerImpl_h -#define WebImageLayerImpl_h - +#include "config.h" #include <public/WebImageLayer.h> -#include <wtf/OwnPtr.h> -namespace WebCore { -class ImageLayerChromium; -} +#include "ImageLayerChromium.h" namespace WebKit { -class WebLayerImpl; - -class WebImageLayerImpl : public WebImageLayer { -public: - explicit WebImageLayerImpl(PassRefPtr<WebCore::ImageLayerChromium>); - virtual ~WebImageLayerImpl(); - // WebImageLayer implementation. - WebLayer* layer() OVERRIDE; - virtual void setBitmap(SkBitmap) OVERRIDE; +WebImageLayer WebImageLayer::create() +{ + return WebImageLayer(WebCore::ImageLayerChromium::create()); +} -private: - OwnPtr<WebLayerImpl> m_layer; -}; +WebImageLayer::WebImageLayer(PassRefPtr<WebCore::ImageLayerChromium> layer) + : WebLayer(layer) +{ +} +void WebImageLayer::setBitmap(SkBitmap bitmap) +{ + unwrap<WebCore::ImageLayerChromium>()->setBitmap(bitmap); } -#endif // WebImageLayerImpl_h +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebLayer.cpp b/Source/WebKit/chromium/src/WebLayer.cpp new file mode 100644 index 000000000..37897e6f8 --- /dev/null +++ b/Source/WebKit/chromium/src/WebLayer.cpp @@ -0,0 +1,379 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include <public/WebLayer.h> + +#include "LayerChromium.h" +#include "SkMatrix44.h" +#include "WebAnimationImpl.h" +#include "WebLayerImpl.h" +#include <public/WebFilterOperations.h> +#include <public/WebFloatPoint.h> +#include <public/WebFloatRect.h> +#include <public/WebSize.h> +#include <public/WebTransformationMatrix.h> + +using namespace WebCore; +using WebKit::WebTransformationMatrix; + +namespace { + +WebTransformationMatrix transformationMatrixFromSkMatrix44(const SkMatrix44& matrix) +{ + double data[16]; + matrix.asColMajord(data); + return WebTransformationMatrix(data[0], data[1], data[2], data[3], + data[4], data[5], data[6], data[7], + data[8], data[9], data[10], data[11], + data[12], data[13], data[14], data[15]); +} + +SkMatrix44 skMatrix44FromTransformationMatrix(const WebTransformationMatrix& matrix) +{ + SkMatrix44 skMatrix; + skMatrix.set(0, 0, SkDoubleToMScalar(matrix.m11())); + skMatrix.set(1, 0, SkDoubleToMScalar(matrix.m12())); + skMatrix.set(2, 0, SkDoubleToMScalar(matrix.m13())); + skMatrix.set(3, 0, SkDoubleToMScalar(matrix.m14())); + skMatrix.set(0, 1, SkDoubleToMScalar(matrix.m21())); + skMatrix.set(1, 1, SkDoubleToMScalar(matrix.m22())); + skMatrix.set(2, 1, SkDoubleToMScalar(matrix.m23())); + skMatrix.set(3, 1, SkDoubleToMScalar(matrix.m24())); + skMatrix.set(0, 2, SkDoubleToMScalar(matrix.m31())); + skMatrix.set(1, 2, SkDoubleToMScalar(matrix.m32())); + skMatrix.set(2, 2, SkDoubleToMScalar(matrix.m33())); + skMatrix.set(3, 2, SkDoubleToMScalar(matrix.m34())); + skMatrix.set(0, 3, SkDoubleToMScalar(matrix.m41())); + skMatrix.set(1, 3, SkDoubleToMScalar(matrix.m42())); + skMatrix.set(2, 3, SkDoubleToMScalar(matrix.m43())); + skMatrix.set(3, 3, SkDoubleToMScalar(matrix.m44())); + return skMatrix; +} + +} // anonymous namespace + +namespace WebKit { + +WebLayer WebLayer::create() +{ + return WebLayer(WebLayerImpl::create()); +} + +void WebLayer::reset() +{ + m_private.reset(); +} + +void WebLayer::assign(const WebLayer& other) +{ + m_private = other.m_private; +} + +bool WebLayer::equals(const WebLayer& n) const +{ + return (m_private.get() == n.m_private.get()); +} + +void WebLayer::invalidateRect(const WebFloatRect& dirtyRect) +{ + m_private->setNeedsDisplayRect(dirtyRect); +} + +void WebLayer::invalidate() +{ + m_private->setNeedsDisplay(); +} + +void WebLayer::addChild(const WebLayer& child) +{ + m_private->addChild(child); +} + +void WebLayer::insertChild(const WebLayer& child, size_t index) +{ + m_private->insertChild(child, index); +} + +void WebLayer::replaceChild(const WebLayer& reference, const WebLayer& newLayer) +{ + WebLayer ref = reference; + m_private->replaceChild(ref.unwrap<LayerChromium>(), newLayer); +} + +void WebLayer::setChildren(const WebVector<WebLayer>& webChildren) +{ + Vector<RefPtr<LayerChromium> > children(webChildren.size()); + for (size_t i = 0; i < webChildren.size(); ++i) + children[i] = webChildren[i].unwrap<LayerChromium>(); + m_private->setChildren(children); +} + +void WebLayer::removeFromParent() +{ + m_private->removeFromParent(); +} + +void WebLayer::removeAllChildren() +{ + m_private->removeAllChildren(); +} + +void WebLayer::setAnchorPoint(const WebFloatPoint& anchorPoint) +{ + m_private->setAnchorPoint(anchorPoint); +} + +WebFloatPoint WebLayer::anchorPoint() const +{ + return WebFloatPoint(m_private->anchorPoint()); +} + +void WebLayer::setAnchorPointZ(float anchorPointZ) +{ + m_private->setAnchorPointZ(anchorPointZ); +} + +float WebLayer::anchorPointZ() const +{ + return m_private->anchorPointZ(); +} + +void WebLayer::setBounds(const WebSize& size) +{ + m_private->setBounds(size); +} + +WebSize WebLayer::bounds() const +{ + return WebSize(m_private->bounds()); +} + +void WebLayer::setMasksToBounds(bool masksToBounds) +{ + m_private->setMasksToBounds(masksToBounds); +} + +bool WebLayer::masksToBounds() const +{ + return m_private->masksToBounds(); +} + +void WebLayer::setMaskLayer(const WebLayer& maskLayer) +{ + WebLayer ref = maskLayer; + m_private->setMaskLayer(ref.unwrap<LayerChromium>()); +} + +void WebLayer::setReplicaLayer(const WebLayer& replicaLayer) +{ + WebLayer ref = replicaLayer; + m_private->setReplicaLayer(ref.unwrap<LayerChromium>()); +} + +void WebLayer::setOpacity(float opacity) +{ + m_private->setOpacity(opacity); +} + +float WebLayer::opacity() const +{ + return m_private->opacity(); +} + +void WebLayer::setOpaque(bool opaque) +{ + m_private->setOpaque(opaque); +} + +bool WebLayer::opaque() const +{ + return m_private->opaque(); +} + +void WebLayer::setPosition(const WebFloatPoint& position) +{ + m_private->setPosition(position); +} + +WebFloatPoint WebLayer::position() const +{ + return WebFloatPoint(m_private->position()); +} + +void WebLayer::setSublayerTransform(const SkMatrix44& matrix) +{ + m_private->setSublayerTransform(transformationMatrixFromSkMatrix44(matrix)); +} + +void WebLayer::setSublayerTransform(const WebTransformationMatrix& matrix) +{ + m_private->setSublayerTransform(matrix); +} + +SkMatrix44 WebLayer::sublayerTransform() const +{ + return skMatrix44FromTransformationMatrix(m_private->sublayerTransform()); +} + +void WebLayer::setTransform(const SkMatrix44& matrix) +{ + m_private->setTransform(transformationMatrixFromSkMatrix44(matrix)); +} + +void WebLayer::setTransform(const WebTransformationMatrix& matrix) +{ + m_private->setTransform(matrix); +} + +SkMatrix44 WebLayer::transform() const +{ + return skMatrix44FromTransformationMatrix(m_private->transform()); +} + +void WebLayer::setDrawsContent(bool drawsContent) +{ + m_private->setIsDrawable(drawsContent); +} + +bool WebLayer::drawsContent() const +{ + return m_private->drawsContent(); +} + +void WebLayer::setPreserves3D(bool preserve3D) +{ + m_private->setPreserves3D(preserve3D); +} + +void WebLayer::setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) +{ + m_private->setUseParentBackfaceVisibility(useParentBackfaceVisibility); +} + +void WebLayer::setBackgroundColor(WebColor color) +{ + m_private->setBackgroundColor(color); +} + +void WebLayer::setFilters(const WebFilterOperations& filters) +{ + m_private->setFilters(filters); +} + +void WebLayer::setBackgroundFilters(const WebFilterOperations& filters) +{ + m_private->setBackgroundFilters(filters); +} + +void WebLayer::setDebugBorderColor(const WebColor& color) +{ + m_private->setDebugBorderColor(color); +} + +void WebLayer::setDebugBorderWidth(float width) +{ + m_private->setDebugBorderWidth(width); +} + +void WebLayer::setDebugName(WebString name) +{ + m_private->setDebugName(name); +} + +void WebLayer::setAnimationDelegate(WebAnimationDelegate* delegate) +{ + m_private->setLayerAnimationDelegate(delegate); +} + +bool WebLayer::addAnimation(WebAnimation* animation) +{ + return m_private->addAnimation(static_cast<WebAnimationImpl*>(animation)->cloneToCCAnimation()); +} + +void WebLayer::removeAnimation(int animationId) +{ + m_private->removeAnimation(animationId); +} + +void WebLayer::removeAnimation(int animationId, WebAnimation::TargetProperty targetProperty) +{ + m_private->layerAnimationController()->removeAnimation(animationId, static_cast<CCActiveAnimation::TargetProperty>(targetProperty)); +} + +void WebLayer::pauseAnimation(int animationId, double timeOffset) +{ + m_private->pauseAnimation(animationId, timeOffset); +} + +void WebLayer::suspendAnimations(double monotonicTime) +{ + m_private->suspendAnimations(monotonicTime); +} + +void WebLayer::resumeAnimations(double monotonicTime) +{ + m_private->resumeAnimations(monotonicTime); +} + +bool WebLayer::hasActiveAnimation() +{ + return m_private->hasActiveAnimation(); +} + +void WebLayer::transferAnimationsTo(WebLayer* other) +{ + ASSERT(other); + if (other) + other->m_private->setLayerAnimationController(m_private->releaseLayerAnimationController()); +} + +void WebLayer::setForceRenderSurface(bool forceRenderSurface) +{ + m_private->setForceRenderSurface(forceRenderSurface); +} + +void WebLayer::clearRenderSurface() +{ + m_private->clearRenderSurface(); +} + +WebLayer::WebLayer(const PassRefPtr<LayerChromium>& node) + : m_private(node) +{ +} + +WebLayer& WebLayer::operator=(const PassRefPtr<LayerChromium>& node) +{ + m_private = node; + return *this; +} + +WebLayer::operator PassRefPtr<LayerChromium>() const +{ + return m_private.get(); +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebLayerImpl.cpp b/Source/WebKit/chromium/src/WebLayerImpl.cpp index 40ced485d..16e1206ca 100644 --- a/Source/WebKit/chromium/src/WebLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebLayerImpl.cpp @@ -26,376 +26,25 @@ #include "config.h" #include "WebLayerImpl.h" -#include "CCActiveAnimation.h" -#include "LayerChromium.h" -#include "SkMatrix44.h" -#include "WebAnimationImpl.h" -#include <public/WebFloatPoint.h> -#include <public/WebFloatRect.h> -#include <public/WebSize.h> -#include <public/WebTransformationMatrix.h> - -using WebCore::CCActiveAnimation; -using WebCore::LayerChromium; +using namespace WebCore; namespace WebKit { -namespace { - -WebTransformationMatrix transformationMatrixFromSkMatrix44(const SkMatrix44& matrix) -{ - double data[16]; - matrix.asColMajord(data); - return WebTransformationMatrix(data[0], data[1], data[2], data[3], - data[4], data[5], data[6], data[7], - data[8], data[9], data[10], data[11], - data[12], data[13], data[14], data[15]); -} - -SkMatrix44 skMatrix44FromTransformationMatrix(const WebTransformationMatrix& matrix) -{ - SkMatrix44 skMatrix; - skMatrix.set(0, 0, SkDoubleToMScalar(matrix.m11())); - skMatrix.set(1, 0, SkDoubleToMScalar(matrix.m12())); - skMatrix.set(2, 0, SkDoubleToMScalar(matrix.m13())); - skMatrix.set(3, 0, SkDoubleToMScalar(matrix.m14())); - skMatrix.set(0, 1, SkDoubleToMScalar(matrix.m21())); - skMatrix.set(1, 1, SkDoubleToMScalar(matrix.m22())); - skMatrix.set(2, 1, SkDoubleToMScalar(matrix.m23())); - skMatrix.set(3, 1, SkDoubleToMScalar(matrix.m24())); - skMatrix.set(0, 2, SkDoubleToMScalar(matrix.m31())); - skMatrix.set(1, 2, SkDoubleToMScalar(matrix.m32())); - skMatrix.set(2, 2, SkDoubleToMScalar(matrix.m33())); - skMatrix.set(3, 2, SkDoubleToMScalar(matrix.m34())); - skMatrix.set(0, 3, SkDoubleToMScalar(matrix.m41())); - skMatrix.set(1, 3, SkDoubleToMScalar(matrix.m42())); - skMatrix.set(2, 3, SkDoubleToMScalar(matrix.m43())); - skMatrix.set(3, 3, SkDoubleToMScalar(matrix.m44())); - return skMatrix; -} - -} // anonymous namespace - - -WebLayer* WebLayer::create() +PassRefPtr<WebLayerImpl> WebLayerImpl::create() { - return new WebLayerImpl(LayerChromium::create()); + return adoptRef(new WebLayerImpl()); } -WebLayerImpl::WebLayerImpl(PassRefPtr<LayerChromium> layer) - : m_layer(layer) +WebLayerImpl::WebLayerImpl() + : LayerChromium() { + // Make sure that this layer does not draw content. This way we don't have to override + // the base class implementation of drawsContent(). + ASSERT(!drawsContent()); } WebLayerImpl::~WebLayerImpl() { - m_layer->clearRenderSurface(); - m_layer->setLayerAnimationDelegate(0); -} - -int WebLayerImpl::id() const -{ - return m_layer->id(); -} - -void WebLayerImpl::invalidateRect(const WebFloatRect& rect) -{ - m_layer->setNeedsDisplayRect(rect); -} - -void WebLayerImpl::invalidate() -{ - m_layer->setNeedsDisplay(); -} - -void WebLayerImpl::addChild(WebLayer* child) -{ - m_layer->addChild(static_cast<WebLayerImpl*>(child)->layer()); -} - -void WebLayerImpl::insertChild(WebLayer* child, size_t index) -{ - m_layer->insertChild(static_cast<WebLayerImpl*>(child)->layer(), index); -} - -void WebLayerImpl::replaceChild(WebLayer* reference, WebLayer* newLayer) -{ - m_layer->replaceChild(static_cast<WebLayerImpl*>(reference)->layer(), static_cast<WebLayerImpl*>(newLayer)->layer()); -} - -void WebLayerImpl::setChildren(const WebVector<WebLayer*>& webChildren) -{ - Vector<RefPtr<LayerChromium> > children(webChildren.size()); - for (size_t i = 0; i < webChildren.size(); ++i) - children[i] = static_cast<WebLayerImpl*>(webChildren[i])->layer(); - m_layer->setChildren(children); -} - -void WebLayerImpl::removeFromParent() -{ - m_layer->removeFromParent(); -} - -void WebLayerImpl::removeAllChildren() -{ - m_layer->removeAllChildren(); -} - -void WebLayerImpl::setAnchorPoint(const WebFloatPoint& anchorPoint) -{ - m_layer->setAnchorPoint(anchorPoint); -} - -WebFloatPoint WebLayerImpl::anchorPoint() const -{ - return WebFloatPoint(m_layer->anchorPoint()); -} - -void WebLayerImpl::setAnchorPointZ(float anchorPointZ) -{ - m_layer->setAnchorPointZ(anchorPointZ); -} - -float WebLayerImpl::anchorPointZ() const -{ - return m_layer->anchorPointZ(); -} - -void WebLayerImpl::setBounds(const WebSize& size) -{ - m_layer->setBounds(size); -} - -WebSize WebLayerImpl::bounds() const -{ - return WebSize(m_layer->bounds()); -} - -void WebLayerImpl::setMasksToBounds(bool masksToBounds) -{ - m_layer->setMasksToBounds(masksToBounds); -} - -bool WebLayerImpl::masksToBounds() const -{ - return m_layer->masksToBounds(); -} - -void WebLayerImpl::setMaskLayer(WebLayer* maskLayer) -{ - m_layer->setMaskLayer(maskLayer ? static_cast<WebLayerImpl*>(maskLayer)->layer() : 0); -} - -void WebLayerImpl::setReplicaLayer(WebLayer* replicaLayer) -{ - m_layer->setReplicaLayer(replicaLayer ? static_cast<WebLayerImpl*>(replicaLayer)->layer() : 0); -} - -void WebLayerImpl::setOpacity(float opacity) -{ - m_layer->setOpacity(opacity); -} - -float WebLayerImpl::opacity() const -{ - return m_layer->opacity(); -} - -void WebLayerImpl::setOpaque(bool opaque) -{ - m_layer->setOpaque(opaque); -} - -bool WebLayerImpl::opaque() const -{ - return m_layer->opaque(); -} - -void WebLayerImpl::setPosition(const WebFloatPoint& position) -{ - m_layer->setPosition(position); -} - -WebFloatPoint WebLayerImpl::position() const -{ - return WebFloatPoint(m_layer->position()); -} - -void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix) -{ - m_layer->setSublayerTransform(transformationMatrixFromSkMatrix44(matrix)); -} - -void WebLayerImpl::setSublayerTransform(const WebTransformationMatrix& matrix) -{ - m_layer->setSublayerTransform(matrix); -} - -SkMatrix44 WebLayerImpl::sublayerTransform() const -{ - return skMatrix44FromTransformationMatrix(m_layer->sublayerTransform()); -} - -void WebLayerImpl::setTransform(const SkMatrix44& matrix) -{ - m_layer->setTransform(transformationMatrixFromSkMatrix44(matrix)); -} - -void WebLayerImpl::setTransform(const WebTransformationMatrix& matrix) -{ - m_layer->setTransform(matrix); -} - -SkMatrix44 WebLayerImpl::transform() const -{ - return skMatrix44FromTransformationMatrix(m_layer->transform()); -} - -void WebLayerImpl::setDrawsContent(bool drawsContent) -{ - m_layer->setIsDrawable(drawsContent); -} - -bool WebLayerImpl::drawsContent() const -{ - return m_layer->drawsContent(); -} - -void WebLayerImpl::setPreserves3D(bool preserve3D) -{ - m_layer->setPreserves3D(preserve3D); -} - -void WebLayerImpl::setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) -{ - m_layer->setUseParentBackfaceVisibility(useParentBackfaceVisibility); -} - -void WebLayerImpl::setBackgroundColor(WebColor color) -{ - m_layer->setBackgroundColor(color); -} - -void WebLayerImpl::setFilters(const WebFilterOperations& filters) -{ - m_layer->setFilters(filters); -} - -void WebLayerImpl::setBackgroundFilters(const WebFilterOperations& filters) -{ - m_layer->setBackgroundFilters(filters); -} - -void WebLayerImpl::setDebugBorderColor(const WebColor& color) -{ - m_layer->setDebugBorderColor(color); -} - -void WebLayerImpl::setDebugBorderWidth(float width) -{ - m_layer->setDebugBorderWidth(width); -} - -void WebLayerImpl::setDebugName(WebString name) -{ - m_layer->setDebugName(name); -} - -void WebLayerImpl::setAnimationDelegate(WebAnimationDelegate* delegate) -{ - m_layer->setLayerAnimationDelegate(delegate); -} - -bool WebLayerImpl::addAnimation(WebAnimation* animation) -{ - return m_layer->addAnimation(static_cast<WebAnimationImpl*>(animation)->cloneToCCAnimation()); -} - -void WebLayerImpl::removeAnimation(int animationId) -{ - m_layer->removeAnimation(animationId); -} - -void WebLayerImpl::removeAnimation(int animationId, WebAnimation::TargetProperty targetProperty) -{ - m_layer->layerAnimationController()->removeAnimation(animationId, static_cast<CCActiveAnimation::TargetProperty>(targetProperty)); -} - -void WebLayerImpl::pauseAnimation(int animationId, double timeOffset) -{ - m_layer->pauseAnimation(animationId, timeOffset); -} - -void WebLayerImpl::suspendAnimations(double monotonicTime) -{ - m_layer->suspendAnimations(monotonicTime); -} - -void WebLayerImpl::resumeAnimations(double monotonicTime) -{ - m_layer->resumeAnimations(monotonicTime); -} - -bool WebLayerImpl::hasActiveAnimation() -{ - return m_layer->hasActiveAnimation(); -} - -void WebLayerImpl::transferAnimationsTo(WebLayer* other) -{ - ASSERT(other); - static_cast<WebLayerImpl*>(other)->m_layer->setLayerAnimationController(m_layer->releaseLayerAnimationController()); -} - -void WebLayerImpl::setForceRenderSurface(bool forceRenderSurface) -{ - m_layer->setForceRenderSurface(forceRenderSurface); -} - -void WebLayerImpl::setScrollPosition(WebPoint position) -{ - m_layer->setScrollPosition(position); -} - -void WebLayerImpl::setScrollable(bool scrollable) -{ - m_layer->setScrollable(scrollable); -} - -void WebLayerImpl::setHaveWheelEventHandlers(bool haveWheelEventHandlers) -{ - m_layer->setHaveWheelEventHandlers(haveWheelEventHandlers); -} - -void WebLayerImpl::setShouldScrollOnMainThread(bool shouldScrollOnMainThread) -{ - m_layer->setShouldScrollOnMainThread(shouldScrollOnMainThread); -} - -void WebLayerImpl::setNonFastScrollableRegion(const WebVector<WebRect>& rects) -{ - WebCore::Region region; - for (size_t i = 0; i < rects.size(); ++i) { - WebCore::IntRect rect = rects[i]; - region.unite(rect); - } - m_layer->setNonFastScrollableRegion(region); - -} - -void WebLayerImpl::setIsContainerForFixedPositionLayers(bool enable) -{ - m_layer->setIsContainerForFixedPositionLayers(enable); -} - -void WebLayerImpl::setFixedToContainerLayer(bool enable) -{ - m_layer->setFixedToContainerLayer(enable); -} - -LayerChromium* WebLayerImpl::layer() const -{ - return m_layer.get(); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebLayerImpl.h b/Source/WebKit/chromium/src/WebLayerImpl.h index 7e3b533bc..7e4e75062 100644 --- a/Source/WebKit/chromium/src/WebLayerImpl.h +++ b/Source/WebKit/chromium/src/WebLayerImpl.h @@ -26,84 +26,18 @@ #ifndef WebLayerImpl_h #define WebLayerImpl_h -#include <public/WebLayer.h> -#include <wtf/RefPtr.h> - -namespace WebCore { -class LayerChromium; -} +#include "LayerChromium.h" +#include <wtf/PassRefPtr.h> namespace WebKit { -class WebLayerImpl : public WebLayer { +class WebLayerImpl : public WebCore::LayerChromium { public: - explicit WebLayerImpl(PassRefPtr<WebCore::LayerChromium>); - virtual ~WebLayerImpl(); - - // WebLayer implementation. - virtual int id() const OVERRIDE; - virtual void invalidateRect(const WebFloatRect&) OVERRIDE; - virtual void invalidate() OVERRIDE; - virtual void addChild(WebLayer*) OVERRIDE; - virtual void insertChild(WebLayer*, size_t index) OVERRIDE; - virtual void replaceChild(WebLayer* reference, WebLayer* newLayer) OVERRIDE; - virtual void setChildren(const WebVector<WebLayer*>&) OVERRIDE; - virtual void removeFromParent() OVERRIDE; - virtual void removeAllChildren() OVERRIDE; - virtual void setAnchorPoint(const WebFloatPoint&) OVERRIDE; - virtual WebFloatPoint anchorPoint() const OVERRIDE; - virtual void setAnchorPointZ(float) OVERRIDE; - virtual float anchorPointZ() const OVERRIDE; - virtual void setBounds(const WebSize&) OVERRIDE; - virtual WebSize bounds() const OVERRIDE; - virtual void setMasksToBounds(bool) OVERRIDE; - virtual bool masksToBounds() const OVERRIDE; - virtual void setMaskLayer(WebLayer*) OVERRIDE; - virtual void setReplicaLayer(WebLayer*) OVERRIDE; - virtual void setOpacity(float) OVERRIDE; - virtual float opacity() const OVERRIDE; - virtual void setOpaque(bool) OVERRIDE; - virtual bool opaque() const OVERRIDE; - virtual void setPosition(const WebFloatPoint&) OVERRIDE; - virtual WebFloatPoint position() const OVERRIDE; - virtual void setSublayerTransform(const SkMatrix44&) OVERRIDE; - virtual void setSublayerTransform(const WebTransformationMatrix&) OVERRIDE; - virtual SkMatrix44 sublayerTransform() const OVERRIDE; - virtual void setTransform(const SkMatrix44&) OVERRIDE; - virtual void setTransform(const WebTransformationMatrix&) OVERRIDE; - virtual SkMatrix44 transform() const OVERRIDE; - virtual void setDrawsContent(bool) OVERRIDE; - virtual bool drawsContent() const OVERRIDE; - virtual void setPreserves3D(bool) OVERRIDE; - virtual void setUseParentBackfaceVisibility(bool) OVERRIDE; - virtual void setBackgroundColor(WebColor) OVERRIDE; - virtual void setFilters(const WebFilterOperations&) OVERRIDE; - virtual void setBackgroundFilters(const WebFilterOperations&) OVERRIDE; - virtual void setDebugBorderColor(const WebColor&) OVERRIDE; - virtual void setDebugBorderWidth(float) OVERRIDE; - virtual void setDebugName(WebString) OVERRIDE; - virtual void setAnimationDelegate(WebAnimationDelegate*) OVERRIDE; - virtual bool addAnimation(WebAnimation*) OVERRIDE; - virtual void removeAnimation(int animationId) OVERRIDE; - virtual void removeAnimation(int animationId, WebAnimation::TargetProperty) OVERRIDE; - virtual void pauseAnimation(int animationId, double timeOffset) OVERRIDE; - virtual void suspendAnimations(double monotonicTime) OVERRIDE; - virtual void resumeAnimations(double monotonicTime) OVERRIDE; - virtual bool hasActiveAnimation() OVERRIDE; - virtual void transferAnimationsTo(WebLayer*) OVERRIDE; - virtual void setForceRenderSurface(bool) OVERRIDE; - virtual void setScrollPosition(WebPoint) OVERRIDE; - virtual void setScrollable(bool) OVERRIDE; - virtual void setHaveWheelEventHandlers(bool) OVERRIDE; - virtual void setShouldScrollOnMainThread(bool) OVERRIDE; - virtual void setNonFastScrollableRegion(const WebVector<WebRect>&) OVERRIDE; - virtual void setIsContainerForFixedPositionLayers(bool) OVERRIDE; - virtual void setFixedToContainerLayer(bool) OVERRIDE; - - WebCore::LayerChromium* layer() const; + static PassRefPtr<WebLayerImpl> create(); protected: - RefPtr<WebCore::LayerChromium> m_layer; + WebLayerImpl(); + virtual ~WebLayerImpl(); }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebLayerTreeView.cpp b/Source/WebKit/chromium/src/WebLayerTreeView.cpp index 7dfbcd129..f397e534a 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeView.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeView.cpp @@ -31,7 +31,6 @@ #include "CCLayerTreeHost.h" #include "CCRenderingStats.h" #include "LayerChromium.h" -#include "WebLayerImpl.h" #include "WebLayerTreeViewImpl.h" #include <public/WebLayer.h> #include <public/WebPoint.h> @@ -84,7 +83,7 @@ void WebLayerTreeView::setSurfaceReady() void WebLayerTreeView::setRootLayer(WebLayer *root) { if (root) - m_private->layerTreeHost()->setRootLayer(static_cast<WebLayerImpl*>(root)->layer()); + m_private->layerTreeHost()->setRootLayer(*root); else m_private->layerTreeHost()->setRootLayer(PassRefPtr<LayerChromium>()); } diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp index 1fd823976..1f1933fc9 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp @@ -29,7 +29,6 @@ #include "CCLayerTreeHost.h" #include "CCThreadProxy.h" #include "LayerChromium.h" -#include "WebLayerImpl.h" #include <public/WebGraphicsContext3D.h> #include <public/WebLayer.h> #include <public/WebLayerTreeView.h> @@ -143,7 +142,7 @@ PassOwnPtr<WebLayerTreeViewImpl> WebLayerTreeViewImpl::create(WebLayerTreeViewCl OwnPtr<WebLayerTreeViewImpl> impl = adoptPtr(new WebLayerTreeViewImpl(client, settings)); if (!impl->layerTreeHost()) return nullptr; - impl->layerTreeHost()->setRootLayer(static_cast<const WebLayerImpl*>(&root)->layer()); + impl->layerTreeHost()->setRootLayer(root); return impl.release(); } diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index cb756233e..4a90a988d 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -109,9 +109,9 @@ void WebMediaPlayerClientImpl::readyStateChanged() ASSERT(m_mediaPlayer); m_mediaPlayer->readyStateChanged(); #if USE(ACCELERATED_COMPOSITING) - if (hasVideo() && supportsAcceleratedRendering() && !m_videoLayer) { - m_videoLayer = adoptPtr(WebVideoLayer::create(this)); - m_videoLayer->layer()->setOpaque(m_opaque); + if (hasVideo() && supportsAcceleratedRendering() && m_videoLayer.isNull()) { + m_videoLayer = WebVideoLayer::create(this); + m_videoLayer.setOpaque(m_opaque); } #endif } @@ -138,8 +138,8 @@ void WebMediaPlayerClientImpl::repaint() { ASSERT(m_mediaPlayer); #if USE(ACCELERATED_COMPOSITING) - if (m_videoLayer && supportsAcceleratedRendering()) - m_videoLayer->layer()->invalidate(); + if (!m_videoLayer.isNull() && supportsAcceleratedRendering()) + m_videoLayer.invalidate(); #endif m_mediaPlayer->repaint(); } @@ -166,8 +166,8 @@ void WebMediaPlayerClientImpl::setOpaque(bool opaque) { #if USE(ACCELERATED_COMPOSITING) m_opaque = opaque; - if (m_videoLayer) - m_videoLayer->layer()->setOpaque(m_opaque); + if (!m_videoLayer.isNull()) + m_videoLayer.setOpaque(m_opaque); #endif } @@ -343,7 +343,7 @@ void WebMediaPlayerClientImpl::cancelLoad() WebLayer* WebMediaPlayerClientImpl::platformLayer() const { ASSERT(m_supportsAcceleratedCompositing); - return m_videoLayer ? m_videoLayer->layer() : 0; + return const_cast<WebVideoLayer*>(&m_videoLayer); } #endif @@ -745,7 +745,7 @@ bool WebMediaPlayerClientImpl::supportsAcceleratedRendering() const bool WebMediaPlayerClientImpl::acceleratedRenderingInUse() { - return m_videoLayer && m_videoLayer->active(); + return !m_videoLayer.isNull() && m_videoLayer.active(); } void WebMediaPlayerClientImpl::setVideoFrameProviderClient(WebVideoFrameProvider::Client* client) diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h index 329fd9ec0..373015eb7 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h @@ -205,7 +205,7 @@ private: WebCore::MediaPlayer::Preload m_preload; RefPtr<WebHelperPluginImpl> m_helperPlugin; #if USE(ACCELERATED_COMPOSITING) - OwnPtr<WebVideoLayer> m_videoLayer; + WebVideoLayer m_videoLayer; bool m_supportsAcceleratedCompositing; bool m_opaque; WebVideoFrameProvider::Client* m_videoFrameProviderClient; diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp index 75a97e0f6..a35a0407f 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -366,11 +366,11 @@ void WebPluginContainerImpl::setBackingTextureId(unsigned textureId) if (m_textureId == textureId) return; - ASSERT(!m_ioSurfaceLayer); + ASSERT(m_ioSurfaceLayer.isNull()); - if (!m_textureLayer) - m_textureLayer = adoptPtr(WebExternalTextureLayer::create()); - m_textureLayer->setTextureId(textureId); + if (m_textureLayer.isNull()) + m_textureLayer = WebExternalTextureLayer::create(); + m_textureLayer.setTextureId(textureId); // If anyone of the IDs is zero we need to switch between hardware // and software compositing. This is done by triggering a style recalc @@ -390,11 +390,11 @@ void WebPluginContainerImpl::setBackingIOSurfaceId(int width, if (ioSurfaceId == m_ioSurfaceId) return; - ASSERT(!m_textureLayer); + ASSERT(m_textureLayer.isNull()); - if (!m_ioSurfaceLayer) - m_ioSurfaceLayer = adoptPtr(WebIOSurfaceLayer::create()); - m_ioSurfaceLayer->setIOSurfaceProperties(ioSurfaceId, WebSize(width, height)); + if (m_ioSurfaceLayer.isNull()) + m_ioSurfaceLayer = WebIOSurfaceLayer::create(); + m_ioSurfaceLayer.setIOSurfaceProperties(ioSurfaceId, WebSize(width, height)); // If anyone of the IDs is zero we need to switch between hardware // and software compositing. This is done by triggering a style recalc @@ -409,11 +409,11 @@ void WebPluginContainerImpl::setBackingIOSurfaceId(int width, void WebPluginContainerImpl::commitBackingTexture() { #if USE(ACCELERATED_COMPOSITING) - if (m_textureLayer) - m_textureLayer->layer()->invalidate(); + if (!m_textureLayer.isNull()) + m_textureLayer.invalidate(); - if (m_ioSurfaceLayer) - m_ioSurfaceLayer->layer()->invalidate(); + if (!m_ioSurfaceLayer.isNull()) + m_ioSurfaceLayer.invalidate(); #endif } @@ -480,11 +480,11 @@ void WebPluginContainerImpl::zoomLevelChanged(double zoomLevel) void WebPluginContainerImpl::setOpaque(bool opaque) { #if USE(ACCELERATED_COMPOSITING) - if (m_textureLayer) - m_textureLayer->layer()->setOpaque(opaque); + if (!m_textureLayer.isNull()) + m_textureLayer.setOpaque(opaque); - if (m_ioSurfaceLayer) - m_ioSurfaceLayer->layer()->setOpaque(opaque); + if (!m_ioSurfaceLayer.isNull()) + m_ioSurfaceLayer.setOpaque(opaque); #endif } @@ -575,9 +575,9 @@ void WebPluginContainerImpl::willDestroyPluginLoadObserver(WebPluginLoadObserver WebLayer* WebPluginContainerImpl::platformLayer() const { if (m_textureId) - return m_textureLayer->layer(); + return const_cast<WebExternalTextureLayer*>(&m_textureLayer); if (m_ioSurfaceId) - return m_ioSurfaceLayer->layer(); + return const_cast<WebIOSurfaceLayer*>(&m_ioSurfaceLayer); return 0; } #endif diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.h b/Source/WebKit/chromium/src/WebPluginContainerImpl.h index 998be6e41..074a0ccdc 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.h +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.h @@ -186,10 +186,10 @@ private: // A composited plugin will either have no composited layer, a texture layer, or an IOSurface layer. // It will never have both a texture and IOSurface output. unsigned m_textureId; - OwnPtr<WebExternalTextureLayer> m_textureLayer; + WebExternalTextureLayer m_textureLayer; unsigned m_ioSurfaceId; - OwnPtr<WebIOSurfaceLayer> m_ioSurfaceLayer; + WebIOSurfaceLayer m_ioSurfaceLayer; #endif // The associated scrollbar group object, created lazily. Used for Pepper diff --git a/Source/WebKit/chromium/src/WebScrollableLayer.cpp b/Source/WebKit/chromium/src/WebScrollableLayer.cpp new file mode 100644 index 000000000..a20e81d81 --- /dev/null +++ b/Source/WebKit/chromium/src/WebScrollableLayer.cpp @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include <public/WebScrollableLayer.h> + +#include "LayerChromium.h" +#include "Region.h" + +namespace WebKit { + +void WebScrollableLayer::setScrollPosition(WebPoint position) +{ + m_private->setScrollPosition(position); +} + +void WebScrollableLayer::setScrollable(bool scrollable) +{ + m_private->setScrollable(scrollable); +} + +void WebScrollableLayer::setHaveWheelEventHandlers(bool haveWheelEventHandlers) +{ + m_private->setHaveWheelEventHandlers(haveWheelEventHandlers); +} + +void WebScrollableLayer::setShouldScrollOnMainThread(bool shouldScrollOnMainThread) +{ + m_private->setShouldScrollOnMainThread(shouldScrollOnMainThread); +} + +void WebScrollableLayer::setNonFastScrollableRegion(const WebVector<WebRect>& rects) +{ + WebCore::Region region; + for (size_t i = 0; i < rects.size(); ++i) { + WebCore::IntRect rect = rects[i]; + region.unite(rect); + } + m_private->setNonFastScrollableRegion(region); + +} + +void WebScrollableLayer::setIsContainerForFixedPositionLayers(bool enable) +{ + m_private->setIsContainerForFixedPositionLayers(enable); +} + +void WebScrollableLayer::setFixedToContainerLayer(bool enable) +{ + m_private->setFixedToContainerLayer(enable); +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp b/Source/WebKit/chromium/src/WebScrollbarLayer.cpp index ec6e9895d..2bd1b20fb 100644 --- a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebScrollbarLayer.cpp @@ -24,42 +24,39 @@ */ #include "config.h" -#include "WebScrollbarLayerImpl.h" +#include <public/WebScrollbarLayer.h> #include "ScrollbarLayerChromium.h" -#include "WebLayerImpl.h" -using WebCore::Scrollbar; -using WebCore::ScrollbarLayerChromium; +using namespace WebCore; namespace WebKit { -WebScrollbarLayer* WebScrollbarLayer::create(WebCore::Scrollbar* scrollbar, WebScrollbarThemePainter painter, PassOwnPtr<WebScrollbarThemeGeometry> geometry) +void WebScrollbarLayer::setScrollLayer(const WebLayer layer) { - return new WebScrollbarLayerImpl(ScrollbarLayerChromium::create(WebScrollbar::create(scrollbar), painter, geometry, 0)); + int id = layer.isNull() ? 0 : layer.constUnwrap<LayerChromium>()->id(); + unwrap<ScrollbarLayerChromium>()->setScrollLayerId(id); } - -WebScrollbarLayerImpl::WebScrollbarLayerImpl(PassRefPtr<WebCore::ScrollbarLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +WebScrollbarLayer WebScrollbarLayer::create(WebCore::Scrollbar* scrollbar, WebScrollbarThemePainter painter, PassOwnPtr<WebScrollbarThemeGeometry> geometry) { + return WebScrollbarLayer(ScrollbarLayerChromium::create(WebScrollbar::create(scrollbar), painter, geometry, 0)); } -WebScrollbarLayerImpl::~WebScrollbarLayerImpl() +WebScrollbarLayer::WebScrollbarLayer(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>& layer) + : WebLayer(layer) { } -WebLayer* WebScrollbarLayerImpl::layer() +WebScrollbarLayer& WebScrollbarLayer::operator=(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>& layer) { - return m_layer.get(); + m_private = layer; + return *this; } -void WebScrollbarLayerImpl::setScrollLayer(WebLayer* layer) +WebScrollbarLayer::operator PassRefPtr<ScrollbarLayerChromium>() const { - int id = layer ? static_cast<WebLayerImpl*>(layer)->layer()->id() : 0; - static_cast<ScrollbarLayerChromium*>(m_layer->layer())->setScrollLayerId(id); + return unwrap<ScrollbarLayerChromium>(); } - - } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h b/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h deleted file mode 100644 index 720f79c55..000000000 --- a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebScrollbarLayerImpl_h -#define WebScrollbarLayerImpl_h - -#include <public/WebScrollbarLayer.h> -#include <wtf/OwnPtr.h> -#include <wtf/PassRefPtr.h> - -namespace WebCore { -class ScrollbarLayerChromium; -} - -namespace WebKit { -class WebLayerImpl; - -class WebScrollbarLayerImpl : public WebScrollbarLayer { -public: - explicit WebScrollbarLayerImpl(PassRefPtr<WebCore::ScrollbarLayerChromium>); - virtual ~WebScrollbarLayerImpl(); - - // WebScrollbarLayer implementation. - virtual WebLayer* layer() OVERRIDE; - virtual void setScrollLayer(WebLayer*) OVERRIDE; - -private: - OwnPtr<WebLayerImpl> m_layer; -}; - -} - -#endif // WebScrollbarLayerImpl_h diff --git a/Source/WebKit/chromium/src/WebImageLayerImpl.cpp b/Source/WebKit/chromium/src/WebSolidColorLayer.cpp index d93af8045..83914b263 100644 --- a/Source/WebKit/chromium/src/WebImageLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebSolidColorLayer.cpp @@ -24,37 +24,26 @@ */ #include "config.h" -#include "WebImageLayerImpl.h" +#include <public/WebSolidColorLayer.h> -#include "ImageLayerChromium.h" -#include "WebLayerImpl.h" - -using WebCore::ImageLayerChromium; +#include "WebSolidColorLayerImpl.h" +#include <public/WebFloatRect.h> namespace WebKit { -WebImageLayer* WebImageLayer::create() -{ - return new WebImageLayerImpl(WebCore::ImageLayerChromium::create()); -} - -WebImageLayerImpl::WebImageLayerImpl(PassRefPtr<WebCore::ImageLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) -{ -} - -WebImageLayerImpl::~WebImageLayerImpl() +WebSolidColorLayer WebSolidColorLayer::create() { + return WebSolidColorLayer(WebSolidColorLayerImpl::create()); } -WebLayer* WebImageLayerImpl::layer() +WebSolidColorLayer::WebSolidColorLayer(const PassRefPtr<WebSolidColorLayerImpl>& node) + : WebLayer(node) { - return m_layer.get(); } -void WebImageLayerImpl::setBitmap(SkBitmap bitmap) +void WebSolidColorLayer::setBackgroundColor(const WebColor& color) { - static_cast<ImageLayerChromium*>(m_layer->layer())->setBitmap(bitmap); + m_private->setBackgroundColor(color); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp index 94404262c..33b1a30e3 100644 --- a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp @@ -26,37 +26,24 @@ #include "config.h" #include "WebSolidColorLayerImpl.h" -#include "SolidColorLayerChromium.h" -#include "WebLayerImpl.h" - -using WebCore::SolidColorLayerChromium; +using namespace WebCore; namespace WebKit { -WebSolidColorLayer* WebSolidColorLayer::create() +PassRefPtr<WebSolidColorLayerImpl> WebSolidColorLayerImpl::create() { - return new WebSolidColorLayerImpl(SolidColorLayerChromium::create()); + return adoptRef(new WebSolidColorLayerImpl()); } -WebSolidColorLayerImpl::WebSolidColorLayerImpl(PassRefPtr<SolidColorLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +WebSolidColorLayerImpl::WebSolidColorLayerImpl() + : SolidColorLayerChromium() { - m_layer->layer()->setIsDrawable(true); + setIsDrawable(true); } WebSolidColorLayerImpl::~WebSolidColorLayerImpl() { } -WebLayer* WebSolidColorLayerImpl::layer() -{ - return m_layer.get(); -} - -void WebSolidColorLayerImpl::setBackgroundColor(WebColor color) -{ - m_layer->setBackgroundColor(color); -} - } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h index 7742ba492..d2673b42b 100644 --- a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h +++ b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h @@ -26,28 +26,18 @@ #ifndef WebSolidColorLayerImpl_h #define WebSolidColorLayerImpl_h -#include <public/WebSolidColorLayer.h> -#include <wtf/OwnPtr.h> +#include "SolidColorLayerChromium.h" #include <wtf/PassRefPtr.h> -namespace WebCore { -class SolidColorLayerChromium; -} - namespace WebKit { -class WebLayerImpl; -class WebSolidColorLayerImpl : public WebSolidColorLayer { +class WebSolidColorLayerImpl : public WebCore::SolidColorLayerChromium { public: - explicit WebSolidColorLayerImpl(PassRefPtr<WebCore::SolidColorLayerChromium>); - virtual ~WebSolidColorLayerImpl(); + static PassRefPtr<WebSolidColorLayerImpl> create(); - // WebSolidColorLayer implementation. - virtual WebLayer* layer() OVERRIDE; - virtual void setBackgroundColor(WebColor) OVERRIDE; - -private: - OwnPtr<WebLayerImpl> m_layer; +protected: + WebSolidColorLayerImpl(); + virtual ~WebSolidColorLayerImpl(); }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebVideoLayerImpl.h b/Source/WebKit/chromium/src/WebVideoLayer.cpp index 287e4b5e2..0f342155d 100644 --- a/Source/WebKit/chromium/src/WebVideoLayerImpl.h +++ b/Source/WebKit/chromium/src/WebVideoLayer.cpp @@ -23,32 +23,25 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebVideoLayerImpl_h -#define WebVideoLayerImpl_h - +#include "config.h" +#include "VideoLayerChromium.h" #include <public/WebVideoLayer.h> -namespace WebCore { -class VideoLayerChromium; -} - namespace WebKit { -class WebLayerImpl; - -class WebVideoLayerImpl : public WebVideoLayer { -public: - explicit WebVideoLayerImpl(PassRefPtr<WebCore::VideoLayerChromium>); - virtual ~WebVideoLayerImpl(); - // WebVideoLayer implementation. - virtual WebLayer* layer() OVERRIDE; - virtual bool active() const OVERRIDE; - -private: - OwnPtr<WebLayerImpl> m_layer; -}; +WebVideoLayer WebVideoLayer::create(WebVideoFrameProvider* provider) +{ + return WebVideoLayer(WebCore::VideoLayerChromium::create(provider)); +} +WebVideoLayer::WebVideoLayer(PassRefPtr<WebCore::VideoLayerChromium> layer) + : WebLayer(layer) +{ } -#endif // WebVideoLayerImpl_h +bool WebVideoLayer::active() const +{ + return m_private->layerTreeHost(); +} +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index 97339b342..b18e20944 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -408,7 +408,6 @@ WebViewImpl::WebViewImpl(WebViewClient* client) , m_isCancelingFullScreen(false) , m_benchmarkSupport(this) #if USE(ACCELERATED_COMPOSITING) - , m_rootLayer(0) , m_rootGraphicsLayer(0) , m_isAcceleratedCompositingActive(false) , m_compositorCreationFailed(false) @@ -2215,6 +2214,58 @@ bool WebViewImpl::setEditableSelectionOffsets(int start, int end) return editor->setSelectionOffsets(start, end); } +bool WebViewImpl::setCompositionFromExistingText(int compositionStart, int compositionEnd, const WebVector<WebCompositionUnderline>& underlines) +{ + const Frame* focused = focusedWebCoreFrame(); + if (!focused) + return false; + + Editor* editor = focused->editor(); + if (!editor || !editor->canEdit()) + return false; + + editor->cancelComposition(); + + if (compositionStart == compositionEnd) + return true; + + size_t location; + size_t length; + caretOrSelectionRange(&location, &length); + editor->setIgnoreCompositionSelectionChange(true); + editor->setSelectionOffsets(compositionStart, compositionEnd); + String text = editor->selectedText(); + focused->document()->execCommand("delete", true); + editor->setComposition(text, CompositionUnderlineVectorBuilder(underlines), 0, 0); + editor->setSelectionOffsets(location, location + length); + editor->setIgnoreCompositionSelectionChange(false); + + return true; +} + +void WebViewImpl::extendSelectionAndDelete(int before, int after) +{ + const Frame* focused = focusedWebCoreFrame(); + if (!focused) + return; + + Editor* editor = focused->editor(); + if (!editor || !editor->canEdit()) + return; + + FrameSelection* selection = focused->selection(); + if (!selection) + return; + + size_t location; + size_t length; + RefPtr<Range> range = selection->selection().firstRange(); + if (range && TextIterator::getLocationAndLengthFromRange(selection->rootEditableElement(), range.get(), location, length)) { + editor->setSelectionOffsets(max(static_cast<int>(location) - before, 0), location + length + after); + focused->document()->execCommand("delete", true); + } +} + bool WebViewImpl::isSelectionEditable() const { const Frame* frame = focusedWebCoreFrame(); @@ -3513,7 +3564,6 @@ bool WebViewImpl::allowsAcceleratedCompositing() void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) { m_rootGraphicsLayer = layer; - m_rootLayer = layer ? layer->platformLayer() : 0; setIsAcceleratedCompositingActive(layer); if (m_nonCompositedContentHost) { @@ -3527,8 +3577,11 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) m_nonCompositedContentHost->setScrollLayer(scrollLayer); } + if (layer) + m_rootLayer = *layer->platformLayer(); + if (!m_layerTreeView.isNull()) - m_layerTreeView.setRootLayer(m_rootLayer); + m_layerTreeView.setRootLayer(layer ? &m_rootLayer : 0); IntRect damagedRect(0, 0, m_size.width, m_size.height); if (!m_isAcceleratedCompositingActive) @@ -3641,7 +3694,7 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->showDebugBorders()); m_nonCompositedContentHost->setOpaque(!isTransparent()); - m_layerTreeView.initialize(this, *m_rootLayer, layerTreeViewSettings); + m_layerTreeView.initialize(this, m_rootLayer, layerTreeViewSettings); if (!m_layerTreeView.isNull()) { if (m_webSettings->applyDefaultDeviceScaleFactorInCompositor() && page()->deviceScaleFactor() != 1) { ASSERT(page()->deviceScaleFactor()); diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index 431dad490..b8dcad717 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -162,6 +162,8 @@ public: virtual WebTextInputInfo textInputInfo(); virtual WebTextInputType textInputType(); virtual bool setEditableSelectionOffsets(int start, int end); + virtual bool setCompositionFromExistingText(int compositionStart, int compositionEnd, const WebVector<WebCompositionUnderline>& underlines); + virtual void extendSelectionAndDelete(int before, int after); virtual bool isSelectionEditable() const; virtual WebColor backgroundColor() const; virtual bool selectionBounds(WebRect& start, WebRect& end) const; @@ -814,7 +816,7 @@ private: WebCore::IntRect m_rootLayerScrollDamage; OwnPtr<NonCompositedContentHost> m_nonCompositedContentHost; WebLayerTreeView m_layerTreeView; - WebLayer* m_rootLayer; + WebLayer m_rootLayer; WebCore::GraphicsLayer* m_rootGraphicsLayer; bool m_isAcceleratedCompositingActive; bool m_compositorCreationFailed; diff --git a/Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp index 4948f97cc..a5ca55124 100644 --- a/Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp @@ -122,13 +122,13 @@ TEST(ImageLayerChromiumTest, opaqueImages) RefPtr<Image> nonOpaqueImage = TestImage::create(IntSize(100, 100), false); ASSERT_TRUE(nonOpaqueImage.get()); - ASSERT_FALSE(graphicsLayer->contentsLayer()); + ASSERT_TRUE(graphicsLayer->contentsLayer().isNull()); graphicsLayer->setContentsToImage(opaqueImage.get()); - ASSERT_TRUE(graphicsLayer->contentsLayer()->opaque()); + ASSERT_TRUE(graphicsLayer->contentsLayer().opaque()); graphicsLayer->setContentsToImage(nonOpaqueImage.get()); - ASSERT_FALSE(graphicsLayer->contentsLayer()->opaque()); + ASSERT_FALSE(graphicsLayer->contentsLayer().opaque()); } } // namespace diff --git a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp index b9025b4c8..0e6eb0eb4 100644 --- a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp @@ -803,6 +803,18 @@ TEST(LayerChromiumLayerTreeHostTest, replaceMaskAndReplicaLayer) WebKit::WebCompositor::shutdown(); } +TEST(LayerChromiumLayerTreeHostTest, destroyHostWithNonNullRootLayer) +{ + WebKit::WebCompositor::initialize(0); + RefPtr<LayerChromium> root = LayerChromium::create(); + RefPtr<LayerChromium> child = LayerChromium::create(); + root->addChild(child); + OwnPtr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create()); + layerTreeHost->setRootLayer(root); + layerTreeHost.clear(); + WebKit::WebCompositor::shutdown(); +} + class MockLayerChromium : public LayerChromium { public: bool needsDisplay() const { return m_needsDisplay; } diff --git a/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp b/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp index 052936dab..b5b50bf7d 100644 --- a/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp +++ b/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp @@ -38,6 +38,9 @@ #include <wtf/HashSet.h> #include <wtf/RefCounted.h> #include <wtf/Vector.h> +#include <wtf/text/AtomicString.h> +#include <wtf/text/StringImpl.h> +#include <wtf/text/WTFString.h> using namespace WebCore; @@ -224,5 +227,33 @@ TEST(MemoryInstrumentationTest, visitFirstMemberInNonVirtualClass) EXPECT_EQ(2, visitedObjects.size()); } +TEST(MemoryInstrumentationTest, visitStrings) +{ + { + VisitedObjects visitedObjects; + MemoryInstrumentationImpl impl(visitedObjects); + String string("string"); + impl.addRootObject(string); + EXPECT_EQ(string.impl()->sizeInBytes(), impl.reportedSizeForAllTypes()); + EXPECT_EQ(2, visitedObjects.size()); + } + { + VisitedObjects visitedObjects; + MemoryInstrumentationImpl impl(visitedObjects); + String string("string"); + impl.addRootObject(&string); + EXPECT_EQ(string.impl()->sizeInBytes() + sizeof(String), impl.reportedSizeForAllTypes()); + EXPECT_EQ(2, visitedObjects.size()); + } + { + VisitedObjects visitedObjects; + MemoryInstrumentationImpl impl(visitedObjects); + AtomicString string("string"); + impl.addRootObject(&string); + EXPECT_EQ(string.impl()->sizeInBytes() + sizeof(AtomicString), impl.reportedSizeForAllTypes()); + EXPECT_EQ(2, visitedObjects.size()); + } +} + } // namespace diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp index 8fc74988e..03c201e16 100644 --- a/Source/WebKit/chromium/tests/WebFrameTest.cpp +++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp @@ -891,7 +891,7 @@ TEST_F(WebFrameTest, FindInPageMatchRects) static const char* kFindString = "result"; static const int kFindIdentifier = 12345; - static const int kNumResults = 10; + static const int kNumResults = 16; WebFindOptions options; WebString searchText = WebString::fromUTF8(kFindString); @@ -918,8 +918,8 @@ TEST_F(WebFrameTest, FindInPageMatchRects) // Check that the find result ordering matches with our expectations. Range* result = mainFrame->activeMatchFrame()->activeMatch(); ASSERT_TRUE(result); - result->setEnd(result->endContainer(), result->endOffset() + 2); - EXPECT_EQ(result->text(), String::format("%s %d", kFindString, resultIndex)); + result->setEnd(result->endContainer(), result->endOffset() + 3); + EXPECT_EQ(result->text(), String::format("%s %02d", kFindString, resultIndex)); // Verify that the expected match rect also matches the currently active match. // Compare the enclosing rects to prevent precision issues caused by CSS transforms. @@ -950,6 +950,36 @@ TEST_F(WebFrameTest, FindInPageMatchRects) EXPECT_TRUE(webMatchRects[7].y < webMatchRects[8].y); EXPECT_TRUE(webMatchRects[8].y < webMatchRects[9].y); + // Results 11, 12, 13 and 14 should be between results 10 and 15, as they are inside the table. + EXPECT_TRUE(webMatchRects[11].y > webMatchRects[10].y); + EXPECT_TRUE(webMatchRects[12].y > webMatchRects[10].y); + EXPECT_TRUE(webMatchRects[13].y > webMatchRects[10].y); + EXPECT_TRUE(webMatchRects[14].y > webMatchRects[10].y); + EXPECT_TRUE(webMatchRects[11].y < webMatchRects[15].y); + EXPECT_TRUE(webMatchRects[12].y < webMatchRects[15].y); + EXPECT_TRUE(webMatchRects[13].y < webMatchRects[15].y); + EXPECT_TRUE(webMatchRects[14].y < webMatchRects[15].y); + + // Result 11 should be above 12, 13 and 14 as it's in the table header. + EXPECT_TRUE(webMatchRects[11].y < webMatchRects[12].y); + EXPECT_TRUE(webMatchRects[11].y < webMatchRects[13].y); + EXPECT_TRUE(webMatchRects[11].y < webMatchRects[14].y); + + // Result 11 should also be right to 12, 13 and 14 because of the colspan. + EXPECT_TRUE(webMatchRects[11].x > webMatchRects[12].x); + EXPECT_TRUE(webMatchRects[11].x > webMatchRects[13].x); + EXPECT_TRUE(webMatchRects[11].x > webMatchRects[14].x); + + // Result 12 should be left to results 11, 13 and 14 in the table layout. + EXPECT_TRUE(webMatchRects[12].x < webMatchRects[11].x); + EXPECT_TRUE(webMatchRects[12].x < webMatchRects[13].x); + EXPECT_TRUE(webMatchRects[12].x < webMatchRects[14].x); + + // Results 13, 12 and 14 should be one above the other in that order because of the rowspan + // and vertical-align: middle by default. + EXPECT_TRUE(webMatchRects[13].y < webMatchRects[12].y); + EXPECT_TRUE(webMatchRects[12].y < webMatchRects[14].y); + // Resizing should update the rects version. webView->resize(WebSize(800, 600)); webkit_support::RunAllPendingMessages(); diff --git a/Source/WebKit/chromium/tests/WebLayerTest.cpp b/Source/WebKit/chromium/tests/WebLayerTest.cpp index 9b8e58ca1..667200410 100644 --- a/Source/WebKit/chromium/tests/WebLayerTest.cpp +++ b/Source/WebKit/chromium/tests/WebLayerTest.cpp @@ -26,7 +26,6 @@ #include <public/WebLayer.h> #include "CompositorFakeWebGraphicsContext3D.h" -#include "WebLayerImpl.h" #include <public/WebCompositor.h> #include <public/WebContentLayer.h> #include <public/WebContentLayerClient.h> @@ -77,9 +76,9 @@ public: { // Initialize without threading support. WebKit::WebCompositor::initialize(0); - m_rootLayer = adoptPtr(WebLayer::create()); + m_rootLayer = WebLayer::create(); EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); - EXPECT_TRUE(m_view.initialize(&m_client, *m_rootLayer, WebLayerTreeView::Settings())); + EXPECT_TRUE(m_view.initialize(&m_client, m_rootLayer, WebLayerTreeView::Settings())); Mock::VerifyAndClearExpectations(&m_client); } @@ -88,14 +87,14 @@ public: // We may get any number of scheduleComposite calls during shutdown. EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); m_view.setRootLayer(0); - m_rootLayer.clear(); + m_rootLayer.reset(); m_view.reset(); WebKit::WebCompositor::shutdown(); } protected: MockWebLayerTreeViewClient m_client; - OwnPtr<WebLayer> m_rootLayer; + WebLayer m_rootLayer; WebLayerTreeView m_view; }; @@ -105,73 +104,73 @@ TEST_F(WebLayerTest, Client) { // Base layer. EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); - OwnPtr<WebLayer> layer = adoptPtr(WebLayer::create()); - m_rootLayer->addChild(layer.get()); + WebLayer layer = WebLayer::create(); + m_rootLayer.addChild(layer); Mock::VerifyAndClearExpectations(&m_client); WebFloatPoint point(3, 4); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); - layer->setAnchorPoint(point); + layer.setAnchorPoint(point); Mock::VerifyAndClearExpectations(&m_client); - EXPECT_EQ(point, layer->anchorPoint()); + EXPECT_EQ(point, layer.anchorPoint()); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); float anchorZ = 5; - layer->setAnchorPointZ(anchorZ); + layer.setAnchorPointZ(anchorZ); Mock::VerifyAndClearExpectations(&m_client); - EXPECT_EQ(anchorZ, layer->anchorPointZ()); + EXPECT_EQ(anchorZ, layer.anchorPointZ()); WebSize size(7, 8); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); - layer->setBounds(size); + layer.setBounds(size); Mock::VerifyAndClearExpectations(&m_client); - EXPECT_EQ(size, layer->bounds()); + EXPECT_EQ(size, layer.bounds()); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); - layer->setMasksToBounds(true); + layer.setMasksToBounds(true); Mock::VerifyAndClearExpectations(&m_client); - EXPECT_TRUE(layer->masksToBounds()); + EXPECT_TRUE(layer.masksToBounds()); EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); - OwnPtr<WebLayer> otherLayer = adoptPtr(WebLayer::create()); - m_rootLayer->addChild(otherLayer.get()); + WebLayer otherLayer = WebLayer::create(); + m_rootLayer.addChild(otherLayer); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); - layer->setMaskLayer(otherLayer.get()); + layer.setMaskLayer(otherLayer); Mock::VerifyAndClearExpectations(&m_client); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); float opacity = 0.123f; - layer->setOpacity(opacity); + layer.setOpacity(opacity); Mock::VerifyAndClearExpectations(&m_client); - EXPECT_EQ(opacity, layer->opacity()); + EXPECT_EQ(opacity, layer.opacity()); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); - layer->setOpaque(true); + layer.setOpaque(true); Mock::VerifyAndClearExpectations(&m_client); - EXPECT_TRUE(layer->opaque()); + EXPECT_TRUE(layer.opaque()); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); - layer->setPosition(point); + layer.setPosition(point); Mock::VerifyAndClearExpectations(&m_client); - EXPECT_EQ(point, layer->position()); + EXPECT_EQ(point, layer.position()); // Texture layer. EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); - OwnPtr<WebExternalTextureLayer> textureLayer = adoptPtr(WebExternalTextureLayer::create()); - m_rootLayer->addChild(textureLayer->layer()); + WebExternalTextureLayer textureLayer = WebExternalTextureLayer::create(); + m_rootLayer.addChild(textureLayer); Mock::VerifyAndClearExpectations(&m_client); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); - textureLayer->setTextureId(3); + textureLayer.setTextureId(3); Mock::VerifyAndClearExpectations(&m_client); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); - textureLayer->setFlipped(true); + textureLayer.setFlipped(true); Mock::VerifyAndClearExpectations(&m_client); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); WebFloatRect uvRect(0.1f, 0.1f, 0.9f, 0.9f); - textureLayer->setUVRect(uvRect); + textureLayer.setUVRect(uvRect); Mock::VerifyAndClearExpectations(&m_client); @@ -179,14 +178,14 @@ TEST_F(WebLayerTest, Client) MockWebContentLayerClient contentClient; EXPECT_CALL(contentClient, paintContents(_, _, _)).Times(AnyNumber()); EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); - OwnPtr<WebContentLayer> contentLayer = adoptPtr(WebContentLayer::create(&contentClient)); - m_rootLayer->addChild(contentLayer->layer()); + WebContentLayer contentLayer = WebContentLayer::create(&contentClient); + m_rootLayer.addChild(contentLayer); Mock::VerifyAndClearExpectations(&m_client); EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); - contentLayer->layer()->setDrawsContent(false); + contentLayer.setDrawsContent(false); Mock::VerifyAndClearExpectations(&m_client); - EXPECT_FALSE(contentLayer->layer()->drawsContent()); + EXPECT_FALSE(contentLayer.drawsContent()); } } diff --git a/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp b/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp index 1c1602c23..bec2c6035 100644 --- a/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp +++ b/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp @@ -60,8 +60,8 @@ public: virtual void SetUp() { initializeCompositor(); - m_rootLayer = adoptPtr(WebLayer::create()); - EXPECT_TRUE(m_view.initialize(client(), *m_rootLayer, WebLayerTreeView::Settings())); + m_rootLayer = WebLayer::create(); + EXPECT_TRUE(m_view.initialize(client(), m_rootLayer, WebLayerTreeView::Settings())); m_view.setSurfaceReady(); } @@ -70,13 +70,13 @@ public: Mock::VerifyAndClearExpectations(client()); m_view.setRootLayer(0); - m_rootLayer.clear(); + m_rootLayer.reset(); m_view.reset(); WebKit::WebCompositor::shutdown(); } protected: - OwnPtr<WebLayer> m_rootLayer; + WebLayer m_rootLayer; WebLayerTreeView m_view; }; diff --git a/Source/WebKit/chromium/tests/WebViewTest.cpp b/Source/WebKit/chromium/tests/WebViewTest.cpp index 3ca1094d0..46c96310d 100644 --- a/Source/WebKit/chromium/tests/WebViewTest.cpp +++ b/Source/WebKit/chromium/tests/WebViewTest.cpp @@ -379,4 +379,43 @@ TEST_F(WebViewTest, FormChange) webView->close(); } +TEST_F(WebViewTest, ExtendSelectionAndDelete) +{ + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html")); + WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "input_field_populated.html"); + webView->setInitialFocus(false); + webView->setEditableSelectionOffsets(10, 10); + webView->extendSelectionAndDelete(5, 8); + WebTextInputInfo info = webView->textInputInfo(); + EXPECT_EQ("01234ijklmnopqrstuvwxyz", std::string(info.value.utf8().data())); + EXPECT_EQ(5, info.selectionStart); + EXPECT_EQ(5, info.selectionEnd); + webView->extendSelectionAndDelete(10, 0); + info = webView->textInputInfo(); + EXPECT_EQ("ijklmnopqrstuvwxyz", std::string(info.value.utf8().data())); + webView->close(); +} + +TEST_F(WebViewTest, SetCompositionFromExistingText) +{ + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html")); + WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "input_field_populated.html"); + webView->setInitialFocus(false); + WebVector<WebCompositionUnderline> emptyUnderlines; + webView->setEditableSelectionOffsets(4, 10); + webView->setCompositionFromExistingText(8, 12, emptyUnderlines); + WebTextInputInfo info = webView->textInputInfo(); + EXPECT_EQ(4, info.selectionStart); + EXPECT_EQ(10, info.selectionEnd); + EXPECT_EQ(8, info.compositionStart); + EXPECT_EQ(12, info.compositionEnd); + webView->setCompositionFromExistingText(0, 0, emptyUnderlines); + info = webView->textInputInfo(); + EXPECT_EQ(4, info.selectionStart); + EXPECT_EQ(10, info.selectionEnd); + EXPECT_EQ(-1, info.compositionStart); + EXPECT_EQ(-1, info.compositionEnd); + webView->close(); +} + } diff --git a/Source/WebKit/chromium/tests/data/find_in_page.html b/Source/WebKit/chromium/tests/data/find_in_page.html index c09c9dd06..643073a16 100644 --- a/Source/WebKit/chromium/tests/data/find_in_page.html +++ b/Source/WebKit/chromium/tests/data/find_in_page.html @@ -5,9 +5,9 @@ </head> <body> This a find-in-page match rect test.</br> -result 0</br> +result 00</br> <iframe src="find_in_page_frame.html" height="300" scrolling="yes"></iframe> </br> -result 1 +result 01 </body> </html> diff --git a/Source/WebKit/chromium/tests/data/find_in_page_frame.html b/Source/WebKit/chromium/tests/data/find_in_page_frame.html index 47d29ae0f..a922a50bc 100644 --- a/Source/WebKit/chromium/tests/data/find_in_page_frame.html +++ b/Source/WebKit/chromium/tests/data/find_in_page_frame.html @@ -36,23 +36,40 @@ Foo bar. </br></br> </br></br> </br></br> -result 2 +result 02 <div class="transform"> -result 3 +result 03 </div> -result 4 +result 04 <div class="fixed"> -result 5 +result 05 </div> -result 6 +result 06 <div class="scroll"> -result 7 +result 07 Foo bar. </br></br> </br></br> </br></br> -result 8 +result 08 </div> -result 9 +result 09 +</br></br> +result 10 +<table border="1" cellpadding="10" cellspacing="10"> +<tr> + <th>Foo</th> + <th>Bar</th> + <th>result 11</th> +</tr> +<tr> + <td rowspan="2">result 12</td> + <td colspan="2">result 13</td> +</tr> +<tr> + <td colspan="2">result 14</td> +</tr> +</table> +result 15 </body> </html> diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog index d5b2ddf4e..a22e49348 100644 --- a/Source/WebKit/efl/ChangeLog +++ b/Source/WebKit/efl/ChangeLog @@ -1,3 +1,16 @@ +2012-08-21 Kihong Kwon <kihong.kwon@samsung.com> + + [EFL][GTK][BlackBerry] Fix build error in the DeviceOrientationClient + https://bugs.webkit.org/show_bug.cgi?id=94586 + + Reviewed by Kentaro Hara. + + Fix build error in the DeviceOrientationClientEfl.cpp. + It is occured because DeviceOrientation is changed to DeviceOrientationData in the WebCore. + + * WebCoreSupport/DeviceOrientationClientEfl.cpp: + (WebCore::DeviceOrientationClientEfl::lastOrientation): + 2012-08-20 Thiago Marcos P. Santos <thiago.santos@intel.com> Regression(r124945): Build is broken when touch events is disabled diff --git a/Source/WebKit/efl/WebCoreSupport/DeviceOrientationClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/DeviceOrientationClientEfl.cpp index e3af685f1..639a823c1 100644 --- a/Source/WebKit/efl/WebCoreSupport/DeviceOrientationClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/DeviceOrientationClientEfl.cpp @@ -62,7 +62,7 @@ void DeviceOrientationClientEfl::stopUpdating() notImplemented(); } -DeviceOrientation* DeviceOrientationClientEfl::lastOrientation() const +DeviceOrientationData* DeviceOrientationClientEfl::lastOrientation() const { notImplemented(); return 0; diff --git a/Source/WebKit/gtk/ChangeLog b/Source/WebKit/gtk/ChangeLog index 511a0871a..2ef791908 100644 --- a/Source/WebKit/gtk/ChangeLog +++ b/Source/WebKit/gtk/ChangeLog @@ -1,3 +1,67 @@ +2012-08-21 Joanmarie Diggs <jdiggs@igalia.com> + [Gtk] No accessible caret-moved events found in certain content + https://bugs.webkit.org/show_bug.cgi?id=72811 + + Reviewed by Chris Fleizach. + + Part of the bug is due to objects which should claim to implement AtkText + failed to do so as a result of containing a mixture of inline and block + spans. + + An updated unit test was provided. + + * tests/testatk.c: + (testWebkitAtkCaretOffsets): Added instances of objects containing a + mixture of inline and block spans and tested that they implement AtkText + and contain the right textual contents. + +2012-08-21 Kihong Kwon <kihong.kwon@samsung.com> + + [EFL][GTK][BlackBerry] Fix build error in the DeviceOrientationClient + https://bugs.webkit.org/show_bug.cgi?id=94586 + + Reviewed by Kentaro Hara. + + Fix build error in the DeviceOrientationClientGtk.cpp. + It is occured because DeviceOrientation is changed to DeviceOrientationData in the WebCore. + + * WebCoreSupport/DeviceOrientationClientGtk.cpp: + (WebKit::DeviceOrientationClientGtk::lastOrientation): + +2012-08-21 Martin Robinson <mrobinson@igalia.com> + + [GTK] Using a native window for the WebView breaks GtkOverlay + https://bugs.webkit.org/show_bug.cgi?id=90085 + + Reviewed by Alejandro G. Castro. + + Rewrite AcceleratedCompositingContext for TextureMapperGL to be more similar to + the WebKit2 LayerTreeHost and switch from rendering directly to the widget window + to a window redirected to a pixmap via XComposite. The AcceleratedCompositingContext + now handles painting the non-composited content itself and no longer relies on the + ChromeClient backing store. + + This fixes issues with using GtkOverlay WebKitWebView as well as making it possible + to run pixel tests with accelerated compositing turned on. + + * WebCoreSupport/AcceleratedCompositingContext.h: + (AcceleratedCompositingContext): + * WebCoreSupport/AcceleratedCompositingContextGL.cpp: + Rename some methods to make them more similar to LayerTreeHost. Now we wait to render + the OpenGL context to the window until the widget's draw signal. Escape out of all + methods early if accelerated compositing is disabled. + * WebCoreSupport/ChromeClientGtk.cpp: Always check if accelerated compositing is on + before calling into AcceleratedCompositingContext methods. When AC is on, never paint + the backing store, deferring immediately to the AcceleratedCompositingContext. When + AC is turned on the backing store now shrinks to a small size to save memory. + * webkit/webkitwebview.cpp: + (resizeWebViewFromAllocation): ChromeClient is now responsible for talking to the + AcceleratedCompositingContext directly. + (webkit_web_view_size_allocate): Exit early if the allocation is not a resize. This + makes some deeper logic a bit simpler and avoids accidentally doing too much work for + widget movement. + (webkit_web_view_realize): We no longer need a native window. + 2012-08-15 Joanmarie Diggs <jdiggs@igalia.com> [Gtk] atk_text_set_caret_offset() fails for table cells diff --git a/Source/WebKit/gtk/GNUmakefile.am b/Source/WebKit/gtk/GNUmakefile.am index 215576e51..00473f9d5 100644 --- a/Source/WebKit/gtk/GNUmakefile.am +++ b/Source/WebKit/gtk/GNUmakefile.am @@ -101,6 +101,7 @@ libwebkitgtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBA $(PNG_LIBS) \ $(SQLITE3_LIBS) \ $(UNICODE_LIBS) \ + $(XCOMPOSITE_LIBS) \ $(XRENDER_LIBS) \ $(XT_LIBS) \ $(WINMM_LIBS) \ diff --git a/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h b/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h index 24a614db4..45ef470b6 100644 --- a/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h +++ b/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h @@ -28,10 +28,12 @@ #include <wtf/PassOwnPtr.h> #if USE(TEXTURE_MAPPER) +#include "TextureMapperLayer.h" +#endif + #if USE(TEXTURE_MAPPER_GL) #include "GLContext.h" -#endif -#include "TextureMapperLayer.h" +#include "RedirectedXCompositeWindow.h" #endif #if USE(ACCELERATED_COMPOSITING) @@ -47,11 +49,9 @@ public: } virtual ~AcceleratedCompositingContext(); - void attachRootGraphicsLayer(WebCore::GraphicsLayer*); - void scheduleRootLayerRepaint(const WebCore::IntRect&); - void markForSync(); - void syncLayersTimeout(); - void syncLayersNow(); + void setRootCompositingLayer(WebCore::GraphicsLayer*); + void setNonCompositedContentsNeedDisplay(const WebCore::IntRect&); + void scheduleLayerFlush(); void resizeRootLayer(const WebCore::IntSize&); bool renderLayersToWindow(cairo_t*, const WebCore::IntRect& clipRect); bool enabled(); @@ -63,21 +63,37 @@ public: virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const; virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const; + void initialize(); + void compositeLayersToContext(); + void flushAndRenderLayers(); + bool flushPendingLayerChanges(); + void scrollNonCompositedContents(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset); + private: WebKitWebView* m_webView; - unsigned int m_syncTimerCallbackId; + unsigned int m_layerFlushTimerCallbackId; #if USE(CLUTTER) WebCore::GraphicsLayer* m_rootGraphicsLayer; GtkWidget* m_rootLayerEmbedder; +#elif USE(TEXTURE_MAPPER_GL) + OwnPtr<WebCore::RedirectedXCompositeWindow> m_redirectedWindow; + OwnPtr<WebCore::GraphicsLayer> m_rootLayer; + OwnPtr<WebCore::GraphicsLayer> m_nonCompositedContentLayer; + OwnPtr<WebCore::TextureMapper> m_textureMapper; + double m_lastFlushTime; + double m_redrawPendingTime; + bool m_needsExtraFlush; + + void layerFlushTimerFired(); + void stopAnyPendingLayerFlush(); + static gboolean layerFlushTimerFiredCallback(AcceleratedCompositingContext*); + WebCore::GLContext* prepareForRendering(); + void clearEverywhere(); #elif USE(TEXTURE_MAPPER) WebCore::TextureMapperLayer* m_rootTextureMapperLayer; OwnPtr<WebCore::GraphicsLayer> m_rootGraphicsLayer; OwnPtr<WebCore::TextureMapper> m_textureMapper; -#if USE(TEXTURE_MAPPER_GL) - WebCore::GLContext* glContext(); - OwnPtr<WebCore::GLContext> m_context; -#endif #endif AcceleratedCompositingContext(WebKitWebView*); diff --git a/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp b/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp index 64eb90175..29ba349d8 100644 --- a/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp @@ -27,6 +27,7 @@ #include "Frame.h" #include "FrameView.h" #include "PlatformContextCairo.h" +#include "Settings.h" #include "TextureMapperGL.h" #include "TextureMapperLayer.h" #include "webkitwebviewprivate.h" @@ -35,13 +36,12 @@ #include <gdk/gdk.h> #include <gtk/gtk.h> -#if defined(GDK_WINDOWING_X11) -#define Region XRegion -#define Font XFont -#define Cursor XCursor -#define Screen XScreen -#include <gdk/gdkx.h> -#endif +const double gFramesPerSecond = 60; + +// There seems to be a delicate balance between the main loop being flooded +// with motion events (that force flushes) and starving the main loop of events +// with flush callbacks. This delay is entirely empirical. +const double gScheduleDelay = (1.0 / (gFramesPerSecond / 3.0)); using namespace WebCore; @@ -49,150 +49,322 @@ namespace WebKit { AcceleratedCompositingContext::AcceleratedCompositingContext(WebKitWebView* webView) : m_webView(webView) - , m_syncTimerCallbackId(0) - , m_rootTextureMapperLayer(0) + , m_layerFlushTimerCallbackId(0) + , m_redirectedWindow(RedirectedXCompositeWindow::create(IntSize(1, 1))) + , m_lastFlushTime(0) + , m_redrawPendingTime(0) + , m_needsExtraFlush(false) +{ +} + +static IntSize getWebViewSize(WebKitWebView* webView) { + GtkAllocation allocation; + gtk_widget_get_allocation(GTK_WIDGET(webView), &allocation); + return IntSize(allocation.width, allocation.height); +} + +void AcceleratedCompositingContext::initialize() +{ + if (m_rootLayer) + return; + + m_rootLayer = GraphicsLayer::create(this); + m_rootLayer->setDrawsContent(false); + + IntSize pageSize = getWebViewSize(m_webView); + m_rootLayer->setSize(pageSize); + + // The non-composited contents are a child of the root layer. + m_nonCompositedContentLayer = GraphicsLayer::create(this); + m_nonCompositedContentLayer->setDrawsContent(true); + m_nonCompositedContentLayer->setContentsOpaque(!m_webView->priv->transparent); + m_nonCompositedContentLayer->setSize(pageSize); + if (core(m_webView)->settings()->acceleratedDrawingEnabled()) + m_nonCompositedContentLayer->setAcceleratesDrawing(true); + +#ifndef NDEBUG + m_rootLayer->setName("Root layer"); + m_nonCompositedContentLayer->setName("Non-composited content"); +#endif + + m_rootLayer->addChild(m_nonCompositedContentLayer.get()); + m_nonCompositedContentLayer->setNeedsDisplay(); + + // The creation of the TextureMapper needs an active OpenGL context. + GLContext* context = m_redirectedWindow->context(); + context->makeContextCurrent(); + m_textureMapper = TextureMapperGL::create(); + + toTextureMapperLayer(m_rootLayer.get())->setTextureMapper(m_textureMapper.get()); + + scheduleLayerFlush(); } AcceleratedCompositingContext::~AcceleratedCompositingContext() { - if (m_syncTimerCallbackId) - g_source_remove(m_syncTimerCallbackId); + stopAnyPendingLayerFlush(); +} + +void AcceleratedCompositingContext::stopAnyPendingLayerFlush() +{ + if (!m_layerFlushTimerCallbackId) + return; + g_source_remove(m_layerFlushTimerCallbackId); + m_layerFlushTimerCallbackId = 0; } bool AcceleratedCompositingContext::enabled() { - return m_rootTextureMapperLayer && m_textureMapper; + return m_rootLayer && m_textureMapper; } -GLContext* AcceleratedCompositingContext::glContext() +bool AcceleratedCompositingContext::renderLayersToWindow(cairo_t* cr, const IntRect& clipRect) { - if (m_context) - return m_context.get(); + m_redrawPendingTime = 0; -#if defined(GDK_WINDOWING_X11) - // FIXME: Gracefully account for situations where we do not have a realized window. - GdkWindow* gdkWindow = gtk_widget_get_window(GTK_WIDGET(m_webView)); - if (gdkWindow && gdk_window_has_native(gdkWindow)) - m_context = GLContext::createContextForWindow(GDK_WINDOW_XID(gdkWindow), GLContext::sharingContext()); -#endif + if (!enabled()) + return false; + + // It's important to paint a white background (if the WebView isn't transparent), because when growing + // the redirected window, the usable size of the window may be smaller than the allocation of our widget. + // We don't want to show artifacts in that case. + IntSize usableWindowSize = m_redirectedWindow->usableSize(); + if (usableWindowSize != m_redirectedWindow->size()) { + if (!m_webView->priv->transparent) { + cairo_set_source_rgb(cr, 1, 1, 1); + cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); + } else + cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR); + cairo_paint(cr); + } - return m_context.get(); + cairo_surface_t* windowSurface = m_redirectedWindow->cairoSurfaceForWidget(GTK_WIDGET(m_webView)); + if (!windowSurface) + return true; + + cairo_rectangle(cr, clipRect.x(), clipRect.y(), clipRect.width(), clipRect.height()); + cairo_set_source_surface(cr, windowSurface, 0, 0); + cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); + cairo_fill(cr); + + if (!m_layerFlushTimerCallbackId && toTextureMapperLayer(m_rootLayer.get())->descendantsOrSelfHaveRunningAnimations() || m_needsExtraFlush) { + m_needsExtraFlush = false; + double nextFlush = max((1 / gFramesPerSecond) - (currentTime() - m_lastFlushTime), 0.0); + m_layerFlushTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, 1000 * nextFlush, reinterpret_cast<GSourceFunc>(layerFlushTimerFiredCallback), this, 0); + } + + return true; } -bool AcceleratedCompositingContext::renderLayersToWindow(cairo_t*, const IntRect& clipRect) +GLContext* AcceleratedCompositingContext::prepareForRendering() { if (!enabled()) - return false; + return 0; - GLContext* context = glContext(); + GLContext* context = m_redirectedWindow->context(); if (!context) - return false; + return 0; if (!context->makeContextCurrent()) - return false; + return 0; - GtkAllocation allocation; - gtk_widget_get_allocation(GTK_WIDGET(m_webView), &allocation); - glViewport(0, 0, allocation.width, allocation.height); + return context; +} + +void AcceleratedCompositingContext::compositeLayersToContext() +{ + GLContext* context = prepareForRendering(); + if (!context) + return; + + const IntSize& windowSize = m_redirectedWindow->size(); + glViewport(0, 0, windowSize.width(), windowSize.height()); m_textureMapper->beginPainting(); - m_rootTextureMapperLayer->paint(); + toTextureMapperLayer(m_rootLayer.get())->paint(); m_textureMapper->endPainting(); context->swapBuffers(); - return true; + + // FIXME: It seems that when using double-buffering (and on some drivers single-buffering) + // and XComposite window redirection, two swap buffers are required to force the pixmap + // to update. This isn't a problem during animations, because swapBuffer is continuously + // called. For non-animation situations we use this terrible hack until we can get to the + // bottom of the issue. + if (!toTextureMapperLayer(m_rootLayer.get())->descendantsOrSelfHaveRunningAnimations()) { + context->swapBuffers(); + context->swapBuffers(); + } } -void AcceleratedCompositingContext::attachRootGraphicsLayer(GraphicsLayer* graphicsLayer) +void AcceleratedCompositingContext::clearEverywhere() { - if (!graphicsLayer) { - m_rootGraphicsLayer.clear(); - m_rootTextureMapperLayer = 0; - m_context.clear(); + GLContext* context = prepareForRendering(); + if (!context) return; + + const IntSize& windowSize = m_redirectedWindow->size(); + glViewport(0, 0, windowSize.width(), windowSize.height()); + glClearColor(1, 1, 1, 1); + glClear(GL_COLOR_BUFFER_BIT); + + context->swapBuffers(); + + // FIXME: It seems that when using double-buffering (and on some drivers single-buffering) + // and XComposite window redirection, two swap buffers are required to force the pixmap + // to update. This isn't a problem during animations, because swapBuffer is continuously + // called. For non-animation situations we use this terrible hack until we can get to the + // bottom of the issue. + if (!toTextureMapperLayer(m_rootLayer.get())->descendantsOrSelfHaveRunningAnimations()) { + context->swapBuffers(); + context->swapBuffers(); } +} - m_rootGraphicsLayer = GraphicsLayer::create(this); - m_rootTextureMapperLayer = toTextureMapperLayer(m_rootGraphicsLayer.get()); - m_rootGraphicsLayer->addChild(graphicsLayer); - m_rootGraphicsLayer->setDrawsContent(true); - m_rootGraphicsLayer->setMasksToBounds(false); - m_rootGraphicsLayer->setNeedsDisplay(); - m_rootGraphicsLayer->setSize(core(m_webView)->mainFrame()->view()->frameRect().size()); +void AcceleratedCompositingContext::setRootCompositingLayer(GraphicsLayer* graphicsLayer) +{ + // Clearing everywhere when turning on or off the layer tree prevents us from flashing + // old content before the first flush. + clearEverywhere(); - GLContext* context = glContext(); - if (!context) - return; + if (!graphicsLayer) { + stopAnyPendingLayerFlush(); - // The context needs to be active when creating the texture mapper. It's fine to - // avoid calling swapBuffers here, because it will just initialize shaders. - if (!context->makeContextCurrent()) + // Shrink the offscreen window to save memory while accelerated compositing is turned off. + m_redirectedWindow->resize(IntSize(1, 1)); + m_rootLayer = nullptr; + m_nonCompositedContentLayer = nullptr; + m_textureMapper = nullptr; return; + } - GtkAllocation allocation; - gtk_widget_get_allocation(GTK_WIDGET(m_webView), &allocation); - glViewport(0, 0, allocation.width, allocation.height); + if (graphicsLayer && !enabled()) + m_redirectedWindow->resize(getWebViewSize(m_webView)); - m_textureMapper = TextureMapperGL::create(); - m_rootTextureMapperLayer->setTextureMapper(m_textureMapper.get()); - m_rootGraphicsLayer->syncCompositingStateForThisLayerOnly(); + // Add the accelerated layer tree hierarchy. + initialize(); + m_nonCompositedContentLayer->removeAllChildren(); + m_nonCompositedContentLayer->addChild(graphicsLayer); + + stopAnyPendingLayerFlush(); + + // FIXME: Two flushes seem necessary to get the proper rendering in some cases. It's unclear + // if this is a bug with the RedirectedXComposite window or with this class. + m_needsExtraFlush = true; + scheduleLayerFlush(); + + m_layerFlushTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, 500, reinterpret_cast<GSourceFunc>(layerFlushTimerFiredCallback), this, 0); } -void AcceleratedCompositingContext::scheduleRootLayerRepaint(const IntRect& rect) +void AcceleratedCompositingContext::setNonCompositedContentsNeedDisplay(const IntRect& rect) { - if (!m_rootGraphicsLayer) + if (!m_rootLayer) return; if (rect.isEmpty()) { - m_rootGraphicsLayer->setNeedsDisplay(); + m_rootLayer->setNeedsDisplay(); return; } - m_rootGraphicsLayer->setNeedsDisplayInRect(rect); + m_nonCompositedContentLayer->setNeedsDisplayInRect(rect); + scheduleLayerFlush(); } -void AcceleratedCompositingContext::resizeRootLayer(const IntSize& size) +void AcceleratedCompositingContext::resizeRootLayer(const IntSize& newSize) { - if (!m_rootGraphicsLayer) + if (!enabled()) return; - m_rootGraphicsLayer->setSize(size); - m_rootGraphicsLayer->syncCompositingStateForThisLayerOnly(); + + if (m_rootLayer->size() == newSize) + return; + + m_redirectedWindow->resize(newSize); + m_rootLayer->setSize(newSize); + + // If the newSize exposes new areas of the non-composited content a setNeedsDisplay is needed + // for those newly exposed areas. + FloatSize oldSize = m_nonCompositedContentLayer->size(); + m_nonCompositedContentLayer->setSize(newSize); + + if (newSize.width() > oldSize.width()) { + float height = std::min(static_cast<float>(newSize.height()), oldSize.height()); + m_nonCompositedContentLayer->setNeedsDisplayInRect(FloatRect(oldSize.width(), 0, newSize.width() - oldSize.width(), height)); + } + + if (newSize.height() > oldSize.height()) + m_nonCompositedContentLayer->setNeedsDisplayInRect(FloatRect(0, oldSize.height(), newSize.width(), newSize.height() - oldSize.height())); + + m_nonCompositedContentLayer->setNeedsDisplayInRect(IntRect(IntPoint(), newSize)); + flushAndRenderLayers(); +} + +void AcceleratedCompositingContext::scrollNonCompositedContents(const IntRect& scrollRect, const IntSize& scrollOffset) +{ + m_nonCompositedContentLayer->setNeedsDisplayInRect(scrollRect); + scheduleLayerFlush(); } -static gboolean syncLayersTimeoutCallback(AcceleratedCompositingContext* context) +gboolean AcceleratedCompositingContext::layerFlushTimerFiredCallback(AcceleratedCompositingContext* context) { - context->syncLayersTimeout(); + context->layerFlushTimerFired(); return FALSE; } -void AcceleratedCompositingContext::markForSync() +void AcceleratedCompositingContext::scheduleLayerFlush() { - if (m_syncTimerCallbackId) + if (!enabled()) return; - // We use a GLib timer because otherwise GTK+ event handling during - // dragging can starve WebCore timers, which have a lower priority. - m_syncTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, 0, reinterpret_cast<GSourceFunc>(syncLayersTimeoutCallback), this, 0); + if (m_layerFlushTimerCallbackId) + return; + + // We use a GLib timer because otherwise GTK+ event handling during dragging can + // starve WebCore timers, which have a lower priority. + double nextFlush = max(gScheduleDelay - (currentTime() - m_lastFlushTime), 0.0); + m_layerFlushTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, nextFlush * 1000, reinterpret_cast<GSourceFunc>(layerFlushTimerFiredCallback), this, 0); } -void AcceleratedCompositingContext::syncLayersNow() +bool AcceleratedCompositingContext::flushPendingLayerChanges() { - if (m_rootGraphicsLayer) - m_rootGraphicsLayer->syncCompositingStateForThisLayerOnly(); - - core(m_webView)->mainFrame()->view()->syncCompositingStateIncludingSubframes(); + m_rootLayer->syncCompositingStateForThisLayerOnly(); + m_nonCompositedContentLayer->syncCompositingStateForThisLayerOnly(); + return core(m_webView)->mainFrame()->view()->syncCompositingStateIncludingSubframes(); } -void AcceleratedCompositingContext::syncLayersTimeout() +void AcceleratedCompositingContext::flushAndRenderLayers() { - m_syncTimerCallbackId = 0; - syncLayersNow(); - if (!m_rootGraphicsLayer) + if (!enabled()) + return; + + Frame* frame = core(m_webView)->mainFrame(); + if (!frame || !frame->contentRenderer() || !frame->view()) return; + frame->view()->updateLayoutAndStyleIfNeededRecursive(); - if (toTextureMapperLayer(m_rootGraphicsLayer.get())->descendantsOrSelfHaveRunningAnimations()) - m_syncTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, 1000.0 / 60.0, reinterpret_cast<GSourceFunc>(syncLayersTimeoutCallback), this, 0); + GLContext* context = m_redirectedWindow->context(); + if (context && !context->makeContextCurrent()) + return; + + if (!flushPendingLayerChanges()) + return; - renderLayersToWindow(0, IntRect()); + m_lastFlushTime = currentTime(); + compositeLayersToContext(); + + gtk_widget_queue_draw(GTK_WIDGET(m_webView)); + + // If it's been a long time since we've actually painted, which means that events might + // be starving the main loop, we should force a draw now. This seems to prevent display + // lag on http://2012.beercamp.com. + if (m_redrawPendingTime && currentTime() - m_redrawPendingTime > gScheduleDelay) + gdk_window_process_updates(gtk_widget_get_window(GTK_WIDGET(m_webView)), FALSE); + else if (!m_redrawPendingTime) + m_redrawPendingTime = currentTime(); +} + +void AcceleratedCompositingContext::layerFlushTimerFired() +{ + m_layerFlushTimerCallbackId = 0; + flushAndRenderLayers(); } void AcceleratedCompositingContext::notifyAnimationStarted(const GraphicsLayer*, double time) @@ -206,9 +378,10 @@ void AcceleratedCompositingContext::notifySyncRequired(const GraphicsLayer*) void AcceleratedCompositingContext::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& rectToPaint) { - cairo_t* cr = context.platformContext()->cr(); - copyRectFromCairoSurfaceToContext(m_webView->priv->backingStore->cairoSurface(), cr, - IntSize(), rectToPaint); + context.save(); + context.clip(rectToPaint); + core(m_webView)->mainFrame()->view()->paint(&context, rectToPaint); + context.restore(); } bool AcceleratedCompositingContext::showDebugBorders(const GraphicsLayer*) const diff --git a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp index 41c840924..740e3bbca 100644 --- a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp @@ -142,17 +142,18 @@ void ChromeClient::setWindowRect(const FloatRect& rect) } } -FloatRect ChromeClient::pageRect() +static IntRect getWebViewRect(WebKitWebView* webView) { GtkAllocation allocation; -#if GTK_CHECK_VERSION(2, 18, 0) - gtk_widget_get_allocation(GTK_WIDGET(m_webView), &allocation); -#else - allocation = GTK_WIDGET(m_webView)->allocation; -#endif + gtk_widget_get_allocation(GTK_WIDGET(webView), &allocation); return IntRect(allocation.x, allocation.y, allocation.width, allocation.height); } +FloatRect ChromeClient::pageRect() +{ + return getWebViewRect(m_webView); +} + void ChromeClient::focus() { gtk_widget_grab_focus(GTK_WIDGET(m_webView)); @@ -419,10 +420,20 @@ static void clearEverywhereInBackingStore(WebKitWebView* webView, cairo_t* cr) void ChromeClient::widgetSizeChanged(const IntSize& oldWidgetSize, IntSize newSize) { - WidgetBackingStore* backingStore = m_webView->priv->backingStore.get(); +#if USE(ACCELERATED_COMPOSITING) + AcceleratedCompositingContext* compositingContext = m_webView->priv->acceleratedCompositingContext.get(); + if (compositingContext->enabled()) { + m_webView->priv->acceleratedCompositingContext->resizeRootLayer(newSize); + return; + } +#endif // Grow the backing store by at least 1.5 times the current size. This prevents // lots of unnecessary allocations during an opaque resize. + WidgetBackingStore* backingStore = m_webView->priv->backingStore.get(); + if (backingStore && oldWidgetSize == newSize) + return; + if (backingStore) { const IntSize& oldSize = backingStore->size(); if (newSize.width() > oldSize.width()) @@ -526,20 +537,6 @@ static void paintWebView(WebKitWebView* webView, Frame* frame, Region dirtyRegio gc.restore(); } -void ChromeClient::invalidateWidgetRect(const IntRect& rect) -{ -#if USE(ACCELERATED_COMPOSITING) - AcceleratedCompositingContext* acContext = m_webView->priv->acceleratedCompositingContext.get(); - if (acContext->enabled()) { - acContext->scheduleRootLayerRepaint(rect); - return; - } -#endif - gtk_widget_queue_draw_area(GTK_WIDGET(m_webView), - rect.x(), rect.y(), - rect.width(), rect.height()); -} - void ChromeClient::performAllPendingScrolls() { if (!m_webView->priv->backingStore) @@ -549,7 +546,7 @@ void ChromeClient::performAllPendingScrolls() for (size_t i = 0; i < m_rectsToScroll.size(); i++) { IntRect& scrollRect = m_rectsToScroll[i]; m_webView->priv->backingStore->scroll(scrollRect, m_scrollOffsets[i]); - invalidateWidgetRect(scrollRect); + gtk_widget_queue_draw_area(GTK_WIDGET(m_webView), scrollRect.x(), scrollRect.y(), scrollRect.width(), scrollRect.height()); } m_rectsToScroll.clear(); @@ -585,12 +582,7 @@ void ChromeClient::paint(WebCore::Timer<ChromeClient>*) } const IntRect& rect = m_dirtyRegion.bounds(); - invalidateWidgetRect(rect); - -#if USE(ACCELERATED_COMPOSITING) - m_webView->priv->acceleratedCompositingContext->syncLayersNow(); - m_webView->priv->acceleratedCompositingContext->renderLayersToWindow(0, rect); -#endif + gtk_widget_queue_draw_area(GTK_WIDGET(m_webView), rect.x(), rect.y(), rect.width(), rect.height()); m_dirtyRegion = Region(); m_lastDisplayTime = currentTime(); @@ -606,6 +598,11 @@ void ChromeClient::paint(WebCore::Timer<ChromeClient>*) void ChromeClient::forcePaint() { +#if USE(ACCELERATED_COMPOSITING) + if (m_webView->priv->acceleratedCompositingContext->enabled()) + return; +#endif + m_forcePaint = true; paint(0); m_forcePaint = false; @@ -617,6 +614,14 @@ void ChromeClient::invalidateRootView(const IntRect&, bool immediate) void ChromeClient::invalidateContentsAndRootView(const IntRect& updateRect, bool immediate) { +#if USE(ACCELERATED_COMPOSITING) + AcceleratedCompositingContext* acContext = m_webView->priv->acceleratedCompositingContext.get(); + if (acContext->enabled()) { + acContext->setNonCompositedContentsNeedDisplay(updateRect); + return; + } +#endif + if (updateRect.isEmpty()) return; m_dirtyRegion.unite(updateRect); @@ -625,12 +630,34 @@ void ChromeClient::invalidateContentsAndRootView(const IntRect& updateRect, bool void ChromeClient::invalidateContentsForSlowScroll(const IntRect& updateRect, bool immediate) { - invalidateContentsAndRootView(updateRect, immediate); m_adjustmentWatcher.updateAdjustmentsFromScrollbarsLater(); + +#if USE(ACCELERATED_COMPOSITING) + AcceleratedCompositingContext* acContext = m_webView->priv->acceleratedCompositingContext.get(); + if (acContext->enabled()) { + acContext->setNonCompositedContentsNeedDisplay(updateRect); + return; + } +#endif + + invalidateContentsAndRootView(updateRect, immediate); } void ChromeClient::scroll(const IntSize& delta, const IntRect& rectToScroll, const IntRect& clipRect) { + m_adjustmentWatcher.updateAdjustmentsFromScrollbarsLater(); + +#if USE(ACCELERATED_COMPOSITING) + AcceleratedCompositingContext* compositingContext = m_webView->priv->acceleratedCompositingContext.get(); + if (compositingContext->enabled()) { + ASSERT(!rectToScroll.isEmpty()); + ASSERT(!delta.isEmpty()); + + compositingContext->scrollNonCompositedContents(rectToScroll, delta); + return; + } +#endif + m_rectsToScroll.append(rectToScroll); m_scrollOffsets.append(delta); @@ -657,8 +684,6 @@ void ChromeClient::scroll(const IntSize& delta, const IntRect& rectToScroll, con m_dirtyRegion.unite(scrollRepaintRegion); m_displayTimer.startOneShot(0); - - m_adjustmentWatcher.updateAdjustmentsFromScrollbarsLater(); } IntRect ChromeClient::rootViewToScreen(const IntRect& rect) const @@ -966,17 +991,32 @@ void ChromeClient::exitFullScreenForElement(WebCore::Element*) #if USE(ACCELERATED_COMPOSITING) void ChromeClient::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* rootLayer) { - m_webView->priv->acceleratedCompositingContext->attachRootGraphicsLayer(rootLayer); + AcceleratedCompositingContext* context = m_webView->priv->acceleratedCompositingContext.get(); + bool turningOffCompositing = !rootLayer && context->enabled(); + bool turningOnCompositing = rootLayer && !context->enabled(); + + context->setRootCompositingLayer(rootLayer); + + if (turningOnCompositing) { + m_displayTimer.stop(); + m_webView->priv->backingStore = WebCore::WidgetBackingStore::create(GTK_WIDGET(m_webView), IntSize(1, 1)); + } + + if (turningOffCompositing) { + m_webView->priv->backingStore = WebCore::WidgetBackingStore::create(GTK_WIDGET(m_webView), getWebViewRect(m_webView).size()); + RefPtr<cairo_t> cr = adoptRef(cairo_create(m_webView->priv->backingStore->cairoSurface())); + clearEverywhereInBackingStore(m_webView, cr.get()); + } } void ChromeClient::setNeedsOneShotDrawingSynchronization() { - m_webView->priv->acceleratedCompositingContext->markForSync(); + m_webView->priv->acceleratedCompositingContext->scheduleLayerFlush(); } void ChromeClient::scheduleCompositingLayerSync() { - m_webView->priv->acceleratedCompositingContext->markForSync(); + m_webView->priv->acceleratedCompositingContext->scheduleLayerFlush(); } ChromeClient::CompositingTriggerFlags ChromeClient::allowedCompositingTriggers() const diff --git a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h index e5e2fa1eb..284bdaa36 100644 --- a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h +++ b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h @@ -179,7 +179,6 @@ namespace WebKit { double m_lastDisplayTime; unsigned int m_repaintSoonSourceId; - void invalidateWidgetRect(const IntRect&); #if ENABLE(FULLSCREEN_API) RefPtr<Element> m_fullScreenElement; #endif diff --git a/Source/WebKit/gtk/WebCoreSupport/DeviceOrientationClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/DeviceOrientationClientGtk.cpp index 6e000d2d4..36d303b27 100644 --- a/Source/WebKit/gtk/WebCoreSupport/DeviceOrientationClientGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/DeviceOrientationClientGtk.cpp @@ -58,7 +58,7 @@ void DeviceOrientationClientGtk::stopUpdating() notImplemented(); } -DeviceOrientation* DeviceOrientationClientGtk::lastOrientation() const +WebCore::DeviceOrientationData* DeviceOrientationClientGtk::lastOrientation() const { notImplemented(); return 0; diff --git a/Source/WebKit/gtk/tests/testatk.c b/Source/WebKit/gtk/tests/testatk.c index 2463c74a5..759da1771 100644 --- a/Source/WebKit/gtk/tests/testatk.c +++ b/Source/WebKit/gtk/tests/testatk.c @@ -65,7 +65,7 @@ static const char* linksWithInlineImages = "<html><head><style>a.http:before {co static const char* listsOfItems = "<html><body><ul><li>text only</li><li><a href='foo'>link only</a></li><li>text and a <a href='bar'>link</a></li></ul><ol><li>text only</li><li><a href='foo'>link only</a></li><li>text and a <a href='bar'>link</a></li></ol></body></html>"; -static const char* textForCaretBrowsing = "<html><body><h1>A text header</h1><p>A paragraph <a href='http://foo.bar.baz/'>with a link</a> in the middle</p><ol><li>A list item</li></ol><select><option selected value='foo'>An option in a combo box</option></select><input type='text'' name='foo'' value='foo bar baz' /><table><tr><td>a table cell</td></tr></table></body></html>"; +static const char* textForCaretBrowsing = "<html><body><h1>A text header</h1><p>A paragraph <a href='http://foo.bar.baz/'>with a link</a> in the middle</p><ol><li>A list item</li><li><span style='display:block;'>Block span in a list item</span><span>Inline span in a list item</span></li><li><a href='foo'><span style='display:block;'>Block span in a link in a list item</span><span>Inline span in a link in a list item</span></a></li></ol><select><option selected value='foo'>An option in a combo box</option></select><input type='text' name='foo' value='foo bar baz' /><table><tr><td>a table cell</td><td></td><td><a href='foo'><span style='display:block;'>Block span in a link in a table cell</span><span>Inline span in a link in a table cell</span></a></td><td><span style='display:block;'>Block span in a table cell</span><span>Inline span in a table cell</span></td></tr></table><h4><a href='foo'><span style='display:block;'>Block span in a link in a heading</span><span>Inline span in a link in a heading</span></h4><h4><span style='display:block;'>Block span in a heading</span><span>Inline span in a heading</span></h4></body></html>"; static const char* textForSelections = "<html><body><p>A paragraph with plain text</p><p>A paragraph with <a href='http://webkit.org'>a link</a> in the middle</p><ol><li>A list item</li></ol><select></body></html>"; @@ -336,7 +336,7 @@ static void testWebkitAtkCaretOffsets() AtkObject* list = atk_object_ref_accessible_child(object, 2); g_assert(ATK_OBJECT(list)); g_assert(atk_object_get_role(list) == ATK_ROLE_LIST); - g_assert_cmpint(atk_object_get_n_accessible_children(list), ==, 1); + g_assert_cmpint(atk_object_get_n_accessible_children(list), ==, 3); AtkObject* listItem = atk_object_ref_accessible_child(list, 0); g_assert(ATK_IS_TEXT(listItem)); @@ -344,6 +344,18 @@ static void testWebkitAtkCaretOffsets() g_assert_cmpstr(text, ==, "1. A list item"); g_free (text); + listItem = atk_object_ref_accessible_child(list, 1); + g_assert(ATK_IS_TEXT(listItem)); + text = atk_text_get_text(ATK_TEXT(listItem), 0, -1); + g_assert_cmpstr(text, ==, "2. Block span in a list item\nInline span in a list item"); + g_free (text); + + listItem = atk_object_ref_accessible_child(list, 2); + g_assert(ATK_IS_TEXT(listItem)); + text = atk_text_get_text(ATK_TEXT(listItem), 0, -1); + g_assert_cmpstr(text, ==, "3. Block span in a link in a list item\nInline span in a link in a list item"); + g_free (text); + /* It's not possible to place the caret inside an item's marker. */ result = atk_text_set_caret_offset(ATK_TEXT(listItem), 1); g_assert_cmpint(result, ==, FALSE); @@ -360,10 +372,12 @@ static void testWebkitAtkCaretOffsets() AtkObject* comboBox = atk_object_ref_accessible_child(panel, 0); g_assert(ATK_IS_OBJECT(comboBox)); + g_assert(!ATK_IS_TEXT(comboBox)); g_assert(atk_object_get_role(comboBox) == ATK_ROLE_COMBO_BOX); AtkObject* menuPopup = atk_object_ref_accessible_child(comboBox, 0); g_assert(ATK_IS_OBJECT(menuPopup)); + g_assert(!ATK_IS_TEXT(menuPopup)); g_assert(atk_object_get_role(menuPopup) == ATK_ROLE_MENU); AtkObject* comboBoxOption = atk_object_ref_accessible_child(menuPopup, 0); @@ -372,6 +386,7 @@ static void testWebkitAtkCaretOffsets() g_assert(ATK_IS_TEXT(comboBoxOption)); text = atk_text_get_text(ATK_TEXT(comboBoxOption), 0, -1); g_assert_cmpstr(text, ==, "An option in a combo box"); + g_free(text); /* It's not possible to place the caret inside an option for a combobox. */ result = atk_text_set_caret_offset(ATK_TEXT(comboBoxOption), 1); @@ -383,6 +398,7 @@ static void testWebkitAtkCaretOffsets() g_assert(ATK_IS_TEXT(textEntry)); text = atk_text_get_text(ATK_TEXT(textEntry), 0, -1); g_assert_cmpstr(text, ==, "foo bar baz"); + g_free(text); result = atk_text_set_caret_offset(ATK_TEXT(textEntry), 5); g_assert_cmpint(result, ==, TRUE); @@ -391,8 +407,9 @@ static void testWebkitAtkCaretOffsets() AtkObject* table = atk_object_ref_accessible_child(object, 4); g_assert(ATK_IS_OBJECT(table)); + g_assert(!ATK_IS_TEXT(table)); g_assert(atk_object_get_role(table) == ATK_ROLE_TABLE); - g_assert_cmpint(atk_object_get_n_accessible_children(table), ==, 1); + g_assert_cmpint(atk_object_get_n_accessible_children(table), ==, 4); AtkObject* tableCell = atk_object_ref_accessible_child(table, 0); g_assert(ATK_IS_TEXT(tableCell)); @@ -406,6 +423,42 @@ static void testWebkitAtkCaretOffsets() offset = atk_text_get_caret_offset(ATK_TEXT(tableCell)); g_assert_cmpint(offset, ==, 2); + /* Even empty table cells should implement AtkText, but report an empty string */ + tableCell = atk_object_ref_accessible_child(table, 1); + g_assert(ATK_IS_TEXT(tableCell)); + g_assert(atk_object_get_role(tableCell) == ATK_ROLE_TABLE_CELL); + text = atk_text_get_text(ATK_TEXT(tableCell), 0, -1); + g_assert_cmpstr(text, ==, ""); + g_free(text); + + tableCell = atk_object_ref_accessible_child(table, 2); + g_assert(ATK_IS_TEXT(tableCell)); + g_assert(atk_object_get_role(tableCell) == ATK_ROLE_TABLE_CELL); + text = atk_text_get_text(ATK_TEXT(tableCell), 0, -1); + g_assert_cmpstr(text, ==, "Block span in a link in a table cell\nInline span in a link in a table cell"); + g_free(text); + + tableCell = atk_object_ref_accessible_child(table, 3); + g_assert(ATK_IS_TEXT(tableCell)); + g_assert(atk_object_get_role(tableCell) == ATK_ROLE_TABLE_CELL); + text = atk_text_get_text(ATK_TEXT(tableCell), 0, -1); + g_assert_cmpstr(text, ==, "Block span in a table cell\nInline span in a table cell"); + g_free(text); + + header = atk_object_ref_accessible_child(object, 5); + g_assert(ATK_IS_TEXT(header)); + g_assert(atk_object_get_role(header) == ATK_ROLE_HEADING); + text = atk_text_get_text(ATK_TEXT(header), 0, -1); + g_assert_cmpstr(text, ==, "Block span in a link in a heading\nInline span in a link in a heading"); + g_free(text); + + header = atk_object_ref_accessible_child(object, 6); + g_assert(ATK_IS_TEXT(header)); + g_assert(atk_object_get_role(header) == ATK_ROLE_HEADING); + text = atk_text_get_text(ATK_TEXT(header), 0, -1); + g_assert_cmpstr(text, ==, "Block span in a heading\nInline span in a heading"); + g_free(text); + g_free(textCaretMovedResult); g_object_unref(header); diff --git a/Source/WebKit/gtk/webkit/webkitwebview.cpp b/Source/WebKit/gtk/webkit/webkitwebview.cpp index 971780637..a5368944d 100644 --- a/Source/WebKit/gtk/webkit/webkitwebview.cpp +++ b/Source/WebKit/gtk/webkit/webkitwebview.cpp @@ -679,8 +679,10 @@ static gboolean webkit_web_view_draw(GtkWidget* widget, cairo_t* cr) WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW(widget)->priv; #if USE(TEXTURE_MAPPER) - if (priv->acceleratedCompositingContext->renderLayersToWindow(cr, clipRect)) + if (priv->acceleratedCompositingContext->renderLayersToWindow(cr, clipRect)) { + GTK_WIDGET_CLASS(webkit_web_view_parent_class)->draw(widget, cr); return FALSE; + } #endif cairo_rectangle_list_t* rectList = cairo_copy_clip_rectangle_list(cr); @@ -875,15 +877,16 @@ static void resizeWebViewFromAllocation(WebKitWebView* webView, GtkAllocation* a WebKit::ChromeClient* chromeClient = static_cast<WebKit::ChromeClient*>(page->chrome()->client()); chromeClient->widgetSizeChanged(oldSize, IntSize(allocation->width, allocation->height)); chromeClient->adjustmentWatcher()->updateAdjustmentsFromScrollbars(); - -#if USE(ACCELERATED_COMPOSITING) - webView->priv->acceleratedCompositingContext->resizeRootLayer(IntSize(allocation->width, allocation->height)); -#endif } static void webkit_web_view_size_allocate(GtkWidget* widget, GtkAllocation* allocation) { + GtkAllocation oldAllocation; + gtk_widget_get_allocation(widget, &oldAllocation); + GTK_WIDGET_CLASS(webkit_web_view_parent_class)->size_allocate(widget, allocation); + if (allocation->width == oldAllocation.width && allocation->height == oldAllocation.height) + return; WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); if (!gtk_widget_get_mapped(widget)) { @@ -1003,10 +1006,6 @@ static void webkit_web_view_realize(GtkWidget* widget) #endif GdkWindow* window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask); -#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) - WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW(widget)->priv; - priv->hasNativeWindow = gdk_window_ensure_native(window); -#endif gtk_widget_set_window(widget, window); gdk_window_set_user_data(window, widget); diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index 48445e27d..2b5ceb307 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,16 @@ +2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r126146. + http://trac.webkit.org/changeset/126146 + https://bugs.webkit.org/show_bug.cgi?id=94606 + + It made all tests assert (Requested by Ossy on #webkit). + + * tests/qobjectbridge/tst_qobjectbridge.cpp: + (tst_QObjectBridge::objectDeleted): + (tst_QObjectBridge::introspectQtMethods_data): + (tst_QObjectBridge::introspectQtMethods): + 2012-08-17 Simon Hausmann <simon.hausmann@nokia.com> [Qt] REGRESSION(r125428): fast/profiler/nested-start-and-stop-profiler.html fails diff --git a/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp b/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp index 13d98af93..2ce791d89 100644 --- a/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp +++ b/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp @@ -1879,7 +1879,7 @@ void tst_QObjectBridge::objectDeleted() evalJS("bar.intProperty = 123;"); QCOMPARE(qobj->intProperty(), 123); qobj->resetQtFunctionInvoked(); - evalJS("bar.myInvokable.call(bar);"); + evalJS("bar.myInvokable(bar);"); QCOMPARE(qobj->qtFunctionInvoked(), 0); // do this, to ensure that we cache that it implements call @@ -2148,15 +2148,15 @@ void tst_QObjectBridge::introspectQtMethods_data() QTest::addColumn<QStringList>("expectedPropertyNames"); QTest::newRow("myObject.mySignal") - << "myObject" << "mySignal" << (QStringList() << "connect" << "disconnect" << "name"); + << "myObject" << "mySignal" << (QStringList() << "connect" << "disconnect" << "length" << "name"); QTest::newRow("myObject.mySlot") - << "myObject" << "mySlot" << (QStringList() << "connect" << "disconnect" << "name"); + << "myObject" << "mySlot" << (QStringList() << "connect" << "disconnect" << "length" << "name"); QTest::newRow("myObject.myInvokable") - << "myObject" << "myInvokable" << (QStringList() << "connect" << "disconnect" << "name"); + << "myObject" << "myInvokable" << (QStringList() << "connect" << "disconnect" << "length" << "name"); QTest::newRow("myObject.mySignal.connect") - << "myObject.mySignal" << "connect" << (QStringList() << "name"); + << "myObject.mySignal" << "connect" << (QStringList() << "length" << "name"); QTest::newRow("myObject.mySignal.disconnect") - << "myObject.mySignal" << "disconnect" << (QStringList() << "name"); + << "myObject.mySignal" << "disconnect" << (QStringList() << "length" << "name"); } void tst_QObjectBridge::introspectQtMethods() @@ -2177,7 +2177,7 @@ void tst_QObjectBridge::introspectQtMethods() QCOMPARE(evalJS("descriptor.set"), sUndefined); QCOMPARE(evalJS(QString::fromLatin1("descriptor.value === %0['%1']").arg(methodLookup).arg(name)), sTrue); QCOMPARE(evalJS(QString::fromLatin1("descriptor.enumerable")), sFalse); - QCOMPARE(evalJS(QString::fromLatin1("descriptor.configurable")), sFalse); + QCOMPARE(evalJS(QString::fromLatin1("descriptor.configurable")), sTrue); } QVERIFY(evalJSV("var props=[]; for (var p in myObject.deleteLater) {props.push(p);}; props.sort()").toStringList().isEmpty()); |