Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Issue 2254423002: boundaryTextInserted/Removed() should not call markValid() for irrelavent changes (Closed)

Created:
4 years, 4 months ago by Xiaocheng
Modified:
4 years, 4 months ago
Reviewers:
tkent, yosin_UTC9
CC:
blink-reviews, blink-reviews-dom_chromium.org, chromium-reviews, dglazkov+blink, eae+blinkwatch, rwlbuis, sof
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

boundaryTextInserted/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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+46 lines, -2 lines) Patch
M third_party/WebKit/Source/core/dom/Range.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/dom/RangeTest.cpp View 1 2 1 chunk +44 lines, -0 lines 0 comments Download

Messages

Total messages: 21 (12 generated)
Xiaocheng
PTAL.
4 years, 4 months ago (2016-08-19 05:24:51 UTC) #8
Xiaocheng
+yosin
4 years, 4 months ago (2016-08-19 05:49:04 UTC) #10
yosin_UTC9
https://codereview.chromium.org/2254423002/diff/20001/third_party/WebKit/Source/core/dom/Range.cpp File third_party/WebKit/Source/core/dom/Range.cpp (right): https://codereview.chromium.org/2254423002/diff/20001/third_party/WebKit/Source/core/dom/Range.cpp#newcode1410 third_party/WebKit/Source/core/dom/Range.cpp:1410: boundary.markValid(); Sorry, I don't understand this change. Changing data ...
4 years, 4 months ago (2016-08-19 06:02:43 UTC) #11
yosin_UTC9
lgtm w/ nits Please explain detail in description. Anyway, thanks for finding this! Excellent! https://codereview.chromium.org/2254423002/diff/20001/third_party/WebKit/Source/core/dom/Range.cpp ...
4 years, 4 months ago (2016-08-19 06:25:48 UTC) #12
tkent
rs lgtm
4 years, 4 months ago (2016-08-19 06:30:04 UTC) #13
Xiaocheng
Thanks for review. Committing with patch and description updated. https://codereview.chromium.org/2254423002/diff/20001/third_party/WebKit/Source/core/dom/RangeTest.cpp File third_party/WebKit/Source/core/dom/RangeTest.cpp (right): https://codereview.chromium.org/2254423002/diff/20001/third_party/WebKit/Source/core/dom/RangeTest.cpp#newcode11 third_party/WebKit/Source/core/dom/RangeTest.cpp:11: ...
4 years, 4 months ago (2016-08-19 06:37:45 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2254423002/40001
4 years, 4 months ago (2016-08-19 06:38:07 UTC) #18
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years, 4 months ago (2016-08-19 11:01:31 UTC) #19
commit-bot: I haz the power
4 years, 4 months ago (2016-08-19 11:04:45 UTC) #21
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/8cdfdf011fb08fd2dda2d02c2b89bb7f08a53272
Cr-Commit-Position: refs/heads/master@{#413104}

Powered by Google App Engine
This is Rietveld 408576698