Skip to content

Commit

Permalink
[CSS-Typed-OM] Make sure column-count value gets clamped to [1, inf]
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=249722

Reviewed by Alan Baradlay.

* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/column-count-expected.txt:
* Source/WebCore/rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setColumnCount):

Canonical link: https://commits.webkit.org/258218@main
  • Loading branch information
cdumez committed Dec 21, 2022
1 parent 6568bf9 commit 58acbb9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ PASS Can set 'column-count' to CSS-wide keywords: unset
PASS Can set 'column-count' to CSS-wide keywords: revert
PASS Can set 'column-count' to var() references: var(--A)
PASS Can set 'column-count' to the 'auto' keyword: auto
FAIL Can set 'column-count' to a number: 0 assert_approx_equals: expected 1 +/- 0.000001 but got 0
FAIL Can set 'column-count' to a number: -3.14 assert_approx_equals: expected 1 +/- 0.000001 but got 0
PASS Can set 'column-count' to a number: 0
PASS Can set 'column-count' to a number: -3.14
PASS Can set 'column-count' to a number: 3.14
PASS Can set 'column-count' to a number: calc(2 + 3)
PASS Setting 'column-count' to a length: 0px throws TypeError
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/style/RenderStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ class RenderStyle {
void setColumnProgression(ColumnProgression progression) { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, progression, static_cast<unsigned>(progression)); }
void setColumnWidth(float f) { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, autoWidth, false); SET_NESTED_VAR(m_rareNonInheritedData, multiCol, width, f); }
void setHasAutoColumnWidth() { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, autoWidth, true); SET_NESTED_VAR(m_rareNonInheritedData, multiCol, width, 0); }
void setColumnCount(unsigned short c) { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, autoCount, false); SET_NESTED_VAR(m_rareNonInheritedData, multiCol, count, c); }
void setColumnCount(unsigned short c) { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, autoCount, false); SET_NESTED_VAR(m_rareNonInheritedData, multiCol, count, std::max<unsigned short>(c, 1)); }
void setHasAutoColumnCount() { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, autoCount, true); SET_NESTED_VAR(m_rareNonInheritedData, multiCol, count, initialColumnCount()); }
void setColumnFill(ColumnFill columnFill) { SET_NESTED_VAR(m_rareNonInheritedData, multiCol, fill, static_cast<unsigned>(columnFill)); }
void setColumnGap(GapLength&& gapLength) { SET_VAR(m_rareNonInheritedData, columnGap, WTFMove(gapLength)); }
Expand Down

0 comments on commit 58acbb9

Please sign in to comment.