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

Side by Side Diff: Source/core/editing/ApplyBlockElementCommand.cpp

Issue 105483003: Editing - Code refactoring to avoid redundant function calls (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Including few more similar fixes Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/editing/IndentOutdentCommand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2010 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 RefPtr<Element> blockquote = createBlockElement(); 110 RefPtr<Element> blockquote = createBlockElement();
111 insertNodeAt(blockquote, start); 111 insertNodeAt(blockquote, start);
112 RefPtr<Element> placeholder = createBreakElement(document()); 112 RefPtr<Element> placeholder = createBreakElement(document());
113 appendNode(placeholder, blockquote); 113 appendNode(placeholder, blockquote);
114 setEndingSelection(VisibleSelection(positionBeforeNode(placeholder.get() ), DOWNSTREAM, endingSelection().isDirectional())); 114 setEndingSelection(VisibleSelection(positionBeforeNode(placeholder.get() ), DOWNSTREAM, endingSelection().isDirectional()));
115 return; 115 return;
116 } 116 }
117 117
118 RefPtr<Element> blockquoteForNextIndent; 118 RefPtr<Element> blockquoteForNextIndent;
119 VisiblePosition endOfCurrentParagraph = endOfParagraph(startOfSelection); 119 VisiblePosition endOfCurrentParagraph = endOfParagraph(startOfSelection);
120 VisiblePosition endAfterSelection = endOfParagraph(endOfParagraph(endOfSelec tion).next()); 120 VisiblePosition endOfLastParagraph = endOfParagraph(endOfSelection);
121 m_endOfLastParagraph = endOfParagraph(endOfSelection).deepEquivalent(); 121 VisiblePosition endAfterSelection = endOfParagraph(endOfLastParagraph.next() );
122 m_endOfLastParagraph = endOfLastParagraph.deepEquivalent();
122 123
123 bool atEnd = false; 124 bool atEnd = false;
124 Position end; 125 Position end;
125 while (endOfCurrentParagraph != endAfterSelection && !atEnd) { 126 while (endOfCurrentParagraph != endAfterSelection && !atEnd) {
126 if (endOfCurrentParagraph.deepEquivalent() == m_endOfLastParagraph) 127 if (endOfCurrentParagraph.deepEquivalent() == m_endOfLastParagraph)
127 atEnd = true; 128 atEnd = true;
128 129
129 rangeForParagraphSplittingTextNodesIfNeeded(endOfCurrentParagraph, start , end); 130 rangeForParagraphSplittingTextNodesIfNeeded(endOfCurrentParagraph, start , end);
130 endOfCurrentParagraph = end; 131 endOfCurrentParagraph = end;
131 132
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 278
278 PassRefPtr<Element> ApplyBlockElementCommand::createBlockElement() const 279 PassRefPtr<Element> ApplyBlockElementCommand::createBlockElement() const
279 { 280 {
280 RefPtr<Element> element = createHTMLElement(document(), m_tagName); 281 RefPtr<Element> element = createHTMLElement(document(), m_tagName);
281 if (m_inlineStyle.length()) 282 if (m_inlineStyle.length())
282 element->setAttribute(styleAttr, m_inlineStyle); 283 element->setAttribute(styleAttr, m_inlineStyle);
283 return element.release(); 284 return element.release();
284 } 285 }
285 286
286 } 287 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/IndentOutdentCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698