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

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

Issue 417113011: Cast highestEnclosingNodeOfType() return value to tighter type (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 4 months 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "core/editing/TextIterator.h" 59 #include "core/editing/TextIterator.h"
60 #include "core/editing/VisibleUnits.h" 60 #include "core/editing/VisibleUnits.h"
61 #include "core/editing/WrapContentsInDummySpanCommand.h" 61 #include "core/editing/WrapContentsInDummySpanCommand.h"
62 #include "core/editing/htmlediting.h" 62 #include "core/editing/htmlediting.h"
63 #include "core/editing/markup.h" 63 #include "core/editing/markup.h"
64 #include "core/events/ScopedEventQueue.h" 64 #include "core/events/ScopedEventQueue.h"
65 #include "core/frame/LocalFrame.h" 65 #include "core/frame/LocalFrame.h"
66 #include "core/html/HTMLBRElement.h" 66 #include "core/html/HTMLBRElement.h"
67 #include "core/html/HTMLDivElement.h" 67 #include "core/html/HTMLDivElement.h"
68 #include "core/html/HTMLElement.h" 68 #include "core/html/HTMLElement.h"
69 #include "core/html/HTMLQuoteElement.h"
69 #include "core/html/HTMLSpanElement.h" 70 #include "core/html/HTMLSpanElement.h"
70 #include "core/rendering/InlineTextBox.h" 71 #include "core/rendering/InlineTextBox.h"
71 #include "core/rendering/RenderBlock.h" 72 #include "core/rendering/RenderBlock.h"
72 #include "core/rendering/RenderListItem.h" 73 #include "core/rendering/RenderListItem.h"
73 #include "core/rendering/RenderText.h" 74 #include "core/rendering/RenderText.h"
74 75
75 namespace blink { 76 namespace blink {
76 77
77 using namespace HTMLNames; 78 using namespace HTMLNames;
78 79
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 } 1354 }
1354 1355
1355 // If the caret is in an empty quoted paragraph, and either there is nothing bef ore that 1356 // If the caret is in an empty quoted paragraph, and either there is nothing bef ore that
1356 // paragraph, or what is before is unquoted, and the user presses delete, unquot e that paragraph. 1357 // paragraph, or what is before is unquoted, and the user presses delete, unquot e that paragraph.
1357 bool CompositeEditCommand::breakOutOfEmptyMailBlockquotedParagraph() 1358 bool CompositeEditCommand::breakOutOfEmptyMailBlockquotedParagraph()
1358 { 1359 {
1359 if (!endingSelection().isCaret()) 1360 if (!endingSelection().isCaret())
1360 return false; 1361 return false;
1361 1362
1362 VisiblePosition caret(endingSelection().visibleStart()); 1363 VisiblePosition caret(endingSelection().visibleStart());
1363 Node* highestBlockquote = highestEnclosingNodeOfType(caret.deepEquivalent(), &isMailBlockquote); 1364 HTMLQuoteElement* highestBlockquote = toHTMLQuoteElement(highestEnclosingNod eOfType(caret.deepEquivalent(), &isMailHTMLBlockquoteElement));
1364 if (!highestBlockquote) 1365 if (!highestBlockquote)
1365 return false; 1366 return false;
1366 1367
1367 if (!isStartOfParagraph(caret) || !isEndOfParagraph(caret)) 1368 if (!isStartOfParagraph(caret) || !isEndOfParagraph(caret))
1368 return false; 1369 return false;
1369 1370
1370 VisiblePosition previous(caret.previous(CannotCrossEditingBoundary)); 1371 VisiblePosition previous(caret.previous(CannotCrossEditingBoundary));
1371 // Only move forward if there's nothing before the caret, or if there's unqu oted content before it. 1372 // Only move forward if there's nothing before the caret, or if there's unqu oted content before it.
1372 if (enclosingNodeOfType(previous.deepEquivalent(), &isMailBlockquote)) 1373 if (enclosingNodeOfType(previous.deepEquivalent(), &isMailHTMLBlockquoteElem ent))
1373 return false; 1374 return false;
1374 1375
1375 RefPtrWillBeRawPtr<HTMLBRElement> br = createBreakElement(document()); 1376 RefPtrWillBeRawPtr<HTMLBRElement> br = createBreakElement(document());
1376 // We want to replace this quoted paragraph with an unquoted one, so insert a br 1377 // We want to replace this quoted paragraph with an unquoted one, so insert a br
1377 // to hold the caret before the highest blockquote. 1378 // to hold the caret before the highest blockquote.
1378 insertNodeBefore(br, highestBlockquote); 1379 insertNodeBefore(br, highestBlockquote);
1379 VisiblePosition atBR(positionBeforeNode(br.get())); 1380 VisiblePosition atBR(positionBeforeNode(br.get()));
1380 // If the br we inserted collapsed, for example foo<br><blockquote>...</bloc kquote>, insert 1381 // If the br we inserted collapsed, for example foo<br><blockquote>...</bloc kquote>, insert
1381 // a second one. 1382 // a second one.
1382 if (!isStartOfParagraph(atBR)) 1383 if (!isStartOfParagraph(atBR))
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 } 1498 }
1498 1499
1499 void CompositeEditCommand::trace(Visitor* visitor) 1500 void CompositeEditCommand::trace(Visitor* visitor)
1500 { 1501 {
1501 visitor->trace(m_commands); 1502 visitor->trace(m_commands);
1502 visitor->trace(m_composition); 1503 visitor->trace(m_composition);
1503 EditCommand::trace(visitor); 1504 EditCommand::trace(visitor);
1504 } 1505 }
1505 1506
1506 } // namespace blink 1507 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/BreakBlockquoteCommand.cpp ('k') | Source/core/editing/DeleteSelectionCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698