The core/annotation
directory contains the implementation of Blink web content annotations.
This component allows Blink features and embedders to attach annotations to content in a page rendered by Blink. It provides support only for attachment and interaction with markers in the web content. The actual data and rendering of any annotation content (e.g. the text of a user note) is not in scope for this component and must be implemented by the embedder.
On a feature level, core/annotation
provides:
Current consumers of core/annotation
are:
Annotation: in a very general sense, content added to a page that is not part of the Document as authored by its creator. Examples might include: users attaching notes to images or text snippets, making highlights or attaching reactions/emojis, users or services attaching metadata like “time to read” or ratings, etc.
Annotation Agent: An object in Blink used to support annotating content. An agent does not implement any kind of annotation content or semantics; it provides a means by which a client implementing some form of annotation can attach itself to specific content in a page, mark/highlight it, and provides the client with functionality and notifications to interact with the attachment.
Agent Container: Every agent is created by and stored in a container. When removed, the agent is disposed and all its effects (e.g. highlights) are removed. Containers are owned by a Document and created lazily on demand. Clients interact with annotation agents via the container; that is, by binding to the AnnotationAgentContainer mojo interface and requesting new AnnotationAgents from it.
Selector: A selector is used to attach an annotation to some content in a page. A selector has enough information to uniquely identify an intended instance of content on a page, for example, a text selector might include the snippet of text a note is attached to with some prefix/suffix context to disambiguate that snippet from other instances of the same text.
Attachment: Is the process by which an agent invokes a selector to find a range of DOM that matches the selector's parameters. If such a range is found, the agent is considered attached. Attachment may fail, for example, if the text of the page has changed since the annotation was created and no longer exists. In this case, the agent is unattached.
TODO(bokan)