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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2208 // stop it a second time, after page content has already been loaded and | 2211 // stop it a second time, after page content has already been loaded and |
2209 // displayed with accurate style information. (Our suppression involves | 2212 // displayed with accurate style information. (Our suppression involves |
2210 // blanking the whole page at the moment. If it were more refined, we might | 2213 // blanking the whole page at the moment. If it were more refined, we might |
2211 // be able to do something better.) It's worth noting though that this | 2214 // be able to do something better.) It's worth noting though that this |
2212 // entire method is a hack, since what we really want to do is suspend JS | 2215 // entire method is a hack, since what we really want to do is suspend JS |
2213 // instead of doing a layout with inaccurate information. | 2216 // instead of doing a layout with inaccurate information. |
2214 HTMLElement* bodyElement = body(); | 2217 HTMLElement* bodyElement = body(); |
2215 if (bodyElement && !bodyElement->layoutObject() && | 2218 if (bodyElement && !bodyElement->layoutObject() && |
2216 m_pendingSheetLayout == NoLayoutWithPendingSheets) { | 2219 m_pendingSheetLayout == NoLayoutWithPendingSheets) { |
2217 m_pendingSheetLayout = DidLayoutWithPendingSheets; | 2220 m_pendingSheetLayout = DidLayoutWithPendingSheets; |
2218 styleEngine().resolverChanged(FullStyleUpdate); | 2221 styleEngine().markAllTreeScopesDirty(); |
2219 } else if (m_hasNodesWithPlaceholderStyle) { | 2222 } |
| 2223 if (m_hasNodesWithPlaceholderStyle) { |
2220 // If new nodes have been added or style recalc has been done with style | 2224 // If new nodes have been added or style recalc has been done with style |
2221 // sheets still pending, some nodes may not have had their real style | 2225 // sheets still pending, some nodes may not have had their real style |
2222 // calculated yet. Normally this gets cleaned when style sheets arrive | 2226 // calculated yet. Normally this gets cleaned when style sheets arrive |
2223 // but here we need up-to-date style immediately. | 2227 // but here we need up-to-date style immediately. |
2224 setNeedsStyleRecalc(SubtreeStyleChange, | 2228 setNeedsStyleRecalc(SubtreeStyleChange, |
2225 StyleChangeReasonForTracing::create( | 2229 StyleChangeReasonForTracing::create( |
2226 StyleChangeReason::CleanupPlaceholderStyles)); | 2230 StyleChangeReason::CleanupPlaceholderStyles)); |
2227 } | 2231 } |
2228 } | 2232 } |
2229 updateStyleAndLayoutTree(); | 2233 updateStyleAndLayoutTree(); |
(...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3756 void Document::notifyResizeForViewportUnits() { | 3760 void Document::notifyResizeForViewportUnits() { |
3757 if (m_mediaQueryMatcher) | 3761 if (m_mediaQueryMatcher) |
3758 m_mediaQueryMatcher->viewportChanged(); | 3762 m_mediaQueryMatcher->viewportChanged(); |
3759 if (!hasViewportUnits()) | 3763 if (!hasViewportUnits()) |
3760 return; | 3764 return; |
3761 ensureStyleResolver().notifyResizeForViewportUnits(); | 3765 ensureStyleResolver().notifyResizeForViewportUnits(); |
3762 setNeedsStyleRecalcForViewportUnits(); | 3766 setNeedsStyleRecalcForViewportUnits(); |
3763 } | 3767 } |
3764 | 3768 |
3765 void Document::styleResolverMayHaveChanged() { | 3769 void Document::styleResolverMayHaveChanged() { |
3766 styleEngine().resolverChanged(AnalyzedStyleUpdate); | |
3767 | |
3768 if (hasNodesWithPlaceholderStyle()) { | 3770 if (hasNodesWithPlaceholderStyle()) { |
3769 setNeedsStyleRecalc(SubtreeStyleChange, | 3771 setNeedsStyleRecalc(SubtreeStyleChange, |
3770 StyleChangeReasonForTracing::create( | 3772 StyleChangeReasonForTracing::create( |
3771 StyleChangeReason::CleanupPlaceholderStyles)); | 3773 StyleChangeReason::CleanupPlaceholderStyles)); |
3772 } | 3774 } |
3773 | 3775 |
3774 if (didLayoutWithPendingStylesheets() && | 3776 if (didLayoutWithPendingStylesheets() && |
3775 !styleEngine().hasPendingScriptBlockingSheets()) { | 3777 !styleEngine().hasPendingScriptBlockingSheets()) { |
3776 // We need to manually repaint because we avoid doing all repaints in layout | 3778 // We need to manually repaint because we avoid doing all repaints in layout |
3777 // or style recalc while sheets are still loading to avoid FOUC. | 3779 // or style recalc while sheets are still loading to avoid FOUC. |
(...skipping 2802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6580 } | 6582 } |
6581 | 6583 |
6582 void showLiveDocumentInstances() { | 6584 void showLiveDocumentInstances() { |
6583 WeakDocumentSet& set = liveDocumentSet(); | 6585 WeakDocumentSet& set = liveDocumentSet(); |
6584 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6586 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6585 for (Document* document : set) | 6587 for (Document* document : set) |
6586 fprintf(stderr, "- Document %p URL: %s\n", document, | 6588 fprintf(stderr, "- Document %p URL: %s\n", document, |
6587 document->url().getString().utf8().data()); | 6589 document->url().getString().utf8().data()); |
6588 } | 6590 } |
6589 #endif | 6591 #endif |
OLD | NEW |