[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
pkasting at chromium.org
pkasting at chromium.org
Tue Jan 5 23:40:04 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 8d7b4abcfc1f8deb9700e205f246b7f8f8595913
Author: pkasting at chromium.org <pkasting at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Dec 1 23:34:28 2009 +0000
[Chromium] Simplify zoom-related APIs and add a zoom level getter,
part one: Add new APIs. (Old APIs will be removed in a second pass.)
https://bugs.webkit.org/show_bug.cgi?id=31893
Reviewed by Darin Fisher.
* public/WebView.h:
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::zoomLevel):
(WebKit::WebViewImpl::setZoomLevel):
* src/WebViewImpl.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51560 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index b021532..0b5239a 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,17 @@
+2009-12-01 Peter Kasting <pkasting at google.com>
+
+ Reviewed by Darin Fisher.
+
+ [Chromium] Simplify zoom-related APIs and add a zoom level getter,
+ part one: Add new APIs. (Old APIs will be removed in a second pass.)
+ https://bugs.webkit.org/show_bug.cgi?id=31893
+
+ * public/WebView.h:
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::zoomLevel):
+ (WebKit::WebViewImpl::setZoomLevel):
+ * src/WebViewImpl.h:
+
2009-12-01 Xiyuan Xia <xiyuan at chromium.org>
Reviewed by Darin Fisher.
diff --git a/WebKit/chromium/public/WebView.h b/WebKit/chromium/public/WebView.h
index 29a3f9e..215797f 100644
--- a/WebKit/chromium/public/WebView.h
+++ b/WebKit/chromium/public/WebView.h
@@ -135,19 +135,26 @@ public:
// Zoom ----------------------------------------------------------------
- // Change the text zoom level. It will make the zoom level 20% larger
- // or smaller. If textOnly is set, the text size will be changed.
- // When unset, the entire page's zoom factor will be changed.
- //
- // You can only have either text zoom or full page zoom at one time.
- // Changing the mode will change things in weird ways. Generally the
- // app should only support text zoom or full page zoom, and not both.
- //
- // zoomDefault will reset both full page and text zoom.
+ // DEPRECATED: Will be removed very soon!
virtual void zoomIn(bool textOnly) = 0;
virtual void zoomOut(bool textOnly) = 0;
virtual void zoomDefault() = 0;
+ // Returns the current zoom level. 0 is "original size", and each increment
+ // above or below represents zooming 20% larger or smaller to limits of 300%
+ // and 50% of original size, respectively.
+ virtual int zoomLevel() = 0;
+
+ // Changes the zoom level to the specified level, clamping at the limits
+ // noted above, and returns the current zoom level after applying the
+ // change.
+ //
+ // If |textOnly| is set, only the text will be zoomed; otherwise the entire
+ // page will be zoomed. You can only have either text zoom or full page zoom
+ // at one time. Changing the mode while the page is zoomed will have odd
+ // effects.
+ virtual int setZoomLevel(bool textOnly, int zoomLevel) = 0;
+
// Media ---------------------------------------------------------------
diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp
index 7914a9e..7f31397 100644
--- a/WebKit/chromium/src/WebViewImpl.cpp
+++ b/WebKit/chromium/src/WebViewImpl.cpp
@@ -1246,6 +1246,7 @@ void WebViewImpl::clearFocusedNode()
}
}
+// DEPRECATED
void WebViewImpl::zoomIn(bool textOnly)
{
Frame* frame = mainFrameImpl()->frame();
@@ -1258,6 +1259,7 @@ void WebViewImpl::zoomIn(bool textOnly)
}
}
+// DEPRECATED
void WebViewImpl::zoomOut(bool textOnly)
{
Frame* frame = mainFrameImpl()->frame();
@@ -1270,6 +1272,7 @@ void WebViewImpl::zoomOut(bool textOnly)
}
}
+// DEPRECATED
void WebViewImpl::zoomDefault()
{
// We don't change the zoom mode (text only vs. full page) here. We just want
@@ -1279,6 +1282,25 @@ void WebViewImpl::zoomDefault()
1.0f, mainFrameImpl()->frame()->isZoomFactorTextOnly());
}
+int WebViewImpl::zoomLevel()
+{
+ return m_zoomLevel;
+}
+
+int WebViewImpl::setZoomLevel(bool textOnly, int zoomLevel)
+{
+ float zoomFactor = static_cast<float>(
+ std::max(std::min(std::pow(textSizeMultiplierRatio, zoomLevel),
+ maxTextSizeMultiplier),
+ minTextSizeMultiplier));
+ Frame* frame = mainFrameImpl()->frame();
+ if (zoomFactor != frame->zoomFactor()) {
+ m_zoomLevel = zoomLevel;
+ frame->setZoomFactor(zoomFactor, textOnly);
+ }
+ return m_zoomLevel;
+}
+
void WebViewImpl::performMediaPlayerAction(const WebMediaPlayerAction& action,
const WebPoint& location)
{
diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h
index 96227e3..de0ad0c 100644
--- a/WebKit/chromium/src/WebViewImpl.h
+++ b/WebKit/chromium/src/WebViewImpl.h
@@ -116,9 +116,11 @@ public:
virtual void setFocusedFrame(WebFrame* frame);
virtual void setInitialFocus(bool reverse);
virtual void clearFocusedNode();
- virtual void zoomIn(bool textOnly);
- virtual void zoomOut(bool textOnly);
- virtual void zoomDefault();
+ virtual void zoomIn(bool textOnly); // DEPRECATED
+ virtual void zoomOut(bool textOnly); // DEPRECATED
+ virtual void zoomDefault(); // DEPRECATED
+ virtual int zoomLevel();
+ virtual int setZoomLevel(bool textOnly, int zoomLevel);
virtual void performMediaPlayerAction(
const WebMediaPlayerAction& action,
const WebPoint& location);
@@ -337,8 +339,8 @@ private:
// dragged by the time a drag is initiated.
WebPoint m_lastMouseDownPoint;
- // Keeps track of the current text zoom level. 0 means no zoom, positive
- // values mean larger text, negative numbers mean smaller.
+ // Keeps track of the current zoom level. 0 means no zoom, positive numbers
+ // mean zoom in, negative numbers mean zoom out.
int m_zoomLevel;
bool m_contextMenuAllowed;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list