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

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

Issue 335453002: Remove unused cruft from GraphicsLayer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove test file Created 6 years, 6 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 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, G raphicsLayerClient* client) 76 PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, G raphicsLayerClient* client)
77 { 77 {
78 return factory->createGraphicsLayer(client); 78 return factory->createGraphicsLayer(client);
79 } 79 }
80 80
81 GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client) 81 GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client)
82 : m_client(client) 82 : m_client(client)
83 , m_backgroundColor(Color::transparent) 83 , m_backgroundColor(Color::transparent)
84 , m_opacity(1) 84 , m_opacity(1)
85 , m_zPosition(0)
86 , m_blendMode(blink::WebBlendModeNormal) 85 , m_blendMode(blink::WebBlendModeNormal)
87 , m_hasTransformOrigin(false) 86 , m_hasTransformOrigin(false)
88 , m_contentsOpaque(false) 87 , m_contentsOpaque(false)
89 , m_shouldFlattenTransform(true) 88 , m_shouldFlattenTransform(true)
90 , m_backfaceVisibility(true) 89 , m_backfaceVisibility(true)
91 , m_masksToBounds(false) 90 , m_masksToBounds(false)
92 , m_drawsContent(false) 91 , m_drawsContent(false)
93 , m_contentsVisible(true) 92 , m_contentsVisible(true)
94 , m_isRootForIsolatedGroup(false) 93 , m_isRootForIsolatedGroup(false)
95 , m_hasScrollParent(false) 94 , m_hasScrollParent(false)
96 , m_hasClipParent(false) 95 , m_hasClipParent(false)
97 , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip) 96 , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip)
98 , m_contentsOrientation(CompositingCoordinatesTopDown)
99 , m_parent(0) 97 , m_parent(0)
100 , m_maskLayer(0) 98 , m_maskLayer(0)
101 , m_contentsClippingMaskLayer(0) 99 , m_contentsClippingMaskLayer(0)
102 , m_replicaLayer(0) 100 , m_replicaLayer(0)
103 , m_replicatedLayer(0) 101 , m_replicatedLayer(0)
104 , m_paintCount(0) 102 , m_paintCount(0)
105 , m_contentsLayer(0) 103 , m_contentsLayer(0)
106 , m_contentsLayerId(0) 104 , m_contentsLayerId(0)
107 , m_scrollableArea(0) 105 , m_scrollableArea(0)
108 , m_3dRenderingContext(0) 106 , m_3dRenderingContext(0)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 resetTrackedRepaints(); 140 resetTrackedRepaints();
143 ASSERT(!m_parent); 141 ASSERT(!m_parent);
144 } 142 }
145 143
146 void GraphicsLayer::setParent(GraphicsLayer* layer) 144 void GraphicsLayer::setParent(GraphicsLayer* layer)
147 { 145 {
148 ASSERT(!layer || !layer->hasAncestor(this)); 146 ASSERT(!layer || !layer->hasAncestor(this));
149 m_parent = layer; 147 m_parent = layer;
150 } 148 }
151 149
150 #if ASSERT_ENABLED
151
152 bool GraphicsLayer::hasAncestor(GraphicsLayer* ancestor) const 152 bool GraphicsLayer::hasAncestor(GraphicsLayer* ancestor) const
153 { 153 {
154 for (GraphicsLayer* curr = parent(); curr; curr = curr->parent()) { 154 for (GraphicsLayer* curr = parent(); curr; curr = curr->parent()) {
155 if (curr == ancestor) 155 if (curr == ancestor)
156 return true; 156 return true;
157 } 157 }
158 158
159 return false; 159 return false;
160 } 160 }
161 161
162 #endif
163
162 bool GraphicsLayer::setChildren(const GraphicsLayerVector& newChildren) 164 bool GraphicsLayer::setChildren(const GraphicsLayerVector& newChildren)
163 { 165 {
164 // If the contents of the arrays are the same, nothing to do. 166 // If the contents of the arrays are the same, nothing to do.
165 if (newChildren == m_children) 167 if (newChildren == m_children)
166 return false; 168 return false;
167 169
168 removeAllChildren(); 170 removeAllChildren();
169 171
170 size_t listSize = newChildren.size(); 172 size_t listSize = newChildren.size();
171 for (size_t i = 0; i < listSize; ++i) 173 for (size_t i = 0; i < listSize; ++i)
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 330 }
329 331
330 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I ntRect& clip) 332 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I ntRect& clip)
331 { 333 {
332 if (!m_client) 334 if (!m_client)
333 return; 335 return;
334 incrementPaintCount(); 336 incrementPaintCount();
335 m_client->paintContents(this, context, m_paintingPhase, clip); 337 m_client->paintContents(this, context, m_paintingPhase, clip);
336 } 338 }
337 339
338 void GraphicsLayer::setZPosition(float position)
339 {
340 m_zPosition = position;
341 }
342
343 void GraphicsLayer::updateChildList() 340 void GraphicsLayer::updateChildList()
344 { 341 {
345 WebLayer* childHost = m_layer->layer(); 342 WebLayer* childHost = m_layer->layer();
346 childHost->removeAllChildren(); 343 childHost->removeAllChildren();
347 344
348 clearContentsLayerIfUnregistered(); 345 clearContentsLayerIfUnregistered();
349 346
350 if (m_contentsLayer) { 347 if (m_contentsLayer) {
351 // FIXME: add the contents layer in the correct order with negative z-or der children. 348 // FIXME: add the contents layer in the correct order with negative z-or der children.
352 // This does not cause visible rendering issues because currently conten ts layers are only used 349 // This does not cause visible rendering issues because currently conten ts layers are only used
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 ts << repaintRectsCopy[i].x() << " "; 677 ts << repaintRectsCopy[i].x() << " ";
681 ts << repaintRectsCopy[i].y() << " "; 678 ts << repaintRectsCopy[i].y() << " ";
682 ts << repaintRectsCopy[i].width() << " "; 679 ts << repaintRectsCopy[i].width() << " ";
683 ts << repaintRectsCopy[i].height(); 680 ts << repaintRectsCopy[i].height();
684 ts << ")\n"; 681 ts << ")\n";
685 } 682 }
686 writeIndent(ts, indent + 1); 683 writeIndent(ts, indent + 1);
687 ts << ")\n"; 684 ts << ")\n";
688 } 685 }
689 686
690 if ((flags & LayerTreeIncludesPaintingPhases) && paintingPhase()) { 687 if ((flags & LayerTreeIncludesPaintingPhases) && m_paintingPhase) {
691 writeIndent(ts, indent + 1); 688 writeIndent(ts, indent + 1);
692 ts << "(paintingPhases\n"; 689 ts << "(paintingPhases\n";
693 if (paintingPhase() & GraphicsLayerPaintBackground) { 690 if (m_paintingPhase & GraphicsLayerPaintBackground) {
694 writeIndent(ts, indent + 2); 691 writeIndent(ts, indent + 2);
695 ts << "GraphicsLayerPaintBackground\n"; 692 ts << "GraphicsLayerPaintBackground\n";
696 } 693 }
697 if (paintingPhase() & GraphicsLayerPaintForeground) { 694 if (m_paintingPhase & GraphicsLayerPaintForeground) {
698 writeIndent(ts, indent + 2); 695 writeIndent(ts, indent + 2);
699 ts << "GraphicsLayerPaintForeground\n"; 696 ts << "GraphicsLayerPaintForeground\n";
700 } 697 }
701 if (paintingPhase() & GraphicsLayerPaintMask) { 698 if (m_paintingPhase & GraphicsLayerPaintMask) {
702 writeIndent(ts, indent + 2); 699 writeIndent(ts, indent + 2);
703 ts << "GraphicsLayerPaintMask\n"; 700 ts << "GraphicsLayerPaintMask\n";
704 } 701 }
705 if (paintingPhase() & GraphicsLayerPaintChildClippingMask) { 702 if (m_paintingPhase & GraphicsLayerPaintChildClippingMask) {
706 writeIndent(ts, indent + 2); 703 writeIndent(ts, indent + 2);
707 ts << "GraphicsLayerPaintChildClippingMask\n"; 704 ts << "GraphicsLayerPaintChildClippingMask\n";
708 } 705 }
709 if (paintingPhase() & GraphicsLayerPaintOverflowContents) { 706 if (m_paintingPhase & GraphicsLayerPaintOverflowContents) {
710 writeIndent(ts, indent + 2); 707 writeIndent(ts, indent + 2);
711 ts << "GraphicsLayerPaintOverflowContents\n"; 708 ts << "GraphicsLayerPaintOverflowContents\n";
712 } 709 }
713 if (paintingPhase() & GraphicsLayerPaintCompositedScroll) { 710 if (m_paintingPhase & GraphicsLayerPaintCompositedScroll) {
714 writeIndent(ts, indent + 2); 711 writeIndent(ts, indent + 2);
715 ts << "GraphicsLayerPaintCompositedScroll\n"; 712 ts << "GraphicsLayerPaintCompositedScroll\n";
716 } 713 }
717 writeIndent(ts, indent + 1); 714 writeIndent(ts, indent + 1);
718 ts << ")\n"; 715 ts << ")\n";
719 } 716 }
720 717
721 if (flags & LayerTreeIncludesClipAndScrollParents) { 718 if (flags & LayerTreeIncludesClipAndScrollParents) {
722 if (m_hasScrollParent) { 719 if (m_hasScrollParent) {
723 writeIndent(ts, indent + 1); 720 writeIndent(ts, indent + 1);
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 if (m_isRootForIsolatedGroup == isolated) 961 if (m_isRootForIsolatedGroup == isolated)
965 return; 962 return;
966 m_isRootForIsolatedGroup = isolated; 963 m_isRootForIsolatedGroup = isolated;
967 platformLayer()->setIsRootForIsolatedGroup(isolated); 964 platformLayer()->setIsRootForIsolatedGroup(isolated);
968 } 965 }
969 966
970 void GraphicsLayer::setContentsNeedsDisplay() 967 void GraphicsLayer::setContentsNeedsDisplay()
971 { 968 {
972 if (WebLayer* contentsLayer = contentsLayerIfRegistered()) { 969 if (WebLayer* contentsLayer = contentsLayerIfRegistered()) {
973 contentsLayer->invalidate(); 970 contentsLayer->invalidate();
974 addRepaintRect(contentsRect()); 971 addRepaintRect(m_contentsRect);
975 } 972 }
976 } 973 }
977 974
978 void GraphicsLayer::setNeedsDisplay() 975 void GraphicsLayer::setNeedsDisplay()
979 { 976 {
980 if (drawsContent()) { 977 if (drawsContent()) {
981 m_layer->layer()->invalidate(); 978 m_layer->layer()->invalidate();
982 addRepaintRect(FloatRect(FloatPoint(), m_size)); 979 addRepaintRect(FloatRect(FloatPoint(), m_size));
983 for (size_t i = 0; i < m_linkHighlights.size(); ++i) 980 for (size_t i = 0; i < m_linkHighlights.size(); ++i)
984 m_linkHighlights[i]->invalidate(); 981 m_linkHighlights[i]->invalidate();
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 #ifndef NDEBUG 1229 #ifndef NDEBUG
1233 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) 1230 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer)
1234 { 1231 {
1235 if (!layer) 1232 if (!layer)
1236 return; 1233 return;
1237 1234
1238 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); 1235 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo);
1239 fprintf(stderr, "%s\n", output.utf8().data()); 1236 fprintf(stderr, "%s\n", output.utf8().data());
1240 } 1237 }
1241 #endif 1238 #endif
OLDNEW
« no previous file with comments | « Source/platform/graphics/GraphicsLayer.h ('k') | Source/web/tests/CompositedLayerMappingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698