Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 145283003: Switch AccessibilityMode to be a bitmap (Closed) Base URL: https://chromium.googlesource.com/chromium/src@enable
Patch Set: Address dtseng's comments Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 notification_provider_(NULL), 833 notification_provider_(NULL),
834 geolocation_dispatcher_(NULL), 834 geolocation_dispatcher_(NULL),
835 input_tag_speech_dispatcher_(NULL), 835 input_tag_speech_dispatcher_(NULL),
836 speech_recognition_dispatcher_(NULL), 836 speech_recognition_dispatcher_(NULL),
837 media_stream_dispatcher_(NULL), 837 media_stream_dispatcher_(NULL),
838 browser_plugin_manager_(NULL), 838 browser_plugin_manager_(NULL),
839 media_stream_client_(NULL), 839 media_stream_client_(NULL),
840 web_user_media_client_(NULL), 840 web_user_media_client_(NULL),
841 midi_dispatcher_(NULL), 841 midi_dispatcher_(NULL),
842 devtools_agent_(NULL), 842 devtools_agent_(NULL),
843 accessibility_mode_(AccessibilityModeOff), 843 accessibility_mode_(0),
David Tseng 2014/01/27 22:16:06 Define/use the enum here.
aboxhall 2014/01/28 17:48:26 Done.
844 renderer_accessibility_(NULL), 844 renderer_accessibility_(NULL),
845 mouse_lock_dispatcher_(NULL), 845 mouse_lock_dispatcher_(NULL),
846 #if defined(OS_ANDROID) 846 #if defined(OS_ANDROID)
847 body_background_color_(SK_ColorWHITE), 847 body_background_color_(SK_ColorWHITE),
848 expected_content_intent_id_(0), 848 expected_content_intent_id_(0),
849 media_player_manager_(NULL), 849 media_player_manager_(NULL),
850 #endif 850 #endif
851 #if defined(OS_WIN) 851 #if defined(OS_WIN)
852 focused_plugin_id_(-1), 852 focused_plugin_id_(-1),
853 #endif 853 #endif
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 int32 routing_id, 1086 int32 routing_id,
1087 int32 main_frame_routing_id, 1087 int32 main_frame_routing_id,
1088 int32 surface_id, 1088 int32 surface_id,
1089 int64 session_storage_namespace_id, 1089 int64 session_storage_namespace_id,
1090 const base::string16& frame_name, 1090 const base::string16& frame_name,
1091 bool is_renderer_created, 1091 bool is_renderer_created,
1092 bool swapped_out, 1092 bool swapped_out,
1093 bool hidden, 1093 bool hidden,
1094 int32 next_page_id, 1094 int32 next_page_id,
1095 const blink::WebScreenInfo& screen_info, 1095 const blink::WebScreenInfo& screen_info,
1096 AccessibilityMode accessibility_mode, 1096 unsigned int accessibility_mode,
1097 bool allow_partial_swap) { 1097 bool allow_partial_swap) {
1098 DCHECK(routing_id != MSG_ROUTING_NONE); 1098 DCHECK(routing_id != MSG_ROUTING_NONE);
1099 RenderViewImplParams params( 1099 RenderViewImplParams params(
1100 opener_id, 1100 opener_id,
1101 renderer_prefs, 1101 renderer_prefs,
1102 webkit_prefs, 1102 webkit_prefs,
1103 routing_id, 1103 routing_id,
1104 main_frame_routing_id, 1104 main_frame_routing_id,
1105 surface_id, 1105 surface_id,
1106 session_storage_namespace_id, 1106 session_storage_namespace_id,
(...skipping 4173 matching lines...) Expand 10 before | Expand all | Expand 10 after
5280 5280
5281 void RenderViewImpl::OnSetBackground(const SkBitmap& background) { 5281 void RenderViewImpl::OnSetBackground(const SkBitmap& background) {
5282 if (webview()) 5282 if (webview())
5283 webview()->setIsTransparent(!background.empty()); 5283 webview()->setIsTransparent(!background.empty());
5284 if (compositor_) 5284 if (compositor_)
5285 compositor_->setHasTransparentBackground(!background.empty()); 5285 compositor_->setHasTransparentBackground(!background.empty());
5286 5286
5287 SetBackground(background); 5287 SetBackground(background);
5288 } 5288 }
5289 5289
5290 void RenderViewImpl::OnSetAccessibilityMode(AccessibilityMode new_mode) { 5290 void RenderViewImpl::OnSetAccessibilityMode(unsigned int new_mode) {
5291 if (accessibility_mode_ == new_mode) 5291 if (accessibility_mode_ == new_mode)
5292 return; 5292 return;
5293 accessibility_mode_ = new_mode; 5293 accessibility_mode_ = new_mode;
5294 if (renderer_accessibility_) { 5294 if (renderer_accessibility_) {
5295 delete renderer_accessibility_; 5295 delete renderer_accessibility_;
5296 renderer_accessibility_ = NULL; 5296 renderer_accessibility_ = NULL;
5297 } 5297 }
5298 if (accessibility_mode_ == AccessibilityModeComplete) 5298 if (!(accessibility_mode_ & AccessibilityModeFlagRenderer))
David Tseng 2014/01/27 22:16:06 You might want to check this. What happens to !0b0
aboxhall 2014/01/28 17:48:26 In C++, "the value zero (for integral, floating-po
5299 return;
5300
5301 if (!(accessibility_mode_ & AccessibilityModeFlagEditableTextOnly))
5299 renderer_accessibility_ = new RendererAccessibilityComplete(this); 5302 renderer_accessibility_ = new RendererAccessibilityComplete(this);
5300 #if !defined(OS_ANDROID) 5303 #if !defined(OS_ANDROID)
5301 else if (accessibility_mode_ == AccessibilityModeEditableTextOnly) 5304 else if (accessibility_mode_ & AccessibilityModeFlagEditableTextOnly)
5302 renderer_accessibility_ = new RendererAccessibilityFocusOnly(this); 5305 renderer_accessibility_ = new RendererAccessibilityFocusOnly(this);
5303 #endif 5306 #endif
5304 } 5307 }
5305 5308
5306 void RenderViewImpl::OnSetActive(bool active) { 5309 void RenderViewImpl::OnSetActive(bool active) {
5307 if (webview()) 5310 if (webview())
5308 webview()->setIsActive(active); 5311 webview()->setIsActive(active);
5309 5312
5310 #if defined(ENABLE_PLUGINS) && defined(OS_MACOSX) 5313 #if defined(ENABLE_PLUGINS) && defined(OS_MACOSX)
5311 std::set<WebPluginDelegateProxy*>::iterator plugin_it; 5314 std::set<WebPluginDelegateProxy*>::iterator plugin_it;
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
6104 if (main_frame && main_frame->opener()) 6107 if (main_frame && main_frame->opener())
6105 main_frame->setOpener(NULL); 6108 main_frame->setOpener(NULL);
6106 } 6109 }
6107 6110
6108 #if defined(OS_ANDROID) 6111 #if defined(OS_ANDROID)
6109 bool RenderViewImpl::didTapMultipleTargets( 6112 bool RenderViewImpl::didTapMultipleTargets(
6110 const blink::WebGestureEvent& event, 6113 const blink::WebGestureEvent& event,
6111 const WebVector<WebRect>& target_rects) { 6114 const WebVector<WebRect>& target_rects) {
6112 // Never show a disambiguation popup when accessibility is enabled, 6115 // Never show a disambiguation popup when accessibility is enabled,
6113 // as this interferes with "touch exploration". 6116 // as this interferes with "touch exploration".
6114 if (accessibility_mode_ == AccessibilityModeComplete) 6117 if (accessibility_mode_ & AccessibilityModeFlagRenderer &&
David Tseng 2014/01/27 22:16:06 Please define and use accessibility complete in th
aboxhall 2014/01/28 17:48:26 Done. Note that we explicitly don't want to check
6118 accessibility_mode_ & AccessibilityModeFlagPlatform &&
6119 !(accessibility_mode_ & AccessibilityModeFlagEditableTextOnly))
6115 return false; 6120 return false;
6116 6121
6117 gfx::Rect finger_rect( 6122 gfx::Rect finger_rect(
6118 event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2, 6123 event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2,
6119 event.data.tap.width, event.data.tap.height); 6124 event.data.tap.width, event.data.tap.height);
6120 gfx::Rect zoom_rect; 6125 gfx::Rect zoom_rect;
6121 float new_total_scale = 6126 float new_total_scale =
6122 DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor( 6127 DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor(
6123 finger_rect, target_rects, GetSize(), 6128 finger_rect, target_rects, GetSize(),
6124 gfx::Rect(webview()->mainFrame()->visibleContentRect()).size(), 6129 gfx::Rect(webview()->mainFrame()->visibleContentRect()).size(),
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
6264 for (size_t i = 0; i < icon_urls.size(); i++) { 6269 for (size_t i = 0; i < icon_urls.size(); i++) {
6265 WebURL url = icon_urls[i].iconURL(); 6270 WebURL url = icon_urls[i].iconURL();
6266 if (!url.isEmpty()) 6271 if (!url.isEmpty())
6267 urls.push_back(FaviconURL(url, 6272 urls.push_back(FaviconURL(url,
6268 ToFaviconType(icon_urls[i].iconType()))); 6273 ToFaviconType(icon_urls[i].iconType())));
6269 } 6274 }
6270 SendUpdateFaviconURL(urls); 6275 SendUpdateFaviconURL(urls);
6271 } 6276 }
6272 6277
6273 } // namespace content 6278 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698