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 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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
628 { | 628 { |
629 if (!m_selectorQueryCache) | 629 if (!m_selectorQueryCache) |
630 m_selectorQueryCache = adoptPtr(new SelectorQueryCache()); | 630 m_selectorQueryCache = adoptPtr(new SelectorQueryCache()); |
631 return *m_selectorQueryCache; | 631 return *m_selectorQueryCache; |
632 } | 632 } |
633 | 633 |
634 MediaQueryMatcher& Document::mediaQueryMatcher() | 634 MediaQueryMatcher& Document::mediaQueryMatcher() |
635 { | 635 { |
636 if (!m_mediaQueryMatcher) | 636 if (!m_mediaQueryMatcher) |
637 m_mediaQueryMatcher = MediaQueryMatcher::create(this); | 637 m_mediaQueryMatcher = MediaQueryMatcher::create(this); |
638 if (m_styleResolver && m_styleResolver->hasPendingAuthorStyleSheets()) | |
639 m_styleResolver->appendPendingAuthorStyleSheets(); | |
638 return *m_mediaQueryMatcher; | 640 return *m_mediaQueryMatcher; |
639 } | 641 } |
640 | 642 |
641 void Document::setCompatibilityMode(CompatibilityMode mode) | 643 void Document::setCompatibilityMode(CompatibilityMode mode) |
642 { | 644 { |
643 if (m_compatibilityModeLocked || mode == m_compatibilityMode) | 645 if (m_compatibilityModeLocked || mode == m_compatibilityMode) |
644 return; | 646 return; |
645 bool wasInQuirksMode = inQuirksMode(); | 647 bool wasInQuirksMode = inQuirksMode(); |
646 m_compatibilityMode = mode; | 648 m_compatibilityMode = mode; |
647 selectorQueryCache().invalidate(); | 649 selectorQueryCache().invalidate(); |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1693 // resolves style (here) and then when we resolve style on the parent chain, we may end up | 1695 // resolves style (here) and then when we resolve style on the parent chain, we may end up |
1694 // re-attaching our containing iframe, which when asked HTMLFrameElementBase ::isURLAllowed | 1696 // re-attaching our containing iframe, which when asked HTMLFrameElementBase ::isURLAllowed |
1695 // hits a null-dereference due to security code always assuming the document has a SecurityOrigin. | 1697 // hits a null-dereference due to security code always assuming the document has a SecurityOrigin. |
1696 | 1698 |
1697 if (m_styleEngine->needsUpdateActiveStylesheetsOnStyleRecalc()) | 1699 if (m_styleEngine->needsUpdateActiveStylesheetsOnStyleRecalc()) |
1698 m_styleEngine->updateActiveStyleSheets(FullStyleUpdate); | 1700 m_styleEngine->updateActiveStyleSheets(FullStyleUpdate); |
1699 | 1701 |
1700 if (m_elemSheet && m_elemSheet->contents()->usesRemUnits()) | 1702 if (m_elemSheet && m_elemSheet->contents()->usesRemUnits()) |
1701 m_styleEngine->setUsesRemUnit(true); | 1703 m_styleEngine->setUsesRemUnit(true); |
1702 | 1704 |
1705 if (m_styleResolver && m_styleResolver->hasPendingAuthorStyleSheets()) | |
1706 m_styleResolver->appendPendingAuthorStyleSheets(); | |
esprehn
2013/10/25 02:37:58
You shouldn't be repeated this everywhere. Just li
tasak
2013/10/25 10:10:10
I see.
I added an inline function to StyleResolver
| |
1707 | |
1703 { | 1708 { |
1704 PostAttachCallbacks::SuspendScope suspendPostAttachCallbacks; | 1709 PostAttachCallbacks::SuspendScope suspendPostAttachCallbacks; |
1705 RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates; | 1710 RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates; |
1706 FrameView::DeferredRepaintScope deferRepaints(*view()); | 1711 FrameView::DeferredRepaintScope deferRepaints(*view()); |
1707 TemporaryChange<bool> changeInStyleRecalc(m_inStyleRecalc, true); | 1712 TemporaryChange<bool> changeInStyleRecalc(m_inStyleRecalc, true); |
1708 | 1713 |
1709 if (styleChangeType() >= SubtreeStyleChange) | 1714 if (styleChangeType() >= SubtreeStyleChange) |
1710 change = Force; | 1715 change = Force; |
1711 | 1716 |
1712 if (change == Force || (change >= Inherit && shouldDisplaySeamlesslyWith Parent())) { | 1717 if (change == Force || (change >= Inherit && shouldDisplaySeamlesslyWith Parent())) { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1880 updateLayout(); | 1885 updateLayout(); |
1881 | 1886 |
1882 if (view()) | 1887 if (view()) |
1883 view()->partialLayout().reset(); | 1888 view()->partialLayout().reset(); |
1884 } | 1889 } |
1885 | 1890 |
1886 PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Elem ent* element) | 1891 PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Elem ent* element) |
1887 { | 1892 { |
1888 ASSERT_ARG(element, element->document() == this); | 1893 ASSERT_ARG(element, element->document() == this); |
1889 TemporaryChange<bool> ignoreStyleSheets(m_ignorePendingStylesheets, true); | 1894 TemporaryChange<bool> ignoreStyleSheets(m_ignorePendingStylesheets, true); |
1890 return styleResolver()->styleForElement(element, element->parentNode() ? ele ment->parentNode()->computedStyle() : 0); | 1895 StyleResolver* resolver = styleResolver(); |
1896 if (resolver->hasPendingAuthorStyleSheets()) | |
1897 resolver->appendPendingAuthorStyleSheets(); | |
esprehn
2013/10/25 02:37:58
This doesn't make sense. You call appendPendingAut
tasak
2013/10/25 10:10:10
Yeah, this is my mistake.
Since I removed the call
| |
1898 return resolver->styleForElement(element, element->parentNode() ? element->p arentNode()->computedStyle() : 0); | |
1891 } | 1899 } |
1892 | 1900 |
1893 PassRefPtr<RenderStyle> Document::styleForPage(int pageIndex) | 1901 PassRefPtr<RenderStyle> Document::styleForPage(int pageIndex) |
1894 { | 1902 { |
1895 return styleResolver()->styleForPage(pageIndex); | 1903 StyleResolver* resolver = styleResolver(); |
1904 if (resolver->hasPendingAuthorStyleSheets()) | |
1905 resolver->appendPendingAuthorStyleSheets(); | |
esprehn
2013/10/25 02:37:58
Same.
tasak
2013/10/25 10:10:10
Done.
| |
1906 return resolver->styleForPage(pageIndex); | |
1896 } | 1907 } |
1897 | 1908 |
1898 bool Document::isPageBoxVisible(int pageIndex) | 1909 bool Document::isPageBoxVisible(int pageIndex) |
1899 { | 1910 { |
1900 return styleForPage(pageIndex)->visibility() != HIDDEN; // display property doesn't apply to @page. | 1911 return styleForPage(pageIndex)->visibility() != HIDDEN; // display property doesn't apply to @page. |
1901 } | 1912 } |
1902 | 1913 |
1903 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft) | 1914 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft) |
1904 { | 1915 { |
1905 RefPtr<RenderStyle> style = styleForPage(pageIndex); | 1916 RefPtr<RenderStyle> style = styleForPage(pageIndex); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1951 | 1962 |
1952 void Document::createStyleResolver() | 1963 void Document::createStyleResolver() |
1953 { | 1964 { |
1954 bool matchAuthorAndUserStyles = true; | 1965 bool matchAuthorAndUserStyles = true; |
1955 if (Settings* docSettings = settings()) | 1966 if (Settings* docSettings = settings()) |
1956 matchAuthorAndUserStyles = docSettings->authorAndUserStylesEnabled(); | 1967 matchAuthorAndUserStyles = docSettings->authorAndUserStylesEnabled(); |
1957 m_styleResolver = adoptPtr(new StyleResolver(*this, matchAuthorAndUserStyles )); | 1968 m_styleResolver = adoptPtr(new StyleResolver(*this, matchAuthorAndUserStyles )); |
1958 m_styleEngine->combineCSSFeatureFlags(m_styleResolver->ruleFeatureSet()); | 1969 m_styleEngine->combineCSSFeatureFlags(m_styleResolver->ruleFeatureSet()); |
1959 } | 1970 } |
1960 | 1971 |
1972 void Document::appendPendingAuthorStyleSheets() | |
1973 { | |
1974 ASSERT(m_styleResolver); | |
1975 if (!m_styleResolver->hasPendingAuthorStyleSheets()) | |
1976 return; | |
1977 m_styleResolver->appendPendingAuthorStyleSheets(); | |
1978 } | |
1979 | |
1961 void Document::clearStyleResolver() | 1980 void Document::clearStyleResolver() |
1962 { | 1981 { |
1963 m_styleResolver.clear(); | 1982 m_styleResolver.clear(); |
1964 } | 1983 } |
1965 | 1984 |
1966 void Document::attach(const AttachContext& context) | 1985 void Document::attach(const AttachContext& context) |
1967 { | 1986 { |
1968 ASSERT(!confusingAndOftenMisusedAttached()); | 1987 ASSERT(!confusingAndOftenMisusedAttached()); |
1969 ASSERT(!m_axObjectCache || this != topDocument()); | 1988 ASSERT(!m_axObjectCache || this != topDocument()); |
1970 | 1989 |
(...skipping 3383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5354 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode) | 5373 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode) |
5355 { | 5374 { |
5356 if (!isActive()) | 5375 if (!isActive()) |
5357 return; | 5376 return; |
5358 | 5377 |
5359 styleEngine()->modifiedStyleSheet(sheet); | 5378 styleEngine()->modifiedStyleSheet(sheet); |
5360 styleResolverChanged(when, updateMode); | 5379 styleResolverChanged(when, updateMode); |
5361 } | 5380 } |
5362 | 5381 |
5363 } // namespace WebCore | 5382 } // namespace WebCore |
OLD | NEW |