summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMangesh Ghiware <mghiware@google.com>2012-05-18 10:18:45 -0700
committerMangesh Ghiware <mghiware@google.com>2012-05-18 17:48:12 -0700
commit541af8dff4d592277d0f835deafaf728dad8bc57 (patch)
tree2b271cb9a99f476c188d3192c5b9e02023af9e6c
parentc6097fa86138b3dc74b91e12017cfab615fa0f38 (diff)
downloadexternal_webkit-541af8dff4d592277d0f835deafaf728dad8bc57.zip
external_webkit-541af8dff4d592277d0f835deafaf728dad8bc57.tar.gz
external_webkit-541af8dff4d592277d0f835deafaf728dad8bc57.tar.bz2
Revert part of "Fix iframe, ..."
Fix DOMWindow innerWidth and innerHeight to report correct values even after an orientation change. Uses platform-specific widget. This reverts part of commit I588aa5709e7a3c2ced9479c3cf9c1827bf6f7733. Bug: 6479900 Change-Id: Ic5c8785e35b14d6723eee4f4dfe1b0a3e1ec284a
-rw-r--r--Source/WebCore/page/DOMWindow.cpp16
-rw-r--r--Source/WebCore/platform/ScrollView.cpp24
-rw-r--r--Source/WebCore/platform/ScrollView.h11
-rw-r--r--Source/WebCore/platform/android/ScrollViewAndroid.cpp28
-rw-r--r--Source/WebCore/platform/android/WidgetAndroid.cpp9
5 files changed, 87 insertions, 1 deletions
diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp
index ee2206b..c7f162a 100644
--- a/Source/WebCore/page/DOMWindow.cpp
+++ b/Source/WebCore/page/DOMWindow.cpp
@@ -1095,7 +1095,11 @@ int DOMWindow::innerHeight() const
if (!view)
return 0;
+#if PLATFORM(ANDROID)
+ return static_cast<int>(view->actualHeight() / m_frame->pageZoomFactor());
+#else
return static_cast<int>(view->height() / m_frame->pageZoomFactor());
+#endif
}
int DOMWindow::innerWidth() const
@@ -1107,7 +1111,11 @@ int DOMWindow::innerWidth() const
if (!view)
return 0;
+#if PLATFORM(ANDROID)
+ return static_cast<int>(view->actualWidth() / m_frame->pageZoomFactor());
+#else
return static_cast<int>(view->width() / m_frame->pageZoomFactor());
+#endif
}
int DOMWindow::screenX() const
@@ -1145,7 +1153,11 @@ int DOMWindow::scrollX() const
m_frame->document()->updateLayoutIgnorePendingStylesheets();
+#if PLATFORM(ANDROID)
+ return static_cast<int>(view->actualScrollX() / m_frame->pageZoomFactor());
+#else
return static_cast<int>(view->scrollX() / m_frame->pageZoomFactor());
+#endif
}
int DOMWindow::scrollY() const
@@ -1159,7 +1171,11 @@ int DOMWindow::scrollY() const
m_frame->document()->updateLayoutIgnorePendingStylesheets();
+#if PLATFORM(ANDROID)
+ return static_cast<int>(view->actualScrollY() / m_frame->pageZoomFactor());
+#else
return static_cast<int>(view->scrollY() / m_frame->pageZoomFactor());
+#endif
}
bool DOMWindow::closed() const
diff --git a/Source/WebCore/platform/ScrollView.cpp b/Source/WebCore/platform/ScrollView.cpp
index 140c8e5..864fdc5 100644
--- a/Source/WebCore/platform/ScrollView.cpp
+++ b/Source/WebCore/platform/ScrollView.cpp
@@ -308,6 +308,30 @@ void ScrollView::setContentsSize(const IntSize& newSize)
}
#if PLATFORM(ANDROID)
+int ScrollView::actualWidth() const {
+ if (platformWidget())
+ return platformActualWidth();
+ return width();
+}
+
+int ScrollView::actualHeight() const {
+ if (platformWidget())
+ return platformActualHeight();
+ return height();
+}
+
+int ScrollView::actualScrollX() const {
+ if (platformWidget())
+ return platformActualScrollX();
+ return scrollX();
+}
+
+int ScrollView::actualScrollY() const {
+ if (platformWidget())
+ return platformActualScrollY();
+ return scrollY();
+}
+
FrameView* ScrollView::frameView() {
if (this->isFrameView()) {
FrameView* frameView = reinterpret_cast<FrameView*>(this);
diff --git a/Source/WebCore/platform/ScrollView.h b/Source/WebCore/platform/ScrollView.h
index e58d025..3228870 100644
--- a/Source/WebCore/platform/ScrollView.h
+++ b/Source/WebCore/platform/ScrollView.h
@@ -172,6 +172,10 @@ public:
virtual void setContentsSize(const IntSize&);
#if PLATFORM(ANDROID)
+ int actualWidth() const;
+ int actualHeight() const;
+ int actualScrollX() const;
+ int actualScrollY() const;
FrameView* frameView();
#endif
@@ -401,6 +405,13 @@ private:
void platformSetScrollOrigin(const IntPoint&, bool updatePositionAtAll, bool updatePositionSynchronously);
+#if PLATFORM(ANDROID)
+ int platformActualWidth() const;
+ int platformActualHeight() const;
+ int platformActualScrollX() const;
+ int platformActualScrollY() const;
+#endif
+
#if PLATFORM(MAC) && defined __OBJC__
public:
NSView* documentView() const;
diff --git a/Source/WebCore/platform/android/ScrollViewAndroid.cpp b/Source/WebCore/platform/android/ScrollViewAndroid.cpp
index cc1c09e..e7300a1 100644
--- a/Source/WebCore/platform/android/ScrollViewAndroid.cpp
+++ b/Source/WebCore/platform/android/ScrollViewAndroid.cpp
@@ -68,6 +68,34 @@ IntSize ScrollView::platformContentsSize() const
return m_contentsSize;
}
+int ScrollView::platformActualWidth() const
+{
+ if (parent())
+ return width();
+ return platformWidget()->visibleWidth();
+}
+
+int ScrollView::platformActualHeight() const
+{
+ if (parent())
+ return height();
+ return platformWidget()->visibleHeight();
+}
+
+int ScrollView::platformActualScrollX() const
+{
+ if (parent())
+ return scrollX();
+ return platformWidget()->visibleX();
+}
+
+int ScrollView::platformActualScrollY() const
+{
+ if (parent())
+ return scrollY();
+ return platformWidget()->visibleY();
+}
+
void ScrollView::platformSetScrollPosition(const WebCore::IntPoint& pt)
{
PlatformBridge::setScrollPosition(this, m_scrollOrigin.x() + pt.x(),
diff --git a/Source/WebCore/platform/android/WidgetAndroid.cpp b/Source/WebCore/platform/android/WidgetAndroid.cpp
index 6858f29..3c5b1c8 100644
--- a/Source/WebCore/platform/android/WidgetAndroid.cpp
+++ b/Source/WebCore/platform/android/WidgetAndroid.cpp
@@ -49,7 +49,9 @@ Widget::~Widget()
IntRect Widget::frameRect() const
{
- return m_frame;
+ if (!platformWidget())
+ return m_frame;
+ return platformWidget()->getBounds();
}
void Widget::setFocus(bool focused)
@@ -89,6 +91,11 @@ void Widget::hide()
void Widget::setFrameRect(const IntRect& rect)
{
m_frame = rect;
+ // platformWidget() is 0 when called from Scrollbar
+ if (!platformWidget())
+ return;
+ platformWidget()->setLocation(rect.x(), rect.y());
+ platformWidget()->setSize(rect.width(), rect.height());
}
void Widget::setIsSelected(bool isSelected)