Bug 189643 - Re-order Node flags based on semantics
Summary: Re-order Node flags based on semantics
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-09-14 18:48 PDT by Ryosuke Niwa
Modified: 2018-09-17 14:08 PDT (History)
8 users (show)

See Also:


Attachments
Cleanup (3.33 KB, patch)
2018-09-14 18:52 PDT, Ryosuke Niwa
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2018-09-14 18:48:45 PDT
Re-order Node flags so that flags used for similar purposes are grouped together.
Comment 1 Ryosuke Niwa 2018-09-14 18:52:13 PDT
Created attachment 349845 [details]
Cleanup
Comment 2 Simon Fraser (smfr) 2018-09-14 19:01:16 PDT
Comment on attachment 349845 [details]
Cleanup

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

> Source/WebCore/dom/Node.h:566
> -        IsConnectedFlag = 1 << 6,
> -        IsInShadowTreeFlag = 1 << 7,
> -        IsDocumentNodeFlag = 1 << 8,
> -        IsShadowRootFlag = 1 << 9,
> +        IsDocumentNodeFlag = 1 << 6,
> +        IsShadowRootFlag = 1 << 7,
> +        IsConnectedFlag = 1 << 8,
> +        IsInShadowTreeFlag = 1 << 9,
>          HasRareDataFlag = 1 << 10,

I would prefer all the "= 1 << N" be aligned, so it's easy to see that they are increasing by one, but not everyone agrees.

> Source/WebCore/dom/Node.h:584
> +        StyleValidityShift = 22,

Does this break our ability to use this enum with OptionSet<>?
Comment 3 Ryosuke Niwa 2018-09-17 13:47:15 PDT
(In reply to Simon Fraser (smfr) from comment #2)
> Comment on attachment 349845 [details]
> Cleanup
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=349845&action=review
> 
> > Source/WebCore/dom/Node.h:566
> > -        IsConnectedFlag = 1 << 6,
> > -        IsInShadowTreeFlag = 1 << 7,
> > -        IsDocumentNodeFlag = 1 << 8,
> > -        IsShadowRootFlag = 1 << 9,
> > +        IsDocumentNodeFlag = 1 << 6,
> > +        IsShadowRootFlag = 1 << 7,
> > +        IsConnectedFlag = 1 << 8,
> > +        IsInShadowTreeFlag = 1 << 9,
> >          HasRareDataFlag = 1 << 10,
> 
> I would prefer all the "= 1 << N" be aligned, so it's easy to see that they
> are increasing by one, but not everyone agrees.

Well, if we did that, then we'd have to re-align them whenever a flag with a longer name than the current longest one is added.

> > Source/WebCore/dom/Node.h:584
> > +        StyleValidityShift = 22,
> 
> Does this break our ability to use this enum with OptionSet<>?

Yes. But we can probably just add two vales of StyleValidity directly to NodeFlags and do the manual conversion instead.
Comment 4 Ryosuke Niwa 2018-09-17 14:07:10 PDT
Committed r236083: <https://trac.webkit.org/changeset/236083>
Comment 5 Radar WebKit Bug Importer 2018-09-17 14:08:20 PDT
<rdar://problem/44533292>