Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Side by Side Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 1449623002: IntersectionObserver: second cut. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Add RuntimeEnabled flags to all idl's, fix test expectations. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "core/css/resolver/StyleResolver.h" 47 #include "core/css/resolver/StyleResolver.h"
48 #include "core/css/resolver/StyleResolverParentScope.h" 48 #include "core/css/resolver/StyleResolverParentScope.h"
49 #include "core/css/resolver/StyleResolverStats.h" 49 #include "core/css/resolver/StyleResolverStats.h"
50 #include "core/dom/AXObjectCache.h" 50 #include "core/dom/AXObjectCache.h"
51 #include "core/dom/Attr.h" 51 #include "core/dom/Attr.h"
52 #include "core/dom/CSSSelectorWatch.h" 52 #include "core/dom/CSSSelectorWatch.h"
53 #include "core/dom/ClientRect.h" 53 #include "core/dom/ClientRect.h"
54 #include "core/dom/ClientRectList.h" 54 #include "core/dom/ClientRectList.h"
55 #include "core/dom/DatasetDOMStringMap.h" 55 #include "core/dom/DatasetDOMStringMap.h"
56 #include "core/dom/ElementDataCache.h" 56 #include "core/dom/ElementDataCache.h"
57 #include "core/dom/ElementIntersectionObserverData.h"
57 #include "core/dom/ElementRareData.h" 58 #include "core/dom/ElementRareData.h"
58 #include "core/dom/ElementTraversal.h" 59 #include "core/dom/ElementTraversal.h"
59 #include "core/dom/ExceptionCode.h" 60 #include "core/dom/ExceptionCode.h"
60 #include "core/dom/FirstLetterPseudoElement.h" 61 #include "core/dom/FirstLetterPseudoElement.h"
61 #include "core/dom/Fullscreen.h" 62 #include "core/dom/Fullscreen.h"
62 #include "core/dom/LayoutTreeBuilder.h" 63 #include "core/dom/LayoutTreeBuilder.h"
63 #include "core/dom/MutationObserverInterestGroup.h" 64 #include "core/dom/MutationObserverInterestGroup.h"
64 #include "core/dom/MutationRecord.h" 65 #include "core/dom/MutationRecord.h"
65 #include "core/dom/NamedNodeMap.h" 66 #include "core/dom/NamedNodeMap.h"
66 #include "core/dom/NodeComputedStyle.h" 67 #include "core/dom/NodeComputedStyle.h"
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 ContainerNode::insertedInto(insertionPoint); 1451 ContainerNode::insertedInto(insertionPoint);
1451 1452
1452 if (containsFullScreenElement() && parentElement() && !parentElement()->cont ainsFullScreenElement()) 1453 if (containsFullScreenElement() && parentElement() && !parentElement()->cont ainsFullScreenElement())
1453 setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true); 1454 setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true);
1454 1455
1455 ASSERT(!hasRareData() || !elementRareData()->hasPseudoElements()); 1456 ASSERT(!hasRareData() || !elementRareData()->hasPseudoElements());
1456 1457
1457 if (!insertionPoint->isInTreeScope()) 1458 if (!insertionPoint->isInTreeScope())
1458 return InsertionDone; 1459 return InsertionDone;
1459 1460
1460 if (hasRareData()) 1461 if (hasRareData()) {
1461 elementRareData()->clearClassListValueForQuirksMode(); 1462 ElementRareData* rareData = elementRareData();
1463 rareData->clearClassListValueForQuirksMode();
1464 if (rareData->intersectionObserverData())
1465 rareData->intersectionObserverData()->activateValidIntersectionObser vers(*this);
1466 }
1462 1467
1463 if (isUpgradedCustomElement() && inDocument()) 1468 if (isUpgradedCustomElement() && inDocument())
1464 CustomElement::didAttach(this, document()); 1469 CustomElement::didAttach(this, document());
1465 1470
1466 TreeScope& scope = insertionPoint->treeScope(); 1471 TreeScope& scope = insertionPoint->treeScope();
1467 if (scope != treeScope()) 1472 if (scope != treeScope())
1468 return InsertionDone; 1473 return InsertionDone;
1469 1474
1470 const AtomicString& idValue = getIdAttribute(); 1475 const AtomicString& idValue = getIdAttribute();
1471 if (!idValue.isNull()) 1476 if (!idValue.isNull())
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 1534
1530 clearElementFlag(IsInCanvasSubtree); 1535 clearElementFlag(IsInCanvasSubtree);
1531 1536
1532 if (hasRareData()) { 1537 if (hasRareData()) {
1533 ElementRareData* data = elementRareData(); 1538 ElementRareData* data = elementRareData();
1534 1539
1535 data->clearRestyleFlags(); 1540 data->clearRestyleFlags();
1536 1541
1537 if (ElementAnimations* elementAnimations = data->elementAnimations()) 1542 if (ElementAnimations* elementAnimations = data->elementAnimations())
1538 elementAnimations->cssAnimations().cancel(); 1543 elementAnimations->cssAnimations().cancel();
1544
1545 if (data->intersectionObserverData())
1546 data->intersectionObserverData()->deactivateAllIntersectionObservers (*this);
1539 } 1547 }
1540 } 1548 }
1541 1549
1542 void Element::attach(const AttachContext& context) 1550 void Element::attach(const AttachContext& context)
1543 { 1551 {
1544 ASSERT(document().inStyleRecalc()); 1552 ASSERT(document().inStyleRecalc());
1545 1553
1546 // We've already been through detach when doing an attach, but we might 1554 // We've already been through detach when doing an attach, but we might
1547 // need to clear any state that's been added since then. 1555 // need to clear any state that's been added since then.
1548 if (hasRareData() && styleChangeType() == NeedsReattachStyleChange) { 1556 if (hasRareData() && styleChangeType() == NeedsReattachStyleChange) {
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
2579 if (!exceptionState.hadException()) 2587 if (!exceptionState.hadException())
2580 return newChild; 2588 return newChild;
2581 } 2589 }
2582 return nullptr; 2590 return nullptr;
2583 } 2591 }
2584 2592
2585 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + wher e + "') is not one of 'beforeBegin', 'afterBegin', 'beforeEnd', or 'afterEnd'.") ; 2593 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + wher e + "') is not one of 'beforeBegin', 'afterBegin', 'beforeEnd', or 'afterEnd'.") ;
2586 return nullptr; 2594 return nullptr;
2587 } 2595 }
2588 2596
2597 ElementIntersectionObserverData* Element::intersectionObserverData() const
2598 {
2599 if (elementRareData())
2600 return elementRareData()->intersectionObserverData();
2601 return nullptr;
2602 }
2603
2604 ElementIntersectionObserverData& Element::ensureIntersectionObserverData()
2605 {
2606 return ensureElementRareData().ensureIntersectionObserverData();
2607 }
2608
2589 // Step 1 of http://domparsing.spec.whatwg.org/#insertadjacenthtml() 2609 // Step 1 of http://domparsing.spec.whatwg.org/#insertadjacenthtml()
2590 static Element* contextElementForInsertion(const String& where, Element* element , ExceptionState& exceptionState) 2610 static Element* contextElementForInsertion(const String& where, Element* element , ExceptionState& exceptionState)
2591 { 2611 {
2592 if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "aft erEnd")) { 2612 if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "aft erEnd")) {
2593 Element* parent = element->parentElement(); 2613 Element* parent = element->parentElement();
2594 if (!parent) { 2614 if (!parent) {
2595 exceptionState.throwDOMException(NoModificationAllowedError, "The el ement has no parent."); 2615 exceptionState.throwDOMException(NoModificationAllowedError, "The el ement has no parent.");
2596 return nullptr; 2616 return nullptr;
2597 } 2617 }
2598 return parent; 2618 return parent;
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
3624 { 3644 {
3625 #if ENABLE(OILPAN) 3645 #if ENABLE(OILPAN)
3626 if (hasRareData()) 3646 if (hasRareData())
3627 visitor->trace(elementRareData()); 3647 visitor->trace(elementRareData());
3628 visitor->trace(m_elementData); 3648 visitor->trace(m_elementData);
3629 #endif 3649 #endif
3630 ContainerNode::trace(visitor); 3650 ContainerNode::trace(visitor);
3631 } 3651 }
3632 3652
3633 } // namespace blink 3653 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698