Bug 220944

Summary: Expose the value of `<meta name="theme-color" content="...">` as SPI
Product: WebKit Reporter: Devin Rousso <hi>
Component: WebKit APIAssignee: Devin Rousso <hi>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, changseok, esprehn+autocc, ews-watchlist, gyuyoung.kim, hi, kangil.han, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=221015
Bug Depends on:    
Bug Blocks: 224509, 224389    
Attachments:
Description Flags
Patch
none
Patch
none
Patch ews-feeder: commit-queue-

Description Devin Rousso 2021-01-25 13:45:17 PST
.
Comment 1 Radar WebKit Bug Importer 2021-01-25 13:46:12 PST
<rdar://problem/73586711>
Comment 2 Devin Rousso 2021-01-25 13:46:38 PST
Created attachment 418330 [details]
Patch
Comment 3 Tim Horton 2021-01-25 14:03:33 PST
Comment on attachment 418330 [details]
Patch

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

> Source/WebCore/html/HTMLMetaElement.cpp:70
> +        process();

This seems... surprising? Did we really not support dynamic change of name before? Should we bother now?

> Source/WebKit/UIProcess/WebPageProxy.h:649
> +    // Set by the WebProcess when parsing `<meta name="theme-color" content="...">`.

Maybe "corresponds to the web content's `<meta name="theme-color" ...`"?
Comment 4 Devin Rousso 2021-01-25 14:07:35 PST
Comment on attachment 418330 [details]
Patch

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

>> Source/WebCore/html/HTMLMetaElement.cpp:70
>> +        process();
> 
> This seems... surprising? Did we really not support dynamic change of name before? Should we bother now?

AFAIK we did not.  I was surprised as well.  According to the spec we should <https://html.spec.whatwg.org/multipage/semantics.html#meta-theme-color>
> If any meta elements are inserted into the document or removed from the document, or existing meta elements have their name or content attributes changed, user agents must re-run the above algorithm and apply the result to any affected UI.
Comment 5 Devin Rousso 2021-01-25 14:08:37 PST
Also, something I just realized, I should double-check and make sure that the `_themeColor` is `nil`-d out if the page navigates and the new page doesn't have a `<meta name="theme-color" content="...">` (or at least that `_themeColor` stays `nil` until that node is processed).
Comment 6 Devin Rousso 2021-01-26 11:50:10 PST
Created attachment 418457 [details]
Patch
Comment 7 Tim Horton 2021-01-26 12:00:10 PST
Comment on attachment 418457 [details]
Patch

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

> Source/WebKit/WebProcess/WebPage/WebPage.cpp:3911
> +    layerTransaction.setThemeColor(corePage()->themeColor());

Should this reset m_pendingThemeColorChange? I guess it doesn't matter, it's just a bit funny that it gets stuck if UI-side compositing is on.
Comment 8 Devin Rousso 2021-01-26 12:16:21 PST
Created attachment 418460 [details]
Patch
Comment 9 EWS 2021-01-26 16:31:28 PST
Committed r271920: <https://trac.webkit.org/changeset/271920>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 418460 [details].