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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp

Issue 2630783002: Remove |success| parameter from GeometryMapper's public methods (Closed)
Patch Set: Rebase Created 3 years, 11 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) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Robert O'Callahan <roc+@cs.cmu.edu> 8 * Robert O'Callahan <roc+@cs.cmu.edu>
9 * David Baron <dbaron@fas.harvard.edu> 9 * David Baron <dbaron@fas.harvard.edu>
10 * Christian Biesinger <cbiesinger@web.de> 10 * Christian Biesinger <cbiesinger@web.de>
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 208
209 LayoutRect PaintLayerClipper::localClipRect( 209 LayoutRect PaintLayerClipper::localClipRect(
210 const PaintLayer* clippingRootLayer) const { 210 const PaintLayer* clippingRootLayer) const {
211 ClipRectsContext context(clippingRootLayer, PaintingClipRects); 211 ClipRectsContext context(clippingRootLayer, PaintingClipRects);
212 if (m_geometryMapper) { 212 if (m_geometryMapper) {
213 ClipRect clipRect = applyOverflowClipToBackgroundRectWithGeometryMapper( 213 ClipRect clipRect = applyOverflowClipToBackgroundRectWithGeometryMapper(
214 context, clipRectWithGeometryMapper(context, false)); 214 context, clipRectWithGeometryMapper(context, false));
215 215
216 // The rect now needs to be transformed to the local space of this 216 // The rect now needs to be transformed to the local space of this
217 // PaintLayer. 217 // PaintLayer.
218 bool success = false;
219 const auto* clipRootLayerTransform = clippingRootLayer->layoutObject() 218 const auto* clipRootLayerTransform = clippingRootLayer->layoutObject()
220 ->paintProperties() 219 ->paintProperties()
221 ->localBorderBoxProperties() 220 ->localBorderBoxProperties()
222 ->transform(); 221 ->transform();
223 const auto* layerTransform = m_layer.layoutObject() 222 const auto* layerTransform = m_layer.layoutObject()
224 ->paintProperties() 223 ->paintProperties()
225 ->localBorderBoxProperties() 224 ->localBorderBoxProperties()
226 ->transform(); 225 ->transform();
227 FloatRect clippedRectInLocalSpace = 226 FloatRect clippedRectInLocalSpace =
228 m_geometryMapper->sourceToDestinationRect(FloatRect(clipRect.rect()), 227 m_geometryMapper->sourceToDestinationRect(
229 clipRootLayerTransform, 228 FloatRect(clipRect.rect()), clipRootLayerTransform, layerTransform);
230 layerTransform, success);
231 DCHECK(success);
232 229
233 return LayoutRect(clippedRectInLocalSpace); 230 return LayoutRect(clippedRectInLocalSpace);
234 } 231 }
235 232
236 LayoutRect layerBounds; 233 LayoutRect layerBounds;
237 ClipRect backgroundRect, foregroundRect; 234 ClipRect backgroundRect, foregroundRect;
238 calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()), 235 calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()),
239 layerBounds, backgroundRect, foregroundRect); 236 layerBounds, backgroundRect, foregroundRect);
240 237
241 LayoutRect clipRect = backgroundRect.rect(); 238 LayoutRect clipRect = backgroundRect.rect();
(...skipping 11 matching lines...) Expand all
253 #ifdef CHECK_CLIP_RECTS 250 #ifdef CHECK_CLIP_RECTS
254 #define CHECK_RECTS_EQ(expected, actual) \ 251 #define CHECK_RECTS_EQ(expected, actual) \
255 CHECK((expected.isEmpty() && actual.isEmpty()) || expected == actual) \ 252 CHECK((expected.isEmpty() && actual.isEmpty()) || expected == actual) \
256 << "expected=" << expected.toString() << " actual=" << actual.toString() 253 << "expected=" << expected.toString() << " actual=" << actual.toString()
257 #endif 254 #endif
258 255
259 void PaintLayerClipper::mapLocalToRootWithGeometryMapper( 256 void PaintLayerClipper::mapLocalToRootWithGeometryMapper(
260 const ClipRectsContext& context, 257 const ClipRectsContext& context,
261 LayoutRect& layoutRect) const { 258 LayoutRect& layoutRect) const {
262 DCHECK(m_geometryMapper); 259 DCHECK(m_geometryMapper);
263 bool success;
264 260
265 const auto* layerTransform = m_layer.layoutObject() 261 const auto* layerTransform = m_layer.layoutObject()
266 ->paintProperties() 262 ->paintProperties()
267 ->localBorderBoxProperties() 263 ->localBorderBoxProperties()
268 ->transform(); 264 ->transform();
269 const auto* rootTransform = context.rootLayer->layoutObject() 265 const auto* rootTransform = context.rootLayer->layoutObject()
270 ->paintProperties() 266 ->paintProperties()
271 ->localBorderBoxProperties() 267 ->localBorderBoxProperties()
272 ->transform(); 268 ->transform();
273 269
274 FloatRect localRect(layoutRect); 270 FloatRect localRect(layoutRect);
275 localRect.moveBy(FloatPoint(m_layer.layoutObject()->paintOffset())); 271 localRect.moveBy(FloatPoint(m_layer.layoutObject()->paintOffset()));
276 layoutRect = LayoutRect(m_geometryMapper->sourceToDestinationRect( 272 layoutRect = LayoutRect(m_geometryMapper->sourceToDestinationRect(
277 localRect, layerTransform, rootTransform, success)); 273 localRect, layerTransform, rootTransform));
278 DCHECK(success);
279 } 274 }
280 275
281 void PaintLayerClipper::calculateRectsWithGeometryMapper( 276 void PaintLayerClipper::calculateRectsWithGeometryMapper(
282 const ClipRectsContext& context, 277 const ClipRectsContext& context,
283 const LayoutRect& paintDirtyRect, 278 const LayoutRect& paintDirtyRect,
284 LayoutRect& layerBounds, 279 LayoutRect& layerBounds,
285 ClipRect& backgroundRect, 280 ClipRect& backgroundRect,
286 ClipRect& foregroundRect, 281 ClipRect& foregroundRect,
287 const LayoutPoint* offsetFromRoot) const { 282 const LayoutPoint* offsetFromRoot) const {
288 backgroundRect = applyOverflowClipToBackgroundRectWithGeometryMapper( 283 backgroundRect = applyOverflowClipToBackgroundRectWithGeometryMapper(
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 return parentRects.posClipRect(); 428 return parentRects.posClipRect();
434 429
435 return parentRects.overflowClipRect(); 430 return parentRects.overflowClipRect();
436 } 431 }
437 432
438 ClipRect PaintLayerClipper::clipRectWithGeometryMapper( 433 ClipRect PaintLayerClipper::clipRectWithGeometryMapper(
439 const ClipRectsContext& context, 434 const ClipRectsContext& context,
440 bool isForeground) const { 435 bool isForeground) const {
441 DCHECK(m_geometryMapper); 436 DCHECK(m_geometryMapper);
442 LayoutRect source(LayoutRect::infiniteIntRect()); 437 LayoutRect source(LayoutRect::infiniteIntRect());
443 bool success = false;
444 const auto* properties = m_layer.layoutObject()->paintProperties(); 438 const auto* properties = m_layer.layoutObject()->paintProperties();
445 DCHECK(properties && properties->localBorderBoxProperties()); 439 DCHECK(properties && properties->localBorderBoxProperties());
446 PropertyTreeState propertyTreeState = *properties->localBorderBoxProperties(); 440 PropertyTreeState propertyTreeState = *properties->localBorderBoxProperties();
447 441
448 if (isForeground && shouldClipOverflow(context) && properties->overflowClip()) 442 if (isForeground && shouldClipOverflow(context) && properties->overflowClip())
449 propertyTreeState.setClip(properties->overflowClip()); 443 propertyTreeState.setClip(properties->overflowClip());
450 444
451 const auto* ancestorProperties = 445 const auto* ancestorProperties =
452 context.rootLayer->layoutObject()->paintProperties(); 446 context.rootLayer->layoutObject()->paintProperties();
453 DCHECK(ancestorProperties && ancestorProperties->localBorderBoxProperties()); 447 DCHECK(ancestorProperties && ancestorProperties->localBorderBoxProperties());
454 PropertyTreeState destinationPropertyTreeState = 448 PropertyTreeState destinationPropertyTreeState =
455 *ancestorProperties->localBorderBoxProperties(); 449 *ancestorProperties->localBorderBoxProperties();
456 if (!context.rootLayer->clipper().shouldRespectOverflowClip(context)) { 450 if (!context.rootLayer->clipper().shouldRespectOverflowClip(context)) {
457 if (ancestorProperties->overflowClip()) 451 if (ancestorProperties->overflowClip())
458 destinationPropertyTreeState.setClip(ancestorProperties->overflowClip()); 452 destinationPropertyTreeState.setClip(ancestorProperties->overflowClip());
459 } 453 }
460 FloatRect clippedRectInRootLayerSpace = 454 FloatRect clippedRectInRootLayerSpace =
461 m_geometryMapper->sourceToDestinationVisualRect( 455 m_geometryMapper->sourceToDestinationVisualRect(
462 FloatRect(source), propertyTreeState, destinationPropertyTreeState, 456 FloatRect(source), propertyTreeState, destinationPropertyTreeState);
463 success);
464 DCHECK(success);
465 return ClipRect(LayoutRect(clippedRectInRootLayerSpace)); 457 return ClipRect(LayoutRect(clippedRectInRootLayerSpace));
466 } 458 }
467 459
468 ClipRect PaintLayerClipper::applyOverflowClipToBackgroundRectWithGeometryMapper( 460 ClipRect PaintLayerClipper::applyOverflowClipToBackgroundRectWithGeometryMapper(
469 const ClipRectsContext& context, 461 const ClipRectsContext& context,
470 const ClipRect& clip) const { 462 const ClipRect& clip) const {
471 const LayoutObject& layoutObject = *m_layer.layoutObject(); 463 const LayoutObject& layoutObject = *m_layer.layoutObject();
472 FloatRect clipRect(clip.rect()); 464 FloatRect clipRect(clip.rect());
473 if (shouldClipOverflow(context)) { 465 if (shouldClipOverflow(context)) {
474 LayoutRect layerBoundsWithVisualOverflow = 466 LayoutRect layerBoundsWithVisualOverflow =
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 const LayoutSize& subpixelAccumulation) const { 550 const LayoutSize& subpixelAccumulation) const {
559 DCHECK(!m_geometryMapper); 551 DCHECK(!m_geometryMapper);
560 ClipRectsContext context(rootLayer, PaintingClipRects, 552 ClipRectsContext context(rootLayer, PaintingClipRects,
561 IgnoreOverlayScrollbarSize, subpixelAccumulation); 553 IgnoreOverlayScrollbarSize, subpixelAccumulation);
562 if (respectOverflowClip == IgnoreOverflowClip) 554 if (respectOverflowClip == IgnoreOverflowClip)
563 context.setIgnoreOverflowClip(); 555 context.setIgnoreOverflowClip();
564 return getClipRects(context); 556 return getClipRects(context);
565 } 557 }
566 558
567 } // namespace blink 559 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698