OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "android_webview/browser/in_process_view_renderer.h" | 5 #include "android_webview/browser/in_process_view_renderer.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "android_webview/browser/scoped_app_gl_state_restore.h" | 9 #include "android_webview/browser/scoped_app_gl_state_restore.h" |
10 #include "android_webview/public/browser/draw_gl.h" | 10 #include "android_webview/public/browser/draw_gl.h" |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 DCHECK(dip_scale_ > 0); | 531 DCHECK(dip_scale_ > 0); |
532 // In general we don't guarantee that the scroll offset transforms are | 532 // In general we don't guarantee that the scroll offset transforms are |
533 // symmetrical. That is if scrolling from JS to offset1 results in a native | 533 // symmetrical. That is if scrolling from JS to offset1 results in a native |
534 // offset2 then scrolling from UI to offset2 results in JS being scrolled to | 534 // offset2 then scrolling from UI to offset2 results in JS being scrolled to |
535 // offset1 again. | 535 // offset1 again. |
536 // The reason we explicitly do rounding here is that it seems to yeld the | 536 // The reason we explicitly do rounding here is that it seems to yeld the |
537 // most stabile transformation. | 537 // most stabile transformation. |
538 gfx::Vector2dF new_value_css = gfx::ToRoundedVector2d( | 538 gfx::Vector2dF new_value_css = gfx::ToRoundedVector2d( |
539 gfx::ScaleVector2d(new_value, 1.0f / (dip_scale_ * page_scale_factor_))); | 539 gfx::ScaleVector2d(new_value, 1.0f / (dip_scale_ * page_scale_factor_))); |
540 | 540 |
541 DCHECK(scroll_offset_css_ != new_value_css); | 541 // It's possible that more than one set of unique physical coordinates maps |
| 542 // to the same set of CSS coordinates which means we can't reliably early-out |
| 543 // earlier in the call stack. |
| 544 if (scroll_offset_css_ == new_value_css) |
| 545 return; |
542 | 546 |
543 scroll_offset_css_ = new_value_css; | 547 scroll_offset_css_ = new_value_css; |
544 | 548 |
545 if (compositor_) | 549 if (compositor_) |
546 compositor_->DidChangeRootLayerScrollOffset(); | 550 compositor_->DidChangeRootLayerScrollOffset(); |
547 } | 551 } |
548 | 552 |
549 void InProcessViewRenderer::DidUpdateContent() { | 553 void InProcessViewRenderer::DidUpdateContent() { |
550 if (on_new_picture_enable_) | 554 if (on_new_picture_enable_) |
551 client_->OnNewPicture(); | 555 client_->OnNewPicture(); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 base::StringAppendF(&str, | 673 base::StringAppendF(&str, |
670 "surface width height: [%d %d] ", | 674 "surface width height: [%d %d] ", |
671 draw_info->width, | 675 draw_info->width, |
672 draw_info->height); | 676 draw_info->height); |
673 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); | 677 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); |
674 } | 678 } |
675 return str; | 679 return str; |
676 } | 680 } |
677 | 681 |
678 } // namespace android_webview | 682 } // namespace android_webview |
OLD | NEW |