Skip to content

Commit 971fd1c

Browse files
authored
another swing at clarifying the favicon desc
1 parent 847f668 commit 971fd1c

1 file changed

Lines changed: 20 additions & 18 deletions

File tree

specs/GetFavicon.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
# Background
2-
A favicon (favorite icon) is a tiny icon included along with a website, which is displayed in places like the browser's address bar, page tabs and bookmarks menu. Developers would
3-
like to have an API which allows them to retrieve the Favicon of a webpage, if it has been set, as well as get an update whenever the favicon has changed.
2+
A favicon (favorite icon) is a tiny icon included along with a website, which is displayed in places like the browser's address bar, page tabs and bookmarks menu. Developers would like to have an API which allows them to retrieve the Favicon of a webpage, if it has been set, as well as get an update whenever the favicon has changed.
43

54
# Description
6-
We propose a new Webview2 event which would allow developers to access the current Favicon of a page,
7-
as well as be notified when the favicon changes. This means when a page first loads, it would raise
8-
the FaviconChanged event since before parsing the HTML document there is no known favicon. DOM or JavaScript may change the Favicon,
9-
causing the event to be raised again for the same document.
5+
We propose a new Webview2 event which would allow developers to access the current Favicon of a page and be notified when the favicon changes. This means when a page first loads, it would raise the FaviconChanged event since before parsing the HTML document there is no known favicon. DOM or JavaScript may change the Favicon, causing the event to be raised again for the same document.
106

117
# Examples
128
## Win32 C++ Registering a listener for favicon changes
@@ -65,11 +61,13 @@ See [API Details](#api-details) Section below for API reference
6561
## Win32 C++
6662
```cpp
6763
/// This interface is a handler for when the `Favicon` is changed.
68-
/// The sender is the ICoreWebView2 object the top-level document of which has changed favicon and the eventArgs is nullptr. Use the FaviconUri property and GetFavicon method to obtain the favicon data.
69-
/// second argument is null.
64+
/// The sender is the ICoreWebView2 object the top-level document of
65+
/// which has changed favicon and the eventArgs is nullptr. Use the
66+
/// FaviconUri property and GetFavicon method to obtain the favicon
67+
/// data. The second argument is always null.
7068
/// For more information see `add_FaviconChanged`.
7169
[uuid(2913DA94-833D-4DE0-8DCA-900FC524A1A4), object, pointer_default(unique)]
72-
interface ICoreWebView2ExperimentalFaviconChangedEventHandler : IUnknown {
70+
interface ICoreWebView2FaviconChangedEventHandler : IUnknown {
7371
/// Called to notify the favicon changed.
7472
HRESULT Invoke(
7573
[in] ICoreWebView2* sender,
@@ -81,20 +79,24 @@ interface ICoreWebView2ExperimentalFaviconChangedEventHandler : IUnknown {
8179
/// is the result from the image write operation.
8280
/// For more details, see the `GetFavicon` API.
8381
[uuid(A2508329-7DA8-49D7-8C05-FA125E4AEE8D), object, pointer_default(unique)]
84-
interface ICoreWebView2ExperimentalGetFaviconCompletedHandler : IUnknown {
82+
interface ICoreWebView2GetFaviconCompletedHandler : IUnknown {
8583
/// Called to notify the favicon has been retrieved.
8684
HRESULT Invoke([in] HRESULT error_code);
8785
}
8886

8987
/// This is the ICoreWebView2 Experimental Favicon interface.
90-
/// The `FaviconChanged` event is raised when the [favicon](https://developer.mozilla.org/en-US/docs/Glossary/Favicon) of the top-level document changes. The favicon can change when navigating to a new document or if script dynamically changes the favicon. When navigating from a document with a favicon to a new URI, the FaviconChanged event will be raised first for first navigating to a new document which declares a favicon in its HTML or has script to set its favicon, the document and the FaviconChanged event will be raised for that
91-
/// Favicon. When a new page loads event would fire due to Favicon not being set.
92-
/// The event would also set the Favicon when the set by DOM or Javascript.
88+
/// The `FaviconChanged` event is raised when the
89+
/// [favicon](https://developer.mozilla.org/en-US/docs/Glossary/Favicon)
90+
/// of the top-level document changes or if script dynamically changes the favicon.
91+
/// The FaviconChanged event will be raised for first navigating to a new
92+
/// document, whether or not a document declares a Favicon in HTML. The event will
93+
/// be raised again if a favicon is declared in its HTML or has script to set its favicon.
94+
/// The favicon infromation can then be retrieved with `GetFavicon` and `FaviconUri`.
9395
[uuid(DC838C64-F64B-4DC7-98EC-0992108E2157), object, pointer_default(unique)]
9496
interface ICoreWebView2_10 : ICoreWebView2_9 {
9597
/// Add an event handler for the `FaviconChanged` event.
9698
HRESULT add_FaviconChanged(
97-
[in] ICoreWebView2ExperimentalFaviconChangedEventHandler* eventHandler,
99+
[in] ICoreWebViewFaviconChangedEventHandler* eventHandler,
98100
[out] EventRegistrationToken* token);
99101

100102
/// Remove the event handler for `FaviconChanged` event.
@@ -109,13 +111,13 @@ interface ICoreWebView2_10 : ICoreWebView2_9 {
109111
/// Async function for getting the actual image data of the favicon.
110112
/// If the `imageStream` is null, the `HRESULT` will be `E_POINTER`, otherwise
111113
/// it is `S_OK`.
112-
/// The image is copied to the `imageStream` object and when complete. If
113-
/// there is no image then no data would be copied into the imageStream.
114-
/// In either scenario the `eventHandler` is executed at the end of the operation.
114+
/// The image is copied to the `imageStream` object. If there is no image then
115+
/// no data would be copied into the imageStream.
116+
/// In either scenario the `completedHandler` is executed at the end of the operation.
115117
HRESULT GetFavicon(
116118
[in] COREWEBVIEW2_FAVICON_IMAGE_FORMAT format,
117119
[in] IStream* imageStream,
118-
[in] ICoreWebView2ExperimentalGetFaviconCompletedHandler* eventHandler);
120+
[in] ICoreWebView2GetFaviconCompletedHandler* completedHandler);
119121
}
120122

121123
[v1_enum]

0 commit comments

Comments
 (0)