Title: [126767] trunk/Source/WebKit/blackberry
- Revision
- 126767
- Author
- [email protected]
- Date
- 2012-08-27 08:49:48 -0700 (Mon, 27 Aug 2012)
Log Message
BlackBerry] Shrink the in-region nested scrollable list as soon as we can
https://bugs.webkit.org/show_bug.cgi?id=95019
Reviewed by Rob Buis.
Patch by Antonio Gomes <[email protected]>
We cache all possible nested scrollable in-region layers given a point.
It is up to the client to pick a view, based on the scroll position and limits
of each layer, and on the diretion user swipes its finger.
>From the point we pick a view on, we stick with it, and any other
possibly cached layer can be uncached, as it won't be needed.
Patch providesa simple solution to that.
* Api/InRegionScroller.cpp:
(BlackBerry::WebKit::InRegionScrollerPrivate::InRegionScrollerPrivate):
(BlackBerry::WebKit::InRegionScrollerPrivate::reset):
(BlackBerry::WebKit::InRegionScrollerPrivate::setScrollPositionWebKitThread):
(BlackBerry::WebKit::InRegionScrollerPrivate::calculateActiveAndShrinkCachedScrollableAreas):
(WebKit):
(BlackBerry::WebKit::InRegionScrollerPrivate::calculateInRegionScrollableAreasForPoint):
* Api/InRegionScroller_p.h:
(InRegionScrollerPrivate):
Modified Paths
Diff
Modified: trunk/Source/WebKit/blackberry/Api/InRegionScroller.cpp (126766 => 126767)
--- trunk/Source/WebKit/blackberry/Api/InRegionScroller.cpp 2012-08-27 15:49:10 UTC (rev 126766)
+++ trunk/Source/WebKit/blackberry/Api/InRegionScroller.cpp 2012-08-27 15:49:48 UTC (rev 126767)
@@ -76,6 +76,7 @@
InRegionScrollerPrivate::InRegionScrollerPrivate(WebPagePrivate* webPagePrivate)
: m_webPage(webPagePrivate)
+ , m_needsActiveScrollableAreaCalculation(false)
{
}
@@ -93,6 +94,7 @@
{
setNode(0);
+ m_needsActiveScrollableAreaCalculation = false;
for (size_t i = 0; i < m_activeInRegionScrollableAreas.size(); ++i)
delete m_activeInRegionScrollableAreas[i];
m_activeInRegionScrollableAreas.clear();
@@ -143,13 +145,42 @@
if (!layer)
return false;
+ calculateActiveAndShrinkCachedScrollableAreas(layer);
+
// FIXME: Clamp maximum and minimum scroll positions as a last attempt to fix round errors.
return setLayerScrollPosition(layer, scrollPosition);
}
+void InRegionScrollerPrivate::calculateActiveAndShrinkCachedScrollableAreas(RenderLayer* layer)
+{
+ if (!m_needsActiveScrollableAreaCalculation)
+ return;
+
+ ASSERT(layer);
+ std::vector<Platform::ScrollViewBase*>::iterator end = m_activeInRegionScrollableAreas.end();
+ std::vector<Platform::ScrollViewBase*>::iterator it = m_activeInRegionScrollableAreas.begin();
+ while (it != end) {
+ InRegionScrollableArea* curr = static_cast<InRegionScrollableArea*>(*it);
+
+ if (layer == curr->layer()) {
+ ++it;
+ continue;
+ }
+
+ delete *it;
+ it = m_activeInRegionScrollableAreas.erase(it);
+ // ::erase invalidates the iterators.
+ end = m_activeInRegionScrollableAreas.end();
+ }
+
+ ASSERT(m_activeInRegionScrollableAreas.size() == 1);
+ m_needsActiveScrollableAreaCalculation = false;
+}
+
void InRegionScrollerPrivate::calculateInRegionScrollableAreasForPoint(const WebCore::IntPoint& point)
{
ASSERT(m_activeInRegionScrollableAreas.empty());
+ m_needsActiveScrollableAreaCalculation = false;
HitTestResult result = m_webPage->m_mainFrame->eventHandler()->hitTestResultAtPoint(m_webPage->mapFromViewportToContents(point), false /*allowShadowContent*/);
Node* node = result.innerNonSharedNode();
@@ -190,6 +221,8 @@
if (m_activeInRegionScrollableAreas.empty())
return;
+ m_needsActiveScrollableAreaCalculation = true;
+
// Post-calculate the visible window rects in reverse hit test order so
// we account for all and any clipping rects.
WebCore::IntRect recursiveClippingRect(WebCore::IntPoint::zero(), m_webPage->transformedViewportSize());
Modified: trunk/Source/WebKit/blackberry/Api/InRegionScroller_p.h (126766 => 126767)
--- trunk/Source/WebKit/blackberry/Api/InRegionScroller_p.h 2012-08-27 15:49:10 UTC (rev 126766)
+++ trunk/Source/WebKit/blackberry/Api/InRegionScroller_p.h 2012-08-27 15:49:48 UTC (rev 126767)
@@ -60,12 +60,15 @@
private:
bool setLayerScrollPosition(WebCore::RenderLayer*, const WebCore::IntPoint& scrollPosition);
+ void calculateActiveAndShrinkCachedScrollableAreas(WebCore::RenderLayer*);
+
void pushBackInRegionScrollable(InRegionScrollableArea*);
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/ChangeLog (126766 => 126767)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-08-27 15:49:10 UTC (rev 126766)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-08-27 15:49:48 UTC (rev 126767)
@@ -1,5 +1,29 @@
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
+
+ Reviewed by Rob Buis.
+
+ We cache all possible nested scrollable in-region layers given a point.
+ It is up to the client to pick a view, based on the scroll position and limits
+ of each layer, and on the direction user swipes its finger.
+ From the point we pick a view on, we stick with it, and any other
+ possibly cached layer can be uncached, as it won't be needed.
+ Patch provides a simple solution to that.
+
+ * Api/InRegionScroller.cpp:
+ (BlackBerry::WebKit::InRegionScrollerPrivate::InRegionScrollerPrivate):
+ (BlackBerry::WebKit::InRegionScrollerPrivate::reset):
+ (BlackBerry::WebKit::InRegionScrollerPrivate::setScrollPositionWebKitThread):
+ (BlackBerry::WebKit::InRegionScrollerPrivate::calculateActiveAndShrinkCachedScrollableAreas):
+ (WebKit):
+ (BlackBerry::WebKit::InRegionScrollerPrivate::calculateInRegionScrollableAreasForPoint):
+ * Api/InRegionScroller_p.h:
+ (InRegionScrollerPrivate):
+
+2012-08-25 Antonio Gomes <[email protected]>
+
For convenience, make RenderLayer::enclosingElement a public method.
https://bugs.webkit.org/show_bug.cgi?id=95018
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes