⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 246389 in webkit


Ignore:
Timestamp:
Jun 12, 2019, 8:21:36 PM (7 years ago)
Author:
Simon Fraser
Message:

paddingBoxRect() is wrong with RTL scrollbars on the left
https://bugs.webkit.org/show_bug.cgi?id=198816

Reviewed by Jon Lee.

Source/WebCore:

RenderBox::paddingBoxRect() needs to offset the left side of the box for the
vertical scrollbar, if it's placed on the left.

Test: compositing/geometry/rtl-overflow-scroll.html

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::paddingBoxRect const):

  • rendering/RenderBox.h:

(WebCore::RenderBox::paddingBoxRect const): Deleted.

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::updateGeometry):

  • rendering/RenderListBox.cpp:

(WebCore::RenderListBox::controlClipRect const):

LayoutTests:

  • compositing/geometry/rtl-overflow-scroll-expected.html: Added.
  • compositing/geometry/rtl-overflow-scroll.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r246387 r246389  
     12019-06-12  Simon Fraser  <simon.fraser@apple.com>
     2
     3        paddingBoxRect() is wrong with RTL scrollbars on the left
     4        https://bugs.webkit.org/show_bug.cgi?id=198816
     5
     6        Reviewed by Jon Lee.
     7
     8        * compositing/geometry/rtl-overflow-scroll-expected.html: Added.
     9        * compositing/geometry/rtl-overflow-scroll.html: Added.
     10
    1112019-06-12  Eric Carlson  <eric.carlson@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r246388 r246389  
     12019-06-12  Simon Fraser  <simon.fraser@apple.com>
     2
     3        paddingBoxRect() is wrong with RTL scrollbars on the left
     4        https://bugs.webkit.org/show_bug.cgi?id=198816
     5
     6        Reviewed by Jon Lee.
     7
     8        RenderBox::paddingBoxRect() needs to offset the left side of the box for the
     9        vertical scrollbar, if it's placed on the left.
     10
     11        Test: compositing/geometry/rtl-overflow-scroll.html
     12
     13        * rendering/RenderBox.cpp:
     14        (WebCore::RenderBox::paddingBoxRect const):
     15        * rendering/RenderBox.h:
     16        (WebCore::RenderBox::paddingBoxRect const): Deleted.
     17        * rendering/RenderLayerBacking.cpp:
     18        (WebCore::RenderLayerBacking::updateGeometry):
     19        * rendering/RenderListBox.cpp:
     20        (WebCore::RenderListBox::controlClipRect const):
     21
    1222019-06-12  Youenn Fablet  <youenn@apple.com>
    223
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r245543 r246389  
    659659}
    660660
     661LayoutRect RenderBox::paddingBoxRect() const
     662{
     663    auto verticalScrollbarWidth = this->verticalScrollbarWidth();
     664    LayoutUnit offsetForScrollbar = shouldPlaceBlockDirectionScrollbarOnLeft() ? verticalScrollbarWidth : 0;
     665
     666    return LayoutRect(borderLeft() + offsetForScrollbar, borderTop(),
     667        width() - borderLeft() - borderRight() - verticalScrollbarWidth,
     668        height() - borderTop() - borderBottom() - horizontalScrollbarHeight());
     669}
     670
    661671LayoutRect RenderBox::contentBoxRect() const
    662672{
  • trunk/Source/WebCore/rendering/RenderBox.h

    r245543 r246389  
    220220    LayoutUnit paddingBoxWidth() const { return width() - borderLeft() - borderRight() - verticalScrollbarWidth(); }
    221221    LayoutUnit paddingBoxHeight() const { return height() - borderTop() - borderBottom() - horizontalScrollbarHeight(); }
    222     LayoutRect paddingBoxRect() const { return LayoutRect(borderLeft(), borderTop(), paddingBoxWidth(), paddingBoxHeight()); }
     222    LayoutRect paddingBoxRect() const;
    223223    LayoutRect paddingBoxRectIncludingScrollbar() const { return LayoutRect(borderLeft(), borderTop(), width() - borderLeft() - borderRight(), height() - borderTop() - borderBottom()); }
    224224
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r246301 r246389  
    12171217        ASSERT(m_scrolledContentsLayer);
    12181218        auto& renderBox = downcast<RenderBox>(renderer());
    1219         LayoutRect paddingBoxIncludingScrollbar = renderBox.paddingBoxRectIncludingScrollbar();
     1219        LayoutRect paddingBox = renderBox.paddingBoxRect();
    12201220        LayoutRect parentLayerBounds = clippingLayer() ? clippingBox : compositedBounds();
    12211221
    12221222        // FIXME: need to do some pixel snapping here.
    1223         m_scrollContainerLayer->setPosition(FloatPoint(paddingBoxIncludingScrollbar.location() - parentLayerBounds.location()));
     1223        m_scrollContainerLayer->setPosition(FloatPoint(paddingBox.location() - parentLayerBounds.location()));
    12241224        m_scrollContainerLayer->setSize(roundedIntSize(LayoutSize(renderBox.paddingBoxWidth(), renderBox.paddingBoxHeight())));
    12251225
     
    12311231
    12321232        FloatSize oldScrollingLayerOffset = m_scrollContainerLayer->offsetFromRenderer();
    1233         m_scrollContainerLayer->setOffsetFromRenderer(toFloatSize(paddingBoxIncludingScrollbar.location()));
     1233        m_scrollContainerLayer->setOffsetFromRenderer(toFloatSize(paddingBox.location()));
    12341234
    12351235        if (m_childClippingMaskLayer) {
    12361236            m_childClippingMaskLayer->setPosition(m_scrollContainerLayer->position());
    12371237            m_childClippingMaskLayer->setSize(m_scrollContainerLayer->size());
    1238             m_childClippingMaskLayer->setOffsetFromRenderer(toFloatSize(paddingBoxIncludingScrollbar.location()));
     1238            m_childClippingMaskLayer->setOffsetFromRenderer(toFloatSize(paddingBox.location()));
    12391239        }
    12401240
     
    12471247        m_scrolledContentsLayer->setSize(scrollSize);
    12481248        m_scrolledContentsLayer->setScrollOffset(scrollOffset, GraphicsLayer::DontSetNeedsDisplay);
    1249         m_scrolledContentsLayer->setOffsetFromRenderer(toLayoutSize(paddingBoxIncludingScrollbar.location()), GraphicsLayer::DontSetNeedsDisplay);
     1249        m_scrolledContentsLayer->setOffsetFromRenderer(toLayoutSize(paddingBox.location()), GraphicsLayer::DontSetNeedsDisplay);
    12501250       
    12511251        adjustTiledBackingCoverage();
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r246285 r246389  
    805805    // to get painted.
    806806    LayoutRect clipRect = paddingBoxRect();
    807     if (shouldPlaceBlockDirectionScrollbarOnLeft())
    808         clipRect.move(m_vBar->occupiedWidth(), 0);
    809807    clipRect.moveBy(additionalOffset);
    810808    return clipRect;
Note: See TracChangeset for help on using the changeset viewer.