Commit ae434975 authored by tonikitoo@webkit.org's avatar tonikitoo@webkit.org

[BlackBerry] Clean up BackingStoreClient (part II)

https://bugs.webkit.org/show_bug.cgi?id=99327

Reviewed by Yong Li.
Patch by Antonio Gomes <agomes@rim.com>

Remove more unneeded BackingStoreClient <-> WebPageClient integration
methods:
- BackingStoreClient* backingStoreClientForFrame(...)
- void addBackingStoreClientForFrame(...)
- void removeBackingStoreClientForFrame(...)

Change places calling WPPriv::backingStoreClientForFrame to directly
access WPPriv::backingStoreClient instead, since only the main frame will
have a BackingStoreClient instance associated with it, and it is owned by
the WKPriv.

Remove non-mainframe only references to BackingStoreClient completely,
since it is dead code now.

* Api/InRegionScroller.cpp:
(BlackBerry::WebKit::InRegionScrollerPrivate::setLayerScrollPosition):
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::backingStoreClient):
(BlackBerry::WebKit::WebPage::destroy):
* Api/WebPage_p.h:
(WebPagePrivate):
* WebCoreSupport/ChromeClientBlackBerry.cpp:
(WebCore::ChromeClientBlackBerry::invalidateContentsForSlowScroll):
(WebCore::ChromeClientBlackBerry::scroll):
* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::transitionToCommittedForNewPage):
(WebCore::FrameLoaderClientBlackBerry::createFrame):
(WebCore::FrameLoaderClientBlackBerry::detachedFromParent2):
* WebKitSupport/BackingStoreClient.cpp:
(BlackBerry::WebKit::BackingStoreClient::create):
(BlackBerry::WebKit::BackingStoreClient::BackingStoreClient):
(BlackBerry::WebKit::BackingStoreClient::~BackingStoreClient):
* WebKitSupport/BackingStoreClient.h:
(BackingStoreClient):
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::setBatchEditingActive):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131314 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4a8b3d82
...@@ -299,20 +299,8 @@ bool InRegionScrollerPrivate::setLayerScrollPosition(RenderLayer* layer, const I ...@@ -299,20 +299,8 @@ bool InRegionScrollerPrivate::setLayerScrollPosition(RenderLayer* layer, const I
ASSERT(canScrollInnerFrame(frame)); ASSERT(canScrollInnerFrame(frame));
view->setCanBlitOnScroll(false); view->setCanBlitOnScroll(false);
BackingStoreClient* backingStoreClient = m_webPage->backingStoreClientForFrame(view->frame());
if (backingStoreClient) {
backingStoreClient->setIsClientGeneratedScroll(true);
backingStoreClient->setIsScrollNotificationSuppressed(true);
}
view->setScrollPosition(scrollPosition); view->setScrollPosition(scrollPosition);
if (backingStoreClient) {
backingStoreClient->setIsClientGeneratedScroll(false);
backingStoreClient->setIsScrollNotificationSuppressed(false);
}
} else { } else {
// RenderBox-based elements case (scrollable boxes (div's, p's, textarea's, etc)). // RenderBox-based elements case (scrollable boxes (div's, p's, textarea's, etc)).
......
...@@ -2479,30 +2479,11 @@ IntSize WebPagePrivate::fixedLayoutSize(bool snapToIncrement) const ...@@ -2479,30 +2479,11 @@ IntSize WebPagePrivate::fixedLayoutSize(bool snapToIncrement) const
return IntSize(defaultLayoutWidth, defaultLayoutHeight); return IntSize(defaultLayoutWidth, defaultLayoutHeight);
} }
BackingStoreClient* WebPagePrivate::backingStoreClientForFrame(const Frame* frame) const BackingStoreClient* WebPagePrivate::backingStoreClient() const
{ {
ASSERT(frame); return m_backingStoreClient;
BackingStoreClient* backingStoreClient = 0;
if (m_backingStoreClientForFrameMap.contains(frame))
backingStoreClient = m_backingStoreClientForFrameMap.get(frame);
return backingStoreClient;
}
void WebPagePrivate::addBackingStoreClientForFrame(const Frame* frame, BackingStoreClient* client)
{
ASSERT(frame);
ASSERT(client);
m_backingStoreClientForFrameMap.add(frame, client);
} }
void WebPagePrivate::removeBackingStoreClientForFrame(const Frame* frame)
{
ASSERT(frame);
if (m_backingStoreClientForFrameMap.contains(frame))
m_backingStoreClientForFrameMap.remove(frame);
}
void WebPagePrivate::clearDocumentData(const Document* documentGoingAway) void WebPagePrivate::clearDocumentData(const Document* documentGoingAway)
{ {
ASSERT(documentGoingAway); ASSERT(documentGoingAway);
...@@ -3125,15 +3106,6 @@ void WebPage::destroy() ...@@ -3125,15 +3106,6 @@ void WebPage::destroy()
FrameLoader* loader = d->m_mainFrame->loader(); FrameLoader* loader = d->m_mainFrame->loader();
// Remove main frame's backing store client from the map
// to prevent FrameLoaderClientBlackyBerry::detachFromParent2(),
// which is called by loader->detachFromParent(), deleting it.
// We will delete it in ~WebPagePrivate().
// Reason: loader->detachFromParent() may ping back to backing store
// indirectly through ChromeClientBlackBerry::invalidateContentsAndWindow().
// see RIM PR #93256.
d->removeBackingStoreClientForFrame(d->m_mainFrame);
// Set m_mainFrame to 0 to avoid calls back in to the backingstore during webpage deletion. // Set m_mainFrame to 0 to avoid calls back in to the backingstore during webpage deletion.
d->m_mainFrame = 0; d->m_mainFrame = 0;
if (loader) if (loader)
......
...@@ -432,9 +432,7 @@ public: ...@@ -432,9 +432,7 @@ public:
bool dispatchTouchPointAsMouseEventToFullScreenPlugin(WebCore::PluginView*, const Platform::TouchPoint&); bool dispatchTouchPointAsMouseEventToFullScreenPlugin(WebCore::PluginView*, const Platform::TouchPoint&);
bool dispatchMouseEventToFullScreenPlugin(WebCore::PluginView*, const Platform::MouseEvent&); bool dispatchMouseEventToFullScreenPlugin(WebCore::PluginView*, const Platform::MouseEvent&);
BackingStoreClient* backingStoreClientForFrame(const WebCore::Frame*) const; BackingStoreClient* backingStoreClient() const;
void addBackingStoreClientForFrame(const WebCore::Frame*, BackingStoreClient*);
void removeBackingStoreClientForFrame(const WebCore::Frame*);
void setParentPopup(WebCore::PagePopupBlackBerry* webPopup); void setParentPopup(WebCore::PagePopupBlackBerry* webPopup);
......
2012-10-15 Antonio Gomes <agomes@rim.com>
[BlackBerry] Clean up BackingStoreClient (part II)
https://bugs.webkit.org/show_bug.cgi?id=99327
Reviewed by Yong Li.
Remove more unneeded BackingStoreClient <-> WebPageClient integration
methods:
- BackingStoreClient* backingStoreClientForFrame(...)
- void addBackingStoreClientForFrame(...)
- void removeBackingStoreClientForFrame(...)
Change places calling WPPriv::backingStoreClientForFrame to directly
access WPPriv::backingStoreClient instead, since only the main frame will
have a BackingStoreClient instance associated with it, and it is owned by
the WKPriv.
Remove non-mainframe only references to BackingStoreClient completely,
since it is dead code now.
* Api/InRegionScroller.cpp:
(BlackBerry::WebKit::InRegionScrollerPrivate::setLayerScrollPosition):
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::backingStoreClient):
(BlackBerry::WebKit::WebPage::destroy):
* Api/WebPage_p.h:
(WebPagePrivate):
* WebCoreSupport/ChromeClientBlackBerry.cpp:
(WebCore::ChromeClientBlackBerry::invalidateContentsForSlowScroll):
(WebCore::ChromeClientBlackBerry::scroll):
* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::transitionToCommittedForNewPage):
(WebCore::FrameLoaderClientBlackBerry::createFrame):
(WebCore::FrameLoaderClientBlackBerry::detachedFromParent2):
* WebKitSupport/BackingStoreClient.cpp:
(BlackBerry::WebKit::BackingStoreClient::create):
(BlackBerry::WebKit::BackingStoreClient::BackingStoreClient):
(BlackBerry::WebKit::BackingStoreClient::~BackingStoreClient):
* WebKitSupport/BackingStoreClient.h:
(BackingStoreClient):
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::setBatchEditingActive):
2012-10-15 Antonio Gomes <agomes@rim.com> 2012-10-15 Antonio Gomes <agomes@rim.com>
[BlackBerry] Clean up BackingStoreClient (part I) [BlackBerry] Clean up BackingStoreClient (part I)
......
...@@ -585,9 +585,9 @@ void ChromeClientBlackBerry::invalidateContentsForSlowScroll(const IntSize& delt ...@@ -585,9 +585,9 @@ void ChromeClientBlackBerry::invalidateContentsForSlowScroll(const IntSize& delt
if (scrollView != m_webPagePrivate->m_mainFrame->view()) if (scrollView != m_webPagePrivate->m_mainFrame->view())
invalidateContentsAndRootView(updateRect, true /*immediate*/); invalidateContentsAndRootView(updateRect, true /*immediate*/);
else { else {
BackingStoreClient* backingStoreClientForFrame = m_webPagePrivate->backingStoreClientForFrame(m_webPagePrivate->m_mainFrame); BackingStoreClient* backingStoreClient = m_webPagePrivate->backingStoreClient();
ASSERT(backingStoreClientForFrame); ASSERT(backingStoreClient);
backingStoreClientForFrame->checkOriginOfCurrentScrollOperation(); backingStoreClient->checkOriginOfCurrentScrollOperation();
m_webPagePrivate->m_backingStore->d->slowScroll(delta, updateRect, immediate); m_webPagePrivate->m_backingStore->d->slowScroll(delta, updateRect, immediate);
} }
...@@ -601,9 +601,9 @@ void ChromeClientBlackBerry::scroll(const IntSize& delta, const IntRect& scrollV ...@@ -601,9 +601,9 @@ void ChromeClientBlackBerry::scroll(const IntSize& delta, const IntRect& scrollV
if (!m_webPagePrivate->m_mainFrame->view()) if (!m_webPagePrivate->m_mainFrame->view())
return; return;
BackingStoreClient* backingStoreClientForFrame = m_webPagePrivate->backingStoreClientForFrame(m_webPagePrivate->m_mainFrame); BackingStoreClient* backingStoreClient = m_webPagePrivate->backingStoreClient();
ASSERT(backingStoreClientForFrame); ASSERT(backingStoreClient);
backingStoreClientForFrame->checkOriginOfCurrentScrollOperation(); backingStoreClient->checkOriginOfCurrentScrollOperation();
m_webPagePrivate->m_backingStore->d->scroll(delta, scrollViewRect, clipRect); m_webPagePrivate->m_backingStore->d->scroll(delta, scrollViewRect, clipRect);
} }
......
...@@ -435,9 +435,8 @@ void FrameLoaderClientBlackBerry::transitionToCommittedForNewPage() ...@@ -435,9 +435,8 @@ void FrameLoaderClientBlackBerry::transitionToCommittedForNewPage()
// in the backing store from another thread (see BackingStorePrivate::blitVisibleContents method), // in the backing store from another thread (see BackingStorePrivate::blitVisibleContents method),
// so we suspend and resume screen update to make sure we do not get a invalid FrameView // so we suspend and resume screen update to make sure we do not get a invalid FrameView
// state. // state.
BackingStoreClient* backingStoreClientForFrame = m_webPagePrivate->backingStoreClientForFrame(m_frame); if (isMainFrame() && m_webPagePrivate->backingStoreClient())
if (backingStoreClientForFrame) m_webPagePrivate->backingStoreClient()->backingStore()->d->suspendScreenAndBackingStoreUpdates();
backingStoreClientForFrame->backingStore()->d->suspendScreenAndBackingStoreUpdates();
// We are navigating away from this document, so clean up any footprint we might have. // We are navigating away from this document, so clean up any footprint we might have.
if (m_frame->document()) if (m_frame->document())
...@@ -456,8 +455,9 @@ void FrameLoaderClientBlackBerry::transitionToCommittedForNewPage() ...@@ -456,8 +455,9 @@ void FrameLoaderClientBlackBerry::transitionToCommittedForNewPage()
ScrollbarAlwaysOff, /* ver mode */ ScrollbarAlwaysOff, /* ver mode */
true); /* lock the mode */ true); /* lock the mode */
if (backingStoreClientForFrame) if (isMainFrame() && m_webPagePrivate->backingStoreClient())
backingStoreClientForFrame->backingStore()->d->resumeScreenAndBackingStoreUpdates(BackingStore::None); m_webPagePrivate->backingStoreClient()->backingStore()->d->resumeScreenAndBackingStoreUpdates(BackingStore::None);
m_frame->view()->updateCanHaveScrollbars(); m_frame->view()->updateCanHaveScrollbars();
if (isMainFrame()) { if (isMainFrame()) {
...@@ -787,8 +787,6 @@ PassRefPtr<Frame> FrameLoaderClientBlackBerry::createFrame(const KURL& url, cons ...@@ -787,8 +787,6 @@ PassRefPtr<Frame> FrameLoaderClientBlackBerry::createFrame(const KURL& url, cons
if (!childFrame->tree()->parent()) if (!childFrame->tree()->parent())
return 0; return 0;
BackingStoreClient::create(childFrame.get(), m_frame, m_webPagePrivate->m_webPage);
m_frame->loader()->loadURLIntoChildFrame(url, referrer, childFrame.get()); m_frame->loader()->loadURLIntoChildFrame(url, referrer, childFrame.get());
if (!childFrame->tree()->parent()) if (!childFrame->tree()->parent())
...@@ -956,12 +954,6 @@ Frame* FrameLoaderClientBlackBerry::dispatchCreatePage(const NavigationAction& n ...@@ -956,12 +954,6 @@ Frame* FrameLoaderClientBlackBerry::dispatchCreatePage(const NavigationAction& n
void FrameLoaderClientBlackBerry::detachedFromParent2() void FrameLoaderClientBlackBerry::detachedFromParent2()
{ {
BackingStoreClient* backingStoreClientForFrame = m_webPagePrivate->backingStoreClientForFrame(m_frame);
if (backingStoreClientForFrame) {
delete backingStoreClientForFrame;
backingStoreClientForFrame = 0;
}
if (m_frame->document()) if (m_frame->document())
m_webPagePrivate->clearDocumentData(m_frame->document()); m_webPagePrivate->clearDocumentData(m_frame->document());
......
...@@ -51,77 +51,28 @@ static inline IntSize pointToSize(const IntPoint& point) ...@@ -51,77 +51,28 @@ static inline IntSize pointToSize(const IntPoint& point)
BackingStoreClient* BackingStoreClient::create(Frame* frame, Frame* parentFrame, WebPage* parentPage) BackingStoreClient* BackingStoreClient::create(Frame* frame, Frame* parentFrame, WebPage* parentPage)
{ {
ASSERT(parentPage); ASSERT(!parentFrame);
ASSERT(frame->view()); BackingStoreClient* it = new BackingStoreClient(frame, parentPage);
// FIXME: We do not support inner frames for now.
if (parentFrame)
return 0;
BackingStoreClient* parentBackingStoreClient
= parentFrame
? parentPage->d->backingStoreClientForFrame(parentFrame)
: 0;
// If this frame has a parent with no backingstore then just stop since
// our frame heirarchy is done.
if (parentFrame && !parentBackingStoreClient)
return 0;
BackingStoreClient* it = new BackingStoreClient(frame, parentFrame, parentPage);
ASSERT(it);
// Frame -> BackingStoreClient mapping is controlled by the Page.
parentPage->d->addBackingStoreClientForFrame(frame, it);
// Add the backing store client to the child list of its parent.
if (parentBackingStoreClient)
parentBackingStoreClient->addChild(it);
return it; return it;
} }
BackingStoreClient::BackingStoreClient(Frame* frame, Frame* parentFrame, WebPage* parentPage) BackingStoreClient::BackingStoreClient(Frame* frame, WebPage* parentPage)
: m_frame(frame) : m_frame(frame)
, m_webPage(parentPage) , m_webPage(parentPage)
, m_backingStore(0) , m_backingStore(0)
, m_parent(0)
, m_isClientGeneratedScroll(false) , m_isClientGeneratedScroll(false)
, m_isScrollNotificationSuppressed(false) , m_isScrollNotificationSuppressed(false)
{ {
UNUSED_PARAM(parentFrame);
m_backingStore = new BackingStore(m_webPage, this); m_backingStore = new BackingStore(m_webPage, this);
} }
BackingStoreClient::~BackingStoreClient() BackingStoreClient::~BackingStoreClient()
{ {
m_webPage->d->removeBackingStoreClientForFrame(m_frame);
delete m_backingStore; delete m_backingStore;
m_backingStore = 0; m_backingStore = 0;
m_frame = 0; m_frame = 0;
} }
void BackingStoreClient::addChild(BackingStoreClient* child)
{
ASSERT(child);
child->m_parent = this;
}
WTF::Vector <BackingStoreClient*> BackingStoreClient::children() const
{
WTF::Vector<BackingStoreClient*> children;
for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) {
BlackBerry::WebKit::BackingStoreClient* client =
m_webPage->d->backingStoreClientForFrame(child);
if (client)
children.append(client);
}
return children;
}
IntRect BackingStoreClient::absoluteRect() const IntRect BackingStoreClient::absoluteRect() const
{ {
IntRect rect = IntRect(IntPoint::zero(), viewportSize()); IntRect rect = IntRect(IntPoint::zero(), viewportSize());
......
...@@ -45,10 +45,6 @@ public: ...@@ -45,10 +45,6 @@ public:
WebCore::Frame* frame() const { return m_frame; } WebCore::Frame* frame() const { return m_frame; }
bool isMainFrame() const { return m_frame == m_webPage->d->m_mainFrame; } bool isMainFrame() const { return m_frame == m_webPage->d->m_mainFrame; }
void addChild(BackingStoreClient* child);
WTF::Vector <BackingStoreClient*> children() const;
BackingStoreClient* parent() const { return m_parent; }
WebCore::IntPoint absoluteLocation() const; WebCore::IntPoint absoluteLocation() const;
WebCore::IntPoint transformedAbsoluteLocation() const; WebCore::IntPoint transformedAbsoluteLocation() const;
WebCore::IntRect absoluteRect() const; WebCore::IntRect absoluteRect() const;
...@@ -104,12 +100,11 @@ public: ...@@ -104,12 +100,11 @@ public:
void checkOriginOfCurrentScrollOperation(); void checkOriginOfCurrentScrollOperation();
private: private:
BackingStoreClient(WebCore::Frame*, WebCore::Frame* parentFrame, WebPage* parentPage); BackingStoreClient(WebCore::Frame*, WebPage* parentPage);
WebCore::Frame* m_frame; WebCore::Frame* m_frame;
WebPage* m_webPage; WebPage* m_webPage;
BackingStore* m_backingStore; BackingStore* m_backingStore;
BackingStoreClient* m_parent;
bool m_isClientGeneratedScroll; bool m_isClientGeneratedScroll;
bool m_isScrollNotificationSuppressed; bool m_isScrollNotificationSuppressed;
}; };
......
...@@ -1745,14 +1745,14 @@ bool InputHandler::setBatchEditingActive(bool active) ...@@ -1745,14 +1745,14 @@ bool InputHandler::setBatchEditingActive(bool active)
// FIXME switch this to m_currentFocusElement->document()->frame() when we have separate // FIXME switch this to m_currentFocusElement->document()->frame() when we have separate
// backingstore for each frame. // backingstore for each frame.
BackingStoreClient* backingStoreClientForFrame = m_webPage->backingStoreClientForFrame(m_webPage->mainFrame()); BackingStoreClient* backingStoreClient = m_webPage->backingStoreClient();
ASSERT(backingStoreClientForFrame); ASSERT(backingStoreClient);
// Enable / Disable the backingstore to prevent visual updates. // Enable / Disable the backingstore to prevent visual updates.
if (!active) if (!active)
backingStoreClientForFrame->backingStore()->resumeScreenAndBackingStoreUpdates(BackingStore::RenderAndBlit); backingStoreClient->backingStore()->resumeScreenAndBackingStoreUpdates(BackingStore::RenderAndBlit);
else else
backingStoreClientForFrame->backingStore()->suspendScreenAndBackingStoreUpdates(); backingStoreClient->backingStore()->suspendScreenAndBackingStoreUpdates();
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment