- Revision
- 184455
- Author
- [email protected]
- Date
- 2015-05-18 03:32:14 -0700 (Mon, 18 May 2015)
Log Message
Merge r175197 - Clamp wordSpacing percentage value.
https://bugs.webkit.org/show_bug.cgi?id=129350.
Patch by Said Abou-Hallawa <[email protected]> on 2014-10-24
Reviewed by Zalan Bujtas.
Source/WebCore:
When the CSS wordSpacing property is percentage, its value has to be within the
pre-defined min/max values for the CSS length type. This is done the same way
the wordSpacing of type <length> is handled.
Tests: css3/infinite-word-spacing.html.
Move the definitions of minValueForCssLength and maxValueForCssLength from the
.cpp file to the .h file.
* css/CSSPrimitiveValue.cpp:
* css/CSSPrimitiveValue.h:
Clamp the wordSpacing value to minValueForCssLength and maxValueForCssLength when
its type is percentage.
* css/DeprecatedStyleBuilder.cpp:
(WebCore::ApplyPropertyWordSpacing::applyValue):
LayoutTests:
Make sure that setting the CSS style wordSpacing property to very huge percentage
value and blending this value with other values for animating key frames does
not assert or crash. The expectation is to have this huge value to be clamped to
the pre-defined min/max values for the CSS length type. So when blending the clamped
value with other wordSpacing values, the result can't be NaN. This should be very
similar to the case when it is set to a huge <length> value.
* css3/infinite-word-spacing-expected.txt: Added.
* css3/infinite-word-spacing.html: Added.
Modified Paths
Added Paths
Diff
Modified: releases/WebKitGTK/webkit-2.4/LayoutTests/ChangeLog (184454 => 184455)
--- releases/WebKitGTK/webkit-2.4/LayoutTests/ChangeLog 2015-05-18 10:23:09 UTC (rev 184454)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/ChangeLog 2015-05-18 10:32:14 UTC (rev 184455)
@@ -1,3 +1,20 @@
+2014-10-24 Said Abou-Hallawa <[email protected]>
+
+ Clamp wordSpacing percentage value.
+ https://bugs.webkit.org/show_bug.cgi?id=129350.
+
+ Reviewed by Zalan Bujtas.
+
+ Make sure that setting the CSS style wordSpacing property to very huge percentage
+ value and blending this value with other values for animating key frames does
+ not assert or crash. The expectation is to have this huge value to be clamped to
+ the pre-defined min/max values for the CSS length type. So when blending the clamped
+ value with other wordSpacing values, the result can't be NaN. This should be very
+ similar to the case when it is set to a huge <length> value.
+
+ * css3/infinite-word-spacing-expected.txt: Added.
+ * css3/infinite-word-spacing.html: Added.
+
2014-10-29 Zalan Bujtas <[email protected]>
Remove invalid float from RootInlineBox.
Added: releases/WebKitGTK/webkit-2.4/LayoutTests/css3/infinite-word-spacing-expected.txt (0 => 184455)
--- releases/WebKitGTK/webkit-2.4/LayoutTests/css3/infinite-word-spacing-expected.txt (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/css3/infinite-word-spacing-expected.txt 2015-05-18 10:32:14 UTC (rev 184455)
@@ -0,0 +1 @@
+PASS if no assert or crash in debug.
Added: releases/WebKitGTK/webkit-2.4/LayoutTests/css3/infinite-word-spacing.html (0 => 184455)
--- releases/WebKitGTK/webkit-2.4/LayoutTests/css3/infinite-word-spacing.html (rev 0)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/css3/infinite-word-spacing.html 2015-05-18 10:32:14 UTC (rev 184455)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ h1 {
+ -webkit-animation-name: spacing;
+ -webkit-animation-duration: 1s;
+ }
+ @-webkit-keyframes spacing {
+ 0% {
+ word-spacing: normal
+ }
+ 20% {
+ word-spacing: 11111111111111111111111111111111111111111111111111%
+ }
+ 40% {
+ word-spacing: 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111%
+ }
+ 60% {
+ word-spacing: 200%
+ }
+ 80% {
+ word-spacing: 300%
+ }
+ 100% { }
+ }
+ </style>
+</head>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+<body>
+<h1>PASS if no assert or crash in debug.</h1>
+</body>
+</html>
Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog (184454 => 184455)
--- releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog 2015-05-18 10:23:09 UTC (rev 184454)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog 2015-05-18 10:32:14 UTC (rev 184455)
@@ -1,3 +1,26 @@
+2014-10-24 Said Abou-Hallawa <[email protected]>
+
+ Clamp wordSpacing percentage value.
+ https://bugs.webkit.org/show_bug.cgi?id=129350.
+
+ Reviewed by Zalan Bujtas.
+
+ When the CSS wordSpacing property is percentage, its value has to be within the
+ pre-defined min/max values for the CSS length type. This is done the same way
+ the wordSpacing of type <length> is handled.
+
+ Tests: css3/infinite-word-spacing.html.
+
+ Move the definitions of minValueForCssLength and maxValueForCssLength from the
+ .cpp file to the .h file.
+ * css/CSSPrimitiveValue.cpp:
+ * css/CSSPrimitiveValue.h:
+
+ Clamp the wordSpacing value to minValueForCssLength and maxValueForCssLength when
+ its type is percentage.
+ * css/DeprecatedStyleBuilder.cpp:
+ (WebCore::ApplyPropertyWordSpacing::applyValue):
+
2014-10-24 Zalan Bujtas <[email protected]>
Replace INT_MIN/MAX / kFixedPointDenominator with intMin/MaxForLayoutUnit.
Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/css/CSSPrimitiveValue.cpp (184454 => 184455)
--- releases/WebKitGTK/webkit-2.4/Source/WebCore/css/CSSPrimitiveValue.cpp 2015-05-18 10:23:09 UTC (rev 184454)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/css/CSSPrimitiveValue.cpp 2015-05-18 10:32:14 UTC (rev 184455)
@@ -32,7 +32,6 @@
#include "Counter.h"
#include "ExceptionCode.h"
#include "Font.h"
-#include "LayoutUnit.h"
#include "Node.h"
#include "Pair.h"
#include "RGBColor.h"
@@ -53,11 +52,6 @@
namespace WebCore {
-// Max/min values for CSS, needs to slightly smaller/larger than the true max/min values to allow for rounding without overflowing.
-// Subtract two (rather than one) to allow for values to be converted to float and back without exceeding the LayoutUnit::max.
-const int maxValueForCssLength = intMaxForLayoutUnit - 2;
-const int minValueForCssLength = intMinForLayoutUnit + 2;
-
static inline bool isValidCSSUnitTypeForDoubleConversion(CSSPrimitiveValue::UnitTypes unitType)
{
switch (unitType) {
Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/css/CSSPrimitiveValue.h (184454 => 184455)
--- releases/WebKitGTK/webkit-2.4/Source/WebCore/css/CSSPrimitiveValue.h 2015-05-18 10:23:09 UTC (rev 184454)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/css/CSSPrimitiveValue.h 2015-05-18 10:32:14 UTC (rev 184455)
@@ -26,6 +26,7 @@
#include "CSSValue.h"
#include "CSSValueKeywords.h"
#include "Color.h"
+#include "LayoutUnit.h"
#include <wtf/Forward.h>
#include <wtf/MathExtras.h>
#include <wtf/PassRefPtr.h>
@@ -45,6 +46,11 @@
struct Length;
struct LengthSize;
+// Max/min values for CSS, needs to slightly smaller/larger than the true max/min values to allow for rounding without overflowing.
+// Subtract two (rather than one) to allow for values to be converted to float and back without exceeding the LayoutUnit::max.
+const int maxValueForCssLength = intMaxForLayoutUnit - 2;
+const int minValueForCssLength = intMinForLayoutUnit + 2;
+
// Dimension calculations are imprecise, often resulting in values of e.g.
// 44.99998. We need to go ahead and round if we're really close to the next
// integer value.
Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/css/DeprecatedStyleBuilder.cpp (184454 => 184455)
--- releases/WebKitGTK/webkit-2.4/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2015-05-18 10:23:09 UTC (rev 184454)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2015-05-18 10:32:14 UTC (rev 184455)
@@ -1549,7 +1549,7 @@
multiplier *= frame->textZoomFactor();
wordSpacing = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), multiplier);
} else if (primitiveValue->isPercentage())
- wordSpacing = Length(primitiveValue->getDoubleValue(), Percent);
+ wordSpacing = Length(clampTo<float>(primitiveValue->getDoubleValue(), minValueForCssLength, maxValueForCssLength), Percent);
else if (primitiveValue->isNumber())
wordSpacing = Length(primitiveValue->getDoubleValue(), Fixed);
else if (primitiveValue->isViewportPercentageLength())