Bug 120084 - Web Inspector: provide style invalidation reasons with Layout timeline records
Summary: Web Inspector: provide style invalidation reasons with Layout timeline records
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
: 107667 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-08-20 13:42 PDT by Simon Fraser (smfr)
Modified: 2019-01-02 13:03 PST (History)
9 users (show)

See Also:


Attachments
Patch (not for review but feedback welcome). (44.01 KB, patch)
2013-08-20 13:46 PDT, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff
Screenshot (256.98 KB, image/png)
2013-08-20 13:56 PDT, Simon Fraser (smfr)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2013-08-20 13:42:14 PDT
Allow the inspector to show the reason for style invalidation
Comment 1 Simon Fraser (smfr) 2013-08-20 13:46:51 PDT
Created attachment 209226 [details]
Patch (not for review but feedback welcome).
Comment 2 Simon Fraser (smfr) 2013-08-20 13:56:12 PDT
Created attachment 209227 [details]
Screenshot
Comment 3 Darin Adler 2013-08-20 14:14:02 PDT
Comment on attachment 209226 [details]
Patch (not for review but feedback welcome).

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

> Source/WebCore/inspector/InspectorInstrumentation.h:177
> +    enum RecalcStyleReason {

Putting these inside the InspectorInstrumentation namespace makes use of them so wordy. Really wish they weren’t in the namespace.

> Source/WebCore/inspector/InspectorInstrumentation.h:196
> +    class RecalcStyleReasonSetter {

Would be nice to make this explicitly non-copyable.

> Source/WebCore/inspector/InspectorInstrumentation.h:551
> +    static RecalcStyleReason s_recalcStyleReason;

Is the cost for all this extra global variable access affordable?
Comment 4 Radar WebKit Bug Importer 2013-08-21 17:22:21 PDT
<rdar://problem/14802834>
Comment 5 Antti Koivisto 2013-08-23 00:25:34 PDT
Comment on attachment 209226 [details]
Patch (not for review but feedback welcome).

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

> Source/WebCore/inspector/InspectorInstrumentation.h:191
> +    enum RecalcStyleReason {
> +        NoReason,
> +        CSSAnimation,
> +        Fullscreen,
> +        ActiveState,
> +        HoverState,
> +        FocusState,
> +        AttributeChange,
> +        ClassAttributeChange,
> +        InlineStyleChange,
> +        SelectorSensitiveStateChange,
> +        DOMTreeChange,
> +        FormControlChange,
> +        DragStateChange,
> +    };

It might be useful to make the reason tracking part of the style resolve code rather than being in Inspector land. We might have internal uses for this information. Specifically we might want to decide what sort of resolve to do at resolve time instead at invalidation time like we do now.

This is not really a show stopper for this patch (we can switch over later) but something to consider.

>> Source/WebCore/inspector/InspectorInstrumentation.h:196
>> +    class RecalcStyleReasonSetter {
> 
> Would be nice to make this explicitly non-copyable.

Global variable based hackery like this is pretty distasteful. It is probably ok for Inspector interface but at least we shouldn't propagate these elsewhere.
Comment 6 Simon Fraser (smfr) 2013-08-23 08:57:23 PDT
> It might be useful to make the reason tracking part of the style resolve code rather than being in Inspector land. We might have internal uses for this information. Specifically we might want to decide what sort of resolve to do at resolve time instead at invalidation time like we do now.
> 
> This is not really a show stopper for this patch (we can switch over later) but something to consider.

Interesting, though in some cases it would require plumbing a "reason" param through several levels of calls.

> >> Source/WebCore/inspector/InspectorInstrumentation.h:196
> >> +    class RecalcStyleReasonSetter {
> > 
> > Would be nice to make this explicitly non-copyable.
> 
> Global variable based hackery like this is pretty distasteful. It is probably ok for Inspector interface but at least we shouldn't propagate these elsewhere.

InspectorInstrumentation consults a global to decide whether to take a fast return, so this isn't really any different, but I agree that global state is icky.
Comment 7 Timothy Hatcher 2014-01-18 00:43:53 PST
Sorry I didn't see this until now. I like where this is going. With the Timeline work I'm doing this would be great to get landed. Layout reasons would be good too.
Comment 8 BJ Burg 2017-04-06 16:09:03 PDT
<rdar://problem/25493105>
Comment 9 BJ Burg 2017-04-06 16:49:50 PDT
*** Bug 107667 has been marked as a duplicate of this bug. ***