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

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

Issue 2557533005: Collect active stylesheets and and apply asynchronously. (Closed)
Patch Set: [Mac] Missing style recalc for device scale change Created 4 years 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 return *m_selectorQueryCache; 561 return *m_selectorQueryCache;
562 } 562 }
563 563
564 MediaQueryMatcher& Document::mediaQueryMatcher() { 564 MediaQueryMatcher& Document::mediaQueryMatcher() {
565 if (!m_mediaQueryMatcher) 565 if (!m_mediaQueryMatcher)
566 m_mediaQueryMatcher = MediaQueryMatcher::create(*this); 566 m_mediaQueryMatcher = MediaQueryMatcher::create(*this);
567 return *m_mediaQueryMatcher; 567 return *m_mediaQueryMatcher;
568 } 568 }
569 569
570 void Document::mediaQueryAffectingValueChanged() { 570 void Document::mediaQueryAffectingValueChanged() {
571 m_evaluateMediaQueriesOnStyleRecalc = true;
572 styleEngine().mediaQueryAffectingValueChanged(); 571 styleEngine().mediaQueryAffectingValueChanged();
572 if (needsLayoutTreeUpdate())
573 m_evaluateMediaQueriesOnStyleRecalc = true;
574 else
575 evaluateMediaQueryList();
573 InspectorInstrumentation::mediaQueryResultChanged(this); 576 InspectorInstrumentation::mediaQueryResultChanged(this);
574 } 577 }
575 578
576 void Document::setCompatibilityMode(CompatibilityMode mode) { 579 void Document::setCompatibilityMode(CompatibilityMode mode) {
577 if (m_compatibilityModeLocked || mode == m_compatibilityMode) 580 if (m_compatibilityModeLocked || mode == m_compatibilityMode)
578 return; 581 return;
579 m_compatibilityMode = mode; 582 m_compatibilityMode = mode;
580 selectorQueryCache().invalidate(); 583 selectorQueryCache().invalidate();
581 } 584 }
582 585
(...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after
2213 // stop it a second time, after page content has already been loaded and 2216 // stop it a second time, after page content has already been loaded and
2214 // displayed with accurate style information. (Our suppression involves 2217 // displayed with accurate style information. (Our suppression involves
2215 // blanking the whole page at the moment. If it were more refined, we might 2218 // blanking the whole page at the moment. If it were more refined, we might
2216 // be able to do something better.) It's worth noting though that this 2219 // be able to do something better.) It's worth noting though that this
2217 // entire method is a hack, since what we really want to do is suspend JS 2220 // entire method is a hack, since what we really want to do is suspend JS
2218 // instead of doing a layout with inaccurate information. 2221 // instead of doing a layout with inaccurate information.
2219 HTMLElement* bodyElement = body(); 2222 HTMLElement* bodyElement = body();
2220 if (bodyElement && !bodyElement->layoutObject() && 2223 if (bodyElement && !bodyElement->layoutObject() &&
2221 m_pendingSheetLayout == NoLayoutWithPendingSheets) { 2224 m_pendingSheetLayout == NoLayoutWithPendingSheets) {
2222 m_pendingSheetLayout = DidLayoutWithPendingSheets; 2225 m_pendingSheetLayout = DidLayoutWithPendingSheets;
2223 styleEngine().resolverChanged(FullStyleUpdate); 2226 styleEngine().markAllTreeScopesDirty();
2224 } else if (m_hasNodesWithPlaceholderStyle) { 2227 }
2228 if (m_hasNodesWithPlaceholderStyle) {
2225 // If new nodes have been added or style recalc has been done with style 2229 // If new nodes have been added or style recalc has been done with style
2226 // sheets still pending, some nodes may not have had their real style 2230 // sheets still pending, some nodes may not have had their real style
2227 // calculated yet. Normally this gets cleaned when style sheets arrive 2231 // calculated yet. Normally this gets cleaned when style sheets arrive
2228 // but here we need up-to-date style immediately. 2232 // but here we need up-to-date style immediately.
2229 setNeedsStyleRecalc(SubtreeStyleChange, 2233 setNeedsStyleRecalc(SubtreeStyleChange,
2230 StyleChangeReasonForTracing::create( 2234 StyleChangeReasonForTracing::create(
2231 StyleChangeReason::CleanupPlaceholderStyles)); 2235 StyleChangeReason::CleanupPlaceholderStyles));
2232 } 2236 }
2233 } 2237 }
2234 updateStyleAndLayoutTree(); 2238 updateStyleAndLayoutTree();
(...skipping 4347 matching lines...) Expand 10 before | Expand all | Expand 10 after
6582 } 6586 }
6583 6587
6584 void showLiveDocumentInstances() { 6588 void showLiveDocumentInstances() {
6585 WeakDocumentSet& set = liveDocumentSet(); 6589 WeakDocumentSet& set = liveDocumentSet();
6586 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6590 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6587 for (Document* document : set) 6591 for (Document* document : set)
6588 fprintf(stderr, "- Document %p URL: %s\n", document, 6592 fprintf(stderr, "- Document %p URL: %s\n", document,
6589 document->url().getString().utf8().data()); 6593 document->url().getString().utf8().data());
6590 } 6594 }
6591 #endif 6595 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698