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 * (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 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1426 | 1426 |
1427 return body; | 1427 return body; |
1428 } | 1428 } |
1429 | 1429 |
1430 return documentElement(); | 1430 return documentElement(); |
1431 } | 1431 } |
1432 | 1432 |
1433 return body(); | 1433 return body(); |
1434 } | 1434 } |
1435 | 1435 |
1436 // We use HashMap::set over HashMap::add here as we want to | |
1437 // replace the ComputedStyle but not the Node if the Node is | |
1438 // already present. | |
1439 void Document::AddNonAttachedStyle(const Node& node, | |
1440 RefPtr<ComputedStyle> computed_style) { | |
1441 DCHECK(node.IsElementNode() || node.IsTextNode()); | |
1442 non_attached_style_.Set(&node, computed_style); | |
1443 } | |
1444 | |
1445 ComputedStyle* Document::GetNonAttachedStyle(const Node& node) const { | |
1446 return non_attached_style_.at(&node); | |
1447 } | |
1448 | |
1449 /* | 1436 /* |
1450 * Performs three operations: | 1437 * Performs three operations: |
1451 * 1. Convert control characters to spaces | 1438 * 1. Convert control characters to spaces |
1452 * 2. Trim leading and trailing spaces | 1439 * 2. Trim leading and trailing spaces |
1453 * 3. Collapse internal whitespace. | 1440 * 3. Collapse internal whitespace. |
1454 */ | 1441 */ |
1455 template <typename CharacterType> | 1442 template <typename CharacterType> |
1456 static inline String CanonicalizedTitle(Document* document, | 1443 static inline String CanonicalizedTitle(Document* document, |
1457 const String& title) { | 1444 const String& title) { |
1458 unsigned length = title.length(); | 1445 unsigned length = title.length(); |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2120 } | 2107 } |
2121 if (document_element->NeedsReattachLayoutTree() || | 2108 if (document_element->NeedsReattachLayoutTree() || |
2122 document_element->ChildNeedsReattachLayoutTree()) { | 2109 document_element->ChildNeedsReattachLayoutTree()) { |
2123 TRACE_EVENT0("blink,blink_style", "Document::rebuildLayoutTree"); | 2110 TRACE_EVENT0("blink,blink_style", "Document::rebuildLayoutTree"); |
2124 document_element->RebuildLayoutTree(); | 2111 document_element->RebuildLayoutTree(); |
2125 } | 2112 } |
2126 } | 2113 } |
2127 | 2114 |
2128 View()->RecalcOverflowAfterStyleChange(); | 2115 View()->RecalcOverflowAfterStyleChange(); |
2129 | 2116 |
2130 // Only retain the HashMap for the duration of StyleRecalc and | |
2131 // LayoutTreeConstruction. | |
2132 non_attached_style_.Clear(); | |
rune
2017/04/19 20:34:52
Do we retain the ComputedStyle on each node now, e
nainar
2017/04/19 23:43:41
For the needs of this patch I should delete the co
rune
2017/04/20 08:56:39
So, if we have a subtree of N elements which is in
nainar
2017/04/21 00:51:30
We shouldn't be retaining the nonAttachedStyle for
rune
2017/04/21 07:41:46
No, this was more of a future concern.
nainar
2017/04/26 02:55:16
Done.
Had to change Node::setNonAttachedStyle()
rune
2017/04/26 08:47:28
Sorry for being unclear, but I think the patch set
| |
2133 ClearChildNeedsStyleRecalc(); | 2117 ClearChildNeedsStyleRecalc(); |
2134 ClearChildNeedsReattachLayoutTree(); | 2118 ClearChildNeedsReattachLayoutTree(); |
2135 | 2119 |
2136 resolver.ClearStyleSharingList(); | 2120 resolver.ClearStyleSharingList(); |
2137 | 2121 |
2138 DCHECK(!NeedsStyleRecalc()); | 2122 DCHECK(!NeedsStyleRecalc()); |
2139 DCHECK(!ChildNeedsStyleRecalc()); | 2123 DCHECK(!ChildNeedsStyleRecalc()); |
2140 DCHECK(!NeedsReattachLayoutTree()); | 2124 DCHECK(!NeedsReattachLayoutTree()); |
2141 DCHECK(!ChildNeedsReattachLayoutTree()); | 2125 DCHECK(!ChildNeedsReattachLayoutTree()); |
2142 DCHECK(InStyleRecalc()); | 2126 DCHECK(InStyleRecalc()); |
2143 DCHECK_EQ(GetStyleResolver(), &resolver); | 2127 DCHECK_EQ(GetStyleResolver(), &resolver); |
2144 DCHECK(non_attached_style_.IsEmpty()); | |
2145 lifecycle_.AdvanceTo(DocumentLifecycle::kStyleClean); | 2128 lifecycle_.AdvanceTo(DocumentLifecycle::kStyleClean); |
2146 if (should_record_stats) { | 2129 if (should_record_stats) { |
2147 TRACE_EVENT_END2( | 2130 TRACE_EVENT_END2( |
2148 "blink,blink_style", "Document::updateStyle", "resolverAccessCount", | 2131 "blink,blink_style", "Document::updateStyle", "resolverAccessCount", |
2149 GetStyleEngine().StyleForElementCount() - initial_element_count, | 2132 GetStyleEngine().StyleForElementCount() - initial_element_count, |
2150 "counters", GetStyleEngine().Stats()->ToTracedValue()); | 2133 "counters", GetStyleEngine().Stats()->ToTracedValue()); |
2151 } else { | 2134 } else { |
2152 TRACE_EVENT_END1( | 2135 TRACE_EVENT_END1( |
2153 "blink,blink_style", "Document::updateStyle", "resolverAccessCount", | 2136 "blink,blink_style", "Document::updateStyle", "resolverAccessCount", |
2154 GetStyleEngine().StyleForElementCount() - initial_element_count); | 2137 GetStyleEngine().StyleForElementCount() - initial_element_count); |
(...skipping 4431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6586 visitor->Trace(user_action_elements_); | 6569 visitor->Trace(user_action_elements_); |
6587 visitor->Trace(svg_extensions_); | 6570 visitor->Trace(svg_extensions_); |
6588 visitor->Trace(timeline_); | 6571 visitor->Trace(timeline_); |
6589 visitor->Trace(compositor_pending_animations_); | 6572 visitor->Trace(compositor_pending_animations_); |
6590 visitor->Trace(context_document_); | 6573 visitor->Trace(context_document_); |
6591 visitor->Trace(canvas_font_cache_); | 6574 visitor->Trace(canvas_font_cache_); |
6592 visitor->Trace(intersection_observer_controller_); | 6575 visitor->Trace(intersection_observer_controller_); |
6593 visitor->Trace(snap_coordinator_); | 6576 visitor->Trace(snap_coordinator_); |
6594 visitor->Trace(resize_observer_controller_); | 6577 visitor->Trace(resize_observer_controller_); |
6595 visitor->Trace(property_registry_); | 6578 visitor->Trace(property_registry_); |
6596 visitor->Trace(non_attached_style_); | |
6597 visitor->Trace(network_state_observer_); | 6579 visitor->Trace(network_state_observer_); |
6598 Supplementable<Document>::Trace(visitor); | 6580 Supplementable<Document>::Trace(visitor); |
6599 TreeScope::Trace(visitor); | 6581 TreeScope::Trace(visitor); |
6600 ContainerNode::Trace(visitor); | 6582 ContainerNode::Trace(visitor); |
6601 ExecutionContext::Trace(visitor); | 6583 ExecutionContext::Trace(visitor); |
6602 SecurityContext::Trace(visitor); | 6584 SecurityContext::Trace(visitor); |
6603 SynchronousMutationNotifier::Trace(visitor); | 6585 SynchronousMutationNotifier::Trace(visitor); |
6604 } | 6586 } |
6605 | 6587 |
6606 void Document::RecordDeferredLoadReason(WouldLoadReason reason) { | 6588 void Document::RecordDeferredLoadReason(WouldLoadReason reason) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6645 } | 6627 } |
6646 | 6628 |
6647 void showLiveDocumentInstances() { | 6629 void showLiveDocumentInstances() { |
6648 WeakDocumentSet& set = liveDocumentSet(); | 6630 WeakDocumentSet& set = liveDocumentSet(); |
6649 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6631 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6650 for (blink::Document* document : set) | 6632 for (blink::Document* document : set) |
6651 fprintf(stderr, "- Document %p URL: %s\n", document, | 6633 fprintf(stderr, "- Document %p URL: %s\n", document, |
6652 document->Url().GetString().Utf8().Data()); | 6634 document->Url().GetString().Utf8().Data()); |
6653 } | 6635 } |
6654 #endif | 6636 #endif |
OLD | NEW |