Title: [175925] releases/WebKitGTK/webkit-2.6
- Revision
- 175925
- Author
- [email protected]
- Date
- 2014-11-11 07:50:48 -0800 (Tue, 11 Nov 2014)
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.6/LayoutTests/ChangeLog (175924 => 175925)
--- releases/WebKitGTK/webkit-2.6/LayoutTests/ChangeLog 2014-11-11 15:38:44 UTC (rev 175924)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/ChangeLog 2014-11-11 15:50:48 UTC (rev 175925)
@@ -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.6/LayoutTests/css3/infinite-word-spacing-expected.txt (0 => 175925)
--- releases/WebKitGTK/webkit-2.6/LayoutTests/css3/infinite-word-spacing-expected.txt (rev 0)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/css3/infinite-word-spacing-expected.txt 2014-11-11 15:50:48 UTC (rev 175925)
@@ -0,0 +1 @@
+PASS if no assert or crash in debug.
Added: releases/WebKitGTK/webkit-2.6/LayoutTests/css3/infinite-word-spacing.html (0 => 175925)
--- releases/WebKitGTK/webkit-2.6/LayoutTests/css3/infinite-word-spacing.html (rev 0)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/css3/infinite-word-spacing.html 2014-11-11 15:50:48 UTC (rev 175925)
@@ -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.6/Source/WebCore/ChangeLog (175924 => 175925)
--- releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog 2014-11-11 15:38:44 UTC (rev 175924)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog 2014-11-11 15:50:48 UTC (rev 175925)
@@ -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.6/Source/WebCore/css/CSSPrimitiveValue.cpp (175924 => 175925)
--- releases/WebKitGTK/webkit-2.6/Source/WebCore/css/CSSPrimitiveValue.cpp 2014-11-11 15:38:44 UTC (rev 175924)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/css/CSSPrimitiveValue.cpp 2014-11-11 15:50:48 UTC (rev 175925)
@@ -33,7 +33,6 @@
#include "Counter.h"
#include "ExceptionCode.h"
#include "Font.h"
-#include "LayoutUnit.h"
#include "Node.h"
#include "Pair.h"
#include "RGBColor.h"
@@ -59,11 +58,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.6/Source/WebCore/css/CSSPrimitiveValue.h (175924 => 175925)
--- releases/WebKitGTK/webkit-2.6/Source/WebCore/css/CSSPrimitiveValue.h 2014-11-11 15:38:44 UTC (rev 175924)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/css/CSSPrimitiveValue.h 2014-11-11 15:50:48 UTC (rev 175925)
@@ -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>
@@ -50,6 +51,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.6/Source/WebCore/css/DeprecatedStyleBuilder.cpp (175924 => 175925)
--- releases/WebKitGTK/webkit-2.6/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2014-11-11 15:38:44 UTC (rev 175924)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2014-11-11 15:50:48 UTC (rev 175925)
@@ -1557,7 +1557,7 @@
else if (primitiveValue->isLength()) {
wordSpacing = primitiveValue->computeLength<Length>(csstoLengthConversionDataWithTextZoomFactor(*styleResolver));
} 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
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes