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

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

Issue 2490163002: Reland of "Tracking reference filter mutation via SVGElementProxy" (Closed)
Patch Set: Fix double observer unregistration; simplify scope selection; add tests 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 clearNeedsReattachLayoutTree(); 1953 clearNeedsReattachLayoutTree();
1956 1954
1957 StyleResolver& resolver = ensureStyleResolver(); 1955 StyleResolver& resolver = ensureStyleResolver();
1958 1956
1959 bool shouldRecordStats; 1957 bool shouldRecordStats;
1960 TRACE_EVENT_CATEGORY_GROUP_ENABLED("blink,blink_style", &shouldRecordStats); 1958 TRACE_EVENT_CATEGORY_GROUP_ENABLED("blink,blink_style", &shouldRecordStats);
1961 styleEngine().setStatsEnabled(shouldRecordStats); 1959 styleEngine().setStatsEnabled(shouldRecordStats);
1962 1960
1963 if (Element* documentElement = this->documentElement()) { 1961 if (Element* documentElement = this->documentElement()) {
1964 inheritHtmlAndBodyElementStyles(change); 1962 inheritHtmlAndBodyElementStyles(change);
1965 dirtyElementsForLayerUpdate();
1966 if (documentElement->shouldCallRecalcStyle(change)) 1963 if (documentElement->shouldCallRecalcStyle(change))
1967 documentElement->recalcStyle(change); 1964 documentElement->recalcStyle(change);
1968 while (dirtyElementsForLayerUpdate())
1969 documentElement->recalcStyle(NoChange);
1970 } 1965 }
1971 1966
1972 view()->recalcOverflowAfterStyleChange(); 1967 view()->recalcOverflowAfterStyleChange();
1973 1968
1974 // Only retain the HashMap for the duration of StyleRecalc and 1969 // Only retain the HashMap for the duration of StyleRecalc and
1975 // LayoutTreeConstruction. 1970 // LayoutTreeConstruction.
1976 m_nonAttachedStyle.clear(); 1971 m_nonAttachedStyle.clear();
1977 clearChildNeedsStyleRecalc(); 1972 clearChildNeedsStyleRecalc();
1978 clearChildNeedsReattachLayoutTree(); 1973 clearChildNeedsReattachLayoutTree();
1979 1974
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
2237 2232
2238 void Document::setIsViewSource(bool isViewSource) { 2233 void Document::setIsViewSource(bool isViewSource) {
2239 m_isViewSource = isViewSource; 2234 m_isViewSource = isViewSource;
2240 if (!m_isViewSource) 2235 if (!m_isViewSource)
2241 return; 2236 return;
2242 2237
2243 setSecurityOrigin(SecurityOrigin::createUnique()); 2238 setSecurityOrigin(SecurityOrigin::createUnique());
2244 didUpdateSecurityOrigin(); 2239 didUpdateSecurityOrigin();
2245 } 2240 }
2246 2241
2247 bool Document::dirtyElementsForLayerUpdate() {
2248 if (m_layerUpdateSVGFilterElements.isEmpty())
2249 return false;
2250
2251 for (Element* element : m_layerUpdateSVGFilterElements)
2252 element->setNeedsStyleRecalc(LocalStyleChange,
2253 StyleChangeReasonForTracing::create(
2254 StyleChangeReason::SVGFilterLayerUpdate));
2255 m_layerUpdateSVGFilterElements.clear();
2256 return true;
2257 }
2258
2259 void Document::scheduleSVGFilterLayerUpdateHack(Element& element) {
2260 if (element.getStyleChangeType() == NeedsReattachStyleChange)
2261 return;
2262 element.setSVGFilterNeedsLayerUpdate();
2263 m_layerUpdateSVGFilterElements.add(&element);
2264 scheduleLayoutTreeUpdateIfNeeded();
2265 }
2266
2267 void Document::unscheduleSVGFilterLayerUpdateHack(Element& element) {
2268 element.clearSVGFilterNeedsLayerUpdate();
2269 m_layerUpdateSVGFilterElements.remove(&element);
2270 }
2271
2272 void Document::scheduleUseShadowTreeUpdate(SVGUseElement& element) { 2242 void Document::scheduleUseShadowTreeUpdate(SVGUseElement& element) {
2273 m_useElementsNeedingUpdate.add(&element); 2243 m_useElementsNeedingUpdate.add(&element);
2274 scheduleLayoutTreeUpdateIfNeeded(); 2244 scheduleLayoutTreeUpdateIfNeeded();
2275 } 2245 }
2276 2246
2277 void Document::unscheduleUseShadowTreeUpdate(SVGUseElement& element) { 2247 void Document::unscheduleUseShadowTreeUpdate(SVGUseElement& element) {
2278 m_useElementsNeedingUpdate.remove(&element); 2248 m_useElementsNeedingUpdate.remove(&element);
2279 } 2249 }
2280 2250
2281 void Document::updateUseShadowTreesIfNeeded() { 2251 void Document::updateUseShadowTreesIfNeeded() {
(...skipping 4116 matching lines...) Expand 10 before | Expand all | Expand 10 after
6398 visitor->trace(m_styleSheetList); 6368 visitor->trace(m_styleSheetList);
6399 visitor->trace(m_documentTiming); 6369 visitor->trace(m_documentTiming);
6400 visitor->trace(m_mediaQueryMatcher); 6370 visitor->trace(m_mediaQueryMatcher);
6401 visitor->trace(m_scriptedAnimationController); 6371 visitor->trace(m_scriptedAnimationController);
6402 visitor->trace(m_scriptedIdleTaskController); 6372 visitor->trace(m_scriptedIdleTaskController);
6403 visitor->trace(m_textAutosizer); 6373 visitor->trace(m_textAutosizer);
6404 visitor->trace(m_registrationContext); 6374 visitor->trace(m_registrationContext);
6405 visitor->trace(m_customElementMicrotaskRunQueue); 6375 visitor->trace(m_customElementMicrotaskRunQueue);
6406 visitor->trace(m_elementDataCache); 6376 visitor->trace(m_elementDataCache);
6407 visitor->trace(m_useElementsNeedingUpdate); 6377 visitor->trace(m_useElementsNeedingUpdate);
6408 visitor->trace(m_layerUpdateSVGFilterElements);
6409 visitor->trace(m_timers); 6378 visitor->trace(m_timers);
6410 visitor->trace(m_templateDocument); 6379 visitor->trace(m_templateDocument);
6411 visitor->trace(m_templateDocumentHost); 6380 visitor->trace(m_templateDocumentHost);
6412 visitor->trace(m_userActionElements); 6381 visitor->trace(m_userActionElements);
6413 visitor->trace(m_svgExtensions); 6382 visitor->trace(m_svgExtensions);
6414 visitor->trace(m_timeline); 6383 visitor->trace(m_timeline);
6415 visitor->trace(m_compositorPendingAnimations); 6384 visitor->trace(m_compositorPendingAnimations);
6416 visitor->trace(m_contextDocument); 6385 visitor->trace(m_contextDocument);
6417 visitor->trace(m_canvasFontCache); 6386 visitor->trace(m_canvasFontCache);
6418 visitor->trace(m_intersectionObserverController); 6387 visitor->trace(m_intersectionObserverController);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
6468 } 6437 }
6469 6438
6470 void showLiveDocumentInstances() { 6439 void showLiveDocumentInstances() {
6471 WeakDocumentSet& set = liveDocumentSet(); 6440 WeakDocumentSet& set = liveDocumentSet();
6472 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6441 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6473 for (Document* document : set) 6442 for (Document* document : set)
6474 fprintf(stderr, "- Document %p URL: %s\n", document, 6443 fprintf(stderr, "- Document %p URL: %s\n", document,
6475 document->url().getString().utf8().data()); 6444 document->url().getString().utf8().data());
6476 } 6445 }
6477 #endif 6446 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/Element.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698