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

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

Issue 2401343002: Tracking filter mutation via SVGElementProxy (Closed)
Patch Set: Tweak lifecycle checks Created 4 years, 1 month 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 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 if (layoutViewItem().wasNotifiedOfSubtreeChange()) 1561 if (layoutViewItem().wasNotifiedOfSubtreeChange())
1562 return true; 1562 return true;
1563 return false; 1563 return false;
1564 } 1564 }
1565 1565
1566 bool Document::needsFullLayoutTreeUpdate() const { 1566 bool Document::needsFullLayoutTreeUpdate() const {
1567 if (!isActive() || !view()) 1567 if (!isActive() || !view())
1568 return false; 1568 return false;
1569 if (!m_useElementsNeedingUpdate.isEmpty()) 1569 if (!m_useElementsNeedingUpdate.isEmpty())
1570 return true; 1570 return true;
1571 if (!m_layerUpdateSVGFilterElements.isEmpty())
1572 return true;
1573 if (needsStyleRecalc()) 1571 if (needsStyleRecalc())
1574 return true; 1572 return true;
1575 if (needsStyleInvalidation()) 1573 if (needsStyleInvalidation())
1576 return true; 1574 return true;
1577 // FIXME: The childNeedsDistributionRecalc bit means either self or children, 1575 // FIXME: The childNeedsDistributionRecalc bit means either self or children,
1578 // we should fix that. 1576 // we should fix that.
1579 if (childNeedsDistributionRecalc()) 1577 if (childNeedsDistributionRecalc())
1580 return true; 1578 return true;
1581 if (DocumentAnimations::needsAnimationTimingUpdate(*this)) 1579 if (DocumentAnimations::needsAnimationTimingUpdate(*this))
1582 return true; 1580 return true;
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 clearNeedsReattachLayoutTree(); 1951 clearNeedsReattachLayoutTree();
1954 1952
1955 StyleResolver& resolver = ensureStyleResolver(); 1953 StyleResolver& resolver = ensureStyleResolver();
1956 1954
1957 bool shouldRecordStats; 1955 bool shouldRecordStats;
1958 TRACE_EVENT_CATEGORY_GROUP_ENABLED("blink,blink_style", &shouldRecordStats); 1956 TRACE_EVENT_CATEGORY_GROUP_ENABLED("blink,blink_style", &shouldRecordStats);
1959 styleEngine().setStatsEnabled(shouldRecordStats); 1957 styleEngine().setStatsEnabled(shouldRecordStats);
1960 1958
1961 if (Element* documentElement = this->documentElement()) { 1959 if (Element* documentElement = this->documentElement()) {
1962 inheritHtmlAndBodyElementStyles(change); 1960 inheritHtmlAndBodyElementStyles(change);
1963 dirtyElementsForLayerUpdate();
1964 if (documentElement->shouldCallRecalcStyle(change)) 1961 if (documentElement->shouldCallRecalcStyle(change))
1965 documentElement->recalcStyle(change); 1962 documentElement->recalcStyle(change);
1966 while (dirtyElementsForLayerUpdate())
1967 documentElement->recalcStyle(NoChange);
1968 } 1963 }
1969 1964
1970 view()->recalcOverflowAfterStyleChange(); 1965 view()->recalcOverflowAfterStyleChange();
1971 1966
1972 // Only retain the HashMap for the duration of StyleRecalc and 1967 // Only retain the HashMap for the duration of StyleRecalc and
1973 // LayoutTreeConstruction. 1968 // LayoutTreeConstruction.
1974 m_nonAttachedStyle.clear(); 1969 m_nonAttachedStyle.clear();
1975 clearChildNeedsStyleRecalc(); 1970 clearChildNeedsStyleRecalc();
1976 clearChildNeedsReattachLayoutTree(); 1971 clearChildNeedsReattachLayoutTree();
1977 1972
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
2235 2230
2236 void Document::setIsViewSource(bool isViewSource) { 2231 void Document::setIsViewSource(bool isViewSource) {
2237 m_isViewSource = isViewSource; 2232 m_isViewSource = isViewSource;
2238 if (!m_isViewSource) 2233 if (!m_isViewSource)
2239 return; 2234 return;
2240 2235
2241 setSecurityOrigin(SecurityOrigin::createUnique()); 2236 setSecurityOrigin(SecurityOrigin::createUnique());
2242 didUpdateSecurityOrigin(); 2237 didUpdateSecurityOrigin();
2243 } 2238 }
2244 2239
2245 bool Document::dirtyElementsForLayerUpdate() {
2246 if (m_layerUpdateSVGFilterElements.isEmpty())
2247 return false;
2248
2249 for (Element* element : m_layerUpdateSVGFilterElements)
2250 element->setNeedsStyleRecalc(LocalStyleChange,
2251 StyleChangeReasonForTracing::create(
2252 StyleChangeReason::SVGFilterLayerUpdate));
2253 m_layerUpdateSVGFilterElements.clear();
2254 return true;
2255 }
2256
2257 void Document::scheduleSVGFilterLayerUpdateHack(Element& element) {
2258 if (element.getStyleChangeType() == NeedsReattachStyleChange)
2259 return;
2260 element.setSVGFilterNeedsLayerUpdate();
2261 m_layerUpdateSVGFilterElements.add(&element);
2262 scheduleLayoutTreeUpdateIfNeeded();
2263 }
2264
2265 void Document::unscheduleSVGFilterLayerUpdateHack(Element& element) {
2266 element.clearSVGFilterNeedsLayerUpdate();
2267 m_layerUpdateSVGFilterElements.remove(&element);
2268 }
2269
2270 void Document::scheduleUseShadowTreeUpdate(SVGUseElement& element) { 2240 void Document::scheduleUseShadowTreeUpdate(SVGUseElement& element) {
2271 m_useElementsNeedingUpdate.add(&element); 2241 m_useElementsNeedingUpdate.add(&element);
2272 scheduleLayoutTreeUpdateIfNeeded(); 2242 scheduleLayoutTreeUpdateIfNeeded();
2273 } 2243 }
2274 2244
2275 void Document::unscheduleUseShadowTreeUpdate(SVGUseElement& element) { 2245 void Document::unscheduleUseShadowTreeUpdate(SVGUseElement& element) {
2276 m_useElementsNeedingUpdate.remove(&element); 2246 m_useElementsNeedingUpdate.remove(&element);
2277 } 2247 }
2278 2248
2279 void Document::updateUseShadowTreesIfNeeded() { 2249 void Document::updateUseShadowTreesIfNeeded() {
(...skipping 4127 matching lines...) Expand 10 before | Expand all | Expand 10 after
6407 visitor->trace(m_styleSheetList); 6377 visitor->trace(m_styleSheetList);
6408 visitor->trace(m_documentTiming); 6378 visitor->trace(m_documentTiming);
6409 visitor->trace(m_mediaQueryMatcher); 6379 visitor->trace(m_mediaQueryMatcher);
6410 visitor->trace(m_scriptedAnimationController); 6380 visitor->trace(m_scriptedAnimationController);
6411 visitor->trace(m_scriptedIdleTaskController); 6381 visitor->trace(m_scriptedIdleTaskController);
6412 visitor->trace(m_textAutosizer); 6382 visitor->trace(m_textAutosizer);
6413 visitor->trace(m_registrationContext); 6383 visitor->trace(m_registrationContext);
6414 visitor->trace(m_customElementMicrotaskRunQueue); 6384 visitor->trace(m_customElementMicrotaskRunQueue);
6415 visitor->trace(m_elementDataCache); 6385 visitor->trace(m_elementDataCache);
6416 visitor->trace(m_useElementsNeedingUpdate); 6386 visitor->trace(m_useElementsNeedingUpdate);
6417 visitor->trace(m_layerUpdateSVGFilterElements);
6418 visitor->trace(m_timers); 6387 visitor->trace(m_timers);
6419 visitor->trace(m_templateDocument); 6388 visitor->trace(m_templateDocument);
6420 visitor->trace(m_templateDocumentHost); 6389 visitor->trace(m_templateDocumentHost);
6421 visitor->trace(m_userActionElements); 6390 visitor->trace(m_userActionElements);
6422 visitor->trace(m_svgExtensions); 6391 visitor->trace(m_svgExtensions);
6423 visitor->trace(m_timeline); 6392 visitor->trace(m_timeline);
6424 visitor->trace(m_compositorPendingAnimations); 6393 visitor->trace(m_compositorPendingAnimations);
6425 visitor->trace(m_contextDocument); 6394 visitor->trace(m_contextDocument);
6426 visitor->trace(m_canvasFontCache); 6395 visitor->trace(m_canvasFontCache);
6427 visitor->trace(m_intersectionObserverController); 6396 visitor->trace(m_intersectionObserverController);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
6477 } 6446 }
6478 6447
6479 void showLiveDocumentInstances() { 6448 void showLiveDocumentInstances() {
6480 WeakDocumentSet& set = liveDocumentSet(); 6449 WeakDocumentSet& set = liveDocumentSet();
6481 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6450 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6482 for (Document* document : set) 6451 for (Document* document : set)
6483 fprintf(stderr, "- Document %p URL: %s\n", document, 6452 fprintf(stderr, "- Document %p URL: %s\n", document,
6484 document->url().getString().utf8().data()); 6453 document->url().getString().utf8().data());
6485 } 6454 }
6486 #endif 6455 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698