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

Side by Side Diff: content/renderer/accessibility/render_accessibility_impl.cc

Issue 2956053005: Keep track of fixed positioning in accessibility tree.
Patch Set: Created 3 years, 5 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/accessibility/render_accessibility_impl.h" 5 #include "content/renderer/accessibility/render_accessibility_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <queue> 10 #include <queue>
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 event_msgs.push_back(event_msg); 409 event_msgs.push_back(event_msg);
410 410
411 // For each node in the update, set the location in our map from 411 // For each node in the update, set the location in our map from
412 // ids to locations. 412 // ids to locations.
413 for (size_t i = 0; i < event_msg.update.nodes.size(); ++i) { 413 for (size_t i = 0; i < event_msg.update.nodes.size(); ++i) {
414 ui::AXNodeData& src = event_msg.update.nodes[i]; 414 ui::AXNodeData& src = event_msg.update.nodes[i];
415 ui::AXRelativeBounds& dst = locations_[event_msg.update.nodes[i].id]; 415 ui::AXRelativeBounds& dst = locations_[event_msg.update.nodes[i].id];
416 dst.offset_container_id = src.offset_container_id; 416 dst.offset_container_id = src.offset_container_id;
417 dst.bounds = src.location; 417 dst.bounds = src.location;
418 dst.transform.reset(nullptr); 418 dst.transform.reset(nullptr);
419 dst.is_fixed_positioned = src.is_fixed_positioned;
419 if (src.transform) 420 if (src.transform)
420 dst.transform.reset(new gfx::Transform(*src.transform)); 421 dst.transform.reset(new gfx::Transform(*src.transform));
421 } 422 }
422 423
423 VLOG(1) << "Accessibility event: " << ui::ToString(event.event_type) 424 VLOG(1) << "Accessibility event: " << ui::ToString(event.event_type)
424 << " on node id " << event_msg.id 425 << " on node id " << event_msg.id
425 << "\n" << event_msg.update.ToString(); 426 << "\n" << event_msg.update.ToString();
426 } 427 }
427 428
428 Send(new AccessibilityHostMsg_Events(routing_id(), event_msgs, reset_token_, 429 Send(new AccessibilityHostMsg_Events(routing_id(), event_msgs, reset_token_,
(...skipping 27 matching lines...) Expand all
456 // be new, so don't continue to explore this branch. 457 // be new, so don't continue to explore this branch.
457 int id = obj.AxID(); 458 int id = obj.AxID();
458 auto iter = locations_.find(id); 459 auto iter = locations_.find(id);
459 if (iter == locations_.end()) 460 if (iter == locations_.end())
460 continue; 461 continue;
461 462
462 // If the location has changed, append it to the IPC message. 463 // If the location has changed, append it to the IPC message.
463 WebAXObject offset_container; 464 WebAXObject offset_container;
464 WebFloatRect bounds_in_container; 465 WebFloatRect bounds_in_container;
465 SkMatrix44 container_transform; 466 SkMatrix44 container_transform;
467 bool is_fixed_positioned;
466 obj.GetRelativeBounds(offset_container, bounds_in_container, 468 obj.GetRelativeBounds(offset_container, bounds_in_container,
467 container_transform); 469 container_transform, is_fixed_positioned);
468 ui::AXRelativeBounds new_location; 470 ui::AXRelativeBounds new_location;
469 new_location.offset_container_id = offset_container.AxID(); 471 new_location.offset_container_id = offset_container.AxID();
470 new_location.bounds = bounds_in_container; 472 new_location.bounds = bounds_in_container;
473 new_location.is_fixed_positioned = is_fixed_positioned;
471 if (!container_transform.isIdentity()) 474 if (!container_transform.isIdentity())
472 new_location.transform = base::WrapUnique( 475 new_location.transform = base::WrapUnique(
473 new gfx::Transform(container_transform)); 476 new gfx::Transform(container_transform));
474 if (iter->second != new_location) { 477 if (iter->second != new_location) {
475 AccessibilityHostMsg_LocationChangeParams message; 478 AccessibilityHostMsg_LocationChangeParams message;
476 message.id = id; 479 message.id = id;
477 message.new_location = new_location; 480 message.new_location = new_location;
478 messages.push_back(message); 481 messages.push_back(message);
479 } 482 }
480 483
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 721
719 const WebDocument& document = GetMainDocument(); 722 const WebDocument& document = GetMainDocument();
720 if (document.IsNull()) 723 if (document.IsNull())
721 return; 724 return;
722 725
723 WebAXObject::FromWebDocument(document).ScrollToMakeVisibleWithSubFocus( 726 WebAXObject::FromWebDocument(document).ScrollToMakeVisibleWithSubFocus(
724 WebRect(bounds.x(), bounds.y(), bounds.width(), bounds.height())); 727 WebRect(bounds.x(), bounds.y(), bounds.width(), bounds.height()));
725 } 728 }
726 729
727 } // namespace content 730 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698