Chromium Code Reviews| 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 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 896 DCHECK(!otherIterator); | 896 DCHECK(!otherIterator); |
| 897 return nullptr; | 897 return nullptr; |
| 898 } | 898 } |
| 899 | 899 |
| 900 void Node::reattachLayoutTree(const AttachContext& context) { | 900 void Node::reattachLayoutTree(const AttachContext& context) { |
| 901 AttachContext reattachContext(context); | 901 AttachContext reattachContext(context); |
| 902 reattachContext.performingReattach = true; | 902 reattachContext.performingReattach = true; |
| 903 | 903 |
| 904 // We only need to detach if the node has already been through | 904 // We only need to detach if the node has already been through |
| 905 // attachLayoutTree(). | 905 // attachLayoutTree(). |
| 906 if (getStyleChangeType() < NeedsReattachStyleChange) | 906 if (getStyleChangeType() < NeedsReattachStyleChange) |
|
nainar
2017/02/02 07:42:01
Figured out why tests were failing!
This check
| |
| 907 detachLayoutTree(reattachContext); | 907 detachLayoutTree(reattachContext); |
| 908 attachLayoutTree(reattachContext); | 908 attachLayoutTree(reattachContext); |
| 909 } | 909 } |
| 910 | 910 |
| 911 void Node::attachLayoutTree(const AttachContext&) { | 911 void Node::attachLayoutTree(const AttachContext&) { |
| 912 DCHECK(document().inStyleRecalc() || isDocumentNode()); | 912 DCHECK(document().inStyleRecalc() || isDocumentNode()); |
| 913 DCHECK(!document().lifecycle().inDetach()); | 913 DCHECK(!document().lifecycle().inDetach()); |
| 914 DCHECK(needsAttach()); | 914 DCHECK(needsAttach()); |
| 915 DCHECK(!layoutObject() || | 915 DCHECK(!layoutObject() || |
| 916 (layoutObject()->style() && | 916 (layoutObject()->style() && |
| 917 (layoutObject()->parent() || layoutObject()->isLayoutView()))); | 917 (layoutObject()->parent() || layoutObject()->isLayoutView()))); |
| 918 | 918 |
| 919 clearNeedsStyleRecalc(); | 919 clearNeedsStyleRecalc(); |
| 920 clearNeedsReattachLayoutTree(); | 920 clearNeedsReattachLayoutTree(); |
| 921 | 921 |
| 922 if (AXObjectCache* cache = document().axObjectCache()) | 922 if (AXObjectCache* cache = document().axObjectCache()) |
| 923 cache->updateCacheAfterNodeIsAttached(this); | 923 cache->updateCacheAfterNodeIsAttached(this); |
| 924 } | 924 } |
| 925 | 925 |
| 926 void Node::detachLayoutTree(const AttachContext& context) { | 926 void Node::detachLayoutTree(const AttachContext& context) { |
| 927 DCHECK(document().lifecycle().stateAllowsDetach()); | 927 DCHECK(document().lifecycle().stateAllowsDetach()); |
| 928 DocumentLifecycle::DetachScope willDetach(document().lifecycle()); | 928 DocumentLifecycle::DetachScope willDetach(document().lifecycle()); |
| 929 | 929 |
| 930 if (layoutObject()) | 930 if (layoutObject()) |
| 931 layoutObject()->destroyAndCleanupAnonymousWrappers(); | 931 layoutObject()->destroyAndCleanupAnonymousWrappers(); |
| 932 setLayoutObject(nullptr); | 932 setLayoutObject(nullptr); |
| 933 setStyleChange(NeedsReattachStyleChange); | 933 setStyleChange(NeedsReattachStyleChange); |
| 934 setFlag(NeedsReattachLayoutTree); | |
| 934 clearChildNeedsStyleInvalidation(); | 935 clearChildNeedsStyleInvalidation(); |
| 935 } | 936 } |
| 936 | 937 |
| 937 void Node::reattachWhitespaceSiblingsIfNeeded(Text* start) { | 938 void Node::reattachWhitespaceSiblingsIfNeeded(Text* start) { |
| 938 ScriptForbiddenScope forbidScriptDuringRawIteration; | 939 ScriptForbiddenScope forbidScriptDuringRawIteration; |
| 939 for (Node* sibling = start; sibling; sibling = sibling->nextSibling()) { | 940 for (Node* sibling = start; sibling; sibling = sibling->nextSibling()) { |
| 940 if (sibling->isTextNode() && toText(sibling)->containsOnlyWhitespace()) { | 941 if (sibling->isTextNode() && toText(sibling)->containsOnlyWhitespace()) { |
| 941 bool hadLayoutObject = !!sibling->layoutObject(); | 942 bool hadLayoutObject = !!sibling->layoutObject(); |
| 942 toText(sibling)->reattachLayoutTreeIfNeeded(); | 943 toText(sibling)->reattachLayoutTreeIfNeeded(); |
| 943 // If sibling's layout object status didn't change we don't need to | 944 // If sibling's layout object status didn't change we don't need to |
| (...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2566 if (node) { | 2567 if (node) { |
| 2567 std::stringstream stream; | 2568 std::stringstream stream; |
| 2568 node->printNodePathTo(stream); | 2569 node->printNodePathTo(stream); |
| 2569 LOG(INFO) << stream.str(); | 2570 LOG(INFO) << stream.str(); |
| 2570 } else { | 2571 } else { |
| 2571 LOG(INFO) << "Cannot showNodePath for <null>"; | 2572 LOG(INFO) << "Cannot showNodePath for <null>"; |
| 2572 } | 2573 } |
| 2573 } | 2574 } |
| 2574 | 2575 |
| 2575 #endif | 2576 #endif |
| OLD | NEW |