Changeset 135070 in webkit


Ignore:
Timestamp:
Nov 18, 2012, 10:06:50 AM (13 years ago)
Author:
Simon Fraser
Message:

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

.:

2012-09-07 Simon Fraser <Simon Fraser>

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 Fraser>

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):
Location:
branches/safari-536.28-branch
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-536.28-branch/ChangeLog

    r133969 r135070  
     12012-11-18  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Prerequisite for <rdar://problem/12725980> Fix overlay scrollbar painting in compositing layers (102442)
     4        Merge r127943
     5
     6    2012-09-07  Simon Fraser  <simon.fraser@apple.com>
     7   
     8            box-shadow causes overlay scrollbars to be in the wrong position when element is composited
     9            https://bugs.webkit.org/show_bug.cgi?id=85647
     10   
     11            Reviewed by James Robinson.
     12   
     13            Test overlay scrollbars in composited layers.
     14   
     15            * ManualTests/scrollbars/scrollbars-in-composited-layers.html: Added.
     16
    1172012-11-08  Lucas Forschler  <lforschler@apple.com>
    218
  • branches/safari-536.28-branch/Source/WebCore/ChangeLog

    r135012 r135070  
     12012-11-18  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Prerequisite for <rdar://problem/12725980> Fix overlay scrollbar painting in compositing layers (102442)
     4        Merge r127943
     5
     6    2012-09-07  Simon Fraser  <simon.fraser@apple.com>
     7   
     8            box-shadow causes overlay scrollbars to be in the wrong position when element is composited
     9            https://bugs.webkit.org/show_bug.cgi?id=85647
     10   
     11            Reviewed by James Robinson.
     12   
     13            The code that positioned the GraphicsLayers for scrollbars failed to take
     14            into account any offset between the origin of the compositing layer,
     15            and the renderer. This caused scrollbar layers to be misplaced or hidden
     16            on layers with, for example, box-shadows.
     17           
     18            Also moved the code that positions the scrollbar layers into RendderLayerBacking,
     19            since this is where all the rest of the GraphicsLayer-positioning code lives.
     20           
     21            Renamed an "offsetFromLayer" param to "offsetFromRoot" which is more accurate.
     22   
     23            Manual test, since overlay scrollbars are not enabled in DRT/WTR:
     24                ManualTests/scrollbars/scrollbars-in-composited-layers.html
     25   
     26            * rendering/RenderLayer.cpp:
     27            (WebCore::RenderLayer::positionOverflowControls):
     28            * rendering/RenderLayerBacking.cpp:
     29            (WebCore::RenderLayerBacking::positionOverflowControlsLayers):
     30            * rendering/RenderLayerBacking.h:
     31            (RenderLayerBacking):
     32
    1332012-11-16  Andy Estes  <aestes@apple.com>
    234
  • branches/safari-536.28-branch/Source/WebCore/rendering/RenderLayer.cpp

    r134740 r135070  
    23072307}
    23082308
    2309 void RenderLayer::positionOverflowControls(const IntSize& offsetFromLayer)
     2309void RenderLayer::positionOverflowControls(const IntSize& offsetFromRoot)
    23102310{
    23112311    if (!m_hBar && !m_vBar && (!renderer()->hasOverflowClip() || renderer()->style()->resize() == RESIZE_NONE))
     
    23182318    const IntRect borderBox = box->pixelSnappedBorderBoxRect();
    23192319    const IntRect& scrollCorner = scrollCornerRect();
    2320     IntRect absBounds(borderBox.location() + offsetFromLayer, borderBox.size());
     2320    IntRect absBounds(borderBox.location() + offsetFromRoot, borderBox.size());
    23212321    if (m_vBar)
    23222322        m_vBar->setFrameRect(IntRect(verticalScrollbarStart(absBounds.x(), absBounds.maxX()),
     
    23312331                                     m_hBar->height()));
    23322332
    2333 #if USE(ACCELERATED_COMPOSITING)
    2334     if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
    2335         if (m_hBar) {
    2336             layer->setPosition(m_hBar->frameRect().location() - offsetFromLayer);
    2337             layer->setSize(m_hBar->frameRect().size());
    2338         }
    2339         layer->setDrawsContent(m_hBar);
    2340     }
    2341     if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
    2342         if (m_vBar) {
    2343             layer->setPosition(m_vBar->frameRect().location() - offsetFromLayer);
    2344             layer->setSize(m_vBar->frameRect().size());
    2345         }
    2346         layer->setDrawsContent(m_vBar);
    2347     }
    2348 
    2349     if (GraphicsLayer* layer = layerForScrollCorner()) {
    2350         const LayoutRect& scrollCornerAndResizer = scrollCornerAndResizerRect();
    2351         layer->setPosition(scrollCornerAndResizer.location());
    2352         layer->setSize(scrollCornerAndResizer.size());
    2353         layer->setDrawsContent(!scrollCornerAndResizer.isEmpty());
    2354     }
    2355 #endif
    2356 
    23572333    if (m_scrollCorner)
    23582334        m_scrollCorner->setFrameRect(scrollCorner);
    23592335    if (m_resizer)
    23602336        m_resizer->setFrameRect(resizerCornerRect(this, borderBox));
     2337
     2338#if USE(ACCELERATED_COMPOSITING)   
     2339    if (isComposited())
     2340        backing()->positionOverflowControlsLayers(offsetFromRoot);
     2341#endif
    23612342}
    23622343
  • branches/safari-536.28-branch/Source/WebCore/rendering/RenderLayerBacking.cpp

    r134713 r135070  
    730730}
    731731
     732void RenderLayerBacking::positionOverflowControlsLayers(const IntSize& offsetFromRoot)
     733{
     734    IntSize offsetFromRenderer = m_graphicsLayer->offsetFromRenderer();
     735    if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
     736        Scrollbar* hBar = m_owningLayer->horizontalScrollbar();
     737        if (hBar) {
     738            layer->setPosition(hBar->frameRect().location() - offsetFromRoot - offsetFromRenderer);
     739            layer->setSize(hBar->frameRect().size());
     740        }
     741        layer->setDrawsContent(hBar);
     742    }
     743   
     744    if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
     745        Scrollbar* vBar = m_owningLayer->verticalScrollbar();
     746        if (vBar) {
     747            layer->setPosition(vBar->frameRect().location() - offsetFromRoot - offsetFromRenderer);
     748            layer->setSize(vBar->frameRect().size());
     749        }
     750        layer->setDrawsContent(vBar);
     751    }
     752
     753    if (GraphicsLayer* layer = layerForScrollCorner()) {
     754        const LayoutRect& scrollCornerAndResizer = m_owningLayer->scrollCornerAndResizerRect();
     755        layer->setPosition(scrollCornerAndResizer.location() - offsetFromRenderer);
     756        layer->setSize(scrollCornerAndResizer.size());
     757        layer->setDrawsContent(!scrollCornerAndResizer.isEmpty());
     758    }
     759}
     760
    732761bool RenderLayerBacking::updateForegroundLayer(bool needsForegroundLayer)
    733762{
  • branches/safari-536.28-branch/Source/WebCore/rendering/RenderLayerBacking.h

    r134713 r135070  
    122122   
    123123    void updateAfterWidgetResize();
     124    void positionOverflowControlsLayers(const IntSize& offsetFromRoot);
    124125
    125126    // GraphicsLayerClient interface
Note: See TracChangeset for help on using the changeset viewer.