[webkit-changes] [WebKit/WebKit] 5c3f5c: Add support for fading out document markers

Aditya Keerthi noreply at github.com
Sat Feb 25 14:14:51 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5c3f5c350c623143a75e7b21c99695aeac53d2eb
      https://github.com/WebKit/WebKit/commit/5c3f5c350c623143a75e7b21c99695aeac53d2eb
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M Source/WebCore/dom/DocumentMarkerController.cpp
    M Source/WebCore/dom/DocumentMarkerController.h
    M Source/WebCore/dom/RenderedDocumentMarker.h
    M Source/WebCore/rendering/TextBoxPainter.cpp

  Log Message:
  -----------
  Add support for fading out document markers
https://bugs.webkit.org/show_bug.cgi?id=252870
rdar://105857998

Reviewed by Megan Gardner.

Add the ability to fade out document markers, similar to DataDetector highlights
and PageOverlays.

* Source/WebCore/dom/DocumentMarkerController.cpp:
(WebCore::DocumentMarkerController::DocumentMarkerController):

Specify constants for the animation frame rate and duration. The frame rate
was selected to match other existing animations, such as fading out DataDetector
highlights and PageOverlays.

(WebCore::DocumentMarkerController::detach):
(WebCore::DocumentMarkerController::forEachOfTypes):

Add a helper method to iterate over all markers of a given type.

(WebCore::DocumentMarkerController::removeMarkers):
(WebCore::DocumentMarkerController::removeMarkersFromList):

Introduce a filter function, to avoid code duplication when it is time to
remove faded out markers.

(WebCore::DocumentMarkerController::dismissMarkers):

This method removes markers of a given type by fading them out, rather than
simply removing them from the list of rendered document markers.

Markers that are fading out, as marked as "being dismissed" and an animation
start time is recorded. If the animation timer is not already running, it is
started.

(WebCore::DocumentMarkerController::fadeAnimationTimerFired):

On each tick, update the opacity of markers being dismissed based on the
animation start time and the current time. Once the marker is fully faded out,
it is removed from the list of markers. If there are no more markers to animate,
the timer is stopped.

* Source/WebCore/dom/DocumentMarkerController.h:
* Source/WebCore/dom/RenderedDocumentMarker.h:

Add new properties to `RenderedDocumentMarker` to support animation.

(WebCore::RenderedDocumentMarker::opacity const):
(WebCore::RenderedDocumentMarker::setOpacity):
(WebCore::RenderedDocumentMarker::isBeingDismissed const):
(WebCore::RenderedDocumentMarker::setBeingDismissed):
(WebCore::RenderedDocumentMarker::animationStartTime const):
* Source/WebCore/rendering/TextBoxPainter.cpp:
(WebCore::TextBoxPainter<TextBoxPath>::paintPlatformDocumentMarker):

Adjust the alpha value of the marker color to perform the fade.

Canonical link: https://commits.webkit.org/260842@main




More information about the webkit-changes mailing list