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

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

Issue 8748019: Make sure the document's scroll position is always up-to-date before... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/renderer_accessibility.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "content/common/view_messages.h" 6 #include "content/common/view_messages.h"
7 #include "content/public/common/content_switches.h" 7 #include "content/public/common/content_switches.h"
8 #include "content/renderer/render_view_impl.h" 8 #include "content/renderer/render_view_impl.h"
9 #include "content/renderer/renderer_accessibility.h" 9 #include "content/renderer/renderer_accessibility.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec t.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec t.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 NOTREACHED(); 74 NOTREACHED();
75 return false; 75 return false;
76 } 76 }
77 return true; 77 return true;
78 } 78 }
79 79
80 RendererAccessibility::RendererAccessibility(RenderViewImpl* render_view) 80 RendererAccessibility::RendererAccessibility(RenderViewImpl* render_view)
81 : content::RenderViewObserver(render_view), 81 : content::RenderViewObserver(render_view),
82 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), 82 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
83 browser_root_(NULL), 83 browser_root_(NULL),
84 last_scroll_offset_(gfx::Size()),
84 ack_pending_(false), 85 ack_pending_(false),
85 logging_(false), 86 logging_(false),
86 sent_load_complete_(false) { 87 sent_load_complete_(false) {
87 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 88 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
88 if (command_line.HasSwitch(switches::kEnableAccessibility)) 89 if (command_line.HasSwitch(switches::kEnableAccessibility))
89 WebAccessibilityObject::enableAccessibility(); 90 WebAccessibilityObject::enableAccessibility();
90 if (command_line.HasSwitch(switches::kEnableAccessibilityLogging)) 91 if (command_line.HasSwitch(switches::kEnableAccessibilityLogging))
91 logging_ = true; 92 logging_ = true;
92 } 93 }
93 94
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 158
158 if (notification != WebKit::WebAccessibilityNotificationLoadComplete && 159 if (notification != WebKit::WebAccessibilityNotificationLoadComplete &&
159 !sent_load_complete_) { 160 !sent_load_complete_) {
160 // Load complete should be our first notification sent. Send it manually 161 // Load complete should be our first notification sent. Send it manually
161 // in cases where we don't get it first to avoid focus problems. 162 // in cases where we don't get it first to avoid focus problems.
162 PostAccessibilityNotification( 163 PostAccessibilityNotification(
163 document.accessibilityObject(), 164 document.accessibilityObject(),
164 WebKit::WebAccessibilityNotificationLoadComplete); 165 WebKit::WebAccessibilityNotificationLoadComplete);
165 } 166 }
166 167
168 gfx::Size scroll_offset = document.frame()->scrollOffset();
169 if (scroll_offset != last_scroll_offset_) {
170 // Make sure the browser is always aware of the scroll position of
171 // the root document element by posting a generic notification that
172 // will update it.
173 // TODO(dmazzoni): remove this as soon as
174 // https://bugs.webkit.org/show_bug.cgi?id=73460 is fixed.
175 last_scroll_offset_ = scroll_offset;
176 PostAccessibilityNotification(
177 document.accessibilityObject(),
178 WebKit::WebAccessibilityNotificationLayoutComplete);
179 }
180
167 if (notification == WebKit::WebAccessibilityNotificationLoadComplete) 181 if (notification == WebKit::WebAccessibilityNotificationLoadComplete)
168 sent_load_complete_ = true; 182 sent_load_complete_ = true;
169 183
170 // Add the accessibility object to our cache and ensure it's valid. 184 // Add the accessibility object to our cache and ensure it's valid.
171 Notification acc_notification; 185 Notification acc_notification;
172 acc_notification.id = obj.axID(); 186 acc_notification.id = obj.axID();
173 acc_notification.type = notification; 187 acc_notification.type = notification;
174 188
175 ViewHostMsg_AccEvent::Value temp; 189 ViewHostMsg_AccEvent::Value temp;
176 if (!WebAccessibilityNotificationToViewHostMsg(notification, &temp)) 190 if (!WebAccessibilityNotificationToViewHostMsg(notification, &temp))
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 439
426 WebDocument RendererAccessibility::GetMainDocument() { 440 WebDocument RendererAccessibility::GetMainDocument() {
427 WebView* view = render_view()->GetWebView(); 441 WebView* view = render_view()->GetWebView();
428 WebFrame* main_frame = view ? view->mainFrame() : NULL; 442 WebFrame* main_frame = view ? view->mainFrame() : NULL;
429 443
430 if (main_frame) 444 if (main_frame)
431 return main_frame->document(); 445 return main_frame->document();
432 else 446 else
433 return WebDocument(); 447 return WebDocument();
434 } 448 }
OLDNEW
« no previous file with comments | « content/renderer/renderer_accessibility.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698