Title: [138183] trunk/Source/WebCore
Revision
138183
Author
toniki...@webkit.org
Date
2012-12-19 11:27:42 -0800 (Wed, 19 Dec 2012)

Log Message

Make RenderLayerCompositor::requiresCompositingForScrollableFrame scrollbars agnostic
https://bugs.webkit.org/show_bug.cgi?id=97903

Reviewed by Simon Fraser.
Patch by Antonio Gomes <a1.go...@sisa.samsung.com>

Some ports (including Qt-wk1 and BlackBerry) allow disabling
scrollbars at FrameView creation level. Regardless the scrollbars
presence though, their frame's content can still be scrolled as needed.
The said, checking for the scrollbars presence in order to determine
the scrollability of an inner frame is flaky, as done in RenderLayerCompositor::requiresCompositingForScrollableFrame.

Instead, the patch factors out part of the logic in
FrameView::updateScrollableAreaSet into a new ::isScrollable method.
The later can be used to check the scrollability of a given FrameView.

No new tests added, since there is no behavior change: ports like Chromium and others
who currently check for the scrollbars presence in order to determine
an inner frame scrollability should not be affected.

* page/FrameView.cpp:
(WebCore::FrameView::isScrollable):
(WebCore):
(WebCore::FrameView::updateScrollableAreaSet):
* page/FrameView.h:
(FrameView):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (138182 => 138183)


--- trunk/Source/WebCore/ChangeLog	2012-12-19 19:24:37 UTC (rev 138182)
+++ trunk/Source/WebCore/ChangeLog	2012-12-19 19:27:42 UTC (rev 138183)
@@ -1,3 +1,33 @@
+2012-12-12  Antonio Gomes  <a1.go...@sisa.samsung.com>
+
+        Make RenderLayerCompositor::requiresCompositingForScrollableFrame scrollbars agnostic
+        https://bugs.webkit.org/show_bug.cgi?id=97903
+
+        Reviewed by Simon Fraser.
+
+        Some ports (including Qt-wk1 and BlackBerry) allow disabling
+        scrollbars at FrameView creation level. Regardless the scrollbars
+        presence though, their frame's content can still be scrolled as needed.
+        The said, checking for the scrollbars presence in order to determine
+        the scrollability of an inner frame is flaky, as done in RenderLayerCompositor::requiresCompositingForScrollableFrame.
+
+        Instead, the patch factors out part of the logic in
+        FrameView::updateScrollableAreaSet into a new ::isScrollable method.
+        The later can be used to check the scrollability of a given FrameView.
+
+        No new tests added, since there is no behavior change: ports like Chromium and others
+        who currently check for the scrollbars presence in order to determine
+        an inner frame scrollability should not be affected.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::isScrollable):
+        (WebCore):
+        (WebCore::FrameView::updateScrollableAreaSet):
+        * page/FrameView.h:
+        (FrameView):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame):
+
 2012-12-18  Roger Fong  <roger_f...@apple.com>
 
         Popup menu on Windows should fade in instead of sliding in.

Modified: trunk/Source/WebCore/page/FrameView.cpp (138182 => 138183)


--- trunk/Source/WebCore/page/FrameView.cpp	2012-12-19 19:24:37 UTC (rev 138182)
+++ trunk/Source/WebCore/page/FrameView.cpp	2012-12-19 19:27:42 UTC (rev 138183)
@@ -2834,41 +2834,48 @@
     return frameRect();
 }
 
-void FrameView::updateScrollableAreaSet()
+bool FrameView::isScrollable()
 {
-    // That ensures that only inner frames are cached.
-    if (!parentFrameView())
-        return;
-
     // Check for:
-    // 1) display:none or visibility:hidden set to self or inherited.
-    // 2) overflow{-x,-y}: hidden;
-    // 3) scrolling: no;
+    // 1) If there an actual overflow.
+    // 2) display:none or visibility:hidden set to self or inherited.
+    // 3) overflow{-x,-y}: hidden;
+    // 4) scrolling: no;
 
-    // Covers #1.
-    HTMLFrameOwnerElement* owner = m_frame->ownerElement();
-    if (!owner || !owner->renderer() || !owner->renderer()->visibleToHitTesting()) {
-        parentFrameView()->removeScrollableArea(this);
-        return;
-    }
-
+    // Covers #1
     IntSize contentSize = contentsSize();
     IntSize visibleContentSize = visibleContentRect().size();
-    if ((contentSize.height() <= visibleContentSize.height() && contentSize.width() <= visibleContentSize.width())) {
-        parentFrameView()->removeScrollableArea(this);
-        return;
-    }
+    if ((contentSize.height() <= visibleContentSize.height() && contentSize.width() <= visibleContentSize.width()))
+        return false;
 
-    // Cover #2 and #3.
+    // Covers #2.
+    HTMLFrameOwnerElement* owner = m_frame->ownerElement();
+    if (owner && (!owner->renderer() || !owner->renderer()->visibleToHitTesting()))
+        return false;
+
+    // Cover #3 and #4.
     ScrollbarMode horizontalMode;
     ScrollbarMode verticalMode;
     calculateScrollbarModesForLayout(horizontalMode, verticalMode, RulesFromWebContentOnly);
-    if (horizontalMode == ScrollbarAlwaysOff && verticalMode == ScrollbarAlwaysOff) {
-        parentFrameView()->removeScrollableArea(this);
+    if (horizontalMode == ScrollbarAlwaysOff && verticalMode == ScrollbarAlwaysOff)
+        return false;
+
+    return true;
+}
+
+void FrameView::updateScrollableAreaSet()
+{
+    // That ensures that only inner frames are cached.
+    FrameView* parentFrameView = this->parentFrameView();
+    if (!parentFrameView)
         return;
+
+    if (!isScrollable()) {
+        parentFrameView->removeScrollableArea(this);
+        return;
     }
 
-    parentFrameView()->addScrollableArea(this);
+    parentFrameView->addScrollableArea(this);
 }
 
 bool FrameView::shouldSuspendScrollAnimations() const

Modified: trunk/Source/WebCore/page/FrameView.h (138182 => 138183)


--- trunk/Source/WebCore/page/FrameView.h	2012-12-19 19:24:37 UTC (rev 138182)
+++ trunk/Source/WebCore/page/FrameView.h	2012-12-19 19:27:42 UTC (rev 138183)
@@ -311,6 +311,8 @@
 
     bool isFrameViewScrollCorner(RenderScrollbarPart* scrollCorner) const { return m_scrollCorner == scrollCorner; }
 
+    bool isScrollable();
+
     enum ScrollbarModesCalculationStrategy { RulesFromWebContentOnly, AnyRule };
     void calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy = AnyRule);
 

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (138182 => 138183)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2012-12-19 19:24:37 UTC (rev 138182)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2012-12-19 19:27:42 UTC (rev 138183)
@@ -1797,8 +1797,8 @@
     // Need this done first to determine overflow.
     ASSERT(!m_renderView->needsLayout());
 
-    ScrollView* scrollView = m_renderView->frameView();
-    return scrollView->verticalScrollbar() || scrollView->horizontalScrollbar();
+    FrameView* frameView = m_renderView->frameView();
+    return frameView->isScrollable();
 }
 
 bool RenderLayerCompositor::requiresCompositingForTransform(RenderObject* renderer) const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to