Changeset 179771 in webkit
- Timestamp:
- Feb 6, 2015, 5:11:07 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r179762 r179771 1 2015-02-06 Simon Fraser <simon.fraser@apple.com> 2 3 Convert the compositing overlap map to use LayoutRects 4 https://bugs.webkit.org/show_bug.cgi?id=141346 5 6 Reviewed by Zalan Bujtas. 7 8 Test with adjacent layers on non-pixel boundaries. 9 10 * compositing/layer-creation/subpixel-adjacent-layers-overlap-expected.txt: Added. 11 * compositing/layer-creation/subpixel-adjacent-layers-overlap.html: Added. 12 1 13 2015-02-06 Bartlomiej Gajda <b.gajda@samsung.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r179770 r179771 1 2015-02-06 Simon Fraser <simon.fraser@apple.com> 2 3 Convert the compositing overlap map to use LayoutRects 4 https://bugs.webkit.org/show_bug.cgi?id=141346 5 rdar://problem/18206365 6 7 Reviewed by Zalan Bujtas. 8 9 If two compositing layers were adjoining but not overlapping, but happened to 10 have non-integral offsets, then using enclosing IntRects in the overlap map 11 would cause us to think they are overlapping, and create unnecessary backing store. 12 13 Fix by converting the overlap map to use LayoutRects. 14 15 Test: compositing/layer-creation/subpixel-adjacent-layers-overlap.html 16 17 * rendering/RenderLayerCompositor.cpp: 18 (WebCore::OverlapMapContainer::add): 19 (WebCore::OverlapMapContainer::overlapsLayers): 20 (WebCore::RenderLayerCompositor::OverlapMap::add): 21 (WebCore::RenderLayerCompositor::OverlapMap::overlapsLayers): 22 (WebCore::RenderLayerCompositor::OverlapMap::RectList::append): 23 (WebCore::RenderLayerCompositor::OverlapMap::RectList::intersects): 24 (WebCore::RenderLayerCompositor::logLayerInfo): 25 (WebCore::RenderLayerCompositor::addToOverlapMap): 26 (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): 27 (WebCore::RenderLayerCompositor::computeCompositingRequirements): 28 * rendering/RenderLayerCompositor.h: 29 1 30 2015-02-06 Andreas Kling <akling@apple.com> 2 31 -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r179432 r179771 69 69 #if PLATFORM(IOS) 70 70 #include "LegacyTileCache.h" 71 #include "MainFrame.h"72 #include "Region.h"73 71 #include "RenderScrollbar.h" 74 72 #endif … … 105 103 class OverlapMapContainer { 106 104 public: 107 void add(const IntRect& bounds)105 void add(const LayoutRect& bounds) 108 106 { 109 107 m_layerRects.append(bounds); … … 111 109 } 112 110 113 bool overlapsLayers(const IntRect& bounds) const111 bool overlapsLayers(const LayoutRect& bounds) const 114 112 { 115 113 // Checking with the bounding box will quickly reject cases when … … 131 129 } 132 130 private: 133 Vector< IntRect> m_layerRects;134 IntRect m_boundingBox;131 Vector<LayoutRect> m_layerRects; 132 LayoutRect m_boundingBox; 135 133 }; 136 134 … … 147 145 } 148 146 149 void add(const RenderLayer* layer, const IntRect& bounds)147 void add(const RenderLayer* layer, const LayoutRect& bounds) 150 148 { 151 149 // Layers do not contribute to overlap immediately--instead, they will … … 162 160 } 163 161 164 bool overlapsLayers(const IntRect& bounds) const162 bool overlapsLayers(const LayoutRect& bounds) const 165 163 { 166 164 return m_overlapStack.last().overlapsLayers(bounds); … … 187 185 private: 188 186 struct RectList { 189 Vector< IntRect> rects;190 IntRect boundingRect;187 Vector<LayoutRect> rects; 188 LayoutRect boundingRect; 191 189 192 void append(const IntRect& rect)190 void append(const LayoutRect& rect) 193 191 { 194 192 rects.append(rect); … … 202 200 } 203 201 204 bool intersects(const IntRect& rect) const202 bool intersects(const LayoutRect& rect) const 205 203 { 206 204 if (!rects.size() || !boundingRect.intersects(rect)) … … 828 826 } 829 827 828 LayoutRect absoluteBounds = backing->compositedBounds(); 829 absoluteBounds.move(layer.offsetFromAncestor(m_renderView.layer())); 830 830 831 StringBuilder logString; 831 logString.append(String::format("%*p %dx%d%.2fKB", 12 + depth * 2, &layer,832 backing->compositedBounds().width().round(), backing->compositedBounds().height().round(),832 logString.append(String::format("%*p (%.6f,%.6f-%.6f,%.6f) %.2fKB", 12 + depth * 2, &layer, 833 absoluteBounds.x().toFloat(), absoluteBounds.y().toFloat(), absoluteBounds.maxX().toFloat(), absoluteBounds.maxY().toFloat(), 833 834 backing->backingStoreMemoryEstimate() / 1024)); 834 835 … … 1106 1107 } 1107 1108 1108 void RenderLayerCompositor::addToOverlapMap(OverlapMap& overlapMap, RenderLayer& layer, IntRect& layerBounds, bool& boundsComputed)1109 void RenderLayerCompositor::addToOverlapMap(OverlapMap& overlapMap, RenderLayer& layer, LayoutRect& layerBounds, bool& boundsComputed) 1109 1110 { 1110 1111 if (layer.isRootLayer()) … … 1114 1115 // FIXME: If this layer's overlap bounds include its children, we don't need to add its 1115 1116 // children's bounds to the overlap map. 1116 layerBounds = enclosing IntRect(overlapMap.geometryMap().absoluteRect(layer.overlapBounds()));1117 layerBounds = enclosingLayoutRect(overlapMap.geometryMap().absoluteRect(layer.overlapBounds())); 1117 1118 // Empty rects never intersect, but we need them to for the purposes of overlap testing. 1118 1119 if (layerBounds.isEmpty()) 1119 layerBounds.setSize( IntSize(1, 1));1120 layerBounds.setSize(LayoutSize(1, 1)); 1120 1121 boundsComputed = true; 1121 1122 } 1122 1123 1123 IntRect clipRect = snappedIntRect(layer.backgroundClipRect(RenderLayer::ClipRectsContext(&rootRenderLayer(), AbsoluteClipRects)).rect()); // FIXME: Incorrect for CSS regions.1124 LayoutRect clipRect = layer.backgroundClipRect(RenderLayer::ClipRectsContext(&rootRenderLayer(), AbsoluteClipRects)).rect(); // FIXME: Incorrect for CSS regions. 1124 1125 1125 1126 // On iOS, pageScaleFactor() is not applied by RenderView, so we should not scale here. … … 1143 1144 overlapMap.geometryMap().pushMappingsToAncestor(&layer, ancestorLayer); 1144 1145 1145 IntRect bounds;1146 LayoutRect bounds; 1146 1147 bool haveComputedBounds = false; 1147 1148 addToOverlapMap(overlapMap, layer, bounds, haveComputedBounds); … … 1228 1229 RenderLayer::IndirectCompositingReason compositingReason = compositingState.m_subtreeIsCompositing ? RenderLayer::IndirectCompositingReason::Stacking : RenderLayer::IndirectCompositingReason::None; 1229 1230 bool haveComputedBounds = false; 1230 IntRect absBounds;1231 LayoutRect absBounds; 1231 1232 1232 1233 // If we know for sure the layer is going to be composited, don't bother looking it up in the overlap map 1233 1234 if (!willBeComposited && !overlapMap.isEmpty() && compositingState.m_testingOverlap) { 1234 1235 // If we're testing for overlap, we only need to composite if we overlap something that is already composited. 1235 absBounds = enclosing IntRect(overlapMap.geometryMap().absoluteRect(layer.overlapBounds()));1236 absBounds = enclosingLayoutRect(overlapMap.geometryMap().absoluteRect(layer.overlapBounds())); 1236 1237 1237 1238 // Empty rects never intersect, but we need them to for the purposes of overlap testing. 1238 1239 if (absBounds.isEmpty()) 1239 absBounds.setSize( IntSize(1, 1));1240 absBounds.setSize(LayoutSize(1, 1)); 1240 1241 haveComputedBounds = true; 1241 1242 compositingReason = overlapMap.overlapsLayers(absBounds) ? RenderLayer::IndirectCompositingReason::Overlap : RenderLayer::IndirectCompositingReason::None; -
trunk/Source/WebCore/rendering/RenderLayerCompositor.h
r176915 r179771 334 334 void recursiveRepaintLayer(RenderLayer&); 335 335 336 void addToOverlapMap(OverlapMap&, RenderLayer&, IntRect& layerBounds, bool& boundsComputed);336 void addToOverlapMap(OverlapMap&, RenderLayer&, LayoutRect& layerBounds, bool& boundsComputed); 337 337 void addToOverlapMapRecursive(OverlapMap&, RenderLayer&, RenderLayer* ancestorLayer = nullptr); 338 338
Note:
See TracChangeset
for help on using the changeset viewer.