| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/blink_ax_tree_source.h" | 5 #include "content/renderer/accessibility/blink_ax_tree_source.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 : tree_source_(tree_source) { | 123 : tree_source_(tree_source) { |
| 124 tree_source_->Freeze(); | 124 tree_source_->Freeze(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 ScopedFreezeBlinkAXTreeSource::~ScopedFreezeBlinkAXTreeSource() { | 127 ScopedFreezeBlinkAXTreeSource::~ScopedFreezeBlinkAXTreeSource() { |
| 128 tree_source_->Thaw(); | 128 tree_source_->Thaw(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 BlinkAXTreeSource::BlinkAXTreeSource(RenderFrameImpl* render_frame) | 131 BlinkAXTreeSource::BlinkAXTreeSource(RenderFrameImpl* render_frame) |
| 132 : render_frame_(render_frame), | 132 : render_frame_(render_frame), |
| 133 accessibility_focus_id_(-1), | |
| 134 frozen_(false) {} | 133 frozen_(false) {} |
| 135 | 134 |
| 136 BlinkAXTreeSource::~BlinkAXTreeSource() { | 135 BlinkAXTreeSource::~BlinkAXTreeSource() { |
| 137 } | 136 } |
| 138 | 137 |
| 139 void BlinkAXTreeSource::Freeze() { | 138 void BlinkAXTreeSource::Freeze() { |
| 140 CHECK(!frozen_); | 139 CHECK(!frozen_); |
| 141 frozen_ = true; | 140 frozen_ = true; |
| 142 | 141 |
| 143 if (render_frame_ && render_frame_->GetWebFrame()) | 142 if (render_frame_ && render_frame_->GetWebFrame()) |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y, scrollOffset.y()); | 716 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y, scrollOffset.y()); |
| 718 | 717 |
| 719 const gfx::Point& minScrollOffset = src.minimumScrollOffset(); | 718 const gfx::Point& minScrollOffset = src.minimumScrollOffset(); |
| 720 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MIN, minScrollOffset.x()); | 719 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MIN, minScrollOffset.x()); |
| 721 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MIN, minScrollOffset.y()); | 720 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MIN, minScrollOffset.y()); |
| 722 | 721 |
| 723 const gfx::Point& maxScrollOffset = src.maximumScrollOffset(); | 722 const gfx::Point& maxScrollOffset = src.maximumScrollOffset(); |
| 724 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MAX, maxScrollOffset.x()); | 723 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MAX, maxScrollOffset.x()); |
| 725 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MAX, maxScrollOffset.y()); | 724 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MAX, maxScrollOffset.y()); |
| 726 } | 725 } |
| 726 |
| 727 if (dst->id == image_data_node_id_) { |
| 728 dst->AddStringAttribute(ui::AX_ATTR_IMAGE_DATA_URL, |
| 729 src.imageDataUrl(max_image_data_size_).utf8()); |
| 730 } |
| 727 } | 731 } |
| 728 | 732 |
| 729 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 733 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
| 730 CHECK(frozen_); | 734 CHECK(frozen_); |
| 731 return document_; | 735 return document_; |
| 732 } | 736 } |
| 733 | 737 |
| 734 WebAXObject BlinkAXTreeSource::ComputeRoot() const { | 738 WebAXObject BlinkAXTreeSource::ComputeRoot() const { |
| 735 if (!explicit_root_.isNull()) | 739 if (!explicit_root_.isNull()) |
| 736 return explicit_root_; | 740 return explicit_root_; |
| 737 | 741 |
| 738 if (!render_frame_ || !render_frame_->GetWebFrame()) | 742 if (!render_frame_ || !render_frame_->GetWebFrame()) |
| 739 return WebAXObject(); | 743 return WebAXObject(); |
| 740 | 744 |
| 741 WebDocument document = render_frame_->GetWebFrame()->document(); | 745 WebDocument document = render_frame_->GetWebFrame()->document(); |
| 742 if (!document.isNull()) | 746 if (!document.isNull()) |
| 743 return document.accessibilityObject(); | 747 return document.accessibilityObject(); |
| 744 | 748 |
| 745 return WebAXObject(); | 749 return WebAXObject(); |
| 746 } | 750 } |
| 747 | 751 |
| 748 } // namespace content | 752 } // namespace content |
| OLD | NEW |