Changeset 175464 in webkit


Ignore:
Timestamp:
Nov 2, 2014 2:47:30 PM (9 years ago)
Author:
Chris Dumez
Message:

Move string-typed properties to the new StyleBuilder
https://bugs.webkit.org/show_bug.cgi?id=138295

Reviewed by Antti Koivisto.

Move string-typed properties to the new StyleBuilder:
-webkit-hyphenate-character
-webkit-line-grid
-webkit-flow-into
-webkit-flow-from

No new tests, no behavior change.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r175463 r175464  
     12014-11-02  Chris Dumez  <cdumez@apple.com>
     2
     3        Move string-typed properties to the new StyleBuilder
     4        https://bugs.webkit.org/show_bug.cgi?id=138295
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Move string-typed properties to the new StyleBuilder:
     9        -webkit-hyphenate-character
     10        -webkit-line-grid
     11        -webkit-flow-into
     12        -webkit-flow-from
     13
     14        No new tests, no behavior change.
     15
    1162014-11-02  Chris Dumez  <cdumez@apple.com>
    217
  • trunk/Source/WebCore/css/CSSPropertyNames.in

    r175458 r175464  
    388388-webkit-grid-auto-flow
    389389#endif
    390 -webkit-hyphenate-character [Inherited]
     390-webkit-hyphenate-character [Inherited, NewStyleBuilder, NameForMethods=HyphenationString, Converter=StringOrAuto]
    391391-webkit-hyphenate-limit-after [Inherited, NewStyleBuilder, NameForMethods=HyphenationLimitAfter, Converter=Number<short>]
    392392-webkit-hyphenate-limit-before [Inherited, NewStyleBuilder, NameForMethods=HyphenationLimitBefore, Converter=Number<short>]
     
    399399-webkit-line-break [Inherited, NewStyleBuilder, TypeName=LineBreak]
    400400-webkit-line-clamp [NewStyleBuilder, TypeName=LineClampValue]
    401 -webkit-line-grid [Inherited]
     401-webkit-line-grid [Inherited, NewStyleBuilder, Converter=StringOrNone]
    402402-webkit-line-snap [Inherited, NewStyleBuilder, TypeName=LineSnap]
    403403-webkit-logical-width
     
    505505-webkit-user-select [Inherited, NewStyleBuilder]
    506506#if defined(ENABLE_CSS_REGIONS) && ENABLE_CSS_REGIONS
    507 -webkit-flow-into
    508 -webkit-flow-from
     507-webkit-flow-into [NewStyleBuilder, NameForMethods=FlowThread, Converter=StringOrNone]
     508-webkit-flow-from [NewStyleBuilder, NameForMethods=RegionThread, Converter=StringOrNone]
    509509-webkit-region-fragment [NewStyleBuilder, TypeName=RegionFragment]
    510510-webkit-region-break-after [NewStyleBuilder, TypeName=EPageBreak, Initial=initialPageBreak]
  • trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp

    r175458 r175464  
    301301
    302302    static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
    303 };
    304 
    305 enum StringIdentBehavior { NothingMapsToNull = 0, MapNoneToNull, MapAutoToNull };
    306 template <StringIdentBehavior identBehavior, const AtomicString& (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(const AtomicString&), const AtomicString& (*initialFunction)()>
    307 class ApplyPropertyString {
    308 public:
    309     static void setValue(RenderStyle* style, const AtomicString& value) { (style->*setterFunction)(value); }
    310     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
    311     {
    312         if (!is<CSSPrimitiveValue>(*value))
    313             return;
    314         CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
    315         if ((identBehavior == MapNoneToNull && primitiveValue.getValueID() == CSSValueNone)
    316             || (identBehavior == MapAutoToNull && primitiveValue.getValueID() == CSSValueAuto))
    317             setValue(styleResolver->style(), nullAtom);
    318         else
    319             setValue(styleResolver->style(), primitiveValue.getStringValue());
    320     }
    321     static PropertyHandler createHandler()
    322     {
    323         PropertyHandler handler = ApplyPropertyDefaultBase<const AtomicString&, getterFunction, const AtomicString&, setterFunction, const AtomicString&, initialFunction>::createHandler();
    324         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
    325     }
    326303};
    327304
     
    21162093    setPropertyHandler(CSSPropertyColumnRuleColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::setVisitedLinkColumnRuleColor, &RenderStyle::color>::createHandler());
    21172094    setPropertyHandler(CSSPropertyColumnWidth, ApplyPropertyAuto<float, &RenderStyle::columnWidth, &RenderStyle::setColumnWidth, &RenderStyle::hasAutoColumnWidth, &RenderStyle::setHasAutoColumnWidth, ComputeLength>::createHandler());
    2118 #if ENABLE(CSS_REGIONS)
    2119     setPropertyHandler(CSSPropertyWebkitFlowFrom, ApplyPropertyString<MapNoneToNull, &RenderStyle::regionThread, &RenderStyle::setRegionThread, &RenderStyle::initialRegionThread>::createHandler());
    2120     setPropertyHandler(CSSPropertyWebkitFlowInto, ApplyPropertyString<MapNoneToNull, &RenderStyle::flowThread, &RenderStyle::setFlowThread, &RenderStyle::initialFlowThread>::createHandler());
    2121 #endif
    21222095    setPropertyHandler(CSSPropertyWebkitFontKerning, ApplyPropertyFont<FontDescription::Kerning, &FontDescription::kerning, &FontDescription::setKerning, FontDescription::AutoKerning>::createHandler());
    21232096    setPropertyHandler(CSSPropertyWebkitFontSmoothing, ApplyPropertyFont<FontSmoothingMode, &FontDescription::fontSmoothing, &FontDescription::setFontSmoothing, AutoSmoothing>::createHandler());
    21242097    setPropertyHandler(CSSPropertyWebkitFontVariantLigatures, ApplyPropertyFontVariantLigatures::createHandler());
    2125     setPropertyHandler(CSSPropertyWebkitHyphenateCharacter, ApplyPropertyString<MapAutoToNull, &RenderStyle::hyphenationString, &RenderStyle::setHyphenationString, &RenderStyle::initialHyphenationString>::createHandler());
    2126     setPropertyHandler(CSSPropertyWebkitLineGrid, ApplyPropertyString<MapNoneToNull, &RenderStyle::lineGrid, &RenderStyle::setLineGrid, &RenderStyle::initialLineGrid>::createHandler());
    21272098    setPropertyHandler(CSSPropertyWebkitMarqueeRepetition, ApplyPropertyMarqueeRepetition::createHandler());
    21282099    setPropertyHandler(CSSPropertyWebkitMarqueeSpeed, ApplyPropertyMarqueeSpeed::createHandler());
  • trunk/Source/WebCore/css/StyleBuilderConverter.h

    r175454 r175464  
    5454    template <CSSPropertyID property> static PassRefPtr<StyleImage> convertBorderImageSource(StyleResolver&, CSSValue&);
    5555    static TransformOperations convertTransform(StyleResolver&, CSSValue&);
     56    static String convertString(StyleResolver&, CSSValue&);
     57    static String convertStringOrAuto(StyleResolver&, CSSValue&);
     58    static String convertStringOrNone(StyleResolver&, CSSValue&);
    5659
    5760private:
     
    250253}
    251254
     255inline String StyleBuilderConverter::convertString(StyleResolver&, CSSValue& value)
     256{
     257    return downcast<CSSPrimitiveValue>(value).getStringValue();
     258}
     259
     260inline String StyleBuilderConverter::convertStringOrAuto(StyleResolver& styleResolver, CSSValue& value)
     261{
     262    if (downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueAuto)
     263        return nullAtom;
     264    return convertString(styleResolver, value);
     265}
     266
     267inline String StyleBuilderConverter::convertStringOrNone(StyleResolver& styleResolver, CSSValue& value)
     268{
     269    if (downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueNone)
     270        return nullAtom;
     271    return convertString(styleResolver, value);
     272}
     273
    252274} // namespace WebCore
    253275
Note: See TracChangeset for help on using the changeset viewer.