WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
238208
Add css-typed-om color IDL skeletons
https://bugs.webkit.org/show_bug.cgi?id=238208
Summary
Add css-typed-om color IDL skeletons
Alex Christensen
Reported
2022-03-22 10:49:14 PDT
Add css-typed-om color IDL skeletons
Attachments
Patch
(115.73 KB, patch)
2022-03-22 10:49 PDT
,
Alex Christensen
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(116.98 KB, patch)
2022-03-22 11:21 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(118.67 KB, patch)
2022-03-22 14:59 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(140.37 KB, patch)
2022-03-23 13:53 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(140.16 KB, patch)
2022-03-25 09:29 PDT
,
Alex Christensen
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Alex Christensen
Comment 1
2022-03-22 10:49:58 PDT
Created
attachment 455393
[details]
Patch
Alex Christensen
Comment 2
2022-03-22 11:21:40 PDT
Created
attachment 455401
[details]
Patch
Alex Christensen
Comment 3
2022-03-22 14:59:25 PDT
Created
attachment 455433
[details]
Patch
Sam Weinig
Comment 4
2022-03-23 09:58:06 PDT
Comment on
attachment 455433
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=455433&action=review
> Source/WebCore/ChangeLog:10 > +
This should be more filled out and probably include a link to the spec.
> Source/WebCore/ChangeLog:108 > + * css/typedom/color/CSSOKLab.idl: Copied from Source/WebCore/css/typedom/CSSKeywordValue.idl.
Not sure these "Copied from ..." texts are useful.
> Source/WebCore/css/typedom/color/CSSColor.h:37 > + static Ref<CSSColor> create(CSSKeywordish&& colorSpace, Vector<CSSColorPercent>&& channels, CSSNumberish&& alpha)
I don't think there is much value in making these explicitly r-values. I prefer the patter of making the parameters normal values, and moving into them. This gives more flexibility for the same level of performance. Same for the constructor and setters.
> Source/WebCore/css/typedom/color/CSSColor.idl:30 > +[
I've been trying to encourage linking to the IDL in the spec for each IDL file.
> Source/WebCore/css/typedom/color/CSSColor.idl:31 > + EnabledAtRuntime=CSSTypedOMEnabled,
Trying to remove EnabledAtRuntime (since it is a singleton) so this should use EnabledBySettings instead (same for all the others).
> Source/WebCore/css/typedom/color/CSSColor.idl:38 > + // FIXME: Add support for ObservableArray and add this.
Worth adding a bugzilla URL for this.
> Source/WebCore/css/typedom/color/CSSColorValue.h:45 > + RefPtr<CSSKeywordValue> colorSpace() { return nullptr; } > + RefPtr<CSSColorValue> to(CSSKeywordish&&) { return nullptr; }
Are these correct? Or still to be implemented?
> Source/WebCore/css/typedom/color/CSSHSL.cpp:41 > + , m_alpha(WTFMove(alpha)) { }
Our style usually puts the { } on separate lines like: { }
> Source/WebCore/css/typedom/color/CSSHSL.h:47 > + void setAlpha(CSSColorPercent&& alpha) { m_alpha = WTFMove(alpha); } > +private:
Please add a newline between these.
> Source/WebCore/css/typedom/color/CSSHWB.h:52 > + Ref<CSSNumericValue> m_h; > + CSSNumberish m_w; > + CSSNumberish m_b;
In the other classes, you have used the full name for the members, so these should probably be m_hue, m_whiteness, m_blackness.
> Source/WebCore/css/typedom/color/CSSLCH.h:37 > + template<typename... Args> static Ref<CSSLCH> create(Args&&... args) { return adoptRef(*new CSSLCH(std::forward<Args>(args)...)); }
For this one, using && is correct, since this is not an r-value, but rather a "universal reference" since Args is a template parameter.
> Source/WebCore/css/typedom/color/CSSLCH.h:50 > + CSSColorPercent m_luminance;
This should be called m_lightness (that is what it is called for Lab/LCH/OKLab/OKLCH)
> Source/WebCore/css/typedom/color/CSSOKLCH.h:50 > + CSSColorPercent m_luminance;
This should be called m_lightness (that is what it is called for Lab/LCH/OKLab/OKLCH)
> Source/WebCore/css/typedom/color/CSSRGB.h:54 > + CSSColorRGBComp m_r; > + CSSColorRGBComp m_g; > + CSSColorRGBComp m_b;
I would rename these to m_red, m_green, m_blue to match the other classes members.
Alex Christensen
Comment 5
2022-03-23 13:53:52 PDT
Created
attachment 455548
[details]
Patch
Sam Weinig
Comment 6
2022-03-25 08:45:12 PDT
Comment on
attachment 455548
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=455548&action=review
> Source/WebCore/css/typedom/color/CSSColor.h:42 > + void setAlpha(CSSNumberish&& alpha) { m_alpha = WTFMove(alpha); }
You don't need (or I would argue want) the && here. (Same for all the other uses outside of the template create use case. In general, most places really don't require it).
> Source/WebCore/css/typedom/color/CSSHWB.h:47 > + void setAlpha(CSSNumberish&& alpha) { m_alpha = WTFMove(alpha); } > +private:
Missing newline.
Alex Christensen
Comment 7
2022-03-25 09:29:32 PDT
Created
attachment 455772
[details]
Patch
EWS
Comment 8
2022-03-25 11:04:29 PDT
Committed
r291867
(
248873@main
): <
https://commits.webkit.org/248873@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 455772
[details]
.
Radar WebKit Bug Importer
Comment 9
2022-03-25 11:05:19 PDT
<
rdar://problem/90846706
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug