Bug 166735 - Give RenderObject a Page& getter.
Summary: Give RenderObject a Page& getter.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-05 11:41 PST by Andreas Kling
Modified: 2017-01-06 06:06 PST (History)
3 users (show)

See Also:


Attachments
Patch for EWS (54.66 KB, patch)
2017-01-05 11:44 PST, Andreas Kling
no flags Details | Formatted Diff | Diff
Patch II for EWS (74.73 KB, patch)
2017-01-05 12:34 PST, Andreas Kling
no flags Details | Formatted Diff | Diff
Patch (77.00 KB, patch)
2017-01-05 13:14 PST, Andreas Kling
no flags Details | Formatted Diff | Diff
Patch (70.55 KB, patch)
2017-01-05 13:23 PST, Andreas Kling
darin: review+
Details | Formatted Diff | Diff
Patch for landing (71.55 KB, patch)
2017-01-06 05:30 PST, Andreas Kling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2017-01-05 11:41:55 PST
Now that we're getting better at felling render trees, it seems like we can make some promises about there always being a Page while a tree is standing.

Having a Page& RenderObject::page() will get rid of a ton of sketchy branches.
Comment 1 Andreas Kling 2017-01-05 11:44:48 PST
Created attachment 298118 [details]
Patch for EWS
Comment 2 Andreas Kling 2017-01-05 12:34:16 PST
Created attachment 298123 [details]
Patch II for EWS
Comment 3 Andreas Kling 2017-01-05 13:14:24 PST
Created attachment 298127 [details]
Patch
Comment 4 Andreas Kling 2017-01-05 13:23:35 PST
Created attachment 298128 [details]
Patch
Comment 5 Darin Adler 2017-01-05 23:45:37 PST
Comment on attachment 298128 [details]
Patch

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

Almost enough to make me think I don’t need to keep moving things from Page to MainFrame.

> Source/WebCore/rendering/RenderLayerCompositor.cpp:4145
> +Page& RenderLayerCompositor::page() const
> +{
> +    return m_renderView.page();
> +}

Can this be inlined, or would that require adding more includes?

> Source/WebCore/rendering/RenderObject.cpp:146
>  RenderTheme& RenderObject::theme() const
>  {
> -    ASSERT(document().page());
> -    return document().page()->theme();
> +    return page().theme();
>  }

Can this be inlined, or would that require adding more includes?

> Source/WebCore/rendering/RenderObject.h:1013
> +    ASSERT(frame().page());

I would love it if we added a brief comment here explaining why this is guaranteed to be non-null.

> Source/WebCore/rendering/RenderTheme.cpp:789
> +    return o.page().focusController().isActive();

How about the word object instead of "o"?
Comment 6 Andreas Kling 2017-01-06 05:29:44 PST
(In reply to comment #5)
> Comment on attachment 298128 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=298128&action=review
> 
> Almost enough to make me think I don’t need to keep moving things from Page
> to MainFrame.

Almost!

> > Source/WebCore/rendering/RenderLayerCompositor.cpp:4145
> > +Page& RenderLayerCompositor::page() const
> > +{
> > +    return m_renderView.page();
> > +}
> 
> Can this be inlined, or would that require adding more includes?

Yeah, include cycle problem. We can solve it but I don't think it's important.

> > Source/WebCore/rendering/RenderObject.cpp:146
> >  RenderTheme& RenderObject::theme() const
> >  {
> > -    ASSERT(document().page());
> > -    return document().page()->theme();
> > +    return page().theme();
> >  }
> 
> Can this be inlined, or would that require adding more includes?

Same here.

> > Source/WebCore/rendering/RenderObject.h:1013
> > +    ASSERT(frame().page());
> 
> I would love it if we added a brief comment here explaining why this is
> guaranteed to be non-null.

Ok, I will add a comment here, and a longer comment in Frame::willDetachPage().
Comment 7 Andreas Kling 2017-01-06 05:30:07 PST
Created attachment 298197 [details]
Patch for landing
Comment 8 WebKit Commit Bot 2017-01-06 06:06:28 PST
Comment on attachment 298197 [details]
Patch for landing

Clearing flags on attachment: 298197

Committed r210436: <http://trac.webkit.org/changeset/210436>
Comment 9 WebKit Commit Bot 2017-01-06 06:06:32 PST
All reviewed patches have been landed.  Closing bug.