Chromium Code Reviews| 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 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 962 { | 962 { |
| 963 // These checks are from DOM Core Level 2, createElementNS | 963 // These checks are from DOM Core Level 2, createElementNS |
| 964 // http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-DocCrElNS | 964 // http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-DocCrElNS |
| 965 if (!qName.prefix().isEmpty() && qName.namespaceURI().isNull()) // createEle mentNS(null, "html:div") | 965 if (!qName.prefix().isEmpty() && qName.namespaceURI().isNull()) // createEle mentNS(null, "html:div") |
| 966 return false; | 966 return false; |
| 967 if (qName.prefix() == xmlAtom && qName.namespaceURI() != XMLNames::xmlNamesp aceURI) // createElementNS("http://www.example.com", "xml:lang") | 967 if (qName.prefix() == xmlAtom && qName.namespaceURI() != XMLNames::xmlNamesp aceURI) // createElementNS("http://www.example.com", "xml:lang") |
| 968 return false; | 968 return false; |
| 969 | 969 |
| 970 // Required by DOM Level 3 Core and unspecified by DOM Level 2 Core: | 970 // Required by DOM Level 3 Core and unspecified by DOM Level 2 Core: |
| 971 // http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-DocC rElNS | 971 // http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-DocC rElNS |
| 972 // createElementNS("http://www.w3.org/2000/xmlns/", "foo:bar"), createElemen tNS(null, "xmlns:bar") | 972 // createElementNS("http://www.w3.org/2000/xmlns/", "foo:bar"), createElemen tNS(null, "xmlns:bar"), createElementNS(null, "xmlns") |
| 973 if ((qName.prefix() == xmlnsAtom && qName.namespaceURI() != XMLNSNames::xmln sNamespaceURI) || (qName.prefix() != xmlnsAtom && qName.namespaceURI() == XMLNSN ames::xmlnsNamespaceURI)) | 973 if (qName.prefix() == xmlnsAtom || (qName.prefix().isEmpty() && qName.localN ame() == xmlnsAtom)) |
| 974 return qName.namespaceURI() == XMLNSNames::xmlnsNamespaceURI; | |
| 975 if (qName.namespaceURI() == XMLNSNames::xmlnsNamespaceURI) | |
| 974 return false; | 976 return false; |
| 975 | 977 |
| 976 return true; | 978 return true; |
|
abarth-chromium
2014/01/04 17:53:34
Can you change these last three lines to read:
re
pwnall-personal
2014/01/04 19:31:37
Done.
| |
| 977 } | 979 } |
| 978 | 980 |
| 979 bool Document::hasValidNamespaceForAttributes(const QualifiedName& qName) | 981 bool Document::hasValidNamespaceForAttributes(const QualifiedName& qName) |
| 980 { | 982 { |
| 981 // Spec: DOM Level 2 Core: http://www.w3.org/TR/DOM-Level-2-Core/core.html#I D-ElSetAttrNS | |
| 982 if (qName.prefix().isEmpty() && qName.localName() == xmlnsAtom) { | |
| 983 // Note: The case of an "xmlns" qualified name with a namespace of | |
| 984 // xmlnsNamespaceURI is specifically allowed (See <http://www.w3.org/200 0/xmlns/>). | |
| 985 return qName.namespaceURI() == XMLNSNames::xmlnsNamespaceURI; | |
| 986 } | |
| 987 return hasValidNamespaceForElements(qName); | 983 return hasValidNamespaceForElements(qName); |
| 988 } | 984 } |
| 989 | 985 |
| 990 // FIXME: This should really be in a possible ElementFactory class | 986 // FIXME: This should really be in a possible ElementFactory class |
| 991 PassRefPtr<Element> Document::createElement(const QualifiedName& qName, bool cre atedByParser) | 987 PassRefPtr<Element> Document::createElement(const QualifiedName& qName, bool cre atedByParser) |
| 992 { | 988 { |
| 993 RefPtr<Element> e; | 989 RefPtr<Element> e; |
| 994 | 990 |
| 995 // FIXME: Use registered namespaces and look up in a hash to find the right factory. | 991 // FIXME: Use registered namespaces and look up in a hash to find the right factory. |
| 996 if (qName.namespaceURI() == xhtmlNamespaceURI) | 992 if (qName.namespaceURI() == xhtmlNamespaceURI) |
| (...skipping 4275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5272 } | 5268 } |
| 5273 | 5269 |
| 5274 FastTextAutosizer* Document::fastTextAutosizer() | 5270 FastTextAutosizer* Document::fastTextAutosizer() |
| 5275 { | 5271 { |
| 5276 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d()) | 5272 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d()) |
| 5277 m_fastTextAutosizer = FastTextAutosizer::create(this); | 5273 m_fastTextAutosizer = FastTextAutosizer::create(this); |
| 5278 return m_fastTextAutosizer.get(); | 5274 return m_fastTextAutosizer.get(); |
| 5279 } | 5275 } |
| 5280 | 5276 |
| 5281 } // namespace WebCore | 5277 } // namespace WebCore |
| OLD | NEW |