Commit 5c1e5fd0 authored by dmazzoni@chromium.org's avatar dmazzoni@chromium.org

Make accessible scroll position attributes more generic and

add attributes for the min and max scroll position, as the
first step towards implementing accessible scrolling APIs.

BUG=104468
TEST=none
Review URL: http://codereview.chromium.org/8776026

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112814 0039d316-1c4b-4281-b951-d872f2087c98
parent 961ceb88
...@@ -133,8 +133,8 @@ gfx::Rect BrowserAccessibility::GetLocalBoundsRect() { ...@@ -133,8 +133,8 @@ gfx::Rect BrowserAccessibility::GetLocalBoundsRect() {
BrowserAccessibility* root = manager_->GetRoot(); BrowserAccessibility* root = manager_->GetRoot();
int scroll_x = 0; int scroll_x = 0;
int scroll_y = 0; int scroll_y = 0;
root->GetIntAttribute(WebAccessibility::ATTR_DOC_SCROLLX, &scroll_x); root->GetIntAttribute(WebAccessibility::ATTR_SCROLL_X, &scroll_x);
root->GetIntAttribute(WebAccessibility::ATTR_DOC_SCROLLY, &scroll_y); root->GetIntAttribute(WebAccessibility::ATTR_SCROLL_Y, &scroll_y);
bounds.Offset(-scroll_x, -scroll_y); bounds.Offset(-scroll_x, -scroll_y);
return bounds; return bounds;
...@@ -272,4 +272,3 @@ string16 BrowserAccessibility::GetTextRecursive() const { ...@@ -272,4 +272,3 @@ string16 BrowserAccessibility::GetTextRecursive() const {
result += children_[i]->GetTextRecursive(); result += children_[i]->GetTextRecursive();
return result; return result;
} }
...@@ -582,11 +582,23 @@ std::string WebAccessibility::DebugString(bool recursive, ...@@ -582,11 +582,23 @@ std::string WebAccessibility::DebugString(bool recursive,
++iter) { ++iter) {
std::string value = IntToString(iter->second); std::string value = IntToString(iter->second);
switch (iter->first) { switch (iter->first) {
case ATTR_DOC_SCROLLX: case ATTR_SCROLL_X:
result += " scrollx=" + value; result += " scroll_x=" + value;
break; break;
case ATTR_DOC_SCROLLY: case ATTR_SCROLL_X_MIN:
result += " scrolly=" + value; result += " scroll_x_min=" + value;
break;
case ATTR_SCROLL_X_MAX:
result += " scroll_x_max=" + value;
break;
case ATTR_SCROLL_Y:
result += " scroll_y=" + value;
break;
case ATTR_SCROLL_Y_MIN:
result += " scroll_y_min=" + value;
break;
case ATTR_SCROLL_Y_MAX:
result += " scroll_y_max=" + value;
break; break;
case ATTR_HIERARCHICAL_LEVEL: case ATTR_HIERARCHICAL_LEVEL:
result += " level=" + value; result += " level=" + value;
...@@ -924,8 +936,16 @@ void WebAccessibility::Init(const WebKit::WebAccessibilityObject& src, ...@@ -924,8 +936,16 @@ void WebAccessibility::Init(const WebKit::WebAccessibilityObject& src,
string_attributes[ATTR_DOC_DOCTYPE] = doctype.name(); string_attributes[ATTR_DOC_DOCTYPE] = doctype.name();
const gfx::Size& scroll_offset = document.frame()->scrollOffset(); const gfx::Size& scroll_offset = document.frame()->scrollOffset();
int_attributes[ATTR_DOC_SCROLLX] = scroll_offset.width(); int_attributes[ATTR_SCROLL_X] = scroll_offset.width();
int_attributes[ATTR_DOC_SCROLLY] = scroll_offset.height(); int_attributes[ATTR_SCROLL_Y] = scroll_offset.height();
const gfx::Size& min_offset = document.frame()->minimumScrollOffset();
int_attributes[ATTR_SCROLL_X_MIN] = min_offset.width();
int_attributes[ATTR_SCROLL_Y_MIN] = min_offset.height();
const gfx::Size& max_offset = document.frame()->maximumScrollOffset();
int_attributes[ATTR_SCROLL_X_MAX] = max_offset.width();
int_attributes[ATTR_SCROLL_Y_MAX] = max_offset.height();
} }
if (role == WebAccessibility::ROLE_TABLE) { if (role == WebAccessibility::ROLE_TABLE) {
......
...@@ -190,9 +190,13 @@ struct WEBKIT_GLUE_EXPORT WebAccessibility { ...@@ -190,9 +190,13 @@ struct WEBKIT_GLUE_EXPORT WebAccessibility {
}; };
enum IntAttribute { enum IntAttribute {
// Document attributes. // Scrollable container attributes.
ATTR_DOC_SCROLLX, ATTR_SCROLL_X,
ATTR_DOC_SCROLLY, ATTR_SCROLL_X_MIN,
ATTR_SCROLL_X_MAX,
ATTR_SCROLL_Y,
ATTR_SCROLL_Y_MIN,
ATTR_SCROLL_Y_MAX,
// Editable text attributes. // Editable text attributes.
ATTR_TEXT_SEL_START, ATTR_TEXT_SEL_START,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment