| 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 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1456 ContainerNode::attach(context); | 1456 ContainerNode::attach(context); |
| 1457 | 1457 |
| 1458 createPseudoElementIfNeeded(AFTER); | 1458 createPseudoElementIfNeeded(AFTER); |
| 1459 createPseudoElementIfNeeded(BACKDROP); | 1459 createPseudoElementIfNeeded(BACKDROP); |
| 1460 | 1460 |
| 1461 // We create the first-letter element after the :before, :after and | 1461 // We create the first-letter element after the :before, :after and |
| 1462 // children are attached because the first letter text could come | 1462 // children are attached because the first letter text could come |
| 1463 // from any of them. | 1463 // from any of them. |
| 1464 createPseudoElementIfNeeded(FIRST_LETTER); | 1464 createPseudoElementIfNeeded(FIRST_LETTER); |
| 1465 | 1465 |
| 1466 // The marker has to come after the other content, including the BEFORE pseu
do |
| 1467 // element so make sure we create it last. |
| 1468 if (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled()) |
| 1469 createPseudoElementIfNeeded(MARKER); |
| 1470 |
| 1466 if (hasRareData() && !renderer()) { | 1471 if (hasRareData() && !renderer()) { |
| 1467 if (ActiveAnimations* activeAnimations = elementRareData()->activeAnimat
ions()) { | 1472 if (ActiveAnimations* activeAnimations = elementRareData()->activeAnimat
ions()) { |
| 1468 activeAnimations->cssAnimations().cancel(); | 1473 activeAnimations->cssAnimations().cancel(); |
| 1469 activeAnimations->setAnimationStyleChange(false); | 1474 activeAnimations->setAnimationStyleChange(false); |
| 1470 } | 1475 } |
| 1471 } | 1476 } |
| 1472 } | 1477 } |
| 1473 | 1478 |
| 1474 void Element::detach(const AttachContext& context) | 1479 void Element::detach(const AttachContext& context) |
| 1475 { | 1480 { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1619 if (change > UpdatePseudoElements || childNeedsStyleRecalc()) { | 1624 if (change > UpdatePseudoElements || childNeedsStyleRecalc()) { |
| 1620 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->old
erShadowRoot()) { | 1625 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->old
erShadowRoot()) { |
| 1621 if (root->shouldCallRecalcStyle(change)) | 1626 if (root->shouldCallRecalcStyle(change)) |
| 1622 root->recalcStyle(change); | 1627 root->recalcStyle(change); |
| 1623 } | 1628 } |
| 1624 recalcChildStyle(change); | 1629 recalcChildStyle(change); |
| 1625 } | 1630 } |
| 1626 | 1631 |
| 1627 updatePseudoElement(AFTER, change); | 1632 updatePseudoElement(AFTER, change); |
| 1628 updatePseudoElement(BACKDROP, change); | 1633 updatePseudoElement(BACKDROP, change); |
| 1634 if (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled()) |
| 1635 updatePseudoElement(MARKER, change); |
| 1629 | 1636 |
| 1630 // If our children have changed then we need to force the first-letter | 1637 // If our children have changed then we need to force the first-letter |
| 1631 // checks as we don't know if they effected the first letter or not. | 1638 // checks as we don't know if they effected the first letter or not. |
| 1632 // This can be seen when a child transitions from floating to | 1639 // This can be seen when a child transitions from floating to |
| 1633 // non-floating we have to take it into account for the first letter. | 1640 // non-floating we have to take it into account for the first letter. |
| 1634 updatePseudoElement(FIRST_LETTER, childNeedsStyleRecalc() ? Force : chan
ge); | 1641 updatePseudoElement(FIRST_LETTER, childNeedsStyleRecalc() ? Force : chan
ge); |
| 1635 | 1642 |
| 1636 clearChildNeedsStyleRecalc(); | 1643 clearChildNeedsStyleRecalc(); |
| 1637 } | 1644 } |
| 1638 | 1645 |
| (...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2625 | 2632 |
| 2626 // PseudoElement styles hang off their parent element's style so if we n
eeded | 2633 // PseudoElement styles hang off their parent element's style so if we n
eeded |
| 2627 // a style recalc we should Force one on the pseudo. | 2634 // a style recalc we should Force one on the pseudo. |
| 2628 // FIXME: We should figure out the right text sibling to pass. | 2635 // FIXME: We should figure out the right text sibling to pass. |
| 2629 element->recalcStyle(change == UpdatePseudoElements ? Force : change); | 2636 element->recalcStyle(change == UpdatePseudoElements ? Force : change); |
| 2630 | 2637 |
| 2631 // Wait until our parent is not displayed or pseudoElementRendererIsNeed
ed | 2638 // Wait until our parent is not displayed or pseudoElementRendererIsNeed
ed |
| 2632 // is false, otherwise we could continuously create and destroy PseudoEl
ements | 2639 // is false, otherwise we could continuously create and destroy PseudoEl
ements |
| 2633 // when RenderObject::isChildAllowed on our parent returns false for the | 2640 // when RenderObject::isChildAllowed on our parent returns false for the |
| 2634 // PseudoElement's renderer for each style recalc. | 2641 // PseudoElement's renderer for each style recalc. |
| 2635 if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedP
seudoStyle(pseudoId))) | 2642 if (!renderer() |
| 2643 || (!pseudoElementRendererIsNeeded(renderer()->getCachedPseudoStyle(
pseudoId)) && (pseudoId == MARKER && renderer()->style()->display() != LIST_ITEM
))) |
| 2636 elementRareData()->setPseudoElement(pseudoId, nullptr); | 2644 elementRareData()->setPseudoElement(pseudoId, nullptr); |
| 2637 } else if (pseudoId == FIRST_LETTER && element && change >= UpdatePseudoElem
ents && !FirstLetterPseudoElement::firstLetterTextRenderer(*element)) { | 2645 } else if (pseudoId == FIRST_LETTER && element && change >= UpdatePseudoElem
ents && !FirstLetterPseudoElement::firstLetterTextRenderer(*element)) { |
| 2638 // This can happen if we change to a float, for example. We need to clea
nup the | 2646 // This can happen if we change to a float, for example. We need to clea
nup the |
| 2639 // first-letter pseudoElement and then fix the text of the original rema
ining | 2647 // first-letter pseudoElement and then fix the text of the original rema
ining |
| 2640 // text renderer. | 2648 // text renderer. |
| 2641 // This can be seen in Test 7 of fast/css/first-letter-removed-added.htm
l | 2649 // This can be seen in Test 7 of fast/css/first-letter-removed-added.htm
l |
| 2642 elementRareData()->setPseudoElement(pseudoId, nullptr); | 2650 elementRareData()->setPseudoElement(pseudoId, nullptr); |
| 2643 } else if (change >= UpdatePseudoElements) { | 2651 } else if (change >= UpdatePseudoElements) { |
| 2644 createPseudoElementIfNeeded(pseudoId); | 2652 createPseudoElementIfNeeded(pseudoId); |
| 2645 } | 2653 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2660 element->reattach(); | 2668 element->reattach(); |
| 2661 else | 2669 else |
| 2662 elementRareData()->setPseudoElement(FIRST_LETTER, nullptr); | 2670 elementRareData()->setPseudoElement(FIRST_LETTER, nullptr); |
| 2663 return true; | 2671 return true; |
| 2664 } | 2672 } |
| 2665 return false; | 2673 return false; |
| 2666 } | 2674 } |
| 2667 | 2675 |
| 2668 void Element::createPseudoElementIfNeeded(PseudoId pseudoId) | 2676 void Element::createPseudoElementIfNeeded(PseudoId pseudoId) |
| 2669 { | 2677 { |
| 2670 if (isPseudoElement()) | 2678 if (isPseudoElement() && (pseudoId != MARKER || isMarkerPseudoElement())) |
| 2671 return; | 2679 return; |
| 2672 | 2680 |
| 2673 // Document::ensureStyleResolver is not inlined and shows up on profiles, av
oid it here. | 2681 // Document::ensureStyleResolver is not inlined and shows up on profiles, av
oid it here. |
| 2674 StyleEngine* engine = document().styleEngine(); | 2682 StyleEngine* engine = document().styleEngine(); |
| 2675 RefPtrWillBeRawPtr<PseudoElement> element = engine->ensureResolver().createP
seudoElementIfNeeded(*this, pseudoId); | 2683 RefPtrWillBeRawPtr<PseudoElement> element = engine->ensureResolver().createP
seudoElementIfNeeded(*this, pseudoId); |
| 2676 if (!element) | 2684 if (!element) |
| 2677 return; | 2685 return; |
| 2678 | |
| 2679 if (pseudoId == BACKDROP) | 2686 if (pseudoId == BACKDROP) |
| 2680 document().addToTopLayer(element.get(), this); | 2687 document().addToTopLayer(element.get(), this); |
| 2688 |
| 2681 element->insertedInto(this); | 2689 element->insertedInto(this); |
| 2682 element->attach(); | 2690 element->attach(); |
| 2683 | 2691 |
| 2684 InspectorInstrumentation::pseudoElementCreated(element.get()); | 2692 InspectorInstrumentation::pseudoElementCreated(element.get()); |
| 2685 | 2693 |
| 2686 ensureElementRareData().setPseudoElement(pseudoId, element.release()); | 2694 ensureElementRareData().setPseudoElement(pseudoId, element.release()); |
| 2687 } | 2695 } |
| 2688 | 2696 |
| 2689 PseudoElement* Element::pseudoElement(PseudoId pseudoId) const | 2697 PseudoElement* Element::pseudoElement(PseudoId pseudoId) const |
| 2690 { | 2698 { |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3386 { | 3394 { |
| 3387 #if ENABLE(OILPAN) | 3395 #if ENABLE(OILPAN) |
| 3388 if (hasRareData()) | 3396 if (hasRareData()) |
| 3389 visitor->trace(elementRareData()); | 3397 visitor->trace(elementRareData()); |
| 3390 visitor->trace(m_elementData); | 3398 visitor->trace(m_elementData); |
| 3391 #endif | 3399 #endif |
| 3392 ContainerNode::trace(visitor); | 3400 ContainerNode::trace(visitor); |
| 3393 } | 3401 } |
| 3394 | 3402 |
| 3395 } // namespace blink | 3403 } // namespace blink |
| OLD | NEW |