[webkit-changes] [WebKit/WebKit] bcf18f: Clipping a caret rect results in its size changing...

Richard Robinson noreply at github.com
Tue May 30 19:41:50 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bcf18f7a8a9ac7060cefc6d942c2561e84f879ed
      https://github.com/WebKit/WebKit/commit/bcf18f7a8a9ac7060cefc6d942c2561e84f879ed
  Author: Richard Robinson <richard_robinson2 at apple.com>
  Date:   2023-05-30 (Tue, 30 May 2023)

  Changed paths:
    M LayoutTests/fast/css/caret-color-expected.html
    M LayoutTests/fast/css/caret-color-fallback-to-color-expected.html
    M LayoutTests/fast/css/caret-color-fallback-to-color.html
    M LayoutTests/fast/css/caret-color-inherit-expected.html
    M LayoutTests/fast/css/caret-color-inherit.html
    M LayoutTests/fast/css/caret-color-span-inside-editable-parent-expected.html
    M LayoutTests/fast/css/caret-color-span-inside-editable-parent.html
    M LayoutTests/fast/css/caret-color.html
    M Source/WebCore/editing/FrameSelection.cpp
    M Source/WebCore/editing/FrameSelection.h
    M Source/WebCore/rendering/RenderBlock.cpp

  Log Message:
  -----------
  Clipping a caret rect results in its size changing instead of actually clipping
https://bugs.webkit.org/show_bug.cgi?id=257512
rdar://110012236

Reviewed by Megan Gardner.

When the caret is being clipped, such as when it's within an `overflow: hidden` div and partially
hidden, the caret rect is actually being resized to a different size, instead of actually being clipped.

This is because when painting the caret, we were resizing the caret rect to be the intersection of the
original rect and the clipping rect.

This PR fixes this by removing that resizing logic, which maintains the caret's size, and still results
in the caret being properly clipped.

Also rebaselines some related caret layout tests/

* LayoutTests/fast/css/caret-color-expected.html:
* LayoutTests/fast/css/caret-color-fallback-to-color-expected.html:
* LayoutTests/fast/css/caret-color-fallback-to-color.html:
* LayoutTests/fast/css/caret-color-inherit-expected.html:
* LayoutTests/fast/css/caret-color-inherit.html:
* LayoutTests/fast/css/caret-color-span-inside-editable-parent-expected.html:
* LayoutTests/fast/css/caret-color-span-inside-editable-parent.html:
* LayoutTests/fast/css/caret-color.html:
* Source/WebCore/editing/FrameSelection.cpp:
(WebCore::FrameSelection::paintCaret):
(WebCore::CaretBase::paintCaret const):
(WebCore::DragCaretController::paintDragCaret const):
* Source/WebCore/editing/FrameSelection.h:
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintCaret):

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




More information about the webkit-changes mailing list