Changeset 295715 in webkit


Ignore:
Timestamp:
Jun 21, 2022, 7:41:14 PM (3 years ago)
Author:
Alan Bujtas
Message:

RenderBox::hasHorizontalLayoutOverflow/hasVerticalLayoutOverflow use incorrect coordinate space
https://bugs.webkit.org/show_bug.cgi?id=241796

Reviewed by Simon Fraser.

RenderBox::x() and y() are in the coordinate space of the containing block while layoutOverflowRect is relative to the box's border box. These functions would compute overflow true if the box happens to have some offset (through margin or positioning) even without actual overflow.

  • LayoutTests/fast/overflow/horizontal-overflow-with-offset-expected.txt: Added.
  • LayoutTests/fast/overflow/horizontal-overflow-with-offset.html: Added.
  • LayoutTests/fast/overflow/vertical-overflow-with-offset-expected.txt: Added.
  • LayoutTests/fast/overflow/vertical-overflow-with-offset.html: Added.
  • Source/WebCore/rendering/RenderBox.h:

(WebCore::RenderBox::hasHorizontalLayoutOverflow const):
(WebCore::RenderBox::hasVerticalLayoutOverflow const):

Canonical link: https://commits.webkit.org/251720@main

Location:
trunk
Files:
4 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/rendering/RenderBox.h

    r295399 r295715  
    626626            return false;
    627627
    628         LayoutRect layoutOverflowRect = m_overflow->layoutOverflowRect();
    629         flipForWritingMode(layoutOverflowRect);
    630         return layoutOverflowRect.x() < x() || layoutOverflowRect.maxX() > x() + logicalWidth();
     628        auto layoutOverflowRect = m_overflow->layoutOverflowRect();
     629        auto paddingBoxRect = flippedClientBoxRect();
     630        return layoutOverflowRect.x() < paddingBoxRect.x() || layoutOverflowRect.maxX() > paddingBoxRect.maxX();
    631631    }
    632632
     
    636636            return false;
    637637
    638         LayoutRect layoutOverflowRect = m_overflow->layoutOverflowRect();
    639         flipForWritingMode(layoutOverflowRect);
    640         return layoutOverflowRect.y() < y() || layoutOverflowRect.maxY() > y() + logicalHeight();
     638        auto layoutOverflowRect = m_overflow->layoutOverflowRect();
     639        auto paddingBoxRect = flippedClientBoxRect();
     640        return layoutOverflowRect.y() < paddingBoxRect.y() || layoutOverflowRect.maxY() > paddingBoxRect.maxY();
    641641    }
    642642
Note: See TracChangeset for help on using the changeset viewer.