Index: third_party/WebKit/Source/core/dom/Element.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp |
index a215cf9cc02bbc4ea443f940b799c5c78d6b8f53..1cf2f52c23a1f7229f0e4105ea61775834080977 100644 |
--- a/third_party/WebKit/Source/core/dom/Element.cpp |
+++ b/third_party/WebKit/Source/core/dom/Element.cpp |
@@ -60,6 +60,8 @@ |
#include "core/dom/ExceptionCode.h" |
#include "core/dom/FirstLetterPseudoElement.h" |
#include "core/dom/Fullscreen.h" |
+#include "core/dom/IntersectionObserver.h" |
+#include "core/dom/IntersectionObserverRegistry.h" |
#include "core/dom/LayoutTreeBuilder.h" |
#include "core/dom/MutationObserverInterestGroup.h" |
#include "core/dom/MutationRecord.h" |
@@ -106,6 +108,8 @@ |
#include "core/html/HTMLTemplateElement.h" |
#include "core/html/parser/HTMLParserIdioms.h" |
#include "core/inspector/InspectorInstrumentation.h" |
+#include "core/layout/LayoutInline.h" |
+#include "core/layout/LayoutPart.h" |
#include "core/layout/LayoutTextFragment.h" |
#include "core/layout/LayoutView.h" |
#include "core/loader/DocumentLoader.h" |
@@ -1468,8 +1472,21 @@ Node::InsertionNotificationRequest Element::insertedInto(ContainerNode* insertio |
if (!insertionPoint->isInTreeScope()) |
return InsertionDone; |
- if (hasRareData()) |
- elementRareData()->clearClassListValueForQuirksMode(); |
+ if (hasRareData()) { |
+ ElementRareData* rareData = elementRareData(); |
+ rareData->clearClassListValueForQuirksMode(); |
+ if (rareData->hasIntersectionObserver()) { |
esprehn
2015/12/12 00:14:13
this code should be moved into a separate object f
szager1
2015/12/16 19:15:34
I moved all the logic into ElementRareData and the
|
+ IntersectionObserverRegistry* registry = document().intersectionObserverRegistry(); |
+ for (auto& observer: rareData->intersectionObservers()) { |
+ registry->addTrackedObserver(*observer); |
+ observer->setActive(true); |
+ } |
+ } |
+ if (rareData->hasIntersectionObservation()) { |
+ for (auto& observation: rareData->intersectionObservations()) |
esprehn
2015/12/12 00:14:13
space before :
this should also be moved into the
szager1
2015/12/16 19:15:34
same comment
|
+ observation->setActive(observation->observer()->isDescendantOfRoot(this)); |
+ } |
+ } |
if (isUpgradedCustomElement() && inDocument()) |
CustomElement::didAttach(this, document()); |
@@ -1547,6 +1564,12 @@ void Element::removedFrom(ContainerNode* insertionPoint, Node* next) |
if (ElementAnimations* elementAnimations = data->elementAnimations()) |
elementAnimations->cssAnimations().cancel(); |
+ |
+ if (data->hasIntersectionObserver()) { |
esprehn
2015/12/12 00:14:13
if (ElementIntersectionObserverSet* observerSet =
szager1
2015/12/16 19:15:34
I moved all the logic into ElementRareData and Ele
|
+ document().intersectionObserverRegistry()->removeTrackedObserversForRoot(this); |
+ data->deactivateAllIntersectionObservers(); |
+ } |
+ data->deactivateAllIntersectionObservations(); |
esprehn
2015/12/12 00:14:13
this should be inside that same deactivate method,
szager1
2015/12/16 19:15:34
same comment
|
} |
} |
@@ -3578,6 +3601,27 @@ bool Element::supportsStyleSharing() const |
return true; |
} |
+WeakPtrWillBeRawPtr<Element> Element::createWeakPtr() |
+{ |
+#if ENABLE(OILPAN) |
+ return this; |
+#else |
+ return ensureElementRareData().createWeakPtr(this); |
esprehn
2015/12/12 00:14:13
Remove this, we shouldn't have a createWeakPtr met
szager1
2015/12/16 19:15:34
Done.
|
+#endif |
+} |
+ |
+void Element::addIntersectionObservation(IntersectionObservation& observation) |
+{ |
+ ensureElementRareData().intersectionObservations().add(&observation); |
+} |
+ |
+void Element::removeIntersectionObservation(IntersectionObservation& observation) |
+{ |
+ if (!hasRareData() || !elementRareData()->hasIntersectionObservation()) |
esprehn
2015/12/12 00:14:13
how do we get here without having observations? no
szager1
2015/12/16 19:15:34
Good point, fixed.
|
+ return; |
+ elementRareData()->intersectionObservations().remove(&observation); |
+} |
+ |
void Element::logAddElementIfIsolatedWorldAndInDocument(const char element[], const QualifiedName& attr1) |
{ |
if (!inDocument()) |