Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor caret animation out of FrameSelection
https://bugs.webkit.org/show_bug.cgi?id=248112 rdar://102535758 Reviewed by Simon Fraser and Darin Adler. Simplifies `FrameSelection` by factoring out the animation logic into its own class, to fit with how we handle other animations. Instead of `FrameSelection` owning its own caret blinking timer, the caret is now subject to the repaint cycle of `Page::updateRendering`. This PR introduces a new `CaretAnimation` virtual class, with a `CaretAnimationSimple` subclass to model how the current caret blinking works. This inheritence hierarchy is modelled after how `ScrollAnimation` works. The CaretAnimation now owns a timer, which when fired, schedules a rendering update for the caret to update its appearance. When the rendering update happens, `CaretAnimation::serviceAnimation` is triggered, which performs the actual adjustment to the caret's presentation's properties. `FrameSelection::invalidateCaretRect` is then triggered which causes the actual painting of the care to reflect its new appearance. Note that because the animation is now tied to `Page::updateRendering`, `CaretAnimation::serviceAnimation` may be called at any given time, and so the animation must track when the last time it was called was and account for this. * Source/WebCore/Headers.cmake: * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/dom/Document.cpp: (WebCore::Document::serviceCaretAnimation): * Source/WebCore/dom/Document.h: * Source/WebCore/editing/FrameSelection.cpp: (WebCore::FrameSelection::FrameSelection): (WebCore::FrameSelection::willBeRemovedFromFrame): (WebCore::FrameSelection::paintCaret): (WebCore::FrameSelection::setCaretBlinkingSuspended): (WebCore::FrameSelection::isCaretBlinkingSuspended const): (WebCore::FrameSelection::caretAnimationDidUpdate): (WebCore::FrameSelection::document): (WebCore::FrameSelection::updateAppearance): (WebCore::FrameSelection::setCaretVisibility): (WebCore::FrameSelection::setCaretColor): (WebCore::FrameSelection::caretBlinkTimerFired): Deleted. (WebCore::FrameSelection::setCaretBlinks): Deleted. * Source/WebCore/editing/FrameSelection.h: (WebCore::FrameSelection::currentCaretAnimator): (WebCore::FrameSelection::currentCaretAnimator const): (WebCore::FrameSelection::setCaretBlinkingSuspended): Deleted. (WebCore::FrameSelection::isCaretBlinkingSuspended const): Deleted. * Source/WebCore/page/Page.cpp: (WebCore::Page::updateRendering): (WebCore::Page::finalizeRenderingUpdate): (WebCore::operator<<): * Source/WebCore/page/Page.h: * Source/WebCore/platform/CaretAnimator.cpp: Added. (WebCore::CaretAnimator::page const): (WebCore::CaretAnimator::serviceCaretAnimation): (WebCore::CaretAnimator::scheduleAnimation): * Source/WebCore/platform/CaretAnimator.h: Added. (WebCore::CaretAnimationClient::caretAnimationDidUpdate): (WebCore::CaretAnimationClient::caretAnimationWillStart): (WebCore::CaretAnimationClient::caretAnimationDidEnd): (WebCore::CaretAnimator::CaretAnimator): (WebCore::CaretAnimator::stop): (WebCore::CaretAnimator::isActive const): (WebCore::CaretAnimator::setCaretBlinkingSuspended): (WebCore::CaretAnimator::isCaretBlinkingSuspended const): (WebCore::CaretAnimator::didStart): (WebCore::CaretAnimator::didEnd): (WebCore::CaretAnimator::timeSinceStart const): * Source/WebCore/platform/SimpleCaretAnimator.cpp: Added. (WebCore::SimpleCaretAnimator::SimpleCaretAnimator): (WebCore::SimpleCaretAnimator::serviceAnimation): (WebCore::SimpleCaretAnimator::start): (WebCore::SimpleCaretAnimator::debugDescription const): * Source/WebCore/platform/SimpleCaretAnimator.h: Added. Canonical link: https://commits.webkit.org/257219@main
- Loading branch information
Showing
13 changed files
with
378 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.