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