Index: Source/core/dom/Element.cpp |
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp |
index 02518c5bcfad6a3e0e43c5279e4d700cd817c74a..feee846aac1631bd81fb52401e31a962cc8e2ccf 100644 |
--- a/Source/core/dom/Element.cpp |
+++ b/Source/core/dom/Element.cpp |
@@ -1237,8 +1237,8 @@ Node::InsertionNotificationRequest Element::insertedInto(ContainerNode* insertio |
if (isUpgradedCustomElement() && inDocument()) |
CustomElement::didEnterDocument(this, document()); |
- TreeScope& scope = insertionPoint->treeScope(); |
- if (&scope != &treeScope()) |
+ NonNullPtr<TreeScope> scope = insertionPoint->treeScope(); |
+ if (scope != treeScope()) |
return InsertionDone; |
const AtomicString& idValue = getIdAttribute(); |
@@ -1250,7 +1250,7 @@ Node::InsertionNotificationRequest Element::insertedInto(ContainerNode* insertio |
updateName(nullAtom, nameValue); |
if (hasTagName(labelTag)) { |
- if (scope.shouldCacheLabelsByForAttribute()) |
+ if (scope->shouldCacheLabelsByForAttribute()) |
updateLabel(scope, nullAtom, fastGetAttribute(forAttr)); |
} |
@@ -1282,7 +1282,7 @@ void Element::removedFrom(ContainerNode* insertionPoint) |
setSavedLayerScrollOffset(IntSize()); |
- if (insertionPoint->isInTreeScope() && &treeScope() == &document()) { |
+ if (insertionPoint->isInTreeScope() && treeScope() == &document()) { |
const AtomicString& idValue = getIdAttribute(); |
if (!idValue.isNull()) |
updateId(insertionPoint->treeScope(), idValue, nullAtom); |
@@ -1292,8 +1292,8 @@ void Element::removedFrom(ContainerNode* insertionPoint) |
updateName(nameValue, nullAtom); |
if (hasTagName(labelTag)) { |
- TreeScope& treeScope = insertionPoint->treeScope(); |
- if (treeScope.shouldCacheLabelsByForAttribute()) |
+ NonNullPtr<TreeScope> treeScope = insertionPoint->treeScope(); |
+ if (treeScope->shouldCacheLabelsByForAttribute()) |
updateLabel(treeScope, fastGetAttribute(forAttr), nullAtom); |
} |
} |
@@ -1843,7 +1843,7 @@ PassRefPtr<Attr> Element::setAttributeNode(Attr* attrNode, ExceptionState& es) |
setAttributeInternal(index, attrNode->qualifiedName(), attrNode->value(), NotInSynchronizationOfLazyAttribute); |
attrNode->attachToElement(this); |
- treeScope().adoptIfNeeded(attrNode); |
+ treeScope()->adoptIfNeeded(attrNode); |
ensureAttrNodeListForElement(this)->append(attrNode); |
return oldAttrNode.release(); |
@@ -2067,7 +2067,7 @@ void Element::updateFocusAppearance(bool /*restorePreviousSelection*/) |
void Element::blur() |
{ |
cancelFocusAppearanceUpdate(); |
- if (treeScope().adjustedFocusedElement() == this) { |
+ if (treeScope()->adjustedFocusedElement() == this) { |
Document& doc = document(); |
if (doc.page()) |
doc.page()->focusController().setFocusedElement(0, doc.frame()); |
@@ -2774,21 +2774,21 @@ inline void Element::updateId(const AtomicString& oldId, const AtomicString& new |
updateId(treeScope(), oldId, newId); |
} |
-inline void Element::updateId(TreeScope& scope, const AtomicString& oldId, const AtomicString& newId) |
+inline void Element::updateId(NonNullPtr<TreeScope> scope, const AtomicString& oldId, const AtomicString& newId) |
{ |
ASSERT(isInTreeScope()); |
ASSERT(oldId != newId); |
if (!oldId.isEmpty()) |
- scope.removeElementById(oldId, this); |
+ scope->removeElementById(oldId, this); |
if (!newId.isEmpty()) |
- scope.addElementById(newId, this); |
+ scope->addElementById(newId, this); |
if (shouldRegisterAsExtraNamedItem()) |
updateExtraNamedItemRegistration(oldId, newId); |
} |
-void Element::updateLabel(TreeScope& scope, const AtomicString& oldForAttributeValue, const AtomicString& newForAttributeValue) |
+void Element::updateLabel(NonNullPtr<TreeScope> scope, const AtomicString& oldForAttributeValue, const AtomicString& newForAttributeValue) |
{ |
ASSERT(hasTagName(labelTag)); |
@@ -2799,9 +2799,9 @@ void Element::updateLabel(TreeScope& scope, const AtomicString& oldForAttributeV |
return; |
if (!oldForAttributeValue.isEmpty()) |
- scope.removeLabel(oldForAttributeValue, toHTMLLabelElement(this)); |
+ scope->removeLabel(oldForAttributeValue, toHTMLLabelElement(this)); |
if (!newForAttributeValue.isEmpty()) |
- scope.addLabel(newForAttributeValue, toHTMLLabelElement(this)); |
+ scope->addLabel(newForAttributeValue, toHTMLLabelElement(this)); |
} |
static bool hasSelectorForAttribute(Document* document, const AtomicString& localName) |
@@ -2816,8 +2816,8 @@ void Element::willModifyAttribute(const QualifiedName& name, const AtomicString& |
else if (name == HTMLNames::nameAttr) |
updateName(oldValue, newValue); |
else if (name == HTMLNames::forAttr && hasTagName(labelTag)) { |
- TreeScope& scope = treeScope(); |
- if (scope.shouldCacheLabelsByForAttribute()) |
+ NonNullPtr<TreeScope> scope = treeScope(); |
+ if (scope->shouldCacheLabelsByForAttribute()) |
updateLabel(scope, oldValue, newValue); |
} |
@@ -2959,7 +2959,7 @@ PassRefPtr<Attr> Element::ensureAttr(const QualifiedName& name) |
RefPtr<Attr> attrNode = findAttrNodeInList(attrNodeList, name); |
if (!attrNode) { |
attrNode = Attr::create(*this, name); |
- treeScope().adoptIfNeeded(attrNode.get()); |
+ treeScope()->adoptIfNeeded(attrNode.get()); |
attrNodeList->append(attrNode); |
} |
return attrNode.release(); |