8000 Stop returning nullptr for system font keywords on non-font related p… · WebKit/WebKit@db5cab0 · GitHub
[go: up one dir, main page]

Skip to content

Commit db5cab0

Browse files
chirags27nt1m
authored andcommitted
Stop returning nullptr for system font keywords on non-font related properties
https://bugs.webkit.org/show_bug.cgi?id=250245 rdar://103916548 Reviewed by Darin Adler and Tim Nguyen. The code that is handling font: menu shouldn’t apply to non-font properties. * LayoutTests/fast/css/css-text-border-menu-expected.txt: Added. * LayoutTests/fast/css/css-text-border-menu.html: Added. * Source/WebCore/css/StyleProperties.cpp: (WebCore::StyleProperties::getPropertyCSSValue const): Canonical link: https://commits.webkit.org/258742@main
1 parent 91b8d58 commit db5cab0

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PASS if no crash
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<script>
2+
function test() {
3+
if (window.testRunner)
4+
testRunner.dumpAsText();
5+
const div = document.createElement("div");
6+
const elementStyle = div.style;
7+
elementStyle.border = "menu";
8+
cssText = elementStyle.cssText;
9+
}
10+
</script>
11+
<body onload="test()">
12+
<p>PASS if no crash</p>

Source/WebCore/css/StyleProperties.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@ RefPtr<CSSValue> StyleProperties::getPropertyCSSValue(CSSPropertyID propertyID)
11391139
auto value = property.value();
11401140
// System fonts are represented as CSSPrimitiveValue for various font subproperties, but these must serialize as the empty string.
11411141
// It might be better to implement this as a special CSSValue type instead of turning them into null here.
1142-
if (property.id() != CSSPropertyFont && CSSPropertyParserHelpers::isSystemFontShorthand(valueID(value)))
1142+
if (property.shorthandID() == CSSPropertyFont && CSSPropertyParserHelpers::isSystemFontShorthand(valueID(value)))
11431143
return nullptr;
11441144
return value;
11451145
}

0 commit comments

Comments
 (0)
0