Title: [110981] trunk/Source/WebCore
- Revision
- 110981
- Author
- kenn...@webkit.org
- Date
- 2012-03-16 03:34:23 -0700 (Fri, 16 Mar 2012)
Log Message
Follow up to: window.innerWidth/Height should not include page scale https://bugs.webkit.org/show_bug.cgi?id=76555
Reviewed by Simon Hausmann.
Introduce mapping methods for converting between CSS and layout units.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::innerHeight):
(WebCore::DOMWindow::innerWidth):
(WebCore::DOMWindow::scrollX):
(WebCore::DOMWindow::scrollY):
(WebCore::DOMWindow::scrollTo):
* page/FrameView.h:
(FrameView):
(WebCore::FrameView::mapFromLayoutToCSSUnits):
(WebCore):
(WebCore::FrameView::mapFromCSSToLayoutUnits):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (110980 => 110981)
--- trunk/Source/WebCore/ChangeLog 2012-03-16 10:29:34 UTC (rev 110980)
+++ trunk/Source/WebCore/ChangeLog 2012-03-16 10:34:23 UTC (rev 110981)
@@ -1,3 +1,24 @@
+2012-03-15 Kenneth Rohde Christiansen <kenn...@webkit.org>
+
+ Follow up to: window.innerWidth/Height should not include page scale
+ https://bugs.webkit.org/show_bug.cgi?id=76555
+
+ Reviewed by Simon Hausmann.
+
+ Introduce mapping methods for converting between CSS and layout units.
+
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::innerHeight):
+ (WebCore::DOMWindow::innerWidth):
+ (WebCore::DOMWindow::scrollX):
+ (WebCore::DOMWindow::scrollY):
+ (WebCore::DOMWindow::scrollTo):
+ * page/FrameView.h:
+ (FrameView):
+ (WebCore::FrameView::mapFromLayoutToCSSUnits):
+ (WebCore):
+ (WebCore::FrameView::mapFromCSSToLayoutUnits):
+
2012-03-16 Ian Vollick <voll...@chromium.org>
[chromium] Threaded opacity animation jump to opacity of 0
Modified: trunk/Source/WebCore/page/DOMWindow.cpp (110980 => 110981)
--- trunk/Source/WebCore/page/DOMWindow.cpp 2012-03-16 10:29:34 UTC (rev 110980)
+++ trunk/Source/WebCore/page/DOMWindow.cpp 2012-03-16 10:34:23 UTC (rev 110981)
@@ -1132,10 +1132,10 @@
FrameView* view = m_frame->view();
if (!view)
return 0;
-
+
long height = view->visibleContentRect(/* includeScrollbars */ true).height();
InspectorInstrumentation::applyScreenHeightOverride(m_frame, &height);
- return static_cast<int>(height / (m_frame->pageZoomFactor() * m_frame->frameScaleFactor()));
+ return view->mapFromLayoutToCSSUnits(height);
}
int DOMWindow::innerWidth() const
@@ -1149,7 +1149,7 @@
long width = view->visibleContentRect(/* includeScrollbars */ true).width();
InspectorInstrumentation::applyScreenWidthOverride(m_frame, &width);
- return static_cast<int>(width / (m_frame->pageZoomFactor() * m_frame->frameScaleFactor()));
+ return view->mapFromLayoutToCSSUnits(width);
}
int DOMWindow::screenX() const
@@ -1187,7 +1187,7 @@
m_frame->document()->updateLayoutIgnorePendingStylesheets();
- return static_cast<int>(view->scrollX() / (m_frame->pageZoomFactor() * m_frame->frameScaleFactor()));
+ return view->mapFromLayoutToCSSUnits(view->scrollX());
}
int DOMWindow::scrollY() const
@@ -1201,7 +1201,7 @@
m_frame->document()->updateLayoutIgnorePendingStylesheets();
- return static_cast<int>(view->scrollY() / (m_frame->pageZoomFactor() * m_frame->frameScaleFactor()));
+ return view->mapFromLayoutToCSSUnits(view->scrollY());
}
bool DOMWindow::closed() const
@@ -1419,9 +1419,8 @@
if (!view)
return;
- int zoomedX = static_cast<int>(x * m_frame->pageZoomFactor() * m_frame->frameScaleFactor());
- int zoomedY = static_cast<int>(y * m_frame->pageZoomFactor() * m_frame->frameScaleFactor());
- view->setScrollPosition(IntPoint(zoomedX, zoomedY));
+ IntPoint layoutPos(view->mapFromCSSToLayoutUnits(x), view->mapFromCSSToLayoutUnits(y));
+ view->setScrollPosition(layoutPos);
}
void DOMWindow::moveBy(float x, float y) const
Modified: trunk/Source/WebCore/page/FrameView.h (110980 => 110981)
--- trunk/Source/WebCore/page/FrameView.h 2012-03-16 10:29:34 UTC (rev 110980)
+++ trunk/Source/WebCore/page/FrameView.h 2012-03-16 10:34:23 UTC (rev 110981)
@@ -27,6 +27,7 @@
#include "AdjustViewSizeOrNot.h"
#include "Color.h"
+#include "Frame.h"
#include "LayoutTypes.h"
#include "PaintPhase.h"
#include "ScrollView.h"
@@ -75,6 +76,9 @@
Frame* frame() const { return m_frame.get(); }
void clearFrame();
+ int mapFromLayoutToCSSUnits(LayoutUnit);
+ LayoutUnit mapFromCSSToLayoutUnits(int);
+
LayoutUnit marginWidth() const { return m_margins.width(); } // -1 means default
LayoutUnit marginHeight() const { return m_margins.height(); } // -1 means default
void setMarginWidth(LayoutUnit);
@@ -530,6 +534,16 @@
setIsVisuallyNonEmpty();
}
+inline int FrameView::mapFromLayoutToCSSUnits(LayoutUnit value)
+{
+ return value / (m_frame->pageZoomFactor() * m_frame->frameScaleFactor());
+}
+
+inline LayoutUnit FrameView::mapFromCSSToLayoutUnits(int value)
+{
+ return value * m_frame->pageZoomFactor() * m_frame->frameScaleFactor();
+}
+
} // namespace WebCore
#endif // FrameView_h
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes