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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 #include "core/editing/SplitTextNodeCommand.h" | 57 #include "core/editing/SplitTextNodeCommand.h" |
58 #include "core/editing/SplitTextNodeContainingElementCommand.h" | 58 #include "core/editing/SplitTextNodeContainingElementCommand.h" |
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/HTMLElement.h" | 68 #include "core/html/HTMLElement.h" |
68 #include "core/html/HTMLSpanElement.h" | 69 #include "core/html/HTMLSpanElement.h" |
69 #include "core/rendering/InlineTextBox.h" | 70 #include "core/rendering/InlineTextBox.h" |
70 #include "core/rendering/RenderBlock.h" | 71 #include "core/rendering/RenderBlock.h" |
71 #include "core/rendering/RenderListItem.h" | 72 #include "core/rendering/RenderListItem.h" |
72 #include "core/rendering/RenderText.h" | 73 #include "core/rendering/RenderText.h" |
73 | 74 |
74 namespace blink { | 75 namespace blink { |
75 | 76 |
76 using namespace HTMLNames; | 77 using namespace HTMLNames; |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 { | 287 { |
287 applyCommandToComposite(InsertParagraphSeparatorCommand::create(document(),
useDefaultParagraphElement, pasteBlockqutoeIntoUnquotedArea)); | 288 applyCommandToComposite(InsertParagraphSeparatorCommand::create(document(),
useDefaultParagraphElement, pasteBlockqutoeIntoUnquotedArea)); |
288 } | 289 } |
289 | 290 |
290 bool CompositeEditCommand::isRemovableBlock(const Node* node) | 291 bool CompositeEditCommand::isRemovableBlock(const Node* node) |
291 { | 292 { |
292 ASSERT(node); | 293 ASSERT(node); |
293 if (!isHTMLDivElement(*node)) | 294 if (!isHTMLDivElement(*node)) |
294 return false; | 295 return false; |
295 | 296 |
296 ContainerNode* parentNode = node->parentNode(); | 297 const HTMLDivElement& element = toHTMLDivElement(*node); |
| 298 ContainerNode* parentNode = element.parentNode(); |
297 if (parentNode && parentNode->firstChild() != parentNode->lastChild()) | 299 if (parentNode && parentNode->firstChild() != parentNode->lastChild()) |
298 return false; | 300 return false; |
299 | 301 |
300 if (!toElement(node)->hasAttributes()) | 302 if (!element.hasAttributes()) |
301 return true; | 303 return true; |
302 | 304 |
303 return false; | 305 return false; |
304 } | 306 } |
305 | 307 |
306 void CompositeEditCommand::insertNodeBefore(PassRefPtrWillBeRawPtr<Node> insertC
hild, PassRefPtrWillBeRawPtr<Node> refChild, ShouldAssumeContentIsAlwaysEditable
shouldAssumeContentIsAlwaysEditable) | 308 void CompositeEditCommand::insertNodeBefore(PassRefPtrWillBeRawPtr<Node> insertC
hild, PassRefPtrWillBeRawPtr<Node> refChild, ShouldAssumeContentIsAlwaysEditable
shouldAssumeContentIsAlwaysEditable) |
307 { | 309 { |
308 ASSERT(!isHTMLBodyElement(*refChild)); | 310 ASSERT(!isHTMLBodyElement(*refChild)); |
309 applyCommandToComposite(InsertNodeBeforeCommand::create(insertChild, refChil
d, shouldAssumeContentIsAlwaysEditable)); | 311 applyCommandToComposite(InsertNodeBeforeCommand::create(insertChild, refChil
d, shouldAssumeContentIsAlwaysEditable)); |
310 } | 312 } |
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 } | 1497 } |
1496 | 1498 |
1497 void CompositeEditCommand::trace(Visitor* visitor) | 1499 void CompositeEditCommand::trace(Visitor* visitor) |
1498 { | 1500 { |
1499 visitor->trace(m_commands); | 1501 visitor->trace(m_commands); |
1500 visitor->trace(m_composition); | 1502 visitor->trace(m_composition); |
1501 EditCommand::trace(visitor); | 1503 EditCommand::trace(visitor); |
1502 } | 1504 } |
1503 | 1505 |
1504 } // namespace blink | 1506 } // namespace blink |
OLD | NEW |