[webkit-changes] [WebKit/WebKit] dc20f6: [macOS] Data detector highlights are broken with U...

Aditya Keerthi noreply at github.com
Thu Dec 1 17:23:00 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dc20f61c73d1c88b51f1d6d9811c8a068df04d67
      https://github.com/WebKit/WebKit/commit/dc20f61c73d1c88b51f1d6d9811c8a068df04d67
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2022-12-01 (Thu, 01 Dec 2022)

  Changed paths:
    M Source/WebCore/platform/mac/DataDetectorHighlight.h
    M Source/WebCore/platform/mac/DataDetectorHighlight.mm

  Log Message:
  -----------
  [macOS] Data detector highlights are broken with UI-side compositing
https://bugs.webkit.org/show_bug.cgi?id=248548
rdar://101664503

Reviewed by Simon Fraser.

Data detector highlights are currently broken when with UI-side compositing
and DOM rendering using the GPU process for two reasons:

1. There is no platform graphics context in the web process, which means
   highlights cannot be painted by simply using CG drawing commands.
2. CALayer's are no longer accessible in the web process, which means the
   existing fade in/out animation no longer works.

Both these problems could be solved by moving all highlight rendering logic
into the UI process. However, that solution was not chosen, as it would be a
complex refactoring, and would make scrolling highlights difficult.

To fix (1), highlights are now drawn into a local image buffer, which is then
drawn into the graphics context using a display list command. An alternative
approach to fix (1) would be to add a new display list drawing command to draw
Data Detector highlights. However, that solution introduces unnecessary
complexity. Furthermore, this drawing command does not really make sense for
other platforms.

To fix (2), the fade animation is now performed using a timer, similar to the
animation of PageOverlay. An alternative approach to fix (2) would be to add
animations to the GraphicsLayer itself. However, the current animation
infrastructure lacks the ability to specify a single "to" animation, and does
not provide a clean way to detect completion. Given the short duration of the
animation, and the fact that Data Detector highlights are not a hot codepath, a
simple Timer-based animation is used instead.

* Source/WebCore/platform/mac/DataDetectorHighlight.h:
* Source/WebCore/platform/mac/DataDetectorHighlight.mm:
(WebCore::DataDetectorHighlight::DataDetectorHighlight):
(WebCore::DataDetectorHighlight::invalidate):
(WebCore::DataDetectorHighlight::paintContents):
(WebCore::DataDetectorHighlight::fadeAnimationTimerFired):
(WebCore::DataDetectorHighlight::fadeIn):
(WebCore::DataDetectorHighlight::fadeOut):
(WebCore::DataDetectorHighlight::startFadeAnimation):

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




More information about the webkit-changes mailing list