Chromium Code Reviews
DescriptionboundaryTextInserted/Removed() should not call markValid() for irrelavent changes
This patch fixes a bug related to the maintenance of RangeBoundaryPoint. Example:
Let body's content be "<div>foo<span>bar</span></foo>", and a range created as
from (<span>, 0) to (<div>, 2). Then there are two updates:
1. Insert a new sibling before the text node "foo"
2. Insert/Remove characters in the text node "foo"
In the current implementation, step 2 incorrectly marks the boundary points of
the range as up-to-date without actually updating the stored offsets in it, making
the change in step 1 ignored. Then if we call |range->endPosition()|, we still get
(<div>, 2) instead of (<div>, 3), leaving the range in an inconsistent state.
This patch ensures that boundaryTextInserted/Removed() only calls markValid()
when the current RangeBoundaryPoints's container is the CharacterData node
where text is inserted/removed, and irrelevant RangeBoundaryPoints should not
be changed.
BUG=639184
TEST=webkit_unit_tests --gtest_filter=RangeTest.NotMarkedValidByIrrelevantText*
Committed: https://crrev.com/8cdfdf011fb08fd2dda2d02c2b89bb7f08a53272
Cr-Commit-Position: refs/heads/master@{#413104}
Patch Set 1 #Patch Set 2 : Add unit test #
Total comments: 4
Patch Set 3 : Remove useless includes #
Messages
Total messages: 21 (12 generated)
|
||||||||||||||||||||||||||||