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

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

Issue 18601002: Add infrastructure for partial layouts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Work in progress v2 Created 7 years, 4 months 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 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 oe->document()->updateLayout(); 1737 oe->document()->updateLayout();
1738 1738
1739 updateStyleIfNeeded(); 1739 updateStyleIfNeeded();
1740 1740
1741 StackStats::LayoutCheckPoint layoutCheckPoint; 1741 StackStats::LayoutCheckPoint layoutCheckPoint;
1742 1742
1743 // Only do a layout if changes have occurred that make it necessary. 1743 // Only do a layout if changes have occurred that make it necessary.
1744 if (frameView && renderer() && (frameView->layoutPending() || renderer()->ne edsLayout())) 1744 if (frameView && renderer() && (frameView->layoutPending() || renderer()->ne edsLayout()))
1745 frameView->layout(); 1745 frameView->layout();
1746 1746
1747 if (frameView)
1748 frameView->resetPartialLayoutState();
1749
1747 setNeedsFocusedElementCheck(); 1750 setNeedsFocusedElementCheck();
1748 } 1751 }
1749 1752
1750 void Document::setNeedsFocusedElementCheck() 1753 void Document::setNeedsFocusedElementCheck()
1751 { 1754 {
1752 // FIXME: Using a Task doesn't look a good idea. 1755 // FIXME: Using a Task doesn't look a good idea.
1753 if (!m_focusedElement || m_didPostCheckFocusedElementTask) 1756 if (!m_focusedElement || m_didPostCheckFocusedElementTask)
1754 return; 1757 return;
1755 postTask(CheckFocusedElementTask::create()); 1758 postTask(CheckFocusedElementTask::create());
1756 m_didPostCheckFocusedElementTask = true; 1759 m_didPostCheckFocusedElementTask = true;
(...skipping 26 matching lines...) Expand all
1783 // may not have had their real style calculated yet. Normally this g ets cleaned when style sheets arrive 1786 // may not have had their real style calculated yet. Normally this g ets cleaned when style sheets arrive
1784 // but here we need up-to-date style immediately. 1787 // but here we need up-to-date style immediately.
1785 recalcStyle(Force); 1788 recalcStyle(Force);
1786 } 1789 }
1787 1790
1788 updateLayout(); 1791 updateLayout();
1789 1792
1790 m_ignorePendingStylesheets = oldIgnore; 1793 m_ignorePendingStylesheets = oldIgnore;
1791 } 1794 }
1792 1795
1796 void Document::tryPartialUpdateLayoutIgnorePendingStylesheets(RenderObject* stop LayoutAtRenderer)
1797 {
1798 if (stopLayoutAtRenderer) {
1799 // Look for parents that are css regions, flexbox, grid, or flow and pre vent partial layout.
1800 // FIXME: should this be a whitelist?
1801 bool canDoPartialLayout = true;
1802 RenderObject* renderer = stopLayoutAtRenderer;
1803 do {
1804 if (renderer->isFlexibleBoxIncludingDeprecated() || renderer->isRend erGrid() || renderer->isRenderRegion() || renderer->isRenderNamedFlowThread() || renderer->isRenderFlowThread()) {
1805 canDoPartialLayout = false;
1806 break;
1807 }
1808 } while ((renderer = renderer->parent()));
1809 if (canDoPartialLayout)
1810 view()->setStopLayoutAtRenderer(stopLayoutAtRenderer);
1811 }
1812
1813 updateLayoutIgnorePendingStylesheets();
1814 }
1815
1793 PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Elem ent* element) 1816 PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Elem ent* element)
1794 { 1817 {
1795 ASSERT_ARG(element, element->document() == this); 1818 ASSERT_ARG(element, element->document() == this);
1796 TemporaryChange<bool> ignoreStyleSheets(m_ignorePendingStylesheets, true); 1819 TemporaryChange<bool> ignoreStyleSheets(m_ignorePendingStylesheets, true);
1797 return styleResolver()->styleForElement(element, element->parentNode() ? ele ment->parentNode()->computedStyle() : 0); 1820 return styleResolver()->styleForElement(element, element->parentNode() ? ele ment->parentNode()->computedStyle() : 0);
1798 } 1821 }
1799 1822
1800 PassRefPtr<RenderStyle> Document::styleForPage(int pageIndex) 1823 PassRefPtr<RenderStyle> Document::styleForPage(int pageIndex)
1801 { 1824 {
1802 return styleResolver()->styleForPage(pageIndex); 1825 return styleResolver()->styleForPage(pageIndex);
(...skipping 3326 matching lines...) Expand 10 before | Expand all | Expand 10 after
5129 { 5152 {
5130 return DocumentLifecycleNotifier::create(this); 5153 return DocumentLifecycleNotifier::create(this);
5131 } 5154 }
5132 5155
5133 DocumentLifecycleNotifier* Document::lifecycleNotifier() 5156 DocumentLifecycleNotifier* Document::lifecycleNotifier()
5134 { 5157 {
5135 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); 5158 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier());
5136 } 5159 }
5137 5160
5138 } // namespace WebCore 5161 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698