Changeset 269835 in webkit


Ignore:
Timestamp:
Nov 15, 2020 5:15:09 PM (3 years ago)
Author:
Simon Fraser
Message:

Minor RenderStyle boxShadow cleanup
https://bugs.webkit.org/show_bug.cgi?id=218952

Reviewed by Sam Weinig.

Rename getBoxShadowExtent() to boxShadowExtent() and have it return a LayoutBoxExtent.

Make shadow-related functions static that can be, and private that can be.

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::applyVisualEffectOverflow const):

  • rendering/RenderElement.cpp:

(WebCore::RenderElement::repaintAfterLayoutIfNeeded):

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::shadowExtent):
(WebCore::RenderStyle::shadowInsetExtent):
(WebCore::RenderStyle::getShadowHorizontalExtent):
(WebCore::RenderStyle::getShadowVerticalExtent):
(WebCore::RenderStyle::getShadowExtent const): Deleted.
(WebCore::RenderStyle::getShadowInsetExtent const): Deleted.
(WebCore::RenderStyle::getShadowHorizontalExtent const): Deleted.
(WebCore::RenderStyle::getShadowVerticalExtent const): Deleted.

  • rendering/style/RenderStyle.h:

(WebCore::RenderStyle::boxShadowExtent const):
(WebCore::RenderStyle::boxShadowInsetExtent const):
(WebCore::RenderStyle::getBoxShadowExtent const): Deleted.
(WebCore::RenderStyle::getBoxShadowInsetExtent const): Deleted.

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r269833 r269835  
     12020-11-15  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Minor RenderStyle boxShadow cleanup
     4        https://bugs.webkit.org/show_bug.cgi?id=218952
     5
     6        Reviewed by Sam Weinig.
     7
     8        Rename getBoxShadowExtent() to boxShadowExtent() and have it return a LayoutBoxExtent.
     9
     10        Make shadow-related functions static that can be, and private that can be.
     11
     12        * rendering/RenderBox.cpp:
     13        (WebCore::RenderBox::applyVisualEffectOverflow const):
     14        * rendering/RenderElement.cpp:
     15        (WebCore::RenderElement::repaintAfterLayoutIfNeeded):
     16        * rendering/style/RenderStyle.cpp:
     17        (WebCore::RenderStyle::shadowExtent):
     18        (WebCore::RenderStyle::shadowInsetExtent):
     19        (WebCore::RenderStyle::getShadowHorizontalExtent):
     20        (WebCore::RenderStyle::getShadowVerticalExtent):
     21        (WebCore::RenderStyle::getShadowExtent const): Deleted.
     22        (WebCore::RenderStyle::getShadowInsetExtent const): Deleted.
     23        (WebCore::RenderStyle::getShadowHorizontalExtent const): Deleted.
     24        (WebCore::RenderStyle::getShadowVerticalExtent const): Deleted.
     25        * rendering/style/RenderStyle.h:
     26        (WebCore::RenderStyle::boxShadowExtent const):
     27        (WebCore::RenderStyle::boxShadowInsetExtent const):
     28        (WebCore::RenderStyle::getBoxShadowExtent const): Deleted.
     29        (WebCore::RenderStyle::getBoxShadowInsetExtent const): Deleted.
     30
    1312020-11-15  Andres Gonzalez  <andresg_22@apple.com>
    232
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r269728 r269835  
    46144614    // Compute box-shadow overflow first.
    46154615    if (style().boxShadow()) {
    4616         LayoutUnit shadowLeft;
    4617         LayoutUnit shadowRight;
    4618         LayoutUnit shadowTop;
    4619         LayoutUnit shadowBottom;
    4620         style().getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft);
     4616        auto shadowExtent = style().boxShadowExtent();
    46214617
    46224618        // In flipped blocks writing modes such as vertical-rl, the physical right shadow value is actually at the lower x-coordinate.
    4623         overflowMinX = borderBox.x() + ((!isFlipped || isHorizontal) ? shadowLeft : -shadowRight);
    4624         overflowMaxX = borderBox.maxX() + ((!isFlipped || isHorizontal) ? shadowRight : -shadowLeft);
    4625         overflowMinY = borderBox.y() + ((!isFlipped || !isHorizontal) ? shadowTop : -shadowBottom);
    4626         overflowMaxY = borderBox.maxY() + ((!isFlipped || !isHorizontal) ? shadowBottom : -shadowTop);
     4619        overflowMinX = borderBox.x() + ((!isFlipped || isHorizontal) ? shadowExtent.left() : -shadowExtent.right());
     4620        overflowMaxX = borderBox.maxX() + ((!isFlipped || isHorizontal) ? shadowExtent.right() : -shadowExtent.left());
     4621        overflowMinY = borderBox.y() + ((!isFlipped || !isHorizontal) ? shadowExtent.top() : -shadowExtent.bottom());
     4622        overflowMaxY = borderBox.maxY() + ((!isFlipped || !isHorizontal) ? shadowExtent.bottom() : -shadowExtent.top());
    46274623    }
    46284624
    46294625    // Now compute border-image-outset overflow.
    46304626    if (style().hasBorderImageOutsets()) {
    4631         LayoutBoxExtent borderOutsets = style().borderImageOutsets();
     4627        auto borderOutsets = style().borderImageOutsets();
    46324628       
    46334629        // In flipped blocks writing modes, the physical sides are inverted. For example in vertical-rl, the right
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r269228 r269835  
    12351235    const RenderStyle& outlineStyle = outlineStyleForRepaint();
    12361236    LayoutUnit outlineWidth { outlineStyle.outlineSize() };
    1237     LayoutBoxExtent insetShadowExtent = style().getBoxShadowInsetExtent();
     1237    auto insetShadowExtent = style().boxShadowInsetExtent();
    12381238    LayoutUnit width = absoluteValue(newOutlineBox.width() - oldOutlineBox.width());
    12391239    if (width) {
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r269144 r269835  
    19201920}
    19211921
    1922 void RenderStyle::getShadowExtent(const ShadowData* shadow, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const
    1923 {
    1924     top = 0;
    1925     right = 0;
    1926     bottom = 0;
    1927     left = 0;
     1922LayoutBoxExtent RenderStyle::shadowExtent(const ShadowData* shadow)
     1923{
     1924    LayoutUnit top;
     1925    LayoutUnit right;
     1926    LayoutUnit bottom;
     1927    LayoutUnit left;
    19281928
    19291929    for ( ; shadow; shadow = shadow->next()) {
     
    19371937        left = std::min<LayoutUnit>(left, shadow->x() - extentAndSpread);
    19381938    }
    1939 }
    1940 
    1941 LayoutBoxExtent RenderStyle::getShadowInsetExtent(const ShadowData* shadow) const
     1939   
     1940    return { top, right, bottom, left };
     1941}
     1942
     1943LayoutBoxExtent RenderStyle::shadowInsetExtent(const ShadowData* shadow)
    19421944{
    19431945    LayoutUnit top;
     
    19571959    }
    19581960
    1959     return LayoutBoxExtent(WTFMove(top), WTFMove(right), WTFMove(bottom), WTFMove(left));
    1960 }
    1961 
    1962 void RenderStyle::getShadowHorizontalExtent(const ShadowData* shadow, LayoutUnit &left, LayoutUnit &right) const
     1961    return { top, right, bottom, left };
     1962}
     1963
     1964void RenderStyle::getShadowHorizontalExtent(const ShadowData* shadow, LayoutUnit &left, LayoutUnit &right)
    19631965{
    19641966    left = 0;
     
    19751977}
    19761978
    1977 void RenderStyle::getShadowVerticalExtent(const ShadowData* shadow, LayoutUnit &top, LayoutUnit &bottom) const
     1979void RenderStyle::getShadowVerticalExtent(const ShadowData* shadow, LayoutUnit &top, LayoutUnit &bottom)
    19781980{
    19791981    top = 0;
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r269820 r269835  
    564564
    565565    const ShadowData* boxShadow() const { return m_rareNonInheritedData->boxShadow.get(); }
    566     void getBoxShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(boxShadow(), top, right, bottom, left); }
    567     LayoutBoxExtent getBoxShadowInsetExtent() const { return getShadowInsetExtent(boxShadow()); }
     566    LayoutBoxExtent boxShadowExtent() const { return shadowExtent(boxShadow()); }
     567    LayoutBoxExtent boxShadowInsetExtent() const { return shadowInsetExtent(boxShadow()); }
    568568    void getBoxShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(boxShadow(), left, right); }
    569569    void getBoxShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(boxShadow(), top, bottom); }
     
    17781778
    17791779    void inheritUnicodeBidiFrom(const RenderStyle* parent) { m_nonInheritedFlags.unicodeBidi = parent->m_nonInheritedFlags.unicodeBidi; }
    1780     void getShadowExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const;
    1781     void getShadowHorizontalExtent(const ShadowData*, LayoutUnit& left, LayoutUnit& right) const;
    1782     void getShadowVerticalExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& bottom) const;
     1780
    17831781    void getShadowInlineDirectionExtent(const ShadowData*, LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const;
    17841782    void getShadowBlockDirectionExtent(const ShadowData*, LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const;
     
    19131911    void setContent(std::unique_ptr<ContentData>, bool add);
    19141912
    1915     LayoutBoxExtent getShadowInsetExtent(const ShadowData*) const;
    1916 
    19171913    static bool isDisplayReplacedType(DisplayType);
    19181914    static bool isDisplayInlineType(DisplayType);
     
    19201916    static bool isDisplayGridBox(DisplayType);
    19211917    static bool isDisplayFlexibleOrGridBox(DisplayType);
     1918
     1919    static LayoutBoxExtent shadowExtent(const ShadowData*);
     1920    static LayoutBoxExtent shadowInsetExtent(const ShadowData*);
     1921    static void getShadowHorizontalExtent(const ShadowData*, LayoutUnit& left, LayoutUnit& right);
     1922    static void getShadowVerticalExtent(const ShadowData*, LayoutUnit& top, LayoutUnit& bottom);
    19221923
    19231924    Color colorResolvingCurrentColor(CSSPropertyID colorProperty, bool visitedLink) const;
Note: See TracChangeset for help on using the changeset viewer.