DescriptionUnable 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 #
Messages
Total messages: 24 (0 generated)
|