| 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 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1518 ContainerNode::attach(context); | 1518 ContainerNode::attach(context); |
| 1519 | 1519 |
| 1520 createPseudoElementIfNeeded(AFTER); | 1520 createPseudoElementIfNeeded(AFTER); |
| 1521 createPseudoElementIfNeeded(BACKDROP); | 1521 createPseudoElementIfNeeded(BACKDROP); |
| 1522 | 1522 |
| 1523 // We create the first-letter element after the :before, :after and | 1523 // We create the first-letter element after the :before, :after and |
| 1524 // children are attached because the first letter text could come | 1524 // children are attached because the first letter text could come |
| 1525 // from any of them. | 1525 // from any of them. |
| 1526 createPseudoElementIfNeeded(FIRST_LETTER); | 1526 createPseudoElementIfNeeded(FIRST_LETTER); |
| 1527 | 1527 |
| 1528 // The marker has to come after the other content, including the BEFORE pseu
do |
| 1529 // element so make sure we create it last. |
| 1530 if (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled()) |
| 1531 createPseudoElementIfNeeded(MARKER); |
| 1532 |
| 1528 if (hasRareData() && !layoutObject()) { | 1533 if (hasRareData() && !layoutObject()) { |
| 1529 if (ElementAnimations* elementAnimations = elementRareData()->elementAni
mations()) { | 1534 if (ElementAnimations* elementAnimations = elementRareData()->elementAni
mations()) { |
| 1530 elementAnimations->cssAnimations().cancel(); | 1535 elementAnimations->cssAnimations().cancel(); |
| 1531 elementAnimations->setAnimationStyleChange(false); | 1536 elementAnimations->setAnimationStyleChange(false); |
| 1532 } | 1537 } |
| 1533 } | 1538 } |
| 1534 } | 1539 } |
| 1535 | 1540 |
| 1536 void Element::detach(const AttachContext& context) | 1541 void Element::detach(const AttachContext& context) |
| 1537 { | 1542 { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1684 if (change > UpdatePseudoElements || childNeedsStyleRecalc()) { | 1689 if (change > UpdatePseudoElements || childNeedsStyleRecalc()) { |
| 1685 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->old
erShadowRoot()) { | 1690 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->old
erShadowRoot()) { |
| 1686 if (root->shouldCallRecalcStyle(change)) | 1691 if (root->shouldCallRecalcStyle(change)) |
| 1687 root->recalcStyle(change); | 1692 root->recalcStyle(change); |
| 1688 } | 1693 } |
| 1689 recalcChildStyle(change); | 1694 recalcChildStyle(change); |
| 1690 } | 1695 } |
| 1691 | 1696 |
| 1692 updatePseudoElement(AFTER, change); | 1697 updatePseudoElement(AFTER, change); |
| 1693 updatePseudoElement(BACKDROP, change); | 1698 updatePseudoElement(BACKDROP, change); |
| 1699 if (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled()) |
| 1700 updatePseudoElement(MARKER, change); |
| 1694 | 1701 |
| 1695 // If our children have changed then we need to force the first-letter | 1702 // If our children have changed then we need to force the first-letter |
| 1696 // checks as we don't know if they effected the first letter or not. | 1703 // checks as we don't know if they effected the first letter or not. |
| 1697 // This can be seen when a child transitions from floating to | 1704 // This can be seen when a child transitions from floating to |
| 1698 // non-floating we have to take it into account for the first letter. | 1705 // non-floating we have to take it into account for the first letter. |
| 1699 updatePseudoElement(FIRST_LETTER, childNeedsStyleRecalc() ? Force : chan
ge); | 1706 updatePseudoElement(FIRST_LETTER, childNeedsStyleRecalc() ? Force : chan
ge); |
| 1700 | 1707 |
| 1701 clearChildNeedsStyleRecalc(); | 1708 clearChildNeedsStyleRecalc(); |
| 1702 } | 1709 } |
| 1703 | 1710 |
| (...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2738 layoutObject()->mutableStyle()->removeCachedPseudoStyle(pseudoId); | 2745 layoutObject()->mutableStyle()->removeCachedPseudoStyle(pseudoId); |
| 2739 | 2746 |
| 2740 // PseudoElement styles hang off their parent element's style so if we n
eeded | 2747 // PseudoElement styles hang off their parent element's style so if we n
eeded |
| 2741 // a style recalc we should Force one on the pseudo. | 2748 // a style recalc we should Force one on the pseudo. |
| 2742 // FIXME: We should figure out the right text sibling to pass. | 2749 // FIXME: We should figure out the right text sibling to pass. |
| 2743 element->recalcStyle(change == UpdatePseudoElements ? Force : change); | 2750 element->recalcStyle(change == UpdatePseudoElements ? Force : change); |
| 2744 | 2751 |
| 2745 // Wait until our parent is not displayed or pseudoElementRendererIsNeed
ed | 2752 // Wait until our parent is not displayed or pseudoElementRendererIsNeed
ed |
| 2746 // is false, otherwise we could continuously create and destroy PseudoEl
ements | 2753 // is false, otherwise we could continuously create and destroy PseudoEl
ements |
| 2747 // when LayoutObject::isChildAllowed on our parent returns false for the | 2754 // when LayoutObject::isChildAllowed on our parent returns false for the |
| 2748 // PseudoElement's renderer for each style recalc. | 2755 // PseudoElement's layoutObject for each style recalc. |
| 2749 if (!layoutObject() || !pseudoElementRendererIsNeeded(layoutObject()->ge
tCachedPseudoStyle(pseudoId))) | 2756 if (!layoutObject() |
| 2757 || (!pseudoElementRendererIsNeeded(layoutObject()->getCachedPseudoSt
yle(pseudoId)) |
| 2758 && (pseudoId == MARKER && layoutObject()->style()->display() !=
LIST_ITEM))) { |
| 2750 elementRareData()->setPseudoElement(pseudoId, nullptr); | 2759 elementRareData()->setPseudoElement(pseudoId, nullptr); |
| 2760 } |
| 2751 } else if (pseudoId == FIRST_LETTER && element && change >= UpdatePseudoElem
ents && !FirstLetterPseudoElement::firstLetterTextRenderer(*element)) { | 2761 } else if (pseudoId == FIRST_LETTER && element && change >= UpdatePseudoElem
ents && !FirstLetterPseudoElement::firstLetterTextRenderer(*element)) { |
| 2752 // This can happen if we change to a float, for example. We need to clea
nup the | 2762 // This can happen if we change to a float, for example. We need to clea
nup the |
| 2753 // first-letter pseudoElement and then fix the text of the original rema
ining | 2763 // first-letter pseudoElement and then fix the text of the original rema
ining |
| 2754 // text renderer. | 2764 // text renderer. |
| 2755 // This can be seen in Test 7 of fast/css/first-letter-removed-added.htm
l | 2765 // This can be seen in Test 7 of fast/css/first-letter-removed-added.htm
l |
| 2756 elementRareData()->setPseudoElement(pseudoId, nullptr); | 2766 elementRareData()->setPseudoElement(pseudoId, nullptr); |
| 2757 } else if (change >= UpdatePseudoElements) { | 2767 } else if (change >= UpdatePseudoElements) { |
| 2758 createPseudoElementIfNeeded(pseudoId); | 2768 createPseudoElementIfNeeded(pseudoId); |
| 2759 } | 2769 } |
| 2760 } | 2770 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2774 element->reattach(); | 2784 element->reattach(); |
| 2775 else | 2785 else |
| 2776 elementRareData()->setPseudoElement(FIRST_LETTER, nullptr); | 2786 elementRareData()->setPseudoElement(FIRST_LETTER, nullptr); |
| 2777 return true; | 2787 return true; |
| 2778 } | 2788 } |
| 2779 return false; | 2789 return false; |
| 2780 } | 2790 } |
| 2781 | 2791 |
| 2782 void Element::createPseudoElementIfNeeded(PseudoId pseudoId) | 2792 void Element::createPseudoElementIfNeeded(PseudoId pseudoId) |
| 2783 { | 2793 { |
| 2784 if (isPseudoElement()) | 2794 if (isPseudoElement() && (pseudoId != MARKER || isMarkerPseudoElement())) |
| 2785 return; | 2795 return; |
| 2786 | 2796 |
| 2787 // Document::ensureStyleResolver is not inlined and shows up on profiles, av
oid it here. | 2797 // Document::ensureStyleResolver is not inlined and shows up on profiles, av
oid it here. |
| 2788 RefPtrWillBeRawPtr<PseudoElement> element = document().styleEngine().ensureR
esolver().createPseudoElementIfNeeded(*this, pseudoId); | 2798 RefPtrWillBeRawPtr<PseudoElement> element = document().styleEngine().ensure
Resolver().createPseudoElementIfNeeded(*this, pseudoId); |
| 2789 if (!element) | 2799 if (!element) |
| 2790 return; | 2800 return; |
| 2791 | |
| 2792 if (pseudoId == BACKDROP) | 2801 if (pseudoId == BACKDROP) |
| 2793 document().addToTopLayer(element.get(), this); | 2802 document().addToTopLayer(element.get(), this); |
| 2803 |
| 2794 element->insertedInto(this); | 2804 element->insertedInto(this); |
| 2795 element->attach(); | 2805 element->attach(); |
| 2796 | 2806 |
| 2797 InspectorInstrumentation::pseudoElementCreated(element.get()); | 2807 InspectorInstrumentation::pseudoElementCreated(element.get()); |
| 2798 | 2808 |
| 2799 ensureElementRareData().setPseudoElement(pseudoId, element.release()); | 2809 ensureElementRareData().setPseudoElement(pseudoId, element.release()); |
| 2800 } | 2810 } |
| 2801 | 2811 |
| 2802 PseudoElement* Element::pseudoElement(PseudoId pseudoId) const | 2812 PseudoElement* Element::pseudoElement(PseudoId pseudoId) const |
| 2803 { | 2813 { |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3500 { | 3510 { |
| 3501 #if ENABLE(OILPAN) | 3511 #if ENABLE(OILPAN) |
| 3502 if (hasRareData()) | 3512 if (hasRareData()) |
| 3503 visitor->trace(elementRareData()); | 3513 visitor->trace(elementRareData()); |
| 3504 visitor->trace(m_elementData); | 3514 visitor->trace(m_elementData); |
| 3505 #endif | 3515 #endif |
| 3506 ContainerNode::trace(visitor); | 3516 ContainerNode::trace(visitor); |
| 3507 } | 3517 } |
| 3508 | 3518 |
| 3509 } // namespace blink | 3519 } // namespace blink |
| OLD | NEW |