OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 GetInputMethod()->CancelComposition(this); | 918 GetInputMethod()->CancelComposition(this); |
919 has_composition_text_ = false; | 919 has_composition_text_ = false; |
920 } | 920 } |
921 | 921 |
922 void RenderWidgetHostViewAura::ImeCompositionRangeChanged( | 922 void RenderWidgetHostViewAura::ImeCompositionRangeChanged( |
923 const gfx::Range& range, | 923 const gfx::Range& range, |
924 const std::vector<gfx::Rect>& character_bounds) { | 924 const std::vector<gfx::Rect>& character_bounds) { |
925 composition_character_bounds_ = character_bounds; | 925 composition_character_bounds_ = character_bounds; |
926 } | 926 } |
927 | 927 |
928 void RenderWidgetHostViewAura::DidUpdateBackingStore( | |
929 const gfx::Rect& scroll_rect, | |
930 const gfx::Vector2d& scroll_delta, | |
931 const std::vector<gfx::Rect>& copy_rects, | |
932 const std::vector<ui::LatencyInfo>& latency_info) { | |
933 for (size_t i = 0; i < latency_info.size(); i++) | |
934 software_latency_info_.push_back(latency_info[i]); | |
935 | |
936 // Use the state of the RenderWidgetHost and not the window as the two may | |
937 // differ. In particular if the window is hidden but the renderer isn't and we | |
938 // ignore the update and the window is made visible again the layer isn't | |
939 // marked as dirty and we show the wrong thing. | |
940 if (host_->is_hidden()) | |
941 return; | |
942 | |
943 gfx::Rect clip_rect; | |
944 if (paint_canvas_) { | |
945 SkRect sk_clip_rect; | |
946 if (paint_canvas_->sk_canvas()->getClipBounds(&sk_clip_rect)) | |
947 clip_rect = gfx::ToEnclosingRect(gfx::SkRectToRectF(sk_clip_rect)); | |
948 } | |
949 | |
950 if (!scroll_rect.IsEmpty()) | |
951 SchedulePaintIfNotInClip(scroll_rect, clip_rect); | |
952 | |
953 #if defined(OS_WIN) | |
954 aura::WindowTreeHost* host = window_->GetHost(); | |
955 #endif | |
956 for (size_t i = 0; i < copy_rects.size(); ++i) { | |
957 gfx::Rect rect = gfx::SubtractRects(copy_rects[i], scroll_rect); | |
958 if (rect.IsEmpty()) | |
959 continue; | |
960 | |
961 SchedulePaintIfNotInClip(rect, clip_rect); | |
962 | |
963 #if defined(OS_WIN) | |
964 if (host) { | |
965 // Send the invalid rect in screen coordinates. | |
966 gfx::Rect screen_rect = GetViewBounds(); | |
967 gfx::Rect invalid_screen_rect(rect); | |
968 invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y()); | |
969 HWND hwnd = host->GetAcceleratedWidget(); | |
970 PaintPluginWindowsHelper(hwnd, invalid_screen_rect); | |
971 } | |
972 #endif // defined(OS_WIN) | |
973 } | |
974 } | |
975 | |
976 void RenderWidgetHostViewAura::RenderProcessGone(base::TerminationStatus status, | 928 void RenderWidgetHostViewAura::RenderProcessGone(base::TerminationStatus status, |
977 int error_code) { | 929 int error_code) { |
978 UpdateCursorIfOverSelf(); | 930 UpdateCursorIfOverSelf(); |
979 Destroy(); | 931 Destroy(); |
980 } | 932 } |
981 | 933 |
982 void RenderWidgetHostViewAura::Destroy() { | 934 void RenderWidgetHostViewAura::Destroy() { |
983 // Beware, this function is not called on all destruction paths. It will | 935 // Beware, this function is not called on all destruction paths. It will |
984 // implicitly end up calling ~RenderWidgetHostViewAura though, so all | 936 // implicitly end up calling ~RenderWidgetHostViewAura though, so all |
985 // destruction/cleanup code should happen there, not here. | 937 // destruction/cleanup code should happen there, not here. |
(...skipping 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3173 RenderWidgetHost* widget) { | 3125 RenderWidgetHost* widget) { |
3174 return new RenderWidgetHostViewAura(widget); | 3126 return new RenderWidgetHostViewAura(widget); |
3175 } | 3127 } |
3176 | 3128 |
3177 // static | 3129 // static |
3178 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3130 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3179 GetScreenInfoForWindow(results, NULL); | 3131 GetScreenInfoForWindow(results, NULL); |
3180 } | 3132 } |
3181 | 3133 |
3182 } // namespace content | 3134 } // namespace content |
OLD | NEW |