Skip to content

Commit 3996476

Browse files
committed
[text-box] Make text-box-edge inherited per spec update
https://bugs.webkit.org/show_bug.cgi?id=281590 rdar://138049359 Reviewed by NOBODY (OOPS!). See w3c/csswg-drafts#10904 * LayoutTests/imported/w3c/web-platform-tests/css/css-inline/text-box-trim/parsing/inheritance-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-inline/text-box-trim/parsing/inheritance.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-inline/text-box-trim/text-box-trim-accumulation-001.html: * Source/WebCore/css/CSSProperties.json: * Source/WebCore/rendering/style/RenderStyle.cpp: (WebCore::rareDataChangeRequiresLayout): (WebCore::rareInheritedDataChangeRequiresLayout): (WebCore::RenderStyle::conservativelyCollectChangedAnimatableProperties const): (WebCore::RenderStyle::textBoxEdge const): (WebCore::RenderStyle::setTextBoxEdge): (WebCore::RenderStyle::setLineFitEdge): * Source/WebCore/rendering/style/StyleRareInheritedData.cpp: (WebCore::StyleRareInheritedData::StyleRareInheritedData): (WebCore::StyleRareInheritedData::operator== const): * Source/WebCore/rendering/style/StyleRareInheritedData.h: * Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): (WebCore::StyleRareNonInheritedData::operator== const): * Source/WebCore/rendering/style/StyleRareNonInheritedData.h:
1 parent ae4bc13 commit 3996476

File tree

9 files changed

+16
-18
lines changed

9 files changed

+16
-18
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
PASS Property text-box-edge has initial value auto
3-
PASS Property text-box-edge does not inherit
3+
PASS Property text-box-edge inherits
44
PASS Property text-box-trim has initial value none
55
PASS Property text-box-trim does not inherit
66

LayoutTests/imported/w3c/web-platform-tests/css/css-inline/text-box-trim/parsing/inheritance.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
<div id="target">div>
1010
div>
1111
<script>
12-
assert_not_inherited('text-box-edge', 'auto', 'cap');
12+
assert_inherited('text-box-edge', 'auto', 'cap');
1313
assert_not_inherited('text-box-trim', 'none', 'trim-start');
1414
script>

LayoutTests/imported/w3c/web-platform-tests/css/css-inline/text-box-trim/text-box-trim-accumulation-001.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
}
1818
.target {
1919
font: 100px/2 MetricsTestFont;
20+
text-box-edge: auto;
2021
}
2122
.target, .outer {
2223
text-box-trim: trim-start;

Source/WebCore/css/CSSProperties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@
670670
}
671671
},
672672
"text-box-edge": {
673-
"inherited": false,
673+
"inherited": true,
674674
"values": [
675675
"auto",
676676
"text",

Source/WebCore/rendering/style/RenderStyle.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -878,9 +878,6 @@ static bool rareDataChangeRequiresLayout(const StyleRareNonInheritedData& first,
878878
if (first.textBoxTrim != second.textBoxTrim)
879879
return true;
880880

881-
if (first.textBoxEdge != second.textBoxEdge)
882-
return true;
883-
884881
if (first.maxLines != second.maxLines)
885882
return true;
886883

@@ -898,6 +895,7 @@ static bool rareInheritedDataChangeRequiresLayout(const StyleRareInheritedData&
898895
|| first.textAlignLast != second.textAlignLast
899896
|| first.textJustify != second.textJustify
900897
|| first.textIndentLine != second.textIndentLine
898+
|| first.textBoxEdge != second.textBoxEdge
901899
|| first.lineFitEdge != second.lineFitEdge
902900
|| first.usedZoom != second.usedZoom
903901
|| first.textZoom != second.textZoom
@@ -1946,8 +1944,6 @@ void RenderStyle::conservativelyCollectChangedAnimatableProperties(const RenderS
19461944
changingProperties.m_properties.set(CSSPropertyScrollSnapStop);
19471945
if (first.scrollSnapType != second.scrollSnapType)
19481946
changingProperties.m_properties.set(CSSPropertyScrollSnapType);
1949-
if (first.textBoxEdge != second.textBoxEdge)
1950-
changingProperties.m_properties.set(CSSPropertyTextBoxEdge);
19511947
if (first.maxLines != second.maxLines)
19521948
changingProperties.m_properties.set(CSSPropertyMaxLines);
19531949
if (first.overflowContinue != second.overflowContinue)
@@ -2081,6 +2077,8 @@ void RenderStyle::conservativelyCollectChangedAnimatableProperties(const RenderS
20812077
changingProperties.m_properties.set(CSSPropertyImageRendering);
20822078
if (first.textAlignLast != second.textAlignLast)
20832079
changingProperties.m_properties.set(CSSPropertyTextAlignLast);
2080+
if (first.textBoxEdge != second.textBoxEdge)
2081+
changingProperties.m_properties.set(CSSPropertyTextBoxEdge);
20842082
if (first.lineFitEdge != second.lineFitEdge)
20852083
changingProperties.m_properties.set(CSSPropertyLineFitEdge);
20862084
if (first.textJustify != second.textJustify)
@@ -3766,12 +3764,12 @@ bool RenderStyle::hasSnapPosition() const
37663764

37673765
TextEdge RenderStyle::textBoxEdge() const
37683766
{
3769-
return m_nonInheritedData->rareData->textBoxEdge;
3767+
return m_rareInheritedData->textBoxEdge;
37703768
}
37713769

3772-
void RenderStyle::setTextBoxEdge(TextEdge textBoxEdgeValue)
3770+
void RenderStyle::setTextBoxEdge(TextEdge value)
37733771
{
3774-
SET_NESTED_VAR(m_nonInheritedData, rareData, textBoxEdge, textBoxEdgeValue);
3772+
SET_VAR(m_rareInheritedData, textBoxEdge, value);
37753773
}
37763774

37773775
TextEdge RenderStyle::initialTextBoxEdge()
@@ -3784,9 +3782,9 @@ TextEdge RenderStyle::lineFitEdge() const
37843782
return m_rareInheritedData->lineFitEdge;
37853783
}
37863784

3787-
void RenderStyle::setLineFitEdge(TextEdge lineFitEdgeValue)
3785+
void RenderStyle::setLineFitEdge(TextEdge value)
37883786
{
3789-
SET_VAR(m_rareInheritedData, lineFitEdge, lineFitEdgeValue);
3787+
SET_VAR(m_rareInheritedData, lineFitEdge, value);
37903788
}
37913789

37923790
TextEdge RenderStyle::initialLineFitEdge()

Source/WebCore/rendering/style/StyleRareInheritedData.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ StyleRareInheritedData::StyleRareInheritedData()
8787
, indent(RenderStyle::initialTextIndent())
8888
, usedZoom(RenderStyle::initialZoom())
8989
, textUnderlineOffset(RenderStyle::initialTextUnderlineOffset())
90+
, textBoxEdge(RenderStyle::initialTextBoxEdge())
9091
, lineFitEdge(RenderStyle::initialLineFitEdge())
9192
, miterLimit(RenderStyle::initialStrokeMiterLimit())
9293
, customProperties(StyleCustomPropertyData::create())
@@ -182,6 +183,7 @@ inline StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedDa
182183
, indent(o.indent)
183184
, usedZoom(o.usedZoom)
184185
, textUnderlineOffset(o.textUnderlineOffset)
186+
, textBoxEdge(o.textBoxEdge)
185187
, lineFitEdge(o.lineFitEdge)
186188
, miterLimit(o.miterLimit)
187189
, customProperties(o.customProperties)
@@ -295,6 +297,7 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
295297
&& indent == o.indent
296298
&& usedZoom == o.usedZoom
297299
&& textUnderlineOffset == o.textUnderlineOffset
300+
&& textBoxEdge == o.textBoxEdge
298301
&& lineFitEdge == o.lineFitEdge
299302
&& wordSpacing == o.wordSpacing
300303
&& miterLimit == o.miterLimit

Source/WebCore/rendering/style/StyleRareInheritedData.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class StyleRareInheritedData : public RefCounted {
9696

9797
TextUnderlineOffset textUnderlineOffset;
9898

99+
TextEdge textBoxEdge;
99100
TextEdge lineFitEdge;
100101

101102
Length wordSpacing;

Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
101101
, pseudoElementNameArgument(nullAtom())
102102
, anchorNames(RenderStyle::initialAnchorNames())
103103
, positionAnchor(RenderStyle::initialPositionAnchor())
104-
, textBoxEdge(RenderStyle::initialTextBoxEdge())
105104
, blockStepSize(RenderStyle::initialBlockStepSize())
106105
, blockStepInsert(static_cast<unsigned>(RenderStyle::initialBlockStepInsert()))
107106
, overscrollBehaviorX(static_cast<unsigned>(RenderStyle::initialOverscrollBehaviorX()))
@@ -200,7 +199,6 @@ inline StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonIn
200199
, pseudoElementNameArgument(o.pseudoElementNameArgument)
201200
, anchorNames(o.anchorNames)
202201
, positionAnchor(o.positionAnchor)
203-
, textBoxEdge(o.textBoxEdge)
204202
, blockStepSize(o.blockStepSize)
205203
, blockStepInsert(o.blockStepInsert)
206204
, overscrollBehaviorX(o.overscrollBehaviorX)
@@ -330,7 +328,6 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
330328
&& containIntrinsicHeightType == o.containIntrinsicHeightType
331329
&& containerType == o.containerType
332330
&& textBoxTrim == o.textBoxTrim
333-
&& textBoxEdge == o.textBoxEdge
334331
&& overflowAnchor == o.overflowAnchor
335332
&& viewTransitionClasses == o.viewTransitionClasses
336333
&& viewTransitionName == o.viewTransitionName

Source/WebCore/rendering/style/StyleRareNonInheritedData.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,6 @@ class StyleRareNonInheritedData : public RefCounted {
207207
Vector anchorNames;
208208
AtomString positionAnchor;
209209

210-
TextEdge textBoxEdge;
211-
212210
std::optional blockStepSize;
213211
unsigned blockStepInsert : 1; // BlockStepInsert
214212

0 commit comments

Comments
 (0)