Chromium Code Reviews| 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 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1239 | 1239 |
| 1240 return body; | 1240 return body; |
| 1241 } | 1241 } |
| 1242 | 1242 |
| 1243 return documentElement(); | 1243 return documentElement(); |
| 1244 } | 1244 } |
| 1245 | 1245 |
| 1246 return body(); | 1246 return body(); |
| 1247 } | 1247 } |
| 1248 | 1248 |
| 1249 // We use HashMap::set over HashMap::add here as we want to | |
| 1250 // replace the ComputedStyle but not the Element if the Element is | |
| 1251 // already present. | |
| 1252 void Document::addNonAttachedStyle(Element* element, | |
| 1253 RefPtr<ComputedStyle> computedStyle) { | |
| 1254 m_nonAttachedStyle.set(element, computedStyle); | |
|
esprehn
2016/10/05 02:17:40
&element
nainar
2016/10/05 03:32:37
Done.
| |
| 1255 } | |
| 1256 | |
| 1257 RefPtr<ComputedStyle> Document::getNonAttachedStyle(Element* element) { | |
| 1258 return m_nonAttachedStyle.get(element); | |
|
esprehn
2016/10/05 02:17:40
&element
nainar
2016/10/05 03:32:37
Done.
| |
| 1259 } | |
| 1260 | |
| 1249 /* | 1261 /* |
| 1250 * Performs three operations: | 1262 * Performs three operations: |
| 1251 * 1. Convert control characters to spaces | 1263 * 1. Convert control characters to spaces |
| 1252 * 2. Trim leading and trailing spaces | 1264 * 2. Trim leading and trailing spaces |
| 1253 * 3. Collapse internal whitespace. | 1265 * 3. Collapse internal whitespace. |
| 1254 */ | 1266 */ |
| 1255 template <typename CharacterType> | 1267 template <typename CharacterType> |
| 1256 static inline String canonicalizedTitle(Document* document, | 1268 static inline String canonicalizedTitle(Document* document, |
| 1257 const String& title) { | 1269 const String& title) { |
| 1258 unsigned length = title.length(); | 1270 unsigned length = title.length(); |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1910 inheritHtmlAndBodyElementStyles(change); | 1922 inheritHtmlAndBodyElementStyles(change); |
| 1911 dirtyElementsForLayerUpdate(); | 1923 dirtyElementsForLayerUpdate(); |
| 1912 if (documentElement->shouldCallRecalcStyle(change)) | 1924 if (documentElement->shouldCallRecalcStyle(change)) |
| 1913 documentElement->recalcStyle(change); | 1925 documentElement->recalcStyle(change); |
| 1914 while (dirtyElementsForLayerUpdate()) | 1926 while (dirtyElementsForLayerUpdate()) |
| 1915 documentElement->recalcStyle(NoChange); | 1927 documentElement->recalcStyle(NoChange); |
| 1916 } | 1928 } |
| 1917 | 1929 |
| 1918 view()->recalcOverflowAfterStyleChange(); | 1930 view()->recalcOverflowAfterStyleChange(); |
| 1919 | 1931 |
| 1932 // Only retain the HashMap for the duration of StyleRecalc and | |
| 1933 // LayoutTreeConstruction. | |
| 1934 m_nonAttachedStyle.clear(); | |
| 1920 clearChildNeedsStyleRecalc(); | 1935 clearChildNeedsStyleRecalc(); |
| 1921 | 1936 |
| 1922 resolver.clearStyleSharingList(); | 1937 resolver.clearStyleSharingList(); |
| 1923 | 1938 |
| 1924 m_wasPrinting = m_printing; | 1939 m_wasPrinting = m_printing; |
| 1925 | 1940 |
| 1926 DCHECK(!needsStyleRecalc()); | 1941 DCHECK(!needsStyleRecalc()); |
| 1927 DCHECK(!childNeedsStyleRecalc()); | 1942 DCHECK(!childNeedsStyleRecalc()); |
| 1928 DCHECK(inStyleRecalc()); | 1943 DCHECK(inStyleRecalc()); |
| 1929 DCHECK_EQ(styleResolver(), &resolver); | 1944 DCHECK_EQ(styleResolver(), &resolver); |
| 1945 DCHECK(m_nonAttachedStyle.isEmpty()); | |
| 1930 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); | 1946 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); |
| 1931 if (shouldRecordStats) { | 1947 if (shouldRecordStats) { |
| 1932 TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle", | 1948 TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle", |
| 1933 "resolverAccessCount", | 1949 "resolverAccessCount", |
| 1934 styleEngine().styleForElementCount() - initialElementCount, | 1950 styleEngine().styleForElementCount() - initialElementCount, |
| 1935 "counters", styleEngine().stats()->toTracedValue()); | 1951 "counters", styleEngine().stats()->toTracedValue()); |
| 1936 } else { | 1952 } else { |
| 1937 TRACE_EVENT_END1( | 1953 TRACE_EVENT_END1( |
| 1938 "blink,blink_style", "Document::updateStyle", "resolverAccessCount", | 1954 "blink,blink_style", "Document::updateStyle", "resolverAccessCount", |
| 1939 styleEngine().styleForElementCount() - initialElementCount); | 1955 styleEngine().styleForElementCount() - initialElementCount); |
| (...skipping 4379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6319 visitor->trace(m_svgExtensions); | 6335 visitor->trace(m_svgExtensions); |
| 6320 visitor->trace(m_timeline); | 6336 visitor->trace(m_timeline); |
| 6321 visitor->trace(m_compositorPendingAnimations); | 6337 visitor->trace(m_compositorPendingAnimations); |
| 6322 visitor->trace(m_contextDocument); | 6338 visitor->trace(m_contextDocument); |
| 6323 visitor->trace(m_canvasFontCache); | 6339 visitor->trace(m_canvasFontCache); |
| 6324 visitor->trace(m_intersectionObserverController); | 6340 visitor->trace(m_intersectionObserverController); |
| 6325 visitor->trace(m_intersectionObserverData); | 6341 visitor->trace(m_intersectionObserverData); |
| 6326 visitor->trace(m_snapCoordinator); | 6342 visitor->trace(m_snapCoordinator); |
| 6327 visitor->trace(m_resizeObserverController); | 6343 visitor->trace(m_resizeObserverController); |
| 6328 visitor->trace(m_propertyRegistry); | 6344 visitor->trace(m_propertyRegistry); |
| 6345 visitor->trace(m_nonAttachedStyle); | |
| 6329 Supplementable<Document>::trace(visitor); | 6346 Supplementable<Document>::trace(visitor); |
| 6330 TreeScope::trace(visitor); | 6347 TreeScope::trace(visitor); |
| 6331 ContainerNode::trace(visitor); | 6348 ContainerNode::trace(visitor); |
| 6332 ExecutionContext::trace(visitor); | 6349 ExecutionContext::trace(visitor); |
| 6333 SecurityContext::trace(visitor); | 6350 SecurityContext::trace(visitor); |
| 6334 } | 6351 } |
| 6335 | 6352 |
| 6336 void Document::onVisibilityMaybeChanged(bool visible) { | 6353 void Document::onVisibilityMaybeChanged(bool visible) { |
| 6337 DCHECK(frame()); | 6354 DCHECK(frame()); |
| 6338 if (visible && !m_visibilityWasLogged && frame()->isCrossOriginSubframe()) { | 6355 if (visible && !m_visibilityWasLogged && frame()->isCrossOriginSubframe()) { |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 6369 } | 6386 } |
| 6370 | 6387 |
| 6371 void showLiveDocumentInstances() { | 6388 void showLiveDocumentInstances() { |
| 6372 WeakDocumentSet& set = liveDocumentSet(); | 6389 WeakDocumentSet& set = liveDocumentSet(); |
| 6373 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6390 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6374 for (Document* document : set) | 6391 for (Document* document : set) |
| 6375 fprintf(stderr, "- Document %p URL: %s\n", document, | 6392 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6376 document->url().getString().utf8().data()); | 6393 document->url().getString().utf8().data()); |
| 6377 } | 6394 } |
| 6378 #endif | 6395 #endif |
| OLD | NEW |