| OLD | NEW |
| 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/editing/Editor.h" | 34 #include "core/editing/Editor.h" |
| 35 #include "core/editing/FrameSelection.h" | 35 #include "core/editing/FrameSelection.h" |
| 36 #include "core/editing/InsertLineBreakCommand.h" | 36 #include "core/editing/InsertLineBreakCommand.h" |
| 37 #include "core/editing/InsertParagraphSeparatorCommand.h" | 37 #include "core/editing/InsertParagraphSeparatorCommand.h" |
| 38 #include "core/editing/InsertTextCommand.h" | 38 #include "core/editing/InsertTextCommand.h" |
| 39 #include "core/editing/SpellChecker.h" | 39 #include "core/editing/SpellChecker.h" |
| 40 #include "core/editing/VisiblePosition.h" | 40 #include "core/editing/VisiblePosition.h" |
| 41 #include "core/editing/VisibleUnits.h" | 41 #include "core/editing/VisibleUnits.h" |
| 42 #include "core/editing/htmlediting.h" | 42 #include "core/editing/htmlediting.h" |
| 43 #include "core/frame/LocalFrame.h" | 43 #include "core/frame/LocalFrame.h" |
| 44 #include "core/html/HTMLBRElement.h" |
| 44 #include "core/rendering/RenderObject.h" | 45 #include "core/rendering/RenderObject.h" |
| 45 | 46 |
| 46 namespace WebCore { | 47 namespace WebCore { |
| 47 | 48 |
| 48 using namespace HTMLNames; | 49 using namespace HTMLNames; |
| 49 | 50 |
| 50 class TypingCommandLineOperation | 51 class TypingCommandLineOperation |
| 51 { | 52 { |
| 52 public: | 53 public: |
| 53 TypingCommandLineOperation(TypingCommand* typingCommand, bool selectInserted
Text, const String& text) | 54 TypingCommandLineOperation(TypingCommand* typingCommand, bool selectInserted
Text, const String& text) |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 } | 378 } |
| 378 | 379 |
| 379 bool TypingCommand::makeEditableRootEmpty() | 380 bool TypingCommand::makeEditableRootEmpty() |
| 380 { | 381 { |
| 381 Element* root = endingSelection().rootEditableElement(); | 382 Element* root = endingSelection().rootEditableElement(); |
| 382 if (!root || !root->firstChild()) | 383 if (!root || !root->firstChild()) |
| 383 return false; | 384 return false; |
| 384 | 385 |
| 385 if (root->firstChild() == root->lastChild()) { | 386 if (root->firstChild() == root->lastChild()) { |
| 386 Element* firstElementChild = ElementTraversal::firstWithin(*root); | 387 Element* firstElementChild = ElementTraversal::firstWithin(*root); |
| 387 if (firstElementChild && firstElementChild->hasTagName(brTag)) { | 388 if (isHTMLBRElement(firstElementChild)) { |
| 388 // If there is a single child and it could be a placeholder, leave i
t alone. | 389 // If there is a single child and it could be a placeholder, leave i
t alone. |
| 389 if (root->renderer() && root->renderer()->isRenderBlockFlow()) | 390 if (root->renderer() && root->renderer()->isRenderBlockFlow()) |
| 390 return false; | 391 return false; |
| 391 } | 392 } |
| 392 } | 393 } |
| 393 | 394 |
| 394 while (Node* child = root->firstChild()) | 395 while (Node* child = root->firstChild()) |
| 395 removeNode(child); | 396 removeNode(child); |
| 396 | 397 |
| 397 addBlockPlaceholderIfNeeded(root); | 398 addBlockPlaceholderIfNeeded(root); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 ASSERT_NOT_REACHED(); | 619 ASSERT_NOT_REACHED(); |
| 619 m_preservesTypingStyle = false; | 620 m_preservesTypingStyle = false; |
| 620 } | 621 } |
| 621 | 622 |
| 622 bool TypingCommand::isTypingCommand() const | 623 bool TypingCommand::isTypingCommand() const |
| 623 { | 624 { |
| 624 return true; | 625 return true; |
| 625 } | 626 } |
| 626 | 627 |
| 627 } // namespace WebCore | 628 } // namespace WebCore |
| OLD | NEW |