Changeset 51560 in webkit
- Timestamp:
- Dec 1, 2009 3:34:28 PM (14 years ago)
- Location:
- trunk/WebKit/chromium
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/chromium/ChangeLog
r51548 r51560 1 2009-12-01 Peter Kasting <pkasting@google.com> 2 3 Reviewed by Darin Fisher. 4 5 [Chromium] Simplify zoom-related APIs and add a zoom level getter, 6 part one: Add new APIs. (Old APIs will be removed in a second pass.) 7 https://bugs.webkit.org/show_bug.cgi?id=31893 8 9 * public/WebView.h: 10 * src/WebViewImpl.cpp: 11 (WebKit::WebViewImpl::zoomLevel): 12 (WebKit::WebViewImpl::setZoomLevel): 13 * src/WebViewImpl.h: 14 1 15 2009-12-01 Xiyuan Xia <xiyuan@chromium.org> 2 16 -
trunk/WebKit/chromium/public/WebView.h
r51440 r51560 136 136 // Zoom ---------------------------------------------------------------- 137 137 138 // Change the text zoom level. It will make the zoom level 20% larger 139 // or smaller. If textOnly is set, the text size will be changed. 140 // When unset, the entire page's zoom factor will be changed. 141 // 142 // You can only have either text zoom or full page zoom at one time. 143 // Changing the mode will change things in weird ways. Generally the 144 // app should only support text zoom or full page zoom, and not both. 145 // 146 // zoomDefault will reset both full page and text zoom. 138 // DEPRECATED: Will be removed very soon! 147 139 virtual void zoomIn(bool textOnly) = 0; 148 140 virtual void zoomOut(bool textOnly) = 0; 149 141 virtual void zoomDefault() = 0; 142 143 // Returns the current zoom level. 0 is "original size", and each increment 144 // above or below represents zooming 20% larger or smaller to limits of 300% 145 // and 50% of original size, respectively. 146 virtual int zoomLevel() = 0; 147 148 // Changes the zoom level to the specified level, clamping at the limits 149 // noted above, and returns the current zoom level after applying the 150 // change. 151 // 152 // If |textOnly| is set, only the text will be zoomed; otherwise the entire 153 // page will be zoomed. You can only have either text zoom or full page zoom 154 // at one time. Changing the mode while the page is zoomed will have odd 155 // effects. 156 virtual int setZoomLevel(bool textOnly, int zoomLevel) = 0; 150 157 151 158 -
trunk/WebKit/chromium/src/WebViewImpl.cpp
r51440 r51560 1247 1247 } 1248 1248 1249 // DEPRECATED 1249 1250 void WebViewImpl::zoomIn(bool textOnly) 1250 1251 { … … 1259 1260 } 1260 1261 1262 // DEPRECATED 1261 1263 void WebViewImpl::zoomOut(bool textOnly) 1262 1264 { … … 1271 1273 } 1272 1274 1275 // DEPRECATED 1273 1276 void WebViewImpl::zoomDefault() 1274 1277 { … … 1278 1281 mainFrameImpl()->frame()->setZoomFactor( 1279 1282 1.0f, mainFrameImpl()->frame()->isZoomFactorTextOnly()); 1283 } 1284 1285 int WebViewImpl::zoomLevel() 1286 { 1287 return m_zoomLevel; 1288 } 1289 1290 int WebViewImpl::setZoomLevel(bool textOnly, int zoomLevel) 1291 { 1292 float zoomFactor = static_cast<float>( 1293 std::max(std::min(std::pow(textSizeMultiplierRatio, zoomLevel), 1294 maxTextSizeMultiplier), 1295 minTextSizeMultiplier)); 1296 Frame* frame = mainFrameImpl()->frame(); 1297 if (zoomFactor != frame->zoomFactor()) { 1298 m_zoomLevel = zoomLevel; 1299 frame->setZoomFactor(zoomFactor, textOnly); 1300 } 1301 return m_zoomLevel; 1280 1302 } 1281 1303 -
trunk/WebKit/chromium/src/WebViewImpl.h
r51440 r51560 117 117 virtual void setInitialFocus(bool reverse); 118 118 virtual void clearFocusedNode(); 119 virtual void zoomIn(bool textOnly); 120 virtual void zoomOut(bool textOnly); 121 virtual void zoomDefault(); 119 virtual void zoomIn(bool textOnly); // DEPRECATED 120 virtual void zoomOut(bool textOnly); // DEPRECATED 121 virtual void zoomDefault(); // DEPRECATED 122 virtual int zoomLevel(); 123 virtual int setZoomLevel(bool textOnly, int zoomLevel); 122 124 virtual void performMediaPlayerAction( 123 125 const WebMediaPlayerAction& action, … … 338 340 WebPoint m_lastMouseDownPoint; 339 341 340 // Keeps track of the current text zoom level. 0 means no zoom, positive341 // values mean larger text, negative numbers mean smaller.342 // Keeps track of the current zoom level. 0 means no zoom, positive numbers 343 // mean zoom in, negative numbers mean zoom out. 342 344 int m_zoomLevel; 343 345
Note: See TracChangeset
for help on using the changeset viewer.