Chromium Code Reviews| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 #include "core/dom/CSSSelectorWatch.h" | 53 #include "core/dom/CSSSelectorWatch.h" |
| 54 #include "core/dom/ClientRect.h" | 54 #include "core/dom/ClientRect.h" |
| 55 #include "core/dom/ClientRectList.h" | 55 #include "core/dom/ClientRectList.h" |
| 56 #include "core/dom/DatasetDOMStringMap.h" | 56 #include "core/dom/DatasetDOMStringMap.h" |
| 57 #include "core/dom/ElementDataCache.h" | 57 #include "core/dom/ElementDataCache.h" |
| 58 #include "core/dom/ElementRareData.h" | 58 #include "core/dom/ElementRareData.h" |
| 59 #include "core/dom/ElementTraversal.h" | 59 #include "core/dom/ElementTraversal.h" |
| 60 #include "core/dom/ExceptionCode.h" | 60 #include "core/dom/ExceptionCode.h" |
| 61 #include "core/dom/FirstLetterPseudoElement.h" | 61 #include "core/dom/FirstLetterPseudoElement.h" |
| 62 #include "core/dom/Fullscreen.h" | 62 #include "core/dom/Fullscreen.h" |
| 63 #include "core/dom/IntersectionObserver.h" | |
| 64 #include "core/dom/IntersectionObserverRegistry.h" | |
| 63 #include "core/dom/LayoutTreeBuilder.h" | 65 #include "core/dom/LayoutTreeBuilder.h" |
| 64 #include "core/dom/MutationObserverInterestGroup.h" | 66 #include "core/dom/MutationObserverInterestGroup.h" |
| 65 #include "core/dom/MutationRecord.h" | 67 #include "core/dom/MutationRecord.h" |
| 66 #include "core/dom/NamedNodeMap.h" | 68 #include "core/dom/NamedNodeMap.h" |
| 67 #include "core/dom/NodeComputedStyle.h" | 69 #include "core/dom/NodeComputedStyle.h" |
| 68 #include "core/dom/PresentationAttributeStyle.h" | 70 #include "core/dom/PresentationAttributeStyle.h" |
| 69 #include "core/dom/PseudoElement.h" | 71 #include "core/dom/PseudoElement.h" |
| 70 #include "core/dom/ScriptableDocumentParser.h" | 72 #include "core/dom/ScriptableDocumentParser.h" |
| 71 #include "core/dom/SelectorQuery.h" | 73 #include "core/dom/SelectorQuery.h" |
| 72 #include "core/dom/StyleChangeReason.h" | 74 #include "core/dom/StyleChangeReason.h" |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 99 #include "core/html/HTMLElement.h" | 101 #include "core/html/HTMLElement.h" |
| 100 #include "core/html/HTMLFormControlsCollection.h" | 102 #include "core/html/HTMLFormControlsCollection.h" |
| 101 #include "core/html/HTMLFrameElementBase.h" | 103 #include "core/html/HTMLFrameElementBase.h" |
| 102 #include "core/html/HTMLFrameOwnerElement.h" | 104 #include "core/html/HTMLFrameOwnerElement.h" |
| 103 #include "core/html/HTMLOptionsCollection.h" | 105 #include "core/html/HTMLOptionsCollection.h" |
| 104 #include "core/html/HTMLPlugInElement.h" | 106 #include "core/html/HTMLPlugInElement.h" |
| 105 #include "core/html/HTMLTableRowsCollection.h" | 107 #include "core/html/HTMLTableRowsCollection.h" |
| 106 #include "core/html/HTMLTemplateElement.h" | 108 #include "core/html/HTMLTemplateElement.h" |
| 107 #include "core/html/parser/HTMLParserIdioms.h" | 109 #include "core/html/parser/HTMLParserIdioms.h" |
| 108 #include "core/inspector/InspectorInstrumentation.h" | 110 #include "core/inspector/InspectorInstrumentation.h" |
| 111 #include "core/layout/LayoutInline.h" | |
| 112 #include "core/layout/LayoutPart.h" | |
| 109 #include "core/layout/LayoutTextFragment.h" | 113 #include "core/layout/LayoutTextFragment.h" |
| 110 #include "core/layout/LayoutView.h" | 114 #include "core/layout/LayoutView.h" |
| 111 #include "core/loader/DocumentLoader.h" | 115 #include "core/loader/DocumentLoader.h" |
| 112 #include "core/page/ChromeClient.h" | 116 #include "core/page/ChromeClient.h" |
| 113 #include "core/page/FocusController.h" | 117 #include "core/page/FocusController.h" |
| 114 #include "core/page/Page.h" | 118 #include "core/page/Page.h" |
| 115 #include "core/page/PointerLockController.h" | 119 #include "core/page/PointerLockController.h" |
| 116 #include "core/page/SpatialNavigation.h" | 120 #include "core/page/SpatialNavigation.h" |
| 117 #include "core/page/scrolling/ScrollCustomizationCallbacks.h" | 121 #include "core/page/scrolling/ScrollCustomizationCallbacks.h" |
| 118 #include "core/page/scrolling/ScrollState.h" | 122 #include "core/page/scrolling/ScrollState.h" |
| (...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1461 ContainerNode::insertedInto(insertionPoint); | 1465 ContainerNode::insertedInto(insertionPoint); |
| 1462 | 1466 |
| 1463 if (containsFullScreenElement() && parentElement() && !parentElement()->cont ainsFullScreenElement()) | 1467 if (containsFullScreenElement() && parentElement() && !parentElement()->cont ainsFullScreenElement()) |
| 1464 setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true); | 1468 setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true); |
| 1465 | 1469 |
| 1466 ASSERT(!hasRareData() || !elementRareData()->hasPseudoElements()); | 1470 ASSERT(!hasRareData() || !elementRareData()->hasPseudoElements()); |
| 1467 | 1471 |
| 1468 if (!insertionPoint->isInTreeScope()) | 1472 if (!insertionPoint->isInTreeScope()) |
| 1469 return InsertionDone; | 1473 return InsertionDone; |
| 1470 | 1474 |
| 1471 if (hasRareData()) | 1475 if (hasRareData()) { |
| 1472 elementRareData()->clearClassListValueForQuirksMode(); | 1476 ElementRareData* rareData = elementRareData(); |
| 1477 rareData->clearClassListValueForQuirksMode(); | |
| 1478 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
| |
| 1479 IntersectionObserverRegistry* registry = document().intersectionObse rverRegistry(); | |
| 1480 for (auto& observer: rareData->intersectionObservers()) { | |
| 1481 registry->addTrackedObserver(*observer); | |
| 1482 observer->setActive(true); | |
| 1483 } | |
| 1484 } | |
| 1485 if (rareData->hasIntersectionObservation()) { | |
| 1486 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
| |
| 1487 observation->setActive(observation->observer()->isDescendantOfRo ot(this)); | |
| 1488 } | |
| 1489 } | |
| 1473 | 1490 |
| 1474 if (isUpgradedCustomElement() && inDocument()) | 1491 if (isUpgradedCustomElement() && inDocument()) |
| 1475 CustomElement::didAttach(this, document()); | 1492 CustomElement::didAttach(this, document()); |
| 1476 | 1493 |
| 1477 TreeScope& scope = insertionPoint->treeScope(); | 1494 TreeScope& scope = insertionPoint->treeScope(); |
| 1478 if (scope != treeScope()) | 1495 if (scope != treeScope()) |
| 1479 return InsertionDone; | 1496 return InsertionDone; |
| 1480 | 1497 |
| 1481 const AtomicString& idValue = getIdAttribute(); | 1498 const AtomicString& idValue = getIdAttribute(); |
| 1482 if (!idValue.isNull()) | 1499 if (!idValue.isNull()) |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1540 | 1557 |
| 1541 clearElementFlag(IsInCanvasSubtree); | 1558 clearElementFlag(IsInCanvasSubtree); |
| 1542 | 1559 |
| 1543 if (hasRareData()) { | 1560 if (hasRareData()) { |
| 1544 ElementRareData* data = elementRareData(); | 1561 ElementRareData* data = elementRareData(); |
| 1545 | 1562 |
| 1546 data->clearRestyleFlags(); | 1563 data->clearRestyleFlags(); |
| 1547 | 1564 |
| 1548 if (ElementAnimations* elementAnimations = data->elementAnimations()) | 1565 if (ElementAnimations* elementAnimations = data->elementAnimations()) |
| 1549 elementAnimations->cssAnimations().cancel(); | 1566 elementAnimations->cssAnimations().cancel(); |
| 1567 | |
| 1568 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
| |
| 1569 document().intersectionObserverRegistry()->removeTrackedObserversFor Root(this); | |
| 1570 data->deactivateAllIntersectionObservers(); | |
| 1571 } | |
| 1572 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
| |
| 1550 } | 1573 } |
| 1551 } | 1574 } |
| 1552 | 1575 |
| 1553 void Element::attach(const AttachContext& context) | 1576 void Element::attach(const AttachContext& context) |
| 1554 { | 1577 { |
| 1555 ASSERT(document().inStyleRecalc()); | 1578 ASSERT(document().inStyleRecalc()); |
| 1556 | 1579 |
| 1557 // We've already been through detach when doing an attach, but we might | 1580 // We've already been through detach when doing an attach, but we might |
| 1558 // need to clear any state that's been added since then. | 1581 // need to clear any state that's been added since then. |
| 1559 if (hasRareData() && styleChangeType() == NeedsReattachStyleChange) { | 1582 if (hasRareData() && styleChangeType() == NeedsReattachStyleChange) { |
| (...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3571 return false; | 3594 return false; |
| 3572 if (isHTMLElement() && toHTMLElement(this)->hasDirectionAuto()) | 3595 if (isHTMLElement() && toHTMLElement(this)->hasDirectionAuto()) |
| 3573 return false; | 3596 return false; |
| 3574 if (hasAnimations()) | 3597 if (hasAnimations()) |
| 3575 return false; | 3598 return false; |
| 3576 if (Fullscreen::isActiveFullScreenElement(*this)) | 3599 if (Fullscreen::isActiveFullScreenElement(*this)) |
| 3577 return false; | 3600 return false; |
| 3578 return true; | 3601 return true; |
| 3579 } | 3602 } |
| 3580 | 3603 |
| 3604 WeakPtrWillBeRawPtr<Element> Element::createWeakPtr() | |
| 3605 { | |
| 3606 #if ENABLE(OILPAN) | |
| 3607 return this; | |
| 3608 #else | |
| 3609 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.
| |
| 3610 #endif | |
| 3611 } | |
| 3612 | |
| 3613 void Element::addIntersectionObservation(IntersectionObservation& observation) | |
| 3614 { | |
| 3615 ensureElementRareData().intersectionObservations().add(&observation); | |
| 3616 } | |
| 3617 | |
| 3618 void Element::removeIntersectionObservation(IntersectionObservation& observation ) | |
| 3619 { | |
| 3620 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.
| |
| 3621 return; | |
| 3622 elementRareData()->intersectionObservations().remove(&observation); | |
| 3623 } | |
| 3624 | |
| 3581 void Element::logAddElementIfIsolatedWorldAndInDocument(const char element[], co nst QualifiedName& attr1) | 3625 void Element::logAddElementIfIsolatedWorldAndInDocument(const char element[], co nst QualifiedName& attr1) |
| 3582 { | 3626 { |
| 3583 if (!inDocument()) | 3627 if (!inDocument()) |
| 3584 return; | 3628 return; |
| 3585 V8DOMActivityLogger* activityLogger = V8DOMActivityLogger::currentActivityLo ggerIfIsolatedWorld(); | 3629 V8DOMActivityLogger* activityLogger = V8DOMActivityLogger::currentActivityLo ggerIfIsolatedWorld(); |
| 3586 if (!activityLogger) | 3630 if (!activityLogger) |
| 3587 return; | 3631 return; |
| 3588 Vector<String, 2> argv; | 3632 Vector<String, 2> argv; |
| 3589 argv.append(element); | 3633 argv.append(element); |
| 3590 argv.append(fastGetAttribute(attr1)); | 3634 argv.append(fastGetAttribute(attr1)); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3639 { | 3683 { |
| 3640 #if ENABLE(OILPAN) | 3684 #if ENABLE(OILPAN) |
| 3641 if (hasRareData()) | 3685 if (hasRareData()) |
| 3642 visitor->trace(elementRareData()); | 3686 visitor->trace(elementRareData()); |
| 3643 visitor->trace(m_elementData); | 3687 visitor->trace(m_elementData); |
| 3644 #endif | 3688 #endif |
| 3645 ContainerNode::trace(visitor); | 3689 ContainerNode::trace(visitor); |
| 3646 } | 3690 } |
| 3647 | 3691 |
| 3648 } // namespace blink | 3692 } // namespace blink |
| OLD | NEW |