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

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

Issue 2740823005: Track lastTextNode during rebuildLayoutTree. (Closed)
Patch Set: Missing reset of lastTextNode for elements. Created 3 years, 9 months 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 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 1410
1411 return documentElement(); 1411 return documentElement();
1412 } 1412 }
1413 1413
1414 return body(); 1414 return body();
1415 } 1415 }
1416 1416
1417 // We use HashMap::set over HashMap::add here as we want to 1417 // We use HashMap::set over HashMap::add here as we want to
1418 // replace the ComputedStyle but not the Node if the Node is 1418 // replace the ComputedStyle but not the Node if the Node is
1419 // already present. 1419 // already present.
1420 void Document::addStyleReattachData(const Node& node, 1420 void Document::addNonAttachedStyle(const Node& node,
1421 StyleReattachData& styleReattachData) { 1421 RefPtr<ComputedStyle> computedStyle) {
1422 DCHECK(node.isElementNode() || node.isTextNode()); 1422 DCHECK(node.isElementNode() || node.isTextNode());
1423 m_styleReattachDataMap.set(&node, styleReattachData); 1423 m_nonAttachedStyle.set(&node, computedStyle);
1424 } 1424 }
1425 1425
1426 StyleReattachData Document::getStyleReattachData(const Node& node) const { 1426 ComputedStyle* Document::getNonAttachedStyle(const Node& node) const {
1427 return m_styleReattachDataMap.at(&node); 1427 return m_nonAttachedStyle.at(&node);
1428 } 1428 }
1429 1429
1430 /* 1430 /*
1431 * Performs three operations: 1431 * Performs three operations:
1432 * 1. Convert control characters to spaces 1432 * 1. Convert control characters to spaces
1433 * 2. Trim leading and trailing spaces 1433 * 2. Trim leading and trailing spaces
1434 * 3. Collapse internal whitespace. 1434 * 3. Collapse internal whitespace.
1435 */ 1435 */
1436 template <typename CharacterType> 1436 template <typename CharacterType>
1437 static inline String canonicalizedTitle(Document* document, 1437 static inline String canonicalizedTitle(Document* document,
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
2100 documentElement->recalcStyle(change); 2100 documentElement->recalcStyle(change);
2101 if (documentElement->needsReattachLayoutTree() || 2101 if (documentElement->needsReattachLayoutTree() ||
2102 documentElement->childNeedsReattachLayoutTree()) 2102 documentElement->childNeedsReattachLayoutTree())
2103 documentElement->rebuildLayoutTree(); 2103 documentElement->rebuildLayoutTree();
2104 } 2104 }
2105 2105
2106 view()->recalcOverflowAfterStyleChange(); 2106 view()->recalcOverflowAfterStyleChange();
2107 2107
2108 // Only retain the HashMap for the duration of StyleRecalc and 2108 // Only retain the HashMap for the duration of StyleRecalc and
2109 // LayoutTreeConstruction. 2109 // LayoutTreeConstruction.
2110 m_styleReattachDataMap.clear(); 2110 m_nonAttachedStyle.clear();
2111 clearChildNeedsStyleRecalc(); 2111 clearChildNeedsStyleRecalc();
2112 clearChildNeedsReattachLayoutTree(); 2112 clearChildNeedsReattachLayoutTree();
2113 2113
2114 resolver.clearStyleSharingList(); 2114 resolver.clearStyleSharingList();
2115 2115
2116 DCHECK(!needsStyleRecalc()); 2116 DCHECK(!needsStyleRecalc());
2117 DCHECK(!childNeedsStyleRecalc()); 2117 DCHECK(!childNeedsStyleRecalc());
2118 DCHECK(!needsReattachLayoutTree()); 2118 DCHECK(!needsReattachLayoutTree());
2119 DCHECK(!childNeedsReattachLayoutTree()); 2119 DCHECK(!childNeedsReattachLayoutTree());
2120 DCHECK(inStyleRecalc()); 2120 DCHECK(inStyleRecalc());
2121 DCHECK_EQ(styleResolver(), &resolver); 2121 DCHECK_EQ(styleResolver(), &resolver);
2122 DCHECK(m_styleReattachDataMap.isEmpty()); 2122 DCHECK(m_nonAttachedStyle.isEmpty());
2123 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); 2123 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean);
2124 if (shouldRecordStats) { 2124 if (shouldRecordStats) {
2125 TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle", 2125 TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle",
2126 "resolverAccessCount", 2126 "resolverAccessCount",
2127 styleEngine().styleForElementCount() - initialElementCount, 2127 styleEngine().styleForElementCount() - initialElementCount,
2128 "counters", styleEngine().stats()->toTracedValue()); 2128 "counters", styleEngine().stats()->toTracedValue());
2129 } else { 2129 } else {
2130 TRACE_EVENT_END1( 2130 TRACE_EVENT_END1(
2131 "blink,blink_style", "Document::updateStyle", "resolverAccessCount", 2131 "blink,blink_style", "Document::updateStyle", "resolverAccessCount",
2132 styleEngine().styleForElementCount() - initialElementCount); 2132 styleEngine().styleForElementCount() - initialElementCount);
(...skipping 4470 matching lines...) Expand 10 before | Expand all | Expand 10 after
6603 visitor->trace(m_userActionElements); 6603 visitor->trace(m_userActionElements);
6604 visitor->trace(m_svgExtensions); 6604 visitor->trace(m_svgExtensions);
6605 visitor->trace(m_timeline); 6605 visitor->trace(m_timeline);
6606 visitor->trace(m_compositorPendingAnimations); 6606 visitor->trace(m_compositorPendingAnimations);
6607 visitor->trace(m_contextDocument); 6607 visitor->trace(m_contextDocument);
6608 visitor->trace(m_canvasFontCache); 6608 visitor->trace(m_canvasFontCache);
6609 visitor->trace(m_intersectionObserverController); 6609 visitor->trace(m_intersectionObserverController);
6610 visitor->trace(m_snapCoordinator); 6610 visitor->trace(m_snapCoordinator);
6611 visitor->trace(m_resizeObserverController); 6611 visitor->trace(m_resizeObserverController);
6612 visitor->trace(m_propertyRegistry); 6612 visitor->trace(m_propertyRegistry);
6613 visitor->trace(m_styleReattachDataMap); 6613 visitor->trace(m_nonAttachedStyle);
6614 visitor->trace(m_networkStateObserver); 6614 visitor->trace(m_networkStateObserver);
6615 Supplementable<Document>::trace(visitor); 6615 Supplementable<Document>::trace(visitor);
6616 TreeScope::trace(visitor); 6616 TreeScope::trace(visitor);
6617 ContainerNode::trace(visitor); 6617 ContainerNode::trace(visitor);
6618 ExecutionContext::trace(visitor); 6618 ExecutionContext::trace(visitor);
6619 SecurityContext::trace(visitor); 6619 SecurityContext::trace(visitor);
6620 SynchronousMutationNotifier::trace(visitor); 6620 SynchronousMutationNotifier::trace(visitor);
6621 } 6621 }
6622 6622
6623 void Document::recordDeferredLoadReason(WouldLoadReason reason) { 6623 void Document::recordDeferredLoadReason(WouldLoadReason reason) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
6668 } 6668 }
6669 6669
6670 void showLiveDocumentInstances() { 6670 void showLiveDocumentInstances() {
6671 WeakDocumentSet& set = liveDocumentSet(); 6671 WeakDocumentSet& set = liveDocumentSet();
6672 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6672 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6673 for (blink::Document* document : set) 6673 for (blink::Document* document : set)
6674 fprintf(stderr, "- Document %p URL: %s\n", document, 6674 fprintf(stderr, "- Document %p URL: %s\n", document,
6675 document->url().getString().utf8().data()); 6675 document->url().getString().utf8().data());
6676 } 6676 }
6677 #endif 6677 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/Element.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698