Skip to content
Permalink
Browse files
[CSS-Typed-OM] Make sure column-count value gets clamped to [1, inf]
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 58acbb968b7336a4f32ce0c3a9026b915b6914b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
@@ -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
@@ -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)); }

0 comments on commit 58acbb9

Please sign in to comment.