OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 return new AXImageMapLink(area, ax_object_cache); | 50 return new AXImageMapLink(area, ax_object_cache); |
51 } | 51 } |
52 | 52 |
53 HTMLMapElement* AXImageMapLink::MapElement() const { | 53 HTMLMapElement* AXImageMapLink::MapElement() const { |
54 HTMLAreaElement* area = AreaElement(); | 54 HTMLAreaElement* area = AreaElement(); |
55 if (!area) | 55 if (!area) |
56 return nullptr; | 56 return nullptr; |
57 return Traversal<HTMLMapElement>::FirstAncestor(*area); | 57 return Traversal<HTMLMapElement>::FirstAncestor(*area); |
58 } | 58 } |
59 | 59 |
60 AXObject* AXImageMapLink::ComputeParent() const { | 60 AXObjectImpl* AXImageMapLink::ComputeParent() const { |
61 DCHECK(!IsDetached()); | 61 DCHECK(!IsDetached()); |
62 if (parent_) | 62 if (parent_) |
63 return parent_; | 63 return parent_; |
64 | 64 |
65 if (!MapElement()) | 65 if (!MapElement()) |
66 return nullptr; | 66 return nullptr; |
67 | 67 |
68 return AxObjectCache().GetOrCreate(MapElement()->GetLayoutObject()); | 68 return AxObjectCache().GetOrCreate(MapElement()->GetLayoutObject()); |
69 } | 69 } |
70 | 70 |
71 AccessibilityRole AXImageMapLink::RoleValue() const { | 71 AccessibilityRole AXImageMapLink::RoleValue() const { |
72 const AtomicString& aria_role = | 72 const AtomicString& aria_role = |
73 GetAOMPropertyOrARIAAttribute(AOMStringProperty::kRole); | 73 GetAOMPropertyOrARIAAttribute(AOMStringProperty::kRole); |
74 if (!aria_role.IsEmpty()) | 74 if (!aria_role.IsEmpty()) |
75 return AXObject::AriaRoleToWebCoreRole(aria_role); | 75 return AXObjectImpl::AriaRoleToWebCoreRole(aria_role); |
76 | 76 |
77 return kLinkRole; | 77 return kLinkRole; |
78 } | 78 } |
79 | 79 |
80 bool AXImageMapLink::ComputeAccessibilityIsIgnored( | 80 bool AXImageMapLink::ComputeAccessibilityIsIgnored( |
81 IgnoredReasons* ignored_reasons) const { | 81 IgnoredReasons* ignored_reasons) const { |
82 return AccessibilityIsIgnoredByDefault(ignored_reasons); | 82 return AccessibilityIsIgnoredByDefault(ignored_reasons); |
83 } | 83 } |
84 | 84 |
85 Element* AXImageMapLink::ActionElement() const { | 85 Element* AXImageMapLink::ActionElement() const { |
86 return AnchorElement(); | 86 return AnchorElement(); |
87 } | 87 } |
88 | 88 |
89 Element* AXImageMapLink::AnchorElement() const { | 89 Element* AXImageMapLink::AnchorElement() const { |
90 return GetNode() ? ToElement(GetNode()) : nullptr; | 90 return GetNode() ? ToElement(GetNode()) : nullptr; |
91 } | 91 } |
92 | 92 |
93 KURL AXImageMapLink::Url() const { | 93 KURL AXImageMapLink::Url() const { |
94 if (!AreaElement()) | 94 if (!AreaElement()) |
95 return KURL(); | 95 return KURL(); |
96 | 96 |
97 return AreaElement()->Href(); | 97 return AreaElement()->Href(); |
98 } | 98 } |
99 | 99 |
100 void AXImageMapLink::GetRelativeBounds( | 100 void AXImageMapLink::GetRelativeBounds( |
101 AXObject** out_container, | 101 AXObjectImpl** out_container, |
102 FloatRect& out_bounds_in_container, | 102 FloatRect& out_bounds_in_container, |
103 SkMatrix44& out_container_transform) const { | 103 SkMatrix44& out_container_transform) const { |
104 *out_container = nullptr; | 104 *out_container = nullptr; |
105 out_bounds_in_container = FloatRect(); | 105 out_bounds_in_container = FloatRect(); |
106 out_container_transform.setIdentity(); | 106 out_container_transform.setIdentity(); |
107 | 107 |
108 HTMLAreaElement* area = AreaElement(); | 108 HTMLAreaElement* area = AreaElement(); |
109 HTMLMapElement* map = MapElement(); | 109 HTMLMapElement* map = MapElement(); |
110 if (!area || !map) | 110 if (!area || !map) |
111 return; | 111 return; |
112 | 112 |
113 LayoutObject* layout_object; | 113 LayoutObject* layout_object; |
114 if (parent_ && parent_->IsAXLayoutObject()) | 114 if (parent_ && parent_->IsAXLayoutObject()) |
115 layout_object = ToAXLayoutObject(parent_)->GetLayoutObject(); | 115 layout_object = ToAXLayoutObject(parent_)->GetLayoutObject(); |
116 else | 116 else |
117 layout_object = map->GetLayoutObject(); | 117 layout_object = map->GetLayoutObject(); |
118 | 118 |
119 if (!layout_object) | 119 if (!layout_object) |
120 return; | 120 return; |
121 | 121 |
122 out_bounds_in_container = area->GetPath(layout_object).BoundingRect(); | 122 out_bounds_in_container = area->GetPath(layout_object).BoundingRect(); |
123 *out_container = AxObjectCache().GetOrCreate(layout_object); | 123 *out_container = AxObjectCache().GetOrCreate(layout_object); |
124 } | 124 } |
125 | 125 |
126 DEFINE_TRACE(AXImageMapLink) { | 126 DEFINE_TRACE(AXImageMapLink) { |
127 AXNodeObject::Trace(visitor); | 127 AXNodeObject::Trace(visitor); |
128 } | 128 } |
129 | 129 |
130 } // namespace blink | 130 } // namespace blink |
OLD | NEW |