Bug 92257 - 2% of all samples running grid demo show up in StyleResolver::canShareStyleWithElement, 20% of those due to getAttribute instead of fastGetAttribute
Summary: 2% of all samples running grid demo show up in StyleResolver::canShareStyleWi...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Seidel (no email)
URL:
Keywords:
Depends on:
Blocks: 92258
  Show dependency treegraph
 
Reported: 2012-07-25 08:25 PDT by Eric Seidel (no email)
Modified: 2012-07-26 04:53 PDT (History)
10 users (show)

See Also:


Attachments
Patch (2.46 KB, patch)
2012-07-25 08:27 PDT, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff
the grid demo (2.86 KB, text/html)
2012-07-25 08:28 PDT, Eric Seidel (no email)
no flags Details
Patch (3.05 KB, patch)
2012-07-26 02:49 PDT, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff
Patch for landing (3.07 KB, patch)
2012-07-26 02:59 PDT, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2012-07-25 08:25:01 PDT
2% of all samples running grid demo show up in StyleResolver::canShareStyleWithElement, 20% of those due to getAttribute instead of fastGetAttribute
Comment 1 Eric Seidel (no email) 2012-07-25 08:27:37 PDT
Created attachment 154362 [details]
Patch
Comment 2 Eric Seidel (no email) 2012-07-25 08:28:02 PDT
The last time this was touched was for kling's rollout in bug 80245.
Comment 3 Eric Seidel (no email) 2012-07-25 08:28:29 PDT
Created attachment 154363 [details]
the grid demo
Comment 4 Eric Seidel (no email) 2012-07-25 17:41:55 PDT
Thoughts, Kling?
Comment 5 Eric Seidel (no email) 2012-07-25 23:38:18 PDT
This is actually higher than I had originally measured, because the getAttribute() call itself shows up as nearly 1%!
Comment 6 Andreas Kling 2012-07-26 01:04:54 PDT
(In reply to comment #4)
> Thoughts, Kling?

This looks like a great low-hanging fruit to go after, though I'm afraid that this won't properly serialize the typeAttr on an SVG element that's the target of a property animation.

We have this check earlier in the function:
if (element->isSVGElement() && static_cast<SVGElement*>(element)->animatedSMILStyleProperties())
    return false;

But animatedSMILStyleProperties() is only concerned with animations on CSS properties.

CC'ing some SVG folks who might know more about this.
Comment 7 Eric Seidel (no email) 2012-07-26 01:35:33 PDT
OK.  I suspect we can detect that case and only take the slow path when necessary.  WildFox? pdr?
Comment 8 Nikolas Zimmermann 2012-07-26 01:39:48 PDT
(In reply to comment #6)
> (In reply to comment #4)
> > Thoughts, Kling?
> 
> This looks like a great low-hanging fruit to go after, though I'm afraid that this won't properly serialize the typeAttr on an SVG element that's the target of a property animation.
SVGs typeAttr is SVGNames::typeAttr, and shouldn't be affected by this at all.
We don't use HTMLNames::typeAttr in SVG except for <script>, which doesn't have a renderer and thus no style as well.

I think it's safe from the SVG side.
Comment 9 Eric Seidel (no email) 2012-07-26 01:43:59 PDT
DEFINE_GLOBAL(QualifiedName, typeAttr, nullAtom, "type", svgNamespaceURI)
vs.
DEFINE_GLOBAL(QualifiedName, typeAttr, nullAtom, "type", xhtmlNamespaceURI)

So they only differ in namespace.

inline Attribute* findAttributeInVector(const Vector<Attribute>& attributes, const QualifiedName& name)
{
    for (unsigned i = 0; i < attributes.size(); ++i) {
        if (attributes.at(i).name().matches(name))
            return &const_cast<Vector<Attribute>& >(attributes).at(i);
    }
    return 0;
}

uses 

    bool matches(const QualifiedName& other) const { return m_impl == other.m_impl || (localName() == other.localName() && namespaceURI() == other.namespaceURI()); }


Which does use namespace.

So it appears that HTMLNames::typeAttr and SVGNames::typeAttr function independently, as WildFox suggests.  Meaning this patch should have no affect on SVG.
Comment 10 Eric Seidel (no email) 2012-07-26 01:49:47 PDT
Woh, wait a sec.  HTMLNames later initializes typeAttr to not include the namespace:

    new ((void*)&typeAttr) QualifiedName(nullAtom, "type", nullAtom);


Clearly makeNames needs to be fixed!

Similarly SVGNames does:

    new ((void*)&typeAttr) QualifiedName(nullAtom, "type", nullAtom);
Comment 11 Eric Seidel (no email) 2012-07-26 02:49:39 PDT
Created attachment 154591 [details]
Patch
Comment 12 Andreas Kling 2012-07-26 02:50:57 PDT
Comment on attachment 154591 [details]
Patch

Fabulous! r=me
Comment 13 Eric Seidel (no email) 2012-07-26 02:59:16 PDT
Created attachment 154593 [details]
Patch for landing
Comment 14 WebKit Review Bot 2012-07-26 04:53:04 PDT
Comment on attachment 154593 [details]
Patch for landing

Clearing flags on attachment: 154593

Committed r123730: <http://trac.webkit.org/changeset/123730>
Comment 15 WebKit Review Bot 2012-07-26 04:53:10 PDT
All reviewed patches have been landed.  Closing bug.