Commit 821a1004 authored by ch.dumez@samsung.com's avatar ch.dumez@samsung.com

Avoid double attribute lookup in HTMLElement::matchesReadWritePseudoClass()

Avoid double attribute lookup in HTMLElement::matchesReadWritePseudoClass().
Instead of calling fastHasAttribute() then fastGetAttribute(), call
fastGetAttribute() directly and check if the returned value is nullAtom.

fastHasAttribute() and fastGetAttribute() do exactly the same thing internally
and the only difference is the return type. The attribute lookup is a linear
search and thus it is a good idea to avoid doing it twice.

R=adamk, eseidel

Review URL: https://codereview.chromium.org/184613003

git-svn-id: svn://svn.chromium.org/blink/trunk@168318 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b82a3986
......@@ -935,9 +935,8 @@ bool HTMLElement::matchesReadOnlyPseudoClass() const
bool HTMLElement::matchesReadWritePseudoClass() const
{
if (fastHasAttribute(contenteditableAttr)) {
const AtomicString& value = fastGetAttribute(contenteditableAttr);
const AtomicString& value = fastGetAttribute(contenteditableAttr);
if (!value.isNull()) {
if (value.isEmpty() || equalIgnoringCase(value, "true") || equalIgnoringCase(value, "plaintext-only"))
return true;
if (equalIgnoringCase(value, "false"))
......
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