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

Side by Side Diff: third_party/WebKit/Source/platform/FrameViewBase.cpp

Issue 2721133003: Rename platform/Widget to platform/FrameViewBase in platform. (Closed)
Patch Set: Rename platform/Widget to platform/FrameViewBase in platform. Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 FrameViewBase* FrameViewBase::root() const { 51 FrameViewBase* FrameViewBase::root() const {
52 const FrameViewBase* top = this; 52 const FrameViewBase* top = this;
53 while (top->parent()) 53 while (top->parent())
54 top = top->parent(); 54 top = top->parent();
55 if (top->isFrameView()) 55 if (top->isFrameView())
56 return const_cast<FrameViewBase*>(static_cast<const FrameViewBase*>(top)); 56 return const_cast<FrameViewBase*>(static_cast<const FrameViewBase*>(top));
57 return 0; 57 return 0;
58 } 58 }
59 59
60 IntRect FrameViewBase::convertFromRootFrame(const IntRect& rectInRootFrame) cons t { 60 IntRect FrameViewBase::convertFromRootFrame(
61 const IntRect& rectInRootFrame) const {
61 if (const FrameViewBase* parentFrameViewBase = parent()) { 62 if (const FrameViewBase* parentFrameViewBase = parent()) {
62 IntRect parentRect = parentFrameViewBase->convertFromRootFrame(rectInRootFra me); 63 IntRect parentRect =
64 parentFrameViewBase->convertFromRootFrame(rectInRootFrame);
63 return convertFromContainingWidget(parentRect); 65 return convertFromContainingWidget(parentRect);
64 } 66 }
65 return rectInRootFrame; 67 return rectInRootFrame;
66 } 68 }
67 69
68 IntRect FrameViewBase::convertToRootFrame(const IntRect& localRect) const { 70 IntRect FrameViewBase::convertToRootFrame(const IntRect& localRect) const {
69 if (const FrameViewBase* parentFrameViewBase = parent()) { 71 if (const FrameViewBase* parentFrameViewBase = parent()) {
70 IntRect parentRect = convertToContainingWidget(localRect); 72 IntRect parentRect = convertToContainingWidget(localRect);
71 return parentFrameViewBase->convertToRootFrame(parentRect); 73 return parentFrameViewBase->convertToRootFrame(parentRect);
72 } 74 }
73 return localRect; 75 return localRect;
74 } 76 }
75 77
76 IntPoint FrameViewBase::convertFromRootFrame(const IntPoint& pointInRootFrame) c onst { 78 IntPoint FrameViewBase::convertFromRootFrame(
79 const IntPoint& pointInRootFrame) const {
77 if (const FrameViewBase* parentFrameViewBase = parent()) { 80 if (const FrameViewBase* parentFrameViewBase = parent()) {
78 IntPoint parentPoint = parentFrameViewBase->convertFromRootFrame(pointInRoot Frame); 81 IntPoint parentPoint =
82 parentFrameViewBase->convertFromRootFrame(pointInRootFrame);
79 return convertFromContainingWidget(parentPoint); 83 return convertFromContainingWidget(parentPoint);
80 } 84 }
81 return pointInRootFrame; 85 return pointInRootFrame;
82 } 86 }
83 87
84 FloatPoint FrameViewBase::convertFromRootFrame( 88 FloatPoint FrameViewBase::convertFromRootFrame(
85 const FloatPoint& pointInRootFrame) const { 89 const FloatPoint& pointInRootFrame) const {
86 // FrameViewBase / windows are required to be IntPoint aligned, but we may nee d to 90 // FrameViewBase / windows are required to be IntPoint aligned, but we may
87 // convert FloatPoint values within them (eg. for event co-ordinates). 91 // need to convert FloatPoint values within them (eg. for event co-ordinates).
88 IntPoint flooredPoint = flooredIntPoint(pointInRootFrame); 92 IntPoint flooredPoint = flooredIntPoint(pointInRootFrame);
89 FloatPoint parentPoint = this->convertFromRootFrame(flooredPoint); 93 FloatPoint parentPoint = this->convertFromRootFrame(flooredPoint);
90 FloatSize windowFraction = pointInRootFrame - flooredPoint; 94 FloatSize windowFraction = pointInRootFrame - flooredPoint;
91 // Use linear interpolation handle any fractional value (eg. for iframes 95 // Use linear interpolation handle any fractional value (eg. for iframes
92 // subject to a transform beyond just a simple translation). 96 // subject to a transform beyond just a simple translation).
93 // FIXME: Add FloatPoint variants of all co-ordinate space conversion APIs. 97 // FIXME: Add FloatPoint variants of all co-ordinate space conversion APIs.
94 if (!windowFraction.isEmpty()) { 98 if (!windowFraction.isEmpty()) {
95 const int kFactor = 1000; 99 const int kFactor = 1000;
96 IntPoint parentLineEnd = this->convertFromRootFrame( 100 IntPoint parentLineEnd = this->convertFromRootFrame(
97 flooredPoint + roundedIntSize(windowFraction.scaledBy(kFactor))); 101 flooredPoint + roundedIntSize(windowFraction.scaledBy(kFactor)));
98 FloatSize parentFraction = 102 FloatSize parentFraction =
99 (parentLineEnd - parentPoint).scaledBy(1.0f / kFactor); 103 (parentLineEnd - parentPoint).scaledBy(1.0f / kFactor);
100 parentPoint.move(parentFraction); 104 parentPoint.move(parentFraction);
101 } 105 }
102 return parentPoint; 106 return parentPoint;
103 } 107 }
104 108
105 IntPoint FrameViewBase::convertToRootFrame(const IntPoint& localPoint) const { 109 IntPoint FrameViewBase::convertToRootFrame(const IntPoint& localPoint) const {
106 if (const FrameViewBase* parentFrameViewBase = parent()) { 110 if (const FrameViewBase* parentFrameViewBase = parent()) {
107 IntPoint parentPoint = convertToContainingWidget(localPoint); 111 IntPoint parentPoint = convertToContainingWidget(localPoint);
108 return parentFrameViewBase->convertToRootFrame(parentPoint); 112 return parentFrameViewBase->convertToRootFrame(parentPoint);
109 } 113 }
110 return localPoint; 114 return localPoint;
111 } 115 }
112 116
113 IntRect FrameViewBase::convertToContainingWidget(const IntRect& localRect) const { 117 IntRect FrameViewBase::convertToContainingWidget(
118 const IntRect& localRect) const {
114 if (const FrameViewBase* parentFrameViewBase = parent()) { 119 if (const FrameViewBase* parentFrameViewBase = parent()) {
115 IntRect parentRect(localRect); 120 IntRect parentRect(localRect);
116 parentRect.setLocation( 121 parentRect.setLocation(
117 parentFrameViewBase->convertChildToSelf(this, localRect.location())); 122 parentFrameViewBase->convertChildToSelf(this, localRect.location()));
118 return parentRect; 123 return parentRect;
119 } 124 }
120 return localRect; 125 return localRect;
121 } 126 }
122 127
123 IntRect FrameViewBase::convertFromContainingWidget(const IntRect& parentRect) co nst { 128 IntRect FrameViewBase::convertFromContainingWidget(
129 const IntRect& parentRect) const {
124 if (const FrameViewBase* parentFrameViewBase = parent()) { 130 if (const FrameViewBase* parentFrameViewBase = parent()) {
125 IntRect localRect = parentRect; 131 IntRect localRect = parentRect;
126 localRect.setLocation( 132 localRect.setLocation(
127 parentFrameViewBase->convertSelfToChild(this, localRect.location())); 133 parentFrameViewBase->convertSelfToChild(this, localRect.location()));
128 return localRect; 134 return localRect;
129 } 135 }
130 136
131 return parentRect; 137 return parentRect;
132 } 138 }
133 139
134 IntPoint FrameViewBase::convertToContainingWidget(const IntPoint& localPoint) co nst { 140 IntPoint FrameViewBase::convertToContainingWidget(
141 const IntPoint& localPoint) const {
135 if (const FrameViewBase* parentFrameViewBase = parent()) 142 if (const FrameViewBase* parentFrameViewBase = parent())
136 return parentFrameViewBase->convertChildToSelf(this, localPoint); 143 return parentFrameViewBase->convertChildToSelf(this, localPoint);
137 144
138 return localPoint; 145 return localPoint;
139 } 146 }
140 147
141 IntPoint FrameViewBase::convertFromContainingWidget( 148 IntPoint FrameViewBase::convertFromContainingWidget(
142 const IntPoint& parentPoint) const { 149 const IntPoint& parentPoint) const {
143 if (const FrameViewBase* parentFrameViewBase = parent()) 150 if (const FrameViewBase* parentFrameViewBase = parent())
144 return parentFrameViewBase->convertSelfToChild(this, parentPoint); 151 return parentFrameViewBase->convertSelfToChild(this, parentPoint);
145 152
146 return parentPoint; 153 return parentPoint;
147 } 154 }
148 155
149 IntPoint FrameViewBase::convertChildToSelf(const FrameViewBase*, 156 IntPoint FrameViewBase::convertChildToSelf(const FrameViewBase*,
150 const IntPoint& point) const { 157 const IntPoint& point) const {
151 return point; 158 return point;
152 } 159 }
153 160
154 IntPoint FrameViewBase::convertSelfToChild(const FrameViewBase*, 161 IntPoint FrameViewBase::convertSelfToChild(const FrameViewBase*,
155 const IntPoint& point) const { 162 const IntPoint& point) const {
156 return point; 163 return point;
157 } 164 }
158 165
159 } // namespace blink 166 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/FrameViewBase.h ('k') | third_party/WebKit/Source/platform/HostWindow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698