mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 966591 - Part 5: Pass hit bounds to a11y code. r=surkov
This commit is contained in:
parent
9225567670
commit
56a25e3e98
@ -919,7 +919,27 @@ void
|
||||
Accessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame)
|
||||
{
|
||||
nsIFrame* frame = GetFrame();
|
||||
if (frame) {
|
||||
if (frame && mContent) {
|
||||
nsRect* hitRegionRect = static_cast<nsRect*>(mContent->GetProperty(nsGkAtoms::hitregion));
|
||||
|
||||
if (hitRegionRect) {
|
||||
// This is for canvas fallback content
|
||||
// Find a canvas frame the found hit region is relative to.
|
||||
nsIFrame* canvasFrame = frame->GetParent();
|
||||
while (canvasFrame && (canvasFrame->GetType() != nsGkAtoms::HTMLCanvasFrame))
|
||||
canvasFrame = canvasFrame->GetParent();
|
||||
|
||||
// make the canvas the bounding frame
|
||||
if (canvasFrame) {
|
||||
*aBoundingFrame = canvasFrame;
|
||||
|
||||
nsPresContext* presContext = mDoc->PresContext();
|
||||
aTotalBounds = *hitRegionRect;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
*aBoundingFrame = nsLayoutUtils::GetContainingBlockForClientRect(frame);
|
||||
aTotalBounds = nsLayoutUtils::
|
||||
GetAllInFlowRectsUnion(frame, *aBoundingFrame,
|
||||
|
@ -2395,7 +2395,9 @@ CanvasRenderingContext2D::AddHitRegion(const HitRegionOptions& options, ErrorRes
|
||||
|
||||
// get the bounds of the current path. They are relative to the canvas
|
||||
mgfx::Rect bounds(mPath->GetBounds(mTarget->GetTransform()));
|
||||
nsRect* nsBounds = new nsRect(bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
gfxRect rect(bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
nsRect* nsBounds = new nsRect();
|
||||
*nsBounds = nsLayoutUtils::RoundGfxRectToAppRect(rect, AppUnitsPerCSSPixel());
|
||||
options.mControl->SetProperty(nsGkAtoms::hitregion, nsBounds, ReleaseBBoxPropertyValue, true);
|
||||
|
||||
// finally, add the region to the list if it has an ID
|
||||
|
Loading…
Reference in New Issue
Block a user