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

Side by Side Diff: Source/WebKit/chromium/src/WebViewImpl.cpp

Issue 13723004: Remove the ENABLE_TEXT_AUTOSIZING compile-time flag. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 } 1191 }
1192 1192
1193 bool scaleUnchanged = true; 1193 bool scaleUnchanged = true;
1194 if (!rect.isEmpty()) { 1194 if (!rect.isEmpty()) {
1195 // Pages should be as legible as on desktop when at dpi scale, so no 1195 // Pages should be as legible as on desktop when at dpi scale, so no
1196 // need to zoom in further when automatically determining zoom level 1196 // need to zoom in further when automatically determining zoom level
1197 // (after double tap, find in page, etc), though the user should still 1197 // (after double tap, find in page, etc), though the user should still
1198 // be allowed to manually pinch zoom in further if they desire. 1198 // be allowed to manually pinch zoom in further if they desire.
1199 const float defaultScaleWhenAlreadyLegible = m_minimumPageScaleFactor * doubleTapZoomAlreadyLegibleRatio; 1199 const float defaultScaleWhenAlreadyLegible = m_minimumPageScaleFactor * doubleTapZoomAlreadyLegibleRatio;
1200 float legibleScale = 1; 1200 float legibleScale = 1;
1201 #if ENABLE(TEXT_AUTOSIZING)
1202 if (page() && page()->settings()) 1201 if (page() && page()->settings())
1203 legibleScale *= page()->settings()->textAutosizingFontScaleFactor(); 1202 legibleScale *= page()->settings()->textAutosizingFontScaleFactor();
1204 #endif
1205 if (legibleScale < defaultScaleWhenAlreadyLegible) 1203 if (legibleScale < defaultScaleWhenAlreadyLegible)
1206 legibleScale = (scale == m_minimumPageScaleFactor) ? defaultScaleWhe nAlreadyLegible : m_minimumPageScaleFactor; 1204 legibleScale = (scale == m_minimumPageScaleFactor) ? defaultScaleWhe nAlreadyLegible : m_minimumPageScaleFactor;
1207 1205
1208 float defaultMargin = doubleTapZoomContentDefaultMargin; 1206 float defaultMargin = doubleTapZoomContentDefaultMargin;
1209 float minimumMargin = doubleTapZoomContentMinimumMargin; 1207 float minimumMargin = doubleTapZoomContentMinimumMargin;
1210 // We want the margins to have the same physical size, which means we 1208 // We want the margins to have the same physical size, which means we
1211 // need to express them in post-scale size. To do that we'd need to know 1209 // need to express them in post-scale size. To do that we'd need to know
1212 // the scale we're scaling to, but that depends on the margins. Instead 1210 // the scale we're scaling to, but that depends on the margins. Instead
1213 // we express them as a fraction of the target rectangle: this will be 1211 // we express them as a fraction of the target rectangle: this will be
1214 // correct if we end up fully zooming to it, and won't matter if we 1212 // correct if we end up fully zooming to it, and won't matter if we
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after
2765 WebRect caret, unusedEnd; 2763 WebRect caret, unusedEnd;
2766 selectionBounds(caret, unusedEnd); 2764 selectionBounds(caret, unusedEnd);
2767 IntRect unscaledCaret = caret; 2765 IntRect unscaledCaret = caret;
2768 unscaledCaret.scale(1 / pageScaleFactor()); 2766 unscaledCaret.scale(1 / pageScaleFactor());
2769 caret = unscaledCaret; 2767 caret = unscaledCaret;
2770 2768
2771 // Pick a scale which is reasonably readable. This is the scale at which 2769 // Pick a scale which is reasonably readable. This is the scale at which
2772 // the caret height will become minReadableCaretHeight (adjusted for dpi 2770 // the caret height will become minReadableCaretHeight (adjusted for dpi
2773 // and font scale factor). 2771 // and font scale factor).
2774 float targetScale = 1; 2772 float targetScale = 1;
2775 #if ENABLE(TEXT_AUTOSIZING)
2776 if (page() && page()->settings()) 2773 if (page() && page()->settings())
2777 targetScale *= page()->settings()->textAutosizingFontScaleFactor(); 2774 targetScale *= page()->settings()->textAutosizingFontScaleFactor();
2778 #endif 2775
2779 newScale = clampPageScaleFactorToLimits(minReadableCaretHeight * targetScale / caret.height); 2776 newScale = clampPageScaleFactorToLimits(minReadableCaretHeight * targetScale / caret.height);
2780 const float deltaScale = newScale / pageScaleFactor(); 2777 const float deltaScale = newScale / pageScaleFactor();
2781 2778
2782 // Convert the rects to absolute space in the new scale. 2779 // Convert the rects to absolute space in the new scale.
2783 IntRect textboxRectInDocumentCoordinates = textboxRect; 2780 IntRect textboxRectInDocumentCoordinates = textboxRect;
2784 textboxRectInDocumentCoordinates.move(mainFrame()->scrollOffset()); 2781 textboxRectInDocumentCoordinates.move(mainFrame()->scrollOffset());
2785 IntRect caretInDocumentCoordinates = caret; 2782 IntRect caretInDocumentCoordinates = caret;
2786 caretInDocumentCoordinates.move(mainFrame()->scrollOffset()); 2783 caretInDocumentCoordinates.move(mainFrame()->scrollOffset());
2787 2784
2788 int viewWidth = m_size.width / newScale; 2785 int viewWidth = m_size.width / newScale;
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after
4269 #endif 4266 #endif
4270 4267
4271 bool WebViewImpl::shouldDisableDesktopWorkarounds() 4268 bool WebViewImpl::shouldDisableDesktopWorkarounds()
4272 { 4269 {
4273 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); 4270 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments();
4274 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom 4271 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom
4275 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); 4272 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto);
4276 } 4273 }
4277 4274
4278 } // namespace WebKit 4275 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/WebSettingsImpl.cpp ('k') | Source/WebKit/chromium/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698