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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp

Issue 1390933003: Implement the framework for the paint property hierarchy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 } 292 }
293 293
294 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I ntRect& clip) 294 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I ntRect& clip)
295 { 295 {
296 if (!m_client) 296 if (!m_client)
297 return; 297 return;
298 if (firstPaintInvalidationTrackingEnabled()) 298 if (firstPaintInvalidationTrackingEnabled())
299 m_debugInfo.clearAnnotatedInvalidateRects(); 299 m_debugInfo.clearAnnotatedInvalidateRects();
300 incrementPaintCount(); 300 incrementPaintCount();
301 #ifndef NDEBUG 301 #ifndef NDEBUG
302 if (m_displayItemList && contentsOpaque() && s_drawDebugRedFill) { 302 if (m_paintArtifact && contentsOpaque() && s_drawDebugRedFill) {
303 FloatRect rect(FloatPoint(), size()); 303 FloatRect rect(FloatPoint(), size());
304 if (!DrawingRecorder::useCachedDrawingIfPossible(context, *this, Display Item::DebugRedFill)) { 304 if (!DrawingRecorder::useCachedDrawingIfPossible(context, *this, Display Item::DebugRedFill)) {
305 DrawingRecorder recorder(context, *this, DisplayItem::DebugRedFill, rect); 305 DrawingRecorder recorder(context, *this, DisplayItem::DebugRedFill, rect);
306 context.fillRect(rect, SK_ColorRED); 306 context.fillRect(rect, SK_ColorRED);
307 } 307 }
308 } 308 }
309 #endif 309 #endif
310 m_client->paintContents(this, context, m_paintingPhase, clip); 310 m_client->paintContents(this, context, m_paintingPhase, clip);
311 } 311 }
312 312
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 if (clampedSize == m_size) 790 if (clampedSize == m_size)
791 return; 791 return;
792 792
793 m_size = clampedSize; 793 m_size = clampedSize;
794 794
795 m_layer->layer()->setBounds(flooredIntSize(m_size)); 795 m_layer->layer()->setBounds(flooredIntSize(m_size));
796 // Note that we don't resize m_contentsLayer. It's up the caller to do that. 796 // Note that we don't resize m_contentsLayer. It's up the caller to do that.
797 797
798 #ifndef NDEBUG 798 #ifndef NDEBUG
799 // The red debug fill needs to be invalidated if the layer resizes. 799 // The red debug fill needs to be invalidated if the layer resizes.
800 if (m_displayItemList) 800 if (m_paintArtifact)
801 m_displayItemList->invalidateUntracked(displayItemClient()); 801 m_paintArtifact->displayItemList().invalidateUntracked(displayItemClient ());
802 #endif 802 #endif
803 } 803 }
804 804
805 void GraphicsLayer::setTransform(const TransformationMatrix& transform) 805 void GraphicsLayer::setTransform(const TransformationMatrix& transform)
806 { 806 {
807 m_transform = transform; 807 m_transform = transform;
808 platformLayer()->setTransform(TransformationMatrix::toSkMatrix44(m_transform )); 808 platformLayer()->setTransform(TransformationMatrix::toSkMatrix44(m_transform ));
809 } 809 }
810 810
811 void GraphicsLayer::setTransformOrigin(const FloatPoint3D& transformOrigin) 811 void GraphicsLayer::setTransformOrigin(const FloatPoint3D& transformOrigin)
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 { 1182 {
1183 if (m_scrollableArea) { 1183 if (m_scrollableArea) {
1184 DoublePoint newPosition = m_scrollableArea->minimumScrollPosition() + to DoubleSize(m_layer->layer()->scrollPositionDouble()); 1184 DoublePoint newPosition = m_scrollableArea->minimumScrollPosition() + to DoubleSize(m_layer->layer()->scrollPositionDouble());
1185 1185
1186 // FrameView::setScrollPosition doesn't work for compositor commits (int eracts poorly with programmatic scroll animations) 1186 // FrameView::setScrollPosition doesn't work for compositor commits (int eracts poorly with programmatic scroll animations)
1187 // so we need to use the ScrollableArea version. The FrameView method sh ould go away soon anyway. 1187 // so we need to use the ScrollableArea version. The FrameView method sh ould go away soon anyway.
1188 m_scrollableArea->ScrollableArea::setScrollPosition(newPosition, Composi torScroll); 1188 m_scrollableArea->ScrollableArea::setScrollPosition(newPosition, Composi torScroll);
1189 } 1189 }
1190 } 1190 }
1191 1191
1192 DisplayItemList* GraphicsLayer::displayItemList() 1192 PaintArtifact* GraphicsLayer::paintArtifact()
1193 { 1193 {
1194 if (!m_displayItemList) 1194 if (!m_paintArtifact)
1195 m_displayItemList = DisplayItemList::create(); 1195 m_paintArtifact = PaintArtifact::create();
1196 return m_displayItemList.get(); 1196 return m_paintArtifact.get();
1197 } 1197 }
1198 1198
1199 } // namespace blink 1199 } // namespace blink
1200 1200
1201 #ifndef NDEBUG 1201 #ifndef NDEBUG
1202 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) 1202 void showGraphicsLayerTree(const blink::GraphicsLayer* layer)
1203 { 1203 {
1204 if (!layer) { 1204 if (!layer) {
1205 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); 1205 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n");
1206 return; 1206 return;
1207 } 1207 }
1208 1208
1209 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); 1209 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo);
1210 fprintf(stderr, "%s\n", output.utf8().data()); 1210 fprintf(stderr, "%s\n", output.utf8().data());
1211 } 1211 }
1212 #endif 1212 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698