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

Changeset 176571 in webkit


Ignore:
Timestamp:
Nov 28, 2014, 10:20:25 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Move the '-webkit-initial-letter', '-webkit-line-box-contain' and '-webkit-text-stroke-width' CSS properties to the new StyleBuilder
https://bugs.webkit.org/show_bug.cgi?id=139053

Patch by Sam Weinig <sam@webkit.org> on 2014-11-28
Reviewed by Andreas Kling.

  • css/CSSPropertyNames.in:
  • css/StyleBuilderConverter.h:

(WebCore::StyleBuilderConverter::convertInitialLetter):
(WebCore::StyleBuilderConverter::convertTextStrokeWidth):
(WebCore::StyleBuilderConverter::convertLineBoxContain):

  • css/StyleResolver.cpp:

(WebCore::StyleResolver::applyProperty):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r176561 r176571  
     12014-11-28  Sam Weinig  <sam@webkit.org>
     2
     3        Move the '-webkit-initial-letter', '-webkit-line-box-contain' and '-webkit-text-stroke-width' CSS properties to the new StyleBuilder
     4        https://bugs.webkit.org/show_bug.cgi?id=139053
     5
     6        Reviewed by Andreas Kling.
     7
     8        * css/CSSPropertyNames.in:
     9        * css/StyleBuilderConverter.h:
     10        (WebCore::StyleBuilderConverter::convertInitialLetter):
     11        (WebCore::StyleBuilderConverter::convertTextStrokeWidth):
     12        (WebCore::StyleBuilderConverter::convertLineBoxContain):
     13        * css/StyleResolver.cpp:
     14        (WebCore::StyleResolver::applyProperty):
     15
    1162014-11-26  Philippe Normand  <pnormand@igalia.com>
    217
  • trunk/Source/WebCore/css/CSSPropertyNames.in

    r176524 r176571  
    413413-webkit-hyphens [Inherited, TypeName=Hyphens]
    414414-epub-hyphens = -webkit-hyphens
    415 -webkit-initial-letter [LegacyStyleBuilder]
    416 -webkit-line-box-contain [Inherited, LegacyStyleBuilder]
     415-webkit-initial-letter [Converter=InitialLetter]
     416-webkit-line-box-contain [Inherited, Converter=LineBoxContain]
    417417-webkit-line-align [Inherited, TypeName=LineAlign]
    418418-webkit-line-break [Inherited, TypeName=LineBreak]
     
    508508-webkit-text-stroke [Inherited, LegacyStyleBuilder]
    509509-webkit-text-stroke-color [Inherited, LegacyStyleBuilder]
    510 -webkit-text-stroke-width [Inherited, LegacyStyleBuilder]
     510-webkit-text-stroke-width [Inherited, Converter=TextStrokeWidth]
    511511-webkit-transform [Converter=Transform]
    512512-webkit-transform-origin [LegacyStyleBuilder]
  • trunk/Source/WebCore/css/StyleBuilderConverter.h

    r176524 r176571  
    7171    static TextUnderlinePosition convertTextUnderlinePosition(StyleResolver&, CSSValue&);
    7272    static PassRefPtr<StyleReflection> convertReflection(StyleResolver&, CSSValue&);
     73    static IntSize convertInitialLetter(StyleResolver&, CSSValue&);
     74    static float convertTextStrokeWidth(StyleResolver&, CSSValue&);
     75    static LineBoxContain convertLineBoxContain(StyleResolver&, CSSValue&);
    7376
    7477private:
     
    495498}
    496499
     500inline IntSize StyleBuilderConverter::convertInitialLetter(StyleResolver&, CSSValue& value)
     501{
     502    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
     503
     504    if (primitiveValue.getValueID() == CSSValueNormal)
     505        return IntSize();
     506
     507    Pair* pair = primitiveValue.getPairValue();
     508    ASSERT(pair);
     509    ASSERT(pair->first());
     510    ASSERT(pair->second());
     511
     512    return IntSize(pair->first()->getIntValue(), pair->second()->getIntValue());
     513}
     514
     515inline float StyleBuilderConverter::convertTextStrokeWidth(StyleResolver& styleResolver, CSSValue& value)
     516{
     517    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
     518
     519    float width = 0;
     520    switch (primitiveValue.getValueID()) {
     521    case CSSValueThin:
     522    case CSSValueMedium:
     523    case CSSValueThick: {
     524        double result = 1.0 / 48;
     525        if (primitiveValue.getValueID() == CSSValueMedium)
     526            result *= 3;
     527        else if (primitiveValue.getValueID() == CSSValueThick)
     528            result *= 5;
     529        Ref<CSSPrimitiveValue> emsValue(CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS));
     530        width = convertComputedLength<float>(styleResolver, emsValue);
     531        break;
     532    }
     533    case CSSValueInvalid: {
     534        width = convertComputedLength<float>(styleResolver, primitiveValue);
     535        break;
     536    }
     537    default:
     538        ASSERT_NOT_REACHED();
     539        return 0;
     540    }
     541
     542    return width;
     543}
     544
     545inline LineBoxContain StyleBuilderConverter::convertLineBoxContain(StyleResolver&, CSSValue& value)
     546{
     547    if (is<CSSPrimitiveValue>(value)) {
     548        ASSERT(downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueNone);
     549        return LineBoxContainNone;
     550    }
     551
     552    return downcast<CSSLineBoxContainValue>(value).value();
     553}
     554
     555
    497556} // namespace WebCore
    498557
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r176524 r176571  
    24902490    }
    24912491#endif
    2492     case CSSPropertyWebkitTextStrokeWidth: {
    2493         HANDLE_INHERIT_AND_INITIAL(textStrokeWidth, TextStrokeWidth)
    2494         float width = 0;
    2495         switch (primitiveValue->getValueID()) {
    2496         case CSSValueThin:
    2497         case CSSValueMedium:
    2498         case CSSValueThick: {
    2499             double result = 1.0 / 48;
    2500             if (primitiveValue->getValueID() == CSSValueMedium)
    2501                 result *= 3;
    2502             else if (primitiveValue->getValueID() == CSSValueThick)
    2503                 result *= 5;
    2504             Ref<CSSPrimitiveValue> value(CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS));
    2505             width = value.get().computeLength<float>(state.cssToLengthConversionData());
    2506             break;
    2507         }
    2508         default:
    2509             width = primitiveValue->computeLength<float>(state.cssToLengthConversionData());
    2510             break;
    2511         }
    2512         state.style()->setTextStrokeWidth(width);
    2513         return;
    2514     }
    25152492    case CSSPropertyWebkitPerspective: {
    25162493        HANDLE_INHERIT_AND_INITIAL(perspective, Perspective)
     
    26132590    }
    26142591
    2615     case CSSPropertyWebkitLineBoxContain: {
    2616         HANDLE_INHERIT_AND_INITIAL(lineBoxContain, LineBoxContain)
    2617         if (primitiveValue && primitiveValue->getValueID() == CSSValueNone) {
    2618             state.style()->setLineBoxContain(LineBoxContainNone);
    2619             return;
    2620         }
    2621 
    2622         if (!is<CSSLineBoxContainValue>(*value))
    2623             return;
    2624 
    2625         state.style()->setLineBoxContain(downcast<CSSLineBoxContainValue>(*value).value());
    2626         return;
    2627     }
    2628 
    26292592    // CSS Fonts Module Level 3
    26302593    case CSSPropertyWebkitFontFeatureSettings: {
     
    28882851    }
    28892852#endif
    2890 
    2891     case CSSPropertyWebkitInitialLetter: {
    2892         HANDLE_INHERIT_AND_INITIAL(initialLetter, InitialLetter)
    2893         if (!value->isPrimitiveValue())
    2894             return;
    2895        
    2896         if (primitiveValue->getValueID() == CSSValueNormal) {
    2897             state.style()->setInitialLetter(IntSize());
    2898             return;
    2899         }
    2900            
    2901         Pair* pair = primitiveValue->getPairValue();
    2902         if (!pair || !pair->first() || !pair->second())
    2903             return;
    2904 
    2905         state.style()->setInitialLetter(IntSize(pair->first()->getIntValue(), pair->second()->getIntValue()));
    2906         return;
    2907     }
    29082853   
    29092854    // These properties are aliased and DeprecatedStyleBuilder already applied the property on the prefixed version.
     
    30983043    case CSSPropertyWebkitHyphenateLimitLines:
    30993044    case CSSPropertyWebkitHyphens:
     3045    case CSSPropertyWebkitInitialLetter:
    31003046    case CSSPropertyWebkitLineAlign:
     3047    case CSSPropertyWebkitLineBoxContain:
    31013048    case CSSPropertyWebkitLineBreak:
    31023049    case CSSPropertyWebkitLineClamp:
     
    31533100    case CSSPropertyWebkitTextSecurity:
    31543101    case CSSPropertyWebkitTextStrokeColor:
     3102    case CSSPropertyWebkitTextStrokeWidth:
    31553103    case CSSPropertyWebkitTransformOriginX:
    31563104    case CSSPropertyWebkitTransformOriginY:
Note: See TracChangeset for help on using the changeset viewer.