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

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

Issue 2894103002: Int and Float properties for Accessibility Object Model phase 1 (Closed)
Patch Set: Update webexposed/ Created 3 years, 7 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) 2010 Nokia Corporation and/or its subsidiary(-ies). 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 * 18 *
19 */ 19 */
20 20
21 #include "modules/accessibility/AXProgressIndicator.h" 21 #include "modules/accessibility/AXProgressIndicator.h"
22 22
23 #include "core/dom/AccessibleNode.h"
23 #include "core/html/HTMLProgressElement.h" 24 #include "core/html/HTMLProgressElement.h"
24 #include "core/layout/LayoutProgress.h" 25 #include "core/layout/LayoutProgress.h"
25 #include "modules/accessibility/AXObjectCacheImpl.h" 26 #include "modules/accessibility/AXObjectCacheImpl.h"
26 #include "platform/wtf/MathExtras.h" 27 #include "platform/wtf/MathExtras.h"
27 28
28 namespace blink { 29 namespace blink {
29 30
30 using namespace HTMLNames; 31 using namespace HTMLNames;
31 32
32 AXProgressIndicator::AXProgressIndicator(LayoutProgress* layout_object, 33 AXProgressIndicator::AXProgressIndicator(LayoutProgress* layout_object,
(...skipping 11 matching lines...) Expand all
44 return aria_role_; 45 return aria_role_;
45 return kProgressIndicatorRole; 46 return kProgressIndicatorRole;
46 } 47 }
47 48
48 bool AXProgressIndicator::ComputeAccessibilityIsIgnored( 49 bool AXProgressIndicator::ComputeAccessibilityIsIgnored(
49 IgnoredReasons* ignored_reasons) const { 50 IgnoredReasons* ignored_reasons) const {
50 return AccessibilityIsIgnoredByDefault(ignored_reasons); 51 return AccessibilityIsIgnoredByDefault(ignored_reasons);
51 } 52 }
52 53
53 float AXProgressIndicator::ValueForRange() const { 54 float AXProgressIndicator::ValueForRange() const {
54 if (HasAttribute(aria_valuenowAttr)) 55 float value_now;
55 return GetAttribute(aria_valuenowAttr).ToFloat(); 56 if (HasAOMPropertyOrARIAAttribute(AOMFloatProperty::kValueNow, value_now))
57 return value_now;
56 58
57 if (GetProgressElement()->position() >= 0) 59 if (GetProgressElement()->position() >= 0)
58 return clampTo<float>(GetProgressElement()->value()); 60 return clampTo<float>(GetProgressElement()->value());
59 // Indeterminate progress bar should return 0. 61 // Indeterminate progress bar should return 0.
60 return 0.0f; 62 return 0.0f;
61 } 63 }
62 64
63 float AXProgressIndicator::MaxValueForRange() const { 65 float AXProgressIndicator::MaxValueForRange() const {
64 if (HasAttribute(aria_valuemaxAttr)) 66 float value_max;
65 return GetAttribute(aria_valuemaxAttr).ToFloat(); 67 if (HasAOMPropertyOrARIAAttribute(AOMFloatProperty::kValueMax, value_max))
68 return value_max;
66 69
67 return clampTo<float>(GetProgressElement()->max()); 70 return clampTo<float>(GetProgressElement()->max());
68 } 71 }
69 72
70 float AXProgressIndicator::MinValueForRange() const { 73 float AXProgressIndicator::MinValueForRange() const {
71 if (HasAttribute(aria_valueminAttr)) 74 float value_min;
72 return GetAttribute(aria_valueminAttr).ToFloat(); 75 if (HasAOMPropertyOrARIAAttribute(AOMFloatProperty::kValueMin, value_min))
76 return value_min;
73 77
74 return 0.0f; 78 return 0.0f;
75 } 79 }
76 80
77 HTMLProgressElement* AXProgressIndicator::GetProgressElement() const { 81 HTMLProgressElement* AXProgressIndicator::GetProgressElement() const {
78 return ToLayoutProgress(layout_object_)->ProgressElement(); 82 return ToLayoutProgress(layout_object_)->ProgressElement();
79 } 83 }
80 84
81 } // namespace blink 85 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698