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 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2750 layoutObject()->mutableStyle()->removeCachedPseudoStyle(pseudoId); | 2757 layoutObject()->mutableStyle()->removeCachedPseudoStyle(pseudoId); |
2751 | 2758 |
2752 // PseudoElement styles hang off their parent element's style so if we n eeded | 2759 // PseudoElement styles hang off their parent element's style so if we n eeded |
2753 // a style recalc we should Force one on the pseudo. | 2760 // a style recalc we should Force one on the pseudo. |
2754 // FIXME: We should figure out the right text sibling to pass. | 2761 // FIXME: We should figure out the right text sibling to pass. |
2755 element->recalcStyle(change == UpdatePseudoElements ? Force : change); | 2762 element->recalcStyle(change == UpdatePseudoElements ? Force : change); |
2756 | 2763 |
2757 // Wait until our parent is not displayed or pseudoElementRendererIsNeed ed | 2764 // Wait until our parent is not displayed or pseudoElementRendererIsNeed ed |
2758 // is false, otherwise we could continuously create and destroy PseudoEl ements | 2765 // is false, otherwise we could continuously create and destroy PseudoEl ements |
2759 // when LayoutObject::isChildAllowed on our parent returns false for the | 2766 // when LayoutObject::isChildAllowed on our parent returns false for the |
2760 // PseudoElement's renderer for each style recalc. | 2767 // PseudoElement's layoutObject for each style recalc. |
2761 if (!layoutObject() || !pseudoElementRendererIsNeeded(layoutObject()->ge tCachedPseudoStyle(pseudoId))) | 2768 if (!layoutObject() |
2769 || (!pseudoElementRendererIsNeeded(layoutObject()->getCachedPseudoSt yle(pseudoId)) | |
2770 && (pseudoId == MARKER && layoutObject()->style()->display() != LIST_ITEM))) { | |
esprehn
2015/04/22 07:45:45
What's up with this check for != LIST_ITEM all ove
dsinclair
2015/04/22 20:00:38
If you have something like: <div style="display: l
| |
2762 elementRareData()->setPseudoElement(pseudoId, nullptr); | 2771 elementRareData()->setPseudoElement(pseudoId, nullptr); |
2772 } | |
2763 } else if (pseudoId == FIRST_LETTER && element && change >= UpdatePseudoElem ents && !FirstLetterPseudoElement::firstLetterTextRenderer(*element)) { | 2773 } else if (pseudoId == FIRST_LETTER && element && change >= UpdatePseudoElem ents && !FirstLetterPseudoElement::firstLetterTextRenderer(*element)) { |
2764 // This can happen if we change to a float, for example. We need to clea nup the | 2774 // This can happen if we change to a float, for example. We need to clea nup the |
2765 // first-letter pseudoElement and then fix the text of the original rema ining | 2775 // first-letter pseudoElement and then fix the text of the original rema ining |
2766 // text renderer. | 2776 // text renderer. |
2767 // This can be seen in Test 7 of fast/css/first-letter-removed-added.htm l | 2777 // This can be seen in Test 7 of fast/css/first-letter-removed-added.htm l |
2768 elementRareData()->setPseudoElement(pseudoId, nullptr); | 2778 elementRareData()->setPseudoElement(pseudoId, nullptr); |
2769 } else if (change >= UpdatePseudoElements) { | 2779 } else if (change >= UpdatePseudoElements) { |
2770 createPseudoElementIfNeeded(pseudoId); | 2780 createPseudoElementIfNeeded(pseudoId); |
2771 } | 2781 } |
2772 } | 2782 } |
(...skipping 13 matching lines...) Expand all Loading... | |
2786 element->reattach(); | 2796 element->reattach(); |
2787 else | 2797 else |
2788 elementRareData()->setPseudoElement(FIRST_LETTER, nullptr); | 2798 elementRareData()->setPseudoElement(FIRST_LETTER, nullptr); |
2789 return true; | 2799 return true; |
2790 } | 2800 } |
2791 return false; | 2801 return false; |
2792 } | 2802 } |
2793 | 2803 |
2794 void Element::createPseudoElementIfNeeded(PseudoId pseudoId) | 2804 void Element::createPseudoElementIfNeeded(PseudoId pseudoId) |
2795 { | 2805 { |
2796 if (isPseudoElement()) | 2806 if (isPseudoElement() && (pseudoId != MARKER || isMarkerPseudoElement())) |
esprehn
2015/04/22 07:45:45
Marker shouldn't need a special case here. PseudoE
dsinclair
2015/04/22 20:00:38
With marker they can. If we have something like:
| |
2797 return; | 2807 return; |
2798 | 2808 |
2799 // Document::ensureStyleResolver is not inlined and shows up on profiles, av oid it here. | 2809 // Document::ensureStyleResolver is not inlined and shows up on profiles, av oid it here. |
2800 RefPtrWillBeRawPtr<PseudoElement> element = document().styleEngine().ensureR esolver().createPseudoElementIfNeeded(*this, pseudoId); | 2810 RefPtrWillBeRawPtr<PseudoElement> element = document().styleEngine().ensure Resolver().createPseudoElementIfNeeded(*this, pseudoId); |
2801 if (!element) | 2811 if (!element) |
2802 return; | 2812 return; |
2803 | |
2804 if (pseudoId == BACKDROP) | 2813 if (pseudoId == BACKDROP) |
2805 document().addToTopLayer(element.get(), this); | 2814 document().addToTopLayer(element.get(), this); |
2815 | |
2806 element->insertedInto(this); | 2816 element->insertedInto(this); |
2807 element->attach(); | 2817 element->attach(); |
2808 | 2818 |
2809 InspectorInstrumentation::pseudoElementCreated(element.get()); | 2819 InspectorInstrumentation::pseudoElementCreated(element.get()); |
2810 | 2820 |
2811 ensureElementRareData().setPseudoElement(pseudoId, element.release()); | 2821 ensureElementRareData().setPseudoElement(pseudoId, element.release()); |
2812 } | 2822 } |
2813 | 2823 |
2814 PseudoElement* Element::pseudoElement(PseudoId pseudoId) const | 2824 PseudoElement* Element::pseudoElement(PseudoId pseudoId) const |
2815 { | 2825 { |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3512 { | 3522 { |
3513 #if ENABLE(OILPAN) | 3523 #if ENABLE(OILPAN) |
3514 if (hasRareData()) | 3524 if (hasRareData()) |
3515 visitor->trace(elementRareData()); | 3525 visitor->trace(elementRareData()); |
3516 visitor->trace(m_elementData); | 3526 visitor->trace(m_elementData); |
3517 #endif | 3527 #endif |
3518 ContainerNode::trace(visitor); | 3528 ContainerNode::trace(visitor); |
3519 } | 3529 } |
3520 | 3530 |
3521 } // namespace blink | 3531 } // namespace blink |
OLD | NEW |