[webkit-changes] [WebKit/WebKit] fc487e: getBoundingClientRect return a wrong rect on a ran...

Ryosuke Niwa noreply at github.com
Thu Oct 12 13:23:21 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fc487e690086d5553a6a00540924142ab8d409ae
      https://github.com/WebKit/WebKit/commit/fc487e690086d5553a6a00540924142ab8d409ae
  Author: Ryosuke Niwa <rniwa at webkit.org>
  Date:   2023-10-12 (Thu, 12 Oct 2023)

  Changed paths:
    A LayoutTests/fast/dom/Range/getBoundingClientRect-on-range-ending-at-beginning-of-element-expected.html
    A LayoutTests/fast/dom/Range/getBoundingClientRect-on-range-ending-at-beginning-of-element.html
    M LayoutTests/fast/dom/Range/getClientRects-expected.txt
    M LayoutTests/fast/dom/Range/getClientRects.html
    M LayoutTests/platform/ios/ios/fast/coordinates/range-client-rects-expected.txt
    M LayoutTests/platform/ios/ios/fast/coordinates/range-client-rects.html
    M Source/WebCore/dom/ElementAncestorIteratorInlines.h
    M Source/WebCore/rendering/RenderObject.cpp

  Log Message:
  -----------
  getBoundingClientRect return a wrong rect on a range that ends at the beginning of an element
https://bugs.webkit.org/show_bug.cgi?id=263040
<rdar://112543805>

Reviewed by Alan Baradlay.

The bug was caused by a logic error in borderAndTextRects to avoid including partially selected elements.
We need to exclude any element after, not before, the range's end and its ancestors.

* LayoutTests/fast/dom/Range/getBoundingClientRect-on-range-ending-at-beginning-of-element-expected.html: Added.
* LayoutTests/fast/dom/Range/getBoundingClientRect-on-range-ending-at-beginning-of-element.html: Added.
* LayoutTests/fast/dom/Range/getClientRects-expected.txt: Rebaselined as the expectation has changed to not to
include the rect for unselected text per this bug fix.
* LayoutTests/fast/dom/Range/getClientRects.html:
* LayoutTests/platform/ios/ios/fast/coordinates/range-client-rects-expected.txt: Rebaselined.
* LayoutTests/platform/ios/ios/fast/coordinates/range-client-rects.html: Add a blank line with br to force
the selection to be extended beneath the 1500px by 1500px square.
* Source/WebCore/dom/ElementAncestorIteratorInlines.h:
(WebCore::lineageOfType):
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::nodeAfter):
(WebCore::borderAndTextRects):
(WebCore::nodeBefore): Deleted.

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




More information about the webkit-changes mailing list