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
3 // found in the LICENSE file.
5 #include "android_webview/browser/parent_compositor_draw_constraints.h"
7 #include "android_webview/browser/child_frame.h"
9 namespace android_webview
{
11 ParentCompositorDrawConstraints::ParentCompositorDrawConstraints()
12 : is_layer(false), surface_rect_empty(false) {
15 ParentCompositorDrawConstraints::ParentCompositorDrawConstraints(
17 const gfx::Transform
& transform
,
18 bool surface_rect_empty
)
21 surface_rect_empty(surface_rect_empty
) {}
23 bool ParentCompositorDrawConstraints::NeedUpdate(
24 const ChildFrame
& frame
) const {
25 if (is_layer
!= frame
.is_layer
||
26 transform
!= frame
.transform_for_tile_priority
) {
30 // Viewport for tile priority does not depend on surface rect in this case.
31 if (frame
.offscreen_pre_raster
|| is_layer
)
34 // Workaround for corner case. See crbug.com/417479.
35 return frame
.viewport_rect_for_tile_priority_empty
&& !surface_rect_empty
;
38 } // namespace webview