| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. |
| 3 * Copyright (C) 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "core/dom/Element.h" | 33 #include "core/dom/Element.h" |
| 34 #include "core/dom/ElementTraversal.h" | 34 #include "core/dom/ElementTraversal.h" |
| 35 #include "core/dom/IdTargetObserverRegistry.h" | 35 #include "core/dom/IdTargetObserverRegistry.h" |
| 36 #include "core/dom/NodeComputedStyle.h" | 36 #include "core/dom/NodeComputedStyle.h" |
| 37 #include "core/dom/StyleChangeReason.h" | 37 #include "core/dom/StyleChangeReason.h" |
| 38 #include "core/dom/TreeScopeAdopter.h" | 38 #include "core/dom/TreeScopeAdopter.h" |
| 39 #include "core/dom/shadow/ElementShadow.h" | 39 #include "core/dom/shadow/ElementShadow.h" |
| 40 #include "core/dom/shadow/ShadowRoot.h" | 40 #include "core/dom/shadow/ShadowRoot.h" |
| 41 #include "core/editing/DOMSelection.h" | 41 #include "core/editing/DOMSelection.h" |
| 42 #include "core/events/EventPath.h" | 42 #include "core/events/EventPath.h" |
| 43 #include "core/frame/Deprecation.h" | |
| 44 #include "core/frame/FrameConsole.h" | |
| 45 #include "core/frame/FrameView.h" | 43 #include "core/frame/FrameView.h" |
| 46 #include "core/frame/LocalFrame.h" | 44 #include "core/frame/LocalFrame.h" |
| 47 #include "core/html/HTMLAnchorElement.h" | 45 #include "core/html/HTMLAnchorElement.h" |
| 48 #include "core/html/HTMLFrameOwnerElement.h" | 46 #include "core/html/HTMLFrameOwnerElement.h" |
| 49 #include "core/html/HTMLMapElement.h" | 47 #include "core/html/HTMLMapElement.h" |
| 50 #include "core/inspector/ConsoleMessage.h" | |
| 51 #include "core/layout/HitTestResult.h" | 48 #include "core/layout/HitTestResult.h" |
| 52 #include "core/layout/api/LayoutViewItem.h" | 49 #include "core/layout/api/LayoutViewItem.h" |
| 53 #include "core/page/FocusController.h" | 50 #include "core/page/FocusController.h" |
| 54 #include "core/page/Page.h" | 51 #include "core/page/Page.h" |
| 55 #include "wtf/Vector.h" | 52 #include "wtf/Vector.h" |
| 56 | 53 |
| 57 namespace blink { | 54 namespace blink { |
| 58 | 55 |
| 59 using namespace HTMLNames; | 56 using namespace HTMLNames; |
| 60 | 57 |
| 61 namespace { | |
| 62 | |
| 63 void addSingletonDeprecationMessageForImageMap(const LocalFrame* frame, | |
| 64 UseCounter::Feature feature, | |
| 65 const String& usemap, | |
| 66 const AtomicString& name) { | |
| 67 if (!frame) | |
| 68 return; | |
| 69 frame->console().addSingletonMessage(ConsoleMessage::create( | |
| 70 DeprecationMessageSource, WarningMessageLevel, | |
| 71 Deprecation::deprecationMessage(feature) + " Comparing usemap=" + usemap + | |
| 72 " and name=" + name)); | |
| 73 } | |
| 74 } | |
| 75 | |
| 76 TreeScope::TreeScope(ContainerNode& rootNode, Document& document) | 58 TreeScope::TreeScope(ContainerNode& rootNode, Document& document) |
| 77 : m_rootNode(&rootNode), | 59 : m_rootNode(&rootNode), |
| 78 m_document(&document), | 60 m_document(&document), |
| 79 m_parentTreeScope(&document), | 61 m_parentTreeScope(&document), |
| 80 m_idTargetObserverRegistry(IdTargetObserverRegistry::create()) { | 62 m_idTargetObserverRegistry(IdTargetObserverRegistry::create()) { |
| 81 DCHECK_NE(rootNode, document); | 63 DCHECK_NE(rootNode, document); |
| 82 m_rootNode->setTreeScope(this); | 64 m_rootNode->setTreeScope(this); |
| 83 } | 65 } |
| 84 | 66 |
| 85 TreeScope::TreeScope(Document& document) | 67 TreeScope::TreeScope(Document& document) |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 m_imageMapsByName->remove(name, imageMap); | 178 m_imageMapsByName->remove(name, imageMap); |
| 197 } | 179 } |
| 198 | 180 |
| 199 HTMLMapElement* TreeScope::getImageMap(const String& url) const { | 181 HTMLMapElement* TreeScope::getImageMap(const String& url) const { |
| 200 if (url.isNull()) | 182 if (url.isNull()) |
| 201 return nullptr; | 183 return nullptr; |
| 202 if (!m_imageMapsByName) | 184 if (!m_imageMapsByName) |
| 203 return nullptr; | 185 return nullptr; |
| 204 size_t hashPos = url.find('#'); | 186 size_t hashPos = url.find('#'); |
| 205 String name = hashPos == kNotFound ? url : url.substring(hashPos + 1); | 187 String name = hashPos == kNotFound ? url : url.substring(hashPos + 1); |
| 206 HTMLMapElement* map = toHTMLMapElement( | 188 return toHTMLMapElement( |
| 207 document().isHTMLDocument() | 189 m_imageMapsByName->getElementByMapName(AtomicString(name), this)); |
| 208 ? m_imageMapsByName->getElementByLowercasedMapName( | |
| 209 AtomicString(name.lower()), this) | |
| 210 : m_imageMapsByName->getElementByMapName(AtomicString(name), this)); | |
| 211 if (!map || !document().isHTMLDocument()) | |
| 212 return map; | |
| 213 const AtomicString& nameValue = map->fastGetAttribute(nameAttr); | |
| 214 if (nameValue.isNull()) | |
| 215 return map; | |
| 216 String strippedName = nameValue; | |
| 217 if (strippedName.startsWith('#')) | |
| 218 strippedName = strippedName.substring(1); | |
| 219 if (strippedName == name) { | |
| 220 UseCounter::count(document(), UseCounter::MapNameMatchingStrict); | |
| 221 } else if (equalIgnoringASCIICase(strippedName, name)) { | |
| 222 addSingletonDeprecationMessageForImageMap( | |
| 223 document().frame(), UseCounter::MapNameMatchingASCIICaseless, url, | |
| 224 nameValue); | |
| 225 } else { | |
| 226 addSingletonDeprecationMessageForImageMap( | |
| 227 document().frame(), UseCounter::MapNameMatchingUnicodeLower, url, | |
| 228 nameValue); | |
| 229 } | |
| 230 return map; | |
| 231 } | 190 } |
| 232 | 191 |
| 233 static bool pointWithScrollAndZoomIfPossible(const Document& document, | 192 static bool pointWithScrollAndZoomIfPossible(const Document& document, |
| 234 IntPoint& point) { | 193 IntPoint& point) { |
| 235 LocalFrame* frame = document.frame(); | 194 LocalFrame* frame = document.frame(); |
| 236 if (!frame) | 195 if (!frame) |
| 237 return false; | 196 return false; |
| 238 FrameView* frameView = frame->view(); | 197 FrameView* frameView = frame->view(); |
| 239 if (!frameView) | 198 if (!frameView) |
| 240 return false; | 199 return false; |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 visitor->trace(m_parentTreeScope); | 521 visitor->trace(m_parentTreeScope); |
| 563 visitor->trace(m_idTargetObserverRegistry); | 522 visitor->trace(m_idTargetObserverRegistry); |
| 564 visitor->trace(m_selection); | 523 visitor->trace(m_selection); |
| 565 visitor->trace(m_elementsById); | 524 visitor->trace(m_elementsById); |
| 566 visitor->trace(m_imageMapsByName); | 525 visitor->trace(m_imageMapsByName); |
| 567 visitor->trace(m_scopedStyleResolver); | 526 visitor->trace(m_scopedStyleResolver); |
| 568 visitor->trace(m_radioButtonGroupScope); | 527 visitor->trace(m_radioButtonGroupScope); |
| 569 } | 528 } |
| 570 | 529 |
| 571 } // namespace blink | 530 } // namespace blink |
| OLD | NEW |