Commit d8db0877 authored by darin@apple.com's avatar darin@apple.com

Do a bit of optimization and cleanup in the HTMLElement class

https://bugs.webkit.org/show_bug.cgi?id=122640

Reviewed by Andreas Kling.

* html/HTMLElement.cpp:
(WebCore::unicodeBidiAttributeForDirAuto): Take a reference.
(WebCore::HTMLElement::collectStyleForPresentationAttribute): Pass one.
(WebCore::mergeWithNextTextNode): Take a reference to a Text node instead
of a PassRefPtr to a Node. Also removed unnecessary check of parentNode.
Also update to new calling convention for mergeWithNextTextNode.
(WebCore::HTMLElement::setOuterHTML): Use parentElement instead of
parentNode, since Antti says that's the future, and either will work here.
Also use nullptr.
(WebCore::HTMLElement::textToFragment): Fix indentation and use nullptr.
(WebCore::HTMLElement::setOuterText): Use a RefPtr for the parent here,
since otherwise there is no guarantee it survives. Also use nullptr and
update to new calling convention for mergeWithNextTextNode.
(WebCore::HTMLElement::insertAdjacent): Use nullptr.
(WebCore::HTMLElement::insertAdjacentElement): Use nullptr.
(WebCore::contextElementForInsertion): Use nullptr.
(WebCore::HTMLElement::contentEditable): Use ASCIILiteral.
(WebCore::HTMLElement::setContentEditable): Use AtomicString::ConstructFromLiteral.
(WebCore::HTMLElement::draggable): Use fastGetAttribute.
(WebCore::HTMLElement::setDraggable): Use AtomicString::ConstructFromLiteral.
(WebCore::HTMLElement::setSpellcheck): Use AtomicString::ConstructFromLiteral.
(WebCore::HTMLElement::click): Use nullptr.
(WebCore::HTMLElement::accessKeyAction): Use nullptr.
(WebCore::HTMLElement::title): Use fastGetAttribute.
(WebCore::HTMLElement::translateAttributeMode): Use fastGetAttribute, isNull,
and isEmpty.
(WebCore::HTMLElement::translate): Use parentElement and toHTMLElement.
Use early-continue style instead of nesting the whole loop body inside an if.
(WebCore::setHasDirAutoFlagRecursively): Use nullptr.
(WebCore::HTMLElement::hasDirectionAuto): Use isNull.
(WebCore::HTMLElement::directionality): Use nullptr.
(WebCore::HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged): Use nullptr.
(WebCore::HTMLElement::addHTMLLengthToStyle): Use longer variable names.

* html/HTMLTableCellElement.cpp:
(WebCore::HTMLTableCellElement::abbr): Use fastGetAttribute.
(WebCore::HTMLTableCellElement::axis): Ditto.
(WebCore::HTMLTableCellElement::headers): Ditto.
(WebCore::HTMLTableCellElement::scope): Ditto.
* html/HTMLTableColElement.cpp:
(WebCore::HTMLTableColElement::width): Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@157300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0717e0de
2013-10-10 Darin Adler <darin@apple.com>
Do a bit of optimization and cleanup in the HTMLElement class
https://bugs.webkit.org/show_bug.cgi?id=122640
Reviewed by Andreas Kling.
* html/HTMLElement.cpp:
(WebCore::unicodeBidiAttributeForDirAuto): Take a reference.
(WebCore::HTMLElement::collectStyleForPresentationAttribute): Pass one.
(WebCore::mergeWithNextTextNode): Take a reference to a Text node instead
of a PassRefPtr to a Node. Also removed unnecessary check of parentNode.
Also update to new calling convention for mergeWithNextTextNode.
(WebCore::HTMLElement::setOuterHTML): Use parentElement instead of
parentNode, since Antti says that's the future, and either will work here.
Also use nullptr.
(WebCore::HTMLElement::textToFragment): Fix indentation and use nullptr.
(WebCore::HTMLElement::setOuterText): Use a RefPtr for the parent here,
since otherwise there is no guarantee it survives. Also use nullptr and
update to new calling convention for mergeWithNextTextNode.
(WebCore::HTMLElement::insertAdjacent): Use nullptr.
(WebCore::HTMLElement::insertAdjacentElement): Use nullptr.
(WebCore::contextElementForInsertion): Use nullptr.
(WebCore::HTMLElement::contentEditable): Use ASCIILiteral.
(WebCore::HTMLElement::setContentEditable): Use AtomicString::ConstructFromLiteral.
(WebCore::HTMLElement::draggable): Use fastGetAttribute.
(WebCore::HTMLElement::setDraggable): Use AtomicString::ConstructFromLiteral.
(WebCore::HTMLElement::setSpellcheck): Use AtomicString::ConstructFromLiteral.
(WebCore::HTMLElement::click): Use nullptr.
(WebCore::HTMLElement::accessKeyAction): Use nullptr.
(WebCore::HTMLElement::title): Use fastGetAttribute.
(WebCore::HTMLElement::translateAttributeMode): Use fastGetAttribute, isNull,
and isEmpty.
(WebCore::HTMLElement::translate): Use parentElement and toHTMLElement.
Use early-continue style instead of nesting the whole loop body inside an if.
(WebCore::setHasDirAutoFlagRecursively): Use nullptr.
(WebCore::HTMLElement::hasDirectionAuto): Use isNull.
(WebCore::HTMLElement::directionality): Use nullptr.
(WebCore::HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged): Use nullptr.
(WebCore::HTMLElement::addHTMLLengthToStyle): Use longer variable names.
* html/HTMLTableCellElement.cpp:
(WebCore::HTMLTableCellElement::abbr): Use fastGetAttribute.
(WebCore::HTMLTableCellElement::axis): Ditto.
(WebCore::HTMLTableCellElement::headers): Ditto.
(WebCore::HTMLTableCellElement::scope): Ditto.
* html/HTMLTableColElement.cpp:
(WebCore::HTMLTableColElement::width): Ditto.
2013-10-10 Darin Adler <darin@apple.com>
Use after free in WebCore::DisplayRefreshMonitorClient::fireDisplayRefreshIfNeeded
This diff is collapsed.
......@@ -131,12 +131,12 @@ bool HTMLTableCellElement::isURLAttribute(const Attribute& attribute) const
String HTMLTableCellElement::abbr() const
{
return getAttribute(abbrAttr);
return fastGetAttribute(abbrAttr);
}
String HTMLTableCellElement::axis() const
{
return getAttribute(axisAttr);
return fastGetAttribute(axisAttr);
}
void HTMLTableCellElement::setColSpan(int n)
......@@ -146,7 +146,7 @@ void HTMLTableCellElement::setColSpan(int n)
String HTMLTableCellElement::headers() const
{
return getAttribute(headersAttr);
return fastGetAttribute(headersAttr);
}
void HTMLTableCellElement::setRowSpan(int n)
......@@ -156,7 +156,7 @@ void HTMLTableCellElement::setRowSpan(int n)
String HTMLTableCellElement::scope() const
{
return getAttribute(scopeAttr);
return fastGetAttribute(scopeAttr);
}
void HTMLTableCellElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const
......
......@@ -97,7 +97,7 @@ void HTMLTableColElement::setSpan(int n)
String HTMLTableColElement::width() const
{
return getAttribute(widthAttr);
return fastGetAttribute(widthAttr);
}
}
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