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

Side by Side Diff: Source/WebCore/rendering/RenderView.cpp

Issue 13913013: Only update composited scrolling state when necessary (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: . Created 7 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 , m_frameView(document->view()) 56 , m_frameView(document->view())
57 , m_selectionStart(0) 57 , m_selectionStart(0)
58 , m_selectionEnd(0) 58 , m_selectionEnd(0)
59 , m_selectionStartPos(-1) 59 , m_selectionStartPos(-1)
60 , m_selectionEndPos(-1) 60 , m_selectionEndPos(-1)
61 , m_maximalOutlineSize(0) 61 , m_maximalOutlineSize(0)
62 , m_pageLogicalHeight(0) 62 , m_pageLogicalHeight(0)
63 , m_pageLogicalHeightChanged(false) 63 , m_pageLogicalHeightChanged(false)
64 , m_layoutState(0) 64 , m_layoutState(0)
65 , m_layoutStateDisableCount(0) 65 , m_layoutStateDisableCount(0)
66 , m_scopedCompositedScrollingUpdatersCount(0)
66 , m_renderQuoteHead(0) 67 , m_renderQuoteHead(0)
67 , m_renderCounterCount(0) 68 , m_renderCounterCount(0)
68 { 69 {
69 // init RenderObject attributes 70 // init RenderObject attributes
70 setInline(false); 71 setInline(false);
71 72
72 m_minPreferredLogicalWidth = 0; 73 m_minPreferredLogicalWidth = 0;
73 m_maxPreferredLogicalWidth = 0; 74 m_maxPreferredLogicalWidth = 0;
74 75
75 setPreferredLogicalWidthsDirty(true, MarkOnlyThis); 76 setPreferredLogicalWidthsDirty(true, MarkOnlyThis);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 static RenderBox* enclosingSeamlessRenderer(Document* doc) 141 static RenderBox* enclosingSeamlessRenderer(Document* doc)
141 { 142 {
142 if (!doc) 143 if (!doc)
143 return 0; 144 return 0;
144 Element* ownerElement = doc->seamlessParentIFrame(); 145 Element* ownerElement = doc->seamlessParentIFrame();
145 if (!ownerElement) 146 if (!ownerElement)
146 return 0; 147 return 0;
147 return ownerElement->renderBox(); 148 return ownerElement->renderBox();
148 } 149 }
149 150
151 void RenderView::cancelScheduledCompositedScrollingUpdatesForLayer(RenderLayer* layer)
152 {
153 m_pendingContiguityUpdates.remove(layer);
154 m_pendingCompositedScrollingUpdates.remove(layer);
155 }
156
150 void RenderView::addChild(RenderObject* newChild, RenderObject* beforeChild) 157 void RenderView::addChild(RenderObject* newChild, RenderObject* beforeChild)
151 { 158 {
152 // Seamless iframes are considered part of an enclosing render flow thread f rom the parent document. This is necessary for them to look 159 // Seamless iframes are considered part of an enclosing render flow thread f rom the parent document. This is necessary for them to look
153 // up regions in the parent document during layout. 160 // up regions in the parent document during layout.
154 if (newChild && !newChild->isRenderFlowThread()) { 161 if (newChild && !newChild->isRenderFlowThread()) {
155 RenderBox* seamlessBox = enclosingSeamlessRenderer(document()); 162 RenderBox* seamlessBox = enclosingSeamlessRenderer(document());
156 if (seamlessBox && seamlessBox->flowThreadContainingBlock()) 163 if (seamlessBox && seamlessBox->flowThreadContainingBlock())
157 newChild->setFlowThreadState(seamlessBox->flowThreadState()); 164 newChild->setFlowThreadState(seamlessBox->flowThreadState());
158 } 165 }
159 RenderBlock::addChild(newChild, beforeChild); 166 RenderBlock::addChild(newChild, beforeChild);
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 ASSERT(m_layoutState == layoutState); 1172 ASSERT(m_layoutState == layoutState);
1166 #endif 1173 #endif
1167 1174
1168 if (layoutState) 1175 if (layoutState)
1169 layoutState->m_isPaginated = m_fragmenting; 1176 layoutState->m_isPaginated = m_fragmenting;
1170 1177
1171 if (m_flowThreadState != RenderObject::NotInsideFlowThread) 1178 if (m_flowThreadState != RenderObject::NotInsideFlowThread)
1172 m_root->setFlowThreadStateIncludingDescendants(m_flowThreadState); 1179 m_root->setFlowThreadStateIncludingDescendants(m_flowThreadState);
1173 } 1180 }
1174 1181
1182 ScopedCompositedScrollingUpdater::ScopedCompositedScrollingUpdater(RenderView* r enderView)
1183 : m_renderView(renderView)
1184 {
1185 if (m_renderView)
Julien - ping for review 2013/04/09 21:06:43 Cannot be NULL per your explanation.
1186 m_renderView->m_scopedCompositedScrollingUpdatersCount++;
1187 }
1188
1189 ScopedCompositedScrollingUpdater::ScopedCompositedScrollingUpdater(RenderLayer* layer, CompositedScrollingUpdateMode mode)
1190 : m_renderView(0)
1191 {
1192 if (!layer || !layer->acceleratedCompositingForOverflowScrollEnabled())
1193 return;
1194
1195 m_renderView = layer->renderer()->view();
1196 m_renderView->m_scopedCompositedScrollingUpdatersCount++;
1197
1198 if (mode == UpdateNeedsCompositedScrolling)
1199 m_renderView->m_pendingCompositedScrollingUpdates.add(layer);
1200 else if (mode == UpdateDescendantsAreContiguousInStackingOrder)
1201 m_renderView->m_pendingContiguityUpdates.add(layer);
1202 }
1203
1204 ScopedCompositedScrollingUpdater::~ScopedCompositedScrollingUpdater()
1205 {
1206 if (!m_renderView)
Julien - ping for review 2013/04/09 21:06:43 Cannot be NULL per your explanation.
1207 return;
1208
1209 m_renderView->m_scopedCompositedScrollingUpdatersCount--;
1210 ASSERT(m_renderView->m_scopedCompositedScrollingUpdatersCount >= 0);
1211 if (!m_renderView->m_scopedCompositedScrollingUpdatersCount) {
Julien - ping for review 2013/04/09 21:06:43 Early return.
1212 HashSet<RenderLayer*> pendingCompositedScrollingUpdates = m_renderView-> m_pendingCompositedScrollingUpdates;
1213 m_renderView->m_pendingCompositedScrollingUpdates.clear();
1214
1215 HashSet<RenderLayer*> pendingContiguityUpdates = m_renderView->m_pending ContiguityUpdates;
1216 m_renderView->m_pendingContiguityUpdates.clear();
1217
1218 if (!pendingContiguityUpdates.isEmpty()) {
Julien - ping for review 2013/04/09 21:06:43 I don't think we need an isEmpty check as the iter
1219 HashSet<RenderLayer*> stackingContexts;
1220 for (HashSet<RenderLayer*>::iterator iter = pendingContiguityUpdates .begin(); iter != pendingContiguityUpdates.end(); ++iter) {
1221 if (RenderLayer* stackingContext = (*iter)->enclosingStackingCon text())
1222 stackingContexts.add(stackingContext);
1223 }
1224 for (HashSet<RenderLayer*>::iterator iter = stackingContexts.begin() ; iter != stackingContexts.end(); ++iter) {
1225 (*iter)->updateLayerListsIfNeeded();
1226 (*iter)->updateDescendantsAreContiguousInStackingOrder();
1227 }
1228 }
1229
1230 if (!pendingCompositedScrollingUpdates.isEmpty()) {
Julien - ping for review 2013/04/09 21:06:43 Same comment.
1231 for (HashSet<RenderLayer*>::iterator iter = pendingCompositedScrolli ngUpdates.begin(); iter != pendingCompositedScrollingUpdates.end(); ++iter)
1232 (*iter)->updateNeedsCompositedScrolling();
1233 }
1234 }
Julien - ping for review 2013/04/09 21:06:43 You do store the HashSet into local variables and
1235 }
1236
1175 } // namespace WebCore 1237 } // namespace WebCore
OLDNEW
« Source/WebCore/rendering/RenderView.h ('K') | « Source/WebCore/rendering/RenderView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698