Closed Bug 762394 Opened 12 years ago Closed 12 years ago

replace do_QueryObject() with static cast in CAccessibleText

Categories

(Core :: Disability Access APIs, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: tbsaunde, Assigned: drexler)

References

Details

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

Attachments

(2 files, 1 obsolete file)

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

actually, ia2AccessibleText
Attached patch patch (obsolete) — Splinter Review
passed tests locally.
Assignee: nobody → andrew.quartey
Status: NEW → ASSIGNED
Attachment #633202 - Flags: review?(trev.saunders)
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)
Attached patch patchSplinter Review
updated patch addressing comments.
Attachment #633202 - Attachment is obsolete: true
Attachment #633349 - Flags: review?(trev.saunders)
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+
Attached patch updated_patchSplinter Review
Updated patch addressing nits.
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/400bc23212f7
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: