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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2106463002: Use enclosingIntRect when computing paint invalidations across transforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 5 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
« no previous file with comments | « third_party/WebKit/LayoutTests/paint/invalidation/invalidation-with-scale-transform-expected.txt ('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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 2087 matching lines...) Expand 10 before | Expand all | Expand 10 after
2098 if (container->styleRef().isFlippedBlocksWritingMode()) 2098 if (container->styleRef().isFlippedBlocksWritingMode())
2099 rect.setX(m_frameRect.width() - rect.maxX()); 2099 rect.setX(m_frameRect.width() - rect.maxX());
2100 } 2100 }
2101 2101
2102 LayoutPoint topLeft = rect.location(); 2102 LayoutPoint topLeft = rect.location();
2103 topLeft.move(locationOffset()); 2103 topLeft.move(locationOffset());
2104 2104
2105 // We are now in our parent container's coordinate space. Apply our transfo rm to obtain a bounding box 2105 // We are now in our parent container's coordinate space. Apply our transfo rm to obtain a bounding box
2106 // in the parent's coordinate space that encloses us. 2106 // in the parent's coordinate space that encloses us.
2107 if (hasLayer() && layer()->transform()) { 2107 if (hasLayer() && layer()->transform()) {
2108 rect = LayoutRect(layer()->transform()->mapRect(pixelSnappedIntRect(rect ))); 2108 // Use enclosingIntRect because we cannot properly compute pixel snappin g for painted elements within
2109 // the transform since we don't know the desired subpixel accumulation a t this point, and the transform may
2110 // include a scale.
2111 rect = LayoutRect(layer()->transform()->mapRect(enclosingIntRect(rect))) ;
2109 topLeft = rect.location(); 2112 topLeft = rect.location();
2110 topLeft.move(locationOffset()); 2113 topLeft.move(locationOffset());
2111 } 2114 }
2112 2115
2113 const ComputedStyle& styleToUse = styleRef(); 2116 const ComputedStyle& styleToUse = styleRef();
2114 EPosition position = styleToUse.position(); 2117 EPosition position = styleToUse.position();
2115 if (position == AbsolutePosition && container->isInFlowPositioned() && conta iner->isLayoutInline()) { 2118 if (position == AbsolutePosition && container->isInFlowPositioned() && conta iner->isLayoutInline()) {
2116 topLeft += toLayoutInline(container)->offsetForInFlowPositionedInline(*t his); 2119 topLeft += toLayoutInline(container)->offsetForInFlowPositionedInline(*t his);
2117 } else if (styleToUse.hasInFlowPosition() && layer()) { 2120 } else if (styleToUse.hasInFlowPosition() && layer()) {
2118 // Apply the relative position offset when invalidating a rectangle. Th e layer 2121 // Apply the relative position offset when invalidating a rectangle. Th e layer
(...skipping 2827 matching lines...) Expand 10 before | Expand all | Expand 10 after
4946 m_rareData->m_snapAreas->remove(&snapArea); 4949 m_rareData->m_snapAreas->remove(&snapArea);
4947 } 4950 }
4948 } 4951 }
4949 4952
4950 SnapAreaSet* LayoutBox::snapAreas() const 4953 SnapAreaSet* LayoutBox::snapAreas() const
4951 { 4954 {
4952 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; 4955 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr;
4953 } 4956 }
4954 4957
4955 } // namespace blink 4958 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/paint/invalidation/invalidation-with-scale-transform-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698