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

Side by Side Diff: third_party/WebKit/Source/platform/geometry/LayoutRect.h

Issue 1817693002: Support edge-inclusive intersections in mapToVisibleRectInAncestorSpace (Closed) Base URL: https://chromium.googlesource.com/chromium/src@intersection-observer-idle-callback
Patch Set: more tests Created 4 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 unified diff | Download patch
OLDNEW
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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // This checks to see if the rect contains x,y in the traditional sense. 157 // This checks to see if the rect contains x,y in the traditional sense.
158 // Equivalent to checking if the rect contains a 1x1 rect below and to the r ight of (px,py). 158 // Equivalent to checking if the rect contains a 1x1 rect below and to the r ight of (px,py).
159 bool contains(LayoutUnit px, LayoutUnit py) const 159 bool contains(LayoutUnit px, LayoutUnit py) const
160 { return px >= x() && px < maxX() && py >= y() && py < maxY(); } 160 { return px >= x() && px < maxX() && py >= y() && py < maxY(); }
161 bool contains(const LayoutPoint& point) const { return contains(point.x(), p oint.y()); } 161 bool contains(const LayoutPoint& point) const { return contains(point.x(), p oint.y()); }
162 162
163 void intersect(const LayoutRect&); 163 void intersect(const LayoutRect&);
164 void unite(const LayoutRect&); 164 void unite(const LayoutRect&);
165 void uniteIfNonZero(const LayoutRect&); 165 void uniteIfNonZero(const LayoutRect&);
166 166
167 // Set this rect to be the intersection of itself and the argument rect
168 // using edge-inclusive geometry. If the two rectangles overlap but the
169 // overlap region is zero-area (either because one of the two rectangles
170 // is zero-area, or because the rectangles overlap at an edge or a corner),
171 // the result is the zero-area intersection. The return value indicates
172 // whether the two rectangle actually have an intersection, since checking
173 // the result for isEmpty() is not conclusive.
174 bool inclusiveIntersect(const LayoutRect&);
175
167 // Besides non-empty rects, this method also unites empty rects (as points o r line segments). 176 // Besides non-empty rects, this method also unites empty rects (as points o r line segments).
168 // For example, union of (100, 100, 0x0) and (200, 200, 50x0) is (100, 100, 150x100). 177 // For example, union of (100, 100, 0x0) and (200, 200, 50x0) is (100, 100, 150x100).
169 void uniteEvenIfEmpty(const LayoutRect&); 178 void uniteEvenIfEmpty(const LayoutRect&);
170 179
171 void inflateX(LayoutUnit dx) 180 void inflateX(LayoutUnit dx)
172 { 181 {
173 m_location.setX(m_location.x() - dx); 182 m_location.setX(m_location.x() - dx);
174 m_size.setWidth(m_size.width() + dx + dx); 183 m_size.setWidth(m_size.width() + dx + dx);
175 } 184 }
176 void inflateY(LayoutUnit dy) 185 void inflateY(LayoutUnit dy)
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 return IntRect(roundedIntPoint(location), pixelSnappedIntSize(size, location )); 272 return IntRect(roundedIntPoint(location), pixelSnappedIntSize(size, location ));
264 } 273 }
265 274
266 // Redeclared here to avoid ODR issues. 275 // Redeclared here to avoid ODR issues.
267 // See platform/testing/GeometryPrinters.h. 276 // See platform/testing/GeometryPrinters.h.
268 void PrintTo(const LayoutRect&, std::ostream*); 277 void PrintTo(const LayoutRect&, std::ostream*);
269 278
270 } // namespace blink 279 } // namespace blink
271 280
272 #endif // LayoutRect_h 281 #endif // LayoutRect_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698