Title: [135070] branches/safari-536.28-branch
Revision
135070
Author
simon.fra...@apple.com
Date
2012-11-18 10:06:50 -0800 (Sun, 18 Nov 2012)

Log Message

Prerequisite for <rdar://problem/12725980> Fix overlay scrollbar painting in compositing layers (102442)
Merge r127943

.:

    2012-09-07  Simon Fraser  <simon.fra...@apple.com>

    box-shadow causes overlay scrollbars to be in the wrong position when element is composited
    https://bugs.webkit.org/show_bug.cgi?id=85647

    Reviewed by James Robinson.

    Test overlay scrollbars in composited layers.

    * ManualTests/scrollbars/scrollbars-in-composited-layers.html: Added.

Source/WebCore:

    2012-09-07  Simon Fraser  <simon.fra...@apple.com>

    box-shadow causes overlay scrollbars to be in the wrong position when element is composited
    https://bugs.webkit.org/show_bug.cgi?id=85647

    Reviewed by James Robinson.

    The code that positioned the GraphicsLayers for scrollbars failed to take
    into account any offset between the origin of the compositing layer,
    and the renderer. This caused scrollbar layers to be misplaced or hidden
    on layers with, for example, box-shadows.

    Also moved the code that positions the scrollbar layers into RendderLayerBacking,
    since this is where all the rest of the GraphicsLayer-positioning code lives.

    Renamed an "offsetFromLayer" param to "offsetFromRoot" which is more accurate.

    Manual test, since overlay scrollbars are not enabled in DRT/WTR:
        ManualTests/scrollbars/scrollbars-in-composited-layers.html

    * rendering/RenderLayer.cpp:
    (WebCore::RenderLayer::positionOverflowControls):
    * rendering/RenderLayerBacking.cpp:
    (WebCore::RenderLayerBacking::positionOverflowControlsLayers):
    * rendering/RenderLayerBacking.h:
    (RenderLayerBacking):

Modified Paths

Added Paths

Diff

Modified: branches/safari-536.28-branch/ChangeLog (135069 => 135070)


--- branches/safari-536.28-branch/ChangeLog	2012-11-18 16:55:06 UTC (rev 135069)
+++ branches/safari-536.28-branch/ChangeLog	2012-11-18 18:06:50 UTC (rev 135070)
@@ -1,3 +1,19 @@
+2012-11-18  Simon Fraser  <simon.fra...@apple.com>
+
+        Prerequisite for <rdar://problem/12725980> Fix overlay scrollbar painting in compositing layers (102442)
+        Merge r127943
+
+    2012-09-07  Simon Fraser  <simon.fra...@apple.com>
+    
+            box-shadow causes overlay scrollbars to be in the wrong position when element is composited
+            https://bugs.webkit.org/show_bug.cgi?id=85647
+    
+            Reviewed by James Robinson.
+    
+            Test overlay scrollbars in composited layers.
+    
+            * ManualTests/scrollbars/scrollbars-in-composited-layers.html: Added.
+
 2012-11-08  Lucas Forschler  <lforsch...@apple.com>
 
         Merge r125695

Added: branches/safari-536.28-branch/ManualTests/scrollbars/scrollbars-in-composited-layers.html (0 => 135070)


--- branches/safari-536.28-branch/ManualTests/scrollbars/scrollbars-in-composited-layers.html	                        (rev 0)
+++ branches/safari-536.28-branch/ManualTests/scrollbars/scrollbars-in-composited-layers.html	2012-11-18 18:06:50 UTC (rev 135070)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+    .scroll {
+        width: 200px;
+        height: 200px;
+        border: 1px solid black;
+        margin: 15px;
+        padding: 5px;
+        overflow-y: scroll;
+        -webkit-transform: translateZ(0);
+        box-shadow: 0 0 15px black;
+    }
+
+    .rotated {
+        -webkit-transform: rotate3d(0, 0, 1, 45deg);
+    }
+    .scroll > div {
+        background-color: silver;
+        width: 500px;
+        height: 1000px;
+    }
+    </style>
+</head>
+<body>
+
+    <p>Overlay scrollbars (on Mac) should show in the correct place when scrolling.</p>
+    <div class="scroll">
+        <div></div>
+    </div>
+
+    <p>Overlay scrollbars (on Mac) should show in the correct place when scrolling, and the resize corner should show in the correct place.</p>
+    <div class="scroll" style="resize: both; overflow:hiddens">
+        <div></div>
+    </div>
+
+    <p>Overlay scrollbars (on Mac) should show in the correct place when scrolling, and the resize corner should show in the correct place.</p>
+    <div class="rotated scroll" style="resize: both; overflow:hiddens">
+        <div></div>
+    </div>
+
+</body>
+</html>
Property changes on: branches/safari-536.28-branch/ManualTests/scrollbars/scrollbars-in-composited-layers.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: branches/safari-536.28-branch/Source/WebCore/ChangeLog (135069 => 135070)


--- branches/safari-536.28-branch/Source/WebCore/ChangeLog	2012-11-18 16:55:06 UTC (rev 135069)
+++ branches/safari-536.28-branch/Source/WebCore/ChangeLog	2012-11-18 18:06:50 UTC (rev 135070)
@@ -1,3 +1,35 @@
+2012-11-18  Simon Fraser  <simon.fra...@apple.com>
+
+        Prerequisite for <rdar://problem/12725980> Fix overlay scrollbar painting in compositing layers (102442)
+        Merge r127943
+
+    2012-09-07  Simon Fraser  <simon.fra...@apple.com>
+    
+            box-shadow causes overlay scrollbars to be in the wrong position when element is composited
+            https://bugs.webkit.org/show_bug.cgi?id=85647
+    
+            Reviewed by James Robinson.
+    
+            The code that positioned the GraphicsLayers for scrollbars failed to take
+            into account any offset between the origin of the compositing layer,
+            and the renderer. This caused scrollbar layers to be misplaced or hidden
+            on layers with, for example, box-shadows.
+            
+            Also moved the code that positions the scrollbar layers into RendderLayerBacking,
+            since this is where all the rest of the GraphicsLayer-positioning code lives.
+            
+            Renamed an "offsetFromLayer" param to "offsetFromRoot" which is more accurate.
+    
+            Manual test, since overlay scrollbars are not enabled in DRT/WTR:
+                ManualTests/scrollbars/scrollbars-in-composited-layers.html
+    
+            * rendering/RenderLayer.cpp:
+            (WebCore::RenderLayer::positionOverflowControls):
+            * rendering/RenderLayerBacking.cpp:
+            (WebCore::RenderLayerBacking::positionOverflowControlsLayers):
+            * rendering/RenderLayerBacking.h:
+            (RenderLayerBacking):
+
 2012-11-16  Andy Estes  <aes...@apple.com>
 
         Fix the Mountain Lion build after r135007.

Modified: branches/safari-536.28-branch/Source/WebCore/rendering/RenderLayer.cpp (135069 => 135070)


--- branches/safari-536.28-branch/Source/WebCore/rendering/RenderLayer.cpp	2012-11-18 16:55:06 UTC (rev 135069)
+++ branches/safari-536.28-branch/Source/WebCore/rendering/RenderLayer.cpp	2012-11-18 18:06:50 UTC (rev 135070)
@@ -2306,7 +2306,7 @@
     return m_hBar || m_vBar || m_scrollCorner || renderer()->style()->resize() != RESIZE_NONE;
 }
 
-void RenderLayer::positionOverflowControls(const IntSize& offsetFromLayer)
+void RenderLayer::positionOverflowControls(const IntSize& offsetFromRoot)
 {
     if (!m_hBar && !m_vBar && (!renderer()->hasOverflowClip() || renderer()->style()->resize() == RESIZE_NONE))
         return;
@@ -2317,7 +2317,7 @@
 
     const IntRect borderBox = box->pixelSnappedBorderBoxRect();
     const IntRect& scrollCorner = scrollCornerRect();
-    IntRect absBounds(borderBox.location() + offsetFromLayer, borderBox.size());
+    IntRect absBounds(borderBox.location() + offsetFromRoot, borderBox.size());
     if (m_vBar)
         m_vBar->setFrameRect(IntRect(verticalScrollbarStart(absBounds.x(), absBounds.maxX()),
                                      absBounds.y() + box->borderTop(),
@@ -2330,34 +2330,15 @@
                                      absBounds.width() - (box->borderLeft() + box->borderRight()) - scrollCorner.width(),
                                      m_hBar->height()));
 
-#if USE(ACCELERATED_COMPOSITING)
-    if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
-        if (m_hBar) {
-            layer->setPosition(m_hBar->frameRect().location() - offsetFromLayer);
-            layer->setSize(m_hBar->frameRect().size());
-        }
-        layer->setDrawsContent(m_hBar);
-    }
-    if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
-        if (m_vBar) {
-            layer->setPosition(m_vBar->frameRect().location() - offsetFromLayer);
-            layer->setSize(m_vBar->frameRect().size());
-        }
-        layer->setDrawsContent(m_vBar);
-    }
-
-    if (GraphicsLayer* layer = layerForScrollCorner()) {
-        const LayoutRect& scrollCornerAndResizer = scrollCornerAndResizerRect();
-        layer->setPosition(scrollCornerAndResizer.location());
-        layer->setSize(scrollCornerAndResizer.size());
-        layer->setDrawsContent(!scrollCornerAndResizer.isEmpty());
-    }
-#endif
-
     if (m_scrollCorner)
         m_scrollCorner->setFrameRect(scrollCorner);
     if (m_resizer)
         m_resizer->setFrameRect(resizerCornerRect(this, borderBox));
+
+#if USE(ACCELERATED_COMPOSITING)    
+    if (isComposited())
+        backing()->positionOverflowControlsLayers(offsetFromRoot);
+#endif
 }
 
 int RenderLayer::scrollWidth() const

Modified: branches/safari-536.28-branch/Source/WebCore/rendering/RenderLayerBacking.cpp (135069 => 135070)


--- branches/safari-536.28-branch/Source/WebCore/rendering/RenderLayerBacking.cpp	2012-11-18 16:55:06 UTC (rev 135069)
+++ branches/safari-536.28-branch/Source/WebCore/rendering/RenderLayerBacking.cpp	2012-11-18 18:06:50 UTC (rev 135070)
@@ -729,6 +729,35 @@
     return layersChanged;
 }
 
+void RenderLayerBacking::positionOverflowControlsLayers(const IntSize& offsetFromRoot)
+{
+    IntSize offsetFromRenderer = m_graphicsLayer->offsetFromRenderer();
+    if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
+        Scrollbar* hBar = m_owningLayer->horizontalScrollbar();
+        if (hBar) {
+            layer->setPosition(hBar->frameRect().location() - offsetFromRoot - offsetFromRenderer);
+            layer->setSize(hBar->frameRect().size());
+        }
+        layer->setDrawsContent(hBar);
+    }
+    
+    if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
+        Scrollbar* vBar = m_owningLayer->verticalScrollbar();
+        if (vBar) {
+            layer->setPosition(vBar->frameRect().location() - offsetFromRoot - offsetFromRenderer);
+            layer->setSize(vBar->frameRect().size());
+        }
+        layer->setDrawsContent(vBar);
+    }
+
+    if (GraphicsLayer* layer = layerForScrollCorner()) {
+        const LayoutRect& scrollCornerAndResizer = m_owningLayer->scrollCornerAndResizerRect();
+        layer->setPosition(scrollCornerAndResizer.location() - offsetFromRenderer);
+        layer->setSize(scrollCornerAndResizer.size());
+        layer->setDrawsContent(!scrollCornerAndResizer.isEmpty());
+    }
+}
+
 bool RenderLayerBacking::updateForegroundLayer(bool needsForegroundLayer)
 {
     bool layerChanged = false;

Modified: branches/safari-536.28-branch/Source/WebCore/rendering/RenderLayerBacking.h (135069 => 135070)


--- branches/safari-536.28-branch/Source/WebCore/rendering/RenderLayerBacking.h	2012-11-18 16:55:06 UTC (rev 135069)
+++ branches/safari-536.28-branch/Source/WebCore/rendering/RenderLayerBacking.h	2012-11-18 18:06:50 UTC (rev 135070)
@@ -121,6 +121,7 @@
     void updateCompositedBounds();
     
     void updateAfterWidgetResize();
+    void positionOverflowControlsLayers(const IntSize& offsetFromRoot);
 
     // GraphicsLayerClient interface
     virtual bool shouldUseTileCache(const GraphicsLayer*) const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to