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 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 | 1514 |
1515 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho
w, PassRefPtr<NodeFilter> filter, ExceptionState& exceptionState) | 1515 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho
w, PassRefPtr<NodeFilter> filter, ExceptionState& exceptionState) |
1516 { | 1516 { |
1517 if (!root) { | 1517 if (!root) { |
1518 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Node")); | 1518 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Node")); |
1519 return nullptr; | 1519 return nullptr; |
1520 } | 1520 } |
1521 return TreeWalker::create(root, whatToShow, filter); | 1521 return TreeWalker::create(root, whatToShow, filter); |
1522 } | 1522 } |
1523 | 1523 |
1524 bool Document::shouldCallRecalcStyleForDocument() | 1524 bool Document::needsRenderTreeUpdate() const |
1525 { | 1525 { |
1526 if (!isActive() || !view()) | 1526 if (!isActive() || !view()) |
1527 return false; | 1527 return false; |
1528 if (needsStyleRecalc() || childNeedsStyleRecalc()) | 1528 if (needsStyleRecalc() || childNeedsStyleRecalc()) |
1529 return true; | 1529 return true; |
1530 if (childNeedsDistributionRecalc()) | 1530 if (childNeedsDistributionRecalc()) |
1531 return true; | 1531 return true; |
1532 if (!m_useElementsNeedingUpdate.isEmpty()) | 1532 if (!m_useElementsNeedingUpdate.isEmpty()) |
1533 return true; | 1533 return true; |
1534 if (!m_layerUpdateElements.isEmpty()) | 1534 if (!m_layerUpdateElements.isEmpty()) |
1535 return true; | 1535 return true; |
1536 if (childNeedsStyleInvalidation()) | 1536 if (childNeedsStyleInvalidation()) |
1537 return true; | 1537 return true; |
1538 return false; | 1538 return false; |
1539 } | 1539 } |
1540 | 1540 |
1541 bool Document::shouldScheduleStyleRecalc() | 1541 bool Document::shouldScheduleRenderTreeUpdate() const |
1542 { | 1542 { |
1543 if (!isActive()) | 1543 if (!isActive()) |
1544 return false; | 1544 return false; |
1545 if (hasPendingStyleRecalc()) | 1545 if (hasPendingStyleRecalc()) |
1546 return false; | 1546 return false; |
1547 if (inStyleRecalc()) | 1547 if (inStyleRecalc()) |
1548 return false; | 1548 return false; |
1549 // InPreLayout will recalc style itself. There's no reason to schedule anoth
er recalc. | 1549 // InPreLayout will recalc style itself. There's no reason to schedule anoth
er recalc. |
1550 if (m_lifecycle.state() == DocumentLifecycle::InPreLayout) | 1550 if (m_lifecycle.state() == DocumentLifecycle::InPreLayout) |
1551 return false; | 1551 return false; |
1552 if (!shouldScheduleLayout()) | 1552 if (!shouldScheduleLayout()) |
1553 return false; | 1553 return false; |
1554 return true; | 1554 return true; |
1555 } | 1555 } |
1556 | 1556 |
1557 void Document::scheduleStyleRecalc() | 1557 void Document::scheduleRenderTreeUpdate() |
1558 { | 1558 { |
1559 if (!shouldScheduleStyleRecalc()) | 1559 if (!shouldScheduleRenderTreeUpdate()) |
1560 return; | 1560 return; |
1561 | 1561 |
1562 ASSERT(shouldCallRecalcStyleForDocument()); | 1562 ASSERT(needsRenderTreeUpdate()); |
1563 | 1563 |
1564 page()->animator().scheduleVisualUpdate(); | 1564 page()->animator().scheduleVisualUpdate(); |
1565 m_lifecycle.advanceTo(DocumentLifecycle::StyleRecalcPending); | 1565 m_lifecycle.advanceTo(DocumentLifecycle::StyleRecalcPending); |
1566 | 1566 |
1567 InspectorInstrumentation::didScheduleStyleRecalculation(this); | 1567 InspectorInstrumentation::didScheduleStyleRecalculation(this); |
1568 } | 1568 } |
1569 | 1569 |
1570 bool Document::hasPendingForcedStyleRecalc() const | 1570 bool Document::hasPendingForcedStyleRecalc() const |
1571 { | 1571 { |
1572 return hasPendingStyleRecalc() && !inStyleRecalc() && styleChangeType() >= S
ubtreeStyleChange; | 1572 return hasPendingStyleRecalc() && !inStyleRecalc() && styleChangeType() >= S
ubtreeStyleChange; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 body->setNeedsStyleRecalc(SubtreeStyleChange); | 1699 body->setNeedsStyleRecalc(SubtreeStyleChange); |
1700 } | 1700 } |
1701 } | 1701 } |
1702 | 1702 |
1703 if (RenderStyle* style = documentElement()->renderStyle()) { | 1703 if (RenderStyle* style = documentElement()->renderStyle()) { |
1704 if (style->direction() != rootDirection || style->writingMode() != rootW
ritingMode) | 1704 if (style->direction() != rootDirection || style->writingMode() != rootW
ritingMode) |
1705 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange); | 1705 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange); |
1706 } | 1706 } |
1707 } | 1707 } |
1708 | 1708 |
1709 void Document::updateStyleIfNeeded() | 1709 void Document::updateRenderTree(StyleRecalcChange change) |
1710 { | |
1711 updateStyle(NoChange); | |
1712 } | |
1713 | |
1714 // FIXME: We need a better name than updateStyleIfNeeded. It's performing style
invalidation, | |
1715 // style recalc, distribution and <use> shadow tree creation. | |
1716 void Document::updateStyle(StyleRecalcChange change) | |
1717 { | 1710 { |
1718 ASSERT(isMainThread()); | 1711 ASSERT(isMainThread()); |
1719 | 1712 |
1720 if (change != Force && !shouldCallRecalcStyleForDocument()) | 1713 if (change != Force && !needsRenderTreeUpdate()) |
1721 return; | 1714 return; |
1722 | 1715 |
1723 if (inStyleRecalc()) | 1716 if (inStyleRecalc()) |
1724 return; | 1717 return; |
1725 | 1718 |
1726 // Entering here from inside layout or paint would be catastrophic since rec
alcStyle can | 1719 // Entering here from inside layout or paint would be catastrophic since rec
alcStyle can |
1727 // tear down the render tree or (unfortunately) run script. Kill the whole r
enderer if | 1720 // tear down the render tree or (unfortunately) run script. Kill the whole r
enderer if |
1728 // someone managed to get into here from inside layout or paint. | 1721 // someone managed to get into here from inside layout or paint. |
1729 RELEASE_ASSERT(!view()->isInPerformLayout()); | 1722 RELEASE_ASSERT(!view()->isInPerformLayout()); |
1730 RELEASE_ASSERT(!view()->isPainting()); | 1723 RELEASE_ASSERT(!view()->isPainting()); |
1731 | 1724 |
1732 // Script can run below in WidgetUpdates, so protect the LocalFrame. | 1725 // Script can run below in WidgetUpdates, so protect the LocalFrame. |
1733 RefPtr<LocalFrame> protect(m_frame); | 1726 RefPtr<LocalFrame> protect(m_frame); |
1734 | 1727 |
1735 TRACE_EVENT0("webkit", "Document::recalcStyle"); | 1728 TRACE_EVENT0("webkit", "Document::updateRenderTree"); |
1736 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "RecalcStyle"); | 1729 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "UpdateRenderTree"); |
1737 | 1730 |
1738 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalc
ulateStyle(this); | 1731 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalc
ulateStyle(this); |
1739 | 1732 |
1740 updateDistributionIfNeeded(); | 1733 updateDistributionIfNeeded(); |
1741 updateUseShadowTreesIfNeeded(); | 1734 updateUseShadowTreesIfNeeded(); |
1742 updateStyleInvalidationIfNeeded(); | 1735 updateStyleInvalidationIfNeeded(); |
1743 | 1736 |
1744 if (m_evaluateMediaQueriesOnStyleRecalc) { | 1737 // This executes media query listeners which runs script. |
1745 m_evaluateMediaQueriesOnStyleRecalc = false; | 1738 evaluateMediaQueryListIfNeeded(); |
1746 evaluateMediaQueryList(); | |
1747 } | |
1748 | 1739 |
1749 // FIXME: We should update style on our ancestor chain before proceeding | 1740 // FIXME: We should update style on our ancestor chain before proceeding |
1750 // however doing so currently causes several tests to crash, as LocalFrame::
setDocument calls Document::attach | 1741 // however doing so currently causes several tests to crash, as LocalFrame::
setDocument calls Document::attach |
1751 // before setting the DOMWindow on the LocalFrame, or the SecurityOrigin on
the document. The attach, in turn | 1742 // before setting the DOMWindow on the LocalFrame, or the SecurityOrigin on
the document. The attach, in turn |
1752 // resolves style (here) and then when we resolve style on the parent chain,
we may end up | 1743 // resolves style (here) and then when we resolve style on the parent chain,
we may end up |
1753 // re-attaching our containing iframe, which when asked HTMLFrameElementBase
::isURLAllowed | 1744 // re-attaching our containing iframe, which when asked HTMLFrameElementBase
::isURLAllowed |
1754 // hits a null-dereference due to security code always assuming the document
has a SecurityOrigin. | 1745 // hits a null-dereference due to security code always assuming the document
has a SecurityOrigin. |
1755 | 1746 |
1756 if (m_elemSheet && m_elemSheet->contents()->usesRemUnits()) | 1747 if (m_elemSheet && m_elemSheet->contents()->usesRemUnits()) |
1757 m_styleEngine->setUsesRemUnit(true); | 1748 m_styleEngine->setUsesRemUnit(true); |
1758 | 1749 |
1759 { | 1750 updateStyle(change); |
1760 RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates; | |
1761 m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc); | |
1762 | |
1763 if (styleChangeType() >= SubtreeStyleChange) | |
1764 change = Force; | |
1765 | |
1766 // FIXME: Cannot access the ensureStyleResolver() before calling styleFo
rDocument below because | |
1767 // apparently the StyleResolver's constructor has side effects. We shoul
d fix it. | |
1768 // See printing/setPrinting.html, printing/width-overflow.html though th
ey only fail on | |
1769 // mac when accessing the resolver by what appears to be a viewport size
difference. | |
1770 | |
1771 if (change == Force) { | |
1772 m_hasNodesWithPlaceholderStyle = false; | |
1773 RefPtr<RenderStyle> documentStyle = StyleResolver::styleForDocument(
*this, m_styleEngine->fontSelector()); | |
1774 StyleRecalcChange localChange = RenderStyle::compare(documentStyle.g
et(), renderView()->style()); | |
1775 if (localChange != NoChange) | |
1776 renderView()->setStyle(documentStyle.release()); | |
1777 } | |
1778 | |
1779 clearNeedsStyleRecalc(); | |
1780 | |
1781 // Uncomment to enable printing of statistics about style sharing and th
e matched property cache. | |
1782 // Optionally pass StyleResolver::ReportSlowStats to print numbers that
require crawling the | |
1783 // entire DOM (where collecting them is very slow). | |
1784 // FIXME: Expose this as a runtime flag. | |
1785 // ensureStyleResolver().enableStats(/*StyleResolver::ReportSlowStats*/)
; | |
1786 | |
1787 if (StyleResolverStats* stats = ensureStyleResolver().stats()) | |
1788 stats->reset(); | |
1789 | |
1790 if (Element* documentElement = this->documentElement()) { | |
1791 inheritHtmlAndBodyElementStyles(change); | |
1792 dirtyElementsForLayerUpdate(); | |
1793 if (documentElement->shouldCallRecalcStyle(change)) | |
1794 documentElement->recalcStyle(change); | |
1795 while (dirtyElementsForLayerUpdate()) | |
1796 documentElement->recalcStyle(NoChange); | |
1797 } | |
1798 | |
1799 ensureStyleResolver().printStats(); | |
1800 | |
1801 view()->updateCompositingLayersAfterStyleChange(); | |
1802 | |
1803 clearChildNeedsStyleRecalc(); | |
1804 | |
1805 if (m_styleEngine->hasResolver()) { | |
1806 // Pseudo element removal and similar may only work with these flags
still set. Reset them after the style recalc. | |
1807 StyleResolver& resolver = m_styleEngine->ensureResolver(); | |
1808 m_styleEngine->resetCSSFeatureFlags(resolver.ensureUpdatedRuleFeatur
eSet()); | |
1809 resolver.clearStyleSharingList(); | |
1810 } | |
1811 | |
1812 ASSERT(!needsStyleRecalc()); | |
1813 ASSERT(!childNeedsStyleRecalc()); | |
1814 ASSERT(inStyleRecalc()); | |
1815 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); | |
1816 } | |
1817 | 1751 |
1818 // As a result of the style recalculation, the currently hovered element mig
ht have been | 1752 // As a result of the style recalculation, the currently hovered element mig
ht have been |
1819 // detached (for example, by setting display:none in the :hover style), sche
dule another mouseMove event | 1753 // detached (for example, by setting display:none in the :hover style), sche
dule another mouseMove event |
1820 // to check if any other elements ended up under the mouse pointer due to re
-layout. | 1754 // to check if any other elements ended up under the mouse pointer due to re
-layout. |
1821 if (hoverNode() && !hoverNode()->renderer() && frame()) | 1755 if (hoverNode() && !hoverNode()->renderer() && frame()) |
1822 frame()->eventHandler().dispatchFakeMouseMoveEventSoon(); | 1756 frame()->eventHandler().dispatchFakeMouseMoveEventSoon(); |
1823 | 1757 |
1824 if (m_focusedElement && !m_focusedElement->isFocusable()) | 1758 if (m_focusedElement && !m_focusedElement->isFocusable()) |
1825 clearFocusedElementSoon(); | 1759 clearFocusedElementSoon(); |
1826 | 1760 |
1827 #if ENABLE(SVG_FONTS) | 1761 #if ENABLE(SVG_FONTS) |
1828 if (svgExtensions()) | 1762 if (svgExtensions()) |
1829 accessSVGExtensions().removePendingSVGFontFaceElementsForRemoval(); | 1763 accessSVGExtensions().removePendingSVGFontFaceElementsForRemoval(); |
1830 #endif | 1764 #endif |
1831 InspectorInstrumentation::didRecalculateStyle(cookie); | 1765 InspectorInstrumentation::didRecalculateStyle(cookie); |
1832 } | 1766 } |
1833 | 1767 |
| 1768 void Document::updateStyle(StyleRecalcChange change) |
| 1769 { |
| 1770 TRACE_EVENT0("webkit", "Document::updateStyle"); |
| 1771 |
| 1772 RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates; |
| 1773 m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc); |
| 1774 |
| 1775 if (styleChangeType() >= SubtreeStyleChange) |
| 1776 change = Force; |
| 1777 |
| 1778 // FIXME: Cannot access the ensureStyleResolver() before calling styleForDoc
ument below because |
| 1779 // apparently the StyleResolver's constructor has side effects. We should fi
x it. |
| 1780 // See printing/setPrinting.html, printing/width-overflow.html though they o
nly fail on |
| 1781 // mac when accessing the resolver by what appears to be a viewport size dif
ference. |
| 1782 |
| 1783 if (change == Force) { |
| 1784 m_hasNodesWithPlaceholderStyle = false; |
| 1785 RefPtr<RenderStyle> documentStyle = StyleResolver::styleForDocument(*thi
s, m_styleEngine->fontSelector()); |
| 1786 StyleRecalcChange localChange = RenderStyle::compare(documentStyle.get()
, renderView()->style()); |
| 1787 if (localChange != NoChange) |
| 1788 renderView()->setStyle(documentStyle.release()); |
| 1789 } |
| 1790 |
| 1791 clearNeedsStyleRecalc(); |
| 1792 |
| 1793 // Uncomment to enable printing of statistics about style sharing and the ma
tched property cache. |
| 1794 // Optionally pass StyleResolver::ReportSlowStats to print numbers that requ
ire crawling the |
| 1795 // entire DOM (where collecting them is very slow). |
| 1796 // FIXME: Expose this as a runtime flag. |
| 1797 // ensureStyleResolver().enableStats(/*StyleResolver::ReportSlowStats*/); |
| 1798 |
| 1799 if (StyleResolverStats* stats = ensureStyleResolver().stats()) |
| 1800 stats->reset(); |
| 1801 |
| 1802 if (Element* documentElement = this->documentElement()) { |
| 1803 inheritHtmlAndBodyElementStyles(change); |
| 1804 dirtyElementsForLayerUpdate(); |
| 1805 if (documentElement->shouldCallRecalcStyle(change)) |
| 1806 documentElement->recalcStyle(change); |
| 1807 while (dirtyElementsForLayerUpdate()) |
| 1808 documentElement->recalcStyle(NoChange); |
| 1809 } |
| 1810 |
| 1811 ensureStyleResolver().printStats(); |
| 1812 |
| 1813 view()->updateCompositingLayersAfterStyleChange(); |
| 1814 |
| 1815 clearChildNeedsStyleRecalc(); |
| 1816 |
| 1817 if (m_styleEngine->hasResolver()) { |
| 1818 // Pseudo element removal and similar may only work with these flags sti
ll set. Reset them after the style recalc. |
| 1819 StyleResolver& resolver = m_styleEngine->ensureResolver(); |
| 1820 m_styleEngine->resetCSSFeatureFlags(resolver.ensureUpdatedRuleFeatureSet
()); |
| 1821 resolver.clearStyleSharingList(); |
| 1822 } |
| 1823 |
| 1824 ASSERT(!needsStyleRecalc()); |
| 1825 ASSERT(!childNeedsStyleRecalc()); |
| 1826 ASSERT(inStyleRecalc()); |
| 1827 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); |
| 1828 } |
| 1829 |
1834 void Document::updateStyleForNodeIfNeeded(Node* node) | 1830 void Document::updateStyleForNodeIfNeeded(Node* node) |
1835 { | 1831 { |
1836 if (!shouldCallRecalcStyleForDocument()) | 1832 if (!needsRenderTreeUpdate()) |
1837 return; | 1833 return; |
1838 | 1834 |
1839 // At this point, we know that we need to recalc some style on the document
in order to fully update styles. | 1835 // At this point, we know that we need to recalc some style on the document
in order to fully update styles. |
1840 // However, style on 'node' only needs to be recalculated if a global recomp
utation is needed, or a node on | 1836 // However, style on 'node' only needs to be recalculated if a global recomp
utation is needed, or a node on |
1841 // the path from 'node' to the root needs style recalc. | 1837 // the path from 'node' to the root needs style recalc. |
1842 | 1838 |
1843 // Global needed. | 1839 // Global needed. |
1844 bool needsRecalc = needsStyleRecalc() || childNeedsDistributionRecalc() || !
m_useElementsNeedingUpdate.isEmpty() || childNeedsStyleInvalidation(); | 1840 bool needsRecalc = needsStyleRecalc() || childNeedsDistributionRecalc() || !
m_useElementsNeedingUpdate.isEmpty() || childNeedsStyleInvalidation(); |
1845 | 1841 |
1846 // On the path. | 1842 // On the path. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1910 // is a hack, since what we really want to do is suspend JS instead of d
oing a layout with | 1906 // is a hack, since what we really want to do is suspend JS instead of d
oing a layout with |
1911 // inaccurate information. | 1907 // inaccurate information. |
1912 HTMLElement* bodyElement = body(); | 1908 HTMLElement* bodyElement = body(); |
1913 if (bodyElement && !bodyElement->renderer() && m_pendingSheetLayout == N
oLayoutWithPendingSheets) { | 1909 if (bodyElement && !bodyElement->renderer() && m_pendingSheetLayout == N
oLayoutWithPendingSheets) { |
1914 m_pendingSheetLayout = DidLayoutWithPendingSheets; | 1910 m_pendingSheetLayout = DidLayoutWithPendingSheets; |
1915 styleResolverChanged(RecalcStyleImmediately); | 1911 styleResolverChanged(RecalcStyleImmediately); |
1916 } else if (m_hasNodesWithPlaceholderStyle) { | 1912 } else if (m_hasNodesWithPlaceholderStyle) { |
1917 // If new nodes have been added or style recalc has been done with s
tyle sheets still | 1913 // If new nodes have been added or style recalc has been done with s
tyle sheets still |
1918 // pending, some nodes may not have had their real style calculated
yet. Normally this | 1914 // pending, some nodes may not have had their real style calculated
yet. Normally this |
1919 // gets cleaned when style sheets arrive but here we need up-to-date
style immediately. | 1915 // gets cleaned when style sheets arrive but here we need up-to-date
style immediately. |
1920 updateStyle(Force); | 1916 updateRenderTree(Force); |
1921 } | 1917 } |
1922 } | 1918 } |
1923 | 1919 |
1924 updateLayout(); | 1920 updateLayout(); |
1925 | 1921 |
1926 if (runPostLayoutTasks == RunPostLayoutTasksSynchronously && view()) | 1922 if (runPostLayoutTasks == RunPostLayoutTasksSynchronously && view()) |
1927 view()->flushAnyPendingPostLayoutTasks(); | 1923 view()->flushAnyPendingPostLayoutTasks(); |
1928 } | 1924 } |
1929 | 1925 |
1930 PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Elem
ent* element) | 1926 PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Elem
ent* element) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 m_layerUpdateElements.clear(); | 1998 m_layerUpdateElements.clear(); |
2003 return true; | 1999 return true; |
2004 } | 2000 } |
2005 | 2001 |
2006 void Document::scheduleLayerUpdate(Element& element) | 2002 void Document::scheduleLayerUpdate(Element& element) |
2007 { | 2003 { |
2008 if (element.styleChangeType() == NeedsReattachStyleChange) | 2004 if (element.styleChangeType() == NeedsReattachStyleChange) |
2009 return; | 2005 return; |
2010 element.setNeedsLayerUpdate(); | 2006 element.setNeedsLayerUpdate(); |
2011 m_layerUpdateElements.add(&element); | 2007 m_layerUpdateElements.add(&element); |
2012 scheduleStyleRecalc(); | 2008 scheduleRenderTreeUpdate(); |
2013 } | 2009 } |
2014 | 2010 |
2015 void Document::unscheduleLayerUpdate(Element& element) | 2011 void Document::unscheduleLayerUpdate(Element& element) |
2016 { | 2012 { |
2017 element.clearNeedsLayerUpdate(); | 2013 element.clearNeedsLayerUpdate(); |
2018 m_layerUpdateElements.remove(&element); | 2014 m_layerUpdateElements.remove(&element); |
2019 } | 2015 } |
2020 | 2016 |
2021 void Document::scheduleUseShadowTreeUpdate(SVGUseElement& element) | 2017 void Document::scheduleUseShadowTreeUpdate(SVGUseElement& element) |
2022 { | 2018 { |
2023 m_useElementsNeedingUpdate.add(&element); | 2019 m_useElementsNeedingUpdate.add(&element); |
2024 scheduleStyleRecalc(); | 2020 scheduleRenderTreeUpdate(); |
2025 } | 2021 } |
2026 | 2022 |
2027 void Document::unscheduleUseShadowTreeUpdate(SVGUseElement& element) | 2023 void Document::unscheduleUseShadowTreeUpdate(SVGUseElement& element) |
2028 { | 2024 { |
2029 m_useElementsNeedingUpdate.remove(&element); | 2025 m_useElementsNeedingUpdate.remove(&element); |
2030 } | 2026 } |
2031 | 2027 |
2032 void Document::updateUseShadowTreesIfNeeded() | 2028 void Document::updateUseShadowTreesIfNeeded() |
2033 { | 2029 { |
2034 if (m_useElementsNeedingUpdate.isEmpty()) | 2030 if (m_useElementsNeedingUpdate.isEmpty()) |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2600 } | 2596 } |
2601 | 2597 |
2602 void Document::setParsing(bool b) | 2598 void Document::setParsing(bool b) |
2603 { | 2599 { |
2604 m_isParsing = b; | 2600 m_isParsing = b; |
2605 | 2601 |
2606 if (m_isParsing && !m_elementDataCache) | 2602 if (m_isParsing && !m_elementDataCache) |
2607 m_elementDataCache = ElementDataCache::create(); | 2603 m_elementDataCache = ElementDataCache::create(); |
2608 } | 2604 } |
2609 | 2605 |
2610 bool Document::shouldScheduleLayout() | 2606 bool Document::shouldScheduleLayout() const |
2611 { | 2607 { |
2612 // This function will only be called when FrameView thinks a layout is neede
d. | 2608 // This function will only be called when FrameView thinks a layout is neede
d. |
2613 // This enforces a couple extra rules. | 2609 // This enforces a couple extra rules. |
2614 // | 2610 // |
2615 // (a) Only schedule a layout once the stylesheets are loaded. | 2611 // (a) Only schedule a layout once the stylesheets are loaded. |
2616 // (b) Only schedule layout once we have a body element. | 2612 // (b) Only schedule layout once we have a body element. |
2617 | 2613 |
2618 return (haveStylesheetsAndImportsLoaded() && body()) | 2614 return (haveStylesheetsAndImportsLoaded() && body()) |
2619 || (documentElement() && !isHTMLHtmlElement(*documentElement())); | 2615 || (documentElement() && !isHTMLHtmlElement(*documentElement())); |
2620 } | 2616 } |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3281 { | 3277 { |
3282 return m_styleEngine->selectedStylesheetSetName(); | 3278 return m_styleEngine->selectedStylesheetSetName(); |
3283 } | 3279 } |
3284 | 3280 |
3285 void Document::setSelectedStylesheetSet(const String& aString) | 3281 void Document::setSelectedStylesheetSet(const String& aString) |
3286 { | 3282 { |
3287 m_styleEngine->setSelectedStylesheetSetName(aString); | 3283 m_styleEngine->setSelectedStylesheetSetName(aString); |
3288 styleResolverChanged(RecalcStyleDeferred); | 3284 styleResolverChanged(RecalcStyleDeferred); |
3289 } | 3285 } |
3290 | 3286 |
| 3287 void Document::evaluateMediaQueryListIfNeeded() |
| 3288 { |
| 3289 if (!m_evaluateMediaQueriesOnStyleRecalc) |
| 3290 return; |
| 3291 evaluateMediaQueryList(); |
| 3292 m_evaluateMediaQueriesOnStyleRecalc = false; |
| 3293 } |
| 3294 |
3291 void Document::evaluateMediaQueryList() | 3295 void Document::evaluateMediaQueryList() |
3292 { | 3296 { |
3293 if (m_mediaQueryMatcher) | 3297 if (m_mediaQueryMatcher) |
3294 m_mediaQueryMatcher->styleResolverChanged(); | 3298 m_mediaQueryMatcher->styleResolverChanged(); |
3295 } | 3299 } |
3296 | 3300 |
3297 void Document::notifyResizeForViewportUnits() | 3301 void Document::notifyResizeForViewportUnits() |
3298 { | 3302 { |
3299 if (!hasViewportUnits()) | 3303 if (!hasViewportUnits()) |
3300 return; | 3304 return; |
(...skipping 2193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5494 } | 5498 } |
5495 | 5499 |
5496 void Document::invalidateNodeListCaches(const QualifiedName* attrName) | 5500 void Document::invalidateNodeListCaches(const QualifiedName* attrName) |
5497 { | 5501 { |
5498 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end(
); | 5502 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end(
); |
5499 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument.
begin(); it != end; ++it) | 5503 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument.
begin(); it != end; ++it) |
5500 (*it)->invalidateCache(attrName); | 5504 (*it)->invalidateCache(attrName); |
5501 } | 5505 } |
5502 | 5506 |
5503 } // namespace WebCore | 5507 } // namespace WebCore |
OLD | NEW |