Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust cursor animator properties #12705

Conversation

mwyrzykowski
Copy link
Contributor

@mwyrzykowski mwyrzykowski commented Apr 13, 2023

cebe6cd

Adjust cursor animator properties
https://bugs.webkit.org/show_bug.cgi?id=255399
<radar://107662722>

Reviewed by Aditya Keerthi.

This patch allows suspending the blink state of the
cursor from the UI process, moves logic from an
static internal function to a virtual function,
and corrects an issue where the caret does not
start animating after a transition.

This also removes CaretAnimator::addLine which is no longer used.

* Source/WebCore/editing/FrameSelection.cpp:
(WebCore::CaretBase::paintCaret const):
(WebCore::FrameSelection::caretAnimatorInvalidated):
Ensure animator starts animating after a caret transition.

(WebCore::FrameSelection::updateAppearance):
With CaretAnimator's stop function virtual, send the reason
for why the stop was issued.

* Source/WebCore/platform/CaretAnimator.cpp:
(WebCore::CaretAnimator::adjustedClipRect const):
Allow specific animator's to override the clip rectangle.

* Source/WebCore/platform/CaretAnimator.h:
(WebCore::CaretAnimator::stop):
Allow for a reason to be used in determining stop behavior.

(WebCore::CaretAnimator::addLine const): Deleted.
This is no longer needed.

* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paint):
(WebCore::RenderBlock::paintObject):
Revert previously added changes.

(WebCore::renderCaretInsideContentsClip): Deleted.
This is no longer used, instead CaretAnimator has a virtual member
function to control the clip rectangle.

* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setCaretBlinkingSuspended):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setCaretBlinkingSuspended):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
Allow blink to be suspended from the UI process.

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

5536906

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2   πŸ§ͺ api-mac βœ… πŸ›  gtk
βœ… πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1   πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios   πŸ§ͺ mac-wk2 βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2-stress
❌ πŸ›  πŸ§ͺ merge βœ… πŸ›  watch
βœ… πŸ›  watch-sim

@mwyrzykowski mwyrzykowski self-assigned this Apr 13, 2023
@mwyrzykowski mwyrzykowski added the Layout and Rendering For bugs with layout and rendering of Web pages. label Apr 13, 2023
@mwyrzykowski mwyrzykowski force-pushed the eng/Adjust-cursor-animator-properties branch from 6792f39 to f12168a Compare April 13, 2023 18:59
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Apr 13, 2023
@mwyrzykowski mwyrzykowski removed the merging-blocked Applied to prevent a change from being merged label Apr 13, 2023
@mwyrzykowski mwyrzykowski force-pushed the eng/Adjust-cursor-animator-properties branch from f12168a to cdd54a9 Compare April 13, 2023 19:43
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Apr 13, 2023
@mwyrzykowski mwyrzykowski removed the merging-blocked Applied to prevent a change from being merged label Apr 18, 2023
@mwyrzykowski mwyrzykowski force-pushed the eng/Adjust-cursor-animator-properties branch from cdd54a9 to b123980 Compare April 18, 2023 05:49
Comment on lines 36 to 50
Alternate
};

enum class CaretAnimatorStopReason : uint8_t {
Default,
CaretRectChanged,
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly strange to see this before the forward declarations. Would you mind moving these enums below line 50?

Comment on lines 79 to 80
{
if (!m_isActive)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably move this into the implementation file.

@@ -91,7 +96,9 @@ class CaretAnimator {
PresentationProperties presentationProperties() const { return m_presentationProperties; }
virtual void paint(const Node&, GraphicsContext&, const FloatRect&, const Color&, const LayoutPoint&) const;
virtual LayoutRect repaintCaretRectForLocalRect(LayoutRect) const;
#if defined(__has_include) && __has_include(<WebKitAdditions/RenderBlockAdditions.h>)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably want a FIXME + bug, so we can remember to remove this #if?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I added a FIXME with a bug

@mwyrzykowski mwyrzykowski force-pushed the eng/Adjust-cursor-animator-properties branch from b123980 to 5536906 Compare April 18, 2023 15:29
@mwyrzykowski mwyrzykowski added the merge-queue Applied to send a pull request to merge-queue label Apr 18, 2023
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Adjust-cursor-animator-properties branch from 5536906 to 98107fc Compare April 18, 2023 17:52
https://bugs.webkit.org/show_bug.cgi?id=255399
<radar://107662722>

Reviewed by Aditya Keerthi.

This patch allows suspending the blink state of the
cursor from the UI process, moves logic from an
static internal function to a virtual function,
and corrects an issue where the caret does not
start animating after a transition.

This also removes CaretAnimator::addLine which is no longer used.

* Source/WebCore/editing/FrameSelection.cpp:
(WebCore::CaretBase::paintCaret const):
(WebCore::FrameSelection::caretAnimatorInvalidated):
Ensure animator starts animating after a caret transition.

(WebCore::FrameSelection::updateAppearance):
With CaretAnimator's stop function virtual, send the reason
for why the stop was issued.

* Source/WebCore/platform/CaretAnimator.cpp:
(WebCore::CaretAnimator::adjustedClipRect const):
Allow specific animator's to override the clip rectangle.

* Source/WebCore/platform/CaretAnimator.h:
(WebCore::CaretAnimator::stop):
Allow for a reason to be used in determining stop behavior.

(WebCore::CaretAnimator::addLine const): Deleted.
This is no longer needed.

* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paint):
(WebCore::RenderBlock::paintObject):
Revert previously added changes.

(WebCore::renderCaretInsideContentsClip): Deleted.
This is no longer used, instead CaretAnimator has a virtual member
function to control the clip rectangle.

* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setCaretBlinkingSuspended):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setCaretBlinkingSuspended):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
Allow blink to be suspended from the UI process.

Canonical link: https://commits.webkit.org/263083@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Adjust-cursor-animator-properties branch from 98107fc to cebe6cd Compare April 18, 2023 17:57
@webkit-commit-queue
Copy link
Collaborator

Committed 263083@main (cebe6cd): https://commits.webkit.org/263083@main

Reviewed commits have been landed. Closing PR #12705 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit cebe6cd into WebKit:main Apr 18, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Layout and Rendering For bugs with layout and rendering of Web pages.
Projects
None yet
5 participants