Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(953)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMapElement.cpp

Issue 2648163002: Remove case-insensitive matching of usemap attribute. (Closed)
Patch Set: _ Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 HTMLImageElement* HTMLMapElement::imageElement() { 62 HTMLImageElement* HTMLMapElement::imageElement() {
63 HTMLCollection* images = document().images(); 63 HTMLCollection* images = document().images();
64 for (unsigned i = 0; Element* curr = images->item(i); ++i) { 64 for (unsigned i = 0; Element* curr = images->item(i); ++i) {
65 DCHECK(isHTMLImageElement(curr)); 65 DCHECK(isHTMLImageElement(curr));
66 66
67 // The HTMLImageElement's useMap() value includes the '#' symbol at the 67 // The HTMLImageElement's useMap() value includes the '#' symbol at the
68 // beginning, which has to be stripped off. 68 // beginning, which has to be stripped off.
69 HTMLImageElement& imageElement = toHTMLImageElement(*curr); 69 HTMLImageElement& imageElement = toHTMLImageElement(*curr);
70 String useMapName = 70 String useMapName =
71 imageElement.getAttribute(usemapAttr).getString().substring(1); 71 imageElement.getAttribute(usemapAttr).getString().substring(1);
72 if (equalIgnoringCase(useMapName, m_name)) 72 if (useMapName == m_name)
73 return &imageElement; 73 return &imageElement;
74 } 74 }
75 75
76 return nullptr; 76 return nullptr;
77 } 77 }
78 78
79 void HTMLMapElement::parseAttribute(const AttributeModificationParams& params) { 79 void HTMLMapElement::parseAttribute(const AttributeModificationParams& params) {
80 // FIXME: This logic seems wrong for XML documents. 80 // FIXME: This logic seems wrong for XML documents.
81 // Either the id or name will be used depending on the order the attributes 81 // Either the id or name will be used depending on the order the attributes
82 // are parsed. 82 // are parsed.
83 83
84 if (params.name == idAttr || params.name == nameAttr) { 84 if (params.name == idAttr || params.name == nameAttr) {
85 if (params.name == idAttr) { 85 if (params.name == idAttr) {
86 // Call base class so that hasID bit gets set. 86 // Call base class so that hasID bit gets set.
87 HTMLElement::parseAttribute(params); 87 HTMLElement::parseAttribute(params);
88 if (document().isHTMLDocument()) 88 if (document().isHTMLDocument())
89 return; 89 return;
90 } 90 }
91 if (isConnected()) 91 if (isConnected())
92 treeScope().removeImageMap(this); 92 treeScope().removeImageMap(this);
93 String mapName = params.newValue; 93 String mapName = params.newValue;
94 if (mapName[0] == '#') 94 if (mapName[0] == '#')
95 mapName = mapName.substring(1); 95 mapName = mapName.substring(1);
96 m_name = 96 m_name = AtomicString(mapName);
97 AtomicString(document().isHTMLDocument() ? mapName.lower() : mapName);
98 if (isConnected()) 97 if (isConnected())
99 treeScope().addImageMap(this); 98 treeScope().addImageMap(this);
100 99
101 return; 100 return;
102 } 101 }
103 102
104 HTMLElement::parseAttribute(params); 103 HTMLElement::parseAttribute(params);
105 } 104 }
106 105
107 HTMLCollection* HTMLMapElement::areas() { 106 HTMLCollection* HTMLMapElement::areas() {
108 return ensureCachedCollection<HTMLCollection>(MapAreas); 107 return ensureCachedCollection<HTMLCollection>(MapAreas);
109 } 108 }
110 109
111 Node::InsertionNotificationRequest HTMLMapElement::insertedInto( 110 Node::InsertionNotificationRequest HTMLMapElement::insertedInto(
112 ContainerNode* insertionPoint) { 111 ContainerNode* insertionPoint) {
113 if (insertionPoint->isConnected()) 112 if (insertionPoint->isConnected())
114 treeScope().addImageMap(this); 113 treeScope().addImageMap(this);
115 return HTMLElement::insertedInto(insertionPoint); 114 return HTMLElement::insertedInto(insertionPoint);
116 } 115 }
117 116
118 void HTMLMapElement::removedFrom(ContainerNode* insertionPoint) { 117 void HTMLMapElement::removedFrom(ContainerNode* insertionPoint) {
119 if (insertionPoint->isConnected()) 118 if (insertionPoint->isConnected())
120 treeScope().removeImageMap(this); 119 treeScope().removeImageMap(this);
121 HTMLElement::removedFrom(insertionPoint); 120 HTMLElement::removedFrom(insertionPoint);
122 } 121 }
123 122
124 } // namespace blink 123 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698