Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r176170 - Assertion hit when setting a very large value to 'bor…
…der-width' / 'font-size' CSS properties https://bugs.webkit.org/show_bug.cgi?id=138770 Reviewed by Darin Adler. Source/WebCore: When setting a very large value to a CSS property, it is represented internally as infinity. r166114 already tried to deal with this by adding an std::isinf() check in CSSValuePool::createValue() and returning an identifier CSSPrimitiveValue with CSSValueInvalid value in such case. The issue is that doing leads to the StyleBuilder getting a CSSValueInvalid CSSPrimitive value as input, which is not handled and leads to assertions. This patch updates the CSSParser to detect cases where the double value is infinity earlier (in CSSParser::validUnit() and parseSimpleLengthValue()), so that we mark the value as invalid and actually drop it. As a result, CSSPrimitiveValues with CSSValueInvalid value no longer make their way to the StyleBuilder. Test: fast/css/style-builder-infinite-value.html fast/css/infinite-floating-value.html * css/CSSParser.cpp: (WebCore::parseSimpleLengthValue): (WebCore::CSSParser::validUnit): * css/CSSValuePool.cpp: (WebCore::CSSValuePool::createValue): LayoutTests: Add a layout test setting very large values to 'border-width' and 'font-size' CSS properties. * fast/css/style-builder-infinite-value-expected.txt: Added. * fast/css/style-builder-infinite-value.html: Added. Canonical link: https://commits.webkit.org/154760.215@webkitgtk/2.6 git-svn-id: https://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-2.6@176195 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
fc1436d
commit 66b22ef
Showing
6 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
LayoutTests/fast/css/style-builder-infinite-value-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Tests setting a very large value to several CSS properties. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS testDiv.style['border-width'] is "1px" | ||
PASS testDiv.style['border-width'] is "1px" | ||
PASS testDiv.style['font-size'] is "1em" | ||
PASS testDiv.style['font-size'] is "1em" | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
This test passes if it does not crash. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<script src="../../resources/js-test-pre.js"></script> | ||
<body> | ||
<p>This test passes if it does not crash.</p> | ||
|
||
<div id="testDiv"></div> | ||
|
||
<script> | ||
description("Tests setting a very large value to several CSS properties."); | ||
|
||
var testDiv = document.getElementById("testDiv"); | ||
testDiv.style["border-width"] = "1px"; | ||
shouldBeEqualToString("testDiv.style['border-width']", "1px"); | ||
testDiv.style["border-width"] = "900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000px"; | ||
shouldBeEqualToString("testDiv.style['border-width']", "1px"); | ||
|
||
testDiv.style["font-size"] = "1em"; | ||
shouldBeEqualToString("testDiv.style['font-size']", "1em"); | ||
testDiv.style["font-size"] = "900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000%"; | ||
shouldBeEqualToString("testDiv.style['font-size']", "1em"); | ||
</script> | ||
<script src="../../resources/js-test-post.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters