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

Side by Side Diff: Source/core/page/Settings.cpp

Issue 49913005: Add Settings::deviceScaleAdjustment. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address review comments. Created 7 years, 1 month 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) 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All rights reserv ed.
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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 #if OS(WIN) 107 #if OS(WIN)
108 static const bool defaultSelectTrailingWhitespaceEnabled = true; 108 static const bool defaultSelectTrailingWhitespaceEnabled = true;
109 #else 109 #else
110 static const bool defaultSelectTrailingWhitespaceEnabled = false; 110 static const bool defaultSelectTrailingWhitespaceEnabled = false;
111 #endif 111 #endif
112 112
113 Settings::Settings(Page* page) 113 Settings::Settings(Page* page)
114 : m_page(0) 114 : m_page(0)
115 , m_mediaTypeOverride("screen") 115 , m_mediaTypeOverride("screen")
116 , m_textAutosizingFontScaleFactor(1) 116 , m_textAutosizingFontScaleFactor(1)
117 , m_deviceScaleAdjustment(1.0f)
117 #if HACK_FORCE_TEXT_AUTOSIZING_ON_DESKTOP 118 #if HACK_FORCE_TEXT_AUTOSIZING_ON_DESKTOP
118 , m_textAutosizingWindowSizeOverride(320, 480) 119 , m_textAutosizingWindowSizeOverride(320, 480)
119 , m_textAutosizingEnabled(true) 120 , m_textAutosizingEnabled(true)
120 #else 121 #else
121 , m_textAutosizingEnabled(false) 122 , m_textAutosizingEnabled(false)
122 #endif 123 #endif
123 , m_useWideViewport(true) 124 , m_useWideViewport(true)
124 , m_loadWithOverviewMode(true) 125 , m_loadWithOverviewMode(true)
125 SETTINGS_INITIALIZER_LIST 126 SETTINGS_INITIALIZER_LIST
126 , m_isJavaEnabled(false) 127 , m_isJavaEnabled(false)
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 void Settings::setLoadWithOverviewMode(bool loadWithOverviewMode) 252 void Settings::setLoadWithOverviewMode(bool loadWithOverviewMode)
252 { 253 {
253 if (m_loadWithOverviewMode == loadWithOverviewMode) 254 if (m_loadWithOverviewMode == loadWithOverviewMode)
254 return; 255 return;
255 256
256 m_loadWithOverviewMode = loadWithOverviewMode; 257 m_loadWithOverviewMode = loadWithOverviewMode;
257 if (m_page->mainFrame()) 258 if (m_page->mainFrame())
258 m_page->chrome().dispatchViewportPropertiesDidChange(m_page->mainFrame() ->document()->viewportDescription()); 259 m_page->chrome().dispatchViewportPropertiesDidChange(m_page->mainFrame() ->document()->viewportDescription());
259 } 260 }
260 261
261 void Settings::setTextAutosizingFontScaleFactor(float fontScaleFactor) 262 void Settings::recalculateTextAutosizingMultipliers()
262 { 263 {
263 m_textAutosizingFontScaleFactor = fontScaleFactor;
264
265 // FIXME: I wonder if this needs to traverse frames like in WebViewImpl::res ize, or whether there is only one document per Settings instance? 264 // FIXME: I wonder if this needs to traverse frames like in WebViewImpl::res ize, or whether there is only one document per Settings instance?
266 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext()) 265 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext())
267 frame->document()->textAutosizer()->recalculateMultipliers(); 266 frame->document()->textAutosizer()->recalculateMultipliers();
268 267
269 m_page->setNeedsRecalcStyleInAllFrames(); 268 m_page->setNeedsRecalcStyleInAllFrames();
270 } 269 }
271 270
271 void Settings::setTextAutosizingFontScaleFactor(float fontScaleFactor)
272 {
273 m_textAutosizingFontScaleFactor = fontScaleFactor;
274 recalculateTextAutosizingMultipliers();
275 }
276
277 void Settings::setDeviceScaleAdjustment(float deviceScaleAdjustment)
278 {
279 m_deviceScaleAdjustment = deviceScaleAdjustment;
280 recalculateTextAutosizingMultipliers();
281 }
282
272 void Settings::setMediaTypeOverride(const String& mediaTypeOverride) 283 void Settings::setMediaTypeOverride(const String& mediaTypeOverride)
273 { 284 {
274 if (m_mediaTypeOverride == mediaTypeOverride) 285 if (m_mediaTypeOverride == mediaTypeOverride)
275 return; 286 return;
276 287
277 m_mediaTypeOverride = mediaTypeOverride; 288 m_mediaTypeOverride = mediaTypeOverride;
278 289
279 Frame* mainFrame = m_page->mainFrame(); 290 Frame* mainFrame = m_page->mainFrame();
280 ASSERT(mainFrame); 291 ASSERT(mainFrame);
281 FrameView* view = mainFrame->view(); 292 FrameView* view = mainFrame->view();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 { 397 {
387 if (m_viewportEnabled == enabled) 398 if (m_viewportEnabled == enabled)
388 return; 399 return;
389 400
390 m_viewportEnabled = enabled; 401 m_viewportEnabled = enabled;
391 if (m_page->mainFrame()) 402 if (m_page->mainFrame())
392 m_page->mainFrame()->document()->updateViewportDescription(); 403 m_page->mainFrame()->document()->updateViewportDescription();
393 } 404 }
394 405
395 } // namespace WebCore 406 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698