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

Side by Side Diff: cc/trees/property_tree.cc

Issue 2792143002: cc: Avoid Crash in Effect Tree Animation by Element ID (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 auto iterator = property_trees()->element_id_to_effect_node_index.find(id); 856 auto iterator = property_trees()->element_id_to_effect_node_index.find(id);
857 if (iterator == property_trees()->element_id_to_effect_node_index.end()) 857 if (iterator == property_trees()->element_id_to_effect_node_index.end())
858 return nullptr; 858 return nullptr;
859 859
860 return Node(iterator->second); 860 return Node(iterator->second);
861 } 861 }
862 862
863 bool EffectTree::OnOpacityAnimated(ElementId id, float opacity) { 863 bool EffectTree::OnOpacityAnimated(ElementId id, float opacity) {
864 EffectNode* node = FindNodeFromElementId(id); 864 EffectNode* node = FindNodeFromElementId(id);
865 DCHECK(node); 865 DCHECK(node);
866 // TODO(crbug.com/706766): Avoid crash. Need more investigation for what is
867 // calling this without setting element id.
868 if (!node)
869 return false;
870
866 if (node->opacity == opacity) 871 if (node->opacity == opacity)
867 return false; 872 return false;
868 node->opacity = opacity; 873 node->opacity = opacity;
869 node->effect_changed = true; 874 node->effect_changed = true;
870 property_trees()->changed = true; 875 property_trees()->changed = true;
871 property_trees()->effect_tree.set_needs_update(true); 876 property_trees()->effect_tree.set_needs_update(true);
872 return true; 877 return true;
873 } 878 }
874 879
875 bool EffectTree::OnFilterAnimated(ElementId id, 880 bool EffectTree::OnFilterAnimated(ElementId id,
876 const FilterOperations& filters) { 881 const FilterOperations& filters) {
877 EffectNode* node = FindNodeFromElementId(id); 882 EffectNode* node = FindNodeFromElementId(id);
878 DCHECK(node); 883 DCHECK(node);
884 // TODO(crbug.com/706766): Avoid crash. Need more investigation for what is
885 // calling this without setting element id.
886 if (!node)
887 return false;
888
879 if (node->filters == filters) 889 if (node->filters == filters)
880 return false; 890 return false;
881 node->filters = filters; 891 node->filters = filters;
882 node->effect_changed = true; 892 node->effect_changed = true;
883 property_trees()->changed = true; 893 property_trees()->changed = true;
884 property_trees()->effect_tree.set_needs_update(true); 894 property_trees()->effect_tree.set_needs_update(true);
885 return true; 895 return true;
886 } 896 }
887 897
888 void EffectTree::UpdateEffects(int id) { 898 void EffectTree::UpdateEffects(int id) {
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
2111 const EffectNode* effect_node = effect_tree.Node(effect_id); 2121 const EffectNode* effect_node = effect_tree.Node(effect_id);
2112 2122
2113 if (effect_node->surface_contents_scale.x() != 0.0 && 2123 if (effect_node->surface_contents_scale.x() != 0.0 &&
2114 effect_node->surface_contents_scale.y() != 0.0) 2124 effect_node->surface_contents_scale.y() != 0.0)
2115 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(), 2125 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(),
2116 1.0 / effect_node->surface_contents_scale.y()); 2126 1.0 / effect_node->surface_contents_scale.y());
2117 return screen_space_transform; 2127 return screen_space_transform;
2118 } 2128 }
2119 2129
2120 } // namespace cc 2130 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698