From: kling@webkit.org Date: Fri, 24 Feb 2012 11:21:22 +0000 (+0000) Subject: Miscellaneous CSSParser dodging in presentation attribute parsing. X-Git-Tag: 070512121124~11915 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ec5657f600b835a34248270b46ba12df34d0833b;p=profile%2Fivi%2Fwebkit-efl.git Miscellaneous CSSParser dodging in presentation attribute parsing. 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 --- diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 61ecc24..df5bcfb 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,24 @@ +2012-02-24 Andreas Kling + + Miscellaneous CSSParser dodging in presentation attribute parsing. + + + 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 [chromium] Avoid culling work for fully-non-opaque tiles, and add tracing for draw culling diff --git a/Source/WebCore/html/HTMLEmbedElement.cpp b/Source/WebCore/html/HTMLEmbedElement.cpp index 9ad59a8..06cb9b1 100644 --- a/Source/WebCore/html/HTMLEmbedElement.cpp +++ b/Source/WebCore/html/HTMLEmbedElement.cpp @@ -85,8 +85,8 @@ void HTMLEmbedElement::collectStyleForAttribute(Attribute* attr, StylePropertySe { 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); diff --git a/Source/WebCore/html/HTMLHRElement.cpp b/Source/WebCore/html/HTMLHRElement.cpp index 918b4b9..8f8b6e1 100644 --- a/Source/WebCore/html/HTMLHRElement.cpp +++ b/Source/WebCore/html/HTMLHRElement.cpp @@ -60,11 +60,11 @@ void HTMLHRElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* { 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); @@ -73,7 +73,7 @@ void HTMLHRElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* 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) { @@ -90,9 +90,9 @@ void HTMLHRElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* 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); } diff --git a/Source/WebCore/html/HTMLIFrameElement.cpp b/Source/WebCore/html/HTMLIFrameElement.cpp index 2eed685..a846fa4 100644 --- a/Source/WebCore/html/HTMLIFrameElement.cpp +++ b/Source/WebCore/html/HTMLIFrameElement.cpp @@ -68,7 +68,7 @@ void HTMLIFrameElement::collectStyleForAttribute(Attribute* attr, StylePropertyS // 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); diff --git a/Source/WebCore/html/HTMLTableElement.cpp b/Source/WebCore/html/HTMLTableElement.cpp index 1d2c80a..9420d95 100644 --- a/Source/WebCore/html/HTMLTableElement.cpp +++ b/Source/WebCore/html/HTMLTableElement.cpp @@ -300,8 +300,8 @@ void HTMLTableElement::collectStyleForAttribute(Attribute* attr, StylePropertySe 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()); diff --git a/Source/WebCore/html/HTMLTablePartElement.cpp b/Source/WebCore/html/HTMLTablePartElement.cpp index d481a47..8a39260 100644 --- a/Source/WebCore/html/HTMLTablePartElement.cpp +++ b/Source/WebCore/html/HTMLTablePartElement.cpp @@ -59,7 +59,15 @@ void HTMLTablePartElement::collectStyleForAttribute(Attribute* attr, StyleProper 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"))