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

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

Issue 2889433002: Workaround transform node NPE in draw_property_utils::UpdateElasticOverscroll (Closed)
Patch Set: Created 3 years, 7 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 "cc/trees/draw_property_utils.h" 5 #include "cc/trees/draw_property_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 PropertyTrees* property_trees, 472 PropertyTrees* property_trees,
473 const LayerType* overscroll_elasticity_layer, 473 const LayerType* overscroll_elasticity_layer,
474 const gfx::Vector2dF& elastic_overscroll) { 474 const gfx::Vector2dF& elastic_overscroll) {
475 if (!overscroll_elasticity_layer) { 475 if (!overscroll_elasticity_layer) {
476 DCHECK(elastic_overscroll.IsZero()); 476 DCHECK(elastic_overscroll.IsZero());
477 return; 477 return;
478 } 478 }
479 479
480 TransformNode* node = property_trees->transform_tree.Node( 480 TransformNode* node = property_trees->transform_tree.Node(
481 overscroll_elasticity_layer->transform_tree_index()); 481 overscroll_elasticity_layer->transform_tree_index());
482 DCHECK(node);
483
484 // TODO(pdr): This is a workaround for https://crbug.com/721772 to avoid
485 // crashing when there's no transform node. This workaround should be removed.
486 if (!node)
487 return;
488
482 if (node->scroll_offset == gfx::ScrollOffset(elastic_overscroll)) 489 if (node->scroll_offset == gfx::ScrollOffset(elastic_overscroll))
483 return; 490 return;
484 491
485 node->scroll_offset = gfx::ScrollOffset(elastic_overscroll); 492 node->scroll_offset = gfx::ScrollOffset(elastic_overscroll);
486 node->needs_local_transform_update = true; 493 node->needs_local_transform_update = true;
487 property_trees->transform_tree.set_needs_update(true); 494 property_trees->transform_tree.set_needs_update(true);
488 } 495 }
489 496
490 #if DCHECK_IS_ON() 497 #if DCHECK_IS_ON()
491 static void ValidatePageScaleLayer(const Layer* page_scale_layer) { 498 static void ValidatePageScaleLayer(const Layer* page_scale_layer) {
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 void UpdateElasticOverscroll(PropertyTrees* property_trees, 1070 void UpdateElasticOverscroll(PropertyTrees* property_trees,
1064 const Layer* overscroll_elasticity_layer, 1071 const Layer* overscroll_elasticity_layer,
1065 const gfx::Vector2dF& elastic_overscroll) { 1072 const gfx::Vector2dF& elastic_overscroll) {
1066 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, 1073 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer,
1067 elastic_overscroll); 1074 elastic_overscroll);
1068 } 1075 }
1069 1076
1070 } // namespace draw_property_utils 1077 } // namespace draw_property_utils
1071 1078
1072 } // namespace cc 1079 } // 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