Open Bug 285167 Opened 20 years ago Updated 2 years ago

Mozilla doesn't support Scrollbar accessible

Categories

(Core :: Disability Access APIs, defect)

x86
Linux
defect

Tracking

()

REOPENED

People

(Reporter: Louie.Zhao, Unassigned)

References

Details

Attachments

(1 file, 2 obsolete files)

AT-Tools, e.g. GOK, need scrollbar accessible to scroll the webpage in case that
the page is too long. Mozilla needs to export accessible for scrollbar elements.
*** Bug 285168 has been marked as a duplicate of this bug. ***
Blocks: 263575
No longer depends on: 263575
Attached patch patch v1 (obsolete) — Splinter Review
Comment on attachment 176723 [details] [diff] [review]
patch v1

>Index: public/nsIAccessibilityService.idl
>+  nsIAccessible createXULScrollbarAccessible(in nsIDOMNode aNode, in boolean aVertical);

>Index: src/atk/nsXULFormControlAccessibleWrap.cpp

this is not the traditional style for initializers in mozilla code, it also
almost certainly doesn't fit in 80 cols:
>+nsXULScrollbarAccessibleWrap::nsXULScrollbarAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell, PRBool aVertical):
>+nsXULScrollbarAccessible(aNode, aShell, aVertical) 
>+{
>+}

>Index: src/base/nsAccessibilityService.cpp
>+NS_IMETHODIMP nsAccessibilityService::CreateXULScrollbarAccessible(nsIDOMNode *aNode, PRBool aVertical, nsIAccessible **_retval)
>+{
>+#ifdef MOZ_XUL
>+  nsCOMPtr<nsIDocument> document(do_QueryInterface(aNode));
>+  if (!document)
>+    return NS_ERROR_FAILURE;
>+
>+  nsIPresShell *presShell = document->GetShellAt(0);
>+  nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(presShell));
>+
>+  *_retval = new nsXULScrollbarAccessibleWrap(aNode, weakShell, aVertical);
>+  if (! *_retval) 
>+    return NS_ERROR_OUT_OF_MEMORY;
>+
>+  NS_ADDREF(*_retval);
>+#else
>+  *_retval = nsnull;
why don't you return NS_ERROR_NOT_AVAILABLE or NS_ERROR_NOT_IMPLEMENTED?
>+#endif // MOZ_XUL
>+  return NS_OK;
>+}

>Index: src/base/nsDocAccessible.cpp

>+/**
>+  * Our next sibling is an vertical nsScrollbarAccessible object
>+  */
is _a vertical_ (because 'ver' is not a vowel sound)
normal mozilla style for /* is:
/**
 * ...
 */
(although it seems accessible doesn't follow that style, =()

>+NS_IMETHODIMP nsDocAccessible::GetNextSibling(nsIAccessible **aNextSibling)
>+{ 
>+  *aNextSibling = nsnull;
>+
>+  if (mNextSibling) {
>+    if (mNextSibling != DEAD_END_ACCESSIBLE)
>+      *aNextSibling = mNextSibling;
i'd suggest an early return here - the assignment line would be
NS_ADDREF(*aNextSibling = mNextSibling);
>+  }

so that you don't have to indent this code block:
>+  else {
>+    nsCOMPtr<nsIAccessibilityService> accService = do_GetService("@mozilla.org/accessibilityService;1");
>+    if (!accService)
>+      return NS_ERROR_FAILURE;
>+

>+    nsresult rv = accService->CreateXULScrollbarAccessible(mDOMNode, PR_TRUE, aNextSibling);
why bother checking NS_FAILED(rv) ?
>+    if (NS_FAILED(rv) || !*aNextSibling)
isn't it sufficient to null check *aNextSibling?
>+      return rv;
...
>+  }
>+
which would mean this code section could use NS_ADDREF:
>+  NS_IF_ADDREF(*aNextSibling);
>+  return NS_OK;
>+}

>Index: src/xul/nsXULFormControlAccessible.cpp
>@@ -661,6 +665,202 @@ NS_IMETHODIMP nsXULTextFieldAccessible::
>     *aState |= STATE_FOCUSED;
>   }
>   return rv;
> }
> 
>+/**
>+  * XUL Scrollbar
>+  *   nsXULScrollbarAccessible has no its own corresponding DOM node.
... does not have its own ...
this isn't accurate anyway, and you should have a bug reference

>+  *   Creating nsXULScrollbarAccessible with the document and use
>+  *   |this| pointer as the unique Id
are unique id's 64bits large?
>+  */
>+nsXULScrollbarAccessible::nsXULScrollbarAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell, PRBool aVertical):
>+nsLeafAccessible(aNode, aShell)
>+{ 
>+  // Indicate the orientation
>+  mVertical = aVertical;
>+}
>+
>+NS_IMETHODIMP nsXULScrollbarAccessible::GetName(nsAString& aName)
>+{
>+  // Don't need name for nsXULScrollbarAccessible
don't need? it would be 'a name', but i don't like the comment.
>+  aName.Truncate();
>+  return NS_OK;
>+}

>+NS_IMETHODIMP nsXULScrollbarAccessible::GetState(PRUint32 *_retval)
>+{
>+  return nsAccessible::GetState(_retval);
>+}
>+
>+
why the extra line ^ ?
>+NS_IMETHODIMP nsXULScrollbarAccessible::GetExtState(PRUint32 *_retval)

>+NS_IMETHODIMP nsXULScrollbarAccessible::GetValue(nsAString& _retval)
>+{
>+  // TODO:
no bug number for followup work?
>+  return NS_ERROR_NOT_IMPLEMENTED;
>+}

>+NS_IMETHODIMP nsXULScrollbarAccessible::GetNextSibling(nsIAccessible **aNextSibling)
see previous comments

>+void nsXULScrollbarAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aBoundingFrame)
>+{
>+  // TODO
bug#? note that the syntax for this todo doesn't match the previous one.
>+  return;

>+// Get the value from nsRect directly instead of converting to pixel
pixel_s_ ?
but... converting *what*?

>+  return (*aMaximum < *aCurValue) ? NS_ERROR_FAILURE:NS_OK;
spaces around : ?

>+    // XXX: better way to get scrollable frame ? 
is there a ...

>+    frame = frame->GetFirstChild(nsnull);
>+    scrollFrame = do_QueryInterface(frame);
>+  }
>+  return scrollFrame;
>+}
>+          
  ^ please don't add trailing whitespace

>+PRBool nsXULScrollbarAccessible::IsVisible()
...
>+  if (mVertical)
>+    return isVerticalVisible;
drop this else after return:
>+  else
>+    return isHorizontalVisible;
>+}
>Index: src/xul/nsXULFormControlAccessible.h
Blocks: fox2access
Assignee: Louie.Zhao → ginn.chen
I wonder if we shouldn't just be creating an accessible for /toolkit/content/widgets/nativescrollbar.xml
/toolkit/content/widgets/scrollbar.xml
via nsIAccessibleProvider.
Also, Ginn -- do you think we should hold up the new-atk work for this bug? I'm not sure if we must really have it for Firefox 2. What's your thought?
Scrollbar code changed a lot.
I'm porting the old patch to trunk. Work in progress.
I think it doesn't have conflicts with new-atk.
Also I don't want this patch wait for another year. We may need to port it again.
Attached patch patch ported to trunk (WIP) (obsolete) — Splinter Review
To do:
1) With this patch, it always creates scrollbars no matter they're visible or not. We'd better create them dynamicly.
2) Do we need GetBoundsRect?
I've no idea how to get ScrollableFrame.
Attachment #176723 - Attachment is obsolete: true
(In reply to comment #7)
> 2) Do we need GetBoundsRect?
Can't we inherit that from nsAccessible?


> I've no idea how to get ScrollableFrame.
You should be able to get it from the doc accessible's frame:
201         nsIScrollableFrame *scrollFrame = nsnull;
202         CallQueryInterface(frame, &scrollFrame);
 
*** Bug 340482 has been marked as a duplicate of this bug. ***
Blocks: newatk
No longer blocks: fox2access
Blocks: keya11y
No longer blocks: newatk
Blocks: lsr
No longer blocks: lsr
See also bug 109215 about making slider accessible (scrollbars have sliders underneath).
Bug 109215 for sliders has been fixed. Does that make this any easier?
(In reply to comment #12)
> Bug 109215 for sliders has been fixed. Does that make this any easier?
> 

It wasn't fixed actually because I roll backed patch due to tree has been closed. Yes it makes easier. All we need is to fix scrollbar.xml to implement nsIAccessibleProvider and to make accessible an anonymous content for scrollbars.
Attached patch patch3Splinter Review
Assignee: ginn.chen → surkov.alexander
Attachment #222020 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #374255 - Flags: review?(marco.zehe)
Attachment #374255 - Flags: superreview?(neil)
Attachment #374255 - Flags: review?(david.bolter)
Attachment #374255 - Flags: review?(enndeakin)
Comment on attachment 374255 [details] [diff] [review]
patch3

>+    if (prop == "role") {
>       is(roleToString(acc[prop]), roleToString(aAccTree[prop]), msg);
>-    else if (prop != "children")
>+
>+    } else if (prop == "states") {

What does that empty line and the braces around that single-line block mean? Did you intend to add something else, or is this an unfinished edit?

>+     * Return stucture describing subtree of scrollbar

Nit: "structure", a missing r.
Attachment #374255 - Flags: review?(marco.zehe) → review+
(In reply to comment #15)

> What does that empty line and the braces around that single-line block mean?
> Did you intend to add something else, or is this an unfinished edit?

I did this for readability. There "else if" block here containing multiple lines therefore I decided to wrap other blocks by braces also.
Note: this is the last bug blocking  Bug 263575 -  [meta] track porting accessibility fixes from Sun Mozilla 1.7  and bug's reporter address (same as this bug) is dead.  So please close Bug 263575 when this bug is fixed.
Comment on attachment 374255 [details] [diff] [review]
patch3

Looks fine to me (despite the slightly odd output from hg diff) although I don't see the point of the uuid change.
Attachment #374255 - Flags: superreview?(neil) → superreview+
Comment on attachment 374255 [details] [diff] [review]
patch3

https://bugzilla.mozilla.org/show_bug.cgi?id=285167>     case nsIAccessibleProvider::XULScale:
>+      *aAccessible = new nsEnumRoleXBLAccessible(aNode, weakShell,
>+                                                 nsIAccessibleRole::ROLE_GROUPING);

I still find the mapping of XULScale to ROLE_GROUPING odd, but it works.
r=me (if you can resolve Neil's uuid concern)

Alexander, I'm not sure I love the method names matching "nsEnumRole*"... but we can IRC on that :)
Attachment #374255 - Flags: review?(david.bolter) → review+
(In reply to comment #18)
> (From update of attachment 374255 [details] [diff] [review])
> Looks fine to me (despite the slightly odd output from hg diff) although I
> don't see the point of the uuid change.

Neil, I changed constants values, for example, XULListCell = 0x00001026; - > const long XULListCell         = 0x0000100C; I must change uuid in this case, right?
(In reply to comment #19)
> (From update of attachment 374255 [details] [diff] [review])

> I still find the mapping of XULScale to ROLE_GROUPING odd, but it works.
> r=me (if you can resolve Neil's uuid concern)

me as well. I'll file bug for this.

> Alexander, I'm not sure I love the method names matching "nsEnumRole*"... but
> we can IRC on that :)

Sure, any ideas are great.
Ah, I hadn't noticed that, I thought you were just reformatting and commenting.
Enn, any chance to review?
Attachment #374255 - Flags: review?(enndeakin) → review+
checked-in, http://hg.mozilla.org/mozilla-central/rev/f640af4933fc
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
I disabled new scrollbar tests on linux due to failure (http://hg.mozilla.org/mozilla-central/rev/ca15d173817d)
Backed out. Let's confirm this regressed TXul.
http://hg.mozilla.org/mozilla-central/rev/9aca8f755e95
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
How can we see the regressed test to know what's wrong in this patch?
Alex, what should we do with this bug? (Doesn't seem like a priority)
Flags: needinfo?(surkov.alexander)
(In reply to David Bolter [:davidb] from comment #29)
> Alex, what should we do with this bug? (Doesn't seem like a priority)

it doesn't look like high priority as we don't have complains about inaccessilbe scrollbars.
Flags: needinfo?(surkov.alexander)
Severity: normal → S3

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: surkov.alexander → nobody
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: