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

Side by Side Diff: Source/core/rendering/CompositedLayerMapping.cpp

Issue 19954010: Clip accelerated descendants of an accelerated layer having border radius and clip overflow (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adding back clipPath condition ommited when rebased Created 7 years, 1 month 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) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 463
464 updateScrollParent(scrollParent); 464 updateScrollParent(scrollParent);
465 updateClipParent(m_owningLayer->clipParent()); 465 updateClipParent(m_owningLayer->clipParent());
466 466
467 if (layerConfigChanged) 467 if (layerConfigChanged)
468 updateInternalHierarchy(); 468 updateInternalHierarchy();
469 469
470 if (updateMaskLayer(renderer->hasMask())) 470 if (updateMaskLayer(renderer->hasMask()))
471 m_graphicsLayer->setMaskLayer(m_maskLayer.get()); 471 m_graphicsLayer->setMaskLayer(m_maskLayer.get());
472 472
473 bool needsChildClippingMask = (renderer->style()->hasBorderRadius() || rende rer->style()->clipPath()) && isAcceleratedContents(renderer); 473 bool hasChildClippingLayer = compositor->clipsCompositingDescendants(m_ownin gLayer) && (hasClippingLayer() || hasScrollingLayer());
474 if (updateClippingMaskLayers(needsChildClippingMask)) 474 bool needsChildClippingMask = (renderer->style()->clipPath() || renderer->st yle()->hasBorderRadius()) && (hasChildClippingLayer || isAcceleratedContents(ren derer));
475 m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLayer.g et()); 475 if (updateClippingMaskLayers(needsChildClippingMask)) {
476 if (hasClippingLayer())
477 clippingLayer()->setMaskLayer(m_childClippingMaskLayer.get());
478 else if (hasScrollingLayer())
479 scrollingLayer()->setMaskLayer(m_childClippingMaskLayer.get());
480 else if (isAcceleratedContents(renderer))
481 m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLay er.get());
482 }
476 483
477 if (m_owningLayer->reflectionInfo()) { 484 if (m_owningLayer->reflectionInfo()) {
478 if (m_owningLayer->reflectionInfo()->reflectionLayer()->hasCompositedLay erMapping()) { 485 if (m_owningLayer->reflectionInfo()->reflectionLayer()->hasCompositedLay erMapping()) {
479 GraphicsLayer* reflectionLayer = m_owningLayer->reflectionInfo()->re flectionLayer()->compositedLayerMapping()->mainGraphicsLayer(); 486 GraphicsLayer* reflectionLayer = m_owningLayer->reflectionInfo()->re flectionLayer()->compositedLayerMapping()->mainGraphicsLayer();
480 m_graphicsLayer->setReplicatedByLayer(reflectionLayer); 487 m_graphicsLayer->setReplicatedByLayer(reflectionLayer);
481 } 488 }
482 } else { 489 } else {
483 m_graphicsLayer->setReplicatedByLayer(0); 490 m_graphicsLayer->setReplicatedByLayer(0);
484 } 491 }
485 492
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 m_graphicsLayer->setNeedsDisplay(); 643 m_graphicsLayer->setNeedsDisplay();
637 } 644 }
638 645
639 // If we have a layer that clips children, position it. 646 // If we have a layer that clips children, position it.
640 IntRect clippingBox; 647 IntRect clippingBox;
641 if (GraphicsLayer* clipLayer = clippingLayer()) { 648 if (GraphicsLayer* clipLayer = clippingLayer()) {
642 clippingBox = clipBox(toRenderBox(renderer())); 649 clippingBox = clipBox(toRenderBox(renderer()));
643 clipLayer->setPosition(FloatPoint(clippingBox.location() - localComposit ingBounds.location())); 650 clipLayer->setPosition(FloatPoint(clippingBox.location() - localComposit ingBounds.location()));
644 clipLayer->setSize(clippingBox.size()); 651 clipLayer->setSize(clippingBox.size());
645 clipLayer->setOffsetFromRenderer(toIntSize(clippingBox.location())); 652 clipLayer->setOffsetFromRenderer(toIntSize(clippingBox.location()));
653 if (m_childClippingMaskLayer && !m_scrollingLayer) {
654 m_childClippingMaskLayer->setPosition(clipLayer->position());
655 m_childClippingMaskLayer->setSize(clipLayer->size());
656 m_childClippingMaskLayer->setOffsetFromRenderer(clipLayer->offsetFro mRenderer());
657 }
646 } 658 }
647 659
648 if (m_maskLayer) { 660 if (m_maskLayer) {
649 if (m_maskLayer->size() != m_graphicsLayer->size()) { 661 if (m_maskLayer->size() != m_graphicsLayer->size()) {
650 m_maskLayer->setSize(m_graphicsLayer->size()); 662 m_maskLayer->setSize(m_graphicsLayer->size());
651 m_maskLayer->setNeedsDisplay(); 663 m_maskLayer->setNeedsDisplay();
652 } 664 }
653 m_maskLayer->setPosition(FloatPoint()); 665 m_maskLayer->setPosition(FloatPoint());
654 m_maskLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer() ); 666 m_maskLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer() );
655 } 667 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 if (style->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) 754 if (style->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
743 clientBox.move(renderBox->verticalScrollbarWidth(), 0); 755 clientBox.move(renderBox->verticalScrollbarWidth(), 0);
744 756
745 IntSize adjustedScrollOffset = m_owningLayer->scrollableArea()->adjusted ScrollOffset(); 757 IntSize adjustedScrollOffset = m_owningLayer->scrollableArea()->adjusted ScrollOffset();
746 m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localCom positingBounds.location())); 758 m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localCom positingBounds.location()));
747 m_scrollingLayer->setSize(clientBox.size()); 759 m_scrollingLayer->setSize(clientBox.size());
748 760
749 IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer() ; 761 IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer() ;
750 m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location()) ); 762 m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location()) );
751 763
764 if (m_childClippingMaskLayer) {
765 m_childClippingMaskLayer->setPosition(m_scrollingLayer->position());
766 m_childClippingMaskLayer->setSize(m_scrollingLayer->size());
767 m_childClippingMaskLayer->setOffsetFromRenderer(toIntSize(clientBox. location()));
768 }
769
752 bool clientBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLaye r->offsetFromRenderer(); 770 bool clientBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLaye r->offsetFromRenderer();
753 771
754 IntSize scrollSize(renderBox->scrollWidth(), renderBox->scrollHeight()); 772 IntSize scrollSize(renderBox->scrollWidth(), renderBox->scrollHeight());
755 if (scrollSize != m_scrollingContentsLayer->size() || clientBoxOffsetCha nged) 773 if (scrollSize != m_scrollingContentsLayer->size() || clientBoxOffsetCha nged)
756 m_scrollingContentsLayer->setNeedsDisplay(); 774 m_scrollingContentsLayer->setNeedsDisplay();
757 775
758 IntSize scrollingContentsOffset = toIntSize(clientBox.location() - adjus tedScrollOffset); 776 IntSize scrollingContentsOffset = toIntSize(clientBox.location() - adjus tedScrollOffset);
759 if (scrollingContentsOffset != m_scrollingContentsLayer->offsetFromRende rer() || scrollSize != m_scrollingContentsLayer->size()) { 777 if (scrollingContentsOffset != m_scrollingContentsLayer->offsetFromRende rer() || scrollSize != m_scrollingContentsLayer->size()) {
760 bool scrollingCoordinatorHandlesOffset = compositor()->scrollingLaye rDidChange(m_owningLayer); 778 bool scrollingCoordinatorHandlesOffset = compositor()->scrollingLaye rDidChange(m_owningLayer);
761 779
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 } else if (graphicsLayer == m_ancestorClippingLayer.get()) { 2013 } else if (graphicsLayer == m_ancestorClippingLayer.get()) {
1996 name = "Ancestor Clipping Layer"; 2014 name = "Ancestor Clipping Layer";
1997 } else if (graphicsLayer == m_foregroundLayer.get()) { 2015 } else if (graphicsLayer == m_foregroundLayer.get()) {
1998 name = m_owningLayer->debugName() + " (foreground) Layer"; 2016 name = m_owningLayer->debugName() + " (foreground) Layer";
1999 } else if (graphicsLayer == m_backgroundLayer.get()) { 2017 } else if (graphicsLayer == m_backgroundLayer.get()) {
2000 name = m_owningLayer->debugName() + " (background) Layer"; 2018 name = m_owningLayer->debugName() + " (background) Layer";
2001 } else if (graphicsLayer == m_childContainmentLayer.get()) { 2019 } else if (graphicsLayer == m_childContainmentLayer.get()) {
2002 name = "Child Containment Layer"; 2020 name = "Child Containment Layer";
2003 } else if (graphicsLayer == m_maskLayer.get()) { 2021 } else if (graphicsLayer == m_maskLayer.get()) {
2004 name = "Mask Layer"; 2022 name = "Mask Layer";
2023 } else if (graphicsLayer == m_childClippingMaskLayer.get()) {
2024 name = "Child Clipping Mask Layer";
2005 } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) { 2025 } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) {
2006 name = "Horizontal Scrollbar Layer"; 2026 name = "Horizontal Scrollbar Layer";
2007 } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) { 2027 } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) {
2008 name = "Vertical Scrollbar Layer"; 2028 name = "Vertical Scrollbar Layer";
2009 } else if (graphicsLayer == m_layerForScrollCorner.get()) { 2029 } else if (graphicsLayer == m_layerForScrollCorner.get()) {
2010 name = "Scroll Corner Layer"; 2030 name = "Scroll Corner Layer";
2011 } else if (graphicsLayer == m_scrollingLayer.get()) { 2031 } else if (graphicsLayer == m_scrollingLayer.get()) {
2012 name = "Scrolling Layer"; 2032 name = "Scrolling Layer";
2013 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2033 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2014 name = "Scrolling Contents Layer"; 2034 name = "Scrolling Contents Layer";
2015 } else { 2035 } else {
2016 ASSERT_NOT_REACHED(); 2036 ASSERT_NOT_REACHED();
2017 } 2037 }
2018 2038
2019 return name; 2039 return name;
2020 } 2040 }
2021 2041
2022 } // namespace WebCore 2042 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/clip/overflow-border-radius-composited-parent.html ('k') | Source/core/rendering/RenderBlock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698