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 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 | 1281 |
1282 return documentElement(); | 1282 return documentElement(); |
1283 } | 1283 } |
1284 | 1284 |
1285 return body(); | 1285 return body(); |
1286 } | 1286 } |
1287 | 1287 |
1288 // We use HashMap::set over HashMap::add here as we want to | 1288 // We use HashMap::set over HashMap::add here as we want to |
1289 // replace the ComputedStyle but not the Element if the Element is | 1289 // replace the ComputedStyle but not the Element if the Element is |
1290 // already present. | 1290 // already present. |
1291 void Document::addNonAttachedStyle(Element& element, | 1291 void Document::addStyleReattachData(Element& element, |
1292 RefPtr<ComputedStyle> computedStyle) { | 1292 StyleReattachData& styleReattachData) { |
1293 m_nonAttachedStyle.set(&element, computedStyle); | 1293 m_styleReattachDataMap.set(&element, styleReattachData); |
1294 } | 1294 } |
1295 | 1295 |
1296 ComputedStyle* Document::getNonAttachedStyle(Element& element) { | 1296 StyleReattachData Document::getStyleReattachData(Element& element) { |
1297 return m_nonAttachedStyle.get(&element); | 1297 return m_styleReattachDataMap.get(&element); |
1298 } | 1298 } |
1299 | 1299 |
1300 /* | 1300 /* |
1301 * Performs three operations: | 1301 * Performs three operations: |
1302 * 1. Convert control characters to spaces | 1302 * 1. Convert control characters to spaces |
1303 * 2. Trim leading and trailing spaces | 1303 * 2. Trim leading and trailing spaces |
1304 * 3. Collapse internal whitespace. | 1304 * 3. Collapse internal whitespace. |
1305 */ | 1305 */ |
1306 template <typename CharacterType> | 1306 template <typename CharacterType> |
1307 static inline String canonicalizedTitle(Document* document, | 1307 static inline String canonicalizedTitle(Document* document, |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1970 if (Element* documentElement = this->documentElement()) { | 1970 if (Element* documentElement = this->documentElement()) { |
1971 inheritHtmlAndBodyElementStyles(change); | 1971 inheritHtmlAndBodyElementStyles(change); |
1972 if (documentElement->shouldCallRecalcStyle(change)) | 1972 if (documentElement->shouldCallRecalcStyle(change)) |
1973 documentElement->recalcStyle(change); | 1973 documentElement->recalcStyle(change); |
1974 } | 1974 } |
1975 | 1975 |
1976 view()->recalcOverflowAfterStyleChange(); | 1976 view()->recalcOverflowAfterStyleChange(); |
1977 | 1977 |
1978 // Only retain the HashMap for the duration of StyleRecalc and | 1978 // Only retain the HashMap for the duration of StyleRecalc and |
1979 // LayoutTreeConstruction. | 1979 // LayoutTreeConstruction. |
1980 m_nonAttachedStyle.clear(); | 1980 m_styleReattachDataMap.clear(); |
1981 clearChildNeedsStyleRecalc(); | 1981 clearChildNeedsStyleRecalc(); |
1982 clearChildNeedsReattachLayoutTree(); | 1982 clearChildNeedsReattachLayoutTree(); |
1983 | 1983 |
1984 resolver.clearStyleSharingList(); | 1984 resolver.clearStyleSharingList(); |
1985 | 1985 |
1986 DCHECK(!needsStyleRecalc()); | 1986 DCHECK(!needsStyleRecalc()); |
1987 DCHECK(!childNeedsStyleRecalc()); | 1987 DCHECK(!childNeedsStyleRecalc()); |
1988 DCHECK(!needsReattachLayoutTree()); | 1988 DCHECK(!needsReattachLayoutTree()); |
1989 DCHECK(!childNeedsReattachLayoutTree()); | 1989 DCHECK(!childNeedsReattachLayoutTree()); |
1990 DCHECK(inStyleRecalc()); | 1990 DCHECK(inStyleRecalc()); |
1991 DCHECK_EQ(styleResolver(), &resolver); | 1991 DCHECK_EQ(styleResolver(), &resolver); |
1992 DCHECK(m_nonAttachedStyle.isEmpty()); | 1992 DCHECK(m_styleReattachDataMap.isEmpty()); |
1993 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); | 1993 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); |
1994 if (shouldRecordStats) { | 1994 if (shouldRecordStats) { |
1995 TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle", | 1995 TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle", |
1996 "resolverAccessCount", | 1996 "resolverAccessCount", |
1997 styleEngine().styleForElementCount() - initialElementCount, | 1997 styleEngine().styleForElementCount() - initialElementCount, |
1998 "counters", styleEngine().stats()->toTracedValue()); | 1998 "counters", styleEngine().stats()->toTracedValue()); |
1999 } else { | 1999 } else { |
2000 TRACE_EVENT_END1( | 2000 TRACE_EVENT_END1( |
2001 "blink,blink_style", "Document::updateStyle", "resolverAccessCount", | 2001 "blink,blink_style", "Document::updateStyle", "resolverAccessCount", |
2002 styleEngine().styleForElementCount() - initialElementCount); | 2002 styleEngine().styleForElementCount() - initialElementCount); |
(...skipping 4390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6393 visitor->trace(m_svgExtensions); | 6393 visitor->trace(m_svgExtensions); |
6394 visitor->trace(m_timeline); | 6394 visitor->trace(m_timeline); |
6395 visitor->trace(m_compositorPendingAnimations); | 6395 visitor->trace(m_compositorPendingAnimations); |
6396 visitor->trace(m_contextDocument); | 6396 visitor->trace(m_contextDocument); |
6397 visitor->trace(m_canvasFontCache); | 6397 visitor->trace(m_canvasFontCache); |
6398 visitor->trace(m_intersectionObserverController); | 6398 visitor->trace(m_intersectionObserverController); |
6399 visitor->trace(m_intersectionObserverData); | 6399 visitor->trace(m_intersectionObserverData); |
6400 visitor->trace(m_snapCoordinator); | 6400 visitor->trace(m_snapCoordinator); |
6401 visitor->trace(m_resizeObserverController); | 6401 visitor->trace(m_resizeObserverController); |
6402 visitor->trace(m_propertyRegistry); | 6402 visitor->trace(m_propertyRegistry); |
6403 visitor->trace(m_nonAttachedStyle); | 6403 visitor->trace(m_styleReattachDataMap); |
6404 Supplementable<Document>::trace(visitor); | 6404 Supplementable<Document>::trace(visitor); |
6405 TreeScope::trace(visitor); | 6405 TreeScope::trace(visitor); |
6406 ContainerNode::trace(visitor); | 6406 ContainerNode::trace(visitor); |
6407 ExecutionContext::trace(visitor); | 6407 ExecutionContext::trace(visitor); |
6408 SecurityContext::trace(visitor); | 6408 SecurityContext::trace(visitor); |
6409 SynchronousMutationNotifier::trace(visitor); | 6409 SynchronousMutationNotifier::trace(visitor); |
6410 } | 6410 } |
6411 | 6411 |
6412 void Document::maybeRecordLoadReason(WouldLoadReason reason) { | 6412 void Document::maybeRecordLoadReason(WouldLoadReason reason) { |
6413 DCHECK(m_wouldLoadReason == Created || reason != Created); | 6413 DCHECK(m_wouldLoadReason == Created || reason != Created); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6449 } | 6449 } |
6450 | 6450 |
6451 void showLiveDocumentInstances() { | 6451 void showLiveDocumentInstances() { |
6452 WeakDocumentSet& set = liveDocumentSet(); | 6452 WeakDocumentSet& set = liveDocumentSet(); |
6453 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6453 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6454 for (Document* document : set) | 6454 for (Document* document : set) |
6455 fprintf(stderr, "- Document %p URL: %s\n", document, | 6455 fprintf(stderr, "- Document %p URL: %s\n", document, |
6456 document->url().getString().utf8().data()); | 6456 document->url().getString().utf8().data()); |
6457 } | 6457 } |
6458 #endif | 6458 #endif |
OLD | NEW |