Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Side by Side Diff: Source/core/dom/Node.cpp

Issue 684633006: Reattach whitespace siblings only when needed (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/dom/Text.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 if (StyleResolver* resolver = document().styleResolver()) 947 if (StyleResolver* resolver = document().styleResolver())
948 resolver->ruleFeatureSet().styleInvalidator().clearInvalidation(*this); 948 resolver->ruleFeatureSet().styleInvalidator().clearInvalidation(*this);
949 clearChildNeedsStyleInvalidation(); 949 clearChildNeedsStyleInvalidation();
950 clearNeedsStyleInvalidation(); 950 clearNeedsStyleInvalidation();
951 951
952 #if ENABLE(ASSERT) 952 #if ENABLE(ASSERT)
953 detachingNode = nullptr; 953 detachingNode = nullptr;
954 #endif 954 #endif
955 } 955 }
956 956
957 void Node::reattachWhitespaceSiblings(Text* start) 957 void Node::reattachWhitespaceSiblingsIfNeeded(Text* start)
958 { 958 {
959 for (Node* sibling = start; sibling; sibling = sibling->nextSibling()) { 959 for (Node* sibling = start; sibling; sibling = sibling->nextSibling()) {
960 if (sibling->isTextNode() && toText(sibling)->containsOnlyWhitespace()) { 960 if (sibling->isTextNode() && toText(sibling)->containsOnlyWhitespace()) {
961 bool hadRenderer = !!sibling->renderer(); 961 bool hadRenderer = !!sibling->renderer();
962 sibling->reattach(); 962 toText(sibling)->reattachIfNeeded();
963 // If the reattach didn't toggle the visibility of the whitespace we don't 963 // If sibling's renderer status didn't change we don't need to conti nue checking
964 // need to continue reattaching siblings since they won't toggle vis ibility 964 // other siblings since their renderer status won't change either.
965 // either. 965 if (!!sibling->renderer() == hadRenderer)
966 if (hadRenderer == !!sibling->renderer())
967 return; 966 return;
968 } else if (sibling->renderer()) { 967 } else if (sibling->renderer()) {
969 return; 968 return;
970 } 969 }
971 } 970 }
972 } 971 }
973 972
974 // FIXME: This code is used by editing. Seems like it could move over there and not pollute Node. 973 // FIXME: This code is used by editing. Seems like it could move over there and not pollute Node.
975 Node* Node::previousNodeConsideringAtomicNodes() const 974 Node* Node::previousNodeConsideringAtomicNodes() const
976 { 975 {
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after
2459 node->showTreeForThis(); 2458 node->showTreeForThis();
2460 } 2459 }
2461 2460
2462 void showNodePath(const blink::Node* node) 2461 void showNodePath(const blink::Node* node)
2463 { 2462 {
2464 if (node) 2463 if (node)
2465 node->showNodePathForThis(); 2464 node->showNodePathForThis();
2466 } 2465 }
2467 2466
2468 #endif 2467 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/dom/Text.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698