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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 } | 747 } |
748 | 748 |
749 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS
tring& name, ExceptionState& exceptionState) | 749 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS
tring& name, ExceptionState& exceptionState) |
750 { | 750 { |
751 return registerElement(state, name, Dictionary(), exceptionState); | 751 return registerElement(state, name, Dictionary(), exceptionState); |
752 } | 752 } |
753 | 753 |
754 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS
tring& name, const Dictionary& options, ExceptionState& exceptionState, CustomEl
ement::NameSet validNames) | 754 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS
tring& name, const Dictionary& options, ExceptionState& exceptionState, CustomEl
ement::NameSet validNames) |
755 { | 755 { |
756 if (!registrationContext()) { | 756 if (!registrationContext()) { |
757 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); | 757 exceptionState.throwDOMException(NotSupportedError, "No element registra
tion context is available."); |
758 return ScriptValue(); | 758 return ScriptValue(); |
759 } | 759 } |
760 | 760 |
761 CustomElementConstructorBuilder constructorBuilder(state, &options); | 761 CustomElementConstructorBuilder constructorBuilder(state, &options); |
762 registrationContext()->registerElement(this, &constructorBuilder, name, vali
dNames, exceptionState); | 762 registrationContext()->registerElement(this, &constructorBuilder, name, vali
dNames, exceptionState); |
763 return constructorBuilder.bindingsReturnValue(); | 763 return constructorBuilder.bindingsReturnValue(); |
764 } | 764 } |
765 | 765 |
766 void Document::setImport(HTMLImport* import) | 766 void Document::setImport(HTMLImport* import) |
767 { | 767 { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 } | 821 } |
822 | 822 |
823 PassRefPtr<Text> Document::createEditingTextNode(const String& text) | 823 PassRefPtr<Text> Document::createEditingTextNode(const String& text) |
824 { | 824 { |
825 return Text::createEditingText(*this, text); | 825 return Text::createEditingText(*this, text); |
826 } | 826 } |
827 | 827 |
828 PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionSt
ate& exceptionState) | 828 PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionSt
ate& exceptionState) |
829 { | 829 { |
830 if (!importedNode) { | 830 if (!importedNode) { |
831 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); | 831 exceptionState.throwDOMException(NotSupportedError, "The node provided i
s invalid."); |
832 return 0; | 832 return 0; |
833 } | 833 } |
834 | 834 |
835 switch (importedNode->nodeType()) { | 835 switch (importedNode->nodeType()) { |
836 case TEXT_NODE: | 836 case TEXT_NODE: |
837 return createTextNode(importedNode->nodeValue()); | 837 return createTextNode(importedNode->nodeValue()); |
838 case CDATA_SECTION_NODE: | 838 case CDATA_SECTION_NODE: |
839 return createCDATASection(importedNode->nodeValue(), exceptionState); | 839 return createCDATASection(importedNode->nodeValue(), exceptionState); |
840 case PROCESSING_INSTRUCTION_NODE: | 840 case PROCESSING_INSTRUCTION_NODE: |
841 return createProcessingInstruction(importedNode->nodeName(), importedNod
e->nodeValue(), exceptionState); | 841 return createProcessingInstruction(importedNode->nodeName(), importedNod
e->nodeValue(), exceptionState); |
842 case COMMENT_NODE: | 842 case COMMENT_NODE: |
843 return createComment(importedNode->nodeValue()); | 843 return createComment(importedNode->nodeValue()); |
844 case DOCUMENT_TYPE_NODE: { | 844 case DOCUMENT_TYPE_NODE: { |
845 DocumentType* doctype = toDocumentType(importedNode); | 845 DocumentType* doctype = toDocumentType(importedNode); |
846 return DocumentType::create(this, doctype->name(), doctype->publicId(),
doctype->systemId()); | 846 return DocumentType::create(this, doctype->name(), doctype->publicId(),
doctype->systemId()); |
847 } | 847 } |
848 case ELEMENT_NODE: { | 848 case ELEMENT_NODE: { |
849 Element* oldElement = toElement(importedNode); | 849 Element* oldElement = toElement(importedNode); |
850 // FIXME: The following check might be unnecessary. Is it possible that | 850 // FIXME: The following check might be unnecessary. Is it possible that |
851 // oldElement has mismatched prefix/namespace? | 851 // oldElement has mismatched prefix/namespace? |
852 if (!hasValidNamespaceForElements(oldElement->tagQName())) { | 852 if (!hasValidNamespaceForElements(oldElement->tagQName())) { |
853 exceptionState.throwUninformativeAndGenericDOMException(NamespaceErr
or); | 853 exceptionState.throwDOMException(NamespaceError, "The imported node
has an invalid namespace."); |
854 return 0; | 854 return 0; |
855 } | 855 } |
856 RefPtr<Element> newElement = createElement(oldElement->tagQName(), false
); | 856 RefPtr<Element> newElement = createElement(oldElement->tagQName(), false
); |
857 | 857 |
858 newElement->cloneDataFromElement(*oldElement); | 858 newElement->cloneDataFromElement(*oldElement); |
859 | 859 |
860 if (deep) { | 860 if (deep) { |
861 for (Node* oldChild = oldElement->firstChild(); oldChild; oldChild =
oldChild->nextSibling()) { | 861 for (Node* oldChild = oldElement->firstChild(); oldChild; oldChild =
oldChild->nextSibling()) { |
862 RefPtr<Node> newChild = importNode(oldChild, true, exceptionStat
e); | 862 RefPtr<Node> newChild = importNode(oldChild, true, exceptionStat
e); |
863 if (exceptionState.hadException()) | 863 if (exceptionState.hadException()) |
(...skipping 30 matching lines...) Expand all Loading... |
894 return newFragment.release(); | 894 return newFragment.release(); |
895 } | 895 } |
896 case ENTITY_NODE: | 896 case ENTITY_NODE: |
897 case NOTATION_NODE: | 897 case NOTATION_NODE: |
898 // FIXME: It should be possible to import these node types, however in D
OM3 the DocumentType is readonly, so there isn't much sense in doing that. | 898 // FIXME: It should be possible to import these node types, however in D
OM3 the DocumentType is readonly, so there isn't much sense in doing that. |
899 // Ability to add these imported nodes to a DocumentType will be conside
red for addition to a future release of the DOM. | 899 // Ability to add these imported nodes to a DocumentType will be conside
red for addition to a future release of the DOM. |
900 case DOCUMENT_NODE: | 900 case DOCUMENT_NODE: |
901 case XPATH_NAMESPACE_NODE: | 901 case XPATH_NAMESPACE_NODE: |
902 break; | 902 break; |
903 } | 903 } |
904 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); | 904 Element* el = toElement(importedNode); |
| 905 exceptionState.throwDOMException(NotSupportedError, "The node to import is o
f type '" + el->tagName() + "', which may not be imported."); |
905 return 0; | 906 return 0; |
906 } | 907 } |
907 | 908 |
908 PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionState& ex
ceptionState) | 909 PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionState& ex
ceptionState) |
909 { | 910 { |
910 if (!source) { | 911 if (!source) { |
911 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); | 912 exceptionState.throwDOMException(NotSupportedError, "The node provided i
s invalid."); |
912 return 0; | 913 return 0; |
913 } | 914 } |
914 | 915 |
915 EventQueueScope scope; | 916 EventQueueScope scope; |
916 | 917 |
917 switch (source->nodeType()) { | 918 switch (source->nodeType()) { |
918 case ENTITY_NODE: | 919 case ENTITY_NODE: |
919 case NOTATION_NODE: | 920 case NOTATION_NODE: |
920 case DOCUMENT_NODE: | 921 case DOCUMENT_NODE: |
921 case DOCUMENT_TYPE_NODE: | 922 case DOCUMENT_TYPE_NODE: |
922 case XPATH_NAMESPACE_NODE: | 923 case XPATH_NAMESPACE_NODE: |
923 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); | 924 exceptionState.throwDOMException(NotSupportedError, "The node provided i
s of type '" + source->nodeName() + "', which may not be adopted."); |
924 return 0; | 925 return 0; |
925 case ATTRIBUTE_NODE: { | 926 case ATTRIBUTE_NODE: { |
926 Attr* attr = toAttr(source.get()); | 927 Attr* attr = toAttr(source.get()); |
927 if (attr->ownerElement()) | 928 if (attr->ownerElement()) |
928 attr->ownerElement()->removeAttributeNode(attr, exceptionState); | 929 attr->ownerElement()->removeAttributeNode(attr, exceptionState); |
929 break; | 930 break; |
930 } | 931 } |
931 default: | 932 default: |
932 if (source->isShadowRoot()) { | 933 if (source->isShadowRoot()) { |
933 // ShadowRoot cannot disconnect itself from the host node. | 934 // ShadowRoot cannot disconnect itself from the host node. |
934 exceptionState.throwUninformativeAndGenericDOMException(HierarchyReq
uestError); | 935 exceptionState.throwDOMException(HierarchyRequestError, "The node pr
ovided is a shadow root, which may not be adopted."); |
935 return 0; | 936 return 0; |
936 } | 937 } |
937 | 938 |
938 if (source->isFrameOwnerElement()) { | 939 if (source->isFrameOwnerElement()) { |
939 HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(s
ource.get()); | 940 HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(s
ource.get()); |
940 if (frame() && frame()->tree().isDescendantOf(frameOwnerElement->con
tentFrame())) { | 941 if (frame() && frame()->tree().isDescendantOf(frameOwnerElement->con
tentFrame())) { |
941 exceptionState.throwUninformativeAndGenericDOMException(Hierarch
yRequestError); | 942 exceptionState.throwDOMException(HierarchyRequestError, "The nod
e provided is a frame which contains this document."); |
942 return 0; | 943 return 0; |
943 } | 944 } |
944 } | 945 } |
945 if (source->parentNode()) { | 946 if (source->parentNode()) { |
946 source->parentNode()->removeChild(source.get(), exceptionState); | 947 source->parentNode()->removeChild(source.get(), exceptionState); |
947 if (exceptionState.hadException()) | 948 if (exceptionState.hadException()) |
948 return 0; | 949 return 0; |
949 } | 950 } |
950 } | 951 } |
951 | 952 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 } | 1025 } |
1025 | 1026 |
1026 PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI,
const AtomicString& qualifiedName, ExceptionState& exceptionState) | 1027 PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI,
const AtomicString& qualifiedName, ExceptionState& exceptionState) |
1027 { | 1028 { |
1028 AtomicString prefix, localName; | 1029 AtomicString prefix, localName; |
1029 if (!parseQualifiedName(qualifiedName, prefix, localName, exceptionState)) | 1030 if (!parseQualifiedName(qualifiedName, prefix, localName, exceptionState)) |
1030 return 0; | 1031 return 0; |
1031 | 1032 |
1032 QualifiedName qName(prefix, localName, namespaceURI); | 1033 QualifiedName qName(prefix, localName, namespaceURI); |
1033 if (!hasValidNamespaceForElements(qName)) { | 1034 if (!hasValidNamespaceForElements(qName)) { |
1034 exceptionState.throwUninformativeAndGenericDOMException(NamespaceError); | |
1035 exceptionState.throwDOMException(NamespaceError, "The namespace URI prov
ided ('" + namespaceURI + "') is not valid for the qualified name provided ('" +
qualifiedName + "')."); | 1035 exceptionState.throwDOMException(NamespaceError, "The namespace URI prov
ided ('" + namespaceURI + "') is not valid for the qualified name provided ('" +
qualifiedName + "')."); |
| 1036 return 0; |
1036 } | 1037 } |
1037 | 1038 |
1038 return createElement(qName, false); | 1039 return createElement(qName, false); |
1039 } | 1040 } |
1040 | 1041 |
1041 String Document::readyState() const | 1042 String Document::readyState() const |
1042 { | 1043 { |
1043 DEFINE_STATIC_LOCAL(const String, loading, ("loading")); | 1044 DEFINE_STATIC_LOCAL(const String, loading, ("loading")); |
1044 DEFINE_STATIC_LOCAL(const String, interactive, ("interactive")); | 1045 DEFINE_STATIC_LOCAL(const String, interactive, ("interactive")); |
1045 DEFINE_STATIC_LOCAL(const String, complete, ("complete")); | 1046 DEFINE_STATIC_LOCAL(const String, complete, ("complete")); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 return; | 1124 return; |
1124 m_contentLanguage = language; | 1125 m_contentLanguage = language; |
1125 | 1126 |
1126 // Document's style depends on the content language. | 1127 // Document's style depends on the content language. |
1127 setNeedsStyleRecalc(); | 1128 setNeedsStyleRecalc(); |
1128 } | 1129 } |
1129 | 1130 |
1130 void Document::setXMLVersion(const String& version, ExceptionState& exceptionSta
te) | 1131 void Document::setXMLVersion(const String& version, ExceptionState& exceptionSta
te) |
1131 { | 1132 { |
1132 if (!implementation()->hasFeature("XML", String())) { | 1133 if (!implementation()->hasFeature("XML", String())) { |
1133 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); | 1134 exceptionState.throwDOMException(NotSupportedError, "This document does
not support XML."); |
1134 return; | 1135 return; |
1135 } | 1136 } |
1136 | 1137 |
1137 if (!XMLDocumentParser::supportsXMLVersion(version)) { | 1138 if (!XMLDocumentParser::supportsXMLVersion(version)) { |
1138 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); | 1139 exceptionState.throwDOMException(NotSupportedError, "This document does
not support the XML version '" + version + "'."); |
1139 return; | 1140 return; |
1140 } | 1141 } |
1141 | 1142 |
1142 m_xmlVersion = version; | 1143 m_xmlVersion = version; |
1143 } | 1144 } |
1144 | 1145 |
1145 void Document::setXMLStandalone(bool standalone, ExceptionState& exceptionState) | 1146 void Document::setXMLStandalone(bool standalone, ExceptionState& exceptionState) |
1146 { | 1147 { |
1147 if (!implementation()->hasFeature("XML", String())) { | 1148 if (!implementation()->hasFeature("XML", String())) { |
1148 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); | 1149 exceptionState.throwDOMException(NotSupportedError, "This document does
not support XML."); |
1149 return; | 1150 return; |
1150 } | 1151 } |
1151 | 1152 |
1152 m_xmlStandalone = standalone ? Standalone : NotStandalone; | 1153 m_xmlStandalone = standalone ? Standalone : NotStandalone; |
1153 } | 1154 } |
1154 | 1155 |
1155 KURL Document::baseURI() const | 1156 KURL Document::baseURI() const |
1156 { | 1157 { |
1157 return baseURL(); | 1158 return baseURL(); |
1158 } | 1159 } |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1440 | 1441 |
1441 PassRefPtr<Range> Document::createRange() | 1442 PassRefPtr<Range> Document::createRange() |
1442 { | 1443 { |
1443 return Range::create(*this); | 1444 return Range::create(*this); |
1444 } | 1445 } |
1445 | 1446 |
1446 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, ExceptionState
& exceptionState) | 1447 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, ExceptionState
& exceptionState) |
1447 { | 1448 { |
1448 // FIXME: Probably this should be handled within the bindings layer and Type
Error should be thrown. | 1449 // FIXME: Probably this should be handled within the bindings layer and Type
Error should be thrown. |
1449 if (!root) { | 1450 if (!root) { |
1450 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); | 1451 exceptionState.throwDOMException(NotSupportedError, "The provided node i
s invalid."); |
1451 return 0; | 1452 return 0; |
1452 } | 1453 } |
1453 return NodeIterator::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilte
r>()); | 1454 return NodeIterator::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilte
r>()); |
1454 } | 1455 } |
1455 | 1456 |
1456 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatT
oShow, ExceptionState& exceptionState) | 1457 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatT
oShow, ExceptionState& exceptionState) |
1457 { | 1458 { |
1458 if (!root) { | 1459 if (!root) { |
1459 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); | 1460 exceptionState.throwDOMException(NotSupportedError, "The provided node i
s invalid."); |
1460 return 0; | 1461 return 0; |
1461 } | 1462 } |
1462 // FIXME: It might be a good idea to emit a warning if |whatToShow| contains
a bit that is not defined in | 1463 // FIXME: It might be a good idea to emit a warning if |whatToShow| contains
a bit that is not defined in |
1463 // NodeFilter. | 1464 // NodeFilter. |
1464 return NodeIterator::create(root, whatToShow, PassRefPtr<NodeFilter>()); | 1465 return NodeIterator::create(root, whatToShow, PassRefPtr<NodeFilter>()); |
1465 } | 1466 } |
1466 | 1467 |
1467 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatT
oShow, PassRefPtr<NodeFilter> filter, ExceptionState& exceptionState) | 1468 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatT
oShow, PassRefPtr<NodeFilter> filter, ExceptionState& exceptionState) |
1468 { | 1469 { |
1469 if (!root) { | 1470 if (!root) { |
1470 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); | 1471 exceptionState.throwDOMException(NotSupportedError, "The provided node i
s invalid."); |
1471 return 0; | 1472 return 0; |
1472 } | 1473 } |
1473 // FIXME: Ditto. | 1474 // FIXME: Ditto. |
1474 return NodeIterator::create(root, whatToShow, filter); | 1475 return NodeIterator::create(root, whatToShow, filter); |
1475 } | 1476 } |
1476 | 1477 |
1477 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, ExceptionState& ex
ceptionState) | 1478 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, ExceptionState& ex
ceptionState) |
1478 { | 1479 { |
1479 if (!root) { | 1480 if (!root) { |
1480 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); | 1481 exceptionState.throwDOMException(NotSupportedError, "The provided node i
s invalid."); |
1481 return 0; | 1482 return 0; |
1482 } | 1483 } |
1483 return TreeWalker::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilter>
()); | 1484 return TreeWalker::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilter>
()); |
1484 } | 1485 } |
1485 | 1486 |
1486 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho
w, ExceptionState& exceptionState) | 1487 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho
w, ExceptionState& exceptionState) |
1487 { | 1488 { |
1488 if (!root) { | 1489 if (!root) { |
1489 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); | 1490 exceptionState.throwDOMException(NotSupportedError, "The provided node i
s invalid."); |
1490 return 0; | 1491 return 0; |
1491 } | 1492 } |
1492 return TreeWalker::create(root, whatToShow, PassRefPtr<NodeFilter>()); | 1493 return TreeWalker::create(root, whatToShow, PassRefPtr<NodeFilter>()); |
1493 } | 1494 } |
1494 | 1495 |
1495 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho
w, PassRefPtr<NodeFilter> filter, ExceptionState& exceptionState) | 1496 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho
w, PassRefPtr<NodeFilter> filter, ExceptionState& exceptionState) |
1496 { | 1497 { |
1497 if (!root) { | 1498 if (!root) { |
1498 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); | 1499 exceptionState.throwDOMException(NotSupportedError, "The provided node i
s invalid."); |
1499 return 0; | 1500 return 0; |
1500 } | 1501 } |
1501 return TreeWalker::create(root, whatToShow, filter); | 1502 return TreeWalker::create(root, whatToShow, filter); |
1502 } | 1503 } |
1503 | 1504 |
1504 void Document::scheduleStyleRecalc() | 1505 void Document::scheduleStyleRecalc() |
1505 { | 1506 { |
1506 if (shouldDisplaySeamlesslyWithParent()) { | 1507 if (shouldDisplaySeamlesslyWithParent()) { |
1507 // When we're seamless, our parent document manages our style recalcs. | 1508 // When we're seamless, our parent document manages our style recalcs. |
1508 ownerElement()->setNeedsStyleRecalc(); | 1509 ownerElement()->setNeedsStyleRecalc(); |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2227 return toHTMLElement(child); | 2228 return toHTMLElement(child); |
2228 } | 2229 } |
2229 | 2230 |
2230 return 0; | 2231 return 0; |
2231 } | 2232 } |
2232 | 2233 |
2233 void Document::setBody(PassRefPtr<HTMLElement> prpNewBody, ExceptionState& excep
tionState) | 2234 void Document::setBody(PassRefPtr<HTMLElement> prpNewBody, ExceptionState& excep
tionState) |
2234 { | 2235 { |
2235 RefPtr<HTMLElement> newBody = prpNewBody; | 2236 RefPtr<HTMLElement> newBody = prpNewBody; |
2236 | 2237 |
2237 if (!newBody || !documentElement()) { | 2238 if (!newBody) { |
2238 exceptionState.throwUninformativeAndGenericDOMException(HierarchyRequest
Error); | 2239 exceptionState.throwDOMException(HierarchyRequestError, "The node provid
ed is invalid."); |
| 2240 return; |
| 2241 } |
| 2242 if (!documentElement()) { |
| 2243 exceptionState.throwDOMException(HierarchyRequestError, "No document ele
ment exists."); |
2239 return; | 2244 return; |
2240 } | 2245 } |
2241 | 2246 |
2242 if (!newBody->hasTagName(bodyTag) && !newBody->hasTagName(framesetTag)) { | 2247 if (!newBody->hasTagName(bodyTag) && !newBody->hasTagName(framesetTag)) { |
2243 exceptionState.throwUninformativeAndGenericDOMException(HierarchyRequest
Error); | 2248 exceptionState.throwDOMException(HierarchyRequestError, "The new body el
ement is of type '" + newBody->tagName() + "'. It must be either a 'BODY' or 'FR
AMESET' element."); |
2244 return; | 2249 return; |
2245 } | 2250 } |
2246 | 2251 |
2247 HTMLElement* oldBody = body(); | 2252 HTMLElement* oldBody = body(); |
2248 if (oldBody == newBody) | 2253 if (oldBody == newBody) |
2249 return; | 2254 return; |
2250 | 2255 |
2251 if (oldBody) | 2256 if (oldBody) |
2252 documentElement()->replaceChild(newBody.release(), oldBody, exceptionSta
te); | 2257 documentElement()->replaceChild(newBody.release(), oldBody, exceptionSta
te); |
2253 else | 2258 else |
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3652 event->setTarget(domWindow()); | 3657 event->setTarget(domWindow()); |
3653 ensureScriptedAnimationController().enqueuePerFrameEvent(event.release()); | 3658 ensureScriptedAnimationController().enqueuePerFrameEvent(event.release()); |
3654 } | 3659 } |
3655 | 3660 |
3656 PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionState&
exceptionState) | 3661 PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionState&
exceptionState) |
3657 { | 3662 { |
3658 RefPtr<Event> event = EventFactory::create(eventType); | 3663 RefPtr<Event> event = EventFactory::create(eventType); |
3659 if (event) | 3664 if (event) |
3660 return event.release(); | 3665 return event.release(); |
3661 | 3666 |
3662 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); | 3667 exceptionState.throwDOMException(NotSupportedError, "The provided event type
('" + eventType + "') is invalid."); |
3663 return 0; | 3668 return 0; |
3664 } | 3669 } |
3665 | 3670 |
3666 void Document::addMutationEventListenerTypeIfEnabled(ListenerType listenerType) | 3671 void Document::addMutationEventListenerTypeIfEnabled(ListenerType listenerType) |
3667 { | 3672 { |
3668 if (ContextFeatures::mutationEventsEnabled(this)) | 3673 if (ContextFeatures::mutationEventsEnabled(this)) |
3669 addListenerType(listenerType); | 3674 addListenerType(listenerType); |
3670 } | 3675 } |
3671 | 3676 |
3672 void Document::addListenerTypeIfNeeded(const AtomicString& eventType) | 3677 void Document::addListenerTypeIfNeeded(const AtomicString& eventType) |
(...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5264 } | 5269 } |
5265 | 5270 |
5266 FastTextAutosizer* Document::fastTextAutosizer() | 5271 FastTextAutosizer* Document::fastTextAutosizer() |
5267 { | 5272 { |
5268 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable
d()) | 5273 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable
d()) |
5269 m_fastTextAutosizer = FastTextAutosizer::create(this); | 5274 m_fastTextAutosizer = FastTextAutosizer::create(this); |
5270 return m_fastTextAutosizer.get(); | 5275 return m_fastTextAutosizer.get(); |
5271 } | 5276 } |
5272 | 5277 |
5273 } // namespace WebCore | 5278 } // namespace WebCore |
OLD | NEW |