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 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1524 return false; | 1524 return false; |
1525 return true; | 1525 return true; |
1526 } | 1526 } |
1527 | 1527 |
1528 void Document::scheduleLayoutTreeUpdate() | 1528 void Document::scheduleLayoutTreeUpdate() |
1529 { | 1529 { |
1530 ASSERT(!hasPendingStyleRecalc()); | 1530 ASSERT(!hasPendingStyleRecalc()); |
1531 ASSERT(shouldScheduleLayoutTreeUpdate()); | 1531 ASSERT(shouldScheduleLayoutTreeUpdate()); |
1532 ASSERT(needsLayoutTreeUpdate()); | 1532 ASSERT(needsLayoutTreeUpdate()); |
1533 | 1533 |
1534 page()->animator().scheduleVisualUpdate(); | 1534 if (!view()->shouldThrottleRendering()) |
| 1535 page()->animator().scheduleVisualUpdate(); |
1535 m_lifecycle.ensureStateAtMost(DocumentLifecycle::VisualUpdatePending); | 1536 m_lifecycle.ensureStateAtMost(DocumentLifecycle::VisualUpdatePending); |
1536 | 1537 |
1537 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Schedu
leStyleRecalculation", TRACE_EVENT_SCOPE_THREAD, "data", InspectorRecalculateSty
lesEvent::data(frame())); | 1538 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Schedu
leStyleRecalculation", TRACE_EVENT_SCOPE_THREAD, "data", InspectorRecalculateSty
lesEvent::data(frame())); |
1538 InspectorInstrumentation::didScheduleStyleRecalculation(this); | 1539 InspectorInstrumentation::didScheduleStyleRecalculation(this); |
1539 | 1540 |
1540 ++m_styleVersion; | 1541 ++m_styleVersion; |
1541 } | 1542 } |
1542 | 1543 |
1543 bool Document::hasPendingForcedStyleRecalc() const | 1544 bool Document::hasPendingForcedStyleRecalc() const |
1544 { | 1545 { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 | 1715 |
1715 void Document::updateLayoutTree(StyleRecalcChange change) | 1716 void Document::updateLayoutTree(StyleRecalcChange change) |
1716 { | 1717 { |
1717 ASSERT(isMainThread()); | 1718 ASSERT(isMainThread()); |
1718 | 1719 |
1719 ScriptForbiddenScope forbidScript; | 1720 ScriptForbiddenScope forbidScript; |
1720 | 1721 |
1721 if (!view() || !isActive()) | 1722 if (!view() || !isActive()) |
1722 return; | 1723 return; |
1723 | 1724 |
| 1725 if (view()->shouldThrottleRendering()) |
| 1726 return; |
| 1727 |
1724 if (change != Force && !needsLayoutTreeUpdate()) { | 1728 if (change != Force && !needsLayoutTreeUpdate()) { |
1725 ASSERT(lifecycle().state() != DocumentLifecycle::VisualUpdatePending); | 1729 ASSERT(lifecycle().state() != DocumentLifecycle::VisualUpdatePending); |
1726 return; | 1730 return; |
1727 } | 1731 } |
1728 | 1732 |
1729 if (inStyleRecalc()) | 1733 if (inStyleRecalc()) |
1730 return; | 1734 return; |
1731 | 1735 |
1732 // Entering here from inside layout or paint would be catastrophic since rec
alcStyle can | 1736 // Entering here from inside layout or paint would be catastrophic since rec
alcStyle can |
1733 // tear down the layout tree or (unfortunately) run script. Kill the whole l
ayoutObject if | 1737 // tear down the layout tree or (unfortunately) run script. Kill the whole l
ayoutObject if |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1781 TRACE_EVENT_END1("blink,devtools.timeline", "UpdateLayoutTree", "elementCoun
t", m_styleRecalcElementCounter); | 1785 TRACE_EVENT_END1("blink,devtools.timeline", "UpdateLayoutTree", "elementCoun
t", m_styleRecalcElementCounter); |
1782 InspectorInstrumentation::didRecalculateStyle(cookie, m_styleRecalcElementCo
unter); | 1786 InspectorInstrumentation::didRecalculateStyle(cookie, m_styleRecalcElementCo
unter); |
1783 | 1787 |
1784 #if ENABLE(ASSERT) | 1788 #if ENABLE(ASSERT) |
1785 assertLayoutTreeUpdated(*this); | 1789 assertLayoutTreeUpdated(*this); |
1786 #endif | 1790 #endif |
1787 } | 1791 } |
1788 | 1792 |
1789 void Document::updateStyle(StyleRecalcChange change) | 1793 void Document::updateStyle(StyleRecalcChange change) |
1790 { | 1794 { |
| 1795 if (view()->shouldThrottleRendering()) |
| 1796 return; |
| 1797 |
1791 TRACE_EVENT_BEGIN0("blink,blink_style", "Document::updateStyle"); | 1798 TRACE_EVENT_BEGIN0("blink,blink_style", "Document::updateStyle"); |
1792 unsigned initialResolverAccessCount = styleEngine().resolverAccessCount(); | 1799 unsigned initialResolverAccessCount = styleEngine().resolverAccessCount(); |
1793 | 1800 |
1794 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; | 1801 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; |
1795 m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc); | 1802 m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc); |
1796 | 1803 |
1797 NthIndexCache nthIndexCache(*this); | 1804 NthIndexCache nthIndexCache(*this); |
1798 | 1805 |
1799 if (styleChangeType() >= SubtreeStyleChange) | 1806 if (styleChangeType() >= SubtreeStyleChange) |
1800 change = Force; | 1807 change = Force; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1958 } | 1965 } |
1959 | 1966 |
1960 // FIXME: This is a bad idea and needs to be removed eventually. | 1967 // FIXME: This is a bad idea and needs to be removed eventually. |
1961 // Other browsers load stylesheets before they continue parsing the web page. | 1968 // Other browsers load stylesheets before they continue parsing the web page. |
1962 // Since we don't, we can run JavaScript code that needs answers before the | 1969 // Since we don't, we can run JavaScript code that needs answers before the |
1963 // stylesheets are loaded. Doing a layout ignoring the pending stylesheets | 1970 // stylesheets are loaded. Doing a layout ignoring the pending stylesheets |
1964 // lets us get reasonable answers. The long term solution to this problem is | 1971 // lets us get reasonable answers. The long term solution to this problem is |
1965 // to instead suspend JavaScript execution. | 1972 // to instead suspend JavaScript execution. |
1966 void Document::updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks
runPostLayoutTasks) | 1973 void Document::updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks
runPostLayoutTasks) |
1967 { | 1974 { |
| 1975 DocumentLifecycle::PreventThrottlingScope preventThrottling(lifecycle()); |
1968 StyleEngine::IgnoringPendingStylesheet ignoring(styleEngine()); | 1976 StyleEngine::IgnoringPendingStylesheet ignoring(styleEngine()); |
1969 | 1977 |
1970 if (styleEngine().hasPendingSheets()) { | 1978 if (styleEngine().hasPendingSheets()) { |
1971 // FIXME: We are willing to attempt to suppress painting with outdated s
tyle info only once. | 1979 // FIXME: We are willing to attempt to suppress painting with outdated s
tyle info only once. |
1972 // Our assumption is that it would be dangerous to try to stop it a seco
nd time, after page | 1980 // Our assumption is that it would be dangerous to try to stop it a seco
nd time, after page |
1973 // content has already been loaded and displayed with accurate style inf
ormation. (Our | 1981 // content has already been loaded and displayed with accurate style inf
ormation. (Our |
1974 // suppression involves blanking the whole page at the moment. If it wer
e more refined, we | 1982 // suppression involves blanking the whole page at the moment. If it wer
e more refined, we |
1975 // might be able to do something better.) It's worth noting though that
this entire method | 1983 // might be able to do something better.) It's worth noting though that
this entire method |
1976 // is a hack, since what we really want to do is suspend JS instead of d
oing a layout with | 1984 // is a hack, since what we really want to do is suspend JS instead of d
oing a layout with |
1977 // inaccurate information. | 1985 // inaccurate information. |
(...skipping 3833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5811 #ifndef NDEBUG | 5819 #ifndef NDEBUG |
5812 using namespace blink; | 5820 using namespace blink; |
5813 void showLiveDocumentInstances() | 5821 void showLiveDocumentInstances() |
5814 { | 5822 { |
5815 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 5823 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
5816 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5824 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5817 for (Document* document : set) | 5825 for (Document* document : set) |
5818 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5826 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
5819 } | 5827 } |
5820 #endif | 5828 #endif |
OLD | NEW |