OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012, Google Inc. All rights reserved. | 2 * Copyright (c) 2012, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 m_location.scale(s, s); | 135 m_location.scale(s, s); |
136 m_size.scale(s); | 136 m_size.scale(s); |
137 } | 137 } |
138 | 138 |
139 void LayoutRect::scale(float xAxisScale, float yAxisScale) | 139 void LayoutRect::scale(float xAxisScale, float yAxisScale) |
140 { | 140 { |
141 m_location.scale(xAxisScale, yAxisScale); | 141 m_location.scale(xAxisScale, yAxisScale); |
142 m_size.scale(xAxisScale, yAxisScale); | 142 m_size.scale(xAxisScale, yAxisScale); |
143 } | 143 } |
144 | 144 |
145 #ifndef NDEBUG | |
146 void LayoutRect::show(bool showRawValue) const | |
147 { | |
148 if (showRawValue) | |
149 printf("Rect (in raw layout units): [x=%d y=%d maxX=%d maxY=%d]\n", x(). rawValue(), y().rawValue(), maxX().rawValue(), maxY().rawValue()); | |
wkorman
2016/08/19 22:18:44
Are layout folks ok with losing the raw value view
pdr.
2016/08/19 23:21:15
This is a good point, but I think we're covered wi
| |
150 else | |
151 printf("Rect (in pixels): [x=%lf y=%lf maxX=%lf maxY=%lf]\n", x().toDoub le(), y().toDouble(), maxX().toDouble(), maxY().toDouble()); | |
152 } | |
153 | |
154 String LayoutRect::toString() const | |
155 { | |
156 return String::format("%s %s", location().toString().ascii().data(), size(). toString().ascii().data()); | |
157 } | |
158 #endif | |
159 | |
160 LayoutRect unionRect(const Vector<LayoutRect>& rects) | 145 LayoutRect unionRect(const Vector<LayoutRect>& rects) |
161 { | 146 { |
162 LayoutRect result; | 147 LayoutRect result; |
163 | 148 |
164 size_t count = rects.size(); | 149 size_t count = rects.size(); |
165 for (size_t i = 0; i < count; ++i) | 150 for (size_t i = 0; i < count; ++i) |
166 result.unite(rects[i]); | 151 result.unite(rects[i]); |
167 | 152 |
168 return result; | 153 return result; |
169 } | 154 } |
(...skipping 19 matching lines...) Expand all Loading... | |
189 return IntRect(location, maxPoint - location); | 174 return IntRect(location, maxPoint - location); |
190 } | 175 } |
191 | 176 |
192 LayoutRect enclosingLayoutRect(const FloatRect& rect) | 177 LayoutRect enclosingLayoutRect(const FloatRect& rect) |
193 { | 178 { |
194 LayoutPoint location = flooredLayoutPoint(rect.minXMinYCorner()); | 179 LayoutPoint location = flooredLayoutPoint(rect.minXMinYCorner()); |
195 LayoutPoint maxPoint = ceiledLayoutPoint(rect.maxXMaxYCorner()); | 180 LayoutPoint maxPoint = ceiledLayoutPoint(rect.maxXMaxYCorner()); |
196 return LayoutRect(location, maxPoint - location); | 181 return LayoutRect(location, maxPoint - location); |
197 } | 182 } |
198 | 183 |
184 String LayoutRect::toString() const | |
185 { | |
186 return String::format("%s %s", | |
187 location().toString().ascii().data(), | |
188 size().toString().ascii().data()); | |
189 } | |
190 | |
199 } // namespace blink | 191 } // namespace blink |
OLD | NEW |