Skip to content

Commit

Permalink
Rename RenderStyle effectiveContainment() to usedContain() & effectiv…
Browse files Browse the repository at this point in the history
…eStrokeColorProperty() to usedStrokeColorProperty()

https://bugs.webkit.org/show_bug.cgi?id=270969

Reviewed by Tim Nguyen.

This aligns them with terminology used in CSS standards.

* Source/WebCore/layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::isLayoutContainmentBox const):
(WebCore::Layout::Box::isSizeContainmentBox const):
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::updateFromStyle):
* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::rareDataChangeRequiresLayout):
(WebCore::RenderStyle::colorResolvingCurrentColor const):
(WebCore::RenderStyle::computedStrokeColor const):
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/RenderStyleInlines.h:
(WebCore::RenderStyle::containsInlineSize const):
(WebCore::RenderStyle::containsLayout const):
(WebCore::RenderStyle::containsLayoutOrPaint const):
(WebCore::RenderStyle::containsPaint const):
(WebCore::RenderStyle::containsSize const):
(WebCore::RenderStyle::containsSizeOrInlineSize const):
(WebCore::RenderStyle::containsStyle const):
(WebCore::RenderStyle::usedContain const):
(WebCore::RenderStyle::usedStrokeColorProperty const):
(WebCore::RenderStyle::effectiveContainment const): Deleted.
(WebCore::RenderStyle::effectiveStrokeColorProperty const): Deleted.
* Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::usedContain const):
(WebCore::StyleRareNonInheritedData::effectiveContainment const): Deleted.
* Source/WebCore/rendering/style/StyleRareNonInheritedData.h:
* Source/WebCore/style/StyleAdjuster.cpp:
(WebCore::Style::Adjuster::propagateToDocumentElementAndInitialContainingBlock):

Canonical link: https://commits.webkit.org/276156@main
  • Loading branch information
annevk committed Mar 15, 2024
1 parent dfd8b28 commit 6518b4a
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions Source/WebCore/layout/layouttree/LayoutBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ bool Box::isLayoutContainmentBox() const
return isAtomicInlineLevelBox();
return true;
};
return m_style.effectiveContainment().contains(Containment::Layout) && supportsLayoutContainment();
return m_style.usedContain().contains(Containment::Layout) && supportsLayoutContainment();
}

bool Box::isRubyAnnotationBox() const
Expand Down Expand Up @@ -327,7 +327,7 @@ bool Box::isSizeContainmentBox() const
return isAtomicInlineLevelBox();
return true;
};
return m_style.effectiveContainment().contains(Containment::Size) && supportsSizeContainment();
return m_style.usedContain().contains(Containment::Size) && supportsSizeContainment();
}

bool Box::isInternalTableBox() const
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/rendering/RenderBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,8 @@ void RenderBox::updateFromStyle()
if (is<HTMLHtmlElement>(documentElement)
&& document().body() == element()
&& documentElementRenderer.effectiveOverflowX() == Overflow::Visible
&& !styleToUse.effectiveContainment()
&& !documentElementRenderer.style().effectiveContainment()) {
&& !styleToUse.usedContain()
&& !documentElementRenderer.style().usedContain()) {
boxHasNonVisibleOverflow = false;
}
}
Expand Down
8 changes: 4 additions & 4 deletions Source/WebCore/rendering/style/RenderStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,8 +845,8 @@ static bool rareDataChangeRequiresLayout(const StyleRareNonInheritedData& first,
if (first.inputSecurity != second.inputSecurity)
return true;

if (first.effectiveContainment().contains(Containment::Size) != second.effectiveContainment().contains(Containment::Size)
|| first.effectiveContainment().contains(Containment::InlineSize) != second.effectiveContainment().contains(Containment::InlineSize))
if (first.usedContain().contains(Containment::Size) != second.usedContain().contains(Containment::Size)
|| first.usedContain().contains(Containment::InlineSize) != second.usedContain().contains(Containment::InlineSize))
return true;

// content-visibiliy:hidden turns on contain:size which requires relayout.
Expand Down Expand Up @@ -3030,7 +3030,7 @@ Color RenderStyle::colorResolvingCurrentColor(CSSPropertyID colorProperty, bool
if (colorProperty == CSSPropertyTextDecorationColor) {
if (hasPositiveStrokeWidth()) {
// Prefer stroke color if possible but not if it's fully transparent.
auto strokeColor = colorResolvingCurrentColor(effectiveStrokeColorProperty(), visitedLink);
auto strokeColor = colorResolvingCurrentColor(usedStrokeColorProperty(), visitedLink);
if (strokeColor.isVisible())
return strokeColor;
}
Expand Down Expand Up @@ -3776,7 +3776,7 @@ bool RenderStyle::hasPositiveStrokeWidth() const

Color RenderStyle::computedStrokeColor() const
{
return visitedDependentColor(effectiveStrokeColorProperty());
return visitedDependentColor(usedStrokeColorProperty());
}

UsedClear RenderStyle::usedClear(const RenderObject& renderer)
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/rendering/style/RenderStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ class RenderStyle {
inline BoxSizing boxSizingForAspectRatio() const;
inline bool hasAspectRatio() const;
inline OptionSet<Containment> contain() const;
inline OptionSet<Containment> effectiveContainment() const;
inline OptionSet<Containment> usedContain() const;
inline bool containsLayout() const;
inline bool containsSize() const;
inline bool containsInlineSize() const;
Expand Down Expand Up @@ -1631,7 +1631,7 @@ class RenderStyle {
inline bool hasExplicitlySetStrokeColor() const;
static inline StyleColor initialStrokeColor();
Color computedStrokeColor() const;
inline CSSPropertyID effectiveStrokeColorProperty() const;
inline CSSPropertyID usedStrokeColorProperty() const;

inline float strokeMiterLimit() const;
inline void setStrokeMiterLimit(float);
Expand Down
18 changes: 9 additions & 9 deletions Source/WebCore/rendering/style/RenderStyleInlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,23 +183,23 @@ inline std::optional<Length> RenderStyle::containIntrinsicWidth() const { return
inline ContainIntrinsicSizeType RenderStyle::containIntrinsicWidthType() const { return static_cast<ContainIntrinsicSizeType>(m_nonInheritedData->rareData->containIntrinsicWidthType); }
inline const Vector<Style::ScopedName>& RenderStyle::containerNames() const { return m_nonInheritedData->rareData->containerNames; }
inline ContainerType RenderStyle::containerType() const { return static_cast<ContainerType>(m_nonInheritedData->rareData->containerType); }
inline bool RenderStyle::containsInlineSize() const { return effectiveContainment().contains(Containment::InlineSize); }
inline bool RenderStyle::containsLayout() const { return effectiveContainment().contains(Containment::Layout); }
inline bool RenderStyle::containsLayoutOrPaint() const { return effectiveContainment().containsAny({ Containment::Layout, Containment::Paint }); }
inline bool RenderStyle::containsPaint() const { return effectiveContainment().contains(Containment::Paint); }
inline bool RenderStyle::containsSize() const { return effectiveContainment().contains(Containment::Size); }
inline bool RenderStyle::containsSizeOrInlineSize() const { return effectiveContainment().containsAny({ Containment::Size, Containment::InlineSize }); }
inline bool RenderStyle::containsStyle() const { return effectiveContainment().contains(Containment::Style); }
inline bool RenderStyle::containsInlineSize() const { return usedContain().contains(Containment::InlineSize); }
inline bool RenderStyle::containsLayout() const { return usedContain().contains(Containment::Layout); }
inline bool RenderStyle::containsLayoutOrPaint() const { return usedContain().containsAny({ Containment::Layout, Containment::Paint }); }
inline bool RenderStyle::containsPaint() const { return usedContain().contains(Containment::Paint); }
inline bool RenderStyle::containsSize() const { return usedContain().contains(Containment::Size); }
inline bool RenderStyle::containsSizeOrInlineSize() const { return usedContain().containsAny({ Containment::Size, Containment::InlineSize }); }
inline bool RenderStyle::containsStyle() const { return usedContain().contains(Containment::Style); }
constexpr OptionSet<Containment> RenderStyle::contentContainment() { return { Containment::Layout, Containment::Paint, Containment::Style }; }
inline const ContentData* RenderStyle::contentData() const { return m_nonInheritedData->miscData->content.get(); }
inline bool RenderStyle::contentDataEquivalent(const RenderStyle* otherStyle) const { return m_nonInheritedData->miscData->contentDataEquivalent(*otherStyle->m_nonInheritedData->miscData); }
inline ContentVisibility RenderStyle::contentVisibility() const { return static_cast<ContentVisibility>(m_nonInheritedData->rareData->contentVisibility); }
inline CursorList* RenderStyle::cursors() const { return m_rareInheritedData->cursorData.get(); }
inline StyleAppearance RenderStyle::usedAppearance() const { return static_cast<StyleAppearance>(m_nonInheritedData->miscData->usedAppearance); }
inline OptionSet<Containment> RenderStyle::effectiveContainment() const { return m_nonInheritedData->rareData->effectiveContainment(); }
inline OptionSet<Containment> RenderStyle::usedContain() const { return m_nonInheritedData->rareData->usedContain(); }
inline bool RenderStyle::effectiveInert() const { return m_rareInheritedData->effectiveInert; }
inline PointerEvents RenderStyle::usedPointerEvents() const { return effectiveInert() ? PointerEvents::None : pointerEvents(); }
inline CSSPropertyID RenderStyle::effectiveStrokeColorProperty() const { return hasExplicitlySetStrokeColor() ? CSSPropertyStrokeColor : CSSPropertyWebkitTextStrokeColor; }
inline CSSPropertyID RenderStyle::usedStrokeColorProperty() const { return hasExplicitlySetStrokeColor() ? CSSPropertyStrokeColor : CSSPropertyWebkitTextStrokeColor; }
inline OptionSet<TouchAction> RenderStyle::usedTouchActions() const { return m_rareInheritedData->usedTouchActions; }
inline UserModify RenderStyle::usedUserModify() const { return effectiveInert() ? UserModify::ReadOnly : userModify(); }
inline float RenderStyle::usedZoom() const { return m_rareInheritedData->usedZoom; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
&& fieldSizing == o.fieldSizing;
}

OptionSet<Containment> StyleRareNonInheritedData::effectiveContainment() const
OptionSet<Containment> StyleRareNonInheritedData::usedContain() const
{
auto containment = contain;

Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/style/StyleRareNonInheritedData.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class StyleRareNonInheritedData : public RefCounted<StyleRareNonInheritedData> {

bool hasBackdropFilters() const;

OptionSet<Containment> effectiveContainment() const;
OptionSet<Containment> usedContain() const;

std::optional<Length> containIntrinsicWidth;
std::optional<Length> containIntrinsicHeight;
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/style/StyleAdjuster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -985,9 +985,9 @@ void Adjuster::propagateToDocumentElementAndInitialContainingBlock(Update& updat
// "Additionally, when any containments are active on either the HTML html or body elements, propagation of
// properties from the body element to the initial containing block, the viewport, or the canvas background, is disabled."
auto shouldPropagateFromBody = [&] {
if (bodyStyle && !bodyStyle->effectiveContainment().isEmpty())
if (bodyStyle && !bodyStyle->usedContain().isEmpty())
return false;
return documentElementStyle->effectiveContainment().isEmpty();
return documentElementStyle->usedContain().isEmpty();
}();

auto writingMode = [&] {
Expand Down

0 comments on commit 6518b4a

Please sign in to comment.