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

Side by Side Diff: Source/core/paint/DeprecatedPaintLayer.cpp

Issue 1307203004: Revert "Reworks the clipping logic" and follow-up. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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 reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 369
370 bool hadTransform = m_transform; 370 bool hadTransform = m_transform;
371 if (hasTransform != hadTransform) { 371 if (hasTransform != hadTransform) {
372 if (hasTransform) 372 if (hasTransform)
373 m_transform = adoptPtr(new TransformationMatrix); 373 m_transform = adoptPtr(new TransformationMatrix);
374 else 374 else
375 m_transform.clear(); 375 m_transform.clear();
376 376
377 // DeprecatedPaintLayers with transforms act as clip rects roots, so cle ar the cached clip rects here. 377 // DeprecatedPaintLayers with transforms act as clip rects roots, so cle ar the cached clip rects here.
378 m_clipper.clearClipRectsIncludingDescendants(); 378 m_clipper.clearClipRectsIncludingDescendants();
379 } else if (hasTransform) {
380 m_clipper.clearClipRectsIncludingDescendants(AbsoluteClipRects);
379 } 381 }
380 382
381 updateTransformationMatrix(); 383 updateTransformationMatrix();
382 384
383 if (had3DTransform != has3DTransform()) 385 if (had3DTransform != has3DTransform())
384 dirty3DTransformedDescendantStatus(); 386 dirty3DTransformedDescendantStatus();
385 } 387 }
386 388
387 static DeprecatedPaintLayer* enclosingLayerForContainingBlock(DeprecatedPaintLay er* layer) 389 static DeprecatedPaintLayer* enclosingLayerForContainingBlock(DeprecatedPaintLay er* layer)
388 { 390 {
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 appendSingleFragmentIgnoringPagination(fragments, rootLayer, dirtyRect, clipRectsCacheSlot, inOverlayScrollbarSizeRelevancy, respectOverflowClip, offset FromRoot, subPixelAccumulation); 1395 appendSingleFragmentIgnoringPagination(fragments, rootLayer, dirtyRect, clipRectsCacheSlot, inOverlayScrollbarSizeRelevancy, respectOverflowClip, offset FromRoot, subPixelAccumulation);
1394 return; 1396 return;
1395 } 1397 }
1396 1398
1397 // Compute our offset within the enclosing pagination layer. 1399 // Compute our offset within the enclosing pagination layer.
1398 LayoutPoint offsetWithinPaginatedLayer; 1400 LayoutPoint offsetWithinPaginatedLayer;
1399 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer) ; 1401 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer) ;
1400 1402
1401 // Calculate clip rects relative to the enclosingPaginationLayer. The purpos e of this call is to determine our bounds clipped to intermediate 1403 // Calculate clip rects relative to the enclosingPaginationLayer. The purpos e of this call is to determine our bounds clipped to intermediate
1402 // layers between us and the pagination context. It's important to minimize the number of fragments we need to create and this helps with that. 1404 // layers between us and the pagination context. It's important to minimize the number of fragments we need to create and this helps with that.
1403 // This code uses a non-standard root layer, which can populate our cache wi th unexpected values. 1405 ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), clip RectsCacheSlot, inOverlayScrollbarSizeRelevancy);
1404 // Thus we bypass the clip rect cache by ignoring |clipRectsCacheSlot| and p assing UncachedClipRects.
1405 // TODO(chadarmstrong): If possible, this code should use the cache (one way would be by computing the root layer relative to |clipRectsCacheSlot|).
1406 ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), Unca chedClipRects, inOverlayScrollbarSizeRelevancy);
1407 if (respectOverflowClip == IgnoreOverflowClip) 1406 if (respectOverflowClip == IgnoreOverflowClip)
1408 paginationClipRectsContext.setIgnoreOverflowClip(); 1407 paginationClipRectsContext.setIgnoreOverflowClip();
1409 LayoutRect layerBoundsInFlowThread; 1408 LayoutRect layerBoundsInFlowThread;
1410 ClipRect backgroundRectInFlowThread; 1409 ClipRect backgroundRectInFlowThread;
1411 ClipRect foregroundRectInFlowThread; 1410 ClipRect foregroundRectInFlowThread;
1412 ClipRect outlineRectInFlowThread; 1411 ClipRect outlineRectInFlowThread;
1413 clipper().calculateRects(paginationClipRectsContext, LayoutRect(LayoutRect:: infiniteIntRect()), layerBoundsInFlowThread, backgroundRectInFlowThread, foregro undRectInFlowThread, 1412 clipper().calculateRects(paginationClipRectsContext, LayoutRect(LayoutRect:: infiniteIntRect()), layerBoundsInFlowThread, backgroundRectInFlowThread, foregro undRectInFlowThread,
1414 outlineRectInFlowThread, &offsetWithinPaginatedLayer); 1413 outlineRectInFlowThread, &offsetWithinPaginatedLayer);
1415 1414
1416 // Take our bounding box within the flow thread and clip it. 1415 // Take our bounding box within the flow thread and clip it.
(...skipping 18 matching lines...) Expand all
1435 // that intersect the actual dirtyRect as well as the pages/columns that int ersect our layer's bounding box. 1434 // that intersect the actual dirtyRect as well as the pages/columns that int ersect our layer's bounding box.
1436 enclosingFlowThread->collectLayerFragments(fragments, layerBoundingBoxInFlow Thread, dirtyRectInFlowThread); 1435 enclosingFlowThread->collectLayerFragments(fragments, layerBoundingBoxInFlow Thread, dirtyRectInFlowThread);
1437 1436
1438 if (fragments.isEmpty()) 1437 if (fragments.isEmpty())
1439 return; 1438 return;
1440 1439
1441 // Get the parent clip rects of the pagination layer, since we need to inter sect with that when painting column contents. 1440 // Get the parent clip rects of the pagination layer, since we need to inter sect with that when painting column contents.
1442 ClipRect ancestorClipRect = dirtyRect; 1441 ClipRect ancestorClipRect = dirtyRect;
1443 if (const DeprecatedPaintLayer* paginationParentLayer = enclosingPaginationL ayer()->parent()) { 1442 if (const DeprecatedPaintLayer* paginationParentLayer = enclosingPaginationL ayer()->parent()) {
1444 const DeprecatedPaintLayer* ancestorLayer = rootLayerIsInsidePaginationL ayer ? paginationParentLayer : rootLayer; 1443 const DeprecatedPaintLayer* ancestorLayer = rootLayerIsInsidePaginationL ayer ? paginationParentLayer : rootLayer;
1445 // This code uses a non-standard root layer, which can populate our cach e with unexpected values. 1444 ClipRectsContext clipRectsContext(ancestorLayer, clipRectsCacheSlot, inO verlayScrollbarSizeRelevancy);
1446 // Thus we bypass the clip rect cache by ignoring |clipRectsCacheSlot| a nd passing UncachedClipRects.
1447 // TODO(chadarmstrong): If possible, this code should use the cache (one way would be by computing the root layer relative to |clipRectsCacheSlot|).
1448 ClipRectsContext clipRectsContext(ancestorLayer, UncachedClipRects, inOv erlayScrollbarSizeRelevancy);
1449 if (respectOverflowClip == IgnoreOverflowClip) 1445 if (respectOverflowClip == IgnoreOverflowClip)
1450 clipRectsContext.setIgnoreOverflowClip(); 1446 clipRectsContext.setIgnoreOverflowClip();
1451 ancestorClipRect = enclosingPaginationLayer()->clipper().backgroundClipR ect(clipRectsContext); 1447 ancestorClipRect = enclosingPaginationLayer()->clipper().backgroundClipR ect(clipRectsContext);
1452 if (rootLayerIsInsidePaginationLayer) 1448 if (rootLayerIsInsidePaginationLayer)
1453 ancestorClipRect.moveBy(-rootLayer->visualOffsetFromAncestor(ancesto rLayer)); 1449 ancestorClipRect.moveBy(-rootLayer->visualOffsetFromAncestor(ancesto rLayer));
1454 ancestorClipRect.intersect(dirtyRect); 1450 ancestorClipRect.intersect(dirtyRect);
1455 } 1451 }
1456 1452
1457 const LayoutSize subPixelAccumulationIfNeeded = offsetFromRoot ? subPixelAcc umulation : LayoutSize(); 1453 const LayoutSize subPixelAccumulationIfNeeded = offsetFromRoot ? subPixelAcc umulation : LayoutSize();
1458 for (size_t i = 0; i < fragments.size(); ++i) { 1454 for (size_t i = 0; i < fragments.size(); ++i) {
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after
2744 2740
2745 void showLayerTree(const blink::LayoutObject* layoutObject) 2741 void showLayerTree(const blink::LayoutObject* layoutObject)
2746 { 2742 {
2747 if (!layoutObject) { 2743 if (!layoutObject) {
2748 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); 2744 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
2749 return; 2745 return;
2750 } 2746 }
2751 showLayerTree(layoutObject->enclosingLayer()); 2747 showLayerTree(layoutObject->enclosingLayer());
2752 } 2748 }
2753 #endif 2749 #endif
OLDNEW
« no previous file with comments | « Source/core/layout/compositing/CompositingInputsUpdater.cpp ('k') | Source/core/paint/DeprecatedPaintLayerClipper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698