Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b6df426f37df31a8168cb073df8ada64aa9c63e1
      
https://github.com/WebKit/WebKit/commit/b6df426f37df31a8168cb073df8ada64aa9c63e1
  Author: Alan Baradlay <za...@apple.com>
  Date:   2023-04-18 (Tue, 18 Apr 2023)

  Changed paths:
    A 
LayoutTests/fast/inline/partial-layout-with-enter-backspace-enter-combo-expected.txt
    A 
LayoutTests/fast/inline/partial-layout-with-enter-backspace-enter-combo.html
    M 
Source/WebCore/layout/formattingContexts/inline/invalidation/InlineInvalidation.cpp

  Log Message:
  -----------
  REGRESSION(261836@main): Incorrect caret placement after hitting 
enter/backspace/enter combo in long text
https://bugs.webkit.org/show_bug.cgi?id=254989
<rdar://problem/108215532>

Reviewed by Antti Koivisto.

This bugs caused by an incorrectly computed (damaged) line index which caused 
us exiting inline layout too early (and not producing content for the new 
newline).

With partial layout we
1. first compute the damaged line index which is the entry point for the 
subsequent inline layout.
2. run inline layout until we see no change in generated display boxes anymore 
(in many cases the damage only affects a range of lines and not the full set)

With the following content:

First line 1\n
Second line 2\n
Third line 3\n

When a new \n is inserted between the last \n and [3], we compute the damage 
position by looking at the _start_ of the previous sibling.
In this case the previous sibling is "First line 1\nSecond line 2\nThird line 
3\n" which means we damage the content starting from line #0.
The subsequent inline layout starts generating display boxes starting from line 
#0 and bails out at the end of line #1 since the set of display boxes are 
getting generated
match what we had before.

This fix ensures that when we insert some content, the damaged line index is 
computed based on the insertion point (end of the previous sibling).

* 
Source/WebCore/layout/formattingContexts/inline/invalidation/InlineInvalidation.cpp:
(WebCore::Layout::damagedLineIndex):
(WebCore::Layout::inlineItemPositionForDamagedContentPosition):
(WebCore::Layout::InlineInvalidation::textInserted):
(WebCore::Layout::InlineInvalidation::inlineLevelBoxInserted):

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to