Changeset 269825 in webkit


Ignore:
Timestamp:
Nov 15, 2020 6:23:23 AM (3 years ago)
Author:
Alan Bujtas
Message:

[LFC][Geometry] Add support for horizontal/vertical scrollbar spacing
https://bugs.webkit.org/show_bug.cgi?id=218950

Reviewed by Antti Koivisto.

Let's make room for visible scrollbars between the border and the padding box.

  • layout/integration/LayoutIntegrationLineLayout.cpp:

(WebCore::LayoutIntegration::LineLayout::updateLayoutBoxDimensions):

  • layout/layouttree/LayoutBoxGeometry.cpp:

(WebCore::Layout::BoxGeometry::BoxGeometry):
(WebCore::Layout::BoxGeometry::paddingBox const):

  • layout/layouttree/LayoutBoxGeometry.h:

(WebCore::Layout::BoxGeometry::borderBoxHeight const):
(WebCore::Layout::BoxGeometry::borderBoxWidth const):
(WebCore::Layout::BoxGeometry::verticalScrollbarWidth const):
(WebCore::Layout::BoxGeometry::horizontalScrollbarHeight const):
(WebCore::Layout::BoxGeometry::setVerticalScrollbarWidth):
(WebCore::Layout::BoxGeometry::setHorizontalScrollbarHeight):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r269824 r269825  
     12020-11-15  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][Geometry] Add support for horizontal/vertical scrollbar spacing
     4        https://bugs.webkit.org/show_bug.cgi?id=218950
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Let's make room for visible scrollbars between the border and the padding box.
     9
     10        * layout/integration/LayoutIntegrationLineLayout.cpp:
     11        (WebCore::LayoutIntegration::LineLayout::updateLayoutBoxDimensions):
     12        * layout/layouttree/LayoutBoxGeometry.cpp:
     13        (WebCore::Layout::BoxGeometry::BoxGeometry):
     14        (WebCore::Layout::BoxGeometry::paddingBox const):
     15        * layout/layouttree/LayoutBoxGeometry.h:
     16        (WebCore::Layout::BoxGeometry::borderBoxHeight const):
     17        (WebCore::Layout::BoxGeometry::borderBoxWidth const):
     18        (WebCore::Layout::BoxGeometry::verticalScrollbarWidth const):
     19        (WebCore::Layout::BoxGeometry::horizontalScrollbarHeight const):
     20        (WebCore::Layout::BoxGeometry::setVerticalScrollbarWidth):
     21        (WebCore::Layout::BoxGeometry::setHorizontalScrollbarHeight):
     22
    1232020-11-15  Tim Horton  <timothy_horton@apple.com>
    224
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp

    r269818 r269825  
    128128    replacedBox.setContentSizeForIntegration({ replacedOrInlineBlock.contentWidth(), replacedOrInlineBlock.contentHeight() });
    129129
     130    auto& replacedBoxGeometry = m_layoutState.ensureGeometryForBox(replacedBox);
     131    replacedBoxGeometry.setVerticalScrollbarWidth(replacedOrInlineBlock.verticalScrollbarWidth());
     132    replacedBoxGeometry.setHorizontalScrollbarHeight(replacedOrInlineBlock.horizontalScrollbarHeight());
     133
    130134    auto baseline = replacedOrInlineBlock.baselinePosition(AlphabeticBaseline, false /* firstLine */, HorizontalLine, PositionOnContainingLine);
    131135    replacedBox.setBaseline(baseline);
  • trunk/Source/WebCore/layout/layouttree/LayoutBoxGeometry.cpp

    r268948 r269825  
    4444    , m_border(other.m_border)
    4545    , m_padding(other.m_padding)
     46    , m_verticalScrollbarWidth(other.m_verticalScrollbarWidth)
     47    , m_horizontalScrollbarHeight(other.m_horizontalScrollbarHeight)
    4648#if ASSERT_ENABLED
    4749    , m_hasValidTop(other.m_hasValidTop)
     
    8991    paddingBox.setTop(borderBox.top() + borderTop());
    9092    paddingBox.setLeft(borderBox.left() + borderLeft());
    91     paddingBox.setHeight(borderBox.bottom() - borderTop() - borderBottom());
    92     paddingBox.setWidth(borderBox.width() - borderLeft() - borderRight());
     93    paddingBox.setHeight(borderBox.bottom() - horizontalScrollbarHeight() - borderBottom() - borderTop());
     94    paddingBox.setWidth(borderBox.width() - borderRight() - verticalScrollbarWidth() - borderLeft());
    9395    return paddingBox;
    9496}
  • trunk/Source/WebCore/layout/layouttree/LayoutBoxGeometry.h

    r268948 r269825  
    9292    LayoutUnit paddingBoxWidth() const { return paddingLeft().valueOr(0) + contentBoxWidth() + paddingRight().valueOr(0); }
    9393
    94     LayoutUnit borderBoxHeight() const { return borderTop() + paddingBoxHeight() + borderBottom(); }
    95     LayoutUnit borderBoxWidth() const { return borderLeft() + paddingBoxWidth() + borderRight(); }
     94    LayoutUnit borderBoxHeight() const { return borderTop() + paddingBoxHeight() + horizontalScrollbarHeight() + borderBottom(); }
     95    LayoutUnit borderBoxWidth() const { return borderLeft() + paddingBoxWidth() + verticalScrollbarWidth() + borderRight(); }
    9696    LayoutUnit marginBoxHeight() const { return marginBefore() + borderBoxHeight() + marginAfter(); }
    9797    LayoutUnit marginBoxWidth() const { return marginStart() + borderBoxWidth() + marginEnd(); }
     
    9999    LayoutUnit verticalMarginBorderAndPadding() const { return marginBefore() + verticalBorder() + verticalPadding().valueOr(0) + marginAfter(); }
    100100    LayoutUnit horizontalMarginBorderAndPadding() const { return marginStart() + horizontalBorder() + horizontalPadding().valueOr(0) + marginEnd(); }
     101
     102    LayoutUnit verticalScrollbarWidth() const { return m_verticalScrollbarWidth; }
     103    LayoutUnit horizontalScrollbarHeight() const { return m_horizontalScrollbarHeight; }
    101104
    102105    Rect marginBox() const;
     
    128131    void setPadding(Optional<Layout::Edges>);
    129132
     133    void setVerticalScrollbarWidth(LayoutUnit width) { m_verticalScrollbarWidth = width; }
     134    void setHorizontalScrollbarHeight(LayoutUnit height) { m_horizontalScrollbarHeight = height; }
     135
    130136private:
    131137    LayoutUnit logicalTop() const;
     
    160166    Layout::Edges m_border;
    161167    Optional<Layout::Edges> m_padding;
     168
     169    LayoutUnit m_verticalScrollbarWidth;
     170    LayoutUnit m_horizontalScrollbarHeight;
    162171
    163172#if ASSERT_ENABLED
Note: See TracChangeset for help on using the changeset viewer.