Title: [167970] trunk/Source/WebCore
Revision
167970
Author
simon.fra...@apple.com
Date
2014-04-29 16:53:57 -0700 (Tue, 29 Apr 2014)

Log Message

Remove some PLATFORM(IOS) #ifdefs related to hasAcceleratedTouchScrolling()
https://bugs.webkit.org/show_bug.cgi?id=132353

Reviewed by Tim Horton & Darin Adler.

Minor cleanup and refactoring to remove #idefs.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollTo): No need for this #ifdef, usesCompositedScrolling()
gives the right answser already.
(WebCore::RenderLayer::visibleContentRectInternal): Use showsOverflowControls() to
avoid #ifdef.
(WebCore::RenderLayer::invalidateScrollbarRect): Ditto.
(WebCore::RenderLayer::invalidateScrollCornerRect): Ditto.
(WebCore::RenderLayer::verticalScrollbarWidth): Ditto.
(WebCore::RenderLayer::horizontalScrollbarHeight): Ditto.
(WebCore::RenderLayer::showsOverflowControls): Return false on iOS.
(WebCore::RenderLayer::paintOverflowControls): Ditto.
(WebCore::RenderLayer::calculateClipRects): Ditto.
* rendering/RenderLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::layerOrAncestorIsTransformedOrUsingCompositedScrolling):
Just #ifdef in side of this function rather than having two similar functions.
(WebCore::RenderLayerBacking::shouldClipCompositedBounds):
(WebCore::hasNonZeroTransformOrigin):
(WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration): Use a local bool
to reduce #ifdefs.
(WebCore::layerOrAncestorIsTransformedOrScrolling): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (167969 => 167970)


--- trunk/Source/WebCore/ChangeLog	2014-04-29 23:53:55 UTC (rev 167969)
+++ trunk/Source/WebCore/ChangeLog	2014-04-29 23:53:57 UTC (rev 167970)
@@ -1,5 +1,36 @@
 2014-04-29  Simon Fraser  <simon.fra...@apple.com>
 
+        Remove some PLATFORM(IOS) #ifdefs related to hasAcceleratedTouchScrolling()
+        https://bugs.webkit.org/show_bug.cgi?id=132353
+
+        Reviewed by Tim Horton & Darin Adler.
+
+        Minor cleanup and refactoring to remove #idefs.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::scrollTo): No need for this #ifdef, usesCompositedScrolling()
+        gives the right answser already.
+        (WebCore::RenderLayer::visibleContentRectInternal): Use showsOverflowControls() to
+        avoid #ifdef.
+        (WebCore::RenderLayer::invalidateScrollbarRect): Ditto.
+        (WebCore::RenderLayer::invalidateScrollCornerRect): Ditto.
+        (WebCore::RenderLayer::verticalScrollbarWidth): Ditto.
+        (WebCore::RenderLayer::horizontalScrollbarHeight): Ditto.
+        (WebCore::RenderLayer::showsOverflowControls): Return false on iOS.
+        (WebCore::RenderLayer::paintOverflowControls): Ditto.
+        (WebCore::RenderLayer::calculateClipRects): Ditto.
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::layerOrAncestorIsTransformedOrUsingCompositedScrolling):
+        Just #ifdef in side of this function rather than having two similar functions.
+        (WebCore::RenderLayerBacking::shouldClipCompositedBounds):
+        (WebCore::hasNonZeroTransformOrigin):
+        (WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration): Use a local bool
+        to reduce #ifdefs.
+        (WebCore::layerOrAncestorIsTransformedOrScrolling): Deleted.
+
+2014-04-29  Simon Fraser  <simon.fra...@apple.com>
+
         Remove Settings::compositedScrollingForFramesEnabled
         https://bugs.webkit.org/show_bug.cgi?id=132352
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (167969 => 167970)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-04-29 23:53:55 UTC (rev 167969)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-04-29 23:53:57 UTC (rev 167970)
@@ -2364,11 +2364,7 @@
         requiresRepaint = false;
 
     // Just schedule a full repaint of our object.
-#if PLATFORM(IOS)
-    if (!hasAcceleratedTouchScrolling())
-#else
     if (requiresRepaint)
-#endif
         renderer().repaintUsingContainer(repaintContainer, m_repaintRect);
 
     // Schedule the scroll and scroll-related DOM events.
@@ -2695,16 +2691,9 @@
 {
     int verticalScrollbarWidth = 0;
     int horizontalScrollbarHeight = 0;
-    if (scrollbarInclusion == IncludeScrollbars) {
+    if (showsOverflowControls() && scrollbarInclusion == IncludeScrollbars) {
         verticalScrollbarWidth = (verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar()) ? verticalScrollbar()->width() : 0;
         horizontalScrollbarHeight = (horizontalScrollbar() && !horizontalScrollbar()->isOverlayScrollbar()) ? horizontalScrollbar()->height() : 0;
-
-#if PLATFORM(IOS)
-        if (hasAcceleratedTouchScrolling()) {
-            verticalScrollbarWidth = 0;
-            horizontalScrollbarHeight = 0;
-        }
-#endif
     }
     
     return IntRect(IntPoint(scrollXOffset(), scrollYOffset()),
@@ -2924,11 +2913,8 @@
 
 void RenderLayer::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect)
 {
-#if PLATFORM(IOS)
-    // No need to invalidate scrollbars if we're using accelerated scrolling.
-    if (hasAcceleratedTouchScrolling())
+    if (!showsOverflowControls())
         return;
-#endif
 
     if (scrollbar == m_vBar.get()) {
         if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
@@ -2960,11 +2946,8 @@
 
 void RenderLayer::invalidateScrollCornerRect(const IntRect& rect)
 {
-#if PLATFORM(IOS)
-    // No need to invalidate the scroll corner if we're using accelerated scrolling.
-    if (hasAcceleratedTouchScrolling())
+    if (!showsOverflowControls())
         return;
-#endif
 
     if (GraphicsLayer* layer = layerForScrollCorner()) {
         layer->setNeedsDisplayInRect(rect);
@@ -3084,27 +3067,21 @@
 
 int RenderLayer::verticalScrollbarWidth(OverlayScrollbarSizeRelevancy relevancy) const
 {
-    if (!m_vBar || (m_vBar->isOverlayScrollbar() && (relevancy == IgnoreOverlayScrollbarSize || !m_vBar->shouldParticipateInHitTesting())))
+    if (!m_vBar
+        || !showsOverflowControls()
+        || (m_vBar->isOverlayScrollbar() && (relevancy == IgnoreOverlayScrollbarSize || !m_vBar->shouldParticipateInHitTesting())))
         return 0;
 
-#if PLATFORM(IOS)
-    if (hasAcceleratedTouchScrolling()) 
-        return 0;
-#endif
-
     return m_vBar->width();
 }
 
 int RenderLayer::horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy relevancy) const
 {
-    if (!m_hBar || (m_hBar->isOverlayScrollbar() && (relevancy == IgnoreOverlayScrollbarSize || !m_hBar->shouldParticipateInHitTesting())))
+    if (!m_hBar
+        || !showsOverflowControls()
+        || (m_hBar->isOverlayScrollbar() && (relevancy == IgnoreOverlayScrollbarSize || !m_hBar->shouldParticipateInHitTesting())))
         return 0;
 
-#if PLATFORM(IOS)
-    if (hasAcceleratedTouchScrolling()) 
-        return 0;
-#endif
-
     return m_hBar->height();
 }
 
@@ -3374,17 +3351,25 @@
     return false;
 }
 
+bool RenderLayer::showsOverflowControls() const
+{
+#if PLATFORM(IOS)
+    // Don't render (custom) scrollbars if we have accelerated scrolling.
+    if (hasAcceleratedTouchScrolling())
+        return false;
+#endif
+
+    return true;
+}
+
 void RenderLayer::paintOverflowControls(GraphicsContext* context, const IntPoint& paintOffset, const IntRect& damageRect, bool paintingOverlayControls)
 {
     // Don't do anything if we have no overflow.
     if (!renderer().hasOverflowClip())
         return;
 
-#if PLATFORM(IOS)
-    // Don't render (custom) scrollbars if we have accelerated scrolling.
-    if (hasAcceleratedTouchScrolling())
+    if (!showsOverflowControls())
         return;
-#endif
 
     // Overlay scrollbars paint in a second pass through the layer tree so that they will paint
     // on top of everything else. If this is the normal painting pass, paintingOverlayControls
@@ -6425,15 +6410,14 @@
         && !renderer().hasFilter()
 #endif
 #if PLATFORM(IOS)
-            && !hasAcceleratedTouchScrolling()
+        && !hasAcceleratedTouchScrolling()
 #endif
 #if ENABLE(CSS_COMPOSITING)
         && !renderer().hasBlendMode()
 #endif
         && !isTransparent()
         && !needsCompositedScrolling()
-        && !renderer().style().hasFlowFrom()
-        ;
+        && !renderer().style().hasFlowFrom();
 }
 
 bool RenderLayer::shouldBeSelfPaintingLayer() const

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (167969 => 167970)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2014-04-29 23:53:55 UTC (rev 167969)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2014-04-29 23:53:57 UTC (rev 167970)
@@ -458,8 +458,8 @@
     bool requiresScrollBoundsOriginUpdate() const { return m_requiresScrollBoundsOriginUpdate; }
     void setRequiresScrollBoundsOriginUpdate(bool requiresUpdate = true) { m_requiresScrollBoundsOriginUpdate = requiresUpdate; }
 
+    // Returns true when the layer could do touch scrolling, but doesn't look at whether there is actually scrollable overflow.
     bool hasAcceleratedTouchScrolling() const;
-
 #endif
 
     int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;
@@ -1058,6 +1058,8 @@
     bool hasScrollableHorizontalOverflow() const;
     bool hasScrollableVerticalOverflow() const;
 
+    bool showsOverflowControls() const;
+
     bool shouldBeNormalFlowOnly() const;
 
     bool shouldBeSelfPaintingLayer() const;

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (167969 => 167970)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2014-04-29 23:53:55 UTC (rev 167969)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2014-04-29 23:53:57 UTC (rev 167970)
@@ -400,37 +400,23 @@
 }
 #endif
 
-static bool hasNonZeroTransformOrigin(const RenderObject& renderer)
-{
-    const RenderStyle& style = renderer.style();
-    return (style.transformOriginX().type() == Fixed && style.transformOriginX().value())
-        || (style.transformOriginY().type() == Fixed && style.transformOriginY().value());
-}
-
-#if PLATFORM(IOS)
-// FIXME: We should merge the concept of RenderLayer::{hasAcceleratedTouchScrolling, needsCompositedScrolling}()
-// so that we can remove this iOS-specific variant.
-static bool layerOrAncestorIsTransformedOrScrolling(RenderLayer& layer)
-{
-    for (RenderLayer* curr = &layer; curr; curr = curr->parent()) {
-        if (curr->hasTransform() || curr->hasAcceleratedTouchScrolling())
-            return true;
-    }
-
-    return false;
-}
-#else
+// FIXME: the hasAcceleratedTouchScrolling()/needsCompositedScrolling() concepts need to be merged.
 static bool layerOrAncestorIsTransformedOrUsingCompositedScrolling(RenderLayer& layer)
 {
     for (RenderLayer* curr = &layer; curr; curr = curr->parent()) {
-        if (curr->hasTransform() || curr->needsCompositedScrolling())
+        if (curr->hasTransform()
+#if PLATFORM(IOS)
+            || curr->hasAcceleratedTouchScrolling()
+#else
+            || curr->needsCompositedScrolling()
+#endif
+            )
             return true;
     }
 
     return false;
 }
-#endif
-    
+
 bool RenderLayerBacking::shouldClipCompositedBounds() const
 {
 #if !PLATFORM(IOS)
@@ -442,13 +428,8 @@
     if (m_usingTiledCacheLayer)
         return false;
 
-#if !PLATFORM(IOS)
     if (layerOrAncestorIsTransformedOrUsingCompositedScrolling(m_owningLayer))
         return false;
-#else
-    if (layerOrAncestorIsTransformedOrScrolling(m_owningLayer))
-        return false;
-#endif
 
     if (m_owningLayer.isFlowThreadCollectingGraphicsLayersUnderRegions())
         return false;
@@ -456,6 +437,13 @@
     return true;
 }
 
+static bool hasNonZeroTransformOrigin(const RenderObject& renderer)
+{
+    const RenderStyle& style = renderer.style();
+    return (style.transformOriginX().type() == Fixed && style.transformOriginX().value())
+        || (style.transformOriginY().type() == Fixed && style.transformOriginY().value());
+}
+
 void RenderLayerBacking::updateCompositedBounds()
 {
     LayoutRect layerBounds = compositor().calculateCompositedBounds(m_owningLayer, m_owningLayer);
@@ -548,16 +536,16 @@
         layerConfigChanged = true;
     
     bool needsDescendentsClippingLayer = compositor().clipsCompositingDescendants(m_owningLayer);
-
+    bool usesCompositedScrolling;
 #if PLATFORM(IOS)
-    // Our scrolling layer will clip.
-    if (m_owningLayer.hasAcceleratedTouchScrolling())
-        needsDescendentsClippingLayer = false;
+    usesCompositedScrolling = m_owningLayer.hasAcceleratedTouchScrolling();
 #else
+    usesCompositedScrolling = m_owningLayer.needsCompositedScrolling();
+#endif
+
     // Our scrolling layer will clip.
-    if (m_owningLayer.needsCompositedScrolling())
+    if (usesCompositedScrolling)
         needsDescendentsClippingLayer = false;
-#endif // PLATFORM(IOS)
 
     if (updateAncestorClippingLayer(compositor().clippedByAncestor(m_owningLayer)))
         layerConfigChanged = true;
@@ -568,13 +556,8 @@
     if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), requiresVerticalScrollbarLayer(), requiresScrollCornerLayer()))
         layerConfigChanged = true;
 
-#if PLATFORM(IOS)
-    if (updateScrollingLayers(m_owningLayer.hasAcceleratedTouchScrolling()))
+    if (updateScrollingLayers(usesCompositedScrolling))
         layerConfigChanged = true;
-#else
-    if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling()))
-        layerConfigChanged = true;
-#endif // PLATFORM(IOS)
 
     if (layerConfigChanged)
         updateInternalHierarchy();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to