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
ASSERT(canScrollInnerFrame(frame));
view->setCanBlitOnScroll(false);
BackingStoreClient* backingStoreClient = m_webPage->backingStoreClientForFrame(view->frame());
if (backingStoreClient) {
backingStoreClient->setIsClientGeneratedScroll(true);
backingStoreClient->setIsScrollNotificationSuppressed(true);
}
view->setScrollPosition(scrollPosition);
if (backingStoreClient) {
backingStoreClient->setIsClientGeneratedScroll(false);
backingStoreClient->setIsScrollNotificationSuppressed(false);
}
} else {
// RenderBox-based elements case (scrollable boxes (div's, p's, textarea's, etc)).
......
......@@ -2479,30 +2479,11 @@ IntSize WebPagePrivate::fixedLayoutSize(bool snapToIncrement) const
return IntSize(defaultLayoutWidth, defaultLayoutHeight);
}
BackingStoreClient* WebPagePrivate::backingStoreClientForFrame(const Frame* frame) const
BackingStoreClient* WebPagePrivate::backingStoreClient() const
{
ASSERT(frame);
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);
return m_backingStoreClient;
}
void WebPagePrivate::removeBackingStoreClientForFrame(const Frame* frame)
{
ASSERT(frame);
if (m_backingStoreClientForFrameMap.contains(frame))
m_backingStoreClientForFrameMap.remove(frame);
}
void WebPagePrivate::clearDocumentData(const Document* documentGoingAway)
{
ASSERT(documentGoingAway);
......@@ -3125,15 +3106,6 @@ void WebPage::destroy()
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.
d->m_mainFrame = 0;
if (loader)
......
......@@ -432,9 +432,7 @@ public:
bool dispatchTouchPointAsMouseEventToFullScreenPlugin(WebCore::PluginView*, const Platform::TouchPoint&);
bool dispatchMouseEventToFullScreenPlugin(WebCore::PluginView*, const Platform::MouseEvent&);
BackingStoreClient* backingStoreClientForFrame(const WebCore::Frame*) const;
void addBackingStoreClientForFrame(const WebCore::Frame*, BackingStoreClient*);
void removeBackingStoreClientForFrame(const WebCore::Frame*);
BackingStoreClient* backingStoreClient() const;
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>
[BlackBerry] Clean up BackingStoreClient (part I)
......
......@@ -585,9 +585,9 @@ void ChromeClientBlackBerry::invalidateContentsForSlowScroll(const IntSize& delt
if (scrollView != m_webPagePrivate->m_mainFrame->view())
invalidateContentsAndRootView(updateRect, true /*immediate*/);
else {
BackingStoreClient* backingStoreClientForFrame = m_webPagePrivate->backingStoreClientForFrame(m_webPagePrivate->m_mainFrame);
ASSERT(backingStoreClientForFrame);
backingStoreClientForFrame->checkOriginOfCurrentScrollOperation();
BackingStoreClient* backingStoreClient = m_webPagePrivate->backingStoreClient();
ASSERT(backingStoreClient);
backingStoreClient->checkOriginOfCurrentScrollOperation();
m_webPagePrivate->m_backingStore->d->slowScroll(delta, updateRect, immediate);
}
......@@ -601,9 +601,9 @@ void ChromeClientBlackBerry::scroll(const IntSize& delta, const IntRect& scrollV
if (!m_webPagePrivate->m_mainFrame->view())
return;
BackingStoreClient* backingStoreClientForFrame = m_webPagePrivate->backingStoreClientForFrame(m_webPagePrivate->m_mainFrame);
ASSERT(backingStoreClientForFrame);
backingStoreClientForFrame->checkOriginOfCurrentScrollOperation();
BackingStoreClient* backingStoreClient = m_webPagePrivate->backingStoreClient();
ASSERT(backingStoreClient);
backingStoreClient->checkOriginOfCurrentScrollOperation();
m_webPagePrivate->m_backingStore->d->scroll(delta, scrollViewRect, clipRect);
}
......
......@@ -435,9 +435,8 @@ void FrameLoaderClientBlackBerry::transitionToCommittedForNewPage()
// 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
// state.
BackingStoreClient* backingStoreClientForFrame = m_webPagePrivate->backingStoreClientForFrame(m_frame);
if (backingStoreClientForFrame)
backingStoreClientForFrame->backingStore()->d->suspendScreenAndBackingStoreUpdates();
if (isMainFrame() && m_webPagePrivate->backingStoreClient())
m_webPagePrivate->backingStoreClient()->backingStore()->d->suspendScreenAndBackingStoreUpdates();
// We are navigating away from this document, so clean up any footprint we might have.
if (m_frame->document())
......@@ -456,8 +455,9 @@ void FrameLoaderClientBlackBerry::transitionToCommittedForNewPage()
ScrollbarAlwaysOff, /* ver mode */
true); /* lock the mode */
if (backingStoreClientForFrame)
backingStoreClientForFrame->backingStore()->d->resumeScreenAndBackingStoreUpdates(BackingStore::None);
if (isMainFrame() && m_webPagePrivate->backingStoreClient())
m_webPagePrivate->backingStoreClient()->backingStore()->d->resumeScreenAndBackingStoreUpdates(BackingStore::None);
m_frame->view()->updateCanHaveScrollbars();
if (isMainFrame()) {
......@@ -787,8 +787,6 @@ PassRefPtr<Frame> FrameLoaderClientBlackBerry::createFrame(const KURL& url, cons
if (!childFrame->tree()->parent())
return 0;
BackingStoreClient::create(childFrame.get(), m_frame, m_webPagePrivate->m_webPage);
m_frame->loader()->loadURLIntoChildFrame(url, referrer, childFrame.get());
if (!childFrame->tree()->parent())
......@@ -956,12 +954,6 @@ Frame* FrameLoaderClientBlackBerry::dispatchCreatePage(const NavigationAction& n
void FrameLoaderClientBlackBerry::detachedFromParent2()
{
BackingStoreClient* backingStoreClientForFrame = m_webPagePrivate->backingStoreClientForFrame(m_frame);
if (backingStoreClientForFrame) {
delete backingStoreClientForFrame;
backingStoreClientForFrame = 0;
}
if (m_frame->document())
m_webPagePrivate->clearDocumentData(m_frame->document());
......
......@@ -51,77 +51,28 @@ static inline IntSize pointToSize(const IntPoint& point)
BackingStoreClient* BackingStoreClient::create(Frame* frame, Frame* parentFrame, WebPage* parentPage)
{
ASSERT(parentPage);
ASSERT(frame->view());
// 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);
ASSERT(!parentFrame);
BackingStoreClient* it = new BackingStoreClient(frame, parentPage);
return it;
}
BackingStoreClient::BackingStoreClient(Frame* frame, Frame* parentFrame, WebPage* parentPage)
BackingStoreClient::BackingStoreClient(Frame* frame, WebPage* parentPage)
: m_frame(frame)
, m_webPage(parentPage)
, m_backingStore(0)
, m_parent(0)
, m_isClientGeneratedScroll(false)
, m_isScrollNotificationSuppressed(false)
{
UNUSED_PARAM(parentFrame);
m_backingStore = new BackingStore(m_webPage, this);
}
BackingStoreClient::~BackingStoreClient()
{
m_webPage->d->removeBackingStoreClientForFrame(m_frame);
delete m_backingStore;
m_backingStore = 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 rect = IntRect(IntPoint::zero(), viewportSize());
......
......@@ -45,10 +45,6 @@ public:
WebCore::Frame* frame() const { return m_frame; }
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 transformedAbsoluteLocation() const;
WebCore::IntRect absoluteRect() const;
......@@ -104,12 +100,11 @@ public:
void checkOriginOfCurrentScrollOperation();
private:
BackingStoreClient(WebCore::Frame*, WebCore::Frame* parentFrame, WebPage* parentPage);
BackingStoreClient(WebCore::Frame*, WebPage* parentPage);
WebCore::Frame* m_frame;
WebPage* m_webPage;
BackingStore* m_backingStore;
BackingStoreClient* m_parent;
bool m_isClientGeneratedScroll;
bool m_isScrollNotificationSuppressed;
};
......
......@@ -1745,14 +1745,14 @@ bool InputHandler::setBatchEditingActive(bool active)
// FIXME switch this to m_currentFocusElement->document()->frame() when we have separate
// backingstore for each frame.
BackingStoreClient* backingStoreClientForFrame = m_webPage->backingStoreClientForFrame(m_webPage->mainFrame());
ASSERT(backingStoreClientForFrame);
BackingStoreClient* backingStoreClient = m_webPage->backingStoreClient();
ASSERT(backingStoreClient);
// Enable / Disable the backingstore to prevent visual updates.
if (!active)
backingStoreClientForFrame->backingStore()->resumeScreenAndBackingStoreUpdates(BackingStore::RenderAndBlit);
backingStoreClient->backingStore()->resumeScreenAndBackingStoreUpdates(BackingStore::RenderAndBlit);
else
backingStoreClientForFrame->backingStore()->suspendScreenAndBackingStoreUpdates();
backingStoreClient->backingStore()->suspendScreenAndBackingStoreUpdates();
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