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

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

Issue 42543007: StyleResolver should update RuleSets lazily. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Filter @viewport and @font-face in lazyAppend Created 7 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 | Annotate | Revision Log
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 r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 { 608 {
609 if (!m_selectorQueryCache) 609 if (!m_selectorQueryCache)
610 m_selectorQueryCache = adoptPtr(new SelectorQueryCache()); 610 m_selectorQueryCache = adoptPtr(new SelectorQueryCache());
611 return *m_selectorQueryCache; 611 return *m_selectorQueryCache;
612 } 612 }
613 613
614 MediaQueryMatcher& Document::mediaQueryMatcher() 614 MediaQueryMatcher& Document::mediaQueryMatcher()
615 { 615 {
616 if (!m_mediaQueryMatcher) 616 if (!m_mediaQueryMatcher)
617 m_mediaQueryMatcher = MediaQueryMatcher::create(this); 617 m_mediaQueryMatcher = MediaQueryMatcher::create(this);
618 appendPendingStyleSheetsIfNeeded(m_styleResolver.get());
618 return *m_mediaQueryMatcher; 619 return *m_mediaQueryMatcher;
619 } 620 }
620 621
621 void Document::setCompatibilityMode(CompatibilityMode mode) 622 void Document::setCompatibilityMode(CompatibilityMode mode)
622 { 623 {
623 if (m_compatibilityModeLocked || mode == m_compatibilityMode) 624 if (m_compatibilityModeLocked || mode == m_compatibilityMode)
624 return; 625 return;
625 bool wasInQuirksMode = inQuirksMode(); 626 bool wasInQuirksMode = inQuirksMode();
626 m_compatibilityMode = mode; 627 m_compatibilityMode = mode;
627 selectorQueryCache().invalidate(); 628 selectorQueryCache().invalidate();
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
1676 // resolves style (here) and then when we resolve style on the parent chain, we may end up 1677 // resolves style (here) and then when we resolve style on the parent chain, we may end up
1677 // re-attaching our containing iframe, which when asked HTMLFrameElementBase ::isURLAllowed 1678 // re-attaching our containing iframe, which when asked HTMLFrameElementBase ::isURLAllowed
1678 // hits a null-dereference due to security code always assuming the document has a SecurityOrigin. 1679 // hits a null-dereference due to security code always assuming the document has a SecurityOrigin.
1679 1680
1680 if (m_styleEngine->needsUpdateActiveStylesheetsOnStyleRecalc()) 1681 if (m_styleEngine->needsUpdateActiveStylesheetsOnStyleRecalc())
1681 m_styleEngine->updateActiveStyleSheets(FullStyleUpdate); 1682 m_styleEngine->updateActiveStyleSheets(FullStyleUpdate);
1682 1683
1683 if (m_elemSheet && m_elemSheet->contents()->usesRemUnits()) 1684 if (m_elemSheet && m_elemSheet->contents()->usesRemUnits())
1684 m_styleEngine->setUsesRemUnit(true); 1685 m_styleEngine->setUsesRemUnit(true);
1685 1686
1687 appendPendingStyleSheetsIfNeeded(m_styleResolver.get());
1688
1686 { 1689 {
1687 PostAttachCallbacks::SuspendScope suspendPostAttachCallbacks; 1690 PostAttachCallbacks::SuspendScope suspendPostAttachCallbacks;
1688 RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates; 1691 RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates;
1689 FrameView::DeferredRepaintScope deferRepaints(*view()); 1692 FrameView::DeferredRepaintScope deferRepaints(*view());
1690 TemporaryChange<bool> changeInStyleRecalc(m_inStyleRecalc, true); 1693 TemporaryChange<bool> changeInStyleRecalc(m_inStyleRecalc, true);
1691 1694
1692 if (styleChangeType() >= SubtreeStyleChange) 1695 if (styleChangeType() >= SubtreeStyleChange)
1693 change = Force; 1696 change = Force;
1694 1697
1695 if (change == Force || (change >= Inherit && shouldDisplaySeamlesslyWith Parent())) { 1698 if (change == Force || (change >= Inherit && shouldDisplaySeamlesslyWith Parent())) {
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 updateLayout(); 1866 updateLayout();
1864 1867
1865 if (view()) 1868 if (view())
1866 view()->partialLayout().reset(); 1869 view()->partialLayout().reset();
1867 } 1870 }
1868 1871
1869 PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Elem ent* element) 1872 PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Elem ent* element)
1870 { 1873 {
1871 ASSERT_ARG(element, element->document() == this); 1874 ASSERT_ARG(element, element->document() == this);
1872 TemporaryChange<bool> ignoreStyleSheets(m_ignorePendingStylesheets, true); 1875 TemporaryChange<bool> ignoreStyleSheets(m_ignorePendingStylesheets, true);
1873 return styleResolver()->styleForElement(element, element->parentNode() ? ele ment->parentNode()->computedStyle() : 0); 1876 StyleResolver* resolver = styleResolver();
1877 appendPendingStyleSheetsIfNeeded(resolver);
1878 return resolver->styleForElement(element, element->parentNode() ? element->p arentNode()->computedStyle() : 0);
1874 } 1879 }
1875 1880
1876 PassRefPtr<RenderStyle> Document::styleForPage(int pageIndex) 1881 PassRefPtr<RenderStyle> Document::styleForPage(int pageIndex)
1877 { 1882 {
1878 return styleResolver()->styleForPage(pageIndex); 1883 StyleResolver* resolver = styleResolver();
1884 appendPendingStyleSheetsIfNeeded(resolver);
1885 return resolver->styleForPage(pageIndex);
1879 } 1886 }
1880 1887
1881 bool Document::isPageBoxVisible(int pageIndex) 1888 bool Document::isPageBoxVisible(int pageIndex)
1882 { 1889 {
1883 return styleForPage(pageIndex)->visibility() != HIDDEN; // display property doesn't apply to @page. 1890 return styleForPage(pageIndex)->visibility() != HIDDEN; // display property doesn't apply to @page.
1884 } 1891 }
1885 1892
1886 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft) 1893 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft)
1887 { 1894 {
1888 RefPtr<RenderStyle> style = styleForPage(pageIndex); 1895 RefPtr<RenderStyle> style = styleForPage(pageIndex);
(...skipping 3333 matching lines...) Expand 10 before | Expand all | Expand 10 after
5222 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode) 5229 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode)
5223 { 5230 {
5224 if (!isActive()) 5231 if (!isActive())
5225 return; 5232 return;
5226 5233
5227 styleEngine()->modifiedStyleSheet(sheet); 5234 styleEngine()->modifiedStyleSheet(sheet);
5228 styleResolverChanged(when, updateMode); 5235 styleResolverChanged(when, updateMode);
5229 } 5236 }
5230 5237
5231 } // namespace WebCore 5238 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698