summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-15 11:03:37 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-15 16:34:03 +0200
commit51ac037c2082a4f6681eda07795869f4c14488e1 (patch)
tree238d9d58b826a055eb9c54973029867db7c3d16b /src/core
parentd5fa096056b033203d9a54497e1554f153a19d93 (diff)
Implement accessible value interface
Change-Id: I837d7f3041aec59ae83c0fe802bc83b746e62b76 Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/browser_accessibility_qt.cpp54
-rw-r--r--src/core/browser_accessibility_qt.h8
2 files changed, 60 insertions, 2 deletions
diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp
index 7a7895a94..1e478c212 100644
--- a/src/core/browser_accessibility_qt.cpp
+++ b/src/core/browser_accessibility_qt.cpp
@@ -78,6 +78,15 @@ void *BrowserAccessibilityQt::interface_cast(QAccessible::InterfaceType type)
if (IsEditableText())
return static_cast<QAccessibleTextInterface*>(this);
break;
+ case QAccessible::ValueInterface: {
+ QAccessible::Role r = role();
+ if (r == QAccessible::ProgressBar ||
+ r == QAccessible::Slider ||
+ r == QAccessible::ScrollBar ||
+ r == QAccessible::SpinBox)
+ return static_cast<QAccessibleValueInterface*>(this);
+ break;
+ }
default:
break;
}
@@ -271,7 +280,7 @@ QAccessible::Role BrowserAccessibilityQt::role() const
case WebAXRolePresentational:
return QAccessible::NoRole; // FIXME
case WebAXRoleProgressIndicator:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::ProgressBar;
case WebAXRoleRadioButton:
return QAccessible::RadioButton;
case WebAXRoleRadioGroup:
@@ -297,7 +306,7 @@ QAccessible::Role BrowserAccessibilityQt::role() const
case WebAXRoleSliderThumb:
return QAccessible::NoRole; // FIXME
case WebAXRoleSpinButton:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::SpinBox;
case WebAXRoleSpinButtonPart:
return QAccessible::NoRole; // FIXME
case WebAXRoleSplitter:
@@ -506,4 +515,45 @@ void BrowserAccessibilityQt::scrollToSubstring(int startIndex, int endIndex)
manager()->ScrollToMakeVisible(*this, GetLocalBoundsForRange(startIndex, endIndex - startIndex));
}
+QVariant BrowserAccessibilityQt::currentValue() const
+{
+ QVariant result;
+ float value;
+ if (GetFloatAttribute(AccessibilityNodeData::ATTR_VALUE_FOR_RANGE, &value)) {
+ result = (double) value;
+ }
+ return result;
+}
+
+void BrowserAccessibilityQt::setCurrentValue(const QVariant &value)
+{
+ // not yet implemented anywhere in blink
+ QT_NOT_YET_IMPLEMENTED
+}
+
+QVariant BrowserAccessibilityQt::maximumValue() const
+{
+ QVariant result;
+ float value;
+ if (GetFloatAttribute(AccessibilityNodeData::ATTR_MAX_VALUE_FOR_RANGE, &value)) {
+ result = (double) value;
+ }
+ return result;
+}
+
+QVariant BrowserAccessibilityQt::minimumValue() const
+{
+ QVariant result;
+ float value;
+ if (GetFloatAttribute(AccessibilityNodeData::ATTR_MIN_VALUE_FOR_RANGE, &value)) {
+ result = (double) value;
+ }
+ return result;
+}
+
+QVariant BrowserAccessibilityQt::minimumStepSize() const
+{
+ return QVariant();
+}
+
} // namespace content
diff --git a/src/core/browser_accessibility_qt.h b/src/core/browser_accessibility_qt.h
index cda205bf2..2c85b3349 100644
--- a/src/core/browser_accessibility_qt.h
+++ b/src/core/browser_accessibility_qt.h
@@ -51,6 +51,7 @@ class BrowserAccessibilityQt
: public BrowserAccessibility
, public QAccessibleInterface
, public QAccessibleTextInterface
+ , public QAccessibleValueInterface
{
public:
BrowserAccessibilityQt();
@@ -93,6 +94,13 @@ public:
void setSelection(int selectionIndex, int startOffset, int endOffset) Q_DECL_OVERRIDE;
int characterCount() const Q_DECL_OVERRIDE;
void scrollToSubstring(int startIndex, int endIndex) Q_DECL_OVERRIDE;
+
+ // QAccessibleValueInterface
+ QVariant currentValue() const Q_DECL_OVERRIDE;
+ void setCurrentValue(const QVariant &value) Q_DECL_OVERRIDE;
+ QVariant maximumValue() const Q_DECL_OVERRIDE;
+ QVariant minimumValue() const Q_DECL_OVERRIDE;
+ QVariant minimumStepSize() const Q_DECL_OVERRIDE;
};
}