| 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights |
| 5 * reserved. |
| 5 * | 6 * |
| 6 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| 10 * | 11 * |
| 11 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Library General Public License for more details. | 15 * Library General Public License for more details. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 26 * License as published by the Free Software Foundation; either | 27 * License as published by the Free Software Foundation; either |
| 27 * version 2.1 of the License, or (at your option) any later version. | 28 * version 2.1 of the License, or (at your option) any later version. |
| 28 * | 29 * |
| 29 * This library is distributed in the hope that it will be useful, | 30 * This library is distributed in the hope that it will be useful, |
| 30 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 31 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 32 * Lesser General Public License for more details. | 33 * Lesser General Public License for more details. |
| 33 * | 34 * |
| 34 * You should have received a copy of the GNU Lesser General Public | 35 * You should have received a copy of the GNU Lesser General Public |
| 35 * License along with this library; if not, write to the Free Software | 36 * License along with this library; if not, write to the Free Software |
| 36 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 US
A | 37 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 37 * | 38 * |
| 38 * Alternatively, the document type parsing portions of this file may be used | 39 * Alternatively, the document type parsing portions of this file may be used |
| 39 * under the terms of either the Mozilla Public License Version 1.1, found at | 40 * under the terms of either the Mozilla Public License Version 1.1, found at |
| 40 * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public | 41 * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public |
| 41 * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html | 42 * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html |
| 42 * (the "GPL"), in which case the provisions of the MPL or the GPL are | 43 * (the "GPL"), in which case the provisions of the MPL or the GPL are |
| 43 * applicable instead of those above. If you wish to allow use of your | 44 * applicable instead of those above. If you wish to allow use of your |
| 44 * version of this file only under the terms of one of those two | 45 * version of this file only under the terms of one of those two |
| 45 * licenses (the MPL or the GPL) and not to allow others to use your | 46 * licenses (the MPL or the GPL) and not to allow others to use your |
| 46 * version of this file under the LGPL, indicate your decision by | 47 * version of this file under the LGPL, indicate your decision by |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 const AtomicString& HTMLDocument::bodyAttributeValue( | 82 const AtomicString& HTMLDocument::bodyAttributeValue( |
| 82 const QualifiedName& name) const { | 83 const QualifiedName& name) const { |
| 83 if (HTMLBodyElement* body = htmlBodyElement()) | 84 if (HTMLBodyElement* body = htmlBodyElement()) |
| 84 return body->fastGetAttribute(name); | 85 return body->fastGetAttribute(name); |
| 85 return nullAtom; | 86 return nullAtom; |
| 86 } | 87 } |
| 87 | 88 |
| 88 void HTMLDocument::setBodyAttribute(const QualifiedName& name, | 89 void HTMLDocument::setBodyAttribute(const QualifiedName& name, |
| 89 const AtomicString& value) { | 90 const AtomicString& value) { |
| 90 if (HTMLBodyElement* body = htmlBodyElement()) { | 91 if (HTMLBodyElement* body = htmlBodyElement()) { |
| 91 // FIXME: This check is apparently for benchmarks that set the same value re
peatedly. | 92 // FIXME: This check is apparently for benchmarks that set the same value |
| 92 // It's not clear what benchmarks though, it's also not clear why we don't a
void | 93 // repeatedly. It's not clear what benchmarks though, it's also not clear |
| 93 // causing a style recalc when setting the same value to a presentational at
tribute | 94 // why we don't avoid causing a style recalc when setting the same value to |
| 94 // in the common case. | 95 // a presentational attribute in the common case. |
| 95 if (body->fastGetAttribute(name) != value) | 96 if (body->fastGetAttribute(name) != value) |
| 96 body->setAttribute(name, value); | 97 body->setAttribute(name, value); |
| 97 } | 98 } |
| 98 } | 99 } |
| 99 | 100 |
| 100 const AtomicString& HTMLDocument::bgColor() const { | 101 const AtomicString& HTMLDocument::bgColor() const { |
| 101 return bodyAttributeValue(bgcolorAttr); | 102 return bodyAttributeValue(bgcolorAttr); |
| 102 } | 103 } |
| 103 | 104 |
| 104 void HTMLDocument::setBgColor(const AtomicString& value) { | 105 void HTMLDocument::setBgColor(const AtomicString& value) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 175 |
| 175 void HTMLDocument::addExtraNamedItem(const AtomicString& name) { | 176 void HTMLDocument::addExtraNamedItem(const AtomicString& name) { |
| 176 addItemToMap(m_extraNamedItemCounts, name); | 177 addItemToMap(m_extraNamedItemCounts, name); |
| 177 } | 178 } |
| 178 | 179 |
| 179 void HTMLDocument::removeExtraNamedItem(const AtomicString& name) { | 180 void HTMLDocument::removeExtraNamedItem(const AtomicString& name) { |
| 180 removeItemFromMap(m_extraNamedItemCounts, name); | 181 removeItemFromMap(m_extraNamedItemCounts, name); |
| 181 } | 182 } |
| 182 | 183 |
| 183 static HashSet<StringImpl*>* createHtmlCaseInsensitiveAttributesSet() { | 184 static HashSet<StringImpl*>* createHtmlCaseInsensitiveAttributesSet() { |
| 184 // This is the list of attributes in HTML 4.01 with values marked as "[CI]" or
case-insensitive | 185 // This is the list of attributes in HTML 4.01 with values marked as "[CI]" or |
| 185 // Mozilla treats all other values as case-sensitive, thus so do we. | 186 // case-insensitive. Mozilla treats all other values as case-sensitive, thus |
| 187 // so do we. |
| 186 HashSet<StringImpl*>* attrSet = new HashSet<StringImpl*>; | 188 HashSet<StringImpl*>* attrSet = new HashSet<StringImpl*>; |
| 187 | 189 |
| 188 const QualifiedName* caseInsensitiveAttributes[] = { | 190 const QualifiedName* caseInsensitiveAttributes[] = { |
| 189 &accept_charsetAttr, &acceptAttr, &alignAttr, &alinkAttr, | 191 &accept_charsetAttr, &acceptAttr, &alignAttr, &alinkAttr, |
| 190 &axisAttr, &bgcolorAttr, &charsetAttr, &checkedAttr, | 192 &axisAttr, &bgcolorAttr, &charsetAttr, &checkedAttr, |
| 191 &clearAttr, &codetypeAttr, &colorAttr, &compactAttr, | 193 &clearAttr, &codetypeAttr, &colorAttr, &compactAttr, |
| 192 &declareAttr, &deferAttr, &dirAttr, &directionAttr, | 194 &declareAttr, &deferAttr, &dirAttr, &directionAttr, |
| 193 &disabledAttr, &enctypeAttr, &faceAttr, &frameAttr, | 195 &disabledAttr, &enctypeAttr, &faceAttr, &frameAttr, |
| 194 &hreflangAttr, &http_equivAttr, &langAttr, &languageAttr, | 196 &hreflangAttr, &http_equivAttr, &langAttr, &languageAttr, |
| 195 &linkAttr, &mediaAttr, &methodAttr, &multipleAttr, | 197 &linkAttr, &mediaAttr, &methodAttr, &multipleAttr, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 211 static HashSet<StringImpl*>* htmlCaseInsensitiveAttributesSet = | 213 static HashSet<StringImpl*>* htmlCaseInsensitiveAttributesSet = |
| 212 createHtmlCaseInsensitiveAttributesSet(); | 214 createHtmlCaseInsensitiveAttributesSet(); |
| 213 bool isPossibleHTMLAttr = | 215 bool isPossibleHTMLAttr = |
| 214 !attributeName.hasPrefix() && (attributeName.namespaceURI() == nullAtom); | 216 !attributeName.hasPrefix() && (attributeName.namespaceURI() == nullAtom); |
| 215 return !isPossibleHTMLAttr || | 217 return !isPossibleHTMLAttr || |
| 216 !htmlCaseInsensitiveAttributesSet->contains( | 218 !htmlCaseInsensitiveAttributesSet->contains( |
| 217 attributeName.localName().impl()); | 219 attributeName.localName().impl()); |
| 218 } | 220 } |
| 219 | 221 |
| 220 } // namespace blink | 222 } // namespace blink |
| OLD | NEW |