| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
| 3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. |
| 4 * Copyright (C) 2011 Igalia S.L. | 4 * Copyright (C) 2011 Igalia S.L. |
| 5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 { | 522 { |
| 523 if (!range) | 523 if (!range) |
| 524 return emptyString(); | 524 return emptyString(); |
| 525 | 525 |
| 526 Document& document = range->ownerDocument(); | 526 Document& document = range->ownerDocument(); |
| 527 const Range* updatedRange = range; | 527 const Range* updatedRange = range; |
| 528 | 528 |
| 529 return createMarkupInternal(document, range, updatedRange, nodes, shouldAnno
tate, convertBlocksToInlines, shouldResolveURLs, constrainingAncestor); | 529 return createMarkupInternal(document, range, updatedRange, nodes, shouldAnno
tate, convertBlocksToInlines, shouldResolveURLs, constrainingAncestor); |
| 530 } | 530 } |
| 531 | 531 |
| 532 PassRefPtrWillBeRawPtr<DocumentFragment> createFragmentFromMarkup(Document& docu
ment, const String& markup) | |
| 533 { | |
| 534 RefPtrWillBeRawPtr<DocumentFragment> fragment = DocumentFragment::create(doc
ument); | |
| 535 fragment->parseHTML(markup, nullptr); | |
| 536 return fragment.release(); | |
| 537 } | |
| 538 | |
| 539 String createMarkup(const Node* node, EChildrenOnly childrenOnly, WillBeHeapVect
or<RawPtrWillBeMember<Node> >* nodes, EAbsoluteURLs shouldResolveURLs, Vector<Qu
alifiedName>* tagNamesToSkip) | 532 String createMarkup(const Node* node, EChildrenOnly childrenOnly, WillBeHeapVect
or<RawPtrWillBeMember<Node> >* nodes, EAbsoluteURLs shouldResolveURLs, Vector<Qu
alifiedName>* tagNamesToSkip) |
| 540 { | 533 { |
| 541 if (!node) | 534 if (!node) |
| 542 return ""; | 535 return ""; |
| 543 | 536 |
| 544 MarkupAccumulator accumulator(nodes, shouldResolveURLs); | 537 MarkupAccumulator accumulator(nodes, shouldResolveURLs); |
| 545 return accumulator.serializeNodes(const_cast<Node&>(*node), childrenOnly, ta
gNamesToSkip); | 538 return accumulator.serializeNodes(const_cast<Node&>(*node), childrenOnly, ta
gNamesToSkip); |
| 546 } | 539 } |
| 547 | 540 |
| 548 PassRefPtrWillBeRawPtr<DocumentFragment> createFragmentForInnerOuterHTML(const S
tring& markup, Element* contextElement, const char* method, ExceptionState& exce
ptionState) | |
| 549 { | |
| 550 ASSERT(contextElement); | |
| 551 Document& document = isHTMLTemplateElement(*contextElement) ? contextElement
->document().ensureTemplateDocument() : contextElement->document(); | |
| 552 RefPtrWillBeRawPtr<DocumentFragment> fragment = DocumentFragment::create(doc
ument); | |
| 553 fragment->parseHTML(markup, contextElement); | |
| 554 return fragment; | |
| 555 } | |
| 556 | |
| 557 void replaceChildrenWithFragment(ContainerNode* container, PassRefPtrWillBeRawPt
r<DocumentFragment> fragment, ExceptionState& exceptionState) | 541 void replaceChildrenWithFragment(ContainerNode* container, PassRefPtrWillBeRawPt
r<DocumentFragment> fragment, ExceptionState& exceptionState) |
| 558 { | 542 { |
| 559 ASSERT(container); | 543 ASSERT(container); |
| 560 RefPtrWillBeRawPtr<ContainerNode> containerNode(container); | 544 RefPtrWillBeRawPtr<ContainerNode> containerNode(container); |
| 561 | 545 |
| 562 ChildListMutationScope mutation(*containerNode); | 546 ChildListMutationScope mutation(*containerNode); |
| 563 | 547 |
| 564 if (!fragment->firstChild()) { | 548 if (!fragment->firstChild()) { |
| 565 containerNode->removeChildren(); | 549 containerNode->removeChildren(); |
| 566 return; | 550 return; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 589 if (!next || !next->isTextNode()) | 573 if (!next || !next->isTextNode()) |
| 590 return; | 574 return; |
| 591 | 575 |
| 592 RefPtrWillBeRawPtr<Text> textNext = toText(next); | 576 RefPtrWillBeRawPtr<Text> textNext = toText(next); |
| 593 textNode->appendData(textNext->data()); | 577 textNode->appendData(textNext->data()); |
| 594 if (textNext->parentNode()) // Might have been removed by mutation event. | 578 if (textNext->parentNode()) // Might have been removed by mutation event. |
| 595 textNext->remove(exceptionState); | 579 textNext->remove(exceptionState); |
| 596 } | 580 } |
| 597 | 581 |
| 598 } | 582 } |
| OLD | NEW |