Chromium Code Reviews

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: If text autosizing is enabled, only partial layout for the second of two layouts Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | 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 133 matching lines...)
144 #include "core/page/MouseEventWithHitTestResults.h" 144 #include "core/page/MouseEventWithHitTestResults.h"
145 #include "core/page/Page.h" 145 #include "core/page/Page.h"
146 #include "core/page/PageConsole.h" 146 #include "core/page/PageConsole.h"
147 #include "core/page/PointerLockController.h" 147 #include "core/page/PointerLockController.h"
148 #include "core/page/Settings.h" 148 #include "core/page/Settings.h"
149 #include "core/page/animation/AnimationController.h" 149 #include "core/page/animation/AnimationController.h"
150 #include "core/page/scrolling/ScrollingCoordinator.h" 150 #include "core/page/scrolling/ScrollingCoordinator.h"
151 #include "core/platform/DateComponents.h" 151 #include "core/platform/DateComponents.h"
152 #include "core/platform/HistogramSupport.h" 152 #include "core/platform/HistogramSupport.h"
153 #include "core/platform/Language.h" 153 #include "core/platform/Language.h"
154 #include "core/platform/ScrollbarTheme.h"
154 #include "core/platform/Timer.h" 155 #include "core/platform/Timer.h"
155 #include "core/platform/chromium/TraceEvent.h" 156 #include "core/platform/chromium/TraceEvent.h"
156 #include "core/platform/network/HTTPParsers.h" 157 #include "core/platform/network/HTTPParsers.h"
157 #include "core/platform/text/PlatformLocale.h" 158 #include "core/platform/text/PlatformLocale.h"
158 #include "core/platform/text/SegmentedString.h" 159 #include "core/platform/text/SegmentedString.h"
159 #include "core/rendering/HitTestRequest.h" 160 #include "core/rendering/HitTestRequest.h"
160 #include "core/rendering/HitTestResult.h" 161 #include "core/rendering/HitTestResult.h"
161 #include "core/rendering/RenderView.h" 162 #include "core/rendering/RenderView.h"
162 #include "core/rendering/RenderWidget.h" 163 #include "core/rendering/RenderWidget.h"
163 #include "core/rendering/TextAutosizer.h" 164 #include "core/rendering/TextAutosizer.h"
(...skipping 1577 matching lines...)
1741 oe->document()->updateLayout(); 1742 oe->document()->updateLayout();
1742 1743
1743 updateStyleIfNeeded(); 1744 updateStyleIfNeeded();
1744 1745
1745 StackStats::LayoutCheckPoint layoutCheckPoint; 1746 StackStats::LayoutCheckPoint layoutCheckPoint;
1746 1747
1747 // Only do a layout if changes have occurred that make it necessary. 1748 // Only do a layout if changes have occurred that make it necessary.
1748 if (frameView && renderer() && (frameView->layoutPending() || renderer()->ne edsLayout())) 1749 if (frameView && renderer() && (frameView->layoutPending() || renderer()->ne edsLayout()))
1749 frameView->layout(); 1750 frameView->layout();
1750 1751
1752 if (frameView)
1753 frameView->resetPartialLayoutState();
1754
1751 setNeedsFocusedElementCheck(); 1755 setNeedsFocusedElementCheck();
1752 } 1756 }
1753 1757
1754 void Document::setNeedsFocusedElementCheck() 1758 void Document::setNeedsFocusedElementCheck()
1755 { 1759 {
1756 // FIXME: Using a Task doesn't look a good idea. 1760 // FIXME: Using a Task doesn't look a good idea.
1757 if (!m_focusedElement || m_didPostCheckFocusedElementTask) 1761 if (!m_focusedElement || m_didPostCheckFocusedElementTask)
1758 return; 1762 return;
1759 postTask(CheckFocusedElementTask::create()); 1763 postTask(CheckFocusedElementTask::create());
1760 m_didPostCheckFocusedElementTask = true; 1764 m_didPostCheckFocusedElementTask = true;
(...skipping 26 matching lines...)
1787 // may not have had their real style calculated yet. Normally this g ets cleaned when style sheets arrive 1791 // may not have had their real style calculated yet. Normally this g ets cleaned when style sheets arrive
1788 // but here we need up-to-date style immediately. 1792 // but here we need up-to-date style immediately.
1789 recalcStyle(Force); 1793 recalcStyle(Force);
1790 } 1794 }
1791 1795
1792 updateLayout(); 1796 updateLayout();
1793 1797
1794 m_ignorePendingStylesheets = oldIgnore; 1798 m_ignorePendingStylesheets = oldIgnore;
1795 } 1799 }
1796 1800
1801 void Document::tryPartialUpdateLayoutIgnorePendingStylesheets(RenderObject* stop LayoutAtRenderer)
esprehn 2013/08/18 03:43:15 This should take a Node, not a renderer. You need
pdr. 2013/08/20 06:19:10 Great catch! I refactored the common style recalc
1802 {
1803 if (stopLayoutAtRenderer) {
1804 // Non-overlay scrollbars can cause layout during layout.
1805 // FIXME: Temporarily ignore non-overlay scrollbars for test coverage.
1806 if (true || ScrollbarTheme::theme()->usesOverlayScrollbars()) {
esprehn 2013/08/18 03:43:15 true? You should probably delete this.
pdr. 2013/08/20 06:19:10 I'd like to leave this in for a bit longer since i
1807 // FIXME: Text autosizing will not work with partial layout.
1808 bool canPartialLayout = true;
1809 RenderObject* renderer = stopLayoutAtRenderer;
1810 do {
1811 if (!renderer->supportsPartialLayout()) {
1812 canPartialLayout = false;
1813 break;
1814 }
1815 } while ((renderer = renderer->parent()));
esprehn 2013/08/18 03:43:15 This is wrong, the style recalc inside updateLayou
pdr. 2013/08/20 06:19:10 Done.
1816 if (canPartialLayout)
1817 view()->setStopLayoutAtRenderer(stopLayoutAtRenderer);
esprehn 2013/08/18 03:43:15 You don't call any methods on it, but storing a re
pdr. 2013/08/20 06:19:10 No use so... just "after free"? :) Fixed.
1818 }
1819 }
1820
1821 updateLayoutIgnorePendingStylesheets();
1822 }
1823
1797 PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Elem ent* element) 1824 PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Elem ent* element)
1798 { 1825 {
1799 ASSERT_ARG(element, element->document() == this); 1826 ASSERT_ARG(element, element->document() == this);
1800 TemporaryChange<bool> ignoreStyleSheets(m_ignorePendingStylesheets, true); 1827 TemporaryChange<bool> ignoreStyleSheets(m_ignorePendingStylesheets, true);
1801 return styleResolver()->styleForElement(element, element->parentNode() ? ele ment->parentNode()->computedStyle() : 0); 1828 return styleResolver()->styleForElement(element, element->parentNode() ? ele ment->parentNode()->computedStyle() : 0);
1802 } 1829 }
1803 1830
1804 PassRefPtr<RenderStyle> Document::styleForPage(int pageIndex) 1831 PassRefPtr<RenderStyle> Document::styleForPage(int pageIndex)
1805 { 1832 {
1806 return styleResolver()->styleForPage(pageIndex); 1833 return styleResolver()->styleForPage(pageIndex);
(...skipping 3386 matching lines...)
5193 { 5220 {
5194 return DocumentLifecycleNotifier::create(this); 5221 return DocumentLifecycleNotifier::create(this);
5195 } 5222 }
5196 5223
5197 DocumentLifecycleNotifier* Document::lifecycleNotifier() 5224 DocumentLifecycleNotifier* Document::lifecycleNotifier()
5198 { 5225 {
5199 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); 5226 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier());
5200 } 5227 }
5201 5228
5202 } // namespace WebCore 5229 } // namespace WebCore
OLDNEW

Powered by Google App Engine