replace do_QueryObject() with static cast in CAccessibleText

RESOLVED FIXED in mozilla16

Status

()

Core
Disability Access APIs
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: tbsaunde, Assigned: drexler)

Tracking

unspecified
mozilla16
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [good first bug][mentor=trev.saunders@gmail.com][lang=c++])

Attachments

(2 attachments, 1 obsolete attachment)

(Reporter)

Description

5 years ago
nsRefPtr<HypertextAccessible> foo = do_QueryObject(this); should become HypertextAccessible* foo = static_cast<HypertextAccessibleWrap*>(this);
also rename it to ia2Text
(Reporter)

Comment 1

5 years ago
> also rename it to ia2Text

actually, ia2AccessibleText
(Assignee)

Comment 2

5 years ago
Created attachment 633202 [details] [diff] [review]
patch

passed tests locally.
Assignee: nobody → andrew.quartey
Status: NEW → ASSIGNED
Attachment #633202 - Flags: review?(trev.saunders)
(Reporter)

Comment 3

5 years ago
Comment on attachment 633202 [details] [diff] [review]
patch

> #include "HyperTextAccessible.h"
>+#include "HyperTextAccessibleWrap.h"

HypertextAccessibleWrap.h is enough

> {
> __try {
>-  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
>-  if (textAcc->IsDefunct())
>+  HyperTextAccessible* ia2AccessibleText = static_cast<HyperTextAccessibleWrap*>(this);

same as bug 762396 rename the class not variable names :)  Sorry I wasn't clearer.

otherwise this one seems fine too
Attachment #633202 - Flags: review?(trev.saunders)
(Assignee)

Comment 4

5 years ago
Created attachment 633349 [details] [diff] [review]
patch

updated patch addressing comments.
Attachment #633202 - Attachment is obsolete: true
Attachment #633349 - Flags: review?(trev.saunders)
(Reporter)

Comment 5

5 years ago
Comment on attachment 633349 [details] [diff] [review]
patch

># HG changeset patch
># Parent e116a5da6cedfe7f980979005c5f4eaa4e0bfa4c
># User Andrew Quartey <andrew.quartey@gmail.com>
>Bug 762394 - Replace do_QueryObject() with static_cast in CAccessibleText
>
>diff --git a/accessible/src/msaa/HyperTextAccessibleWrap.h b/accessible/src/msaa/HyperTextAccessibleWrap.h
>--- a/accessible/src/msaa/HyperTextAccessibleWrap.h
>+++ b/accessible/src/msaa/HyperTextAccessibleWrap.h
>@@ -4,17 +4,17 @@
> /* This Source Code Form is subject to the terms of the Mozilla Public
>  * License, v. 2.0. If a copy of the MPL was not distributed with this
>  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
> 
> #ifndef mozilla_a11y_HyperTextAccessibleWrap_h__
> #define mozilla_a11y_HyperTextAccessibleWrap_h__
> 
> #include "HyperTextAccessible.h"
>-#include "CAccessibleText.h"
>+#include "ia2AccessibleText.h"
> #include "CAccessibleEditableText.h"
> #include "ia2AccessibleHyperText.h"

you should keep them in order, but actually I don't think you need to include it here at all.

> STDMETHODIMP
>-CAccessibleText::get_attributes(long aOffset, long *aStartOffset,
>+ia2AccessibleText::get_attributes(long aOffset, long *aStartOffset,
>                                 long *aEndOffset, BSTR *aTextAttributes)

nit, you break alignment here, and other methods with args on a second line.

> {
Attachment #633349 - Flags: review?(trev.saunders) → review+
(Assignee)

Comment 6

5 years ago
Created attachment 633552 [details] [diff] [review]
updated_patch

Updated patch addressing nits.
(Assignee)

Updated

5 years ago
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/400bc23212f7
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/400bc23212f7
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
You need to log in before you can comment on or make changes to this bug.