Skip to content

Commit f0939c5

Browse files
committed
Use AtomString instead of AtomStringImpl in TreeScopeOrderedMap
https://bugs.webkit.org/show_bug.cgi?id=263239 Reviewed by Chris Dumez. Replaced the use of AtomStringImpl* / AtomStringImpl& in TreeScopeOrderedMap with AtomString. * Source/WebCore/bindings/js/JSDOMWindowProperties.cpp: (WebCore::jsDOMWindowPropertiesGetOwnPropertySlotNamedItemGetter): * Source/WebCore/dom/Element.cpp: (WebCore::Element::insertedIntoAncestor): (WebCore::Element::removedFromAncestor): (WebCore::Element::updateNameForTreeScope): (WebCore::Element::updateNameForDocument): (WebCore::Element::updateIdForTreeScope): (WebCore::Element::updateIdForDocument): (WebCore::Element::updateLabel): * Source/WebCore/dom/ImageOverlay.cpp: (WebCore::ImageOverlay::hasOverlay): * Source/WebCore/dom/TreeScope.cpp: (WebCore::TreeScope::getElementById const): (WebCore::TreeScope::getAllElementsById const): (WebCore::TreeScope::addElementById): (WebCore::TreeScope::removeElementById): (WebCore::TreeScope::getElementByName const): (WebCore::TreeScope::addElementByName): (WebCore::TreeScope::removeElementByName): (WebCore::TreeScope::addImageMap): (WebCore::TreeScope::removeImageMap): (WebCore::TreeScope::getImageMap const): (WebCore::TreeScope::addImageElementByUsemap): (WebCore::TreeScope::removeImageElementByUsemap): (WebCore::TreeScope::imageElementByUsemap const): (WebCore::TreeScope::addLabel): (WebCore::TreeScope::removeLabel): (WebCore::TreeScope::labelElementsForId): * Source/WebCore/dom/TreeScope.h: * Source/WebCore/dom/TreeScopeInlines.h: (WebCore::TreeScope::hasElementWithId const): (WebCore::TreeScope::containsMultipleElementsWithId const): (WebCore::TreeScope::hasElementWithName const): (WebCore::TreeScope::containsMultipleElementsWithName const): * Source/WebCore/dom/TreeScopeOrderedMap.cpp: (WebCore::TreeScopeOrderedMap::add): (WebCore::TreeScopeOrderedMap::remove): (WebCore::TreeScopeOrderedMap::get const): (WebCore::TreeScopeOrderedMap::getAll const): (WebCore::TreeScopeOrderedMap::getElementById const): (WebCore::TreeScopeOrderedMap::getElementByName const): (WebCore::TreeScopeOrderedMap::getElementByMapName const): (WebCore::TreeScopeOrderedMap::getElementByUsemap const): (WebCore::TreeScopeOrderedMap::getElementsByLabelForAttribute const): (WebCore::TreeScopeOrderedMap::getElementByWindowNamedItem const): (WebCore::TreeScopeOrderedMap::getElementByDocumentNamedItem const): (WebCore::TreeScopeOrderedMap::getAllElementsById const): (WebCore::TreeScopeOrderedMap::keys const): * Source/WebCore/dom/TreeScopeOrderedMap.h: (WebCore::TreeScopeOrderedMap::containsSingle const): (WebCore::TreeScopeOrderedMap::contains const): (WebCore::TreeScopeOrderedMap::containsMultiple const): * Source/WebCore/dom/mac/ImageControlsMac.cpp: (WebCore::ImageControlsMac::hasImageControls): * Source/WebCore/html/CachedHTMLCollectionInlines.h: (WebCore::traversalType>::namedItem const): * Source/WebCore/html/HTMLDocument.cpp: (WebCore::HTMLDocument::namedItem): (WebCore::HTMLDocument::isSupportedPropertyName const): (WebCore::HTMLDocument::addDocumentNamedItem): (WebCore::HTMLDocument::removeDocumentNamedItem): (WebCore::HTMLDocument::addWindowNamedItem): (WebCore::HTMLDocument::removeWindowNamedItem): * Source/WebCore/html/HTMLDocument.h: (WebCore::HTMLDocument::documentNamedItem const): (WebCore::HTMLDocument::hasDocumentNamedItem const): (WebCore::HTMLDocument::documentNamedItemContainsMultipleElements const): (WebCore::HTMLDocument::windowNamedItem const): (WebCore::HTMLDocument::hasWindowNamedItem const): (WebCore::HTMLDocument::windowNamedItemContainsMultipleElements const): * Source/WebCore/html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::attributeChanged): (WebCore::HTMLImageElement::insertedIntoAncestor): (WebCore::HTMLImageElement::removedFromAncestor): (WebCore::HTMLImageElement::matchesUsemap const): * Source/WebCore/html/HTMLImageElement.h: * Source/WebCore/html/HTMLMapElement.cpp: (WebCore::HTMLMapElement::imageElement): * Source/WebCore/html/HTMLNameCollection.cpp: (WebCore::WindowNameCollection::elementMatches): (WebCore::DocumentNameCollection::elementMatches): * Source/WebCore/html/HTMLNameCollection.h: * Source/WebCore/html/HTMLObjectElement.cpp: (WebCore::HTMLObjectElement::updateExposedState): Canonical link: https://commits.webkit.org/269477@main
1 parent ed057aa commit f0939c5

18 files changed

+166
-162
lines changed

Source/WebCore/bindings/js/JSDOMWindowProperties.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ static bool jsDOMWindowPropertiesGetOwnPropertySlotNamedItemGetter(JSDOMWindowPr
5959
auto* document = window.document();
6060
if (is<HTMLDocument>(document)) {
6161
auto& htmlDocument = downcast<HTMLDocument>(*document);
62-
auto* atomicPropertyName = propertyName.publicName();
63-
if (atomicPropertyName && htmlDocument.hasWindowNamedItem(*atomicPropertyName)) {
62+
AtomString atomPropertyName = propertyName.publicName();
63+
if (!atomPropertyName.isEmpty() && htmlDocument.hasWindowNamedItem(atomPropertyName)) {
6464
JSValue namedItem;
65-
if (UNLIKELY(htmlDocument.windowNamedItemContainsMultipleElements(*atomicPropertyName))) {
66-
Ref<HTMLCollection> collection = document->windowNamedItems(atomicPropertyName);
65+
if (UNLIKELY(htmlDocument.windowNamedItemContainsMultipleElements(atomPropertyName))) {
66+
Ref<HTMLCollection> collection = document->windowNamedItems(atomPropertyName);
6767
ASSERT(collection->length() > 1);
6868
namedItem = toJS(lexicalGlobalObject, thisObject->globalObject(), collection);
6969
} else
70-
namedItem = toJS(lexicalGlobalObject, thisObject->globalObject(), htmlDocument.windowNamedItem(*atomicPropertyName).get());
70+
namedItem = toJS(lexicalGlobalObject, thisObject->globalObject(), htmlDocument.windowNamedItem(atomPropertyName).get());
7171
slot.setValue(thisObject, static_cast<unsigned>(PropertyAttribute::DontEnum), namedItem);
7272
return true;
7373
}

Source/WebCore/dom/Element.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2684,14 +2684,14 @@ Node::InsertedIntoAncestorResult Element::insertedIntoAncestor(InsertionType ins
26842684

26852685
if (auto& idValue = getIdAttribute(); !idValue.isEmpty()) {
26862686
if (newScope)
2687-
newScope->addElementById(*idValue.impl(), *this);
2687+
newScope->addElementById(idValue, *this);
26882688
if (newDocument)
26892689
updateIdForDocument(*newDocument, nullAtom(), idValue, HTMLDocumentNamedItemMapsUpdatingCondition::Always);
26902690
}
26912691

26922692
if (auto& nameValue = getNameAttribute(); !nameValue.isEmpty()) {
26932693
if (newScope)
2694-
newScope->addElementByName(*nameValue.impl(), *this);
2694+
newScope->addElementByName(nameValue, *this);
26952695
if (newDocument)
26962696
updateNameForDocument(*newDocument, nullAtom(), nameValue);
26972697
}
@@ -2771,14 +2771,14 @@ void Element::removedFromAncestor(RemovalType removalType, ContainerNode& oldPar
27712771

27722772
if (auto& idValue = getIdAttribute(); !idValue.isEmpty()) {
27732773
if (oldScope)
2774-
oldScope->removeElementById(*idValue.impl(), *this);
2774+
oldScope->removeElementById(idValue, *this);
27752775
if (oldHTMLDocument)
27762776
updateIdForDocument(*oldHTMLDocument, idValue, nullAtom(), HTMLDocumentNamedItemMapsUpdatingCondition::Always);
27772777
}
27782778

27792779
if (auto& nameValue = getNameAttribute(); !nameValue.isEmpty()) {
27802780
if (oldScope)
2781-
oldScope->removeElementByName(*nameValue.impl(), *this);
2781+
oldScope->removeElementByName(nameValue, *this);
27822782
if (oldHTMLDocument)
27832783
updateNameForDocument(*oldHTMLDocument, nameValue, nullAtom());
27842784
}
@@ -4748,9 +4748,9 @@ void Element::updateNameForTreeScope(TreeScope& scope, const AtomString& oldName
47484748
ASSERT(oldName != newName);
47494749

47504750
if (!oldName.isEmpty())
4751-
scope.removeElementByName(*oldName.impl(), *this);
4751+
scope.removeElementByName(oldName, *this);
47524752
if (!newName.isEmpty())
4753-
scope.addElementByName(*newName.impl(), *this);
4753+
scope.addElementByName(newName, *this);
47544754
}
47554755

47564756
void Element::updateNameForDocument(HTMLDocument& document, const AtomString& oldName, const AtomString& newName)
@@ -4763,17 +4763,17 @@ void Element::updateNameForDocument(HTMLDocument& document, const AtomString& ol
47634763
if (WindowNameCollection::elementMatchesIfNameAttributeMatch(*this)) {
47644764
const AtomString& id = WindowNameCollection::elementMatchesIfIdAttributeMatch(*this) ? getIdAttribute() : nullAtom();
47654765
if (!oldName.isEmpty() && oldName != id)
4766-
document.removeWindowNamedItem(*oldName.impl(), *this);
4766+
document.removeWindowNamedItem(oldName, *this);
47674767
if (!newName.isEmpty() && newName != id)
4768-
document.addWindowNamedItem(*newName.impl(), *this);
4768+
document.addWindowNamedItem(newName, *this);
47694769
}
47704770

47714771
if (DocumentNameCollection::elementMatchesIfNameAttributeMatch(*this)) {
47724772
const AtomString& id = DocumentNameCollection::elementMatchesIfIdAttributeMatch(*this) ? getIdAttribute() : nullAtom();
47734773
if (!oldName.isEmpty() && oldName != id)
4774-
document.removeDocumentNamedItem(*oldName.impl(), *this);
4774+
document.removeDocumentNamedItem(oldName, *this);
47754775
if (!newName.isEmpty() && newName != id)
4776-
document.addDocumentNamedItem(*newName.impl(), *this);
4776+
document.addDocumentNamedItem(newName, *this);
47774777
}
47784778
}
47794779

@@ -4800,9 +4800,9 @@ void Element::updateIdForTreeScope(TreeScope& scope, const AtomString& oldId, co
48004800
ASSERT(oldId != newId);
48014801

48024802
if (!oldId.isEmpty())
4803-
scope.removeElementById(*oldId.impl(), *this, notifyObservers == NotifyObservers::Yes);
4803+
scope.removeElementById(oldId, *this, notifyObservers == NotifyObservers::Yes);
48044804
if (!newId.isEmpty())
4805-
scope.addElementById(*newId.impl(), *this, notifyObservers == NotifyObservers::Yes);
4805+
scope.addElementById(newId, *this, notifyObservers == NotifyObservers::Yes);
48064806
}
48074807

48084808
void Element::updateIdForDocument(HTMLDocument& document, const AtomString& oldId, const AtomString& newId, HTMLDocumentNamedItemMapsUpdatingCondition condition)
@@ -4816,17 +4816,17 @@ void Element::updateIdForDocument(HTMLDocument& document, const AtomString& oldI
48164816
if (WindowNameCollection::elementMatchesIfIdAttributeMatch(*this)) {
48174817
const AtomString& name = condition == HTMLDocumentNamedItemMapsUpdatingCondition::UpdateOnlyIfDiffersFromNameAttribute && WindowNameCollection::elementMatchesIfNameAttributeMatch(*this) ? getNameAttribute() : nullAtom();
48184818
if (!oldId.isEmpty() && oldId != name)
4819-
document.removeWindowNamedItem(*oldId.impl(), *this);
4819+
document.removeWindowNamedItem(oldId, *this);
48204820
if (!newId.isEmpty() && newId != name)
4821-
document.addWindowNamedItem(*newId.impl(), *this);
4821+
document.addWindowNamedItem(newId, *this);
48224822
}
48234823

48244824
if (DocumentNameCollection::elementMatchesIfIdAttributeMatch(*this)) {
48254825
const AtomString& name = condition == HTMLDocumentNamedItemMapsUpdatingCondition::UpdateOnlyIfDiffersFromNameAttribute && DocumentNameCollection::elementMatchesIfNameAttributeMatch(*this) ? getNameAttribute() : nullAtom();
48264826
if (!oldId.isEmpty() && oldId != name)
4827-
document.removeDocumentNamedItem(*oldId.impl(), *this);
4827+
document.removeDocumentNamedItem(oldId, *this);
48284828
if (!newId.isEmpty() && newId != name)
4829-
document.addDocumentNamedItem(*newId.impl(), *this);
4829+
document.addDocumentNamedItem(newId, *this);
48304830
}
48314831
}
48324832

@@ -4841,9 +4841,9 @@ void Element::updateLabel(TreeScope& scope, const AtomString& oldForAttributeVal
48414841
return;
48424842

48434843
if (!oldForAttributeValue.isEmpty())
4844-
scope.removeLabel(*oldForAttributeValue.impl(), downcast<HTMLLabelElement>(*this));
4844+
scope.removeLabel(oldForAttributeValue, downcast<HTMLLabelElement>(*this));
48454845
if (!newForAttributeValue.isEmpty())
4846-
scope.addLabel(*newForAttributeValue.impl(), downcast<HTMLLabelElement>(*this));
4846+
scope.addLabel(newForAttributeValue, downcast<HTMLLabelElement>(*this));
48474847
}
48484848

48494849
void Element::willModifyAttribute(const QualifiedName& name, const AtomString& oldValue, const AtomString& newValue)

Source/WebCore/dom/ImageOverlay.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ bool hasOverlay(const HTMLElement& element)
112112
if (LIKELY(!shadowRoot || shadowRoot->mode() != ShadowRootMode::UserAgent))
113113
return false;
114114

115-
return shadowRoot->hasElementWithId(*imageOverlayElementIdentifier().impl());
115+
return shadowRoot->hasElementWithId(imageOverlayElementIdentifier());
116116
}
117117

118118
static RefPtr<HTMLElement> imageOverlayHost(const Node& node)

Source/WebCore/dom/TreeScope.cpp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,16 @@ RefPtr<Element> TreeScope::getElementById(const AtomString& elementId) const
113113
return nullptr;
114114
if (!m_elementsById)
115115
return nullptr;
116-
return m_elementsById->getElementById(*elementId.impl(), *this);
116+
return m_elementsById->getElementById(elementId, *this);
117117
}
118118

119119
RefPtr<Element> TreeScope::getElementById(const String& elementId) const
120120
{
121121
if (!m_elementsById)
122122
return nullptr;
123123

124-
if (auto atomElementId = AtomStringImpl::lookUp(elementId.impl()))
125-
return m_elementsById->getElementById(*atomElementId, *this);
124+
if (auto atomElementId = elementId.toExistingAtomString(); !atomElementId.isNull())
125+
return m_elementsById->getElementById(atomElementId, *this);
126126

127127
return nullptr;
128128
}
@@ -133,7 +133,7 @@ RefPtr<Element> TreeScope::getElementById(StringView elementId) const
133133
return nullptr;
134134

135135
if (auto atomElementId = elementId.toExistingAtomString(); !atomElementId.isNull())
136-
return m_elementsById->getElementById(*atomElementId.impl(), *this);
136+
return m_elementsById->getElementById(atomElementId, *this);
137137

138138
return nullptr;
139139
}
@@ -144,10 +144,10 @@ const Vector<CheckedRef<Element>>* TreeScope::getAllElementsById(const AtomStrin
144144
return nullptr;
145145
if (!m_elementsById)
146146
return nullptr;
147-
return m_elementsById->getAllElementsById(*elementId.impl(), *this);
147+
return m_elementsById->getAllElementsById(elementId, *this);
148148
}
149149

150-
void TreeScope::addElementById(const AtomStringImpl& elementId, Element& element, bool notifyObservers)
150+
void TreeScope::addElementById(const AtomString& elementId, Element& element, bool notifyObservers)
151151
{
152152
if (!m_elementsById)
153153
m_elementsById = makeUnique<TreeScopeOrderedMap>();
@@ -156,7 +156,7 @@ void TreeScope::addElementById(const AtomStringImpl& elementId, Element& element
156156
m_idTargetObserverRegistry->notifyObservers(elementId);
157157
}
158158

159-
void TreeScope::removeElementById(const AtomStringImpl& elementId, Element& element, bool notifyObservers)
159+
void TreeScope::removeElementById(const AtomString& elementId, Element& element, bool notifyObservers)
160160
{
161161
if (!m_elementsById)
162162
return;
@@ -171,17 +171,17 @@ RefPtr<Element> TreeScope::getElementByName(const AtomString& name) const
171171
return nullptr;
172172
if (!m_elementsByName)
173173
return nullptr;
174-
return m_elementsByName->getElementByName(*name.impl(), *this);
174+
return m_elementsByName->getElementByName(name, *this);
175175
}
176176

177-
void TreeScope::addElementByName(const AtomStringImpl& name, Element& element)
177+
void TreeScope::addElementByName(const AtomString& name, Element& element)
178178
{
179179
if (!m_elementsByName)
180180
m_elementsByName = makeUnique<TreeScopeOrderedMap>();
181181
m_elementsByName->add(name, element, *this);
182182
}
183183

184-
void TreeScope::removeElementByName(const AtomStringImpl& name, Element& element)
184+
void TreeScope::removeElementByName(const AtomString& name, Element& element)
185185
{
186186
if (!m_elementsByName)
187187
return;
@@ -244,59 +244,59 @@ Element* TreeScope::ancestorElementInThisScope(Element* element) const
244244

245245
void TreeScope::addImageMap(HTMLMapElement& imageMap)
246246
{
247-
AtomStringImpl* name = imageMap.getName().impl();
248-
if (!name)
247+
auto name = imageMap.getName();
248+
if (name.isNull())
249249
return;
250250
if (!m_imageMapsByName)
251251
m_imageMapsByName = makeUnique<TreeScopeOrderedMap>();
252-
m_imageMapsByName->add(*name, imageMap, *this);
252+
m_imageMapsByName->add(name, imageMap, *this);
253253
}
254254

255255
void TreeScope::removeImageMap(HTMLMapElement& imageMap)
256256
{
257257
if (!m_imageMapsByName)
258258
return;
259-
AtomStringImpl* name = imageMap.getName().impl();
260-
if (!name)
259+
auto name = imageMap.getName();
260+
if (name.isNull())
261261
return;
262-
m_imageMapsByName->remove(*name, imageMap);
262+
m_imageMapsByName->remove(name, imageMap);
263263
}
264264

265265
RefPtr<HTMLMapElement> TreeScope::getImageMap(const AtomString& name) const
266266
{
267-
if (!m_imageMapsByName || !name.impl())
267+
if (!m_imageMapsByName || name.isNull())
268268
return nullptr;
269-
return m_imageMapsByName->getElementByMapName(*name.impl(), *this);
269+
return m_imageMapsByName->getElementByMapName(name, *this);
270270
}
271271

272-
void TreeScope::addImageElementByUsemap(const AtomStringImpl& name, HTMLImageElement& element)
272+
void TreeScope::addImageElementByUsemap(const AtomString& name, HTMLImageElement& element)
273273
{
274274
if (!m_imagesByUsemap)
275275
m_imagesByUsemap = makeUnique<TreeScopeOrderedMap>();
276276
return m_imagesByUsemap->add(name, element, *this);
277277
}
278278

279-
void TreeScope::removeImageElementByUsemap(const AtomStringImpl& name, HTMLImageElement& element)
279+
void TreeScope::removeImageElementByUsemap(const AtomString& name, HTMLImageElement& element)
280280
{
281281
if (!m_imagesByUsemap)
282282
return;
283283
m_imagesByUsemap->remove(name, element);
284284
}
285285

286-
RefPtr<HTMLImageElement> TreeScope::imageElementByUsemap(const AtomStringImpl& name) const
286+
RefPtr<HTMLImageElement> TreeScope::imageElementByUsemap(const AtomString& name) const
287287
{
288288
if (!m_imagesByUsemap)
289289
return nullptr;
290290
return m_imagesByUsemap->getElementByUsemap(name, *this);
291291
}
292292

293-
void TreeScope::addLabel(const AtomStringImpl& forAttributeValue, HTMLLabelElement& element)
293+
void TreeScope::addLabel(const AtomString& forAttributeValue, HTMLLabelElement& element)
294294
{
295295
ASSERT(m_labelsByForAttribute);
296296
m_labelsByForAttribute->add(forAttributeValue, element, *this);
297297
}
298298

299-
void TreeScope::removeLabel(const AtomStringImpl& forAttributeValue, HTMLLabelElement& element)
299+
void TreeScope::removeLabel(const AtomString& forAttributeValue, HTMLLabelElement& element)
300300
{
301301
ASSERT(m_labelsByForAttribute);
302302
m_labelsByForAttribute->remove(forAttributeValue, element);
@@ -314,11 +314,11 @@ const Vector<CheckedRef<Element>>* TreeScope::labelElementsForId(const AtomStrin
314314
for (auto& label : descendantsOfType<HTMLLabelElement>(m_rootNode)) {
315315
const AtomString& forValue = label.attributeWithoutSynchronization(forAttr);
316316
if (!forValue.isEmpty())
317-
addLabel(*forValue.impl(), label);
317+
addLabel(forValue, label);
318318
}
319319
}
320320

321-
return m_labelsByForAttribute->getElementsByLabelForAttribute(*forAttributeValue.impl(), *this);
321+
return m_labelsByForAttribute->getElementsByLabelForAttribute(forAttributeValue, *this);
322322
}
323323

324324
static std::optional<LayoutPoint> absolutePointIfNotClipped(Document& document, const LayoutPoint& clientPoint)

Source/WebCore/dom/TreeScope.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,16 @@ class TreeScope {
7474
WEBCORE_EXPORT RefPtr<Element> getElementById(const String&) const;
7575
RefPtr<Element> getElementById(StringView) const;
7676
const Vector<CheckedRef<Element>>* getAllElementsById(const AtomString&) const;
77-
inline bool hasElementWithId(const AtomStringImpl&) const; // Defined in TreeScopeInlines.h.
77+
inline bool hasElementWithId(const AtomString&) const; // Defined in TreeScopeInlines.h.
7878
inline bool containsMultipleElementsWithId(const AtomString& id) const; // Defined in TreeScopeInlines.h.
79-
void addElementById(const AtomStringImpl& elementId, Element&, bool notifyObservers = true);
80-
void removeElementById(const AtomStringImpl& elementId, Element&, bool notifyObservers = true);
79+
void addElementById(const AtomString& elementId, Element&, bool notifyObservers = true);
80+
void removeElementById(const AtomString& elementId, Element&, bool notifyObservers = true);
8181

8282
WEBCORE_EXPORT RefPtr<Element> getElementByName(const AtomString&) const;
83-
inline bool hasElementWithName(const AtomStringImpl&) const; // Defined in TreeScopeInlines.h.
83+
inline bool hasElementWithName(const AtomString&) const; // Defined in TreeScopeInlines.h.
8484
inline bool containsMultipleElementsWithName(const AtomString&) const; // Defined in TreeScopeInlines.h.
85-
void addElementByName(const AtomStringImpl&, Element&);
86-
void removeElementByName(const AtomStringImpl&, Element&);
85+
void addElementByName(const AtomString&, Element&);
86+
void removeElementByName(const AtomString&, Element&);
8787

8888
Document& documentScope() const { return m_documentScope.get(); }
8989
Ref<Document> protectedDocumentScope() const;
@@ -99,14 +99,14 @@ class TreeScope {
9999
void removeImageMap(HTMLMapElement&);
100100
RefPtr<HTMLMapElement> getImageMap(const AtomString&) const;
101101

102-
void addImageElementByUsemap(const AtomStringImpl&, HTMLImageElement&);
103-
void removeImageElementByUsemap(const AtomStringImpl&, HTMLImageElement&);
104-
RefPtr<HTMLImageElement> imageElementByUsemap(const AtomStringImpl&) const;
102+
void addImageElementByUsemap(const AtomString&, HTMLImageElement&);
103+
void removeImageElementByUsemap(const AtomString&, HTMLImageElement&);
104+
RefPtr<HTMLImageElement> imageElementByUsemap(const AtomString&) const;
105105

106106
// For accessibility.
107107
bool shouldCacheLabelsByForAttribute() const { return !!m_labelsByForAttribute; }
108-
void addLabel(const AtomStringImpl& forAttributeValue, HTMLLabelElement&);
109-
void removeLabel(const AtomStringImpl& forAttributeValue, HTMLLabelElement&);
108+
void addLabel(const AtomString& forAttributeValue, HTMLLabelElement&);
109+
void removeLabel(const AtomString& forAttributeValue, HTMLLabelElement&);
110110
const Vector<CheckedRef<Element>>* labelElementsForId(const AtomString& forAttributeValue);
111111

112112
WEBCORE_EXPORT RefPtr<Element> elementFromPoint(double clientX, double clientY);

Source/WebCore/dom/TreeScopeInlines.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,24 @@
2929

3030
namespace WebCore {
3131

32-
inline bool TreeScope::hasElementWithId(const AtomStringImpl& id) const
32+
inline bool TreeScope::hasElementWithId(const AtomString& id) const
3333
{
3434
return m_elementsById && m_elementsById->contains(id);
3535
}
3636

3737
inline bool TreeScope::containsMultipleElementsWithId(const AtomString& id) const
3838
{
39-
return m_elementsById && id.impl() && m_elementsById->containsMultiple(*id.impl());
39+
return m_elementsById && !id.isEmpty() && m_elementsById->containsMultiple(id);
4040
}
4141

42-
inline bool TreeScope::hasElementWithName(const AtomStringImpl& id) const
42+
inline bool TreeScope::hasElementWithName(const AtomString& id) const
4343
{
4444
return m_elementsByName && m_elementsByName->contains(id);
4545
}
4646

4747
inline bool TreeScope::containsMultipleElementsWithName(const AtomString& name) const
4848
{
49-
return m_elementsByName && name.impl() && m_elementsByName->containsMultiple(*name.impl());
49+
return m_elementsByName && !name.isEmpty() && m_elementsByName->containsMultiple(name);
5050
}
5151

5252
} // namespace WebCore

0 commit comments

Comments
 (0)