<http://webkit.org/b/79468>
Reviewed by Antti Koivisto.
- Bypass CSSParser when adding constant values to attribute styles.
- Added fast paths for the valid HTMLTablePartElement align values.
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::collectStyleForAttribute):
* html/HTMLHRElement.cpp:
(WebCore::HTMLHRElement::collectStyleForAttribute):
* html/HTMLIFrameElement.cpp:
(WebCore::HTMLIFrameElement::collectStyleForAttribute):
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::collectStyleForAttribute):
* html/HTMLTablePartElement.cpp:
(WebCore::HTMLTablePartElement::collectStyleForAttribute):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108765
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-24 Andreas Kling <awesomekling@apple.com>
+
+ Miscellaneous CSSParser dodging in presentation attribute parsing.
+ <http://webkit.org/b/79468>
+
+ Reviewed by Antti Koivisto.
+
+ - Bypass CSSParser when adding constant values to attribute styles.
+ - Added fast paths for the valid HTMLTablePartElement align values.
+
+ * html/HTMLEmbedElement.cpp:
+ (WebCore::HTMLEmbedElement::collectStyleForAttribute):
+ * html/HTMLHRElement.cpp:
+ (WebCore::HTMLHRElement::collectStyleForAttribute):
+ * html/HTMLIFrameElement.cpp:
+ (WebCore::HTMLIFrameElement::collectStyleForAttribute):
+ * html/HTMLTableElement.cpp:
+ (WebCore::HTMLTableElement::collectStyleForAttribute):
+ * html/HTMLTablePartElement.cpp:
+ (WebCore::HTMLTablePartElement::collectStyleForAttribute):
+
2012-02-24 Dana Jansens <danakj@chromium.org>
[chromium] Avoid culling work for fully-non-opaque tiles, and add tracing for draw culling
{
if (attr->name() == hiddenAttr) {
if (equalIgnoringCase(attr->value(), "yes") || equalIgnoringCase(attr->value(), "true")) {
- addHTMLLengthToStyle(style, CSSPropertyWidth, "0"); // FIXME: Pass as integer.
- addHTMLLengthToStyle(style, CSSPropertyHeight, "0"); // FIXME: Pass as integer.
+ addPropertyToAttributeStyle(style, CSSPropertyWidth, 0, CSSPrimitiveValue::CSS_PX);
+ addPropertyToAttributeStyle(style, CSSPropertyHeight, 0, CSSPrimitiveValue::CSS_PX);
}
} else
HTMLPlugInImageElement::collectStyleForAttribute(attr, style);
{
if (attr->name() == alignAttr) {
if (equalIgnoringCase(attr->value(), "left")) {
- addPropertyToAttributeStyle(style, CSSPropertyMarginLeft, "0"); // FIXME: Pass as integer.
+ addPropertyToAttributeStyle(style, CSSPropertyMarginLeft, 0, CSSPrimitiveValue::CSS_PX);
addPropertyToAttributeStyle(style, CSSPropertyMarginRight, CSSValueAuto);
} else if (equalIgnoringCase(attr->value(), "right")) {
addPropertyToAttributeStyle(style, CSSPropertyMarginLeft, CSSValueAuto);
- addPropertyToAttributeStyle(style, CSSPropertyMarginRight, "0"); // FIXME: Pass as integer.
+ addPropertyToAttributeStyle(style, CSSPropertyMarginRight, 0, CSSPrimitiveValue::CSS_PX);
} else {
addPropertyToAttributeStyle(style, CSSPropertyMarginLeft, CSSValueAuto);
addPropertyToAttributeStyle(style, CSSPropertyMarginRight, CSSValueAuto);
bool ok;
int v = attr->value().toInt(&ok);
if (ok && !v)
- addHTMLLengthToStyle(style, CSSPropertyWidth, "1"); // FIXME: Pass as integer.
+ addPropertyToAttributeStyle(style, CSSPropertyWidth, 1, CSSPrimitiveValue::CSS_PX);
else
addHTMLLengthToStyle(style, CSSPropertyWidth, attr->value());
} else if (attr->name() == colorAttr) {
StringImpl* si = attr->value().impl();
int size = si->toInt();
if (size <= 1)
- addPropertyToAttributeStyle(style, CSSPropertyBorderBottomWidth, String("0")); // FIXME: Pass as integer.
+ addPropertyToAttributeStyle(style, CSSPropertyBorderBottomWidth, 0, CSSPrimitiveValue::CSS_PX);
else
- addHTMLLengthToStyle(style, CSSPropertyHeight, String::number(size - 2)); // FIXME: Pass as integer.
+ addPropertyToAttributeStyle(style, CSSPropertyHeight, size - 2, CSSPrimitiveValue::CSS_PX);
} else
HTMLElement::collectStyleForAttribute(attr, style);
}
// a presentational hint that the border should be off if set to zero.
if (!attr->isNull() && !attr->value().toInt()) {
// Add a rule that nulls out our border width.
- addHTMLLengthToStyle(style, CSSPropertyBorderWidth, "0"); // FIXME: Pass as integer.
+ addPropertyToAttributeStyle(style, CSSPropertyBorderWidth, 0, CSSPrimitiveValue::CSS_PX);
}
} else
HTMLFrameElementBase::collectStyleForAttribute(attr, style);
else if (attr->name() == heightAttr)
addHTMLLengthToStyle(style, CSSPropertyHeight, attr->value());
else if (attr->name() == borderAttr) {
- int border = attr->isEmpty() ? 1 : attr->value().toInt();
- addHTMLLengthToStyle(style, CSSPropertyBorderWidth, String::number(border)); // FIXME: Pass as integer.
+ int borderWidth = attr->isEmpty() ? 1 : attr->value().toInt();
+ addPropertyToAttributeStyle(style, CSSPropertyBorderWidth, borderWidth, CSSPrimitiveValue::CSS_PX);
} else if (attr->name() == bordercolorAttr) {
if (!attr->isEmpty())
addHTMLColorToStyle(style, CSSPropertyBorderColor, attr->value());
addPropertyToAttributeStyle(style, CSSPropertyBorderStyle, CSSValueSolid);
}
} else if (attr->name() == valignAttr) {
- if (!attr->value().isEmpty())
+ if (equalIgnoringCase(attr->value(), "top"))
+ addPropertyToAttributeStyle(style, CSSPropertyVerticalAlign, CSSValueTop);
+ else if (equalIgnoringCase(attr->value(), "middle"))
+ addPropertyToAttributeStyle(style, CSSPropertyVerticalAlign, CSSValueMiddle);
+ else if (equalIgnoringCase(attr->value(), "bottom"))
+ addPropertyToAttributeStyle(style, CSSPropertyVerticalAlign, CSSValueBottom);
+ else if (equalIgnoringCase(attr->value(), "baseline"))
+ addPropertyToAttributeStyle(style, CSSPropertyVerticalAlign, CSSValueBaseline);
+ else
addPropertyToAttributeStyle(style, CSSPropertyVerticalAlign, attr->value());
} else if (attr->name() == alignAttr) {
if (equalIgnoringCase(attr->value(), "middle") || equalIgnoringCase(attr->value(), "center"))