WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
REOPENED
234405
Remove unneeded webkit specific CSS attribute for Image Control Menu.
https://bugs.webkit.org/show_bug.cgi?id=234405
Summary
Remove unneeded webkit specific CSS attribute for Image Control Menu.
Megan Gardner
Reported
2021-12-16 13:54:45 PST
Remove unneeded webkit specific CSS attribute for Image Control Menu.
Attachments
Patch
(7.96 KB, patch)
2021-12-16 13:59 PST
,
Megan Gardner
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(7.90 KB, patch)
2021-12-16 16:22 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch
(11.51 KB, patch)
2021-12-16 17:19 PST
,
Megan Gardner
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(12.45 KB, patch)
2021-12-16 18:57 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch
(14.79 KB, patch)
2021-12-16 19:44 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch
(16.22 KB, patch)
2021-12-17 00:08 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch
(21.08 KB, patch)
2021-12-20 15:46 PST
,
Megan Gardner
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(21.12 KB, patch)
2021-12-20 16:03 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch
(25.93 KB, patch)
2021-12-22 13:14 PST
,
Megan Gardner
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(26.97 KB, patch)
2021-12-22 20:38 PST
,
Megan Gardner
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(26.97 KB, patch)
2021-12-22 23:19 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch
(27.92 KB, patch)
2021-12-23 08:33 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch
(27.93 KB, patch)
2021-12-23 18:19 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch
(27.63 KB, patch)
2022-01-04 16:48 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch for landing
(27.08 KB, patch)
2022-01-05 16:11 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
[fast-cq] Patch
(1.12 KB, patch)
2022-01-05 17:56 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Show Obsolete
(15)
View All
Add attachment
proposed patch, testcase, etc.
Megan Gardner
Comment 1
2021-12-16 13:59:19 PST
Created
attachment 447391
[details]
Patch
Megan Gardner
Comment 2
2021-12-16 16:22:57 PST
Created
attachment 447397
[details]
Patch
Simon Fraser (smfr)
Comment 3
2021-12-16 16:52:28 PST
Comment on
attachment 447397
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=447397&action=review
> Source/WebKit/ChangeLog:13 > + * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: > + (-[WKWebViewConfiguration init]):
Did you actually change anything here?
> Source/WebCore/rendering/RenderTheme.cpp:307 > +#if ENABLE(SERVICE_CONTROLS) > + if (ImageControlsMac::isImageControlsButtonElement(element.get())) > + return ImageControlsButtonPart; > +#endif
It's a bit weird to see macOS code in RenderTheme which has a RenderThemeMac subclass. Can we factor this into a virtual function?
Megan Gardner
Comment 4
2021-12-16 17:19:58 PST
Created
attachment 447402
[details]
Patch
Megan Gardner
Comment 5
2021-12-16 18:57:51 PST
Created
attachment 447410
[details]
Patch
Megan Gardner
Comment 6
2021-12-16 19:44:10 PST
Created
attachment 447414
[details]
Patch
Megan Gardner
Comment 7
2021-12-17 00:08:35 PST
Created
attachment 447436
[details]
Patch
Megan Gardner
Comment 8
2021-12-17 00:09:58 PST
Patch with logging for debugging test output.
Aditya Keerthi
Comment 9
2021-12-17 10:38:23 PST
Comment on
attachment 447436
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=447436&action=review
> Source/WebCore/rendering/RenderThemeMac.mm:2317 > +bool RenderThemeMac::isImageControl(const Element* elementPtr) const
This should take a `const Element&` instead of a pointer, since you always dereference. Can move the code you added to `RenderTheme::autoAppearanceForElement` below the `Ref element = *elementPtr;`.
Megan Gardner
Comment 10
2021-12-20 15:46:13 PST
Created
attachment 447656
[details]
Patch
Megan Gardner
Comment 11
2021-12-20 16:03:59 PST
Created
attachment 447658
[details]
Patch
Aditya Keerthi
Comment 12
2021-12-20 16:19:32 PST
Comment on
attachment 447658
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=447658&action=review
> Source/WebCore/css/CSSValueKeywords.in:-894 > --internal-image-controls-button
Because of the way we go from CSSValueID to ControlPart (see CSSPrimitiveValueMappings.h, `CSSPrimitiveValue::operator ControlPart()`), removing this value here also requires that the enum value `ImageControlsButtonPart` is moved to the end in the ControlPart enum. Can you make the change in ThemeTypes.h, and add a comment like "// Internal-only values" to separate the value? ``` enum ControlPart { NoControlPart, ... #if ENABLE(ATTACHMENT_ELEMENT) AttachmentPart, BorderlessAttachmentPart, #endif CapsLockIndicatorPart, // Internal-only values ImageControlsButtonPart }; ```
> Source/WebCore/rendering/RenderThemeMac.mm:2317 > +bool RenderThemeMac::isImageControl(const Element* elementPtr) const
https://bugs.webkit.org/show_bug.cgi?id=234405#c9
Wenson Hsieh
Comment 13
2021-12-20 16:28:46 PST
Comment on
attachment 447658
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=447658&action=review
LGTM, with mine and Aditya's comments.
>> Source/WebCore/rendering/RenderThemeMac.mm:2317 >> +bool RenderThemeMac::isImageControl(const Element* elementPtr) const > >
https://bugs.webkit.org/show_bug.cgi?id=234405#c9
+1! (Alternately — you could consider just using `ImageControlsMac::isImageControlsButtonElement` instead of adding this helper function on RenderThemeMac)
> LayoutTests/fast/images/image-controls-basic.html:32 > + setInterval(() => { > + if (hasImageControls(elem)) > + testRunner.notifyDone(); > + }, 200);
Minor nit - it looks like this test mixes spaces and tabs; let's just use spaces?
Megan Gardner
Comment 14
2021-12-22 13:14:49 PST
Created
attachment 447827
[details]
Patch
Megan Gardner
Comment 15
2021-12-22 20:38:02 PST
Created
attachment 447856
[details]
Patch
Megan Gardner
Comment 16
2021-12-22 23:19:14 PST
Created
attachment 447862
[details]
Patch
Megan Gardner
Comment 17
2021-12-23 08:33:45 PST
Created
attachment 447880
[details]
Patch
Radar WebKit Bug Importer
Comment 18
2021-12-23 13:55:16 PST
<
rdar://problem/86864533
>
Megan Gardner
Comment 19
2021-12-23 18:19:01 PST
Created
attachment 447926
[details]
Patch
Megan Gardner
Comment 20
2022-01-04 16:48:57 PST
Created
attachment 448346
[details]
Patch
Darin Adler
Comment 21
2022-01-04 20:37:30 PST
Comment on
attachment 448346
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=448346&action=review
> Source/WebCore/html/HTMLImageElement.cpp:748 > +#endif // ENABLE(SERVICE_CONTROLS)
Should omit this comment here.
> Source/WebCore/html/shadow/mac/imageControlsMac.css:42 > - appearance: -internal-image-controls-button; > + appearance: auto;
Should we remove this line entirely instead of changing it to say "auto"?
> Source/WebCore/platform/ThemeTypes.h:114 > + LargestControlPart = ImageControlsButtonPart > +#else > + LargestControlPart = CapsLockIndicatorPart
Can LargestControlPart be a constant outside the enumeration rather than an enumeration value? constexpr ControlPart largestControlPart = ImageControlsButtonPart; It can otherwise be the same, still right here in the header next to the enumeration.
> Source/WebCore/rendering/RenderTheme.cpp:306 > +#endif > Ref element = *elementPtr;
I suggest a blank line here.
> Source/WebCore/rendering/RenderTheme.h:370 > + virtual bool isImageControl(const Element*) const { return false; }
This should take a const Element&, because it dereferences the pointer without checking for nullptr.
> Source/WebCore/rendering/RenderThemeMac.mm:2321 > + if (ImageControlsMac::isImageControlsButtonElement(*elementPtr)) > + return true; > + return false;
Should just be return x, rather than if (x) return true; return false;
> Source/WebCore/rendering/style/RenderStyle.h:1143 > + static_assert(LargestControlPart < 1 << APPEARANCE_BIT_WIDTH, "Control part must fit in storage bits");
I suggest we just put this static_assert outside the functions, alongside them. Since a static_assert works at runtime it does not need to be inside a function.
> Source/WebCore/rendering/style/StyleRareNonInheritedData.h:69 > +#define APPEARANCE_BIT_WIDTH 7
This should be a constexpr integer, not a #define. constexpr int appearanceBitWidth = 7;
> Source/WebCore/testing/Internals.cpp:6397 > +#endif // ENABLE(SERVICE_CONTROLS)
This endif doesn’t need a comment, it’s so close to the start of the #If.
> Source/WebCore/testing/Internals.h:1194 > +#endif // ENABLE(SERVICE_CONTROLS)
This endif doesn’t need a comment, it’s so close to the start of the #If.
> LayoutTests/ChangeLog:11 > + We need to move this test to be a mac specific one, as it now has mac specific > + test harnessing. Also changed the test to be resistent to the async nature of adding > + the shadow dom elements, and checking the shadow dom directly rather than the resulting layout, > + which is prone to pixel errors.
What makes this test Mac-specific?
> LayoutTests/fast/images/mac/image-controls-basic.html:32 > + if (internals.shadowRoot(elem) && internals.shadowRoot(elem).getElementById('image-controls') && internals.shadowRoot(elem).getElementById('image-controls-button')) > + output += 'PASS: image controls exist in shadowDom'; > + else > + output += 'FAIL: no image controls found in shadowDom'; > + document.getElementById('log').innerHTML = output;
Broken indentation here.
> LayoutTests/fast/images/mac/image-controls-basic.html:40 > + checkForShadowDom(elem);
And here.
Megan Gardner
Comment 22
2022-01-05 15:44:35 PST
Comment on
attachment 448346
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=448346&action=review
>> Source/WebCore/html/shadow/mac/imageControlsMac.css:42 >> + appearance: auto; > > Should we remove this line entirely instead of changing it to say "auto"?
No, default appearance is 'none' so we need this line.
>> LayoutTests/ChangeLog:11 >> + which is prone to pixel errors. > > What makes this test Mac-specific?
hasImageControls - this is on Mac only, and since this test is written to wait until this returns true for async reasons the only way for the test to not time out would be for this to return true (which is blatantly not true), or for us to have a more complicated return system with a N/A return value, or... we could just run it on Mac, which the feature is Mac only anyways, so lets just run it on Mac.
Megan Gardner
Comment 23
2022-01-05 16:11:26 PST
Created
attachment 448448
[details]
Patch for landing
Megan Gardner
Comment 24
2022-01-05 17:12:09 PST
rdar://86426074
EWS
Comment 25
2022-01-05 17:41:00 PST
Committed
r287663
(
245760@main
): <
https://commits.webkit.org/245760@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 448448
[details]
.
Megan Gardner
Comment 26
2022-01-05 17:56:30 PST
Reopening to attach new patch.
Megan Gardner
Comment 27
2022-01-05 17:56:33 PST
Created
attachment 448460
[details]
[fast-cq] Patch
Alex Christensen
Comment 28
2022-01-05 18:17:07 PST
r287666
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