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