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 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. |
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
828 | 828 |
829 inline void Node::setStyleChange(StyleChangeType changeType) | 829 inline void Node::setStyleChange(StyleChangeType changeType) |
830 { | 830 { |
831 m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType; | 831 m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType; |
832 } | 832 } |
833 | 833 |
834 inline void Node::markAncestorsWithChildNeedsStyleRecalc() | 834 inline void Node::markAncestorsWithChildNeedsStyleRecalc() |
835 { | 835 { |
836 for (ContainerNode* p = parentOrShadowHostNode(); p && !p->childNeedsStyleRe calc(); p = p->parentOrShadowHostNode()) | 836 for (ContainerNode* p = parentOrShadowHostNode(); p && !p->childNeedsStyleRe calc(); p = p->parentOrShadowHostNode()) |
837 p->setChildNeedsStyleRecalc(); | 837 p->setChildNeedsStyleRecalc(); |
838 } | |
839 | |
840 inline void Node::markDistributionsWithNeedsStyleRecalc() | |
841 { | |
842 for (ShadowRoot* root = containingShadowRoot(); root; root = root->host()->c ontainingShadowRoot()) { | |
843 ScopeContentDistribution* distribution = root->scopeDistribution(); | |
844 if (!distribution || !distribution->hasInsertionPoint(root)) | |
esprehn
2013/06/13 02:25:38
hasInsertionPoint is static, this doesn't make sen
| |
845 continue; | |
846 root->host()->setNeedsStyleRecalc(); | |
847 const Vector<RefPtr<InsertionPoint> >& insertionPoints = distribution->e nsureInsertionPointList(root); | |
848 for (unsigned i = 0; i < insertionPoints.size(); ++i) | |
849 insertionPoints[i]->setNeedsStyleRecalc(); | |
esprehn
2013/06/13 02:25:38
This is much too aggressive. Now if we setNeedsSty
| |
850 } | |
851 } | |
852 | |
853 inline void Node::propagateStyleRecalcMarking() | |
854 { | |
855 markAncestorsWithChildNeedsStyleRecalc(); | |
856 markDistributionsWithNeedsStyleRecalc(); | |
838 | 857 |
839 if (document()->childNeedsStyleRecalc()) | 858 if (document()->childNeedsStyleRecalc()) |
840 document()->scheduleStyleRecalc(); | 859 document()->scheduleStyleRecalc(); |
841 } | 860 } |
842 | 861 |
843 void Node::refEventTarget() | 862 void Node::refEventTarget() |
844 { | 863 { |
845 ref(); | 864 ref(); |
846 } | 865 } |
847 | 866 |
848 void Node::derefEventTarget() | 867 void Node::derefEventTarget() |
849 { | 868 { |
850 deref(); | 869 deref(); |
851 } | 870 } |
852 | 871 |
853 void Node::setNeedsStyleRecalc(StyleChangeType changeType) | 872 void Node::setNeedsStyleRecalc(StyleChangeType changeType) |
854 { | 873 { |
855 ASSERT(changeType != NoStyleChange); | 874 ASSERT(changeType != NoStyleChange); |
856 if (!attached()) // changed compared to what? | 875 if (!attached()) // changed compared to what? |
857 return; | 876 return; |
858 | 877 |
859 StyleChangeType existingChangeType = styleChangeType(); | 878 StyleChangeType existingChangeType = styleChangeType(); |
860 if (changeType > existingChangeType) | 879 if (changeType > existingChangeType) |
861 setStyleChange(changeType); | 880 setStyleChange(changeType); |
862 | 881 |
863 if (existingChangeType == NoStyleChange) | 882 if (existingChangeType == NoStyleChange) |
864 markAncestorsWithChildNeedsStyleRecalc(); | 883 propagateStyleRecalcMarking(); |
865 } | 884 } |
866 | 885 |
867 void Node::lazyAttach() | 886 void Node::lazyAttach() |
868 { | 887 { |
869 // It's safe to synchronously attach here because we're in the middle of sty le recalc | 888 // It's safe to synchronously attach here because we're in the middle of sty le recalc |
870 // while it's not safe to mark nodes as needing style recalc except in the l oop in | 889 // while it's not safe to mark nodes as needing style recalc except in the l oop in |
871 // Element::recalcStyle because we may mark an ancestor as not needing recal c and | 890 // Element::recalcStyle because we may mark an ancestor as not needing recal c and |
872 // then the node would never get updated. One place this currently happens i s | 891 // then the node would never get updated. One place this currently happens i s |
873 // HTMLObjectElement::renderFallbackContent which may call lazyAttach from i nside | 892 // HTMLObjectElement::renderFallbackContent which may call lazyAttach from i nside |
874 // attach which was triggered by a recalcStyle. | 893 // attach which was triggered by a recalcStyle. |
875 if (document()->inStyleRecalc()) { | 894 if (document()->inStyleRecalc()) { |
876 attach(); | 895 attach(); |
877 return; | 896 return; |
878 } | 897 } |
879 setStyleChange(FullStyleChange); | 898 setStyleChange(FullStyleChange); |
880 markAncestorsWithChildNeedsStyleRecalc(); | 899 propagateStyleRecalcMarking(); |
881 } | 900 } |
882 | 901 |
883 bool Node::supportsFocus() const | 902 bool Node::supportsFocus() const |
884 { | 903 { |
885 return false; | 904 return false; |
886 } | 905 } |
887 | 906 |
888 bool Node::isFocusable() const | 907 bool Node::isFocusable() const |
889 { | 908 { |
890 if (!inDocument() || !supportsFocus()) | 909 if (!inDocument() || !supportsFocus()) |
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2774 node->showTreeForThis(); | 2793 node->showTreeForThis(); |
2775 } | 2794 } |
2776 | 2795 |
2777 void showNodePath(const WebCore::Node* node) | 2796 void showNodePath(const WebCore::Node* node) |
2778 { | 2797 { |
2779 if (node) | 2798 if (node) |
2780 node->showNodePathForThis(); | 2799 node->showNodePathForThis(); |
2781 } | 2800 } |
2782 | 2801 |
2783 #endif | 2802 #endif |
OLD | NEW |