OLD | NEW |
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 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. |
8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 #include "core/frame/UseCounter.h" | 82 #include "core/frame/UseCounter.h" |
83 #include "core/frame/csp/ContentSecurityPolicy.h" | 83 #include "core/frame/csp/ContentSecurityPolicy.h" |
84 #include "core/html/ClassList.h" | 84 #include "core/html/ClassList.h" |
85 #include "core/html/HTMLCanvasElement.h" | 85 #include "core/html/HTMLCanvasElement.h" |
86 #include "core/html/HTMLCollection.h" | 86 #include "core/html/HTMLCollection.h" |
87 #include "core/html/HTMLDocument.h" | 87 #include "core/html/HTMLDocument.h" |
88 #include "core/html/HTMLElement.h" | 88 #include "core/html/HTMLElement.h" |
89 #include "core/html/HTMLFormControlsCollection.h" | 89 #include "core/html/HTMLFormControlsCollection.h" |
90 #include "core/html/HTMLFrameElementBase.h" | 90 #include "core/html/HTMLFrameElementBase.h" |
91 #include "core/html/HTMLFrameOwnerElement.h" | 91 #include "core/html/HTMLFrameOwnerElement.h" |
92 #include "core/html/HTMLLabelElement.h" | |
93 #include "core/html/HTMLOptionsCollection.h" | 92 #include "core/html/HTMLOptionsCollection.h" |
94 #include "core/html/HTMLTableRowsCollection.h" | 93 #include "core/html/HTMLTableRowsCollection.h" |
95 #include "core/html/HTMLTemplateElement.h" | 94 #include "core/html/HTMLTemplateElement.h" |
96 #include "core/html/parser/HTMLParserIdioms.h" | 95 #include "core/html/parser/HTMLParserIdioms.h" |
97 #include "core/inspector/InspectorInstrumentation.h" | 96 #include "core/inspector/InspectorInstrumentation.h" |
98 #include "core/page/Chrome.h" | 97 #include "core/page/Chrome.h" |
99 #include "core/page/ChromeClient.h" | 98 #include "core/page/ChromeClient.h" |
100 #include "core/page/FocusController.h" | 99 #include "core/page/FocusController.h" |
101 #include "core/page/Page.h" | 100 #include "core/page/Page.h" |
102 #include "core/page/PointerLockController.h" | 101 #include "core/page/PointerLockController.h" |
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 return InsertionDone; | 1292 return InsertionDone; |
1294 | 1293 |
1295 const AtomicString& idValue = getIdAttribute(); | 1294 const AtomicString& idValue = getIdAttribute(); |
1296 if (!idValue.isNull()) | 1295 if (!idValue.isNull()) |
1297 updateId(scope, nullAtom, idValue); | 1296 updateId(scope, nullAtom, idValue); |
1298 | 1297 |
1299 const AtomicString& nameValue = getNameAttribute(); | 1298 const AtomicString& nameValue = getNameAttribute(); |
1300 if (!nameValue.isNull()) | 1299 if (!nameValue.isNull()) |
1301 updateName(nullAtom, nameValue); | 1300 updateName(nullAtom, nameValue); |
1302 | 1301 |
1303 if (isHTMLLabelElement(*this)) { | |
1304 if (scope.shouldCacheLabelsByForAttribute()) | |
1305 updateLabel(scope, nullAtom, fastGetAttribute(forAttr)); | |
1306 } | |
1307 | |
1308 if (parentElement() && parentElement()->isInCanvasSubtree()) | 1302 if (parentElement() && parentElement()->isInCanvasSubtree()) |
1309 setIsInCanvasSubtree(true); | 1303 setIsInCanvasSubtree(true); |
1310 | 1304 |
1311 return InsertionDone; | 1305 return InsertionDone; |
1312 } | 1306 } |
1313 | 1307 |
1314 void Element::removedFrom(ContainerNode* insertionPoint) | 1308 void Element::removedFrom(ContainerNode* insertionPoint) |
1315 { | 1309 { |
1316 bool wasInDocument = insertionPoint->inDocument(); | 1310 bool wasInDocument = insertionPoint->inDocument(); |
1317 | 1311 |
1318 ASSERT(!hasRareData() || !elementRareData()->hasPseudoElements()); | 1312 ASSERT(!hasRareData() || !elementRareData()->hasPseudoElements()); |
1319 | 1313 |
1320 if (containsFullScreenElement()) | 1314 if (containsFullScreenElement()) |
1321 setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false); | 1315 setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false); |
1322 | 1316 |
1323 if (document().page()) | 1317 if (document().page()) |
1324 document().page()->pointerLockController().elementRemoved(this); | 1318 document().page()->pointerLockController().elementRemoved(this); |
1325 | 1319 |
1326 setSavedLayerScrollOffset(IntSize()); | 1320 setSavedLayerScrollOffset(IntSize()); |
1327 | 1321 |
1328 if (insertionPoint->isInTreeScope() && treeScope() == document()) { | 1322 if (insertionPoint->isInTreeScope() && treeScope() == document()) { |
1329 const AtomicString& idValue = getIdAttribute(); | 1323 const AtomicString& idValue = getIdAttribute(); |
1330 if (!idValue.isNull()) | 1324 if (!idValue.isNull()) |
1331 updateId(insertionPoint->treeScope(), idValue, nullAtom); | 1325 updateId(insertionPoint->treeScope(), idValue, nullAtom); |
1332 | 1326 |
1333 const AtomicString& nameValue = getNameAttribute(); | 1327 const AtomicString& nameValue = getNameAttribute(); |
1334 if (!nameValue.isNull()) | 1328 if (!nameValue.isNull()) |
1335 updateName(nameValue, nullAtom); | 1329 updateName(nameValue, nullAtom); |
1336 | |
1337 if (isHTMLLabelElement(*this)) { | |
1338 TreeScope& treeScope = insertionPoint->treeScope(); | |
1339 if (treeScope.shouldCacheLabelsByForAttribute()) | |
1340 updateLabel(treeScope, fastGetAttribute(forAttr), nullAtom); | |
1341 } | |
1342 } | 1330 } |
1343 | 1331 |
1344 ContainerNode::removedFrom(insertionPoint); | 1332 ContainerNode::removedFrom(insertionPoint); |
1345 if (wasInDocument) { | 1333 if (wasInDocument) { |
1346 if (hasPendingResources()) | 1334 if (hasPendingResources()) |
1347 document().accessSVGExtensions().removeElementFromPendingResources(t
his); | 1335 document().accessSVGExtensions().removeElementFromPendingResources(t
his); |
1348 | 1336 |
1349 if (isUpgradedCustomElement()) | 1337 if (isUpgradedCustomElement()) |
1350 CustomElement::didLeaveDocument(this, insertionPoint->document()); | 1338 CustomElement::didLeaveDocument(this, insertionPoint->document()); |
1351 } | 1339 } |
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2834 | 2822 |
2835 if (!oldId.isEmpty()) | 2823 if (!oldId.isEmpty()) |
2836 scope.removeElementById(oldId, this); | 2824 scope.removeElementById(oldId, this); |
2837 if (!newId.isEmpty()) | 2825 if (!newId.isEmpty()) |
2838 scope.addElementById(newId, this); | 2826 scope.addElementById(newId, this); |
2839 | 2827 |
2840 if (shouldRegisterAsExtraNamedItem()) | 2828 if (shouldRegisterAsExtraNamedItem()) |
2841 updateExtraNamedItemRegistration(oldId, newId); | 2829 updateExtraNamedItemRegistration(oldId, newId); |
2842 } | 2830 } |
2843 | 2831 |
2844 void Element::updateLabel(TreeScope& scope, const AtomicString& oldForAttributeV
alue, const AtomicString& newForAttributeValue) | |
2845 { | |
2846 ASSERT(isHTMLLabelElement(this)); | |
2847 | |
2848 if (!inDocument()) | |
2849 return; | |
2850 | |
2851 if (oldForAttributeValue == newForAttributeValue) | |
2852 return; | |
2853 | |
2854 if (!oldForAttributeValue.isEmpty()) | |
2855 scope.removeLabel(oldForAttributeValue, toHTMLLabelElement(this)); | |
2856 if (!newForAttributeValue.isEmpty()) | |
2857 scope.addLabel(newForAttributeValue, toHTMLLabelElement(this)); | |
2858 } | |
2859 | |
2860 void Element::willModifyAttribute(const QualifiedName& name, const AtomicString&
oldValue, const AtomicString& newValue) | 2832 void Element::willModifyAttribute(const QualifiedName& name, const AtomicString&
oldValue, const AtomicString& newValue) |
2861 { | 2833 { |
2862 if (isIdAttributeName(name)) { | 2834 if (isIdAttributeName(name)) { |
2863 updateId(oldValue, newValue); | 2835 updateId(oldValue, newValue); |
2864 } else if (name == HTMLNames::nameAttr) { | 2836 } else if (name == HTMLNames::nameAttr) { |
2865 updateName(oldValue, newValue); | 2837 updateName(oldValue, newValue); |
2866 } else if (name == HTMLNames::forAttr && isHTMLLabelElement(*this)) { | |
2867 TreeScope& scope = treeScope(); | |
2868 if (scope.shouldCacheLabelsByForAttribute()) | |
2869 updateLabel(scope, oldValue, newValue); | |
2870 } | 2838 } |
2871 | 2839 |
2872 if (oldValue != newValue) { | 2840 if (oldValue != newValue) { |
2873 if (inActiveDocument() && document().styleResolver() && styleChangeType(
) < SubtreeStyleChange) | 2841 if (inActiveDocument() && document().styleResolver() && styleChangeType(
) < SubtreeStyleChange) |
2874 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForAttributeChange(name, *this); | 2842 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForAttributeChange(name, *this); |
2875 | 2843 |
2876 if (isUpgradedCustomElement()) | 2844 if (isUpgradedCustomElement()) |
2877 CustomElement::attributeDidChange(this, name.localName(), oldValue,
newValue); | 2845 CustomElement::attributeDidChange(this, name.localName(), oldValue,
newValue); |
2878 } | 2846 } |
2879 | 2847 |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3367 { | 3335 { |
3368 #if ENABLE(OILPAN) | 3336 #if ENABLE(OILPAN) |
3369 if (hasRareData()) | 3337 if (hasRareData()) |
3370 visitor->trace(elementRareData()); | 3338 visitor->trace(elementRareData()); |
3371 visitor->trace(m_elementData); | 3339 visitor->trace(m_elementData); |
3372 #endif | 3340 #endif |
3373 ContainerNode::trace(visitor); | 3341 ContainerNode::trace(visitor); |
3374 } | 3342 } |
3375 | 3343 |
3376 } // namespace blink | 3344 } // namespace blink |
OLD | NEW |