| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 if (!window) | 511 if (!window) |
| 512 return 0; | 512 return 0; |
| 513 return window->frame(); | 513 return window->frame(); |
| 514 } | 514 } |
| 515 | 515 |
| 516 PassRefPtr<DocumentFragment> Document::createDocumentFragment() | 516 PassRefPtr<DocumentFragment> Document::createDocumentFragment() |
| 517 { | 517 { |
| 518 return DocumentFragment::create(*this); | 518 return DocumentFragment::create(*this); |
| 519 } | 519 } |
| 520 | 520 |
| 521 PassRefPtr<Text> Document::createTextNode(const String& data) | |
| 522 { | |
| 523 return Text::create(*this, data); | |
| 524 } | |
| 525 | |
| 526 PassRefPtr<Text> Document::createEditingTextNode(const String& text) | 521 PassRefPtr<Text> Document::createEditingTextNode(const String& text) |
| 527 { | 522 { |
| 528 return Text::createEditingText(*this, text); | 523 return Text::createEditingText(*this, text); |
| 529 } | 524 } |
| 530 | 525 |
| 531 bool Document::importContainerNodeChildren(ContainerNode* oldContainerNode, Pass
RefPtr<ContainerNode> newContainerNode, ExceptionState& exceptionState) | 526 bool Document::importContainerNodeChildren(ContainerNode* oldContainerNode, Pass
RefPtr<ContainerNode> newContainerNode, ExceptionState& exceptionState) |
| 532 { | 527 { |
| 533 for (Node* oldChild = oldContainerNode->firstChild(); oldChild; oldChild = o
ldChild->nextSibling()) { | 528 for (Node* oldChild = oldContainerNode->firstChild(); oldChild; oldChild = o
ldChild->nextSibling()) { |
| 534 RefPtr<Node> newChild = importNode(oldChild, true, exceptionState); | 529 RefPtr<Node> newChild = importNode(oldChild, true, exceptionState); |
| 535 if (exceptionState.hadException()) | 530 if (exceptionState.hadException()) |
| 536 return false; | 531 return false; |
| 537 newContainerNode->appendChild(newChild.release(), exceptionState); | 532 newContainerNode->appendChild(newChild.release(), exceptionState); |
| 538 if (exceptionState.hadException()) | 533 if (exceptionState.hadException()) |
| 539 return false; | 534 return false; |
| 540 } | 535 } |
| 541 | 536 |
| 542 return true; | 537 return true; |
| 543 } | 538 } |
| 544 | 539 |
| 545 PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionSt
ate& exceptionState) | 540 PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionSt
ate& exceptionState) |
| 546 { | 541 { |
| 547 switch (importedNode->nodeType()) { | 542 switch (importedNode->nodeType()) { |
| 548 case TEXT_NODE: | 543 case TEXT_NODE: |
| 549 return createTextNode(toText(importedNode)->data()); | 544 return Text::create(*this, toText(importedNode)->data()); |
| 550 case ELEMENT_NODE: { | 545 case ELEMENT_NODE: { |
| 551 Element* oldElement = toElement(importedNode); | 546 Element* oldElement = toElement(importedNode); |
| 552 RefPtr<Element> newElement = createElement(oldElement->tagQName(), false
); | 547 RefPtr<Element> newElement = createElement(oldElement->tagQName(), false
); |
| 553 | 548 |
| 554 newElement->cloneDataFromElement(*oldElement); | 549 newElement->cloneDataFromElement(*oldElement); |
| 555 | 550 |
| 556 if (deep) { | 551 if (deep) { |
| 557 if (!importContainerNodeChildren(oldElement, newElement, exceptionSt
ate)) | 552 if (!importContainerNodeChildren(oldElement, newElement, exceptionSt
ate)) |
| 558 return nullptr; | 553 return nullptr; |
| 559 if (isHTMLTemplateElement(*oldElement) | 554 if (isHTMLTemplateElement(*oldElement) |
| (...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2383 using namespace blink; | 2378 using namespace blink; |
| 2384 void showLiveDocumentInstances() | 2379 void showLiveDocumentInstances() |
| 2385 { | 2380 { |
| 2386 WeakDocumentSet& set = liveDocumentSet(); | 2381 WeakDocumentSet& set = liveDocumentSet(); |
| 2387 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 2382 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 2388 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { | 2383 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { |
| 2389 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); | 2384 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); |
| 2390 } | 2385 } |
| 2391 } | 2386 } |
| 2392 #endif | 2387 #endif |
| OLD | NEW |