| 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, ParserContentPolicy parserContentPolicy) | 532 PassRefPtrWillBeRawPtr<DocumentFragment> createFragmentFromMarkup(Document& docu
ment, const String& markup) |
| 533 { | 533 { |
| 534 RefPtrWillBeRawPtr<DocumentFragment> fragment = DocumentFragment::create(doc
ument); | 534 RefPtrWillBeRawPtr<DocumentFragment> fragment = DocumentFragment::create(doc
ument); |
| 535 fragment->parseHTML(markup, nullptr, parserContentPolicy); | 535 fragment->parseHTML(markup, nullptr); |
| 536 return fragment.release(); | 536 return fragment.release(); |
| 537 } | 537 } |
| 538 | 538 |
| 539 String createMarkup(const Node* node, EChildrenOnly childrenOnly, WillBeHeapVect
or<RawPtrWillBeMember<Node> >* nodes, EAbsoluteURLs shouldResolveURLs, Vector<Qu
alifiedName>* tagNamesToSkip) | 539 String createMarkup(const Node* node, EChildrenOnly childrenOnly, WillBeHeapVect
or<RawPtrWillBeMember<Node> >* nodes, EAbsoluteURLs shouldResolveURLs, Vector<Qu
alifiedName>* tagNamesToSkip) |
| 540 { | 540 { |
| 541 if (!node) | 541 if (!node) |
| 542 return ""; | 542 return ""; |
| 543 | 543 |
| 544 MarkupAccumulator accumulator(nodes, shouldResolveURLs); | 544 MarkupAccumulator accumulator(nodes, shouldResolveURLs); |
| 545 return accumulator.serializeNodes(const_cast<Node&>(*node), childrenOnly, ta
gNamesToSkip); | 545 return accumulator.serializeNodes(const_cast<Node&>(*node), childrenOnly, ta
gNamesToSkip); |
| 546 } | 546 } |
| 547 | 547 |
| 548 PassRefPtrWillBeRawPtr<DocumentFragment> createFragmentForInnerOuterHTML(const S
tring& markup, Element* contextElement, ParserContentPolicy parserContentPolicy,
const char* method, ExceptionState& exceptionState) | 548 PassRefPtrWillBeRawPtr<DocumentFragment> createFragmentForInnerOuterHTML(const S
tring& markup, Element* contextElement, const char* method, ExceptionState& exce
ptionState) |
| 549 { | 549 { |
| 550 ASSERT(contextElement); | 550 ASSERT(contextElement); |
| 551 Document& document = isHTMLTemplateElement(*contextElement) ? contextElement
->document().ensureTemplateDocument() : contextElement->document(); | 551 Document& document = isHTMLTemplateElement(*contextElement) ? contextElement
->document().ensureTemplateDocument() : contextElement->document(); |
| 552 RefPtrWillBeRawPtr<DocumentFragment> fragment = DocumentFragment::create(doc
ument); | 552 RefPtrWillBeRawPtr<DocumentFragment> fragment = DocumentFragment::create(doc
ument); |
| 553 fragment->parseHTML(markup, contextElement, parserContentPolicy); | 553 fragment->parseHTML(markup, contextElement); |
| 554 return fragment; | 554 return fragment; |
| 555 } | 555 } |
| 556 | 556 |
| 557 void replaceChildrenWithFragment(ContainerNode* container, PassRefPtrWillBeRawPt
r<DocumentFragment> fragment, ExceptionState& exceptionState) | 557 void replaceChildrenWithFragment(ContainerNode* container, PassRefPtrWillBeRawPt
r<DocumentFragment> fragment, ExceptionState& exceptionState) |
| 558 { | 558 { |
| 559 ASSERT(container); | 559 ASSERT(container); |
| 560 RefPtrWillBeRawPtr<ContainerNode> containerNode(container); | 560 RefPtrWillBeRawPtr<ContainerNode> containerNode(container); |
| 561 | 561 |
| 562 ChildListMutationScope mutation(*containerNode); | 562 ChildListMutationScope mutation(*containerNode); |
| 563 | 563 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 589 if (!next || !next->isTextNode()) | 589 if (!next || !next->isTextNode()) |
| 590 return; | 590 return; |
| 591 | 591 |
| 592 RefPtrWillBeRawPtr<Text> textNext = toText(next); | 592 RefPtrWillBeRawPtr<Text> textNext = toText(next); |
| 593 textNode->appendData(textNext->data()); | 593 textNode->appendData(textNext->data()); |
| 594 if (textNext->parentNode()) // Might have been removed by mutation event. | 594 if (textNext->parentNode()) // Might have been removed by mutation event. |
| 595 textNext->remove(exceptionState); | 595 textNext->remove(exceptionState); |
| 596 } | 596 } |
| 597 | 597 |
| 598 } | 598 } |
| OLD | NEW |