Bug 171909 - Simplify relationship between Attr and Element now that Attr is childless
Summary: Simplify relationship between Attr and Element now that Attr is childless
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on: 171688
Blocks:
  Show dependency treegraph
 
Reported: 2017-05-09 20:21 PDT by Chris Dumez
Modified: 2017-05-10 15:25 PDT (History)
12 users (show)

See Also:


Attachments
Patch (9.89 KB, patch)
2017-05-09 20:35 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (14.25 KB, patch)
2017-05-09 22:40 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (15.40 KB, patch)
2017-05-09 22:48 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (15.42 KB, patch)
2017-05-10 08:29 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (15.42 KB, patch)
2017-05-10 08:40 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (26.07 KB, patch)
2017-05-10 14:27 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (26.07 KB, patch)
2017-05-10 14:52 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2017-05-09 20:21:01 PDT
No need to invalidate Attr node childNodeLists caches when its value changes since Attr Nodes can no longer have children after Bug 171688.
Comment 1 Chris Dumez 2017-05-09 20:35:28 PDT
Created attachment 309576 [details]
Patch
Comment 2 Chris Dumez 2017-05-09 22:40:09 PDT
Created attachment 309580 [details]
Patch
Comment 3 Ryosuke Niwa 2017-05-09 22:41:43 PDT
Comment on attachment 309580 [details]
Patch

I think we should hold off on these refactorings until next STP goes out to make reverting Attr node change is possible.
Comment 4 Chris Dumez 2017-05-09 22:48:28 PDT
Created attachment 309581 [details]
Patch
Comment 5 Chris Dumez 2017-05-09 22:55:08 PDT
(In reply to Ryosuke Niwa from comment #3)
> Comment on attachment 309580 [details]
> Patch
> 
> I think we should hold off on these refactorings until next STP goes out to
> make reverting Attr node change is possible.

Chrome and Firefox have done this a while back already without trouble so it seems very unlikely STP would cause this change to be reverted.

That said, even if it does need to be reverted manually. It wouldn't been difficult. We are not talking about a lot of code.
Comment 6 Ryosuke Niwa 2017-05-09 23:31:11 PDT
Comment on attachment 309581 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=309581&action=review

> Source/WebCore/dom/Node.cpp:894
> +    for (auto* node = this; node; node = node->parentNode()) {
> +        if (auto* lists = node->nodeLists())
> +            lists->invalidateCaches(attrName);

This refactoring would result in a pref regression. It's very important for hasRareData() check to be inlined in this loop.
Comment 7 Chris Dumez 2017-05-10 07:02:00 PDT
(In reply to Ryosuke Niwa from comment #6)
> Comment on attachment 309581 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=309581&action=review
> 
> > Source/WebCore/dom/Node.cpp:894
> > +    for (auto* node = this; node; node = node->parentNode()) {
> > +        if (auto* lists = node->nodeLists())
> > +            lists->invalidateCaches(attrName);
> 
> This refactoring would result in a pref regression. It's very important for
> hasRareData() check to be inlined in this loop.

Oh I did not realize that. I’ll revert this part, thanks.
Comment 8 Antti Koivisto 2017-05-10 07:40:02 PDT
Comment on attachment 309581 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=309581&action=review

> Source/WebCore/dom/Element.cpp:-1281
> -        // FIXME: Refactor this so it makes some sense.

Nice!
Comment 9 Chris Dumez 2017-05-10 08:29:48 PDT
Created attachment 309607 [details]
Patch
Comment 10 Chris Dumez 2017-05-10 08:40:53 PDT
Created attachment 309608 [details]
Patch
Comment 11 Chris Dumez 2017-05-10 13:04:29 PDT
Comment on attachment 309608 [details]
Patch

Ryosuke made some improvement suggestions offline. I am trying them out.
Comment 12 Chris Dumez 2017-05-10 14:27:21 PDT
Created attachment 309635 [details]
Patch
Comment 13 Ryosuke Niwa 2017-05-10 14:38:14 PDT
Comment on attachment 309635 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=309635&action=review

> Source/WebCore/ChangeLog:18
> +        Attr::setValueForBindings() wa thus renamed to setValue(). Its implementation

Typo: wa -> was.

> Source/WebCore/ChangeLog:21
> +        Element::setAttributeInternal().

Maybe you can put this in the pervious line to make it read better?

> Source/WebCore/dom/Node.cpp:841
> +bool Document::shouldInvalidateNodeListAndCollectionCaches() const

Add inline here?

> Source/WebCore/dom/Node.cpp:850
> +bool Document::shouldInvalidateNodeListAndCollectionCachesForAttribute(const QualifiedName& attrName) const

Add inline here?
Comment 14 Chris Dumez 2017-05-10 14:52:42 PDT
Created attachment 309642 [details]
Patch
Comment 15 WebKit Commit Bot 2017-05-10 15:25:46 PDT
Comment on attachment 309642 [details]
Patch

Clearing flags on attachment: 309642

Committed r216632: <http://trac.webkit.org/changeset/216632>
Comment 16 WebKit Commit Bot 2017-05-10 15:25:48 PDT
All reviewed patches have been landed.  Closing bug.