Commit b8c12bfb authored by dtseng@chromium.org's avatar dtseng@chromium.org

Remove special casing for firing load completes.

With the new logic in SendPendingAccessibilityNotifications, it is no longer necessary to fire a load complete  as the first notification to the browser. Since we walk the parent chain, looking for the first entry actually in our browser cache, we will always end up walking up to the root.

This change therefore also makes sure that notifications fired on the root will include all of the subtree when composing the notification.
BUG=none.
TEST=manual.

Merge remote-tracking branch 'origin' into build_break

Merge branch 'trunk' of http://git.chromium.org/git/chromium into build_break

Attempt fixes at chrome frame tests redness.

TBR=dtseng

Review URL: http://codereview.chromium.org/8869006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113702 0039d316-1c4b-4281-b951-d872f2087c98
parent 45cf3dc6
......@@ -42,7 +42,10 @@ class RendererAccessibilityBrowserTest : public InProcessBrowserTest {
RenderViewHost* view_host = static_cast<RenderViewHost*>(host);
view_host->set_save_accessibility_tree_for_testing(true);
view_host->EnableRendererAccessibility();
while (view_host->accessibility_tree_for_testing().state &
(1 << WebAccessibility::STATE_BUSY)) {
tree_updated_observer.Wait();
}
return view_host->accessibility_tree_for_testing();
}
......
......@@ -1400,14 +1400,13 @@ void RenderViewHost::OnAccessibilityNotifications(
if (param.notification_type == ViewHostMsg_AccEvent::LOAD_COMPLETE &&
save_accessibility_tree_for_testing_) {
accessibility_tree_ = param.acc_tree;
}
}
content::NotificationService::current()->Notify(
content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED,
content::Source<RenderViewHost>(this),
content::NotificationService::NoDetails());
}
}
}
Send(new ViewMsg_AccessibilityNotifications_ACK(routing_id()));
}
......
......@@ -86,8 +86,7 @@ RendererAccessibility::RendererAccessibility(RenderViewImpl* render_view)
browser_root_(NULL),
last_scroll_offset_(gfx::Size()),
ack_pending_(false),
logging_(false),
sent_load_complete_(false) {
logging_(false) {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kEnableAccessibility))
WebAccessibilityObject::enableAccessibility();
......@@ -149,7 +148,7 @@ void RendererAccessibility::DidFinishLoad(WebKit::WebFrame* frame) {
if (!browser_root_ || new_root.axID() != browser_root_->id) {
PostAccessibilityNotification(
new_root,
WebKit::WebAccessibilityNotificationLoadComplete);
WebKit::WebAccessibilityNotificationLayoutComplete);
}
}
......@@ -163,15 +162,6 @@ void RendererAccessibility::PostAccessibilityNotification(
if (document.isNull())
return;
if (notification != WebKit::WebAccessibilityNotificationLoadComplete &&
!sent_load_complete_) {
// Load complete should be our first notification sent. Send it manually
// in cases where we don't get it first to avoid focus problems.
PostAccessibilityNotification(
document.accessibilityObject(),
WebKit::WebAccessibilityNotificationLoadComplete);
}
gfx::Size scroll_offset = document.frame()->scrollOffset();
if (scroll_offset != last_scroll_offset_) {
// Make sure the browser is always aware of the scroll position of
......@@ -185,9 +175,6 @@ void RendererAccessibility::PostAccessibilityNotification(
WebKit::WebAccessibilityNotificationLayoutComplete);
}
if (notification == WebKit::WebAccessibilityNotificationLoadComplete)
sent_load_complete_ = true;
// Add the accessibility object to our cache and ensure it's valid.
Notification acc_notification;
acc_notification.id = obj.axID();
......@@ -230,7 +217,10 @@ void RendererAccessibility::SendPendingAccessibilityNotifications() {
for (size_t i = 0; i < pending_notifications_.size(); ++i) {
Notification& notification = pending_notifications_[i];
bool includes_children = ShouldIncludeChildren(notification);
// TODO(dtseng): Come up with a cleaner way of deciding to include children.
int root_id = document.accessibilityObject().axID();
bool includes_children = ShouldIncludeChildren(notification) ||
root_id == notification.id;
WebAccessibilityObject obj = document.accessibilityObjectFromID(
notification.id);
......@@ -239,7 +229,6 @@ void RendererAccessibility::SendPendingAccessibilityNotifications() {
// notification on a node before the page has loaded. Work our way
// up the parent chain until we find a node the browser has, or until
// we reach the root.
int root_id = document.accessibilityObject().axID();
while (browser_id_map_.find(obj.axID()) == browser_id_map_.end() &&
obj.isValid() &&
obj.axID() != root_id) {
......@@ -468,7 +457,7 @@ void RendererAccessibility::OnEnableAccessibility() {
// accessibility tree by sending it a 'load complete' notification.
PostAccessibilityNotification(
document.accessibilityObject(),
WebKit::WebAccessibilityNotificationLoadComplete);
WebKit::WebAccessibilityNotificationLayoutComplete);
}
}
......
......@@ -120,9 +120,6 @@ class RendererAccessibility : public content::RenderViewObserver {
// True if verbose logging of accessibility events is on.
bool logging_;
// True if we've sent a load complete notification for this page already.
bool sent_load_complete_;
DISALLOW_COPY_AND_ASSIGN(RendererAccessibility);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment