[webkit-reviews] review denied: [Bug 84413] Use a typedef instead of subclassing WTF::Vector for AttributeVector : [Attachment 138577] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Apr 24 09:41:45 PDT 2012


Andreas Kling <kling at webkit.org> has denied Caio Marcelo de Oliveira Filho
<cmarcelo at webkit.org>'s request for review:
Bug 84413: Use a typedef instead of subclassing WTF::Vector for AttributeVector
https://bugs.webkit.org/show_bug.cgi?id=84413

Attachment 138577: Patch
https://bugs.webkit.org/attachment.cgi?id=138577&action=review

------- Additional Comments from Andreas Kling <kling at webkit.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=138577&action=review


Looks good, but let's fix up some things and make it great!

> Source/WebCore/html/parser/HTMLTreeBuilder.cpp:579
> -	   attributes.removeAttribute(nameAttr);
> -	   attributes.removeAttribute(actionAttr);
> -	   attributes.removeAttribute(promptAttr);
> +	   removeAttribute(&attributes, nameAttr);
> +	   removeAttribute(&attributes, actionAttr);
> +	   removeAttribute(&attributes, promptAttr);

Since this is the only user of removeAttribute(), we could write it as a loop
that does a single pass across the attribute vector instead of 3 passes.

> Source/WebCore/html/parser/HTMLTreeBuilder.cpp:583
> -    attributes.insertAttribute(Attribute(nameAttr, isindexTag.localName()));

> +    if (!getAttributeFromVector(&attributes, nameAttr))
> +	   attributes.append(Attribute(nameAttr, isindexTag.localName()));

Given that the nameAttr is always removed just above, you don't need the
getAttributeFromVector() check here.

> Source/WebCore/html/parser/TextDocumentParser.cpp:64
> -    attributes.insertAttribute(Attribute("style", "word-wrap: break-word;
white-space: pre-wrap;"));
> +    attributes.append(Attribute("style", "word-wrap: break-word;
white-space: pre-wrap;"));

It would be slightly more efficient to pass HTMLNames::styleAttr rather than
"style" here.


More information about the webkit-reviews mailing list