Changeset 81374 in webkit
- Timestamp:
- Mar 17, 2011 12:02:50 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r81373 r81374 1 2011-03-17 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Justin Garcia. 4 5 Assert that editing does not ignore position's anchorNode if position is an offset in anchor 6 https://bugs.webkit.org/show_bug.cgi?id=56027 7 8 Added a test to ensure WebKit lets users edit contents inside a button element properly. 9 10 * editing/execCommand/button-expected.txt: Added. 11 * editing/execCommand/button.html: Added. 12 1 13 2011-03-17 Adam Roben <aroben@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r81369 r81374 1 2011-03-17 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Justin Garcia. 4 5 Assert that editing does not ignore position's anchorNode if position is an offset in anchor 6 https://bugs.webkit.org/show_bug.cgi?id=56027 7 8 Added the assertion in Position::Position and Position::moveToPosition. This assertion catches 9 places where we instantiate positions inside a node on which editingIgnoresContent returns true. 10 11 Test: editing/execCommand/button.html 12 13 * dom/Position.cpp: 14 (WebCore::Position::Position): Added an assertion. 15 (WebCore::Position::moveToPosition): Ditto. 16 * dom/PositionIterator.cpp: 17 (WebCore::PositionIterator::operator Position): Avoid creating a position immediately below 18 a node whose content is ignored by editing. While this does not avoid creation of positions 19 inside ignored contents completely, it works in most cases. Filed the bug 56027 to resolve 20 the underlying problem. Without this change, the assertion hits in existing layout tests. 21 cannot be tested directly. 22 * editing/ApplyStyleCommand.cpp: 23 (WebCore::ApplyStyleCommand::addInlineStyleIfNeeded): Call firstPositionInOrBeforeNode 24 instead of firstPositionInNode because startNode may as well be a br element. Without this change, 25 the assertion hits in existing layout tests. 26 * editing/htmlediting.cpp: 27 (WebCore::canHaveChildrenForEditing): button is editable so content is not ignored. Added a test 28 for this. 29 * editing/visible_units.cpp: 30 (WebCore::previousBoundary): Added a FIXME. 31 (WebCore::startPositionForLine): Because br can also have an inline text box, checking that 32 startBox is an inline text box isn't an adequate to instantiate a position inside startNode. 33 Call startNode->isTextNode() instead. Without this change, the assertion hits in existing layout 34 tests. 35 1 36 2011-03-17 Pavel Podivilov <podivilov@chromium.org> 2 37 -
trunk/Source/WebCore/dom/Position.cpp
r81165 r81374 95 95 , m_isLegacyEditingPosition(false) 96 96 { 97 ASSERT(!m_anchorNode || !editingIgnoresContent(m_anchorNode.get())); 97 98 ASSERT(anchorType == PositionIsOffsetInAnchor); 98 99 } … … 100 101 void Position::moveToPosition(PassRefPtr<Node> node, int offset) 101 102 { 103 ASSERT(!editingIgnoresContent(node.get())); 102 104 ASSERT(anchorType() == PositionIsOffsetInAnchor || m_isLegacyEditingPosition); 103 105 m_anchorNode = node; -
trunk/Source/WebCore/dom/PositionIterator.cpp
r81165 r81374 39 39 if (m_nodeAfterPositionInAnchor) { 40 40 ASSERT(m_nodeAfterPositionInAnchor->parentNode() == m_anchorNode); 41 // FIXME: This check is inadaquete because any ancestor could be ignored by editing 42 if (editingIgnoresContent(m_nodeAfterPositionInAnchor->parentNode())) 43 return positionBeforeNode(m_anchorNode); 41 44 return positionInParentBeforeNode(m_nodeAfterPositionInAnchor); 42 45 } -
trunk/Source/WebCore/editing/ApplyStyleCommand.cpp
r80580 r81374 1697 1697 positionForStyleComparison = positionBeforeNode(dummyElement.get()); 1698 1698 } else 1699 positionForStyleComparison = firstPositionIn Node(startNode.get());1699 positionForStyleComparison = firstPositionInOrBeforeNode(startNode.get()); 1700 1700 1701 1701 StyleChange styleChange(style, positionForStyleComparison); -
trunk/Source/WebCore/editing/htmlediting.cpp
r81295 r81374 77 77 && !node->hasTagName(brTag) 78 78 && !node->hasTagName(imgTag) 79 && !node->hasTagName(buttonTag)80 79 && !node->hasTagName(inputTag) 81 80 && !node->hasTagName(textareaTag) -
trunk/Source/WebCore/editing/visible_units.cpp
r81165 r81374 127 127 BackwardsCharacterIterator charIt(searchRange.get()); 128 128 charIt.advance(string.size() - suffixLength - next); 129 // FIXME: charIt can get out of shadow host. 129 130 return VisiblePosition(charIt.range()->endPosition(), DOWNSTREAM); 130 131 } … … 378 379 } 379 380 380 VisiblePosition visPos = start Box->isInlineTextBox() ? VisiblePosition(Position(startNode, static_cast<InlineTextBox *>(startBox)->start(), Position::PositionIsOffsetInAnchor), DOWNSTREAM)381 381 VisiblePosition visPos = startNode->isTextNode() ? VisiblePosition(Position(startNode, static_cast<InlineTextBox *>(startBox)->start(), Position::PositionIsOffsetInAnchor), DOWNSTREAM) 382 : VisiblePosition(positionBeforeNode(startNode), DOWNSTREAM); 382 383 return positionAvoidingFirstPositionInTable(visPos); 383 384 }
Note: See TracChangeset
for help on using the changeset viewer.