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

Side by Side Diff: Source/WebCore/rendering/RenderLayerBacking.cpp

Issue 9187066: Merge 104782 - Repaint all graphics layers when their renderer offset changes (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 8 years, 11 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 | « Source/WebCore/platform/graphics/GraphicsLayer.cpp ('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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 m_ancestorClippingLayer->setSize(parentClipRect.size()); 402 m_ancestorClippingLayer->setSize(parentClipRect.size());
403 403
404 // backgroundRect is relative to compAncestor, so subtract deltaX/deltaY to get back to local coords. 404 // backgroundRect is relative to compAncestor, so subtract deltaX/deltaY to get back to local coords.
405 m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location() - delta); 405 m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location() - delta);
406 406
407 // The primary layer is then parented in, and positioned relative to thi s clipping layer. 407 // The primary layer is then parented in, and positioned relative to thi s clipping layer.
408 graphicsLayerParentLocation = parentClipRect.location(); 408 graphicsLayerParentLocation = parentClipRect.location();
409 } 409 }
410 410
411 m_graphicsLayer->setPosition(FloatPoint() + (relativeCompositingBounds.locat ion() - graphicsLayerParentLocation)); 411 m_graphicsLayer->setPosition(FloatPoint() + (relativeCompositingBounds.locat ion() - graphicsLayerParentLocation));
412
413 LayoutSize oldOffsetFromRenderer = m_graphicsLayer->offsetFromRenderer();
414 m_graphicsLayer->setOffsetFromRenderer(localCompositingBounds.location() - L ayoutPoint()); 412 m_graphicsLayer->setOffsetFromRenderer(localCompositingBounds.location() - L ayoutPoint());
415 413
416 // If the compositing layer offset changes, we need to repaint.
417 if (oldOffsetFromRenderer != m_graphicsLayer->offsetFromRenderer())
418 m_graphicsLayer->setNeedsDisplay();
419
420 FloatSize oldSize = m_graphicsLayer->size(); 414 FloatSize oldSize = m_graphicsLayer->size();
421 FloatSize newSize = relativeCompositingBounds.size(); 415 FloatSize newSize = relativeCompositingBounds.size();
422 if (oldSize != newSize) { 416 if (oldSize != newSize) {
423 m_graphicsLayer->setSize(newSize); 417 m_graphicsLayer->setSize(newSize);
424 // A bounds change will almost always require redisplay. Usually that re display 418 // A bounds change will almost always require redisplay. Usually that re display
425 // will happen because of a repaint elsewhere, but not always: 419 // will happen because of a repaint elsewhere, but not always:
426 // e.g. see RenderView::setMaximalOutlineSize() 420 // e.g. see RenderView::setMaximalOutlineSize()
427 m_graphicsLayer->setNeedsDisplay(); 421 m_graphicsLayer->setNeedsDisplay();
428 } 422 }
429 423
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 scrollbar->paint(&context, transformedClip); 1185 scrollbar->paint(&context, transformedClip);
1192 context.restore(); 1186 context.restore();
1193 } 1187 }
1194 1188
1195 // Up-call from compositing layer drawing callback. 1189 // Up-call from compositing layer drawing callback.
1196 void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, Graph icsContext& context, GraphicsLayerPaintingPhase paintingPhase, const LayoutRect& clip) 1190 void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, Graph icsContext& context, GraphicsLayerPaintingPhase paintingPhase, const LayoutRect& clip)
1197 { 1191 {
1198 if (graphicsLayer == m_graphicsLayer.get() || graphicsLayer == m_foregroundL ayer.get() || graphicsLayer == m_maskLayer.get()) { 1192 if (graphicsLayer == m_graphicsLayer.get() || graphicsLayer == m_foregroundL ayer.get() || graphicsLayer == m_maskLayer.get()) {
1199 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willPa int(m_owningLayer->renderer()->frame(), clip); 1193 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willPa int(m_owningLayer->renderer()->frame(), clip);
1200 1194
1201 LayoutSize offset = graphicsLayer->offsetFromRenderer();
1202 context.translate(-offset);
1203
1204 LayoutRect clipRect(clip);
1205 clipRect.move(offset);
1206
1207 // The dirtyRect is in the coords of the painting root. 1195 // The dirtyRect is in the coords of the painting root.
1208 LayoutRect dirtyRect = compositedBounds(); 1196 LayoutRect dirtyRect = compositedBounds();
1209 dirtyRect.intersect(clipRect); 1197 dirtyRect.intersect(clip);
1210 1198
1211 // We have to use the same root as for hit testing, because both methods can compute and cache clipRects. 1199 // We have to use the same root as for hit testing, because both methods can compute and cache clipRects.
1212 paintIntoLayer(m_owningLayer, &context, dirtyRect, PaintBehaviorNormal, paintingPhase, renderer()); 1200 paintIntoLayer(m_owningLayer, &context, dirtyRect, PaintBehaviorNormal, paintingPhase, renderer());
1213 1201
1214 InspectorInstrumentation::didPaint(cookie); 1202 InspectorInstrumentation::didPaint(cookie);
1215 } else if (graphicsLayer == layerForHorizontalScrollbar()) { 1203 } else if (graphicsLayer == layerForHorizontalScrollbar()) {
1216 paintScrollbar(m_owningLayer->horizontalScrollbar(), context, clip); 1204 paintScrollbar(m_owningLayer->horizontalScrollbar(), context, clip);
1217 } else if (graphicsLayer == layerForVerticalScrollbar()) { 1205 } else if (graphicsLayer == layerForVerticalScrollbar()) {
1218 paintScrollbar(m_owningLayer->verticalScrollbar(), context, clip); 1206 paintScrollbar(m_owningLayer->verticalScrollbar(), context, clip);
1219 } else if (graphicsLayer == layerForScrollCorner()) { 1207 } else if (graphicsLayer == layerForScrollCorner()) {
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 1446
1459 if (m_graphicsLayer->drawsContent()) 1447 if (m_graphicsLayer->drawsContent())
1460 return m_graphicsLayer->usingTiledLayer() ? TiledCompositingLayer : Norm alCompositingLayer; 1448 return m_graphicsLayer->usingTiledLayer() ? TiledCompositingLayer : Norm alCompositingLayer;
1461 1449
1462 return ContainerCompositingLayer; 1450 return ContainerCompositingLayer;
1463 } 1451 }
1464 1452
1465 } // namespace WebCore 1453 } // namespace WebCore
1466 1454
1467 #endif // USE(ACCELERATED_COMPOSITING) 1455 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « Source/WebCore/platform/graphics/GraphicsLayer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698