Bug 113123 - Pass context to Node::attach and detach
Summary: Pass context to Node::attach and detach
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Elliott Sprehn
URL:
Keywords:
Depends on:
Blocks: 111627
  Show dependency treegraph
 
Reported: 2013-03-22 17:53 PDT by Elliott Sprehn
Modified: 2013-09-27 09:18 PDT (History)
22 users (show)

See Also:


Attachments
Patch (69.65 KB, patch)
2013-03-22 17:57 PDT, Elliott Sprehn
koivisto: review-
buildbot: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Elliott Sprehn 2013-03-22 17:53:08 PDT
Pass context to Node::attach and detach
Comment 1 Elliott Sprehn 2013-03-22 17:57:15 PDT
Created attachment 194671 [details]
Patch
Comment 2 Elliott Sprehn 2013-03-22 17:59:02 PDT
This needs a perf test (I have one, but it's not in run-perf-tests format), but I wanted to post the patch instead of having it just sitting on my machine.
Comment 3 Eric Seidel (no email) 2013-03-22 18:12:25 PDT
Comment on attachment 194671 [details]
Patch

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

> Source/WebCore/dom/Element.cpp:-1259
> -void Element::createRendererIfNeeded()

Nothing overrides this anymore?

> Source/WebCore/dom/NodeRenderingContext.h:48
> +    NodeRenderingContext(Node*, const AttachContext* = 0);

isn't explicit still needed?
Comment 4 Build Bot 2013-03-22 19:00:40 PDT
Comment on attachment 194671 [details]
Patch

Attachment 194671 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-commit-queue.appspot.com/results/17239397
Comment 5 Elliott Sprehn 2013-03-22 22:52:44 PDT
(In reply to comment #3)
> (From update of attachment 194671 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=194671&action=review
> 
> > Source/WebCore/dom/Element.cpp:-1259
> > -void Element::createRendererIfNeeded()
> 
> Nothing overrides this anymore?

It's not virtual, so there were never any overrides. You're thinking of Element::createRenderer.

Element::createRendererIfNeeded and Text::createTextRendererIfNeeded were both single line, non virtual methods that had only one caller (or two for Text) and delegated immediately to NodeRenderingContext. I inlined the call sites to just use NodeRenderingContext().createRendererForElementIfNeeded (or createRendererForTextIfNeeded) which makes the code more clear and lets you pass the AttachContext inside Element::attach.

> 
> > Source/WebCore/dom/NodeRenderingContext.h:48
> > +    NodeRenderingContext(Node*, const AttachContext* = 0);
> 
> isn't explicit still needed?

Yeah it is, I'll add it back.
Comment 6 Build Bot 2013-03-23 03:38:46 PDT
Comment on attachment 194671 [details]
Patch

Attachment 194671 [details] did not pass win-ews (win):
Output: http://webkit-commit-queue.appspot.com/results/17181917
Comment 7 Build Bot 2013-03-23 09:47:21 PDT
Comment on attachment 194671 [details]
Patch

Attachment 194671 [details] did not pass mac-ews (mac):
Output: http://webkit-commit-queue.appspot.com/results/17190964
Comment 8 Elliott Sprehn 2013-03-24 00:28:44 PDT
I've been thinking about this more and with a bitfield for lazy attach, or making lazy attach not lie about being attached, we could get the same performance improvement by avoiding n^2 behavior. Making lazyAttach not setAttached would be hard in the short term, so I think we should go with the bitfield.

We should still pass the style down through reattach though in recalcStyle.

@eric: How do you feel about using a bitfield instead? If we do that do you want to keep the AttachContext? Passing just the RenderStyle would make this patch simpler.