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

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: Tweak AccessibilityModeHelperTest Created 6 years, 10 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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 int32 routing_id, 1082 int32 routing_id,
1083 int32 main_frame_routing_id, 1083 int32 main_frame_routing_id,
1084 int32 surface_id, 1084 int32 surface_id,
1085 int64 session_storage_namespace_id, 1085 int64 session_storage_namespace_id,
1086 const base::string16& frame_name, 1086 const base::string16& frame_name,
1087 bool is_renderer_created, 1087 bool is_renderer_created,
1088 bool swapped_out, 1088 bool swapped_out,
1089 bool hidden, 1089 bool hidden,
1090 int32 next_page_id, 1090 int32 next_page_id,
1091 const blink::WebScreenInfo& screen_info, 1091 const blink::WebScreenInfo& screen_info,
1092 AccessibilityMode accessibility_mode, 1092 unsigned int accessibility_mode,
1093 bool allow_partial_swap) { 1093 bool allow_partial_swap) {
1094 DCHECK(routing_id != MSG_ROUTING_NONE); 1094 DCHECK(routing_id != MSG_ROUTING_NONE);
1095 RenderViewImplParams params( 1095 RenderViewImplParams params(
1096 opener_id, 1096 opener_id,
1097 renderer_prefs, 1097 renderer_prefs,
1098 webkit_prefs, 1098 webkit_prefs,
1099 routing_id, 1099 routing_id,
1100 main_frame_routing_id, 1100 main_frame_routing_id,
1101 surface_id, 1101 surface_id,
1102 session_storage_namespace_id, 1102 session_storage_namespace_id,
(...skipping 4177 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))
5299 return;
David Tseng 2014/02/04 20:25:51 What about editable text only? This leads me to be
aboxhall 2014/02/05 16:02:47 Ok, I think it'll be simpler if I go back to what
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 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
6081 if (main_frame && main_frame->opener()) 6084 if (main_frame && main_frame->opener())
6082 main_frame->setOpener(NULL); 6085 main_frame->setOpener(NULL);
6083 } 6086 }
6084 6087
6085 #if defined(OS_ANDROID) 6088 #if defined(OS_ANDROID)
6086 bool RenderViewImpl::didTapMultipleTargets( 6089 bool RenderViewImpl::didTapMultipleTargets(
6087 const blink::WebGestureEvent& event, 6090 const blink::WebGestureEvent& event,
6088 const WebVector<WebRect>& target_rects) { 6091 const WebVector<WebRect>& target_rects) {
6089 // Never show a disambiguation popup when accessibility is enabled, 6092 // Never show a disambiguation popup when accessibility is enabled,
6090 // as this interferes with "touch exploration". 6093 // as this interferes with "touch exploration".
6091 if (accessibility_mode_ == AccessibilityModeComplete) 6094 bool matchesAccessibilityModeComplete =
6095 accessibility_mode_ & AccessibilityModeComplete;
6096 bool hasEditableTextOnlyFlag =
6097 accessibility_mode_ & AccessibilityModeFlagEditableTextOnly;
6098 if (matchesAccessibilityModeComplete && !hasEditableTextOnlyFlag)
6092 return false; 6099 return false;
6093 6100
6094 gfx::Rect finger_rect( 6101 gfx::Rect finger_rect(
6095 event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2, 6102 event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2,
6096 event.data.tap.width, event.data.tap.height); 6103 event.data.tap.width, event.data.tap.height);
6097 gfx::Rect zoom_rect; 6104 gfx::Rect zoom_rect;
6098 float new_total_scale = 6105 float new_total_scale =
6099 DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor( 6106 DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor(
6100 finger_rect, target_rects, GetSize(), 6107 finger_rect, target_rects, GetSize(),
6101 gfx::Rect(webview()->mainFrame()->visibleContentRect()).size(), 6108 gfx::Rect(webview()->mainFrame()->visibleContentRect()).size(),
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
6241 for (size_t i = 0; i < icon_urls.size(); i++) { 6248 for (size_t i = 0; i < icon_urls.size(); i++) {
6242 WebURL url = icon_urls[i].iconURL(); 6249 WebURL url = icon_urls[i].iconURL();
6243 if (!url.isEmpty()) 6250 if (!url.isEmpty())
6244 urls.push_back(FaviconURL(url, 6251 urls.push_back(FaviconURL(url,
6245 ToFaviconType(icon_urls[i].iconType()))); 6252 ToFaviconType(icon_urls[i].iconType())));
6246 } 6253 }
6247 SendUpdateFaviconURL(urls); 6254 SendUpdateFaviconURL(urls);
6248 } 6255 }
6249 6256
6250 } // namespace content 6257 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698