OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 4729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4740 } | 4740 } |
4741 | 4741 |
4742 IntPoint FrameView::ConvertToRootFrame(const IntPoint& local_point) const { | 4742 IntPoint FrameView::ConvertToRootFrame(const IntPoint& local_point) const { |
4743 if (parent_) { | 4743 if (parent_) { |
4744 IntPoint parent_point = ConvertToContainingFrameView(local_point); | 4744 IntPoint parent_point = ConvertToContainingFrameView(local_point); |
4745 return parent_->ConvertToRootFrame(parent_point); | 4745 return parent_->ConvertToRootFrame(parent_point); |
4746 } | 4746 } |
4747 return local_point; | 4747 return local_point; |
4748 } | 4748 } |
4749 | 4749 |
| 4750 IntRect FrameView::ConvertFromRootFrame( |
| 4751 const IntRect& rect_in_root_frame) const { |
| 4752 if (parent_) { |
| 4753 IntRect parent_rect = parent_->ConvertFromRootFrame(rect_in_root_frame); |
| 4754 return ConvertFromContainingFrameView(parent_rect); |
| 4755 } |
| 4756 return rect_in_root_frame; |
| 4757 } |
| 4758 |
| 4759 IntPoint FrameView::ConvertFromRootFrame( |
| 4760 const IntPoint& point_in_root_frame) const { |
| 4761 if (parent_) { |
| 4762 IntPoint parent_point = parent_->ConvertFromRootFrame(point_in_root_frame); |
| 4763 return ConvertFromContainingFrameView(parent_point); |
| 4764 } |
| 4765 return point_in_root_frame; |
| 4766 } |
| 4767 |
| 4768 FloatPoint FrameView::ConvertFromRootFrame( |
| 4769 const FloatPoint& point_in_root_frame) const { |
| 4770 // FrameViews / windows are required to be IntPoint aligned, but we may |
| 4771 // need to convert FloatPoint values within them (eg. for event |
| 4772 // co-ordinates). |
| 4773 IntPoint floored_point = FlooredIntPoint(point_in_root_frame); |
| 4774 FloatPoint parent_point = ConvertFromRootFrame(floored_point); |
| 4775 FloatSize window_fraction = point_in_root_frame - floored_point; |
| 4776 // Use linear interpolation handle any fractional value (eg. for iframes |
| 4777 // subject to a transform beyond just a simple translation). |
| 4778 // FIXME: Add FloatPoint variants of all co-ordinate space conversion APIs. |
| 4779 if (!window_fraction.IsEmpty()) { |
| 4780 const int kFactor = 1000; |
| 4781 IntPoint parent_line_end = ConvertFromRootFrame( |
| 4782 floored_point + RoundedIntSize(window_fraction.ScaledBy(kFactor))); |
| 4783 FloatSize parent_fraction = |
| 4784 (parent_line_end - parent_point).ScaledBy(1.0f / kFactor); |
| 4785 parent_point.Move(parent_fraction); |
| 4786 } |
| 4787 return parent_point; |
| 4788 } |
| 4789 |
4750 IntPoint FrameView::ConvertFromContainingFrameViewToScrollbar( | 4790 IntPoint FrameView::ConvertFromContainingFrameViewToScrollbar( |
4751 const Scrollbar& scrollbar, | 4791 const Scrollbar& scrollbar, |
4752 const IntPoint& parent_point) const { | 4792 const IntPoint& parent_point) const { |
4753 IntPoint new_point = parent_point; | 4793 IntPoint new_point = parent_point; |
4754 // Scrollbars won't be transformed within us | 4794 // Scrollbars won't be transformed within us |
4755 new_point.MoveBy(-scrollbar.Location()); | 4795 new_point.MoveBy(-scrollbar.Location()); |
4756 return new_point; | 4796 return new_point; |
4757 } | 4797 } |
4758 | 4798 |
4759 static void SetNeedsCompositingUpdate(LayoutViewItem layout_view_item, | 4799 static void SetNeedsCompositingUpdate(LayoutViewItem layout_view_item, |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5361 void FrameView::SetAnimationHost( | 5401 void FrameView::SetAnimationHost( |
5362 std::unique_ptr<CompositorAnimationHost> host) { | 5402 std::unique_ptr<CompositorAnimationHost> host) { |
5363 animation_host_ = std::move(host); | 5403 animation_host_ = std::move(host); |
5364 } | 5404 } |
5365 | 5405 |
5366 LayoutUnit FrameView::CaretWidth() const { | 5406 LayoutUnit FrameView::CaretWidth() const { |
5367 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); | 5407 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); |
5368 } | 5408 } |
5369 | 5409 |
5370 } // namespace blink | 5410 } // namespace blink |
OLD | NEW |