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

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

Issue 468343002: Rename repaint to paintInvalidation in core/rendering/compositing. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix invalidator spelling Created 6 years, 4 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
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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 // the squashed RenderLayer described w.r.t. referenceLayer's origin. For th is purpose we already cached 568 // the squashed RenderLayer described w.r.t. referenceLayer's origin. For th is purpose we already cached
569 // offsetFromSquashingCLM before, which describes where the squashed RenderL ayer is located w.r.t. 569 // offsetFromSquashingCLM before, which describes where the squashed RenderL ayer is located w.r.t.
570 // referenceLayer. So we just need to convert that point from referenceLayer space to referenceLayer 570 // referenceLayer. So we just need to convert that point from referenceLayer space to referenceLayer
571 // space. This is simply done by subtracing squashLayerOriginInOwningLayerSp ace, but then the offset 571 // space. This is simply done by subtracing squashLayerOriginInOwningLayerSp ace, but then the offset
572 // overall needs to be negated because that's the direction that the paintin g code expects the 572 // overall needs to be negated because that's the direction that the paintin g code expects the
573 // offset to be. 573 // offset to be.
574 for (size_t i = 0; i < layers.size(); ++i) { 574 for (size_t i = 0; i < layers.size(); ++i) {
575 LayoutPoint offsetFromTransformedAncestorForSquashedLayer = layers[i].re nderLayer->computeOffsetFromTransformedAncestor(); 575 LayoutPoint offsetFromTransformedAncestorForSquashedLayer = layers[i].re nderLayer->computeOffsetFromTransformedAncestor();
576 LayoutSize offsetFromSquashLayerOrigin = (offsetFromTransformedAncestorF orSquashedLayer - referenceOffsetFromTransformedAncestor) - squashLayerOriginInO wningLayerSpace; 576 LayoutSize offsetFromSquashLayerOrigin = (offsetFromTransformedAncestorF orSquashedLayer - referenceOffsetFromTransformedAncestor) - squashLayerOriginInO wningLayerSpace;
577 577
578 // It is ok to repaint here, because all of the geometry needed to corre ctly repaint is computed by this point. 578 // It is ok to issue paint invalidation here, because all of the geometr y needed to correctly invalidate paint is computed by this point.
579 IntSize newOffsetFromRenderer = -IntSize(offsetFromSquashLayerOrigin.wid th().round(), offsetFromSquashLayerOrigin.height().round()); 579 IntSize newOffsetFromRenderer = -IntSize(offsetFromSquashLayerOrigin.wid th().round(), offsetFromSquashLayerOrigin.height().round());
580 LayoutSize subpixelAccumulation = offsetFromSquashLayerOrigin + newOffse tFromRenderer; 580 LayoutSize subpixelAccumulation = offsetFromSquashLayerOrigin + newOffse tFromRenderer;
581 if (layers[i].offsetFromRendererSet && layers[i].offsetFromRenderer != n ewOffsetFromRenderer) { 581 if (layers[i].offsetFromRendererSet && layers[i].offsetFromRenderer != n ewOffsetFromRenderer) {
582 layers[i].renderLayer->repainter().repaintIncludingNonCompositingDes cendants(); 582 layers[i].renderLayer->paintInvalidator().paintInvalidationIncluding NonCompositingDescendants();
583 layersNeedingPaintInvalidation.append(layers[i].renderLayer); 583 layersNeedingPaintInvalidation.append(layers[i].renderLayer);
584 } 584 }
585 layers[i].offsetFromRenderer = newOffsetFromRenderer; 585 layers[i].offsetFromRenderer = newOffsetFromRenderer;
586 layers[i].offsetFromRendererSet = true; 586 layers[i].offsetFromRendererSet = true;
587 587
588 layers[i].renderLayer->setSubpixelAccumulation(subpixelAccumulation); 588 layers[i].renderLayer->setSubpixelAccumulation(subpixelAccumulation);
589 } 589 }
590 590
591 squashingLayer->setPosition(squashLayerBounds.location()); 591 squashingLayer->setPosition(squashLayerBounds.location());
592 squashingLayer->setSize(squashLayerBounds.size()); 592 squashingLayer->setSize(squashLayerBounds.size());
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 { 1394 {
1395 bool layerChanged = false; 1395 bool layerChanged = false;
1396 if (needsForegroundLayer) { 1396 if (needsForegroundLayer) {
1397 if (!m_foregroundLayer) { 1397 if (!m_foregroundLayer) {
1398 m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForFor eground); 1398 m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForFor eground);
1399 m_foregroundLayer->setDrawsContent(true); 1399 m_foregroundLayer->setDrawsContent(true);
1400 m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground); 1400 m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground);
1401 layerChanged = true; 1401 layerChanged = true;
1402 } 1402 }
1403 } else if (m_foregroundLayer) { 1403 } else if (m_foregroundLayer) {
1404 FloatRect repaintRect(FloatPoint(), m_foregroundLayer->size());
1405 m_foregroundLayer->removeFromParent(); 1404 m_foregroundLayer->removeFromParent();
1406 m_foregroundLayer = nullptr; 1405 m_foregroundLayer = nullptr;
1407 layerChanged = true; 1406 layerChanged = true;
1408 } 1407 }
1409 1408
1410 return layerChanged; 1409 return layerChanged;
1411 } 1410 }
1412 1411
1413 bool CompositedLayerMapping::updateBackgroundLayer(bool needsBackgroundLayer) 1412 bool CompositedLayerMapping::updateBackgroundLayer(bool needsBackgroundLayer)
1414 { 1413 {
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 1884
1886 bool CompositedLayerMapping::updateRequiresOwnBackingStoreForAncestorReasons(con st RenderLayer* compositingAncestorLayer) 1885 bool CompositedLayerMapping::updateRequiresOwnBackingStoreForAncestorReasons(con st RenderLayer* compositingAncestorLayer)
1887 { 1886 {
1888 unsigned previousRequiresOwnBackingStoreForAncestorReasons = m_requiresOwnBa ckingStoreForAncestorReasons; 1887 unsigned previousRequiresOwnBackingStoreForAncestorReasons = m_requiresOwnBa ckingStoreForAncestorReasons;
1889 bool previousPaintsIntoCompositedAncestor = paintsIntoCompositedAncestor(); 1888 bool previousPaintsIntoCompositedAncestor = paintsIntoCompositedAncestor();
1890 bool canPaintIntoAncestor = compositingAncestorLayer 1889 bool canPaintIntoAncestor = compositingAncestorLayer
1891 && (compositingAncestorLayer->compositedLayerMapping()->mainGraphicsLaye r()->drawsContent() 1890 && (compositingAncestorLayer->compositedLayerMapping()->mainGraphicsLaye r()->drawsContent()
1892 || compositingAncestorLayer->compositedLayerMapping()->paintsIntoCom positedAncestor()); 1891 || compositingAncestorLayer->compositedLayerMapping()->paintsIntoCom positedAncestor());
1893 1892
1894 if (paintsIntoCompositedAncestor() != previousPaintsIntoCompositedAncestor) 1893 if (paintsIntoCompositedAncestor() != previousPaintsIntoCompositedAncestor)
1895 compositor()->repaintOnCompositingChange(&m_owningLayer); 1894 compositor()->paintInvalidationOnCompositingChange(&m_owningLayer);
1896 1895
1897 m_requiresOwnBackingStoreForAncestorReasons = !canPaintIntoAncestor; 1896 m_requiresOwnBackingStoreForAncestorReasons = !canPaintIntoAncestor;
1898 1897
1899 return m_requiresOwnBackingStoreForAncestorReasons != previousRequiresOwnBac kingStoreForAncestorReasons; 1898 return m_requiresOwnBackingStoreForAncestorReasons != previousRequiresOwnBac kingStoreForAncestorReasons;
1900 } 1899 }
1901 1900
1902 bool CompositedLayerMapping::updateRequiresOwnBackingStoreForIntrinsicReasons() 1901 bool CompositedLayerMapping::updateRequiresOwnBackingStoreForIntrinsicReasons()
1903 { 1902 {
1904 unsigned previousRequiresOwnBackingStoreForIntrinsicReasons = m_requiresOwnB ackingStoreForIntrinsicReasons; 1903 unsigned previousRequiresOwnBackingStoreForIntrinsicReasons = m_requiresOwnB ackingStoreForIntrinsicReasons;
1905 bool previousPaintsIntoCompositedAncestor = paintsIntoCompositedAncestor(); 1904 bool previousPaintsIntoCompositedAncestor = paintsIntoCompositedAncestor();
1906 RenderObject* renderer = m_owningLayer.renderer(); 1905 RenderObject* renderer = m_owningLayer.renderer();
1907 m_requiresOwnBackingStoreForIntrinsicReasons = m_owningLayer.isRootLayer() 1906 m_requiresOwnBackingStoreForIntrinsicReasons = m_owningLayer.isRootLayer()
1908 || (m_owningLayer.compositingReasons() & CompositingReasonComboReasonsTh atRequireOwnBacking) 1907 || (m_owningLayer.compositingReasons() & CompositingReasonComboReasonsTh atRequireOwnBacking)
1909 || m_owningLayer.transform() 1908 || m_owningLayer.transform()
1910 || m_owningLayer.clipsCompositingDescendantsWithBorderRadius() // FIXME: Revisit this if the paintsIntoCompositedAncestor state is removed. 1909 || m_owningLayer.clipsCompositingDescendantsWithBorderRadius() // FIXME: Revisit this if the paintsIntoCompositedAncestor state is removed.
1911 || renderer->isTransparent() 1910 || renderer->isTransparent()
1912 || renderer->hasMask() 1911 || renderer->hasMask()
1913 || renderer->hasReflection() 1912 || renderer->hasReflection()
1914 || renderer->hasFilter(); 1913 || renderer->hasFilter();
1915 1914
1916 if (paintsIntoCompositedAncestor() != previousPaintsIntoCompositedAncestor) 1915 if (paintsIntoCompositedAncestor() != previousPaintsIntoCompositedAncestor)
1917 compositor()->repaintOnCompositingChange(&m_owningLayer); 1916 compositor()->paintInvalidationOnCompositingChange(&m_owningLayer);
1918 1917
1919 1918
1920 return m_requiresOwnBackingStoreForIntrinsicReasons != previousRequiresOwnBa ckingStoreForIntrinsicReasons; 1919 return m_requiresOwnBackingStoreForIntrinsicReasons != previousRequiresOwnBa ckingStoreForIntrinsicReasons;
1921 } 1920 }
1922 1921
1923 void CompositedLayerMapping::setBlendMode(blink::WebBlendMode blendMode) 1922 void CompositedLayerMapping::setBlendMode(blink::WebBlendMode blendMode)
1924 { 1923 {
1925 if (m_ancestorClippingLayer) { 1924 if (m_ancestorClippingLayer) {
1926 m_ancestorClippingLayer->setBlendMode(blendMode); 1925 m_ancestorClippingLayer->setBlendMode(blendMode);
1927 m_graphicsLayer->setBlendMode(blink::WebBlendModeNormal); 1926 m_graphicsLayer->setBlendMode(blink::WebBlendModeNormal);
(...skipping 17 matching lines...) Expand all
1945 } 1944 }
1946 }; 1945 };
1947 1946
1948 void CompositedLayerMapping::setSquashingContentsNeedDisplay() 1947 void CompositedLayerMapping::setSquashingContentsNeedDisplay()
1949 { 1948 {
1950 ApplyToGraphicsLayers(this, SetContentsNeedsDisplayFunctor(), ApplyToSquashi ngLayer); 1949 ApplyToGraphicsLayers(this, SetContentsNeedsDisplayFunctor(), ApplyToSquashi ngLayer);
1951 } 1950 }
1952 1951
1953 void CompositedLayerMapping::setContentsNeedDisplay() 1952 void CompositedLayerMapping::setContentsNeedDisplay()
1954 { 1953 {
1955 // FIXME: need to split out repaints for the background. 1954 // FIXME: need to split out paint invalidations for the background.
1956 ASSERT(!paintsIntoCompositedAncestor()); 1955 ASSERT(!paintsIntoCompositedAncestor());
1957 ApplyToGraphicsLayers(this, SetContentsNeedsDisplayFunctor(), ApplyToContent Layers); 1956 ApplyToGraphicsLayers(this, SetContentsNeedsDisplayFunctor(), ApplyToContent Layers);
1958 } 1957 }
1959 1958
1960 struct SetContentsNeedsDisplayInRectFunctor { 1959 struct SetContentsNeedsDisplayInRectFunctor {
1961 void operator() (GraphicsLayer* layer) const 1960 void operator() (GraphicsLayer* layer) const
1962 { 1961 {
1963 if (layer->drawsContent()) { 1962 if (layer->drawsContent()) {
1964 IntRect layerDirtyRect = r; 1963 IntRect layerDirtyRect = r;
1965 layerDirtyRect.move(-layer->offsetFromRenderer()); 1964 layerDirtyRect.move(-layer->offsetFromRenderer());
1966 layer->setNeedsDisplayInRect(layerDirtyRect); 1965 layer->setNeedsDisplayInRect(layerDirtyRect);
1967 } 1966 }
1968 } 1967 }
1969 1968
1970 IntRect r; 1969 IntRect r;
1971 }; 1970 };
1972 1971
1973 // r is in the coordinate space of the layer's render object 1972 // r is in the coordinate space of the layer's render object
1974 void CompositedLayerMapping::setContentsNeedDisplayInRect(const LayoutRect& r) 1973 void CompositedLayerMapping::setContentsNeedDisplayInRect(const LayoutRect& r)
1975 { 1974 {
1976 // FIXME: need to split out repaints for the background. 1975 // FIXME: need to split out paint invalidations for the background.
1977 ASSERT(!paintsIntoCompositedAncestor()); 1976 ASSERT(!paintsIntoCompositedAncestor());
1978 1977
1979 SetContentsNeedsDisplayInRectFunctor functor = { 1978 SetContentsNeedsDisplayInRectFunctor functor = {
1980 pixelSnappedIntRect(r.location() + m_owningLayer.subpixelAccumulation(), r.size()) 1979 pixelSnappedIntRect(r.location() + m_owningLayer.subpixelAccumulation(), r.size())
1981 }; 1980 };
1982 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); 1981 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers);
1983 } 1982 }
1984 1983
1985 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co nst RenderObject* renderObject, const Vector<GraphicsLayerPaintInfo>& layers) 1984 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co nst RenderObject* renderObject, const Vector<GraphicsLayerPaintInfo>& layers)
1986 { 1985 {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
2162 m_owningLayer.scrollableArea()->paintResizer(&context, IntPoint(), trans formedClip); 2161 m_owningLayer.scrollableArea()->paintResizer(&context, IntPoint(), trans formedClip);
2163 context.restore(); 2162 context.restore();
2164 } 2163 }
2165 InspectorInstrumentation::didPaint(m_owningLayer.renderer(), graphicsLayer, &context, clip); 2164 InspectorInstrumentation::didPaint(m_owningLayer.renderer(), graphicsLayer, &context, clip);
2166 #if ENABLE(ASSERT) 2165 #if ENABLE(ASSERT)
2167 if (Page* page = renderer()->frame()->page()) 2166 if (Page* page = renderer()->frame()->page())
2168 page->setIsPainting(false); 2167 page->setIsPainting(false);
2169 #endif 2168 #endif
2170 } 2169 }
2171 2170
2172 bool CompositedLayerMapping::isTrackingRepaints() const 2171 bool CompositedLayerMapping::isTrackingPaintInvalidations() const
2173 { 2172 {
2174 GraphicsLayerClient* client = compositor(); 2173 GraphicsLayerClient* client = compositor();
2175 return client ? client->isTrackingRepaints() : false; 2174 return client ? client->isTrackingPaintInvalidations() : false;
2176 } 2175 }
2177 2176
2178 #if ENABLE(ASSERT) 2177 #if ENABLE(ASSERT)
2179 void CompositedLayerMapping::verifyNotPainting() 2178 void CompositedLayerMapping::verifyNotPainting()
2180 { 2179 {
2181 ASSERT(!renderer()->frame()->page() || !renderer()->frame()->page()->isPaint ing()); 2180 ASSERT(!renderer()->frame()->page() || !renderer()->frame()->page()->isPaint ing());
2182 } 2181 }
2183 #endif 2182 #endif
2184 2183
2185 void CompositedLayerMapping::notifyAnimationStarted(const GraphicsLayer*, double monotonicTime) 2184 void CompositedLayerMapping::notifyAnimationStarted(const GraphicsLayer*, double monotonicTime)
(...skipping 15 matching lines...) Expand all
2201 GraphicsLayerPaintInfo paintInfo; 2200 GraphicsLayerPaintInfo paintInfo;
2202 paintInfo.renderLayer = squashedLayer; 2201 paintInfo.renderLayer = squashedLayer;
2203 // NOTE: composited bounds are updated elsewhere 2202 // NOTE: composited bounds are updated elsewhere
2204 // NOTE: offsetFromRenderer is updated elsewhere 2203 // NOTE: offsetFromRenderer is updated elsewhere
2205 2204
2206 // Change tracking on squashing layers: at the first sign of something chang ed, just invalidate the layer. 2205 // Change tracking on squashing layers: at the first sign of something chang ed, just invalidate the layer.
2207 // FIXME: Perhaps we can find a tighter more clever mechanism later. 2206 // FIXME: Perhaps we can find a tighter more clever mechanism later.
2208 bool updatedAssignment = false; 2207 bool updatedAssignment = false;
2209 if (nextSquashedLayerIndex < m_squashedLayers.size()) { 2208 if (nextSquashedLayerIndex < m_squashedLayers.size()) {
2210 if (paintInfo.renderLayer != m_squashedLayers[nextSquashedLayerIndex].re nderLayer) { 2209 if (paintInfo.renderLayer != m_squashedLayers[nextSquashedLayerIndex].re nderLayer) {
2211 compositor()->repaintOnCompositingChange(squashedLayer); 2210 compositor()->paintInvalidationOnCompositingChange(squashedLayer);
2212 updatedAssignment = true; 2211 updatedAssignment = true;
2213 m_squashedLayers[nextSquashedLayerIndex] = paintInfo; 2212 m_squashedLayers[nextSquashedLayerIndex] = paintInfo;
2214 } 2213 }
2215 } else { 2214 } else {
2216 compositor()->repaintOnCompositingChange(squashedLayer); 2215 compositor()->paintInvalidationOnCompositingChange(squashedLayer);
2217 m_squashedLayers.append(paintInfo); 2216 m_squashedLayers.append(paintInfo);
2218 updatedAssignment = true; 2217 updatedAssignment = true;
2219 } 2218 }
2220 squashedLayer->setGroupedMapping(this); 2219 squashedLayer->setGroupedMapping(this);
2221 return updatedAssignment; 2220 return updatedAssignment;
2222 } 2221 }
2223 2222
2224 void CompositedLayerMapping::removeRenderLayerFromSquashingGraphicsLayer(const R enderLayer* layer) 2223 void CompositedLayerMapping::removeRenderLayerFromSquashingGraphicsLayer(const R enderLayer* layer)
2225 { 2224 {
2226 size_t layerIndex = kNotFound; 2225 size_t layerIndex = kNotFound;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2287 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { 2286 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
2288 name = "Scrolling Block Selection Layer"; 2287 name = "Scrolling Block Selection Layer";
2289 } else { 2288 } else {
2290 ASSERT_NOT_REACHED(); 2289 ASSERT_NOT_REACHED();
2291 } 2290 }
2292 2291
2293 return name; 2292 return name;
2294 } 2293 }
2295 2294
2296 } // namespace blink 2295 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698