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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXSpinButton.cpp

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 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 // AXSpinButtonPart 95 // AXSpinButtonPart
96 96
97 AXSpinButtonPart::AXSpinButtonPart(AXObjectCacheImpl& ax_object_cache) 97 AXSpinButtonPart::AXSpinButtonPart(AXObjectCacheImpl& ax_object_cache)
98 : AXMockObject(ax_object_cache), is_incrementor_(false) {} 98 : AXMockObject(ax_object_cache), is_incrementor_(false) {}
99 99
100 AXSpinButtonPart* AXSpinButtonPart::Create(AXObjectCacheImpl& ax_object_cache) { 100 AXSpinButtonPart* AXSpinButtonPart::Create(AXObjectCacheImpl& ax_object_cache) {
101 return new AXSpinButtonPart(ax_object_cache); 101 return new AXSpinButtonPart(ax_object_cache);
102 } 102 }
103 103
104 void AXSpinButtonPart::GetRelativeBounds( 104 void AXSpinButtonPart::GetRelativeBounds(AXObject** out_container,
105 AXObject** out_container, 105 FloatRect& out_bounds_in_container,
106 FloatRect& out_bounds_in_container, 106 SkMatrix44& out_container_transform,
107 SkMatrix44& out_container_transform) const { 107 bool& out_is_fixed_positioned) const {
108 *out_container = nullptr; 108 *out_container = nullptr;
109 out_bounds_in_container = FloatRect(); 109 out_bounds_in_container = FloatRect();
110 out_container_transform.setIdentity(); 110 out_container_transform.setIdentity();
111 out_is_fixed_positioned = false;
aboxhall 2017/06/30 06:07:41 Is there some reason we couldn't make is_fixed_pos
dmazzoni 2017/07/06 07:20:22 I don't want to do that in the WebAXObject API bec
111 112
112 if (!ParentObject()) 113 if (!ParentObject())
113 return; 114 return;
114 115
115 // FIXME: This logic should exist in the layout tree or elsewhere, but there 116 // FIXME: This logic should exist in the layout tree or elsewhere, but there
116 // is no relationship that exists that can be queried. 117 // is no relationship that exists that can be queried.
117 ParentObject()->GetRelativeBounds(out_container, out_bounds_in_container, 118 ParentObject()->GetRelativeBounds(out_container, out_bounds_in_container,
118 out_container_transform); 119 out_container_transform,
120 out_is_fixed_positioned);
119 out_bounds_in_container = FloatRect(0, 0, out_bounds_in_container.Width(), 121 out_bounds_in_container = FloatRect(0, 0, out_bounds_in_container.Width(),
120 out_bounds_in_container.Height()); 122 out_bounds_in_container.Height());
121 if (is_incrementor_) { 123 if (is_incrementor_) {
122 out_bounds_in_container.SetHeight(out_bounds_in_container.Height() / 2); 124 out_bounds_in_container.SetHeight(out_bounds_in_container.Height() / 2);
123 } else { 125 } else {
124 out_bounds_in_container.SetY(out_bounds_in_container.Y() + 126 out_bounds_in_container.SetY(out_bounds_in_container.Y() +
125 out_bounds_in_container.Height() / 2); 127 out_bounds_in_container.Height() / 2);
126 out_bounds_in_container.SetHeight(out_bounds_in_container.Height() / 2); 128 out_bounds_in_container.SetHeight(out_bounds_in_container.Height() / 2);
127 } 129 }
128 *out_container = ParentObject(); 130 *out_container = ParentObject();
129 } 131 }
130 132
131 bool AXSpinButtonPart::Press() { 133 bool AXSpinButtonPart::Press() {
132 if (!parent_ || !parent_->IsSpinButton()) 134 if (!parent_ || !parent_->IsSpinButton())
133 return false; 135 return false;
134 136
135 AXSpinButton* spin_button = ToAXSpinButton(ParentObject()); 137 AXSpinButton* spin_button = ToAXSpinButton(ParentObject());
136 if (is_incrementor_) 138 if (is_incrementor_)
137 spin_button->Step(1); 139 spin_button->Step(1);
138 else 140 else
139 spin_button->Step(-1); 141 spin_button->Step(-1);
140 142
141 return true; 143 return true;
142 } 144 }
143 145
144 } // namespace blink 146 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698