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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 GetInputMethod()->CancelComposition(this); | 934 GetInputMethod()->CancelComposition(this); |
935 has_composition_text_ = false; | 935 has_composition_text_ = false; |
936 } | 936 } |
937 | 937 |
938 void RenderWidgetHostViewAura::ImeCompositionRangeChanged( | 938 void RenderWidgetHostViewAura::ImeCompositionRangeChanged( |
939 const gfx::Range& range, | 939 const gfx::Range& range, |
940 const std::vector<gfx::Rect>& character_bounds) { | 940 const std::vector<gfx::Rect>& character_bounds) { |
941 composition_character_bounds_ = character_bounds; | 941 composition_character_bounds_ = character_bounds; |
942 } | 942 } |
943 | 943 |
944 void RenderWidgetHostViewAura::DidUpdateBackingStore( | |
945 const gfx::Rect& scroll_rect, | |
946 const gfx::Vector2d& scroll_delta, | |
947 const std::vector<gfx::Rect>& copy_rects, | |
948 const std::vector<ui::LatencyInfo>& latency_info) { | |
949 for (size_t i = 0; i < latency_info.size(); i++) | |
950 software_latency_info_.push_back(latency_info[i]); | |
951 | |
952 // Use the state of the RenderWidgetHost and not the window as the two may | |
953 // differ. In particular if the window is hidden but the renderer isn't and we | |
954 // ignore the update and the window is made visible again the layer isn't | |
955 // marked as dirty and we show the wrong thing. | |
956 if (host_->is_hidden()) | |
957 return; | |
958 | |
959 gfx::Rect clip_rect; | |
960 if (paint_canvas_) { | |
961 SkRect sk_clip_rect; | |
962 if (paint_canvas_->sk_canvas()->getClipBounds(&sk_clip_rect)) | |
963 clip_rect = gfx::ToEnclosingRect(gfx::SkRectToRectF(sk_clip_rect)); | |
964 } | |
965 | |
966 if (!scroll_rect.IsEmpty()) | |
967 SchedulePaintIfNotInClip(scroll_rect, clip_rect); | |
968 | |
969 #if defined(OS_WIN) | |
970 aura::WindowTreeHost* host = window_->GetHost(); | |
971 #endif | |
972 for (size_t i = 0; i < copy_rects.size(); ++i) { | |
973 gfx::Rect rect = gfx::SubtractRects(copy_rects[i], scroll_rect); | |
974 if (rect.IsEmpty()) | |
975 continue; | |
976 | |
977 SchedulePaintIfNotInClip(rect, clip_rect); | |
978 | |
979 #if defined(OS_WIN) | |
980 if (host) { | |
981 // Send the invalid rect in screen coordinates. | |
982 gfx::Rect screen_rect = GetViewBounds(); | |
983 gfx::Rect invalid_screen_rect(rect); | |
984 invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y()); | |
985 HWND hwnd = host->GetAcceleratedWidget(); | |
986 PaintPluginWindowsHelper(hwnd, invalid_screen_rect); | |
987 } | |
988 #endif // defined(OS_WIN) | |
989 } | |
990 } | |
991 | |
992 void RenderWidgetHostViewAura::RenderProcessGone(base::TerminationStatus status, | 944 void RenderWidgetHostViewAura::RenderProcessGone(base::TerminationStatus status, |
993 int error_code) { | 945 int error_code) { |
994 UpdateCursorIfOverSelf(); | 946 UpdateCursorIfOverSelf(); |
995 Destroy(); | 947 Destroy(); |
996 } | 948 } |
997 | 949 |
998 void RenderWidgetHostViewAura::Destroy() { | 950 void RenderWidgetHostViewAura::Destroy() { |
999 // Beware, this function is not called on all destruction paths. It will | 951 // Beware, this function is not called on all destruction paths. It will |
1000 // implicitly end up calling ~RenderWidgetHostViewAura though, so all | 952 // implicitly end up calling ~RenderWidgetHostViewAura though, so all |
1001 // destruction/cleanup code should happen there, not here. | 953 // destruction/cleanup code should happen there, not here. |
(...skipping 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3189 RenderWidgetHost* widget) { | 3141 RenderWidgetHost* widget) { |
3190 return new RenderWidgetHostViewAura(widget); | 3142 return new RenderWidgetHostViewAura(widget); |
3191 } | 3143 } |
3192 | 3144 |
3193 // static | 3145 // static |
3194 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3146 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3195 GetScreenInfoForWindow(results, NULL); | 3147 GetScreenInfoForWindow(results, NULL); |
3196 } | 3148 } |
3197 | 3149 |
3198 } // namespace content | 3150 } // namespace content |
OLD | NEW |