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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 // Mutation events (bug 22634) from the text node insertion may have rem
oved the refChild | 353 // Mutation events (bug 22634) from the text node insertion may have rem
oved the refChild |
354 if (!refChild->inDocument()) | 354 if (!refChild->inDocument()) |
355 return; | 355 return; |
356 insertNodeBefore(insertChild, refChild); | 356 insertNodeBefore(insertChild, refChild); |
357 } else | 357 } else |
358 insertNodeAfter(insertChild, refChild); | 358 insertNodeAfter(insertChild, refChild); |
359 } | 359 } |
360 | 360 |
361 void CompositeEditCommand::appendNode(PassRefPtrWillBeRawPtr<Node> node, PassRef
PtrWillBeRawPtr<ContainerNode> parent) | 361 void CompositeEditCommand::appendNode(PassRefPtrWillBeRawPtr<Node> node, PassRef
PtrWillBeRawPtr<ContainerNode> parent) |
362 { | 362 { |
363 ASSERT(canHaveChildrenForEditing(parent.get())); | 363 // When cloneParagraphUnderNewElement() clones the fallback content |
| 364 // of an OBJECT element, the ASSERT below may fire since the return |
| 365 // value of canHaveChildrenForEditing is not reliable until the render |
| 366 // object of the OBJECT is created. Hence we ignore this check for OBJECTs. |
| 367 ASSERT(canHaveChildrenForEditing(parent.get()) |
| 368 || (parent->isElementNode() && toElement(parent.get())->tagQName() == ob
jectTag)); |
364 applyCommandToComposite(AppendNodeCommand::create(parent, node)); | 369 applyCommandToComposite(AppendNodeCommand::create(parent, node)); |
365 } | 370 } |
366 | 371 |
367 void CompositeEditCommand::removeChildrenInRange(PassRefPtrWillBeRawPtr<Node> no
de, unsigned from, unsigned to) | 372 void CompositeEditCommand::removeChildrenInRange(PassRefPtrWillBeRawPtr<Node> no
de, unsigned from, unsigned to) |
368 { | 373 { |
369 WillBeHeapVector<RefPtrWillBeMember<Node>> children; | 374 WillBeHeapVector<RefPtrWillBeMember<Node>> children; |
370 Node* child = NodeTraversal::childAt(*node, from); | 375 Node* child = NodeTraversal::childAt(*node, from); |
371 for (unsigned i = from; child && i < to; i++, child = child->nextSibling()) | 376 for (unsigned i = from; child && i < to; i++, child = child->nextSibling()) |
372 children.append(child); | 377 children.append(child); |
373 | 378 |
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 } | 1498 } |
1494 | 1499 |
1495 void CompositeEditCommand::trace(Visitor* visitor) | 1500 void CompositeEditCommand::trace(Visitor* visitor) |
1496 { | 1501 { |
1497 visitor->trace(m_commands); | 1502 visitor->trace(m_commands); |
1498 visitor->trace(m_composition); | 1503 visitor->trace(m_composition); |
1499 EditCommand::trace(visitor); | 1504 EditCommand::trace(visitor); |
1500 } | 1505 } |
1501 | 1506 |
1502 } // namespace blink | 1507 } // namespace blink |
OLD | NEW |