Changeset 106980 in webkit


Ignore:
Timestamp:
Feb 7, 2012 1:22:29 PM (12 years ago)
Author:
tony@chromium.org
Message:

move warning about css values and render style constants closer to where it applies
https://bugs.webkit.org/show_bug.cgi?id=78017

Reviewed by Darin Adler.

Move the warning about keeping RenderStyleConstnats.h enums and
CSSValueKeywords.in values in the same order closer to the properties
that the warning applies to. The warning was easy to miss and was
confusing since it doesn't apply to most values.

Also refactor 2 conversion functions to
enumerate the possible values so the order doesn't matter.

No new tests, just refactoring and comment cleanup.

  • css/CSSPrimitiveValueMappings.h:

(WebCore::CSSPrimitiveValue::operator EListStylePosition): Name all possible values and add a NOT_REACHED().
(WebCore::CSSPrimitiveValue::operator EUserModify): Name all possible values and add a NOT_REACHED().

  • css/CSSValueKeywords.in:
  • css/SVGCSSPropertyNames.in:
  • css/SVGCSSValueKeywords.in:
  • rendering/style/RenderStyleConstants.h:
Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r106978 r106980  
     12012-02-07  Tony Chang  <tony@chromium.org>
     2
     3        move warning about css values and render style constants closer to where it applies
     4        https://bugs.webkit.org/show_bug.cgi?id=78017
     5
     6        Reviewed by Darin Adler.
     7
     8        Move the warning about keeping RenderStyleConstnats.h enums and
     9        CSSValueKeywords.in values in the same order closer to the properties
     10        that the warning applies to. The warning was easy to miss and was
     11        confusing since it doesn't apply to most values.
     12
     13        Also refactor 2 conversion functions to
     14        enumerate the possible values so the order doesn't matter.
     15
     16        No new tests, just refactoring and comment cleanup.
     17
     18        * css/CSSPrimitiveValueMappings.h:
     19        (WebCore::CSSPrimitiveValue::operator EListStylePosition): Name all possible values and add a NOT_REACHED().
     20        (WebCore::CSSPrimitiveValue::operator EUserModify): Name all possible values and add a NOT_REACHED().
     21        * css/CSSValueKeywords.in:
     22        * css/SVGCSSPropertyNames.in:
     23        * css/SVGCSSValueKeywords.in:
     24        * rendering/style/RenderStyleConstants.h:
     25
    1262012-02-06  Jer Noble  <jer.noble@apple.com>
    227
  • trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h

    r106274 r106980  
    13971397template<> inline CSSPrimitiveValue::operator EListStylePosition() const
    13981398{
    1399     return (EListStylePosition)(m_value.ident - CSSValueOutside);
     1399    switch (m_value.ident) {
     1400    case CSSValueOutside:
     1401        return OUTSIDE;
     1402    case CSSValueInside:
     1403        return INSIDE;
     1404    default:
     1405        ASSERT_NOT_REACHED();
     1406        return OUTSIDE;
     1407    }
    14001408}
    14011409
     
    22862294template<> inline CSSPrimitiveValue::operator EUserModify() const
    22872295{
    2288     return static_cast<EUserModify>(m_value.ident - CSSValueReadOnly);
     2296    switch (m_value.ident) {
     2297    case CSSValueReadOnly:
     2298        return READ_ONLY;
     2299    case CSSValueReadWrite:
     2300        return READ_WRITE;
     2301    case CSSValueReadWritePlaintextOnly:
     2302        return READ_WRITE_PLAINTEXT_ONLY;
     2303    default:
     2304        ASSERT_NOT_REACHED();
     2305        return READ_ONLY;
     2306    }
    22892307}
    22902308
  • trunk/Source/WebCore/css/CSSValueKeywords.in

    r105694 r106980  
    1 // These are all values accepted for CSS2.
    2 //
    3 // WARNING:
    4 // --------
    5 //
    6 // The Values are sorted according to the properties they belong to,
    7 // and have to be in the same order as the enums in RenderStyleConstants.h.
    8 //
    9 // If not, the optimizations in the cssparser and style selector will fail,
    10 // and produce incorrect results.
     1//
     2// CSS value names
    113//
    124inherit
     
    179// CSS_PROP_BORDER_BOTTOM_STYLE
    1810// CSS_PROP_BORDER_LEFT_STYLE
     11// The order here must match the order of the EBorderStyle enum in RenderStyleConstants.h.
    1912none
    2013hidden
     
    216209//
    217210// CSS_PROP_TEXT_ALIGN:
     211// The order here must match the order of the ETextAlign enum in RenderStyleConstants.h.
    218212//
    219213-webkit-auto
     
    233227//
    234228// CSS_PROP_LIST_STYLE_TYPE:
     229// The order here must match the order of the EListStyleType enum in RenderStyleConstants.h.
    235230//
    236231disc
     
    317312//
    318313// CSS_PROP_DISPLAY:
     314// The order here must match the order of the EDisplay enum in RenderStyleConstants.h.
    319315//
    320316inline
     
    345341//
    346342// CSS_PROP_CURSOR:
     343// The order here must match the order of the ECursor enum in RenderStyleConstants.h.
    347344//
    348345auto
     
    604601
    605602// -webkit-appearance
    606 // The order here should match the order in the ControlPart enum in ThemeTypes.h.
     603// The order here must match the order in the ControlPart enum in ThemeTypes.h.
    607604// All appearance values that should be accepted by the parser should be listed between 'checkbox' and 'textarea':
    608605checkbox
  • trunk/Source/WebCore/css/SVGCSSPropertyNames.in

    r89362 r106980  
    11//
    2 // all valid SVG CSS2 properties.
     2// SVG CSS property names
    33//
    44
  • trunk/Source/WebCore/css/SVGCSSValueKeywords.in

    r92792 r106980  
    1 // These are all values accepted for CSS2.
    21//
    3 // WARNING:
    4 // --------
    5 //
    6 // The Values are sorted according to the properties they belong to,
    7 // and have to be in the same order as the enums in RenderStyle.h.
    8 //
    9 // If not, the optimizations in the cssparser and style selector will fail,
    10 // and produce incorrect results.
    11 //
     2// SVG CSS value names
    123//
    134// CSS_PROP_*_COLOR
  • trunk/Source/WebCore/rendering/style/RenderStyleConstants.h

    r105694 r106980  
    2929namespace WebCore {
    3030
    31 /*
    32  * WARNING:
    33  * --------
    34  *
    35  * The order of the values in the enums have to agree with the order specified
    36  * in CSSValueKeywords.in, otherwise some optimizations in the parser will fail,
    37  * and produce invalid results.
    38  */
    3931static const size_t PrintColorAdjustBits = 1;
    4032enum PrintColorAdjust {
     
    9486
    9587// These have been defined in the order of their precedence for border-collapsing. Do
    96 // not change this order!
     88// not change this order! This order also must match the order in CSSValueKeywords.in.
    9789enum EBorderStyle { BNONE, BHIDDEN, INSET, GROOVE, OUTSET, RIDGE, DOTTED, DASHED, SOLID, DOUBLE };
    9890
     
    230222};
    231223
    232 // The order of this enum must match the order of the list style types in CSSValueKeywords.in. 
     224// The order of this enum must match the order of the list style types in CSSValueKeywords.in.
    233225enum EListStyleType {
    234226    Disc,
     
    336328};
    337329
     330// The order of this enum must match the order of the text align values in CSSValueKeywords.in.
    338331enum ETextAlign {
    339332    TAAUTO, LEFT, RIGHT, CENTER, JUSTIFY, WEBKIT_LEFT, WEBKIT_RIGHT, WEBKIT_CENTER, TASTART, TAEND,
     
    409402};
    410403
     404// The order of this enum must match the order of the display values in CSSValueKeywords.in.
    411405enum EDisplay {
    412406    INLINE, BLOCK, LIST_ITEM, RUN_IN, COMPACT, INLINE_BLOCK,
Note: See TracChangeset for help on using the changeset viewer.