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

Side by Side Diff: Source/core/inspector/InspectorPageAgent.cpp

Issue 290313002: Use RecalcStyleDeferred for inspector style changes. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 1150
1151 m_deviceMetricsOverridden = enabled; 1151 m_deviceMetricsOverridden = enabled;
1152 m_emulateViewportEnabled = emulateViewport; 1152 m_emulateViewportEnabled = emulateViewport;
1153 if (enabled) 1153 if (enabled)
1154 m_client->setDeviceMetricsOverride(width, height, static_cast<float>(dev iceScaleFactor), emulateViewport, fitWindow); 1154 m_client->setDeviceMetricsOverride(width, height, static_cast<float>(dev iceScaleFactor), emulateViewport, fitWindow);
1155 else 1155 else
1156 m_client->clearDeviceMetricsOverride(); 1156 m_client->clearDeviceMetricsOverride();
1157 1157
1158 Document* document = mainFrame()->document(); 1158 Document* document = mainFrame()->document();
1159 if (document) { 1159 if (document) {
1160 document->styleResolverChanged(RecalcStyleImmediately); 1160 document->styleResolverChanged(RecalcStyleDeferred);
1161 document->mediaQueryAffectingValueChanged(); 1161 document->mediaQueryAffectingValueChanged();
1162 } 1162 }
1163 InspectorInstrumentation::mediaQueryResultChanged(document); 1163 InspectorInstrumentation::mediaQueryResultChanged(document);
1164 1164
1165 if (m_deviceMetricsOverridden) { 1165 if (m_deviceMetricsOverridden) {
1166 m_page->settings().setTextAutosizingEnabled(textAutosizingEnabled); 1166 m_page->settings().setTextAutosizingEnabled(textAutosizingEnabled);
1167 m_page->settings().setDeviceScaleAdjustment(fontScaleFactor); 1167 m_page->settings().setDeviceScaleAdjustment(fontScaleFactor);
1168 } else { 1168 } else {
1169 m_page->settings().setTextAutosizingEnabled(m_embedderTextAutosizingEnab led); 1169 m_page->settings().setTextAutosizingEnabled(m_embedderTextAutosizingEnab led);
1170 m_page->settings().setDeviceScaleAdjustment(m_embedderFontScaleFactor); 1170 m_page->settings().setDeviceScaleAdjustment(m_embedderFontScaleFactor);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 String currentMedia = m_state->getString(PageAgentState::pageAgentEmulatedMe dia); 1217 String currentMedia = m_state->getString(PageAgentState::pageAgentEmulatedMe dia);
1218 if (media == currentMedia) 1218 if (media == currentMedia)
1219 return; 1219 return;
1220 1220
1221 m_state->setString(PageAgentState::pageAgentEmulatedMedia, media); 1221 m_state->setString(PageAgentState::pageAgentEmulatedMedia, media);
1222 Document* document = 0; 1222 Document* document = 0;
1223 if (m_page->mainFrame()) 1223 if (m_page->mainFrame())
1224 document = m_page->mainFrame()->document(); 1224 document = m_page->mainFrame()->document();
1225 if (document) { 1225 if (document) {
1226 document->mediaQueryAffectingValueChanged(); 1226 document->mediaQueryAffectingValueChanged();
1227 document->styleResolverChanged(RecalcStyleImmediately); 1227 document->styleResolverChanged(RecalcStyleDeferred);
1228 document->updateLayout(); 1228 document->updateLayout();
rune 2014/05/18 10:28:43 I don't think this updateLayout() call needs to be
ojan 2014/05/18 17:50:39 My guess is that it's there to trigger this code:
1229 } 1229 }
1230 } 1230 }
1231 1231
1232 bool InspectorPageAgent::applyViewportStyleOverride(StyleResolver* resolver) 1232 bool InspectorPageAgent::applyViewportStyleOverride(StyleResolver* resolver)
1233 { 1233 {
1234 if (!m_deviceMetricsOverridden || !m_emulateViewportEnabled) 1234 if (!m_deviceMetricsOverridden || !m_emulateViewportEnabled)
1235 return false; 1235 return false;
1236 1236
1237 RefPtrWillBeRawPtr<StyleSheetContents> styleSheet = StyleSheetContents::crea te(CSSParserContext(UASheetMode, 0)); 1237 RefPtrWillBeRawPtr<StyleSheetContents> styleSheet = StyleSheetContents::crea te(CSSParserContext(UASheetMode, 0));
1238 styleSheet->parseString(String(viewportAndroidUserAgentStyleSheet, sizeof(vi ewportAndroidUserAgentStyleSheet))); 1238 styleSheet->parseString(String(viewportAndroidUserAgentStyleSheet, sizeof(vi ewportAndroidUserAgentStyleSheet)));
(...skipping 28 matching lines...) Expand all
1267 } 1267 }
1268 1268
1269 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid) 1269 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid)
1270 { 1270 {
1271 m_state->setBoolean(PageAgentState::showSizeOnResize, show); 1271 m_state->setBoolean(PageAgentState::showSizeOnResize, show);
1272 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ; 1272 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ;
1273 } 1273 }
1274 1274
1275 } // namespace WebCore 1275 } // namespace WebCore
1276 1276
OLDNEW
« no previous file with comments | « no previous file | Source/core/inspector/InspectorStyleSheet.cpp » ('j') | Source/core/inspector/InspectorStyleSheet.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698