diff options
author | Grace Kloba <klobag@google.com> | 2009-12-11 13:53:22 -0800 |
---|---|---|
committer | Grace Kloba <klobag@google.com> | 2009-12-11 13:53:22 -0800 |
commit | 9652d6b88e01f27d69c804ac6bc56b527b33c219 (patch) | |
tree | 707d7496ed58712add9c802fc055fb62a569f9af | |
parent | 80e68b43c3da64848db8edc7d8e8fe095888e42e (diff) | |
download | external_webkit-9652d6b88e01f27d69c804ac6bc56b527b33c219.zip external_webkit-9652d6b88e01f27d69c804ac6bc56b527b33c219.tar.gz external_webkit-9652d6b88e01f27d69c804ac6bc56b527b33c219.tar.bz2 |
Rollback to return density for scaleFactor.
Move the comment to HTMLCanvasElement and always use 1.0 there.
-rw-r--r-- | WebCore/html/HTMLCanvasElement.cpp | 24 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp | 24 |
2 files changed, 26 insertions, 22 deletions
diff --git a/WebCore/html/HTMLCanvasElement.cpp b/WebCore/html/HTMLCanvasElement.cpp index 7bae6e3..0405669 100644 --- a/WebCore/html/HTMLCanvasElement.cpp +++ b/WebCore/html/HTMLCanvasElement.cpp @@ -277,7 +277,19 @@ IntRect HTMLCanvasElement::convertLogicalToDevice(const FloatRect& logicalRect) IntSize HTMLCanvasElement::convertLogicalToDevice(const FloatSize& logicalSize) const { +#if PLATFORM(ANDROID) + /* In Android we capture the drawing into a displayList, and then + replay that list at various scale factors (sometimes zoomed out, other + times zoomed in for "normal" reading, yet other times at arbitrary + zoom values based on the user's choice). In all of these cases, we do + not re-record the displayList, hence it is usually harmful to perform + any pre-rounding, since we just don't know the actual drawing resolution + at record time. + */ + float pageScaleFactor = 1.0f; +#else float pageScaleFactor = document()->frame() ? document()->frame()->page()->chrome()->scaleFactor() : 1.0f; +#endif float wf = ceilf(logicalSize.width() * pageScaleFactor); float hf = ceilf(logicalSize.height() * pageScaleFactor); @@ -289,7 +301,19 @@ IntSize HTMLCanvasElement::convertLogicalToDevice(const FloatSize& logicalSize) IntPoint HTMLCanvasElement::convertLogicalToDevice(const FloatPoint& logicalPos) const { +#if PLATFORM(ANDROID) + /* In Android we capture the drawing into a displayList, and then + replay that list at various scale factors (sometimes zoomed out, other + times zoomed in for "normal" reading, yet other times at arbitrary + zoom values based on the user's choice). In all of these cases, we do + not re-record the displayList, hence it is usually harmful to perform + any pre-rounding, since we just don't know the actual drawing resolution + at record time. + */ + float pageScaleFactor = 1.0f; +#else float pageScaleFactor = document()->frame() ? document()->frame()->page()->chrome()->scaleFactor() : 1.0f; +#endif float xf = logicalPos.x() * pageScaleFactor; float yf = logicalPos.y() * pageScaleFactor; diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp index f441aa1..fa70670 100644 --- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp @@ -81,28 +81,8 @@ FloatRect ChromeClientAndroid::pageRect() { notImplemented(); return FloatRect() float ChromeClientAndroid::scaleFactor() { - /* Conceptually, we should return the density of the device's screen, - except that we don't really model webkit's notion of drawing. Webkit - expects the drawing context's matrix (plus scale-factor) to reflect the - actually transformation to the pixels, and thus it uses scaleFactor to - perform some pre-rounding in a few places (e.g. HTMLCanvasElement). - - ASSERT(m_webFrame); - return m_webFrame->density(); - - However, in Android we capture the drawing into a displayList, and then - replay that list at various scale factors (sometimes zoomed out, other - times zoomed in for "normal" reading, yet other times at arbitrary - zoom values based on the user's choice). In all of these cases, we do - not re-record the displayList, hence it is usually harmful to perform - any pre-rounding, since we just don't know the actual drawing resolution - at record time. - - Given Android's device-independent drawing model, we always return 1.0 - for this function, and we implement roundToDevicePixels() to be a no-op - so that we don't introduce pre-rounding artifacts during record. - */ - return 1.0f; + ASSERT(m_webFrame); + return m_webFrame->density(); } #ifdef ANDROID_USER_GESTURE |