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

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

Issue 2730773003: Rename FrameViewBase fields and methods *Widget* to ...FrameViewBase... (Closed)
Patch Set: 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
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( 60 IntRect FrameViewBase::convertFromRootFrame(
61 const IntRect& rectInRootFrame) const { 61 const IntRect& rectInRootFrame) const {
62 if (const FrameViewBase* parentFrameViewBase = parent()) { 62 if (const FrameViewBase* parentFrameViewBase = parent()) {
63 IntRect parentRect = 63 IntRect parentRect =
64 parentFrameViewBase->convertFromRootFrame(rectInRootFrame); 64 parentFrameViewBase->convertFromRootFrame(rectInRootFrame);
65 return convertFromContainingWidget(parentRect); 65 return convertFromContainingFrameViewBase(parentRect);
66 } 66 }
67 return rectInRootFrame; 67 return rectInRootFrame;
68 } 68 }
69 69
70 IntRect FrameViewBase::convertToRootFrame(const IntRect& localRect) const { 70 IntRect FrameViewBase::convertToRootFrame(const IntRect& localRect) const {
71 if (const FrameViewBase* parentFrameViewBase = parent()) { 71 if (const FrameViewBase* parentFrameViewBase = parent()) {
72 IntRect parentRect = convertToContainingWidget(localRect); 72 IntRect parentRect = convertToContainingFrameViewBase(localRect);
73 return parentFrameViewBase->convertToRootFrame(parentRect); 73 return parentFrameViewBase->convertToRootFrame(parentRect);
74 } 74 }
75 return localRect; 75 return localRect;
76 } 76 }
77 77
78 IntPoint FrameViewBase::convertFromRootFrame( 78 IntPoint FrameViewBase::convertFromRootFrame(
79 const IntPoint& pointInRootFrame) const { 79 const IntPoint& pointInRootFrame) const {
80 if (const FrameViewBase* parentFrameViewBase = parent()) { 80 if (const FrameViewBase* parentFrameViewBase = parent()) {
81 IntPoint parentPoint = 81 IntPoint parentPoint =
82 parentFrameViewBase->convertFromRootFrame(pointInRootFrame); 82 parentFrameViewBase->convertFromRootFrame(pointInRootFrame);
83 return convertFromContainingWidget(parentPoint); 83 return convertFromContainingFrameViewBase(parentPoint);
84 } 84 }
85 return pointInRootFrame; 85 return pointInRootFrame;
86 } 86 }
87 87
88 FloatPoint FrameViewBase::convertFromRootFrame( 88 FloatPoint FrameViewBase::convertFromRootFrame(
89 const FloatPoint& pointInRootFrame) const { 89 const FloatPoint& pointInRootFrame) const {
90 // FrameViewBase / windows are required to be IntPoint aligned, but we may 90 // FrameViewBase / windows are required to be IntPoint aligned, but we may
91 // need to convert FloatPoint values within them (eg. for event co-ordinates). 91 // need to convert FloatPoint values within them (eg. for event co-ordinates).
92 IntPoint flooredPoint = flooredIntPoint(pointInRootFrame); 92 IntPoint flooredPoint = flooredIntPoint(pointInRootFrame);
93 FloatPoint parentPoint = this->convertFromRootFrame(flooredPoint); 93 FloatPoint parentPoint = this->convertFromRootFrame(flooredPoint);
94 FloatSize windowFraction = pointInRootFrame - flooredPoint; 94 FloatSize windowFraction = pointInRootFrame - flooredPoint;
95 // Use linear interpolation handle any fractional value (eg. for iframes 95 // Use linear interpolation handle any fractional value (eg. for iframes
96 // subject to a transform beyond just a simple translation). 96 // subject to a transform beyond just a simple translation).
97 // FIXME: Add FloatPoint variants of all co-ordinate space conversion APIs. 97 // FIXME: Add FloatPoint variants of all co-ordinate space conversion APIs.
98 if (!windowFraction.isEmpty()) { 98 if (!windowFraction.isEmpty()) {
99 const int kFactor = 1000; 99 const int kFactor = 1000;
100 IntPoint parentLineEnd = this->convertFromRootFrame( 100 IntPoint parentLineEnd = this->convertFromRootFrame(
101 flooredPoint + roundedIntSize(windowFraction.scaledBy(kFactor))); 101 flooredPoint + roundedIntSize(windowFraction.scaledBy(kFactor)));
102 FloatSize parentFraction = 102 FloatSize parentFraction =
103 (parentLineEnd - parentPoint).scaledBy(1.0f / kFactor); 103 (parentLineEnd - parentPoint).scaledBy(1.0f / kFactor);
104 parentPoint.move(parentFraction); 104 parentPoint.move(parentFraction);
105 } 105 }
106 return parentPoint; 106 return parentPoint;
107 } 107 }
108 108
109 IntPoint FrameViewBase::convertToRootFrame(const IntPoint& localPoint) const { 109 IntPoint FrameViewBase::convertToRootFrame(const IntPoint& localPoint) const {
110 if (const FrameViewBase* parentFrameViewBase = parent()) { 110 if (const FrameViewBase* parentFrameViewBase = parent()) {
111 IntPoint parentPoint = convertToContainingWidget(localPoint); 111 IntPoint parentPoint = convertToContainingFrameViewBase(localPoint);
112 return parentFrameViewBase->convertToRootFrame(parentPoint); 112 return parentFrameViewBase->convertToRootFrame(parentPoint);
113 } 113 }
114 return localPoint; 114 return localPoint;
115 } 115 }
116 116
117 IntRect FrameViewBase::convertToContainingWidget( 117 IntRect FrameViewBase::convertToContainingFrameViewBase(
118 const IntRect& localRect) const { 118 const IntRect& localRect) const {
119 if (const FrameViewBase* parentFrameViewBase = parent()) { 119 if (const FrameViewBase* parentFrameViewBase = parent()) {
120 IntRect parentRect(localRect); 120 IntRect parentRect(localRect);
121 parentRect.setLocation( 121 parentRect.setLocation(
122 parentFrameViewBase->convertChildToSelf(this, localRect.location())); 122 parentFrameViewBase->convertChildToSelf(this, localRect.location()));
123 return parentRect; 123 return parentRect;
124 } 124 }
125 return localRect; 125 return localRect;
126 } 126 }
127 127
128 IntRect FrameViewBase::convertFromContainingWidget( 128 IntRect FrameViewBase::convertFromContainingFrameViewBase(
129 const IntRect& parentRect) const { 129 const IntRect& parentRect) const {
130 if (const FrameViewBase* parentFrameViewBase = parent()) { 130 if (const FrameViewBase* parentFrameViewBase = parent()) {
131 IntRect localRect = parentRect; 131 IntRect localRect = parentRect;
132 localRect.setLocation( 132 localRect.setLocation(
133 parentFrameViewBase->convertSelfToChild(this, localRect.location())); 133 parentFrameViewBase->convertSelfToChild(this, localRect.location()));
134 return localRect; 134 return localRect;
135 } 135 }
136 136
137 return parentRect; 137 return parentRect;
138 } 138 }
139 139
140 IntPoint FrameViewBase::convertToContainingWidget( 140 IntPoint FrameViewBase::convertToContainingFrameViewBase(
141 const IntPoint& localPoint) const { 141 const IntPoint& localPoint) const {
142 if (const FrameViewBase* parentFrameViewBase = parent()) 142 if (const FrameViewBase* parentFrameViewBase = parent())
143 return parentFrameViewBase->convertChildToSelf(this, localPoint); 143 return parentFrameViewBase->convertChildToSelf(this, localPoint);
144 144
145 return localPoint; 145 return localPoint;
146 } 146 }
147 147
148 IntPoint FrameViewBase::convertFromContainingWidget( 148 IntPoint FrameViewBase::convertFromContainingFrameViewBase(
149 const IntPoint& parentPoint) const { 149 const IntPoint& parentPoint) const {
150 if (const FrameViewBase* parentFrameViewBase = parent()) 150 if (const FrameViewBase* parentFrameViewBase = parent())
151 return parentFrameViewBase->convertSelfToChild(this, parentPoint); 151 return parentFrameViewBase->convertSelfToChild(this, parentPoint);
152 152
153 return parentPoint; 153 return parentPoint;
154 } 154 }
155 155
156 IntPoint FrameViewBase::convertChildToSelf(const FrameViewBase*, 156 IntPoint FrameViewBase::convertChildToSelf(const FrameViewBase*,
157 const IntPoint& point) const { 157 const IntPoint& point) const {
158 return point; 158 return point;
159 } 159 }
160 160
161 IntPoint FrameViewBase::convertSelfToChild(const FrameViewBase*, 161 IntPoint FrameViewBase::convertSelfToChild(const FrameViewBase*,
162 const IntPoint& point) const { 162 const IntPoint& point) const {
163 return point; 163 return point;
164 } 164 }
165 165
166 } // namespace blink 166 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/FrameViewBase.h ('k') | third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698