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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 #include "core/dom/ScriptableDocumentParser.h" | 71 #include "core/dom/ScriptableDocumentParser.h" |
72 #include "core/dom/SelectorQuery.h" | 72 #include "core/dom/SelectorQuery.h" |
73 #include "core/dom/StyleChangeReason.h" | 73 #include "core/dom/StyleChangeReason.h" |
74 #include "core/dom/StyleEngine.h" | 74 #include "core/dom/StyleEngine.h" |
75 #include "core/dom/Text.h" | 75 #include "core/dom/Text.h" |
76 #include "core/dom/custom/V0CustomElement.h" | 76 #include "core/dom/custom/V0CustomElement.h" |
77 #include "core/dom/custom/V0CustomElementRegistrationContext.h" | 77 #include "core/dom/custom/V0CustomElementRegistrationContext.h" |
78 #include "core/dom/shadow/InsertionPoint.h" | 78 #include "core/dom/shadow/InsertionPoint.h" |
79 #include "core/dom/shadow/ShadowRoot.h" | 79 #include "core/dom/shadow/ShadowRoot.h" |
80 #include "core/dom/shadow/ShadowRootInit.h" | 80 #include "core/dom/shadow/ShadowRootInit.h" |
| 81 #include "core/dom/shadow/SlotAssignment.h" |
81 #include "core/editing/EditingUtilities.h" | 82 #include "core/editing/EditingUtilities.h" |
82 #include "core/editing/FrameSelection.h" | 83 #include "core/editing/FrameSelection.h" |
83 #include "core/editing/iterators/TextIterator.h" | 84 #include "core/editing/iterators/TextIterator.h" |
84 #include "core/editing/serializers/Serialization.h" | 85 #include "core/editing/serializers/Serialization.h" |
85 #include "core/events/EventDispatcher.h" | 86 #include "core/events/EventDispatcher.h" |
86 #include "core/events/FocusEvent.h" | 87 #include "core/events/FocusEvent.h" |
87 #include "core/frame/FrameHost.h" | 88 #include "core/frame/FrameHost.h" |
88 #include "core/frame/FrameView.h" | 89 #include "core/frame/FrameView.h" |
89 #include "core/frame/HostsUsingFeatures.h" | 90 #include "core/frame/HostsUsingFeatures.h" |
90 #include "core/frame/LocalDOMWindow.h" | 91 #include "core/frame/LocalDOMWindow.h" |
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 return value.lowerASCII(); | 1139 return value.lowerASCII(); |
1139 return value; | 1140 return value; |
1140 } | 1141 } |
1141 | 1142 |
1142 void Element::attributeChanged(const QualifiedName& name, const AtomicString& ol
dValue, const AtomicString& newValue, AttributeModificationReason reason) | 1143 void Element::attributeChanged(const QualifiedName& name, const AtomicString& ol
dValue, const AtomicString& newValue, AttributeModificationReason reason) |
1143 { | 1144 { |
1144 if (ElementShadow* parentElementShadow = shadowWhereNodeCanBeDistributed(*th
is)) { | 1145 if (ElementShadow* parentElementShadow = shadowWhereNodeCanBeDistributed(*th
is)) { |
1145 if (shouldInvalidateDistributionWhenAttributeChanged(parentElementShadow
, name, newValue)) | 1146 if (shouldInvalidateDistributionWhenAttributeChanged(parentElementShadow
, name, newValue)) |
1146 parentElementShadow->setNeedsDistributionRecalc(); | 1147 parentElementShadow->setNeedsDistributionRecalc(); |
1147 } | 1148 } |
1148 if (name == HTMLNames::slotAttr && isChildOfV1ShadowHost()) { | 1149 if (name == HTMLNames::slotAttr && oldValue != newValue) { |
1149 parentElementShadow()->setNeedsDistributionRecalc(); | 1150 if (ShadowRoot* root = v1ShadowRootOfParent()) |
1150 if (oldValue != newValue) | 1151 root->ensureSlotAssignment().hostChildSlotNameChanged(oldValue, newV
alue); |
1151 parentElement()->shadowRootIfV1()->assignV1(); | |
1152 } | 1152 } |
1153 | 1153 |
1154 parseAttribute(name, oldValue, newValue); | 1154 parseAttribute(name, oldValue, newValue); |
1155 | 1155 |
1156 document().incDOMTreeVersion(); | 1156 document().incDOMTreeVersion(); |
1157 | 1157 |
1158 if (name == HTMLNames::idAttr) { | 1158 if (name == HTMLNames::idAttr) { |
1159 AtomicString oldId = elementData()->idForStyleResolution(); | 1159 AtomicString oldId = elementData()->idForStyleResolution(); |
1160 AtomicString newId = makeIdForStyleResolution(newValue, document().inQui
rksMode()); | 1160 AtomicString newId = makeIdForStyleResolution(newValue, document().inQui
rksMode()); |
1161 if (newId != oldId) { | 1161 if (newId != oldId) { |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 | 1500 |
1501 if (ElementAnimations* elementAnimations = data->elementAnimations()) | 1501 if (ElementAnimations* elementAnimations = data->elementAnimations()) |
1502 elementAnimations->cssAnimations().cancel(); | 1502 elementAnimations->cssAnimations().cancel(); |
1503 | 1503 |
1504 if (data->intersectionObserverData()) | 1504 if (data->intersectionObserverData()) |
1505 data->intersectionObserverData()->deactivateAllIntersectionObservers
(*this); | 1505 data->intersectionObserverData()->deactivateAllIntersectionObservers
(*this); |
1506 } | 1506 } |
1507 | 1507 |
1508 if (document().frame()) | 1508 if (document().frame()) |
1509 document().frame()->eventHandler().elementRemoved(this); | 1509 document().frame()->eventHandler().elementRemoved(this); |
1510 | |
1511 if (HTMLSlotElement* slot = assignedSlot()) { | |
1512 ShadowRoot* root = slot->containingShadowRoot(); | |
1513 if (root && root->isV1()) | |
1514 root->assignV1(); | |
1515 } | |
1516 } | 1510 } |
1517 | 1511 |
1518 void Element::attach(const AttachContext& context) | 1512 void Element::attach(const AttachContext& context) |
1519 { | 1513 { |
1520 DCHECK(document().inStyleRecalc()); | 1514 DCHECK(document().inStyleRecalc()); |
1521 | 1515 |
1522 // We've already been through detach when doing an attach, but we might | 1516 // We've already been through detach when doing an attach, but we might |
1523 // need to clear any state that's been added since then. | 1517 // need to clear any state that's been added since then. |
1524 if (hasRareData() && getStyleChangeType() == NeedsReattachStyleChange) { | 1518 if (hasRareData() && getStyleChangeType() == NeedsReattachStyleChange) { |
1525 ElementRareData* data = elementRareData(); | 1519 ElementRareData* data = elementRareData(); |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2081 } | 2075 } |
2082 | 2076 |
2083 void Element::childrenChanged(const ChildrenChange& change) | 2077 void Element::childrenChanged(const ChildrenChange& change) |
2084 { | 2078 { |
2085 ContainerNode::childrenChanged(change); | 2079 ContainerNode::childrenChanged(change); |
2086 | 2080 |
2087 checkForEmptyStyleChange(); | 2081 checkForEmptyStyleChange(); |
2088 if (!change.byParser && change.isChildElementChange()) | 2082 if (!change.byParser && change.isChildElementChange()) |
2089 checkForSiblingStyleChanges(change.type == ElementRemoved ? SiblingEleme
ntRemoved : SiblingElementInserted, change.siblingBeforeChange, change.siblingAf
terChange); | 2083 checkForSiblingStyleChanges(change.type == ElementRemoved ? SiblingEleme
ntRemoved : SiblingElementInserted, change.siblingBeforeChange, change.siblingAf
terChange); |
2090 | 2084 |
2091 if (ElementShadow* shadow = this->shadow()) { | 2085 // TODO(hayato): Confirm that we can skip this if a shadow tree is v1. |
| 2086 if (ElementShadow* shadow = this->shadow()) |
2092 shadow->setNeedsDistributionRecalc(); | 2087 shadow->setNeedsDistributionRecalc(); |
2093 if (document().shadowCascadeOrder() == ShadowCascadeOrder::ShadowCascade
V1) { | |
2094 ShadowRoot* root = isShadowHost(*this) && shadowRoot()->isV1() ? sha
dowRootIfV1() : isHTMLSlotElement(*this) ? containingShadowRoot() : nullptr; | |
2095 if (root && root->isV1()) | |
2096 root->assignV1(); | |
2097 } | |
2098 } | |
2099 } | 2088 } |
2100 | 2089 |
2101 void Element::finishParsingChildren() | 2090 void Element::finishParsingChildren() |
2102 { | 2091 { |
2103 setIsFinishedParsingChildren(true); | 2092 setIsFinishedParsingChildren(true); |
2104 checkForEmptyStyleChange(); | 2093 checkForEmptyStyleChange(); |
2105 checkForSiblingStyleChanges(FinishedParsingChildren, lastChild(), nullptr); | 2094 checkForSiblingStyleChanges(FinishedParsingChildren, lastChild(), nullptr); |
2106 } | 2095 } |
2107 | 2096 |
2108 #ifndef NDEBUG | 2097 #ifndef NDEBUG |
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3707 | 3696 |
3708 DEFINE_TRACE_WRAPPERS(Element) | 3697 DEFINE_TRACE_WRAPPERS(Element) |
3709 { | 3698 { |
3710 if (hasRareData()) { | 3699 if (hasRareData()) { |
3711 visitor->traceWrappers(elementRareData()); | 3700 visitor->traceWrappers(elementRareData()); |
3712 } | 3701 } |
3713 ContainerNode::traceWrappers(visitor); | 3702 ContainerNode::traceWrappers(visitor); |
3714 } | 3703 } |
3715 | 3704 |
3716 } // namespace blink | 3705 } // namespace blink |
OLD | NEW |