Changeset 198560 in webkit


Ignore:
Timestamp:
Mar 22, 2016 3:15:45 PM (8 years ago)
Author:
mmaxfield@apple.com
Message:

[RTL Scrollbars] Position: absolute divs are covered by vertical scrollbar
https://bugs.webkit.org/show_bug.cgi?id=155533

Reviewed by Darin Adler.

Source/WebCore:

This patch changes the behavior of position: absolute elements when their
containing block has overflow: scroll in RTL scrollbar mode. Previously, we
were only adjusting the overflow calculation for such elements (but not
their position calculation). This patch updates the position calculation,
which automatically makes the overflow calculation work propertly, so the
old calculation is no longer necessary.

This patch also updates iframes to appropriately move their dirty rects
and their painting CTM by the scrollbar width when traversing frame
boundaries. This fixes all our existing RTL scrollbar RTL tests.

The RTL scrollbar tests are only marked as passing on certain OSes, so these
tests are transitioning from failing to passing in that other repository.

Test: fast/scrolling/rtl-scrollbars-positioning.html

fast/scrolling/rtl-scrollbars-overflow-elementFromPoint.html
fast/scrolling/rtl-scrollbars-overflow-position-absolute.html
fast/scrolling/rtl-scrollbars-iframe-offset.html
fast/scrolling/rtl-scrollbars-iframe-position-absolute.html
fast/scrolling/rtl-scrollbars-iframe-scrolled.html
fast/scrolling/rtl-scrollbars-iframe.html

  • platform/ScrollView.cpp:

(WebCore::ScrollView::paint):
(WebCore::ScrollView::locationOfContents):

  • platform/ScrollView.h:
  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::repaintLayerDirtyRects):

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::addOverflowFromPositionedObjects):

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::computePositionedLogicalWidth):

  • rendering/RenderView.cpp:

(WebCore::RenderView::repaintViewRectangle):

LayoutTests:

  • TestExpectations:
  • fast/scrolling/rtl-scrollbars-positioning-expected.html: Added.
  • fast/scrolling/rtl-scrollbars-positioning.html: Added.
Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r198558 r198560  
     12016-03-22  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        [RTL Scrollbars] Position: absolute divs are covered by vertical scrollbar
     4        https://bugs.webkit.org/show_bug.cgi?id=155533
     5
     6        Reviewed by Darin Adler.
     7
     8        * TestExpectations:
     9        * fast/scrolling/rtl-scrollbars-positioning-expected.html: Added.
     10        * fast/scrolling/rtl-scrollbars-positioning.html: Added.
     11
    1122016-03-22  Ryan Haddad  <ryanhaddad@apple.com>
    213
  • trunk/LayoutTests/TestExpectations

    r198551 r198560  
    10141014fast/scrolling/rtl-scrollbars-elementFromPoint-static.html [ Failure ]
    10151015fast/scrolling/rtl-scrollbars-iframe-scrolled.html [ ImageOnlyFailure ]
     1016fast/scrolling/rtl-scrollbars-positioning.html [ ImageOnlyFailure ]
  • trunk/Source/WebCore/ChangeLog

    r198553 r198560  
     12016-03-22  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        [RTL Scrollbars] Position: absolute divs are covered by vertical scrollbar
     4        https://bugs.webkit.org/show_bug.cgi?id=155533
     5
     6        Reviewed by Darin Adler.
     7
     8        This patch changes the behavior of position: absolute elements when their
     9        containing block has overflow: scroll in RTL scrollbar mode. Previously, we
     10        were only adjusting the overflow calculation for such elements (but not
     11        their position calculation). This patch updates the position calculation,
     12        which automatically makes the overflow calculation work propertly, so the
     13        old calculation is no longer necessary.
     14
     15        This patch also updates iframes to appropriately move their dirty rects
     16        and their painting CTM by the scrollbar width when traversing frame
     17        boundaries. This fixes all our existing RTL scrollbar RTL tests.
     18
     19        The RTL scrollbar tests are only marked as passing on certain OSes, so these
     20        tests are transitioning from failing to passing in that other repository.
     21
     22        Test: fast/scrolling/rtl-scrollbars-positioning.html
     23              fast/scrolling/rtl-scrollbars-overflow-elementFromPoint.html
     24              fast/scrolling/rtl-scrollbars-overflow-position-absolute.html
     25              fast/scrolling/rtl-scrollbars-iframe-offset.html
     26              fast/scrolling/rtl-scrollbars-iframe-position-absolute.html
     27              fast/scrolling/rtl-scrollbars-iframe-scrolled.html
     28              fast/scrolling/rtl-scrollbars-iframe.html
     29
     30        * platform/ScrollView.cpp:
     31        (WebCore::ScrollView::paint):
     32        (WebCore::ScrollView::locationOfContents):
     33        * platform/ScrollView.h:
     34        * platform/graphics/ca/GraphicsLayerCA.cpp:
     35        (WebCore::GraphicsLayerCA::repaintLayerDirtyRects):
     36        * rendering/RenderBlock.cpp:
     37        (WebCore::RenderBlock::addOverflowFromPositionedObjects):
     38        * rendering/RenderBox.cpp:
     39        (WebCore::RenderBox::computePositionedLogicalWidth):
     40        * rendering/RenderView.cpp:
     41        (WebCore::RenderView::repaintViewRectangle):
     42
    1432016-03-22  Antti Koivisto  <antti@apple.com>
    244
  • trunk/Source/WebCore/platform/ScrollView.cpp

    r198455 r198560  
    12231223    IntRect documentDirtyRect = rect;
    12241224    if (!paintsEntireContents()) {
    1225         IntRect visibleAreaWithoutScrollbars(location(), visibleContentRect(LegacyIOSDocumentVisibleRect).size());
     1225        IntRect visibleAreaWithoutScrollbars(locationOfContents(), visibleContentRect(LegacyIOSDocumentVisibleRect).size());
    12261226        documentDirtyRect.intersect(visibleAreaWithoutScrollbars);
    12271227    }
     
    12301230        GraphicsContextStateSaver stateSaver(context);
    12311231
    1232         context.translate(x(), y());
    1233         documentDirtyRect.moveBy(-location());
     1232        IntPoint locationOfContents = this->locationOfContents();
     1233        context.translate(locationOfContents.x(), locationOfContents.y());
     1234        documentDirtyRect.moveBy(-locationOfContents);
    12341235
    12351236        if (!paintsEntireContents()) {
     
    14991500}
    15001501
     1502IntPoint ScrollView::locationOfContents() const
     1503{
     1504    IntPoint result = location();
     1505    if (verticalScrollbarIsOnLeft() && m_verticalScrollbar)
     1506        result.move(m_verticalScrollbar->occupiedWidth(), 0);
     1507    return result;
     1508}
     1509
    15011510#if !PLATFORM(COCOA)
    15021511
  • trunk/Source/WebCore/platform/ScrollView.h

    r198502 r198560  
    7474    virtual void notifyPageThatContentAreaWillPaint() const;
    7575
     76    IntPoint locationOfContents() const;
     77
    7678    // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea.
    7779    virtual void scrollTo(const ScrollPosition&);
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r198189 r198560  
    26762676    }
    26772677
    2678     if (!m_dirtyRects.size())
    2679         return;
    2680 
    2681     for (size_t i = 0; i < m_dirtyRects.size(); ++i)
    2682         m_layer->setNeedsDisplayInRect(m_dirtyRects[i]);
     2678    for (auto& dirtyRect : m_dirtyRects)
     2679        m_layer->setNeedsDisplayInRect(dirtyRect);
    26832680   
    26842681    m_dirtyRects.clear();
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r198074 r198560  
    10641064       
    10651065        // Fixed positioned elements don't contribute to layout overflow, since they don't scroll with the content.
    1066         if (positionedObject->style().position() != FixedPosition) {
    1067             LayoutUnit x = positionedObject->x();
    1068             if (style().shouldPlaceBlockDirectionScrollbarOnLeft())
    1069                 x += (style().isLeftToRightDirection() ? 1 : -1) * verticalScrollbarWidth();
    1070             addOverflowFromChild(positionedObject, LayoutSize(x, positionedObject->y()));
    1071         }
     1066        if (positionedObject->style().position() != FixedPosition)
     1067            addOverflowFromChild(positionedObject, { positionedObject->x(), positionedObject->y() });
    10721068    }
    10731069}
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r198255 r198560  
    35233523
    35243524    computedValues.m_extent += bordersPlusPadding;
     3525    if (is<RenderBox>(*containerBlock)) {
     3526        auto& containingBox = downcast<RenderBox>(*containerBlock);
     3527        if (containingBox.layer() && containingBox.layer()->verticalScrollbarIsOnLeft())
     3528            computedValues.m_position += containingBox.verticalScrollbarWidth();
     3529    }
    35253530   
    35263531    // Adjust logicalLeft if we need to for the flipped version of our writing mode in regions.
  • trunk/Source/WebCore/rendering/RenderView.cpp

    r197716 r198560  
    636636        adjustedRect.moveBy(-viewRect.location());
    637637        adjustedRect.moveBy(ownerBox->contentBoxRect().location());
     638
     639        // A dirty rect in an iframe is relative to the contents of that iframe.
     640        // When we traverse between parent frames and child frames, we need to make sure
     641        // that the coordinate system is mapped appropriately between the iframe's contents
     642        // and the Renderer that contains the iframe. This transformation must account for a
     643        // left scrollbar (if one exists).
     644        FrameView& frameView = this->frameView();
     645        if (frameView.verticalScrollbarIsOnLeft() && frameView.verticalScrollbar())
     646            adjustedRect.move(LayoutSize(frameView.verticalScrollbar()->occupiedWidth(), 0));
     647
    638648        ownerBox->repaintRectangle(adjustedRect);
    639649        return;
Note: See TracChangeset for help on using the changeset viewer.