⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 175925 in webkit


Ignore:
Timestamp:
Nov 11, 2014, 7:50:48 AM (12 years ago)
Author:
Carlos Garcia Campos
Message:

Merge r175197 - Clamp wordSpacing percentage value.
https://bugs.webkit.org/show_bug.cgi?id=129350.

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> 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.
Location:
releases/WebKitGTK/webkit-2.6
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.6/LayoutTests/ChangeLog

    r175922 r175925  
     12014-10-24  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Clamp wordSpacing percentage value.
     4        https://bugs.webkit.org/show_bug.cgi?id=129350.
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        Make sure that setting the CSS style wordSpacing property to very huge percentage
     9        value and blending this value with other values for animating key frames does
     10        not assert or crash. The expectation is to have this huge value to be clamped to
     11        the pre-defined min/max values for the CSS length type. So when blending the clamped
     12        value with other wordSpacing values, the result can't be NaN. This should be very
     13        similar to the case when it is set to a huge <length> value.
     14
     15        * css3/infinite-word-spacing-expected.txt: Added.
     16        * css3/infinite-word-spacing.html: Added.
     17
    1182014-10-29  Zalan Bujtas  <zalan@apple.com>
    219
  • releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog

    r175924 r175925  
     12014-10-24  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Clamp wordSpacing percentage value.
     4        https://bugs.webkit.org/show_bug.cgi?id=129350.
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        When the CSS wordSpacing property is percentage, its value has to be within the
     9        pre-defined min/max values for the CSS length type. This is done the same way
     10        the wordSpacing of type <length> is handled.
     11
     12        Tests: css3/infinite-word-spacing.html.
     13
     14        Move the definitions of minValueForCssLength and maxValueForCssLength from the
     15        .cpp file to the .h file.
     16        * css/CSSPrimitiveValue.cpp:
     17        * css/CSSPrimitiveValue.h:
     18
     19        Clamp the wordSpacing value to minValueForCssLength and maxValueForCssLength when
     20        its type is percentage.
     21        * css/DeprecatedStyleBuilder.cpp:
     22        (WebCore::ApplyPropertyWordSpacing::applyValue):
     23
    1242014-10-24  Zalan Bujtas  <zalan@apple.com>
    225
  • releases/WebKitGTK/webkit-2.6/Source/WebCore/css/CSSPrimitiveValue.cpp

    r175924 r175925  
    3434#include "ExceptionCode.h"
    3535#include "Font.h"
    36 #include "LayoutUnit.h"
    3736#include "Node.h"
    3837#include "Pair.h"
     
    5958
    6059namespace WebCore {
    61 
    62 // Max/min values for CSS, needs to slightly smaller/larger than the true max/min values to allow for rounding without overflowing.
    63 // Subtract two (rather than one) to allow for values to be converted to float and back without exceeding the LayoutUnit::max.
    64 const int maxValueForCssLength = intMaxForLayoutUnit - 2;
    65 const int minValueForCssLength = intMinForLayoutUnit + 2;
    6660
    6761static inline bool isValidCSSUnitTypeForDoubleConversion(CSSPrimitiveValue::UnitTypes unitType)
  • releases/WebKitGTK/webkit-2.6/Source/WebCore/css/CSSPrimitiveValue.h

    r173570 r175925  
    2727#include "CSSValueKeywords.h"
    2828#include "Color.h"
     29#include "LayoutUnit.h"
    2930#include <wtf/Forward.h>
    3031#include <wtf/MathExtras.h>
     
    5051struct Length;
    5152struct LengthSize;
     53
     54// Max/min values for CSS, needs to slightly smaller/larger than the true max/min values to allow for rounding without overflowing.
     55// Subtract two (rather than one) to allow for values to be converted to float and back without exceeding the LayoutUnit::max.
     56const int maxValueForCssLength = intMaxForLayoutUnit - 2;
     57const int minValueForCssLength = intMinForLayoutUnit + 2;
    5258
    5359// Dimension calculations are imprecise, often resulting in values of e.g.
  • releases/WebKitGTK/webkit-2.6/Source/WebCore/css/DeprecatedStyleBuilder.cpp

    r175901 r175925  
    15581558            wordSpacing = primitiveValue->computeLength<Length>(csstoLengthConversionDataWithTextZoomFactor(*styleResolver));
    15591559        } else if (primitiveValue->isPercentage())
    1560             wordSpacing = Length(primitiveValue->getDoubleValue(), Percent);
     1560            wordSpacing = Length(clampTo<float>(primitiveValue->getDoubleValue(), minValueForCssLength, maxValueForCssLength), Percent);
    15611561        else if (primitiveValue->isNumber())
    15621562            wordSpacing = Length(primitiveValue->getDoubleValue(), Fixed);
Note: See TracChangeset for help on using the changeset viewer.