RESOLVED FIXED Bug 68875
Encapsulate m_firstNodeInserted and m_lastLeafInserted in node insertion logic
https://bugs.webkit.org/show_bug.cgi?id=68875
Summary Encapsulate m_firstNodeInserted and m_lastLeafInserted in node insertion logic
Ryosuke Niwa
Reported 2011-09-27 00:26:58 PDT
As the first part of the bug 68874, we need to encapsulate m_firstNodeInserted and m_lastLeafInserted in ReplaceSelectionCommand's node insertion logic.
Attachments
refactoring (13.48 KB, patch)
2011-09-27 00:39 PDT, Ryosuke Niwa
no flags
Added the forgotten DeleteSelectionCommand change (16.11 KB, patch)
2011-09-27 00:40 PDT, Ryosuke Niwa
tkent: review+
patch for landing (16.46 KB, patch)
2011-09-27 01:40 PDT, Ryosuke Niwa
no flags
Ryosuke Niwa
Comment 1 2011-09-27 00:39:02 PDT
Created attachment 108800 [details] refactoring
WebKit Review Bot
Comment 2 2011-09-27 00:40:32 PDT
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.
Ryosuke Niwa
Comment 3 2011-09-27 00:40:44 PDT
Created attachment 108802 [details] Added the forgotten DeleteSelectionCommand change
WebKit Review Bot
Comment 4 2011-09-27 00:43:01 PDT
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.
Ryosuke Niwa
Comment 5 2011-09-27 00:43:24 PDT
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.
Kent Tamura
Comment 6 2011-09-27 01:20:06 PDT
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.
Ryosuke Niwa
Comment 7 2011-09-27 01:38:37 PDT
Thanks for the review! Will land safely after addressing your comments.
Ryosuke Niwa
Comment 8 2011-09-27 01:40:23 PDT
Created attachment 108809 [details] patch for landing
WebKit Review Bot
Comment 9 2011-09-27 01:59:15 PDT
Comment on attachment 108809 [details] patch for landing Clearing flags on attachment: 108809 Committed r96084: <http://trac.webkit.org/changeset/96084>
WebKit Review Bot
Comment 10 2011-09-27 01:59:20 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.