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

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

Issue 2623513005: Introduce Element::AttributeModificationParams (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
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 (equalIgnoringCase(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 QualifiedName& name, 79 void HTMLMapElement::parseAttribute(const AttributeModificationParams& params) {
80 const AtomicString& oldValue,
81 const AtomicString& value) {
82 // FIXME: This logic seems wrong for XML documents. 80 // FIXME: This logic seems wrong for XML documents.
83 // 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
84 // are parsed. 82 // are parsed.
85 83
86 if (name == idAttr || name == nameAttr) { 84 if (params.name == idAttr || params.name == nameAttr) {
87 if (name == idAttr) { 85 if (params.name == idAttr) {
88 // Call base class so that hasID bit gets set. 86 // Call base class so that hasID bit gets set.
89 HTMLElement::parseAttribute(name, oldValue, value); 87 HTMLElement::parseAttribute(params);
90 if (document().isHTMLDocument()) 88 if (document().isHTMLDocument())
91 return; 89 return;
92 } 90 }
93 if (isConnected()) 91 if (isConnected())
94 treeScope().removeImageMap(this); 92 treeScope().removeImageMap(this);
95 String mapName = value; 93 String mapName = params.newValue;
96 if (mapName[0] == '#') 94 if (mapName[0] == '#')
97 mapName = mapName.substring(1); 95 mapName = mapName.substring(1);
98 m_name = 96 m_name =
99 AtomicString(document().isHTMLDocument() ? mapName.lower() : mapName); 97 AtomicString(document().isHTMLDocument() ? mapName.lower() : mapName);
100 if (isConnected()) 98 if (isConnected())
101 treeScope().addImageMap(this); 99 treeScope().addImageMap(this);
102 100
103 return; 101 return;
104 } 102 }
105 103
106 HTMLElement::parseAttribute(name, oldValue, value); 104 HTMLElement::parseAttribute(params);
107 } 105 }
108 106
109 HTMLCollection* HTMLMapElement::areas() { 107 HTMLCollection* HTMLMapElement::areas() {
110 return ensureCachedCollection<HTMLCollection>(MapAreas); 108 return ensureCachedCollection<HTMLCollection>(MapAreas);
111 } 109 }
112 110
113 Node::InsertionNotificationRequest HTMLMapElement::insertedInto( 111 Node::InsertionNotificationRequest HTMLMapElement::insertedInto(
114 ContainerNode* insertionPoint) { 112 ContainerNode* insertionPoint) {
115 if (insertionPoint->isConnected()) 113 if (insertionPoint->isConnected())
116 treeScope().addImageMap(this); 114 treeScope().addImageMap(this);
117 return HTMLElement::insertedInto(insertionPoint); 115 return HTMLElement::insertedInto(insertionPoint);
118 } 116 }
119 117
120 void HTMLMapElement::removedFrom(ContainerNode* insertionPoint) { 118 void HTMLMapElement::removedFrom(ContainerNode* insertionPoint) {
121 if (insertionPoint->isConnected()) 119 if (insertionPoint->isConnected())
122 treeScope().removeImageMap(this); 120 treeScope().removeImageMap(this);
123 HTMLElement::removedFrom(insertionPoint); 121 HTMLElement::removedFrom(insertionPoint);
124 } 122 }
125 123
126 } // namespace blink 124 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMapElement.h ('k') | third_party/WebKit/Source/core/html/HTMLMediaElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698