- Revision
- 126768
- Author
- [email protected]
- Date
- 2012-08-27 08:50:30 -0700 (Mon, 27 Aug 2012)
Log Message
[BlackBerry] Remove the 'in region scrollable starting node' concept from InRegionScroller
https://bugs.webkit.org/show_bug.cgi?id=95020
Reviewed by Rob Buis.
Patch by Antonio Gomes <[email protected]>
'In-region start scrolling node' is an obsolete concept, and we can remove it
in favor of using the information from the cached layers.
* Api/InRegionScroller.cpp:
(WebKit):
(BlackBerry::WebKit::InRegionScrollerPrivate::reset): Adjusted as it used to clear
the cached 'node'.
(BlackBerry::WebKit::InRegionScrollerPrivate::isActive): Added method to be
checked directly instead of only null-checking the previously cached 'node'.
(BlackBerry::WebKit::InRegionScrollerPrivate::clearDocumentData): New method to
clear the cached resources if its document is done.
(BlackBerry::WebKit::InRegionScrollerPrivate::pushBackInRegionScrollable): Adjusted
to not care about the cached 'node' anymore.
* Api/InRegionScroller_p.h:
(InRegionScrollerPrivate):
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::notifyInRegionScrollStopped): Check ::isActive instead
of ::hasNode, since the later is gone.
(BlackBerry::WebKit::WebPagePrivate::enqueueRenderingOfClippedContentOfScrollableAreaAfterInRegionScrolling):
Changed the method signature, given that we do have a cached 'node' to pass in as parameter anymore.
(BlackBerry::WebKit::WebPagePrivate::clearDocumentData): Delegate all the related work to InRegionScroller.
* Api/WebPage_p.h:
(WebPagePrivate):
* WebKitSupport/TouchEventHandler.cpp:
(BlackBerry::WebKit::TouchEventHandler::drawTapHighlight):
Modified Paths
Diff
Modified: trunk/Source/WebKit/blackberry/Api/InRegionScroller.cpp (126767 => 126768)
--- trunk/Source/WebKit/blackberry/Api/InRegionScroller.cpp 2012-08-27 15:49:48 UTC (rev 126767)
+++ trunk/Source/WebKit/blackberry/Api/InRegionScroller.cpp 2012-08-27 15:50:30 UTC (rev 126768)
@@ -44,7 +44,6 @@
static bool canScrollInnerFrame(Frame*);
static bool canScrollRenderBox(RenderBox*);
static RenderLayer* parentLayer(RenderLayer*);
-static Node* enclosingLayerNode(RenderLayer*);
static bool isNonRenderViewFixedPositionedContainer(RenderLayer*);
InRegionScroller::InRegionScroller(WebPagePrivate* webPagePrivate)
@@ -80,34 +79,31 @@
{
}
-void InRegionScrollerPrivate::setNode(WebCore::Node* node)
-{
- m_inRegionScrollStartingNode = node;
-}
-
-WebCore::Node* InRegionScrollerPrivate::node() const
-{
- return m_inRegionScrollStartingNode.get();
-}
-
void InRegionScrollerPrivate::reset()
{
- setNode(0);
-
m_needsActiveScrollableAreaCalculation = false;
for (size_t i = 0; i < m_activeInRegionScrollableAreas.size(); ++i)
delete m_activeInRegionScrollableAreas[i];
m_activeInRegionScrollableAreas.clear();
}
-bool InRegionScrollerPrivate::hasNode() const
+bool InRegionScrollerPrivate::isActive() const
{
- return !!m_inRegionScrollStartingNode;
+ return m_activeInRegionScrollableAreas.size() > 0;
}
-bool InRegionScrollerPrivate::canScroll() const
+void InRegionScrollerPrivate::clearDocumentData(const Document* documentGoingAway)
{
- return hasNode();
+ if (m_needsActiveScrollableAreaCalculation) {
+ reset();
+ return;
+ }
+
+ InRegionScrollableArea* scrollableArea = static_cast<InRegionScrollableArea*>(m_activeInRegionScrollableAreas[0]);
+ ASSERT(scrollableArea);
+ Node* node = scrollableArea->layer()->enclosingElement();
+ if (node && node->document() == documentGoingAway)
+ reset();
}
bool InRegionScrollerPrivate::setScrollPositionCompositingThread(unsigned camouflagedLayer, const WebCore::IntPoint& scrollPosition)
@@ -376,17 +372,6 @@
return 0;
}
-// FIXME: Make RenderLayer::enclosingElement public so this one can be removed.
-static Node* enclosingLayerNode(RenderLayer* layer)
-{
- for (RenderObject* r = layer->renderer(); r; r = r->parent()) {
- if (Node* e = r->node())
- return e;
- }
- ASSERT_NOT_REACHED();
- return 0;
-}
-
static bool isNonRenderViewFixedPositionedContainer(RenderLayer* layer)
{
RenderObject* o = layer->renderer();
@@ -402,10 +387,6 @@
scrollableArea->setCanPropagateScrollingToEnclosingScrollable(!isNonRenderViewFixedPositionedContainer(scrollableArea->layer()));
m_activeInRegionScrollableAreas.push_back(scrollableArea);
- if (m_activeInRegionScrollableAreas.size() == 1) {
- // FIXME: Use RenderLayer::renderBox()->node() instead?
- setNode(enclosingLayerNode(scrollableArea->layer()));
- }
}
}
Modified: trunk/Source/WebKit/blackberry/Api/InRegionScroller_p.h (126767 => 126768)
--- trunk/Source/WebKit/blackberry/Api/InRegionScroller_p.h 2012-08-27 15:49:48 UTC (rev 126767)
+++ trunk/Source/WebKit/blackberry/Api/InRegionScroller_p.h 2012-08-27 15:50:30 UTC (rev 126768)
@@ -42,20 +42,19 @@
public:
InRegionScrollerPrivate(WebPagePrivate*);
- void setNode(WebCore::Node*);
- WebCore::Node* node() const;
void reset();
+ bool isActive() const;
- bool canScroll() const;
- bool hasNode() const;
-
bool setScrollPositionCompositingThread(unsigned camouflagedLayer, const WebCore::IntPoint& scrollPosition);
bool setScrollPositionWebKitThread(unsigned camouflagedLayer, const WebCore::IntPoint& scrollPosition, bool supportsAcceleratedScrolling);
void calculateInRegionScrollableAreasForPoint(const WebCore::IntPoint&);
const std::vector<Platform::ScrollViewBase*>& activeInRegionScrollableAreas() const;
+ void clearDocumentData(const WebCore::Document*);
+
WebPagePrivate* m_webPage;
+ bool m_needsActiveScrollableAreaCalculation;
private:
bool setLayerScrollPosition(WebCore::RenderLayer*, const WebCore::IntPoint& scrollPosition);
@@ -66,9 +65,7 @@
void adjustScrollDelta(const WebCore::IntPoint& maxOffset, const WebCore::IntPoint& currentOffset, WebCore::IntSize& delta) const;
- RefPtr<WebCore::Node> m_inRegionScrollStartingNode;
std::vector<Platform::ScrollViewBase*> m_activeInRegionScrollableAreas;
- bool m_needsActiveScrollableAreaCalculation;
};
}
Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (126767 => 126768)
--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-08-27 15:49:48 UTC (rev 126767)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-08-27 15:50:30 UTC (rev 126768)
@@ -1482,8 +1482,8 @@
void WebPagePrivate::notifyInRegionScrollStopped()
{
- if (m_inRegionScroller->d->hasNode()) {
- enqueueRenderingOfClippedContentOfScrollableNodeAfterInRegionScrolling(m_inRegionScroller->d->node());
+ if (m_inRegionScroller->d->isActive()) {
+ enqueueRenderingOfClippedContentOfScrollableAreaAfterInRegionScrolling();
m_inRegionScroller->d->reset();
}
}
@@ -1493,9 +1493,16 @@
d->notifyInRegionScrollStopped();
}
-void WebPagePrivate::enqueueRenderingOfClippedContentOfScrollableNodeAfterInRegionScrolling(Node* scrolledNode)
+void WebPagePrivate::enqueueRenderingOfClippedContentOfScrollableAreaAfterInRegionScrolling()
{
- ASSERT(scrolledNode);
+ // If no scrolling was even performed, bail out.
+ if (m_inRegionScroller->d->m_needsActiveScrollableAreaCalculation)
+ return;
+
+ InRegionScrollableArea* scrollableArea = static_cast<InRegionScrollableArea*>(m_inRegionScroller->d->activeInRegionScrollableAreas()[0]);
+ ASSERT(scrollableArea);
+ Node* scrolledNode = scrollableArea->layer()->enclosingElement();
+
if (scrolledNode->isDocumentNode()) {
Frame* frame = static_cast<const Document*>(scrolledNode)->frame();
ASSERT(frame);
@@ -2549,8 +2556,8 @@
if (m_currentBlockZoomAdjustedNode && m_currentBlockZoomAdjustedNode->document() == documentGoingAway)
m_currentBlockZoomAdjustedNode = 0;
- if (m_inRegionScroller->d->hasNode() && m_inRegionScroller->d->node()->document() == documentGoingAway)
- m_inRegionScroller->d->reset();
+ if (m_inRegionScroller->d->isActive())
+ m_inRegionScroller->d->clearDocumentData(documentGoingAway);
if (documentGoingAway->frame())
m_inputHandler->frameUnloaded(documentGoingAway->frame());
Modified: trunk/Source/WebKit/blackberry/Api/WebPage_p.h (126767 => 126768)
--- trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2012-08-27 15:49:48 UTC (rev 126767)
+++ trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2012-08-27 15:50:30 UTC (rev 126768)
@@ -152,7 +152,7 @@
void setScrollPosition(const WebCore::IntPoint&);
void scrollBy(int deltaX, int deltaY);
- void enqueueRenderingOfClippedContentOfScrollableNodeAfterInRegionScrolling(WebCore::Node*);
+ void enqueueRenderingOfClippedContentOfScrollableAreaAfterInRegionScrolling();
void notifyInRegionScrollStopped();
void setScrollOriginPoint(const Platform::IntPoint&);
void setHasInRegionScrollableAreas(bool);
Modified: trunk/Source/WebKit/blackberry/ChangeLog (126767 => 126768)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-08-27 15:49:48 UTC (rev 126767)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-08-27 15:50:30 UTC (rev 126768)
@@ -1,5 +1,38 @@
2012-08-25 Antonio Gomes <[email protected]>
+ [BlackBerry] Remove the 'in region scrollable starting node' concept from InRegionScroller
+ https://bugs.webkit.org/show_bug.cgi?id=95020
+
+ Reviewed by Rob Buis.
+
+ 'In-region start scrolling node' is an obsolete concept, and we can remove it
+ in favor of using the information from the cached layers.
+
+ * Api/InRegionScroller.cpp:
+ (WebKit):
+ (BlackBerry::WebKit::InRegionScrollerPrivate::reset): Adjusted as it used to clear
+ the cached 'node'.
+ (BlackBerry::WebKit::InRegionScrollerPrivate::isActive): Added method to be
+ checked directly instead of only null-checking the previously cached 'node'.
+ (BlackBerry::WebKit::InRegionScrollerPrivate::clearDocumentData): New method to
+ clear the cached resources if its document is done.
+ (BlackBerry::WebKit::InRegionScrollerPrivate::pushBackInRegionScrollable): Adjusted
+ to not care about the cached 'node' anymore.
+ * Api/InRegionScroller_p.h:
+ (InRegionScrollerPrivate):
+ * Api/WebPage.cpp:
+ (BlackBerry::WebKit::WebPagePrivate::notifyInRegionScrollStopped): Check ::isActive instead
+ of ::hasNode, since the later is gone.
+ (BlackBerry::WebKit::WebPagePrivate::enqueueRenderingOfClippedContentOfScrollableAreaAfterInRegionScrolling):
+ Changed the method signature, given that we do have a cached 'node' to pass in as parameter anymore.
+ (BlackBerry::WebKit::WebPagePrivate::clearDocumentData): Delegate all the related work to InRegionScroller.
+ * Api/WebPage_p.h:
+ (WebPagePrivate):
+ * WebKitSupport/TouchEventHandler.cpp:
+ (BlackBerry::WebKit::TouchEventHandler::drawTapHighlight):
+.
+2012-08-25 Antonio Gomes <[email protected]>
+
BlackBerry] Shrink the in-region nested scrollable list as soon as we can
https://bugs.webkit.org/show_bug.cgi?id=95019
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp (126767 => 126768)
--- trunk/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp 2012-08-27 15:49:48 UTC (rev 126767)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp 2012-08-27 15:50:30 UTC (rev 126768)
@@ -351,7 +351,7 @@
// On the client side, this info is being used to hide the tap highlight window on scroll.
RenderLayer* layer = m_webPage->enclosingFixedPositionedAncestorOrSelfIfFixedPositioned(renderer->enclosingLayer());
bool shouldHideTapHighlightRightAfterScrolling = !layer->renderer()->isRenderView();
- shouldHideTapHighlightRightAfterScrolling |= !!m_webPage->m_inRegionScroller->d->node();
+ shouldHideTapHighlightRightAfterScrolling |= !!m_webPage->m_inRegionScroller->d->isActive();
IntPoint framePos(m_webPage->frameOffset(elementFrame));