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 | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
6 * rights reserved. | 6 * rights reserved. |
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * | 10 * |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
873 if (thisIterator == otherIterator) | 873 if (thisIterator == otherIterator) |
874 return const_cast<Node*>(thisIterator); | 874 return const_cast<Node*>(thisIterator); |
875 thisIterator = parent(*thisIterator); | 875 thisIterator = parent(*thisIterator); |
876 otherIterator = parent(*otherIterator); | 876 otherIterator = parent(*otherIterator); |
877 } | 877 } |
878 DCHECK(!otherIterator); | 878 DCHECK(!otherIterator); |
879 return nullptr; | 879 return nullptr; |
880 } | 880 } |
881 | 881 |
882 void Node::reattachLayoutTree(const AttachContext& context) { | 882 void Node::reattachLayoutTree(const AttachContext& context) { |
883 DCHECK(!needsStyleRecalc()); | |
884 DCHECK(!childNeedsStyleRecalc()); | |
883 AttachContext reattachContext(context); | 885 AttachContext reattachContext(context); |
884 reattachContext.performingReattach = true; | 886 reattachContext.performingReattach = true; |
885 | 887 |
886 // We only need to detach if the node has already been through | 888 // We only need to detach if the node has already been through |
887 // attachLayoutTree(). | 889 // attachLayoutTree(). |
888 if (getStyleChangeType() < NeedsReattachStyleChange) | 890 if (getStyleChangeType() <= SubtreeStyleChange) |
nainar
2016/11/29 06:13:39
Question: This will always be true since SubtreeSt
rune
2016/12/05 10:05:17
Yes, this test doesn't make sense now. If you setN
| |
889 detachLayoutTree(reattachContext); | 891 detachLayoutTree(reattachContext); |
890 attachLayoutTree(reattachContext); | 892 attachLayoutTree(reattachContext); |
893 DCHECK(!needsStyleRecalc()); | |
894 DCHECK(!needsReattachLayoutTree()); | |
891 } | 895 } |
892 | 896 |
893 void Node::attachLayoutTree(const AttachContext&) { | 897 void Node::attachLayoutTree(const AttachContext&) { |
894 DCHECK(document().inStyleRecalc() || isDocumentNode()); | 898 DCHECK(document().inStyleRecalc() || isDocumentNode()); |
895 DCHECK(!document().lifecycle().inDetach()); | 899 DCHECK(!document().lifecycle().inDetach()); |
896 DCHECK(needsAttach()); | 900 DCHECK(needsReattachLayoutTree()); |
897 DCHECK(!layoutObject() || | 901 DCHECK(!layoutObject() || |
898 (layoutObject()->style() && | 902 (layoutObject()->style() && |
899 (layoutObject()->parent() || layoutObject()->isLayoutView()))); | 903 (layoutObject()->parent() || layoutObject()->isLayoutView()))); |
900 | 904 |
905 // Only doing this to cater to the comment in | |
906 // Document::updateStyleAndLayoutTree() right above the call to | |
907 // Document::updateStyle(). | |
901 clearNeedsStyleRecalc(); | 908 clearNeedsStyleRecalc(); |
902 clearNeedsReattachLayoutTree(); | 909 clearNeedsReattachLayoutTree(); |
903 | 910 |
904 if (AXObjectCache* cache = document().axObjectCache()) | 911 if (AXObjectCache* cache = document().axObjectCache()) |
905 cache->updateCacheAfterNodeIsAttached(this); | 912 cache->updateCacheAfterNodeIsAttached(this); |
906 } | 913 } |
907 | 914 |
908 void Node::detachLayoutTree(const AttachContext& context) { | 915 void Node::detachLayoutTree(const AttachContext& context) { |
909 DCHECK(document().lifecycle().stateAllowsDetach()); | 916 DCHECK(document().lifecycle().stateAllowsDetach()); |
910 DocumentLifecycle::DetachScope willDetach(document().lifecycle()); | 917 DocumentLifecycle::DetachScope willDetach(document().lifecycle()); |
911 | 918 |
912 if (layoutObject()) | 919 if (layoutObject()) |
913 layoutObject()->destroyAndCleanupAnonymousWrappers(); | 920 layoutObject()->destroyAndCleanupAnonymousWrappers(); |
914 setLayoutObject(nullptr); | 921 setLayoutObject(nullptr); |
915 setStyleChange(NeedsReattachStyleChange); | 922 setNeedsReattachLayoutTree(); |
nainar
2016/11/29 06:13:39
Set the relevant NeedsReattachLayoutTree flag.
| |
916 clearChildNeedsStyleInvalidation(); | 923 clearChildNeedsStyleInvalidation(); |
917 } | 924 } |
918 | 925 |
919 void Node::reattachWhitespaceSiblingsIfNeeded(Text* start) { | 926 void Node::reattachWhitespaceSiblingsIfNeeded(Text* start) { |
920 ScriptForbiddenScope forbidScriptDuringRawIteration; | 927 ScriptForbiddenScope forbidScriptDuringRawIteration; |
921 for (Node* sibling = start; sibling; sibling = sibling->nextSibling()) { | 928 for (Node* sibling = start; sibling; sibling = sibling->nextSibling()) { |
922 if (sibling->isTextNode() && toText(sibling)->containsOnlyWhitespace()) { | 929 if (sibling->isTextNode() && toText(sibling)->containsOnlyWhitespace()) { |
923 bool hadLayoutObject = !!sibling->layoutObject(); | 930 bool hadLayoutObject = !!sibling->layoutObject(); |
924 toText(sibling)->reattachLayoutTreeIfNeeded(); | 931 toText(sibling)->reattachLayoutTreeIfNeeded(); |
925 // If sibling's layout object status didn't change we don't need to | 932 // If sibling's layout object status didn't change we don't need to |
(...skipping 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2545 if (node) { | 2552 if (node) { |
2546 std::stringstream stream; | 2553 std::stringstream stream; |
2547 node->printNodePathTo(stream); | 2554 node->printNodePathTo(stream); |
2548 LOG(INFO) << stream.str(); | 2555 LOG(INFO) << stream.str(); |
2549 } else { | 2556 } else { |
2550 LOG(INFO) << "Cannot showNodePath for <null>"; | 2557 LOG(INFO) << "Cannot showNodePath for <null>"; |
2551 } | 2558 } |
2552 } | 2559 } |
2553 | 2560 |
2554 #endif | 2561 #endif |
OLD | NEW |