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

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

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 750
751 // Transformed or preserve-3d descendants can only be in the z-order lists, 751 // Transformed or preserve-3d descendants can only be in the z-order lists,
752 // not in the normal flow list, so we only need to check those. 752 // not in the normal flow list, so we only need to check those.
753 PaintLayerStackingNodeIterator iterator( 753 PaintLayerStackingNodeIterator iterator(
754 *m_stackingNode.get(), PositiveZOrderChildren | NegativeZOrderChildren); 754 *m_stackingNode.get(), PositiveZOrderChildren | NegativeZOrderChildren);
755 while (PaintLayerStackingNode* node = iterator.next()) { 755 while (PaintLayerStackingNode* node = iterator.next()) {
756 const PaintLayer& childLayer = *node->layer(); 756 const PaintLayer& childLayer = *node->layer();
757 bool childHas3D = false; 757 bool childHas3D = false;
758 // If the child lives in a 3d hierarchy, then the layer at the root of 758 // If the child lives in a 3d hierarchy, then the layer at the root of
759 // that hierarchy needs the m_has3DTransformedDescendant set. 759 // that hierarchy needs the m_has3DTransformedDescendant set.
760 if (childLayer.preserves3D() && (childLayer.has3DTransform() || 760 if (childLayer.preserves3D() &&
761 childLayer.has3DTransformedDescendant())) 761 (childLayer.has3DTransform() ||
762 childLayer.has3DTransformedDescendant()))
762 childHas3D = true; 763 childHas3D = true;
763 else if (childLayer.has3DTransform()) 764 else if (childLayer.has3DTransform())
764 childHas3D = true; 765 childHas3D = true;
765 766
766 if (childHas3D) { 767 if (childHas3D) {
767 m_has3DTransformedDescendant = true; 768 m_has3DTransformedDescendant = true;
768 break; 769 break;
769 } 770 }
770 } 771 }
771 } 772 }
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 m_stackingNode = nullptr; 1506 m_stackingNode = nullptr;
1506 } 1507 }
1507 1508
1508 void PaintLayer::updateScrollableArea() { 1509 void PaintLayer::updateScrollableArea() {
1509 DCHECK(!m_scrollableArea); 1510 DCHECK(!m_scrollableArea);
1510 if (requiresScrollableArea()) 1511 if (requiresScrollableArea())
1511 m_scrollableArea = PaintLayerScrollableArea::create(*this); 1512 m_scrollableArea = PaintLayerScrollableArea::create(*this);
1512 } 1513 }
1513 1514
1514 bool PaintLayer::hasOverflowControls() const { 1515 bool PaintLayer::hasOverflowControls() const {
1515 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || 1516 return m_scrollableArea &&
1516 m_scrollableArea->scrollCorner() || 1517 (m_scrollableArea->hasScrollbar() ||
1517 layoutObject()->style()->resize() != RESIZE_NONE); 1518 m_scrollableArea->scrollCorner() ||
1519 layoutObject()->style()->resize() != RESIZE_NONE);
1518 } 1520 }
1519 1521
1520 void PaintLayer::appendSingleFragmentIgnoringPagination( 1522 void PaintLayer::appendSingleFragmentIgnoringPagination(
1521 PaintLayerFragments& fragments, 1523 PaintLayerFragments& fragments,
1522 const PaintLayer* rootLayer, 1524 const PaintLayer* rootLayer,
1523 const LayoutRect& dirtyRect, 1525 const LayoutRect& dirtyRect,
1524 ClipRectsCacheSlot clipRectsCacheSlot, 1526 ClipRectsCacheSlot clipRectsCacheSlot,
1525 PaintLayer::GeometryMapperOption geometryMapperOption, 1527 PaintLayer::GeometryMapperOption geometryMapperOption,
1526 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior, 1528 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior,
1527 ShouldRespectOverflowClipType respectOverflowClip, 1529 ShouldRespectOverflowClipType respectOverflowClip,
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 // crbug.com/522109. 1727 // crbug.com/522109.
1726 // TODO(majidvp): This should apply more consistently across different 1728 // TODO(majidvp): This should apply more consistently across different
1727 // event types and we should not use RequestType for it. Perhaps best for 1729 // event types and we should not use RequestType for it. Perhaps best for
1728 // it to be done at a higher level. See http://crbug.com/505825 1730 // it to be done at a higher level. See http://crbug.com/505825
1729 } else if ((request.active() || request.release()) && 1731 } else if ((request.active() || request.release()) &&
1730 !request.isChildFrameHitTest()) { 1732 !request.isChildFrameHitTest()) {
1731 fallback = true; 1733 fallback = true;
1732 } 1734 }
1733 if (fallback) { 1735 if (fallback) {
1734 layoutObject()->updateHitTestResult( 1736 layoutObject()->updateHitTestResult(
1735 result, toLayoutView(layoutObject()) 1737 result,
1736 ->flipForWritingMode(hitTestLocation.point())); 1738 toLayoutView(layoutObject())
1739 ->flipForWritingMode(hitTestLocation.point()));
1737 insideLayer = this; 1740 insideLayer = this;
1738 1741
1739 // Don't cache this result since it really wasn't a true hit. 1742 // Don't cache this result since it really wasn't a true hit.
1740 result.setCacheable(false); 1743 result.setCacheable(false);
1741 } 1744 }
1742 } 1745 }
1743 1746
1744 // Now determine if the result is inside an anchor - if the urlElement isn't 1747 // Now determine if the result is inside an anchor - if the urlElement isn't
1745 // already set. 1748 // already set.
1746 Node* node = result.innerNode(); 1749 Node* node = result.innerNode();
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
2205 const HitTestLocation& hitTestLocation, 2208 const HitTestLocation& hitTestLocation,
2206 HitTestFilter hitTestFilter) const { 2209 HitTestFilter hitTestFilter) const {
2207 DCHECK(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); 2210 DCHECK(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant());
2208 2211
2209 if (!layoutObject()->hitTest( 2212 if (!layoutObject()->hitTest(
2210 result, hitTestLocation, 2213 result, hitTestLocation,
2211 toLayoutPoint(layerBounds.location() - layoutBoxLocation()), 2214 toLayoutPoint(layerBounds.location() - layoutBoxLocation()),
2212 hitTestFilter)) { 2215 hitTestFilter)) {
2213 // It's wrong to set innerNode, but then claim that you didn't hit anything, 2216 // It's wrong to set innerNode, but then claim that you didn't hit anything,
2214 // unless it is a rect-based test. 2217 // unless it is a rect-based test.
2215 DCHECK(!result.innerNode() || (result.hitTestRequest().listBased() && 2218 DCHECK(!result.innerNode() ||
2216 result.listBasedTestResult().size())); 2219 (result.hitTestRequest().listBased() &&
2220 result.listBasedTestResult().size()));
2217 return false; 2221 return false;
2218 } 2222 }
2219 2223
2220 if (!result.innerNode()) { 2224 if (!result.innerNode()) {
2221 // We hit something anonymous, and we didn't find a DOM node ancestor in 2225 // We hit something anonymous, and we didn't find a DOM node ancestor in
2222 // this layer. 2226 // this layer.
2223 2227
2224 if (layoutObject()->isLayoutFlowThread()) { 2228 if (layoutObject()->isLayoutFlowThread()) {
2225 // For a flow thread it's safe to just say that we didn't hit anything. 2229 // For a flow thread it's safe to just say that we didn't hit anything.
2226 // That means that we'll continue as normally, and eventually hit a column 2230 // That means that we'll continue as normally, and eventually hit a column
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2282 if (!depthSortDescendants) 2286 if (!depthSortDescendants)
2283 break; 2287 break;
2284 } 2288 }
2285 } 2289 }
2286 2290
2287 return resultLayer; 2291 return resultLayer;
2288 } 2292 }
2289 2293
2290 FloatRect PaintLayer::boxForFilterOrMask() const { 2294 FloatRect PaintLayer::boxForFilterOrMask() const {
2291 return FloatRect(physicalBoundingBoxIncludingStackingChildren( 2295 return FloatRect(physicalBoundingBoxIncludingStackingChildren(
2292 LayoutPoint(), PaintLayer::CalculateBoundsOptions:: 2296 LayoutPoint(),
2293 IncludeTransformsAndCompositedChildLayers)); 2297 PaintLayer::CalculateBoundsOptions::
2298 IncludeTransformsAndCompositedChildLayers));
2294 } 2299 }
2295 2300
2296 LayoutRect PaintLayer::boxForClipPath() const { 2301 LayoutRect PaintLayer::boxForClipPath() const {
2297 if (!layoutObject()->isBox()) { 2302 if (!layoutObject()->isBox()) {
2298 SECURITY_DCHECK(layoutObject()->isLayoutInline()); 2303 SECURITY_DCHECK(layoutObject()->isLayoutInline());
2299 const LayoutInline& layoutInline = toLayoutInline(*layoutObject()); 2304 const LayoutInline& layoutInline = toLayoutInline(*layoutObject());
2300 // This somewhat convoluted computation matches what Gecko does. 2305 // This somewhat convoluted computation matches what Gecko does.
2301 // See crbug.com/641907. 2306 // See crbug.com/641907.
2302 LayoutRect inlineBBox = layoutInline.linesBoundingBox(); 2307 LayoutRect inlineBBox = layoutInline.linesBoundingBox();
2303 const InlineFlowBox* flowBox = layoutInline.firstLineBox(); 2308 const InlineFlowBox* flowBox = layoutInline.firstLineBox();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2450 const_cast<PaintLayer*>(this)->stackingNode()); 2455 const_cast<PaintLayer*>(this)->stackingNode());
2451 #endif 2456 #endif
2452 2457
2453 PaintLayerStackingNodeIterator iterator(*this->stackingNode(), AllChildren); 2458 PaintLayerStackingNodeIterator iterator(*this->stackingNode(), AllChildren);
2454 while (PaintLayerStackingNode* node = iterator.next()) { 2459 while (PaintLayerStackingNode* node = iterator.next()) {
2455 // Here we exclude both directly composited layers and squashing layers 2460 // Here we exclude both directly composited layers and squashing layers
2456 // because those Layers don't paint into the graphics layer 2461 // because those Layers don't paint into the graphics layer
2457 // for this Layer. For example, the bounds of squashed Layers 2462 // for this Layer. For example, the bounds of squashed Layers
2458 // will be included in the computation of the appropriate squashing 2463 // will be included in the computation of the appropriate squashing
2459 // GraphicsLayer. 2464 // GraphicsLayer.
2460 if (options != PaintLayer::CalculateBoundsOptions:: 2465 if (options !=
2461 IncludeTransformsAndCompositedChildLayers && 2466 PaintLayer::CalculateBoundsOptions::
2467 IncludeTransformsAndCompositedChildLayers &&
2462 node->layer()->compositingState() != NotComposited) 2468 node->layer()->compositingState() != NotComposited)
2463 continue; 2469 continue;
2464 result.unite(node->layer()->boundingBoxForCompositingInternal( 2470 result.unite(node->layer()->boundingBoxForCompositingInternal(
2465 compositedLayer, this, options)); 2471 compositedLayer, this, options));
2466 } 2472 }
2467 } 2473 }
2468 2474
2469 LayoutRect PaintLayer::physicalBoundingBoxIncludingStackingChildren( 2475 LayoutRect PaintLayer::physicalBoundingBoxIncludingStackingChildren(
2470 const LayoutPoint& offsetFromRoot, 2476 const LayoutPoint& offsetFromRoot,
2471 CalculateBoundsOptions options) const { 2477 CalculateBoundsOptions options) const {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2525 2531
2526 result.intersect(physicalBoundingBox(LayoutPoint())); 2532 result.intersect(physicalBoundingBox(LayoutPoint()));
2527 2533
2528 expandRectForStackingChildren(compositedLayer, result, options); 2534 expandRectForStackingChildren(compositedLayer, result, options);
2529 2535
2530 // Only enlarge by the filter outsets if we know the filter is going to be 2536 // Only enlarge by the filter outsets if we know the filter is going to be
2531 // rendered in software. Accelerated filters will handle their own outsets. 2537 // rendered in software. Accelerated filters will handle their own outsets.
2532 if (paintsWithFilters()) 2538 if (paintsWithFilters())
2533 result = mapLayoutRectForFilter(result); 2539 result = mapLayoutRectForFilter(result);
2534 2540
2535 if (transform() && (options == IncludeTransformsAndCompositedChildLayers || 2541 if (transform() &&
2536 ((paintsWithTransform(GlobalPaintNormalPhase) && 2542 (options == IncludeTransformsAndCompositedChildLayers ||
2537 (this != &compositedLayer || 2543 ((paintsWithTransform(GlobalPaintNormalPhase) &&
2538 options == MaybeIncludeTransformForAncestorLayer))))) 2544 (this != &compositedLayer ||
2545 options == MaybeIncludeTransformForAncestorLayer)))))
2539 result = transform()->mapRect(result); 2546 result = transform()->mapRect(result);
2540 2547
2541 if (shouldFragmentCompositedBounds(&compositedLayer)) { 2548 if (shouldFragmentCompositedBounds(&compositedLayer)) {
2542 convertFromFlowThreadToVisualBoundingBoxInAncestor(&compositedLayer, 2549 convertFromFlowThreadToVisualBoundingBoxInAncestor(&compositedLayer,
2543 result); 2550 result);
2544 return result; 2551 return result;
2545 } 2552 }
2546 2553
2547 if (stackingParent) { 2554 if (stackingParent) {
2548 LayoutPoint delta; 2555 LayoutPoint delta;
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
3221 } 3228 }
3222 3229
3223 void showLayerTree(const blink::LayoutObject* layoutObject) { 3230 void showLayerTree(const blink::LayoutObject* layoutObject) {
3224 if (!layoutObject) { 3231 if (!layoutObject) {
3225 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; 3232 LOG(INFO) << "Cannot showLayerTree. Root is (nil)";
3226 return; 3233 return;
3227 } 3234 }
3228 showLayerTree(layoutObject->enclosingLayer()); 3235 showLayerTree(layoutObject->enclosingLayer());
3229 } 3236 }
3230 #endif 3237 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintInvalidator.cpp ('k') | third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698