| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 if (paint_canvas_) { | 550 if (paint_canvas_) { |
| 551 SkRect sk_clip_rect; | 551 SkRect sk_clip_rect; |
| 552 if (paint_canvas_->sk_canvas()->getClipBounds(&sk_clip_rect)) | 552 if (paint_canvas_->sk_canvas()->getClipBounds(&sk_clip_rect)) |
| 553 clip_rect = gfx::SkRectToRect(sk_clip_rect); | 553 clip_rect = gfx::SkRectToRect(sk_clip_rect); |
| 554 } | 554 } |
| 555 | 555 |
| 556 if (!scroll_rect.IsEmpty()) | 556 if (!scroll_rect.IsEmpty()) |
| 557 SchedulePaintIfNotInClip(scroll_rect, clip_rect); | 557 SchedulePaintIfNotInClip(scroll_rect, clip_rect); |
| 558 | 558 |
| 559 for (size_t i = 0; i < copy_rects.size(); ++i) { | 559 for (size_t i = 0; i < copy_rects.size(); ++i) { |
| 560 gfx::Rect rect = copy_rects[i]; | 560 gfx::Rect rect = gfx::Subtraction(copy_rects[i], scroll_rect); |
| 561 rect.Subtract(scroll_rect); | |
| 562 if (rect.IsEmpty()) | 561 if (rect.IsEmpty()) |
| 563 continue; | 562 continue; |
| 564 | 563 |
| 565 SchedulePaintIfNotInClip(rect, clip_rect); | 564 SchedulePaintIfNotInClip(rect, clip_rect); |
| 566 | 565 |
| 567 #if defined(OS_WIN) | 566 #if defined(OS_WIN) |
| 568 // Send the invalid rect in screen coordinates. | 567 // Send the invalid rect in screen coordinates. |
| 569 gfx::Rect screen_rect = GetViewBounds(); | 568 gfx::Rect screen_rect = GetViewBounds(); |
| 570 gfx::Rect invalid_screen_rect(rect); | 569 gfx::Rect invalid_screen_rect(rect); |
| 571 invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y()); | 570 invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y()); |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 aura::client::GetScreenPositionClient(root_window); | 1160 aura::client::GetScreenPositionClient(root_window); |
| 1162 screen_position_client->ConvertPointToScreen(window_, &origin); | 1161 screen_position_client->ConvertPointToScreen(window_, &origin); |
| 1163 screen_position_client->ConvertPointToScreen(window_, &end); | 1162 screen_position_client->ConvertPointToScreen(window_, &end); |
| 1164 return gfx::Rect(origin.x(), | 1163 return gfx::Rect(origin.x(), |
| 1165 origin.y(), | 1164 origin.y(), |
| 1166 end.x() - origin.x(), | 1165 end.x() - origin.x(), |
| 1167 end.y() - origin.y()); | 1166 end.y() - origin.y()); |
| 1168 } | 1167 } |
| 1169 | 1168 |
| 1170 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() { | 1169 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() { |
| 1171 gfx::Rect rect = selection_start_rect_; | 1170 const gfx::Rect rect = gfx::Union(selection_start_rect_, selection_end_rect_); |
| 1172 rect.Union(selection_end_rect_); | |
| 1173 return ConvertRectToScreen(rect); | 1171 return ConvertRectToScreen(rect); |
| 1174 } | 1172 } |
| 1175 | 1173 |
| 1176 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds(uint32 index, | 1174 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds(uint32 index, |
| 1177 gfx::Rect* rect) { | 1175 gfx::Rect* rect) { |
| 1178 DCHECK(rect); | 1176 DCHECK(rect); |
| 1179 if (index >= composition_character_bounds_.size()) | 1177 if (index >= composition_character_bounds_.size()) |
| 1180 return false; | 1178 return false; |
| 1181 *rect = ConvertRectToScreen(composition_character_bounds_[index]); | 1179 *rect = ConvertRectToScreen(composition_character_bounds_[index]); |
| 1182 return true; | 1180 return true; |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1792 } else { | 1790 } else { |
| 1793 unlocked_mouse_position_.SetPoint(event->windowX, event->windowY); | 1791 unlocked_mouse_position_.SetPoint(event->windowX, event->windowY); |
| 1794 unlocked_global_mouse_position_.SetPoint(event->globalX, event->globalY); | 1792 unlocked_global_mouse_position_.SetPoint(event->globalX, event->globalY); |
| 1795 } | 1793 } |
| 1796 } | 1794 } |
| 1797 | 1795 |
| 1798 void RenderWidgetHostViewAura::SchedulePaintIfNotInClip( | 1796 void RenderWidgetHostViewAura::SchedulePaintIfNotInClip( |
| 1799 const gfx::Rect& rect, | 1797 const gfx::Rect& rect, |
| 1800 const gfx::Rect& clip) { | 1798 const gfx::Rect& clip) { |
| 1801 if (!clip.IsEmpty()) { | 1799 if (!clip.IsEmpty()) { |
| 1802 gfx::Rect to_paint = rect; | 1800 gfx::Rect to_paint = gfx::Subtraction(rect, clip); |
| 1803 to_paint.Subtract(clip); | |
| 1804 if (!to_paint.IsEmpty()) | 1801 if (!to_paint.IsEmpty()) |
| 1805 window_->SchedulePaintInRect(to_paint); | 1802 window_->SchedulePaintInRect(to_paint); |
| 1806 } else { | 1803 } else { |
| 1807 window_->SchedulePaintInRect(rect); | 1804 window_->SchedulePaintInRect(rect); |
| 1808 } | 1805 } |
| 1809 } | 1806 } |
| 1810 | 1807 |
| 1811 bool RenderWidgetHostViewAura::ShouldMoveToCenter() { | 1808 bool RenderWidgetHostViewAura::ShouldMoveToCenter() { |
| 1812 gfx::Rect rect = window_->bounds(); | 1809 gfx::Rect rect = window_->bounds(); |
| 1813 int border_x = rect.width() * kMouseLockBorderPercentage / 100; | 1810 int border_x = rect.width() * kMouseLockBorderPercentage / 100; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1889 RenderWidgetHost* widget) { | 1886 RenderWidgetHost* widget) { |
| 1890 return new RenderWidgetHostViewAura(widget); | 1887 return new RenderWidgetHostViewAura(widget); |
| 1891 } | 1888 } |
| 1892 | 1889 |
| 1893 // static | 1890 // static |
| 1894 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1891 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 1895 GetScreenInfoForWindow(results, NULL); | 1892 GetScreenInfoForWindow(results, NULL); |
| 1896 } | 1893 } |
| 1897 | 1894 |
| 1898 } // namespace content | 1895 } // namespace content |
| OLD | NEW |