Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (288060 => 288061)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-01-15 18:58:31 UTC (rev 288060)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-01-15 20:10:27 UTC (rev 288061)
@@ -1,3 +1,12 @@
+2022-01-15 Alan Bujtas <[email protected]>
+
+ web-platform-tests/html/rendering/dimension-attributes.html is failing when table width is set to 0px
+ https://bugs.webkit.org/show_bug.cgi?id=235267
+
+ Reviewed by Antti Koivisto.
+
+ * web-platform-tests/html/rendering/dimension-attributes-expected.txt:
+
2022-01-14 Antoine Quint <[email protected]>
Setting `content: normal` on a ::marker should make computed style return resolved values
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/dimension-attributes-expected.txt (288060 => 288061)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/dimension-attributes-expected.txt 2022-01-15 18:58:31 UTC (rev 288060)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/dimension-attributes-expected.txt 2022-01-15 20:10:27 UTC (rev 288061)
@@ -716,9 +716,9 @@
PASS <table width=".x"> mapping to width
PASS <table width=".5"> mapping to width
PASS <table width=".5%"> mapping to width
-FAIL <table width="0"> mapping to width assert_equals: expected "auto" but got "0px"
-FAIL <table width="0%"> mapping to width assert_equals: expected "auto" but got "0%"
-FAIL <table width="0px"> mapping to width assert_equals: expected "auto" but got "0px"
+PASS <table width="0"> mapping to width
+PASS <table width="0%"> mapping to width
+PASS <table width="0px"> mapping to width
PASS <table height="200"> mapping to height
PASS <table height="1007"> mapping to height
PASS <table height=" 00523 "> mapping to height
Modified: trunk/Source/WebCore/ChangeLog (288060 => 288061)
--- trunk/Source/WebCore/ChangeLog 2022-01-15 18:58:31 UTC (rev 288060)
+++ trunk/Source/WebCore/ChangeLog 2022-01-15 20:10:27 UTC (rev 288061)
@@ -1,3 +1,24 @@
+2022-01-15 Alan Bujtas <[email protected]>
+
+ web-platform-tests/html/rendering/dimension-attributes.html is failing when table width is set to 0px
+ https://bugs.webkit.org/show_bug.cgi?id=235267
+
+ Reviewed by Antti Koivisto.
+
+ This patch is based on the following Blink commit:
+ https://chromium-review.googlesource.com/c/chromium/src/+/2458587
+
+ This only applies to width (not height) - see:
+ https://wpt.fyi/results/html/rendering/dimension-attributes.html?label=master&label=experimental&aligned&q=dimension-attributes
+
+ See also: https://drafts.csswg.org/css-tables-3/#mapping
+
+ * html/HTMLElement.cpp:
+ (WebCore::HTMLElement::addHTMLLengthToStyle):
+ * html/HTMLElement.h:
+ * html/HTMLTableElement.cpp:
+ (WebCore::HTMLTableElement::collectPresentationalHintsForAttribute):
+
2022-01-15 Simon Fraser <[email protected]>
Share some code that looks at visibility in order to short-circuit repaint rect computation
Modified: trunk/Source/WebCore/html/HTMLElement.cpp (288060 => 288061)
--- trunk/Source/WebCore/html/HTMLElement.cpp 2022-01-15 18:58:31 UTC (rev 288060)
+++ trunk/Source/WebCore/html/HTMLElement.cpp 2022-01-15 20:10:27 UTC (rev 288061)
@@ -892,10 +892,10 @@
}
}
-void HTMLElement::addHTMLLengthToStyle(MutableStyleProperties& style, CSSPropertyID propertyID, StringView value, AllowPercentage allowPercentage, UseCSSPXAsUnitType useCSSPX, IsMultiLength isMultiLength)
+void HTMLElement::addHTMLLengthToStyle(MutableStyleProperties& style, CSSPropertyID propertyID, StringView value, AllowPercentage allowPercentage, UseCSSPXAsUnitType useCSSPX, IsMultiLength isMultiLength, AllowZeroValue allowZeroValue)
{
auto dimensionValue = isMultiLength == IsMultiLength::No ? parseHTMLDimension(value) : parseHTMLMultiLength(value);
- if (!dimensionValue)
+ if (!dimensionValue || (!dimensionValue->number && allowZeroValue == AllowZeroValue::No))
return;
if (dimensionValue->type == HTMLDimension::Type::Percentage) {
if (allowPercentage == AllowPercentage::Yes)
@@ -909,9 +909,9 @@
}
// https://www.w3.org/TR/html4/sgml/dtd.html#Length, including pixel and percentage values.
-void HTMLElement::addHTMLLengthToStyle(MutableStyleProperties& style, CSSPropertyID propertyID, StringView value)
+void HTMLElement::addHTMLLengthToStyle(MutableStyleProperties& style, CSSPropertyID propertyID, StringView value, AllowZeroValue allowZeroValue)
{
- addHTMLLengthToStyle(style, propertyID, value, AllowPercentage::Yes, UseCSSPXAsUnitType::Yes, IsMultiLength::No);
+ addHTMLLengthToStyle(style, propertyID, value, AllowPercentage::Yes, UseCSSPXAsUnitType::Yes, IsMultiLength::No, allowZeroValue);
}
// https://www.w3.org/TR/html4/sgml/dtd.html#MultiLength, including pixel, percentage, and relative values.
Modified: trunk/Source/WebCore/html/HTMLElement.h (288060 => 288061)
--- trunk/Source/WebCore/html/HTMLElement.h 2022-01-15 18:58:31 UTC (rev 288060)
+++ trunk/Source/WebCore/html/HTMLElement.h 2022-01-15 20:10:27 UTC (rev 288061)
@@ -140,7 +140,8 @@
protected:
HTMLElement(const QualifiedName& tagName, Document&, ConstructionType);
- void addHTMLLengthToStyle(MutableStyleProperties&, CSSPropertyID, StringView value);
+ enum class AllowZeroValue : bool { No, Yes };
+ void addHTMLLengthToStyle(MutableStyleProperties&, CSSPropertyID, StringView value, AllowZeroValue = AllowZeroValue::Yes);
void addHTMLMultiLengthToStyle(MutableStyleProperties&, CSSPropertyID, StringView value);
void addHTMLPixelsToStyle(MutableStyleProperties&, CSSPropertyID, StringView value);
void addHTMLNumberToStyle(MutableStyleProperties&, CSSPropertyID, StringView value);
@@ -177,7 +178,7 @@
enum class AllowPercentage : bool { No, Yes };
enum class UseCSSPXAsUnitType : bool { No, Yes };
enum class IsMultiLength : bool { No, Yes };
- void addHTMLLengthToStyle(MutableStyleProperties&, CSSPropertyID, StringView value, AllowPercentage, UseCSSPXAsUnitType, IsMultiLength);
+ void addHTMLLengthToStyle(MutableStyleProperties&, CSSPropertyID, StringView value, AllowPercentage, UseCSSPXAsUnitType, IsMultiLength, AllowZeroValue = AllowZeroValue::Yes);
};
inline HTMLElement::HTMLElement(const QualifiedName& tagName, Document& document, ConstructionType type = CreateHTMLElement)
Modified: trunk/Source/WebCore/html/HTMLTableElement.cpp (288060 => 288061)
--- trunk/Source/WebCore/html/HTMLTableElement.cpp 2022-01-15 18:58:31 UTC (rev 288060)
+++ trunk/Source/WebCore/html/HTMLTableElement.cpp 2022-01-15 20:10:27 UTC (rev 288061)
@@ -307,7 +307,7 @@
void HTMLTableElement::collectPresentationalHintsForAttribute(const QualifiedName& name, const AtomString& value, MutableStyleProperties& style)
{
if (name == widthAttr)
- addHTMLLengthToStyle(style, CSSPropertyWidth, value);
+ addHTMLLengthToStyle(style, CSSPropertyWidth, value, AllowZeroValue::No);
else if (name == heightAttr)
addHTMLLengthToStyle(style, CSSPropertyHeight, value);
else if (name == borderAttr)