Commit 16fbf381 authored by ddkilzer's avatar ddkilzer

LayoutTests:

        Reviewed by Hyatt.  Patch by Mitz.

        - test updated for http://bugs.webkit.org/show_bug.cgi?id=12215
          Treat 'overflow' and '-webkit-border-radius' as shorthands when parsing and
          when removing.

        * fast/css/remove-shorthand-expected.txt:
        * fast/css/remove-shorthand.html:

WebCore:

        Reviewed by Hyatt.  Patch by Mitz.

        - http://bugs.webkit.org/show_bug.cgi?id=12215
          Treat 'overflow' and '-webkit-border-radius' as shorthands when parsing and
          when removing.

        Test: fast/css/remove-shorthand.html (updated)

        * css/CSSMutableStyleDeclaration.cpp:
        (WebCore::initShorthandMap):
        * css/cssparser.cpp:
        (WebCore::CSSParser::parseValue):



git-svn-id: svn://svn.chromium.org/blink/trunk@18815 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 4ebeb8bf
2007-01-12 Mitz Pettel <mitz@webkit.org>
Reviewed by Hyatt.
- test updated for http://bugs.webkit.org/show_bug.cgi?id=12215
Treat 'overflow' and '-webkit-border-radius' as shorthands when parsing and
when removing.
* fast/css/remove-shorthand-expected.txt:
* fast/css/remove-shorthand.html:
2007-01-12 Rob Buis <buis@kde.org> 2007-01-12 Rob Buis <buis@kde.org>
Reviewed by Mitz. Reviewed by Mitz.
...@@ -22,7 +22,9 @@ ...@@ -22,7 +22,9 @@
-webkit-text-stroke: orange 1pt;\ -webkit-text-stroke: orange 1pt;\
-webkit-columns: 100px 3;\ -webkit-columns: 100px 3;\
-webkit-column-rule: thick dashed silver;\ -webkit-column-rule: thick dashed silver;\
border-spacing: 10px 20px;"); border-spacing: 10px 20px;\
-webkit-border-radius: 6px 8px;\
overflow: scroll;");
element.style.removeProperty(shorthand); element.style.removeProperty(shorthand);
log("Removing '" + shorthand + "' leaves '" + element.style.cssText +"'"); log("Removing '" + shorthand + "' leaves '" + element.style.cssText +"'");
} }
...@@ -46,7 +48,9 @@ ...@@ -46,7 +48,9 @@
"-webkit-text-stroke", "-webkit-text-stroke",
"-webkit-columns", "-webkit-columns",
"-webkit-column-rule", "-webkit-column-rule",
"border-spacing" "border-spacing",
"-webkit-border-radius",
"overflow"
]; ];
for (i in shorthands) for (i in shorthands)
......
2007-01-12 Mitz Pettel <mitz@webkit.org>
Reviewed by Hyatt.
- http://bugs.webkit.org/show_bug.cgi?id=12215
Treat 'overflow' and '-webkit-border-radius' as shorthands when parsing and
when removing.
Test: fast/css/remove-shorthand.html (updated)
* css/CSSMutableStyleDeclaration.cpp:
(WebCore::initShorthandMap):
* css/cssparser.cpp:
(WebCore::CSSParser::parseValue):
2007-01-12 Rob Buis <buis@kde.org> 2007-01-12 Rob Buis <buis@kde.org>
Reviewed by Mitz. Reviewed by Mitz.
......
...@@ -237,8 +237,7 @@ static void initShorthandMap(HashMap<int, PropertyLonghand>& shorthandMap) ...@@ -237,8 +237,7 @@ static void initShorthandMap(HashMap<int, PropertyLonghand>& shorthandMap)
#define SET_SHORTHAND_MAP_ENTRY(map, propID, array) \ #define SET_SHORTHAND_MAP_ENTRY(map, propID, array) \
map.set(propID, PropertyLonghand(array, sizeof(array) / sizeof(array[0]))) map.set(propID, PropertyLonghand(array, sizeof(array) / sizeof(array[0])))
// FIXME: The following properties have "shorthand nature" but are not parsed as // FIXME: The 'font' property has "shorthand nature" but is not parsed as a shorthand.
// shorthands: 'font', '-webkit-border-radius' and 'overflow'.
// Do not change the order of the following four shorthands, and keep them together. // Do not change the order of the following four shorthands, and keep them together.
static const int borderProperties[4][3] = { static const int borderProperties[4][3] = {
...@@ -348,9 +347,20 @@ static void initShorthandMap(HashMap<int, PropertyLonghand>& shorthandMap) ...@@ -348,9 +347,20 @@ static void initShorthandMap(HashMap<int, PropertyLonghand>& shorthandMap)
CSS_PROP__WEBKIT_COLUMN_RULE_COLOR, CSS_PROP__WEBKIT_COLUMN_RULE_COLOR,
CSS_PROP__WEBKIT_COLUMN_RULE_STYLE, CSS_PROP__WEBKIT_COLUMN_RULE_STYLE,
CSS_PROP__WEBKIT_COLUMN_RULE_WIDTH CSS_PROP__WEBKIT_COLUMN_RULE_WIDTH
}; };
SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP__WEBKIT_COLUMN_RULE, columnRuleProperties); SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP__WEBKIT_COLUMN_RULE, columnRuleProperties);
static const int overflowProperties[] = { CSS_PROP_OVERFLOW_X, CSS_PROP_OVERFLOW_Y };
SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP_OVERFLOW, overflowProperties);
static const int borderRadiusProperties[] = {
CSS_PROP__WEBKIT_BORDER_TOP_RIGHT_RADIUS,
CSS_PROP__WEBKIT_BORDER_TOP_LEFT_RADIUS,
CSS_PROP__WEBKIT_BORDER_BOTTOM_LEFT_RADIUS,
CSS_PROP__WEBKIT_BORDER_BOTTOM_RIGHT_RADIUS
};
SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP__WEBKIT_BORDER_RADIUS, borderRadiusProperties);
#undef SET_SHORTHAND_MAP_ENTRY #undef SET_SHORTHAND_MAP_ENTRY
} }
......
...@@ -547,9 +547,16 @@ bool CSSParser::parseValue(int propId, bool important) ...@@ -547,9 +547,16 @@ bool CSSParser::parseValue(int propId, bool important)
valid_primitive = true; valid_primitive = true;
break; break;
case CSS_PROP_OVERFLOW: // visible | hidden | scroll | auto | marquee | overlay | inherit case CSS_PROP_OVERFLOW: {
ShorthandScope scope(this, propId);
if (num != 1 || !parseValue(CSS_PROP_OVERFLOW_X, important))
return false;
CSSValue* value = parsedProperties[numParsedProperties - 1]->value();
addProperty(CSS_PROP_OVERFLOW_Y, value, important);
return true;
}
case CSS_PROP_OVERFLOW_X: case CSS_PROP_OVERFLOW_X:
case CSS_PROP_OVERFLOW_Y: case CSS_PROP_OVERFLOW_Y: // visible | hidden | scroll | auto | marquee | overlay | inherit
if (id == CSS_VAL_VISIBLE || id == CSS_VAL_HIDDEN || id == CSS_VAL_SCROLL || id == CSS_VAL_AUTO || if (id == CSS_VAL_VISIBLE || id == CSS_VAL_HIDDEN || id == CSS_VAL_SCROLL || id == CSS_VAL_AUTO ||
id == CSS_VAL_OVERLAY || id == CSS_VAL__WEBKIT_MARQUEE) id == CSS_VAL_OVERLAY || id == CSS_VAL__WEBKIT_MARQUEE)
valid_primitive = true; valid_primitive = true;
...@@ -1046,7 +1053,15 @@ bool CSSParser::parseValue(int propId, bool important) ...@@ -1046,7 +1053,15 @@ bool CSSParser::parseValue(int propId, bool important)
Pair* pair = new Pair(parsedValue1, parsedValue2); Pair* pair = new Pair(parsedValue1, parsedValue2);
CSSPrimitiveValue* val = new CSSPrimitiveValue(pair); CSSPrimitiveValue* val = new CSSPrimitiveValue(pair);
addProperty(propId, val, important); if (propId == CSS_PROP__WEBKIT_BORDER_RADIUS) {
const int properties[4] = { CSS_PROP__WEBKIT_BORDER_TOP_RIGHT_RADIUS,
CSS_PROP__WEBKIT_BORDER_TOP_LEFT_RADIUS,
CSS_PROP__WEBKIT_BORDER_BOTTOM_LEFT_RADIUS,
CSS_PROP__WEBKIT_BORDER_BOTTOM_RIGHT_RADIUS };
for (int i = 0; i < 4; i++)
addProperty(properties[i], val, important);
} else
addProperty(propId, val, important);
return true; return true;
} }
case CSS_PROP_OUTLINE_OFFSET: case CSS_PROP_OUTLINE_OFFSET:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment