As the first part of the bug 68874, we need to encapsulate m_firstNodeInserted and m_lastLeafInserted in ReplaceSelectionCommand's node insertion logic.
Created attachment 108800 [details] refactoring
Attachment 108800 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 Source/WebCore/editing/ReplaceSelectionCommand.cpp:557: Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side. [whitespace/operators] [4] Total errors found: 1 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 108802 [details] Added the forgotten DeleteSelectionCommand change
Attachment 108802 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 Source/WebCore/editing/ReplaceSelectionCommand.cpp:557: Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side. [whitespace/operators] [4] Total errors found: 1 in 6 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 108802 [details] Added the forgotten DeleteSelectionCommand change View in context: https://bugs.webkit.org/attachment.cgi?id=108802&action=review > Source/WebCore/editing/ReplaceSelectionCommand.cpp:558 > - if (!m_firstNodeInserted->renderer() && > + if (!m_firstNodeInserted->renderer() && > m_firstNodeInserted->isTextNode()) { Style bot is complaining about this existing line. I'll revert this whitespace change or fix the style if the reviewer is so inclined.
Comment on attachment 108802 [details] Added the forgotten DeleteSelectionCommand change View in context: https://bugs.webkit.org/attachment.cgi?id=108802&action=review > Source/WebCore/editing/ReplaceSelectionCommand.h:82 > + void respondToNodeInsertion(Node* node) > + { > + if (!node) > + return; > + > + if (!m_firstNodeInserted) > + m_firstNodeInserted = node; > + > + m_lastNodeInserted = node; > + } > + void willRemoveNode(Node* node) > + { > + if (m_firstNodeInserted == node) > + m_firstNodeInserted = node->traverseNextNode(); > + if (m_lastNodeInserted == node) > + m_lastNodeInserted = node->lastChild() ? node->lastChild() : node->traverseNextSibling(); > + } nit: I'd like to move these function definitions to ReplaceSelectionCommand.cpp in order to reduce the header size. > Source/WebCore/editing/ReplaceSelectionCommand.h:85 > + Node* firstNodeInserted() { return m_firstNodeInserted.get(); } > + Node* lastLeafInserted() { return m_lastNodeInserted->lastDescendant(); } > + Node* pastLastLeaf() { return m_firstNodeInserted ? lastLeafInserted()->traverseNextNode() : 0; } nit: These function should be "const". > Source/WebCore/editing/ReplaceSelectionCommand.h:86 > + private: Need a blank line before the private: label.
Thanks for the review! Will land safely after addressing your comments.
Created attachment 108809 [details] patch for landing
Comment on attachment 108809 [details] patch for landing Clearing flags on attachment: 108809 Committed r96084: <http://trac.webkit.org/changeset/96084>
All reviewed patches have been landed. Closing bug.