Changeset 155424 in webkit
- Timestamp:
- Sep 10, 2013, 12:00:56 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
page/FrameView.cpp (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r155422 r155424 1 2013-09-09 Darin Adler <darin@apple.com> 2 3 Some refinements in FrameView::layout 4 https://bugs.webkit.org/show_bug.cgi?id=121076 5 6 Reviewed by Andreas Kling. 7 8 * page/FrameView.cpp: 9 (WebCore::FrameView::layout): Use a reference for the document in 10 this function since code assumes it's non-null anyway. Change code to 11 only call styleResolverIfExists once. Rewrite comments about blocks 12 and the scopes they create for better clarity. Make m_nestedLayoutCount 13 easier to read. Use HTMLElement* for the pointer to the body element. 14 Moved the call to calculateScrollbarModesForLayout in so we don't 15 waste time doing it for subtree layouts. Get rid of the unhelpful 16 currentHMode and currentVMode local variables. Get rid of an extra 17 block scope we did not need. 18 1 19 2013-09-09 Santosh Mahto <santosh.ma@samsung.com> 2 20 -
trunk/Source/WebCore/page/FrameView.cpp
r155344 r155424 1130 1130 1131 1131 ASSERT(frame().view() == this); 1132 1133 Document* document = frame().document(); 1134 ASSERT(!document->inPageCache()); 1132 ASSERT(frame().document()); 1133 1134 Document& document = *frame().document(); 1135 ASSERT(!document.inPageCache()); 1136 1135 1137 bool subtree; 1136 1138 RenderObject* root; … … 1148 1150 1149 1151 // Viewport-dependent media queries may cause us to need completely different style information. 1150 if (!document->styleResolverIfExists() || document->styleResolverIfExists()->affectedByViewportChange()) {1151 document->styleResolverChanged(DeferRecalcStyle);1152 // FIXME: This instrumentation event is not strictly accurate since cached media query results1153 // do not persist across StyleResolver rebuilds.1154 InspectorInstrumentation::mediaQueryResultChanged( document);1152 StyleResolver* styleResolver = document.styleResolverIfExists(); 1153 if (!styleResolver || styleResolver->affectedByViewportChange()) { 1154 document.styleResolverChanged(DeferRecalcStyle); 1155 // FIXME: This instrumentation event is not strictly accurate since cached media query results do not persist across StyleResolver rebuilds. 1156 InspectorInstrumentation::mediaQueryResultChanged(&document); 1155 1157 } else 1156 document ->evaluateMediaQueryList();1158 document.evaluateMediaQueryList(); 1157 1159 1158 1160 // If there is any pagination to apply, it will affect the RenderView's style, so we should … … 1163 1165 // the layout beats any sort of style recalc update that needs to occur. 1164 1166 TemporaryChange<bool> changeDoingPreLayoutStyleUpdate(m_doingPreLayoutStyleUpdate, true); 1165 document ->updateStyleIfNeeded();1167 document.updateStyleIfNeeded(); 1166 1168 1167 1169 subtree = m_layoutRoot; … … 1172 1174 return; 1173 1175 1174 root = subtree ? m_layoutRoot : document ->renderView();1176 root = subtree ? m_layoutRoot : document.renderView(); 1175 1177 if (!root) { 1176 1178 // FIXME: Do we need to set m_size here? 1177 1179 return; 1178 1180 } 1179 } // Reset m_layoutSchedulingEnabled to its previous value. 1180 // The only reason the scoping was closed here is allow fontCachePurgePreventer 1181 // to outlive the change and reset of m_layoutSchedulingEnabled. 1181 1182 // Close block here so we can set up the font cache purge preventer, which we will still 1183 // want in scope even after we want m_layoutSchedulingEnabled to be restored again. 1184 // The next block sets m_layoutSchedulingEnabled back to false once again. 1185 } 1182 1186 1183 1187 FontCachePurgePreventer fontCachePurgePreventer; 1184 1188 RenderLayer* layer; 1189 1190 ++m_nestedLayoutCount; 1191 1185 1192 { 1186 1193 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false); 1187 1194 1188 m_nestedLayoutCount++;1189 1190 1195 if (!m_layoutRoot) { 1191 Document* document = frame().document(); 1192 Node* body = document->body(); 1196 HTMLElement* body = document.body(); 1193 1197 if (body && body->renderer()) { 1194 1198 if (body->hasTagName(framesetTag) && !frameFlatteningEnabled()) { … … 1202 1206 #ifdef INSTRUMENT_LAYOUT_SCHEDULING 1203 1207 if (m_firstLayout && !frame().ownerElement()) 1204 printf("Elapsed time before first layout: %d\n", document ->elapsedTime());1208 printf("Elapsed time before first layout: %d\n", document.elapsedTime()); 1205 1209 #endif 1206 1210 } … … 1208 1212 autoSizeIfEnabled(); 1209 1213 1210 ScrollbarMode hMode;1211 ScrollbarMode vMode;1212 calculateScrollbarModesForLayout(hMode, vMode);1213 1214 1214 m_needsFullRepaint = !subtree && (m_firstLayout || toRenderView(*root).printing()); 1215 1215 1216 1216 if (!subtree) { 1217 // Now set our scrollbar state for the layout.1218 ScrollbarMode currentHMode = horizontalScrollbarMode();1219 ScrollbarMode currentVMode = verticalScrollbarMode();1220 1221 if (m_firstLayout || (hMode != currentHMode || vMode != currentVMode)) {1217 ScrollbarMode hMode; 1218 ScrollbarMode vMode; 1219 calculateScrollbarModesForLayout(hMode, vMode); 1220 1221 if (m_firstLayout || (hMode != horizontalScrollbarMode() || vMode != verticalScrollbarMode())) { 1222 1222 if (m_firstLayout) { 1223 1223 setScrollbarsSuppressed(true); … … 1251 1251 m_needsFullRepaint = true; 1252 1252 if (!m_firstLayout) { 1253 RenderBox* rootRenderer = document ->documentElement() ? document->documentElement()->renderBox() : 0;1254 RenderBox* bodyRenderer = rootRenderer && document ->body() ? document->body()->renderBox() : 0;1253 RenderBox* rootRenderer = document.documentElement() ? document.documentElement()->renderBox() : 0; 1254 RenderBox* bodyRenderer = rootRenderer && document.body() ? document.body()->renderBox() : 0; 1255 1255 if (bodyRenderer && bodyRenderer->stretchesToViewport()) 1256 1256 bodyRenderer->setChildNeedsLayout(true); … … 1265 1265 pauseScheduledEvents(); 1266 1266 1267 { 1268 bool disableLayoutState = false; 1269 if (subtree) { 1270 disableLayoutState = root->view().shouldDisableLayoutStateForSubtree(root); 1271 root->view().pushLayoutState(root); 1272 } 1273 LayoutStateDisabler layoutStateDisabler(disableLayoutState ? &root->view() : 0); 1274 1275 m_inLayout = true; 1276 beginDeferredRepaints(); 1277 forceLayoutParentViewIfNeeded(); 1267 bool disableLayoutState = false; 1268 if (subtree) { 1269 disableLayoutState = root->view().shouldDisableLayoutStateForSubtree(root); 1270 root->view().pushLayoutState(root); 1271 } 1272 LayoutStateDisabler layoutStateDisabler(disableLayoutState ? &root->view() : 0); 1273 1274 m_inLayout = true; 1275 beginDeferredRepaints(); 1276 forceLayoutParentViewIfNeeded(); 1277 root->layout(); 1278 #if ENABLE(TEXT_AUTOSIZING) 1279 if (document.textAutosizer()->processSubtree(root) && root->needsLayout()) 1278 1280 root->layout(); 1279 #if ENABLE(TEXT_AUTOSIZING) 1280 bool autosized = document->textAutosizer()->processSubtree(root); 1281 if (autosized && root->needsLayout()) 1282 root->layout(); 1283 #endif 1284 endDeferredRepaints(); 1285 m_inLayout = false; 1286 1287 if (subtree) 1288 root->view().popLayoutState(root); 1289 } 1281 #endif 1282 endDeferredRepaints(); 1283 m_inLayout = false; 1284 1285 if (subtree) 1286 root->view().popLayoutState(root); 1287 1290 1288 m_layoutRoot = 0; 1291 } // Reset m_layoutSchedulingEnabled to its previous value. 1289 1290 // Close block here to end the scope of changeSchedulingEnabled and layoutStateDisabler. 1291 } 1292 1292 1293 1293 bool neededFullRepaint = m_needsFullRepaint; … … 1317 1317 cache->postNotification(root, AXObjectCache::AXLayoutComplete, true); 1318 1318 #endif 1319 1319 1320 #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(DRAGGABLE_REGION) 1320 1321 updateAnnotatedRegions(); … … 1325 1326 updateCanBlitOnScrollRecursively(); 1326 1327 1327 if (document->hasListenerType(Document::OVERFLOWCHANGED_LISTENER)) 1328 updateOverflowStatus(layoutWidth() < contentsWidth(), 1329 layoutHeight() < contentsHeight()); 1328 if (document.hasListenerType(Document::OVERFLOWCHANGED_LISTENER)) 1329 updateOverflowStatus(layoutWidth() < contentsWidth(), layoutHeight() < contentsHeight()); 1330 1330 1331 1331 if (m_postLayoutTasksTimer.isActive()) … … 1338 1338 } else { 1339 1339 m_inSynchronousPostLayout = true; 1340 // Calls resumeScheduledEvents() 1341 performPostLayoutTasks(); 1340 performPostLayoutTasks(); // Calls resumeScheduledEvents(). 1342 1341 m_inSynchronousPostLayout = false; 1343 1342 } 1344 1343 } 1345 1344 1346 1345 if (!m_postLayoutTasksTimer.isActive() && (needsLayout() || m_inSynchronousPostLayout || inChildFrameLayoutWithFrameFlattening)) { 1347 1346 // If we need layout or are already in a synchronous call to postLayoutTasks(), … … 1359 1358 InspectorInstrumentation::didLayout(cookie, root); 1360 1359 1361 m_nestedLayoutCount--; 1360 --m_nestedLayoutCount; 1361 1362 1362 if (m_nestedLayoutCount) 1363 1363 return;
Note:
See TracChangeset
for help on using the changeset viewer.