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

Side by Side Diff: third_party/WebKit/Source/core/dom/ContainerNode.cpp

Issue 2476163002: Fixed perf regression by removing tree traversal for text sibling. (Closed)
Patch Set: Rebased Created 4 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
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, 2013 Apple Inc. All rights 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 // O(1) time. See crbug.com/288225 1280 // O(1) time. See crbug.com/288225
1281 StyleResolver& styleResolver = document().ensureStyleResolver(); 1281 StyleResolver& styleResolver = document().ensureStyleResolver();
1282 Text* lastTextNode = nullptr; 1282 Text* lastTextNode = nullptr;
1283 for (Node* child = lastChild(); child; child = child->previousSibling()) { 1283 for (Node* child = lastChild(); child; child = child->previousSibling()) {
1284 if (child->isTextNode()) { 1284 if (child->isTextNode()) {
1285 toText(child)->recalcTextStyle(change, lastTextNode); 1285 toText(child)->recalcTextStyle(change, lastTextNode);
1286 lastTextNode = toText(child); 1286 lastTextNode = toText(child);
1287 } else if (child->isElementNode()) { 1287 } else if (child->isElementNode()) {
1288 Element* element = toElement(child); 1288 Element* element = toElement(child);
1289 if (element->shouldCallRecalcStyle(change)) 1289 if (element->shouldCallRecalcStyle(change))
1290 element->recalcStyle(change); 1290 element->recalcStyle(change, lastTextNode);
1291 else if (element->supportsStyleSharing()) 1291 else if (element->supportsStyleSharing())
1292 styleResolver.addToStyleSharingList(*element); 1292 styleResolver.addToStyleSharingList(*element);
1293 if (element->layoutObject()) 1293 if (element->layoutObject())
1294 lastTextNode = nullptr; 1294 lastTextNode = nullptr;
1295 } 1295 }
1296 } 1296 }
1297 } 1297 }
1298 1298
1299 void ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType, 1299 void ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType,
1300 Element* changedElement, 1300 Element* changedElement,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 return true; 1468 return true;
1469 1469
1470 if (node->isElementNode() && toElement(node)->shadow()) 1470 if (node->isElementNode() && toElement(node)->shadow())
1471 return true; 1471 return true;
1472 1472
1473 return false; 1473 return false;
1474 } 1474 }
1475 #endif 1475 #endif
1476 1476
1477 } // namespace blink 1477 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/BUILD.gn ('k') | third_party/WebKit/Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698