| 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" |
| 43 #include "core/frame/FrameView.h" | 45 #include "core/frame/FrameView.h" |
| 44 #include "core/frame/LocalFrame.h" | 46 #include "core/frame/LocalFrame.h" |
| 45 #include "core/html/HTMLAnchorElement.h" | 47 #include "core/html/HTMLAnchorElement.h" |
| 46 #include "core/html/HTMLFrameOwnerElement.h" | 48 #include "core/html/HTMLFrameOwnerElement.h" |
| 47 #include "core/html/HTMLMapElement.h" | 49 #include "core/html/HTMLMapElement.h" |
| 50 #include "core/inspector/ConsoleMessage.h" |
| 48 #include "core/layout/HitTestResult.h" | 51 #include "core/layout/HitTestResult.h" |
| 49 #include "core/layout/api/LayoutViewItem.h" | 52 #include "core/layout/api/LayoutViewItem.h" |
| 50 #include "core/page/FocusController.h" | 53 #include "core/page/FocusController.h" |
| 51 #include "core/page/Page.h" | 54 #include "core/page/Page.h" |
| 52 #include "wtf/Vector.h" | 55 #include "wtf/Vector.h" |
| 53 | 56 |
| 54 namespace blink { | 57 namespace blink { |
| 55 | 58 |
| 56 using namespace HTMLNames; | 59 using namespace HTMLNames; |
| 57 | 60 |
| 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 |
| 58 TreeScope::TreeScope(ContainerNode& rootNode, Document& document) | 76 TreeScope::TreeScope(ContainerNode& rootNode, Document& document) |
| 59 : m_rootNode(&rootNode), | 77 : m_rootNode(&rootNode), |
| 60 m_document(&document), | 78 m_document(&document), |
| 61 m_parentTreeScope(&document), | 79 m_parentTreeScope(&document), |
| 62 m_idTargetObserverRegistry(IdTargetObserverRegistry::create()) { | 80 m_idTargetObserverRegistry(IdTargetObserverRegistry::create()) { |
| 63 DCHECK_NE(rootNode, document); | 81 DCHECK_NE(rootNode, document); |
| 64 m_rootNode->setTreeScope(this); | 82 m_rootNode->setTreeScope(this); |
| 65 } | 83 } |
| 66 | 84 |
| 67 TreeScope::TreeScope(Document& document) | 85 TreeScope::TreeScope(Document& document) |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 197 } |
| 180 | 198 |
| 181 HTMLMapElement* TreeScope::getImageMap(const String& url) const { | 199 HTMLMapElement* TreeScope::getImageMap(const String& url) const { |
| 182 if (url.isNull()) | 200 if (url.isNull()) |
| 183 return nullptr; | 201 return nullptr; |
| 184 if (!m_imageMapsByName) | 202 if (!m_imageMapsByName) |
| 185 return nullptr; | 203 return nullptr; |
| 186 size_t hashPos = url.find('#'); | 204 size_t hashPos = url.find('#'); |
| 187 String name = hashPos == kNotFound ? url : url.substring(hashPos + 1); | 205 String name = hashPos == kNotFound ? url : url.substring(hashPos + 1); |
| 188 HTMLMapElement* map = toHTMLMapElement( | 206 HTMLMapElement* map = toHTMLMapElement( |
| 189 rootNode().document().isHTMLDocument() | 207 document().isHTMLDocument() |
| 190 ? m_imageMapsByName->getElementByLowercasedMapName( | 208 ? m_imageMapsByName->getElementByLowercasedMapName( |
| 191 AtomicString(name.lower()), this) | 209 AtomicString(name.lower()), this) |
| 192 : m_imageMapsByName->getElementByMapName(AtomicString(name), this)); | 210 : m_imageMapsByName->getElementByMapName(AtomicString(name), this)); |
| 193 if (!map || !rootNode().document().isHTMLDocument()) | 211 if (!map || !document().isHTMLDocument()) |
| 194 return map; | 212 return map; |
| 195 const AtomicString& nameValue = map->fastGetAttribute(nameAttr); | 213 const AtomicString& nameValue = map->fastGetAttribute(nameAttr); |
| 196 if (nameValue.isNull()) | 214 if (nameValue.isNull()) |
| 197 return map; | 215 return map; |
| 198 String strippedName = nameValue; | 216 String strippedName = nameValue; |
| 199 if (strippedName.startsWith('#')) | 217 if (strippedName.startsWith('#')) |
| 200 strippedName = strippedName.substring(1); | 218 strippedName = strippedName.substring(1); |
| 201 if (strippedName == name) | 219 if (strippedName == name) { |
| 202 UseCounter::count(rootNode().document(), UseCounter::MapNameMatchingStrict); | 220 UseCounter::count(document(), UseCounter::MapNameMatchingStrict); |
| 203 else if (equalIgnoringASCIICase(strippedName, name)) | 221 } else if (equalIgnoringASCIICase(strippedName, name)) { |
| 204 UseCounter::count(rootNode().document(), | 222 addSingletonDeprecationMessageForImageMap( |
| 205 UseCounter::MapNameMatchingASCIICaseless); | 223 document().frame(), UseCounter::MapNameMatchingASCIICaseless, url, |
| 206 else | 224 nameValue); |
| 207 UseCounter::count(rootNode().document(), | 225 } else { |
| 208 UseCounter::MapNameMatchingUnicodeLower); | 226 addSingletonDeprecationMessageForImageMap( |
| 227 document().frame(), UseCounter::MapNameMatchingUnicodeLower, url, |
| 228 nameValue); |
| 229 } |
| 209 return map; | 230 return map; |
| 210 } | 231 } |
| 211 | 232 |
| 212 static bool pointWithScrollAndZoomIfPossible(const Document& document, | 233 static bool pointWithScrollAndZoomIfPossible(const Document& document, |
| 213 IntPoint& point) { | 234 IntPoint& point) { |
| 214 LocalFrame* frame = document.frame(); | 235 LocalFrame* frame = document.frame(); |
| 215 if (!frame) | 236 if (!frame) |
| 216 return false; | 237 return false; |
| 217 FrameView* frameView = frame->view(); | 238 FrameView* frameView = frame->view(); |
| 218 if (!frameView) | 239 if (!frameView) |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 visitor->trace(m_parentTreeScope); | 562 visitor->trace(m_parentTreeScope); |
| 542 visitor->trace(m_idTargetObserverRegistry); | 563 visitor->trace(m_idTargetObserverRegistry); |
| 543 visitor->trace(m_selection); | 564 visitor->trace(m_selection); |
| 544 visitor->trace(m_elementsById); | 565 visitor->trace(m_elementsById); |
| 545 visitor->trace(m_imageMapsByName); | 566 visitor->trace(m_imageMapsByName); |
| 546 visitor->trace(m_scopedStyleResolver); | 567 visitor->trace(m_scopedStyleResolver); |
| 547 visitor->trace(m_radioButtonGroupScope); | 568 visitor->trace(m_radioButtonGroupScope); |
| 548 } | 569 } |
| 549 | 570 |
| 550 } // namespace blink | 571 } // namespace blink |
| OLD | NEW |