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. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. |
8 * All rights reserved. | 8 * All rights reserved. |
9 * (C) 2007 Eric Seidel (eric@webkit.org) | 9 * (C) 2007 Eric Seidel (eric@webkit.org) |
10 * | 10 * |
(...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 LayoutObject* Element::createLayoutObject(const ComputedStyle& style) { | 1533 LayoutObject* Element::createLayoutObject(const ComputedStyle& style) { |
1534 return LayoutObject::createObject(this, style); | 1534 return LayoutObject::createObject(this, style); |
1535 } | 1535 } |
1536 | 1536 |
1537 Node::InsertionNotificationRequest Element::insertedInto( | 1537 Node::InsertionNotificationRequest Element::insertedInto( |
1538 ContainerNode* insertionPoint) { | 1538 ContainerNode* insertionPoint) { |
1539 // need to do superclass processing first so isConnected() is true | 1539 // need to do superclass processing first so isConnected() is true |
1540 // by the time we reach updateId | 1540 // by the time we reach updateId |
1541 ContainerNode::insertedInto(insertionPoint); | 1541 ContainerNode::insertedInto(insertionPoint); |
1542 | 1542 |
1543 if (containsFullScreenElement() && parentElement() && | |
1544 !parentElement()->containsFullScreenElement()) | |
1545 setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true); | |
1546 | |
1547 DCHECK(!hasRareData() || !elementRareData()->hasPseudoElements()); | 1543 DCHECK(!hasRareData() || !elementRareData()->hasPseudoElements()); |
1548 | 1544 |
1549 if (!insertionPoint->isInTreeScope()) | 1545 if (!insertionPoint->isInTreeScope()) |
1550 return InsertionDone; | 1546 return InsertionDone; |
1551 | 1547 |
1552 if (hasRareData()) { | 1548 if (hasRareData()) { |
1553 ElementRareData* rareData = elementRareData(); | 1549 ElementRareData* rareData = elementRareData(); |
1554 rareData->clearClassListValueForQuirksMode(); | 1550 rareData->clearClassListValueForQuirksMode(); |
1555 if (rareData->intersectionObserverData()) | 1551 if (rareData->intersectionObserverData()) |
1556 rareData->intersectionObserverData()->activateValidIntersectionObservers( | 1552 rareData->intersectionObserverData()->activateValidIntersectionObservers( |
(...skipping 25 matching lines...) Expand all Loading... |
1582 setIsInCanvasSubtree(true); | 1578 setIsInCanvasSubtree(true); |
1583 | 1579 |
1584 return InsertionDone; | 1580 return InsertionDone; |
1585 } | 1581 } |
1586 | 1582 |
1587 void Element::removedFrom(ContainerNode* insertionPoint) { | 1583 void Element::removedFrom(ContainerNode* insertionPoint) { |
1588 bool wasInDocument = insertionPoint->isConnected(); | 1584 bool wasInDocument = insertionPoint->isConnected(); |
1589 | 1585 |
1590 DCHECK(!hasRareData() || !elementRareData()->hasPseudoElements()); | 1586 DCHECK(!hasRareData() || !elementRareData()->hasPseudoElements()); |
1591 | 1587 |
1592 if (Fullscreen::isCurrentFullScreenElement(*this)) { | |
1593 setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false); | |
1594 if (insertionPoint->isElementNode()) { | |
1595 toElement(insertionPoint)->setContainsFullScreenElement(false); | |
1596 toElement(insertionPoint) | |
1597 ->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries( | |
1598 false); | |
1599 } | |
1600 } | |
1601 | |
1602 if (Fullscreen* fullscreen = Fullscreen::fromIfExists(document())) | |
1603 fullscreen->elementRemoved(*this); | |
1604 | |
1605 if (document().page()) | 1588 if (document().page()) |
1606 document().page()->pointerLockController().elementRemoved(this); | 1589 document().page()->pointerLockController().elementRemoved(this); |
1607 | 1590 |
1608 setSavedLayerScrollOffset(ScrollOffset()); | 1591 setSavedLayerScrollOffset(ScrollOffset()); |
1609 | 1592 |
1610 if (insertionPoint->isInTreeScope() && treeScope() == document()) { | 1593 if (insertionPoint->isInTreeScope() && treeScope() == document()) { |
1611 const AtomicString& idValue = getIdAttribute(); | 1594 const AtomicString& idValue = getIdAttribute(); |
1612 if (!idValue.isNull()) | 1595 if (!idValue.isNull()) |
1613 updateId(insertionPoint->treeScope(), idValue, nullAtom); | 1596 updateId(insertionPoint->treeScope(), idValue, nullAtom); |
1614 | 1597 |
(...skipping 12 matching lines...) Expand all Loading... |
1627 | 1610 |
1628 if (getCustomElementState() == CustomElementState::Custom) | 1611 if (getCustomElementState() == CustomElementState::Custom) |
1629 CustomElement::enqueueDisconnectedCallback(this); | 1612 CustomElement::enqueueDisconnectedCallback(this); |
1630 else if (isUpgradedV0CustomElement()) | 1613 else if (isUpgradedV0CustomElement()) |
1631 V0CustomElement::didDetach(this, insertionPoint->document()); | 1614 V0CustomElement::didDetach(this, insertionPoint->document()); |
1632 | 1615 |
1633 if (needsStyleInvalidation()) | 1616 if (needsStyleInvalidation()) |
1634 document().styleEngine().styleInvalidator().clearInvalidation(*this); | 1617 document().styleEngine().styleInvalidator().clearInvalidation(*this); |
1635 } | 1618 } |
1636 | 1619 |
1637 document().removeFromTopLayer(this); | 1620 if (isInTopLayer()) { |
| 1621 if (isFullscreen()) |
| 1622 Fullscreen::elementRemoved(*this); |
| 1623 document().removeFromTopLayer(this); |
| 1624 } |
1638 | 1625 |
1639 clearElementFlag(IsInCanvasSubtree); | 1626 clearElementFlag(IsInCanvasSubtree); |
1640 | 1627 |
1641 if (hasRareData()) { | 1628 if (hasRareData()) { |
1642 ElementRareData* data = elementRareData(); | 1629 ElementRareData* data = elementRareData(); |
1643 | 1630 |
1644 data->clearRestyleFlags(); | 1631 data->clearRestyleFlags(); |
1645 | 1632 |
1646 if (ElementAnimations* elementAnimations = data->elementAnimations()) | 1633 if (ElementAnimations* elementAnimations = data->elementAnimations()) |
1647 elementAnimations->cssAnimations().cancel(); | 1634 elementAnimations->cssAnimations().cancel(); |
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3348 double Element::getFloatingPointAttribute(const QualifiedName& attributeName, | 3335 double Element::getFloatingPointAttribute(const QualifiedName& attributeName, |
3349 double fallbackValue) const { | 3336 double fallbackValue) const { |
3350 return parseToDoubleForNumberType(getAttribute(attributeName), fallbackValue); | 3337 return parseToDoubleForNumberType(getAttribute(attributeName), fallbackValue); |
3351 } | 3338 } |
3352 | 3339 |
3353 void Element::setFloatingPointAttribute(const QualifiedName& attributeName, | 3340 void Element::setFloatingPointAttribute(const QualifiedName& attributeName, |
3354 double value) { | 3341 double value) { |
3355 setAttribute(attributeName, AtomicString::number(value)); | 3342 setAttribute(attributeName, AtomicString::number(value)); |
3356 } | 3343 } |
3357 | 3344 |
3358 void Element::setContainsFullScreenElement(bool flag) { | |
3359 setElementFlag(ContainsFullScreenElement, flag); | |
3360 document().styleEngine().ensureUAStyleForFullscreen(); | |
3361 pseudoStateChanged(CSSSelector::PseudoFullScreenAncestor); | |
3362 } | |
3363 | |
3364 // Unlike Node::parentOrShadowHostElement, this can cross frame boundaries. | |
3365 static Element* nextAncestorElement(Element* element) { | |
3366 DCHECK(element); | |
3367 if (element->parentOrShadowHostElement()) | |
3368 return element->parentOrShadowHostElement(); | |
3369 | |
3370 Frame* frame = element->document().frame(); | |
3371 if (!frame || !frame->owner()) | |
3372 return nullptr; | |
3373 | |
3374 // Find the next LocalFrame on the ancestor chain, and return the | |
3375 // corresponding <iframe> element for the remote child if it exists. | |
3376 while (frame->tree().parent() && frame->tree().parent()->isRemoteFrame()) | |
3377 frame = frame->tree().parent(); | |
3378 | |
3379 if (frame->owner() && frame->owner()->isLocal()) | |
3380 return toHTMLFrameOwnerElement(frame->owner()); | |
3381 | |
3382 return nullptr; | |
3383 } | |
3384 | |
3385 void Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries( | |
3386 bool flag) { | |
3387 for (Element* element = nextAncestorElement(this); element; | |
3388 element = nextAncestorElement(element)) | |
3389 element->setContainsFullScreenElement(flag); | |
3390 } | |
3391 | |
3392 void Element::setIsInTopLayer(bool inTopLayer) { | 3345 void Element::setIsInTopLayer(bool inTopLayer) { |
3393 if (isInTopLayer() == inTopLayer) | 3346 if (isInTopLayer() == inTopLayer) |
3394 return; | 3347 return; |
3395 setElementFlag(IsInTopLayer, inTopLayer); | 3348 setElementFlag(IsInTopLayer, inTopLayer); |
3396 | 3349 |
3397 // We must ensure a reattach occurs so the layoutObject is inserted in the | 3350 // We must ensure a reattach occurs so the layoutObject is inserted in the |
3398 // correct sibling order under LayoutView according to its top layer position, | 3351 // correct sibling order under LayoutView according to its top layer position, |
3399 // or in its usual place if not in the top layer. | 3352 // or in its usual place if not in the top layer. |
3400 lazyReattachIfAttached(); | 3353 lazyReattachIfAttached(); |
3401 } | 3354 } |
3402 | 3355 |
| 3356 void Element::setIsFullscreen(bool isFullscreen) { |
| 3357 setElementFlag(IsFullscreen, isFullscreen); |
| 3358 } |
| 3359 |
3403 void Element::requestPointerLock() { | 3360 void Element::requestPointerLock() { |
3404 if (document().page()) | 3361 if (document().page()) |
3405 document().page()->pointerLockController().requestPointerLock(this); | 3362 document().page()->pointerLockController().requestPointerLock(this); |
3406 } | 3363 } |
3407 | 3364 |
3408 SpellcheckAttributeState Element::spellcheckAttributeState() const { | 3365 SpellcheckAttributeState Element::spellcheckAttributeState() const { |
3409 const AtomicString& value = fastGetAttribute(spellcheckAttr); | 3366 const AtomicString& value = fastGetAttribute(spellcheckAttr); |
3410 if (value == nullAtom) | 3367 if (value == nullAtom) |
3411 return SpellcheckAttributeDefault; | 3368 return SpellcheckAttributeDefault; |
3412 if (equalIgnoringCase(value, "true") || equalIgnoringCase(value, "")) | 3369 if (equalIgnoringCase(value, "true") || equalIgnoringCase(value, "")) |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3999 if (this == document().cssTarget()) | 3956 if (this == document().cssTarget()) |
4000 return false; | 3957 return false; |
4001 if (isHTMLElement() && toHTMLElement(this)->hasDirectionAuto()) | 3958 if (isHTMLElement() && toHTMLElement(this)->hasDirectionAuto()) |
4002 return false; | 3959 return false; |
4003 // TODO(kochi): This prevents any slotted elements from sharing styles. | 3960 // TODO(kochi): This prevents any slotted elements from sharing styles. |
4004 // Investigate cases where we share styles to optimize styling performance. | 3961 // Investigate cases where we share styles to optimize styling performance. |
4005 if (isChildOfV1ShadowHost()) | 3962 if (isChildOfV1ShadowHost()) |
4006 return false; | 3963 return false; |
4007 if (hasAnimations()) | 3964 if (hasAnimations()) |
4008 return false; | 3965 return false; |
4009 if (Fullscreen::isCurrentFullScreenElement(*this)) | 3966 if (Fullscreen::isFullscreenElement(*this)) |
4010 return false; | 3967 return false; |
4011 return true; | 3968 return true; |
4012 } | 3969 } |
4013 | 3970 |
4014 void Element::logAddElementIfIsolatedWorldAndInDocument( | 3971 void Element::logAddElementIfIsolatedWorldAndInDocument( |
4015 const char element[], | 3972 const char element[], |
4016 const QualifiedName& attr1) { | 3973 const QualifiedName& attr1) { |
4017 if (!isConnected()) | 3974 if (!isConnected()) |
4018 return; | 3975 return; |
4019 V8DOMActivityLogger* activityLogger = | 3976 V8DOMActivityLogger* activityLogger = |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4089 } | 4046 } |
4090 | 4047 |
4091 DEFINE_TRACE_WRAPPERS(Element) { | 4048 DEFINE_TRACE_WRAPPERS(Element) { |
4092 if (hasRareData()) { | 4049 if (hasRareData()) { |
4093 visitor->traceWrappers(elementRareData()); | 4050 visitor->traceWrappers(elementRareData()); |
4094 } | 4051 } |
4095 ContainerNode::traceWrappers(visitor); | 4052 ContainerNode::traceWrappers(visitor); |
4096 } | 4053 } |
4097 | 4054 |
4098 } // namespace blink | 4055 } // namespace blink |
OLD | NEW |