Closed Bug 1423541 Opened 7 years ago Closed 6 years ago

Use Rect's accessors and setters instead of direct member variables

Categories

(Core :: Graphics, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: milan, Assigned: milan)

References

(Blocks 1 open bug)

Details

(Whiteboard: [gfx-noted])

Attachments

(1 file)

      No description provided.
Assignee: nobody → milan
Blocks: 1386277
Component: Disability Access APIs → Graphics
Priority: -- → P3
Whiteboard: [gfx-noted]
Milan, could give some background on the bug please, what benefits are of having accessors methods?
Sure - Bug 1386277 - we are trying to switch to a box model, instead of rectangle.  So, we can't just give access to X/Y, as changing those would in the box model also change the other corner.
Comment on attachment 8934941 [details]
Bug 1423541: Use BaseRect access methods instead of member variables in accessible/

https://reviewboard.mozilla.org/r/205876/#review211498

::: accessible/generic/HyperTextAccessible.cpp:144
(Diff revision 1)
>      // Use the point for the end offset to calculate the width
>      nsPoint frameTextEndPoint;
>      rv = frame->GetPointFromOffset(startContentOffset + frameSubStringLength, &frameTextEndPoint);
>      NS_ENSURE_SUCCESS(rv, nsIntRect());
>  
> -    frameScreenRect.x += std::min(frameTextStartPoint.x, frameTextEndPoint.x);
> +    frameScreenRect.SetRectX(frameScreenRect.X() + std::min(frameTextStartPoint.x, frameTextEndPoint.x),

no SetRectX function on trunk, is it about setting x and width? If so, then name sounds confusing

::: accessible/generic/HyperTextAccessible.cpp:1273
(Diff revision 1)
>      offset1 = 0;
>    }
>  
> -  nsAccUtils::ConvertScreenCoordsTo(&bounds.x, &bounds.y, aCoordType, this);
> +  auto boundsX = bounds.X();
> +  auto boundsY = bounds.Y();
> +  nsAccUtils::ConvertScreenCoordsTo(&boundsX, &boundsY, aCoordType, this);

might be nicer if ConvertScreenCoordsTo worked with Rect

::: accessible/ipc/DocAccessibleParent.cpp:627
(Diff revision 1)
>    nsIntRect rect(CW_USEDEFAULT, CW_USEDEFAULT, 0, 0);
>    if (Compatibility::IsDolphin()) {
>      rect = Bounds();
>      nsIntRect rootRect = rootDocument->Bounds();
> -    rect.x = rootRect.x - rect.x;
> -    rect.y -= rootRect.y;
> +    rect.MoveToX(rootRect.X() - rect.X());
> +    rect.MoveByY(-rootRect.Y());

probably rect.MoveToY(rect.y - rootRect.y) will be a bit more readable
Attachment #8934941 - Flags: review?(surkov.alexander) → review+
Blocks: 1423919
No longer blocks: 1386277
Comment on attachment 8934941 [details]
Bug 1423541: Use BaseRect access methods instead of member variables in accessible/

https://reviewboard.mozilla.org/r/205876/#review211498

> no SetRectX function on trunk, is it about setting x and width? If so, then name sounds confusing

Good follow up bug.

> might be nicer if ConvertScreenCoordsTo worked with Rect

Good follow up.
Pushed by msreckovic@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/40161b05e29e
Use BaseRect access methods instead of member variables in accessible/ r=surkov
https://hg.mozilla.org/mozilla-central/rev/40161b05e29e
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: