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 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1583 if (ActiveAnimations* activeAnimations = data->activeAnimations( )) | 1583 if (ActiveAnimations* activeAnimations = data->activeAnimations( )) |
1584 activeAnimations->setAnimationStyleChange(false); | 1584 activeAnimations->setAnimationStyleChange(false); |
1585 } | 1585 } |
1586 } | 1586 } |
1587 if (parentRenderStyle()) | 1587 if (parentRenderStyle()) |
1588 change = recalcOwnStyle(change); | 1588 change = recalcOwnStyle(change); |
1589 clearNeedsStyleRecalc(); | 1589 clearNeedsStyleRecalc(); |
1590 } | 1590 } |
1591 | 1591 |
1592 // If we reattached we don't need to recalc the style of our descendants any more. | 1592 // If we reattached we don't need to recalc the style of our descendants any more. |
1593 if ((change >= Inherit && change < Reattach) || childNeedsStyleRecalc()) | 1593 if ((change >= Inherit && change < Reattach) || childNeedsStyleRecalc()) { |
1594 recalcChildStyle(change); | 1594 recalcChildStyle(change); |
1595 clearChildNeedsStyleRecalc(); | 1595 clearChildNeedsStyleRecalc(); |
1596 } else if (change == UpdatePseudoElements) { | |
1597 updatePseudoElement(BEFORE, change); | |
1598 updatePseudoElement(AFTER, change); | |
1599 updatePseudoElement(BACKDROP, change); | |
esprehn
2014/01/24 22:53:49
Can you just merge this into recalcChildStyle? If
rune
2014/01/25 00:00:38
I've tried in patch set 6. I've changed it so that
| |
1600 } | |
1596 | 1601 |
1597 if (hasCustomStyleCallbacks()) | 1602 if (hasCustomStyleCallbacks()) |
1598 didRecalcStyle(change); | 1603 didRecalcStyle(change); |
1599 | 1604 |
1600 if (change == Reattach) | 1605 if (change == Reattach) |
1601 reattachWhitespaceSiblings(nextTextSibling); | 1606 reattachWhitespaceSiblings(nextTextSibling); |
1602 } | 1607 } |
1603 | 1608 |
1604 StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change) | 1609 StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change) |
1605 { | 1610 { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1644 // all the way down the tree. This is simpler than having to maintain a cach e of objects (and such font size changes should be rare anyway). | 1649 // all the way down the tree. This is simpler than having to maintain a cach e of objects (and such font size changes should be rare anyway). |
1645 if (document().styleEngine()->usesRemUnits() && document().documentElement() == this && oldStyle->fontSize() != newStyle->fontSize()) { | 1650 if (document().styleEngine()->usesRemUnits() && document().documentElement() == this && oldStyle->fontSize() != newStyle->fontSize()) { |
1646 // Cached RenderStyles may depend on the re units. | 1651 // Cached RenderStyles may depend on the re units. |
1647 document().ensureStyleResolver().invalidateMatchedPropertiesCache(); | 1652 document().ensureStyleResolver().invalidateMatchedPropertiesCache(); |
1648 return Force; | 1653 return Force; |
1649 } | 1654 } |
1650 | 1655 |
1651 if (styleChangeType() >= SubtreeStyleChange) | 1656 if (styleChangeType() >= SubtreeStyleChange) |
1652 return Force; | 1657 return Force; |
1653 | 1658 |
1654 if (change <= Inherit) | 1659 if (change > Inherit || localChange > Inherit) |
1655 return localChange; | 1660 return max(localChange, change); |
1656 | 1661 |
1657 return max(localChange, change); | 1662 if (localChange < Inherit && (oldStyle->hasContentPseudoStyle() || newStyle- >hasContentPseudoStyle())) |
1663 return UpdatePseudoElements; | |
1664 | |
1665 return localChange; | |
1658 } | 1666 } |
1659 | 1667 |
1660 void Element::recalcChildStyle(StyleRecalcChange change) | 1668 void Element::recalcChildStyle(StyleRecalcChange change) |
1661 { | 1669 { |
1662 ASSERT(document().inStyleRecalc()); | 1670 ASSERT(document().inStyleRecalc()); |
1663 ASSERT(change >= Inherit || childNeedsStyleRecalc()); | 1671 ASSERT(change >= Inherit || childNeedsStyleRecalc()); |
1664 ASSERT(!needsStyleRecalc()); | 1672 ASSERT(!needsStyleRecalc()); |
1665 | 1673 |
1666 StyleResolverParentPusher parentPusher(*this); | 1674 StyleResolverParentPusher parentPusher(*this); |
1667 | 1675 |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2761 if (!hasAttributes()) | 2769 if (!hasAttributes()) |
2762 return; | 2770 return; |
2763 for (unsigned i = 0; i < attributeCount(); ++i) { | 2771 for (unsigned i = 0; i < attributeCount(); ++i) { |
2764 if (RefPtr<Attr> attr = attrIfExists(attributeItem(i)->name())) | 2772 if (RefPtr<Attr> attr = attrIfExists(attributeItem(i)->name())) |
2765 attr->normalize(); | 2773 attr->normalize(); |
2766 } | 2774 } |
2767 } | 2775 } |
2768 | 2776 |
2769 void Element::updatePseudoElement(PseudoId pseudoId, StyleRecalcChange change) | 2777 void Element::updatePseudoElement(PseudoId pseudoId, StyleRecalcChange change) |
2770 { | 2778 { |
2779 ASSERT(!needsStyleRecalc()); | |
2771 PseudoElement* element = pseudoElement(pseudoId); | 2780 PseudoElement* element = pseudoElement(pseudoId); |
2772 if (element && (needsStyleRecalc() || shouldRecalcStyle(change, element))) { | 2781 if (element && (change == UpdatePseudoElements || shouldRecalcStyle(change, element))) { |
2782 | |
2773 // Need to clear the cached style if the PseudoElement wants a recalc so it | 2783 // Need to clear the cached style if the PseudoElement wants a recalc so it |
2774 // computes a new style. | 2784 // computes a new style. |
2775 if (element->needsStyleRecalc()) | 2785 if (element->needsStyleRecalc()) |
2776 renderer()->style()->removeCachedPseudoStyle(pseudoId); | 2786 renderer()->style()->removeCachedPseudoStyle(pseudoId); |
2777 | 2787 |
2778 // PseudoElement styles hang off their parent element's style so if we n eeded | 2788 // PseudoElement styles hang off their parent element's style so if we n eeded |
2779 // a style recalc we should Force one on the pseudo. | 2789 // a style recalc we should Force one on the pseudo. |
2780 // FIXME: We should figure out the right text sibling to pass. | 2790 // FIXME: We should figure out the right text sibling to pass. |
2781 element->recalcStyle(needsStyleRecalc() ? Force : change); | 2791 element->recalcStyle(change == UpdatePseudoElements ? Force : change); |
2782 | 2792 |
2783 // Wait until our parent is not displayed or pseudoElementRendererIsNeed ed | 2793 // Wait until our parent is not displayed or pseudoElementRendererIsNeed ed |
2784 // is false, otherwise we could continously create and destroy PseudoEle ments | 2794 // is false, otherwise we could continously create and destroy PseudoEle ments |
2785 // when RenderObject::isChildAllowed on our parent returns false for the | 2795 // when RenderObject::isChildAllowed on our parent returns false for the |
2786 // PseudoElement's renderer for each style recalc. | 2796 // PseudoElement's renderer for each style recalc. |
2787 if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedP seudoStyle(pseudoId))) | 2797 if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedP seudoStyle(pseudoId))) |
2788 elementRareData()->setPseudoElement(pseudoId, 0); | 2798 elementRareData()->setPseudoElement(pseudoId, 0); |
2789 } else if (change >= Inherit || needsStyleRecalc()) | 2799 } else if (change >= UpdatePseudoElements) { |
2790 createPseudoElementIfNeeded(pseudoId); | 2800 createPseudoElementIfNeeded(pseudoId); |
2801 } | |
2791 } | 2802 } |
2792 | 2803 |
2793 bool Element::needsPseudoElement(PseudoId pseudoId, const RenderStyle& style) co nst | 2804 bool Element::needsPseudoElement(PseudoId pseudoId, const RenderStyle& style) co nst |
2794 { | 2805 { |
2795 if (pseudoId == BACKDROP && !isInTopLayer()) | 2806 if (pseudoId == BACKDROP && !isInTopLayer()) |
2796 return false; | 2807 return false; |
2797 if (!renderer() || !pseudoElementRendererIsNeeded(&style)) | 2808 if (!renderer() || !pseudoElementRendererIsNeeded(&style)) |
2798 return false; | 2809 return false; |
2799 /* It's safe to have a backdrop since its renderer is always a child of Rend erView. */ | 2810 /* It's safe to have a backdrop since its renderer is always a child of Rend erView. */ |
2800 if (pseudoId != BACKDROP && !renderer()->canHaveGeneratedChildren()) | 2811 if (pseudoId != BACKDROP && !renderer()->canHaveGeneratedChildren()) |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3642 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems | 3653 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems |
3643 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405 | 3654 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405 |
3644 if (hasTagName(optionTag) || hasTagName(optgroupTag)) | 3655 if (hasTagName(optionTag) || hasTagName(optgroupTag)) |
3645 return false; | 3656 return false; |
3646 if (FullscreenElementStack::isActiveFullScreenElement(this)) | 3657 if (FullscreenElementStack::isActiveFullScreenElement(this)) |
3647 return false; | 3658 return false; |
3648 return true; | 3659 return true; |
3649 } | 3660 } |
3650 | 3661 |
3651 } // namespace WebCore | 3662 } // namespace WebCore |
OLD | NEW |