Skip to content
Permalink
Browse files
move warning about css values and render style constants closer to wh…
…ere 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:


Canonical link: https://commits.webkit.org/94896@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106980 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
idealisms committed Feb 7, 2012
1 parent f47f5a7 commit 0907bbd3147f817bd9037a90aac2e19294b59483
Showing 6 changed files with 58 additions and 33 deletions.
@@ -1,3 +1,28 @@
2012-02-07 Tony Chang <tony@chromium.org>

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:

2012-02-06 Jer Noble <jer.noble@apple.com>

Use CMClock as a timing source for PlatformClock where available.
@@ -1396,7 +1396,15 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStylePosition e)

template<> inline CSSPrimitiveValue::operator EListStylePosition() const
{
return (EListStylePosition)(m_value.ident - CSSValueOutside);
switch (m_value.ident) {
case CSSValueOutside:
return OUTSIDE;
case CSSValueInside:
return INSIDE;
default:
ASSERT_NOT_REACHED();
return OUTSIDE;
}
}

template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e)
@@ -2285,7 +2293,17 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserModify e)

template<> inline CSSPrimitiveValue::operator EUserModify() const
{
return static_cast<EUserModify>(m_value.ident - CSSValueReadOnly);
switch (m_value.ident) {
case CSSValueReadOnly:
return READ_ONLY;
case CSSValueReadWrite:
return READ_WRITE;
case CSSValueReadWritePlaintextOnly:
return READ_WRITE_PLAINTEXT_ONLY;
default:
ASSERT_NOT_REACHED();
return READ_ONLY;
}
}

template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserSelect e)
@@ -1,13 +1,5 @@
// These are all values accepted for CSS2.
//
// WARNING:
// --------
//
// The Values are sorted according to the properties they belong to,
// and have to be in the same order as the enums in RenderStyleConstants.h.
//
// If not, the optimizations in the cssparser and style selector will fail,
// and produce incorrect results.
// CSS value names
//
inherit
initial
@@ -16,6 +8,7 @@ initial
// CSS_PROP_BORDER_TOP_STYLE
// CSS_PROP_BORDER_BOTTOM_STYLE
// CSS_PROP_BORDER_LEFT_STYLE
// The order here must match the order of the EBorderStyle enum in RenderStyleConstants.h.
none
hidden
inset
@@ -215,6 +208,7 @@ bottom
-webkit-baseline-middle
//
// CSS_PROP_TEXT_ALIGN:
// The order here must match the order of the ETextAlign enum in RenderStyleConstants.h.
//
-webkit-auto
left
@@ -232,6 +226,7 @@ outside
inside
//
// CSS_PROP_LIST_STYLE_TYPE:
// The order here must match the order of the EListStyleType enum in RenderStyleConstants.h.
//
disc
circle
@@ -316,6 +311,7 @@ katakana-iroha
//none
//
// CSS_PROP_DISPLAY:
// The order here must match the order of the EDisplay enum in RenderStyleConstants.h.
//
inline
block
@@ -344,6 +340,7 @@ table-caption
//none
//
// CSS_PROP_CURSOR:
// The order here must match the order of the ECursor enum in RenderStyleConstants.h.
//
auto
crosshair
@@ -603,7 +600,7 @@ space
after-white-space

// -webkit-appearance
// The order here should match the order in the ControlPart enum in ThemeTypes.h.
// The order here must match the order in the ControlPart enum in ThemeTypes.h.
// All appearance values that should be accepted by the parser should be listed between 'checkbox' and 'textarea':
checkbox
radio
@@ -1,5 +1,5 @@
//
// all valid SVG CSS2 properties.
// SVG CSS property names
//

// SVG style props
@@ -1,14 +1,5 @@
// These are all values accepted for CSS2.
//
// WARNING:
// --------
//
// The Values are sorted according to the properties they belong to,
// and have to be in the same order as the enums in RenderStyle.h.
//
// If not, the optimizations in the cssparser and style selector will fail,
// and produce incorrect results.
//
// SVG CSS value names
//
// CSS_PROP_*_COLOR
//
@@ -28,14 +28,6 @@

namespace WebCore {

/*
* WARNING:
* --------
*
* The order of the values in the enums have to agree with the order specified
* in CSSValueKeywords.in, otherwise some optimizations in the parser will fail,
* and produce invalid results.
*/
static const size_t PrintColorAdjustBits = 1;
enum PrintColorAdjust {
PrintColorAdjustEconomy,
@@ -93,7 +85,7 @@ enum ColumnSpan { ColumnSpanOne = 0, ColumnSpanAll};
enum EBorderCollapse { BSEPARATE = 0, BCOLLAPSE = 1 };

// These have been defined in the order of their precedence for border-collapsing. Do
// not change this order!
// not change this order! This order also must match the order in CSSValueKeywords.in.
enum EBorderStyle { BNONE, BHIDDEN, INSET, GROOVE, OUTSET, RIDGE, DOTTED, DASHED, SOLID, DOUBLE };

enum EBorderPrecedence { BOFF, BTABLE, BCOLGROUP, BCOL, BROWGROUP, BROW, BCELL };
@@ -229,7 +221,7 @@ enum EResize {
RESIZE_NONE, RESIZE_BOTH, RESIZE_HORIZONTAL, RESIZE_VERTICAL
};

// The order of this enum must match the order of the list style types in CSSValueKeywords.in.
// The order of this enum must match the order of the list style types in CSSValueKeywords.in.
enum EListStyleType {
Disc,
Circle,
@@ -335,6 +327,7 @@ enum EWhiteSpace {
NORMAL, PRE, PRE_WRAP, PRE_LINE, NOWRAP, KHTML_NOWRAP
};

// The order of this enum must match the order of the text align values in CSSValueKeywords.in.
enum ETextAlign {
TAAUTO, LEFT, RIGHT, CENTER, JUSTIFY, WEBKIT_LEFT, WEBKIT_RIGHT, WEBKIT_CENTER, TASTART, TAEND,
};
@@ -408,6 +401,7 @@ enum ECursor {
CURSOR_NONE
};

// The order of this enum must match the order of the display values in CSSValueKeywords.in.
enum EDisplay {
INLINE, BLOCK, LIST_ITEM, RUN_IN, COMPACT, INLINE_BLOCK,
TABLE, INLINE_TABLE, TABLE_ROW_GROUP,

0 comments on commit 0907bbd

Please sign in to comment.