Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Unified Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2855523002: Deleted Widget/FrameViewBase (Closed)
Patch Set: Keep FrameViewBase.h file until dependent CL is landed. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/FrameView.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index 2c69b39b30043c0cbfedae98e1a6a96c7cc148e4..0127e29b27de6bbd9ef8bb1f455c9b0e474ec1df 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -4747,6 +4747,46 @@ IntPoint FrameView::ConvertToRootFrame(const IntPoint& local_point) const {
return local_point;
}
+IntRect FrameView::ConvertFromRootFrame(
+ const IntRect& rect_in_root_frame) const {
+ if (parent_) {
+ IntRect parent_rect = parent_->ConvertFromRootFrame(rect_in_root_frame);
+ return ConvertFromContainingFrameView(parent_rect);
+ }
+ return rect_in_root_frame;
+}
+
+IntPoint FrameView::ConvertFromRootFrame(
+ const IntPoint& point_in_root_frame) const {
+ if (parent_) {
+ IntPoint parent_point = parent_->ConvertFromRootFrame(point_in_root_frame);
+ return ConvertFromContainingFrameView(parent_point);
+ }
+ return point_in_root_frame;
+}
+
+FloatPoint FrameView::ConvertFromRootFrame(
+ const FloatPoint& point_in_root_frame) const {
+ // FrameViews / windows are required to be IntPoint aligned, but we may
+ // need to convert FloatPoint values within them (eg. for event
+ // co-ordinates).
+ IntPoint floored_point = FlooredIntPoint(point_in_root_frame);
+ FloatPoint parent_point = ConvertFromRootFrame(floored_point);
+ FloatSize window_fraction = point_in_root_frame - floored_point;
+ // Use linear interpolation handle any fractional value (eg. for iframes
+ // subject to a transform beyond just a simple translation).
+ // FIXME: Add FloatPoint variants of all co-ordinate space conversion APIs.
+ if (!window_fraction.IsEmpty()) {
+ const int kFactor = 1000;
+ IntPoint parent_line_end = ConvertFromRootFrame(
+ floored_point + RoundedIntSize(window_fraction.ScaledBy(kFactor)));
+ FloatSize parent_fraction =
+ (parent_line_end - parent_point).ScaledBy(1.0f / kFactor);
+ parent_point.Move(parent_fraction);
+ }
+ return parent_point;
+}
+
IntPoint FrameView::ConvertFromContainingFrameViewToScrollbar(
const Scrollbar& scrollbar,
const IntPoint& parent_point) const {

Powered by Google App Engine
This is Rietveld 408576698