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

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 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 } 1193 }
1194 1194
1195 bool scaleUnchanged = true; 1195 bool scaleUnchanged = true;
1196 if (!rect.isEmpty()) { 1196 if (!rect.isEmpty()) {
1197 // Pages should be as legible as on desktop when at dpi scale, so no 1197 // Pages should be as legible as on desktop when at dpi scale, so no
1198 // need to zoom in further when automatically determining zoom level 1198 // need to zoom in further when automatically determining zoom level
1199 // (after double tap, find in page, etc), though the user should still 1199 // (after double tap, find in page, etc), though the user should still
1200 // be allowed to manually pinch zoom in further if they desire. 1200 // be allowed to manually pinch zoom in further if they desire.
1201 const float defaultScaleWhenAlreadyLegible = m_minimumPageScaleFactor * doubleTapZoomAlreadyLegibleRatio; 1201 const float defaultScaleWhenAlreadyLegible = m_minimumPageScaleFactor * doubleTapZoomAlreadyLegibleRatio;
1202 float legibleScale = 1; 1202 float legibleScale = 1;
1203 #if ENABLE(TEXT_AUTOSIZING)
1204 if (page() && page()->settings()) 1203 if (page() && page()->settings())
1205 legibleScale *= page()->settings()->textAutosizingFontScaleFactor(); 1204 legibleScale *= page()->settings()->textAutosizingFontScaleFactor();
1206 #endif
1207 if (legibleScale < defaultScaleWhenAlreadyLegible) 1205 if (legibleScale < defaultScaleWhenAlreadyLegible)
1208 legibleScale = (scale == m_minimumPageScaleFactor) ? defaultScaleWhe nAlreadyLegible : m_minimumPageScaleFactor; 1206 legibleScale = (scale == m_minimumPageScaleFactor) ? defaultScaleWhe nAlreadyLegible : m_minimumPageScaleFactor;
1209 1207
1210 float defaultMargin = doubleTapZoomContentDefaultMargin; 1208 float defaultMargin = doubleTapZoomContentDefaultMargin;
1211 float minimumMargin = doubleTapZoomContentMinimumMargin; 1209 float minimumMargin = doubleTapZoomContentMinimumMargin;
1212 // We want the margins to have the same physical size, which means we 1210 // We want the margins to have the same physical size, which means we
1213 // need to express them in post-scale size. To do that we'd need to know 1211 // need to express them in post-scale size. To do that we'd need to know
1214 // the scale we're scaling to, but that depends on the margins. Instead 1212 // the scale we're scaling to, but that depends on the margins. Instead
1215 // we express them as a fraction of the target rectangle: this will be 1213 // we express them as a fraction of the target rectangle: this will be
1216 // correct if we end up fully zooming to it, and won't matter if we 1214 // correct if we end up fully zooming to it, and won't matter if we
(...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after
2775 WebRect caret, unusedEnd; 2773 WebRect caret, unusedEnd;
2776 selectionBounds(caret, unusedEnd); 2774 selectionBounds(caret, unusedEnd);
2777 IntRect unscaledCaret = caret; 2775 IntRect unscaledCaret = caret;
2778 unscaledCaret.scale(1 / pageScaleFactor()); 2776 unscaledCaret.scale(1 / pageScaleFactor());
2779 caret = unscaledCaret; 2777 caret = unscaledCaret;
2780 2778
2781 // Pick a scale which is reasonably readable. This is the scale at which 2779 // Pick a scale which is reasonably readable. This is the scale at which
2782 // the caret height will become minReadableCaretHeight (adjusted for dpi 2780 // the caret height will become minReadableCaretHeight (adjusted for dpi
2783 // and font scale factor). 2781 // and font scale factor).
2784 float targetScale = 1; 2782 float targetScale = 1;
2785 #if ENABLE(TEXT_AUTOSIZING)
2786 if (page() && page()->settings()) 2783 if (page() && page()->settings())
2787 targetScale *= page()->settings()->textAutosizingFontScaleFactor(); 2784 targetScale *= page()->settings()->textAutosizingFontScaleFactor();
2788 #endif 2785
2789 newScale = clampPageScaleFactorToLimits(minReadableCaretHeight * targetScale / caret.height); 2786 newScale = clampPageScaleFactorToLimits(minReadableCaretHeight * targetScale / caret.height);
2790 const float deltaScale = newScale / pageScaleFactor(); 2787 const float deltaScale = newScale / pageScaleFactor();
2791 2788
2792 // Convert the rects to absolute space in the new scale. 2789 // Convert the rects to absolute space in the new scale.
2793 IntRect textboxRectInDocumentCoordinates = textboxRect; 2790 IntRect textboxRectInDocumentCoordinates = textboxRect;
2794 textboxRectInDocumentCoordinates.move(mainFrame()->scrollOffset()); 2791 textboxRectInDocumentCoordinates.move(mainFrame()->scrollOffset());
2795 IntRect caretInDocumentCoordinates = caret; 2792 IntRect caretInDocumentCoordinates = caret;
2796 caretInDocumentCoordinates.move(mainFrame()->scrollOffset()); 2793 caretInDocumentCoordinates.move(mainFrame()->scrollOffset());
2797 2794
2798 int viewWidth = m_size.width / newScale; 2795 int viewWidth = m_size.width / newScale;
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after
4281 #endif 4278 #endif
4282 4279
4283 bool WebViewImpl::shouldDisableDesktopWorkarounds() 4280 bool WebViewImpl::shouldDisableDesktopWorkarounds()
4284 { 4281 {
4285 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); 4282 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments();
4286 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom 4283 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom
4287 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); 4284 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto);
4288 } 4285 }
4289 4286
4290 } // namespace WebKit 4287 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698