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

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

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

Powered by Google App Engine
This is Rietveld 408576698