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 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 ContainerNode::insertedInto(insertionPoint); | 1447 ContainerNode::insertedInto(insertionPoint); |
1444 | 1448 |
1445 if (containsFullScreenElement() && parentElement() && !parentElement()->cont
ainsFullScreenElement()) | 1449 if (containsFullScreenElement() && parentElement() && !parentElement()->cont
ainsFullScreenElement()) |
1446 setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true); | 1450 setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true); |
1447 | 1451 |
1448 ASSERT(!hasRareData() || !elementRareData()->hasPseudoElements()); | 1452 ASSERT(!hasRareData() || !elementRareData()->hasPseudoElements()); |
1449 | 1453 |
1450 if (!insertionPoint->isInTreeScope()) | 1454 if (!insertionPoint->isInTreeScope()) |
1451 return InsertionDone; | 1455 return InsertionDone; |
1452 | 1456 |
1453 if (hasRareData()) | 1457 if (hasRareData()) { |
1454 elementRareData()->clearClassListValueForQuirksMode(); | 1458 ElementRareData* rareData = elementRareData(); |
| 1459 rareData->clearClassListValueForQuirksMode(); |
| 1460 if (rareData->hasIntersectionObserver()) { |
| 1461 IntersectionObserverRegistry* registry = document().intersectionObse
rverRegistry(); |
| 1462 for (auto& observer: rareData->intersectionObservers()) { |
| 1463 registry->addTrackedObserver(*observer); |
| 1464 observer->setActive(true); |
| 1465 } |
| 1466 } |
| 1467 if (rareData->hasIntersectionObservation()) { |
| 1468 for (auto& observation: rareData->intersectionObservations()) |
| 1469 observation->setActive(observation->observer()->isDescendantOfRo
ot(this)); |
| 1470 } |
| 1471 } |
1455 | 1472 |
1456 if (isUpgradedCustomElement() && inDocument()) | 1473 if (isUpgradedCustomElement() && inDocument()) |
1457 CustomElement::didAttach(this, document()); | 1474 CustomElement::didAttach(this, document()); |
1458 | 1475 |
1459 TreeScope& scope = insertionPoint->treeScope(); | 1476 TreeScope& scope = insertionPoint->treeScope(); |
1460 if (scope != treeScope()) | 1477 if (scope != treeScope()) |
1461 return InsertionDone; | 1478 return InsertionDone; |
1462 | 1479 |
1463 const AtomicString& idValue = getIdAttribute(); | 1480 const AtomicString& idValue = getIdAttribute(); |
1464 if (!idValue.isNull()) | 1481 if (!idValue.isNull()) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1522 | 1539 |
1523 clearElementFlag(IsInCanvasSubtree); | 1540 clearElementFlag(IsInCanvasSubtree); |
1524 | 1541 |
1525 if (hasRareData()) { | 1542 if (hasRareData()) { |
1526 ElementRareData* data = elementRareData(); | 1543 ElementRareData* data = elementRareData(); |
1527 | 1544 |
1528 data->clearRestyleFlags(); | 1545 data->clearRestyleFlags(); |
1529 | 1546 |
1530 if (ElementAnimations* elementAnimations = data->elementAnimations()) | 1547 if (ElementAnimations* elementAnimations = data->elementAnimations()) |
1531 elementAnimations->cssAnimations().cancel(); | 1548 elementAnimations->cssAnimations().cancel(); |
| 1549 |
| 1550 if (data->hasIntersectionObserver()) { |
| 1551 document().intersectionObserverRegistry()->removeTrackedObserversFor
Root(this); |
| 1552 data->deactivateAllIntersectionObservers(); |
| 1553 } |
| 1554 data->deactivateAllIntersectionObservations(); |
1532 } | 1555 } |
1533 } | 1556 } |
1534 | 1557 |
1535 void Element::attach(const AttachContext& context) | 1558 void Element::attach(const AttachContext& context) |
1536 { | 1559 { |
1537 ASSERT(document().inStyleRecalc()); | 1560 ASSERT(document().inStyleRecalc()); |
1538 | 1561 |
1539 // We've already been through detach when doing an attach, but we might | 1562 // We've already been through detach when doing an attach, but we might |
1540 // need to clear any state that's been added since then. | 1563 // need to clear any state that's been added since then. |
1541 if (hasRareData() && styleChangeType() == NeedsReattachStyleChange) { | 1564 if (hasRareData() && styleChangeType() == NeedsReattachStyleChange) { |
(...skipping 2021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3563 return false; | 3586 return false; |
3564 if (isHTMLElement() && toHTMLElement(this)->hasDirectionAuto()) | 3587 if (isHTMLElement() && toHTMLElement(this)->hasDirectionAuto()) |
3565 return false; | 3588 return false; |
3566 if (hasAnimations()) | 3589 if (hasAnimations()) |
3567 return false; | 3590 return false; |
3568 if (Fullscreen::isActiveFullScreenElement(*this)) | 3591 if (Fullscreen::isActiveFullScreenElement(*this)) |
3569 return false; | 3592 return false; |
3570 return true; | 3593 return true; |
3571 } | 3594 } |
3572 | 3595 |
| 3596 WeakPtrWillBeRawPtr<Element> Element::createWeakPtr() |
| 3597 { |
| 3598 #if ENABLE(OILPAN) |
| 3599 return this; |
| 3600 #else |
| 3601 return ensureElementRareData().createWeakPtr(this); |
| 3602 #endif |
| 3603 } |
| 3604 |
| 3605 void Element::addIntersectionObservation(IntersectionObservation& observation) |
| 3606 { |
| 3607 ensureElementRareData().intersectionObservations().add(&observation); |
| 3608 } |
| 3609 |
| 3610 void Element::removeIntersectionObservation(IntersectionObservation& observation
) |
| 3611 { |
| 3612 if (!hasRareData() || !elementRareData()->hasIntersectionObservation()) |
| 3613 return; |
| 3614 elementRareData()->intersectionObservations().remove(&observation); |
| 3615 } |
| 3616 |
| 3617 bool Element::computeIntersection(Element* root, LayoutRect& targetRect, LayoutR
ect& rootRect, LayoutRect& intersectionRect) |
| 3618 { |
| 3619 bool rootIsDocumentElement = (root == root->document().documentElement()); |
| 3620 LayoutObject* rootLayoutObject = rootIsDocumentElement ? root->document().la
youtView() : root->layoutObject(); |
| 3621 if (!rootLayoutObject->isBoxModelObject()) |
| 3622 return false; |
| 3623 intersectionRect = targetRect = toLayoutBoxModelObject(layoutObject())->visu
alOverflowRect(); |
| 3624 layoutObject()->mapRectToPaintInvalidationBacking(toLayoutBoxModelObject(roo
tLayoutObject), intersectionRect, nullptr); |
| 3625 targetRect = LayoutRect(layoutObject()->localToAbsoluteQuad(FloatQuad(FloatR
ect(targetRect)), UseTransforms | ApplyContainerFlip | TraverseDocumentBoundarie
s).boundingBox()); |
| 3626 intersectionRect = LayoutRect(rootLayoutObject->localToAbsoluteQuad(FloatQua
d(FloatRect(intersectionRect))).boundingBox()); |
| 3627 LayoutPoint scrollPosition(root->document().view()->scrollPosition()); |
| 3628 if (rootIsDocumentElement) { |
| 3629 rootRect = LayoutRect(root->document().view()->visibleContentRect()); |
| 3630 intersectionRect.intersect(rootRect); |
| 3631 } else if (rootLayoutObject->isBox()) { |
| 3632 rootRect = LayoutRect(toLayoutBox(rootLayoutObject)->absoluteContentBox(
)); |
| 3633 } else { |
| 3634 rootRect = LayoutRect(rootLayoutObject->absoluteBoundingBoxRect()); |
| 3635 } |
| 3636 targetRect.moveBy(-scrollPosition); |
| 3637 intersectionRect.moveBy(-scrollPosition); |
| 3638 rootRect.moveBy(-scrollPosition); |
| 3639 if (intersectionRect.size().isZero()) |
| 3640 intersectionRect = LayoutRect(); |
| 3641 |
| 3642 return true; |
| 3643 } |
| 3644 |
3573 void Element::logEventIfIsolatedWorldAndInDocument(const String& eventName, cons
t String& arg1, const String& arg2) | 3645 void Element::logEventIfIsolatedWorldAndInDocument(const String& eventName, cons
t String& arg1, const String& arg2) |
3574 { | 3646 { |
3575 if (!inDocument()) | 3647 if (!inDocument()) |
3576 return; | 3648 return; |
3577 V8DOMActivityLogger* activityLogger = V8DOMActivityLogger::currentActivityLo
ggerIfIsolatedWorld(); | 3649 V8DOMActivityLogger* activityLogger = V8DOMActivityLogger::currentActivityLo
ggerIfIsolatedWorld(); |
3578 if (!activityLogger) | 3650 if (!activityLogger) |
3579 return; | 3651 return; |
3580 Vector<String, 2> argv; | 3652 Vector<String, 2> argv; |
3581 argv.append(arg1); | 3653 argv.append(arg1); |
3582 argv.append(arg2); | 3654 argv.append(arg2); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3616 { | 3688 { |
3617 #if ENABLE(OILPAN) | 3689 #if ENABLE(OILPAN) |
3618 if (hasRareData()) | 3690 if (hasRareData()) |
3619 visitor->trace(elementRareData()); | 3691 visitor->trace(elementRareData()); |
3620 visitor->trace(m_elementData); | 3692 visitor->trace(m_elementData); |
3621 #endif | 3693 #endif |
3622 ContainerNode::trace(visitor); | 3694 ContainerNode::trace(visitor); |
3623 } | 3695 } |
3624 | 3696 |
3625 } // namespace blink | 3697 } // namespace blink |
OLD | NEW |