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

Issue 59963002: Unable to delete the first and the last characters of a contenteditable div with display: table. (Closed)

Created:
7 years, 1 month ago by arpitab_
Modified:
7 years ago
CC:
blink-reviews, ojan
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Unable to delete the first and the last characters of a contenteditable div with display: table. Contenteditable cannot be set for table elements. So throughout our editing code we have checks wherein if the node being processed is a table node, we check for contenteditability on its parent. The current check: isTableElement() however checks based on the renderer's style display type. If the display of the renderer was set to TABLE or INLINE_TABLE, it would be considered as a node to be skipped (for editing purposes) and contenteditability verified against its parent. However, with this approach, block elements whose display type has been set to TABLE and who also have contenteditable set for them, too would get skipped; since the check was being carried out against the renderer and not the element type. Methods such as isEditablePosition(), isCandidate(), upstream(), downstream() etc., basically all methods that are concerned with either checking the validity of the current position or dealing with position traversal should thus check against the element's name (table) instead of the renderer. The isTableElement() function is used only for editing purposes. Have thus modified the same to only check against the tag name. Another method isRenderedTable() has been added which performs the old check (against the renderer's display type). One existing test's expected result changes after this fix. The test is a crashtest and an extra space character gets added now. This is because for that test, display: table set on the body element is now being respected and when formatted, an extra space is appended at the end. The extra space gets added for formatting carried out on the body element even with the original code. More explanation with screenshots for this change have been added to the corresponding bug: #107366 BUG=107366 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=162687

Patch Set 1 #

Total comments: 5

Patch Set 2 : Adding new method to preserve old behavior. #

Total comments: 1

Patch Set 3 : Introducing isTableElement() #

Total comments: 4

Patch Set 4 : Modifying testcase #

Total comments: 2

Patch Set 5 : Tweaking the testcase #

Total comments: 4

Patch Set 6 : Fixing the nits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+74 lines, -16 lines) Patch
A LayoutTests/editing/deleting/display-table.html View 1 2 3 4 5 1 chunk +38 lines, -0 lines 0 comments Download
A LayoutTests/editing/deleting/display-table-expected.txt View 1 2 3 4 5 1 chunk +11 lines, -0 lines 0 comments Download
M LayoutTests/editing/execCommand/format-block-at-root-expected.txt View 1 chunk +2 lines, -2 lines 0 comments Download
M Source/core/dom/Position.cpp View 1 2 4 chunks +5 lines, -5 lines 0 comments Download
M Source/core/dom/PositionIterator.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download
M Source/core/editing/CompositeEditCommand.cpp View 1 2 3 4 5 2 chunks +2 lines, -2 lines 0 comments Download
M Source/core/editing/htmlediting.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/editing/htmlediting.cpp View 1 2 3 4 5 4 chunks +14 lines, -6 lines 0 comments Download

Messages

Total messages: 24 (0 generated)
arpitab_
7 years, 1 month ago (2013-11-05 14:35:38 UTC) #1
yosin_UTC9
https://codereview.chromium.org/59963002/diff/1/LayoutTests/editing/execCommand/format-block-at-root-expected.txt File LayoutTests/editing/execCommand/format-block-at-root-expected.txt (right): https://codereview.chromium.org/59963002/diff/1/LayoutTests/editing/execCommand/format-block-at-root-expected.txt#newcode3 LayoutTests/editing/execCommand/format-block-at-root-expected.txt:3: if (window.testRunner) testRunner.dumpAsText(); document.designMode = "on"; range = document.createRange(); ...
7 years, 1 month ago (2013-11-06 01:29:33 UTC) #2
arpitab_
https://codereview.chromium.org/59963002/diff/1/LayoutTests/editing/execCommand/format-block-at-root-expected.txt File LayoutTests/editing/execCommand/format-block-at-root-expected.txt (right): https://codereview.chromium.org/59963002/diff/1/LayoutTests/editing/execCommand/format-block-at-root-expected.txt#newcode3 LayoutTests/editing/execCommand/format-block-at-root-expected.txt:3: if (window.testRunner) testRunner.dumpAsText(); document.designMode = "on"; range = document.createRange(); ...
7 years, 1 month ago (2013-11-06 06:59:51 UTC) #3
yosin_UTC9
https://codereview.chromium.org/59963002/diff/1/LayoutTests/editing/execCommand/format-block-at-root-expected.txt File LayoutTests/editing/execCommand/format-block-at-root-expected.txt (right): https://codereview.chromium.org/59963002/diff/1/LayoutTests/editing/execCommand/format-block-at-root-expected.txt#newcode3 LayoutTests/editing/execCommand/format-block-at-root-expected.txt:3: if (window.testRunner) testRunner.dumpAsText(); document.designMode = "on"; range = document.createRange(); ...
7 years, 1 month ago (2013-11-06 07:32:39 UTC) #4
arpitab_
On 2013/11/06 07:32:39, Yoshi wrote: > https://codereview.chromium.org/59963002/diff/1/LayoutTests/editing/execCommand/format-block-at-root-expected.txt > File LayoutTests/editing/execCommand/format-block-at-root-expected.txt (right): > > https://codereview.chromium.org/59963002/diff/1/LayoutTests/editing/execCommand/format-block-at-root-expected.txt#newcode3 > ...
7 years, 1 month ago (2013-11-07 10:08:49 UTC) #5
arpitab_
Hi Yoshi, Have uploaded another patch with two separate methods: isTableElement() - that checks against ...
7 years, 1 month ago (2013-11-07 11:15:35 UTC) #6
yosin_UTC9
On 2013/11/07 11:15:35, arpitab_ wrote: > Hi Yoshi, > > Have uploaded another patch with ...
7 years, 1 month ago (2013-11-08 01:44:11 UTC) #7
yosin_UTC9
https://codereview.chromium.org/59963002/diff/100001/LayoutTests/editing/execCommand/format-block-at-root-expected.txt File LayoutTests/editing/execCommand/format-block-at-root-expected.txt (right): https://codereview.chromium.org/59963002/diff/100001/LayoutTests/editing/execCommand/format-block-at-root-expected.txt#newcode2 LayoutTests/editing/execCommand/format-block-at-root-expected.txt:2: Test passes if it does not crash. which function ...
7 years, 1 month ago (2013-11-08 01:44:45 UTC) #8
ojan
7 years, 1 month ago (2013-11-08 01:56:20 UTC) #9
arpitab_
On 2013/11/08 01:44:11, Yoshi wrote: > On 2013/11/07 11:15:35, arpitab_ wrote: > > Hi Yoshi, ...
7 years, 1 month ago (2013-11-08 12:39:53 UTC) #10
arpitab_
Hi Yoshi, As discussed, have now added another patch here that introduces the isTableElement() method ...
7 years, 1 month ago (2013-11-14 06:07:02 UTC) #11
yosin_UTC9
Do we really need to replace these isRenderedTable() to isTableElement() for deleting first/last characters in ...
7 years, 1 month ago (2013-11-14 06:57:59 UTC) #12
arpitab_
On 2013/11/14 06:57:59, Yoshi wrote: > Do we really need to replace these isRenderedTable() to ...
7 years, 1 month ago (2013-11-14 07:05:38 UTC) #13
arpitab_
https://codereview.chromium.org/59963002/diff/190001/LayoutTests/editing/deleting/display-table.html File LayoutTests/editing/deleting/display-table.html (right): https://codereview.chromium.org/59963002/diff/190001/LayoutTests/editing/deleting/display-table.html#newcode22 LayoutTests/editing/deleting/display-table.html:22: document.execCommand("forwardDelete"); On 2013/11/14 06:57:59, Yoshi wrote: > I think ...
7 years, 1 month ago (2013-11-14 07:08:14 UTC) #14
arpitab_
Hi Yoshi, Have posted another patch with the modified testcase using js-test.js instead of the ...
7 years, 1 month ago (2013-11-14 10:19:50 UTC) #15
yosin_UTC9
ACK https://codereview.chromium.org/59963002/diff/280001/LayoutTests/editing/deleting/display-table-expected.txt File LayoutTests/editing/deleting/display-table-expected.txt (right): https://codereview.chromium.org/59963002/diff/280001/LayoutTests/editing/deleting/display-table-expected.txt#newcode1 LayoutTests/editing/deleting/display-table-expected.txt:1: Testcase for bug http://crbug.com/107366: Can't delete first and ...
7 years, 1 month ago (2013-11-15 01:57:49 UTC) #16
arpitab_
https://codereview.chromium.org/59963002/diff/280001/LayoutTests/editing/deleting/display-table-expected.txt File LayoutTests/editing/deleting/display-table-expected.txt (right): https://codereview.chromium.org/59963002/diff/280001/LayoutTests/editing/deleting/display-table-expected.txt#newcode1 LayoutTests/editing/deleting/display-table-expected.txt:1: Testcase for bug http://crbug.com/107366: Can't delete first and last ...
7 years, 1 month ago (2013-11-15 06:14:24 UTC) #17
arpitab_
On 2013/11/15 01:57:49, Yoshi wrote: > ACK > > https://codereview.chromium.org/59963002/diff/280001/LayoutTests/editing/deleting/display-table-expected.txt > File LayoutTests/editing/deleting/display-table-expected.txt (right): > ...
7 years, 1 month ago (2013-11-15 06:17:39 UTC) #18
yosin_UTC9
ACK Thanks!
7 years, 1 month ago (2013-11-15 06:36:07 UTC) #19
leviw_travelin_and_unemployed
LGTM. https://codereview.chromium.org/59963002/diff/340001/LayoutTests/editing/deleting/display-table.html File LayoutTests/editing/deleting/display-table.html (right): https://codereview.chromium.org/59963002/diff/340001/LayoutTests/editing/deleting/display-table.html#newcode15 LayoutTests/editing/deleting/display-table.html:15: function testIt(caretPosition, deleteCommand, expectedString) Nit: runTest? Also a ...
7 years ago (2013-11-26 01:39:43 UTC) #20
arpitab_
On 2013/11/26 01:39:43, Levi wrote: > LGTM. > > https://codereview.chromium.org/59963002/diff/340001/LayoutTests/editing/deleting/display-table.html > File LayoutTests/editing/deleting/display-table.html (right): > ...
7 years ago (2013-11-26 09:08:58 UTC) #21
arpitab_
https://codereview.chromium.org/59963002/diff/340001/LayoutTests/editing/deleting/display-table.html File LayoutTests/editing/deleting/display-table.html (right): https://codereview.chromium.org/59963002/diff/340001/LayoutTests/editing/deleting/display-table.html#newcode15 LayoutTests/editing/deleting/display-table.html:15: function testIt(caretPosition, deleteCommand, expectedString) On 2013/11/26 01:39:43, Levi wrote: ...
7 years ago (2013-11-26 09:09:08 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/a.bah@samsung.com/59963002/370001
7 years ago (2013-11-26 10:03:53 UTC) #23
commit-bot: I haz the power
7 years ago (2013-11-26 11:56:58 UTC) #24
Message was sent while issue was closed.
Change committed as 162687

Powered by Google App Engine
This is Rietveld 408576698