Commit 2d5bb27c authored by Rob Buis's avatar Rob Buis Committed by Commit Bot

Make font shorthand initial/inherit parsing less strict

Make font shorthand initial/inherit parsing less strict, the
current solution means the special logic in ConsumeFontFamily
is not taken into account. Since all font longhands will reject
css wide keywords and ConsumeFontFamily has special rules for them,
we can just remove the while loop.

Bug: 824611

Change-Id: I9bae2c1497e61bb0d93973bb1bfaac386d0c6d0b
Reviewed-on: https://chromium-review.googlesource.com/982557Reviewed-by: default avatarTimothy Loh <timloh@chromium.org>
Commit-Queue: Rob Buis <rob.buis@samsung.com>
Cr-Commit-Position: refs/heads/master@{#547677}
parent 0e8b553a
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -11,9 +11,9 @@ PASS test.style.getPropertyValue('font') is ''
PASS test.style.getPropertyValue('font') is ''
PASS test.style.getPropertyValue('font') is ''
PASS test.style.getPropertyValue('font') is ''
PASS test.style.getPropertyValue('font') is ''
PASS test.style.getPropertyValue('font') is ''
PASS test.style.getPropertyValue('font') is ''
PASS test.style.getPropertyValue('font') is '12pt/14pt "bold inherit"'
PASS test.style.getPropertyValue('font') is 'italic 12pt/14pt "bold inherit"'
PASS test.style.getPropertyValue('font') is 'italic 12pt/14pt "bold arial inherit"'
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -27,12 +27,6 @@
shouldBe("test.style.getPropertyValue('font')", "''");
test.style.font = "12pt/14pt inherit";
shouldBe("test.style.getPropertyValue('font')", "''");
test.style.font = "12pt/14pt bold inherit";
shouldBe("test.style.getPropertyValue('font')", "''");
test.style.font = "italic 12pt/14pt bold inherit";
shouldBe("test.style.getPropertyValue('font')", "''");
test.style.font = "italic 12pt/14pt bold arial inherit";
shouldBe("test.style.getPropertyValue('font')", "''");
test.style.font = "x-large/110% 'new century schoolbook', serif, inherit";
shouldBe("test.style.getPropertyValue('font')", "''");
test.style.font = " 'inherit'";
......@@ -47,6 +41,12 @@
shouldBe("test.style.getPropertyValue('font')", "''");
test.style.font = "italic inherit 12pt/14pt bold arial initial";
shouldBe("test.style.getPropertyValue('font')", "''");
test.style.font = "12pt/14pt bold inherit";
shouldBe("test.style.getPropertyValue('font')", "'12pt/14pt \"bold inherit\"'");
test.style.font = "italic 12pt/14pt bold inherit";
shouldBe("test.style.getPropertyValue('font')", "'italic 12pt/14pt \"bold inherit\"'");
test.style.font = "italic 12pt/14pt bold arial inherit";
shouldBe("test.style.getPropertyValue('font')", "'italic 12pt/14pt \"bold arial inherit\"'");
// clean up after ourselves
var tests_container = document.getElementById("tests_container");
tests_container.parentNode.removeChild(tests_container);
......
......@@ -91,13 +91,6 @@ bool ConsumeFont(bool important,
CSSParserTokenRange& range,
const CSSParserContext& context,
HeapVector<CSSPropertyValue, 256>& properties) {
// Let's check if there is an inherit or initial somewhere in the shorthand.
CSSParserTokenRange range_copy = range;
while (!range_copy.AtEnd()) {
CSSValueID id = range_copy.ConsumeIncludingWhitespace().Id();
if (id == CSSValueInherit || id == CSSValueInitial)
return false;
}
// Optional font-style, font-variant, font-stretch and font-weight.
CSSValue* font_style = nullptr;
CSSIdentifierValue* font_variant_caps = nullptr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment