⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 287981 in webkit


Ignore:
Timestamp:
Jan 13, 2022, 10:21:34 AM (5 years ago)
Author:
Alan Bujtas
Message:

REGRESSION (r278561): Right clicking a link selects the full line with unrelated text
​https://bugs.webkit.org/show_bug.cgi?id=235172
<rdar://84069534>

Reviewed by Dean Jackson.

Source/WebCore:

r278561 slightly change highlightStateForTextBox's behavior which now (correctly) returns HighlightState::None when the
RenderText content is not part of the current selection. Prior to r278561, it returned the RenderText's original selection state
which in this case was HighlightState::End.

<div><span>A<br>B<span style="position: absolute"></span></span>C</div>

In this specific case when we select the outer <span>, we end up with the following selection states for the generated line boxes:

(B) -> "Inside"
(C) -> "None"

while previously (C) came back as "End" (note that the absolute positioned element does not generate line boxes).

Now as Line::selectionState traverses through the line boxes, it comes across an unexpected "Inside -> None" transition at the selection end boundary (B -> C)
which incorrectly leaves the line state in "Inside" and we paint the selection all the way to the end of the block.

Test: fast/editing/selection-with-absolute-positioned-empty-content.html

  • layout/integration/InlineIteratorLine.cpp:

(WebCore::InlineIterator::Line::selectionState const):

LayoutTests:

  • fast/editing/selection-with-absolute-positioned-empty-content-expected.txt: Added.
  • fast/editing/selection-with-absolute-positioned-empty-content.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r287976 r287981  
     12022-01-13  Alan Bujtas  <zalan@apple.com>
     2
     3        REGRESSION (r278561): Right clicking a link selects the full line with unrelated text
     4        https://bugs.webkit.org/show_bug.cgi?id=235172
     5        <rdar://84069534>
     6
     7        Reviewed by Dean Jackson.
     8
     9        * fast/editing/selection-with-absolute-positioned-empty-content-expected.txt: Added.
     10        * fast/editing/selection-with-absolute-positioned-empty-content.html: Added.
     11
    1122022-01-10  Sergio Villar Senin  <svillar@igalia.com>
    213
  • trunk/LayoutTests/platform/ios/TestExpectations

    r287662 r287981  
    422422editing/selection/selecting-content-by-overshooting-the-deprecated-flex-container.html [ Skip ]
    423423editing/selection/selecting-content-by-overshooting-the-grid-container.html [ Skip ]
     424editing/selection-with-absolute-positioned-empty-content.html [ Skip ]
    424425editing/spelling/context-menu-suggestions-multiword-selection.html [ Skip ]
    425426editing/spelling/context-menu-suggestions-subword-selection.html [ Skip ]
  • trunk/Source/WebCore/ChangeLog

    r287980 r287981  
     12022-01-13  Alan Bujtas  <zalan@apple.com>
     2
     3        REGRESSION (r278561): Right clicking a link selects the full line with unrelated text
     4        https://bugs.webkit.org/show_bug.cgi?id=235172
     5        <rdar://84069534>
     6
     7        Reviewed by Dean Jackson.
     8
     9        r278561 slightly change highlightStateForTextBox's behavior which now (correctly) returns HighlightState::None when the
     10        RenderText content is not part of the current selection. Prior to r278561, it returned the RenderText's original selection state
     11        which in this case was HighlightState::End.
     12
     13        <div><span>A<br>B<span style="position: absolute"></span></span>C</div>
     14
     15        In this specific case when we select the outer <span>, we end up with the following selection states for the generated line boxes:
     16          (B) -> "Inside"
     17          (C) -> "None"
     18        while previously (C) came back as "End" (note that the absolute positioned element does not generate line boxes).
     19
     20        Now as Line::selectionState traverses through the line boxes, it comes across an unexpected "Inside -> None" transition at the selection end boundary (B -> C)
     21        which incorrectly leaves the line state in "Inside" and we paint the selection all the way to the end of the block.
     22
     23        Test: fast/editing/selection-with-absolute-positioned-empty-content.html
     24
     25        * layout/integration/InlineIteratorLine.cpp:
     26        (WebCore::InlineIterator::Line::selectionState const):
     27
    1282022-01-13  Peng Liu  <peng.liu6@apple.com>
    229
  • trunk/Source/WebCore/layout/integration/InlineIteratorLine.cpp

    r287520 r287981  
    191191            // We are past the end of the selection.
    192192            state = RenderObject::HighlightState::Both;
    193         }
     193        } else if (boxState == RenderObject::HighlightState::None && state == RenderObject::HighlightState::Inside)
     194            state = RenderObject::HighlightState::End;
     195
    194196        if (state == RenderObject::HighlightState::Both)
    195197            break;
Note: See TracChangeset for help on using the changeset viewer.