| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/dom/PresentationAttributeStyle.h" | 32 #include "core/dom/PresentationAttributeStyle.h" |
| 33 | 33 |
| 34 #include "HTMLNames.h" | |
| 35 #include "core/css/StylePropertySet.h" | 34 #include "core/css/StylePropertySet.h" |
| 36 #include "core/dom/Attribute.h" | 35 #include "core/dom/Attribute.h" |
| 37 #include "core/dom/Element.h" | 36 #include "core/dom/Element.h" |
| 37 #include "core/html/HTMLInputElement.h" |
| 38 #include "wtf/HashFunctions.h" | 38 #include "wtf/HashFunctions.h" |
| 39 #include "wtf/HashMap.h" | 39 #include "wtf/HashMap.h" |
| 40 #include "wtf/text/CString.h" | 40 #include "wtf/text/CString.h" |
| 41 | 41 |
| 42 namespace WebCore { | 42 namespace WebCore { |
| 43 | 43 |
| 44 using namespace HTMLNames; | 44 using namespace HTMLNames; |
| 45 | 45 |
| 46 struct PresentationAttributeCacheKey { | 46 struct PresentationAttributeCacheKey { |
| 47 PresentationAttributeCacheKey() : tagName(0) { } | 47 PresentationAttributeCacheKey() : tagName(0) { } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // Sort based on the attribute name pointers. It doesn't matter what the ord
er is as long as it is always the same. | 114 // Sort based on the attribute name pointers. It doesn't matter what the ord
er is as long as it is always the same. |
| 115 return p1.first < p2.first; | 115 return p1.first < p2.first; |
| 116 } | 116 } |
| 117 | 117 |
| 118 static void makePresentationAttributeCacheKey(Element& element, PresentationAttr
ibuteCacheKey& result) | 118 static void makePresentationAttributeCacheKey(Element& element, PresentationAttr
ibuteCacheKey& result) |
| 119 { | 119 { |
| 120 // FIXME: Enable for SVG. | 120 // FIXME: Enable for SVG. |
| 121 if (!element.isHTMLElement()) | 121 if (!element.isHTMLElement()) |
| 122 return; | 122 return; |
| 123 // Interpretation of the size attributes on <input> depends on the type attr
ibute. | 123 // Interpretation of the size attributes on <input> depends on the type attr
ibute. |
| 124 if (element.hasTagName(inputTag)) | 124 if (isHTMLInputElement(element)) |
| 125 return; | 125 return; |
| 126 unsigned size = element.attributeCount(); | 126 unsigned size = element.attributeCount(); |
| 127 for (unsigned i = 0; i < size; ++i) { | 127 for (unsigned i = 0; i < size; ++i) { |
| 128 const Attribute& attribute = element.attributeItem(i); | 128 const Attribute& attribute = element.attributeItem(i); |
| 129 if (!element.isPresentationAttribute(attribute.name())) | 129 if (!element.isPresentationAttribute(attribute.name())) |
| 130 continue; | 130 continue; |
| 131 if (!attribute.namespaceURI().isNull()) | 131 if (!attribute.namespaceURI().isNull()) |
| 132 return; | 132 return; |
| 133 // FIXME: Background URL may depend on the base URL and can't be shared.
Disallow caching. | 133 // FIXME: Background URL may depend on the base URL and can't be shared.
Disallow caching. |
| 134 if (attribute.name() == backgroundAttr) | 134 if (attribute.name() == backgroundAttr) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 presentationAttributeCache().clear(); | 199 presentationAttributeCache().clear(); |
| 200 presentationAttributeCache().set(cacheHash, newEntry.release()); | 200 presentationAttributeCache().set(cacheHash, newEntry.release()); |
| 201 } else { | 201 } else { |
| 202 cacheValue->value = newEntry.release(); | 202 cacheValue->value = newEntry.release(); |
| 203 } | 203 } |
| 204 | 204 |
| 205 return style.release(); | 205 return style.release(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace WebCore | 208 } // namespace WebCore |
| OLD | NEW |