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

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

Issue 205213006: Fix pixel snapping of clipLayers and their descendants (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/sub-pixel/nested-sub-pixel-composited-layers-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 IntRect localCompositingBounds; 689 IntRect localCompositingBounds;
690 IntRect relativeCompositingBounds; 690 IntRect relativeCompositingBounds;
691 IntPoint delta; 691 IntPoint delta;
692 adjustBoundsForSubPixelAccumulation(compAncestor, localCompositingBounds, re lativeCompositingBounds, delta); 692 adjustBoundsForSubPixelAccumulation(compAncestor, localCompositingBounds, re lativeCompositingBounds, delta);
693 693
694 IntPoint graphicsLayerParentLocation; 694 IntPoint graphicsLayerParentLocation;
695 if (compAncestor && compAncestor->compositedLayerMapping()->hasClippingLayer ()) { 695 if (compAncestor && compAncestor->compositedLayerMapping()->hasClippingLayer ()) {
696 // If the compositing ancestor has a layer to clip children, we parent i n that, and therefore 696 // If the compositing ancestor has a layer to clip children, we parent i n that, and therefore
697 // position relative to it. 697 // position relative to it.
698 IntRect clippingBox = clipBox(toRenderBox(compAncestor->renderer())); 698 IntRect clippingBox = clipBox(toRenderBox(compAncestor->renderer()));
699 graphicsLayerParentLocation = clippingBox.location(); 699 graphicsLayerParentLocation = clippingBox.location() + roundedIntSize(co mpAncestor->compositedLayerMapping()->subpixelAccumulation());
700 } else if (compAncestor) { 700 } else if (compAncestor) {
701 graphicsLayerParentLocation = ancestorCompositingBounds.location(); 701 graphicsLayerParentLocation = ancestorCompositingBounds.location();
702 } else { 702 } else {
703 graphicsLayerParentLocation = renderer()->view()->documentRect().locatio n(); 703 graphicsLayerParentLocation = renderer()->view()->documentRect().locatio n();
704 } 704 }
705 705
706 if (compAncestor && compAncestor->needsCompositedScrolling()) { 706 if (compAncestor && compAncestor->needsCompositedScrolling()) {
707 RenderBox* renderBox = toRenderBox(compAncestor->renderer()); 707 RenderBox* renderBox = toRenderBox(compAncestor->renderer());
708 IntSize scrollOffset = renderBox->scrolledContentOffset(); 708 IntSize scrollOffset = renderBox->scrolledContentOffset();
709 IntPoint scrollOrigin(renderBox->borderLeft(), renderBox->borderTop()); 709 IntPoint scrollOrigin(renderBox->borderLeft(), renderBox->borderTop());
(...skipping 20 matching lines...) Expand all
730 m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.loca tion())); 730 m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.loca tion()));
731 731
732 FloatSize oldSize = m_graphicsLayer->size(); 732 FloatSize oldSize = m_graphicsLayer->size();
733 if (oldSize != contentsSize) 733 if (oldSize != contentsSize)
734 m_graphicsLayer->setSize(contentsSize); 734 m_graphicsLayer->setSize(contentsSize);
735 735
736 // If we have a layer that clips children, position it. 736 // If we have a layer that clips children, position it.
737 IntRect clippingBox; 737 IntRect clippingBox;
738 if (GraphicsLayer* clipLayer = clippingLayer()) { 738 if (GraphicsLayer* clipLayer = clippingLayer()) {
739 clippingBox = clipBox(toRenderBox(renderer())); 739 clippingBox = clipBox(toRenderBox(renderer()));
740 clipLayer->setPosition(FloatPoint(clippingBox.location() - localComposit ingBounds.location())); 740 clipLayer->setPosition(FloatPoint(clippingBox.location() - localComposit ingBounds.location() + roundedIntSize(m_subpixelAccumulation)));
741 clipLayer->setSize(clippingBox.size()); 741 clipLayer->setSize(clippingBox.size());
742 clipLayer->setOffsetFromRenderer(toIntSize(clippingBox.location())); 742 clipLayer->setOffsetFromRenderer(toIntSize(clippingBox.location()));
743 if (m_childClippingMaskLayer && !m_scrollingLayer) { 743 if (m_childClippingMaskLayer && !m_scrollingLayer) {
744 m_childClippingMaskLayer->setPosition(clipLayer->position()); 744 m_childClippingMaskLayer->setPosition(clipLayer->position());
745 m_childClippingMaskLayer->setSize(clipLayer->size()); 745 m_childClippingMaskLayer->setSize(clipLayer->size());
746 m_childClippingMaskLayer->setOffsetFromRenderer(clipLayer->offsetFro mRenderer()); 746 m_childClippingMaskLayer->setOffsetFromRenderer(clipLayer->offsetFro mRenderer());
747 } 747 }
748 } else if (m_childTransformLayer) { 748 } else if (m_childTransformLayer) {
749 m_childTransformLayer->setSize(contentsSize); 749 m_childTransformLayer->setSize(contentsSize);
750 } 750 }
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after
2146 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2146 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2147 name = "Scrolling Contents Layer"; 2147 name = "Scrolling Contents Layer";
2148 } else { 2148 } else {
2149 ASSERT_NOT_REACHED(); 2149 ASSERT_NOT_REACHED();
2150 } 2150 }
2151 2151
2152 return name; 2152 return name;
2153 } 2153 }
2154 2154
2155 } // namespace WebCore 2155 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/sub-pixel/nested-sub-pixel-composited-layers-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698