--- a/dom/base/DOMIntersectionObserver.cpp
+++ b/dom/base/DOMIntersectionObserver.cpp
@@ -250,18 +250,18 @@ CheckSimilarOrigin(nsINode* aNode1, nsIN
}
return baseDomain1 == baseDomain2;
}
static Maybe<nsRect>
EdgeInclusiveIntersection(const nsRect& aRect, const nsRect& aOtherRect)
{
- nscoord left = std::max(aRect.x, aOtherRect.x);
- nscoord top = std::max(aRect.y, aOtherRect.y);
+ nscoord left = std::max(aRect.X(), aOtherRect.X());
+ nscoord top = std::max(aRect.Y(), aOtherRect.Y());
nscoord right = std::min(aRect.XMost(), aOtherRect.XMost());
nscoord bottom = std::min(aRect.YMost(), aOtherRect.YMost());
if (left > right || top > bottom) {
return Nothing();
}
return Some(nsRect(left, top, right - left, bottom - top));
}
--- a/dom/base/DOMRect.cpp
+++ b/dom/base/DOMRect.cpp
@@ -114,13 +114,13 @@ RoundFloat(double aValue)
void
DOMRect::SetLayoutRect(const nsRect& aLayoutRect)
{
double scale = 65536.0;
// Round to the nearest 1/scale units. We choose scale so it can be represented
// exactly by machine floating point.
double scaleInv = 1/scale;
double t2pScaled = scale/nsPresContext::AppUnitsPerCSSPixel();
- double x = RoundFloat(aLayoutRect.x*t2pScaled)*scaleInv;
- double y = RoundFloat(aLayoutRect.y*t2pScaled)*scaleInv;
+ double x = RoundFloat(aLayoutRect.X()*t2pScaled)*scaleInv;
+ double y = RoundFloat(aLayoutRect.Y()*t2pScaled)*scaleInv;
SetRect(x, y, RoundFloat(aLayoutRect.XMost()*t2pScaled)*scaleInv - x,
RoundFloat(aLayoutRect.YMost()*t2pScaled)*scaleInv - y);
}
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -1341,48 +1341,48 @@ public:
MOZ_CAN_RUN_SCRIPT void SetScrollTop(int32_t aScrollTop);
MOZ_CAN_RUN_SCRIPT int32_t ScrollLeft();
MOZ_CAN_RUN_SCRIPT void SetScrollLeft(int32_t aScrollLeft);
MOZ_CAN_RUN_SCRIPT int32_t ScrollWidth();
MOZ_CAN_RUN_SCRIPT int32_t ScrollHeight();
MOZ_CAN_RUN_SCRIPT void MozScrollSnap();
MOZ_CAN_RUN_SCRIPT int32_t ClientTop()
{
- return nsPresContext::AppUnitsToIntCSSPixels(GetClientAreaRect().y);
+ return nsPresContext::AppUnitsToIntCSSPixels(GetClientAreaRect().Y());
}
MOZ_CAN_RUN_SCRIPT int32_t ClientLeft()
{
- return nsPresContext::AppUnitsToIntCSSPixels(GetClientAreaRect().x);
+ return nsPresContext::AppUnitsToIntCSSPixels(GetClientAreaRect().X());
}
MOZ_CAN_RUN_SCRIPT int32_t ClientWidth()
{
return nsPresContext::AppUnitsToIntCSSPixels(GetClientAreaRect().Width());
}
MOZ_CAN_RUN_SCRIPT int32_t ClientHeight()
{
return nsPresContext::AppUnitsToIntCSSPixels(GetClientAreaRect().Height());
}
MOZ_CAN_RUN_SCRIPT int32_t ScrollTopMin()
{
nsIScrollableFrame* sf = GetScrollFrame();
return sf ?
- nsPresContext::AppUnitsToIntCSSPixels(sf->GetScrollRange().y) : 0;
+ nsPresContext::AppUnitsToIntCSSPixels(sf->GetScrollRange().Y()) : 0;
}
MOZ_CAN_RUN_SCRIPT int32_t ScrollTopMax()
{
nsIScrollableFrame* sf = GetScrollFrame();
return sf ?
nsPresContext::AppUnitsToIntCSSPixels(sf->GetScrollRange().YMost()) :
0;
}
MOZ_CAN_RUN_SCRIPT int32_t ScrollLeftMin()
{
nsIScrollableFrame* sf = GetScrollFrame();
return sf ?
- nsPresContext::AppUnitsToIntCSSPixels(sf->GetScrollRange().x) : 0;
+ nsPresContext::AppUnitsToIntCSSPixels(sf->GetScrollRange().X()) : 0;
}
MOZ_CAN_RUN_SCRIPT int32_t ScrollLeftMax()
{
nsIScrollableFrame* sf = GetScrollFrame();
return sf ?
nsPresContext::AppUnitsToIntCSSPixels(sf->GetScrollRange().XMost()) :
0;
}
--- a/dom/base/Selection.cpp
+++ b/dom/base/Selection.cpp
@@ -2200,21 +2200,21 @@ Selection::DoAutoScroll(nsIFrame* aFrame
// If aPoint is at the screen edge then try to scroll anyway, once.
RefPtr<nsDeviceContext> dx = shell->GetViewManager()->GetDeviceContext();
nsRect screen;
dx->GetRect(screen);
nsPoint screenPoint = globalPoint +
rootmostFrame->GetScreenRectInAppUnits().TopLeft();
nscoord onePx = nsPresContext::AppUnitsPerCSSPixel();
nscoord scrollAmount = 10 * onePx;
- if (std::abs(screen.x - screenPoint.x) <= onePx) {
+ if (std::abs(screen.X() - screenPoint.x) <= onePx) {
aPoint.x -= scrollAmount;
} else if (std::abs(screen.XMost() - screenPoint.x) <= onePx) {
aPoint.x += scrollAmount;
- } else if (std::abs(screen.y - screenPoint.y) <= onePx) {
+ } else if (std::abs(screen.Y() - screenPoint.y) <= onePx) {
aPoint.y -= scrollAmount;
} else if (std::abs(screen.YMost() - screenPoint.y) <= onePx) {
aPoint.y += scrollAmount;
} else {
break;
}
done = true;
continue;
@@ -3516,20 +3516,20 @@ Selection::GetSelectionEndPointGeometry(
// Get the x coordinate of the offset into the text frame.
rv = GetCachedFrameOffset(frame, nodeOffset, pt);
if (NS_FAILED(rv))
return nullptr;
}
// Return the rect relative to the frame, with zero width.
if (isText) {
- aRect->x = pt.x;
+ aRect->MoveToX(pt.x);
} else if (mFrameSelection->GetHint() == CARET_ASSOCIATE_BEFORE) {
// It's the frame's right edge we're interested in.
- aRect->x = frame->GetRect().Width();
+ aRect->MoveToX(frame->GetRect().Width());
}
aRect->SetHeight(frame->GetRect().Height());
return frame;
}
NS_IMETHODIMP
Selection::ScrollSelectionIntoViewEvent::Run()
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1738,18 +1738,18 @@ nsDOMWindowUtils::GetRootBounds(nsIDOMCl
bounds.SetHeight(bounds.Height() + sf->GetScrollPortRect().Height());
} else if (presShell->GetRootFrame()) {
bounds = presShell->GetRootFrame()->GetRect();
}
}
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
RefPtr<DOMRect> rect = new DOMRect(window);
- rect->SetRect(nsPresContext::AppUnitsToFloatCSSPixels(bounds.x),
- nsPresContext::AppUnitsToFloatCSSPixels(bounds.y),
+ rect->SetRect(nsPresContext::AppUnitsToFloatCSSPixels(bounds.X()),
+ nsPresContext::AppUnitsToFloatCSSPixels(bounds.Y()),
nsPresContext::AppUnitsToFloatCSSPixels(bounds.Width()),
nsPresContext::AppUnitsToFloatCSSPixels(bounds.Height()));
rect.forget(aResult);
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetIMEIsOpen(bool *aState)
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -2630,18 +2630,17 @@ nsFocusManager::GetSelectionLocation(nsI
nsRect caretRect;
nsIFrame *frame = nsCaret::GetGeometry(domSelection, &caretRect);
if (frame) {
nsPoint caretWidgetOffset;
nsIWidget *widget = frame->GetNearestWidget(caretWidgetOffset);
caretRect.MoveBy(caretWidgetOffset);
nsPoint newCaretOffset;
nsIWidget *newCaretWidget = newCaretFrame->GetNearestWidget(newCaretOffset);
- if (widget == newCaretWidget && caretRect.y == newCaretOffset.y &&
- caretRect.x == newCaretOffset.x) {
+ if (widget == newCaretWidget && caretRect.IsEqualXY(newCaretOffset.x, newCaretOffset.y)) {
// The caret is at the start of the new element.
startFrame = newCaretFrame;
startContent = newCaretContent;
if (endOfSelectionInStartNode) {
endContent = newCaretContent; // Ensure end of selection is not before start
}
}
}
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -2469,18 +2469,20 @@ nsFrameLoader::GetWindowDimensions(nsInt
nsCOMPtr<nsIDocShellTreeOwner> parentOwner;
if (NS_FAILED(parentAsItem->GetTreeOwner(getter_AddRefs(parentOwner))) ||
!parentOwner) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIBaseWindow> treeOwnerAsWin(do_GetInterface(parentOwner));
- treeOwnerAsWin->GetPosition(&aRect.x, &aRect.y);
- treeOwnerAsWin->GetSize(&aRect.width, &aRect.height);
+ int32_t x, y, width, height;
+ treeOwnerAsWin->GetPosition(&x, &y);
+ treeOwnerAsWin->GetSize(&width, &height);
+ aRect.SetRect(x, y, width, height);
return NS_OK;
}
NS_IMETHODIMP
nsFrameLoader::UpdatePositionAndSize(nsSubDocumentFrame *aIFrame)
{
if (IsRemoteFrame()) {
if (mRemoteBrowser) {
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -3457,20 +3457,20 @@ nsGlobalWindowOuter::GetScreenXY(CallerT
dc->GetRect(screenRect);
LayoutDeviceRect screenRectDev =
LayoutDevicePixel::FromAppUnits(screenRect, dc->AppUnitsPerDevPixel());
DesktopToLayoutDeviceScale scale = dc->GetDesktopToDeviceScale();
DesktopRect screenRectDesk = screenRectDev / scale;
CSSPoint cssPt =
- LayoutDevicePoint(x - screenRectDev.x, y - screenRectDev.y) /
+ LayoutDevicePoint(x - screenRectDev.X(), y - screenRectDev.Y()) /
presContext->CSSToDevPixelScale();
- cssPt.x += screenRectDesk.x;
- cssPt.y += screenRectDesk.y;
+ cssPt.x += screenRectDesk.X();
+ cssPt.y += screenRectDesk.Y();
return CSSIntPoint(NSToIntRound(cssPt.x), NSToIntRound(cssPt.y));
}
int32_t
nsGlobalWindowOuter::GetScreenXOuter(CallerType aCallerType, ErrorResult& aError)
{
return GetScreenXY(aCallerType, aError).x;
@@ -3505,29 +3505,29 @@ float
nsGlobalWindowOuter::GetMozInnerScreenXOuter(CallerType aCallerType)
{
// When resisting fingerprinting, always return 0.
if (nsContentUtils::ResistFingerprinting(aCallerType)) {
return 0.0;
}
nsRect r = GetInnerScreenRect();
- return nsPresContext::AppUnitsToFloatCSSPixels(r.x);
+ return nsPresContext::AppUnitsToFloatCSSPixels(r.X());
}
float
nsGlobalWindowOuter::GetMozInnerScreenYOuter(CallerType aCallerType)
{
// Return 0 to prevent fingerprinting.
if (nsContentUtils::ResistFingerprinting(aCallerType)) {
return 0.0;
}
nsRect r = GetInnerScreenRect();
- return nsPresContext::AppUnitsToFloatCSSPixels(r.y);
+ return nsPresContext::AppUnitsToFloatCSSPixels(r.Y());
}
double
nsGlobalWindowOuter::GetDevicePixelRatioOuter(CallerType aCallerType)
{
if (!mDocShell) {
return 1.0;
}
--- a/dom/base/nsQueryContentEventResult.cpp
+++ b/dom/base/nsQueryContentEventResult.cpp
@@ -118,17 +118,17 @@ nsQueryContentEventResult::GetReversed(b
}
NS_IMETHODIMP
nsQueryContentEventResult::GetLeft(int32_t *aLeft)
{
NS_ENSURE_TRUE(mSucceeded, NS_ERROR_NOT_AVAILABLE);
NS_ENSURE_TRUE(IsRectRelatedPropertyAvailable(mEventMessage),
NS_ERROR_NOT_AVAILABLE);
- *aLeft = mRect.x;
+ *aLeft = mRect.X();
return NS_OK;
}
NS_IMETHODIMP
nsQueryContentEventResult::GetWidth(int32_t *aWidth)
{
NS_ENSURE_TRUE(mSucceeded, NS_ERROR_NOT_AVAILABLE);
NS_ENSURE_TRUE(IsRectRelatedPropertyAvailable(mEventMessage),
@@ -138,17 +138,17 @@ nsQueryContentEventResult::GetWidth(int3
}
NS_IMETHODIMP
nsQueryContentEventResult::GetTop(int32_t *aTop)
{
NS_ENSURE_TRUE(mSucceeded, NS_ERROR_NOT_AVAILABLE);
NS_ENSURE_TRUE(IsRectRelatedPropertyAvailable(mEventMessage),
NS_ERROR_NOT_AVAILABLE);
- *aTop = mRect.y;
+ *aTop = mRect.Y();
return NS_OK;
}
NS_IMETHODIMP
nsQueryContentEventResult::GetHeight(int32_t *aHeight)
{
NS_ENSURE_TRUE(mSucceeded, NS_ERROR_NOT_AVAILABLE);
NS_ENSURE_TRUE(IsRectRelatedPropertyAvailable(mEventMessage),
@@ -209,18 +209,18 @@ nsQueryContentEventResult::GetCharacterR
NS_ENSURE_TRUE(mSucceeded, NS_ERROR_NOT_AVAILABLE);
NS_ENSURE_TRUE(mEventMessage == eQueryTextRectArray,
NS_ERROR_NOT_AVAILABLE);
if (NS_WARN_IF(mRectArray.Length() <= static_cast<uint32_t>(aOffset))) {
return NS_ERROR_FAILURE;
}
- *aLeft = mRectArray[aOffset].x;
- *aTop = mRectArray[aOffset].y;
+ *aLeft = mRectArray[aOffset].X();
+ *aTop = mRectArray[aOffset].Y();
*aWidth = mRectArray[aOffset].Width();
*aHeight = mRectArray[aOffset].Height();
return NS_OK;
}
void
nsQueryContentEventResult::SetEventResult(nsIWidget* aWidget,
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -3213,30 +3213,28 @@ nsRange::CreateContextualFragment(const
static void ExtractRectFromOffset(nsIFrame* aFrame,
const int32_t aOffset, nsRect* aR, bool aKeepLeft,
bool aClampToEdge)
{
nsPoint point;
aFrame->GetPointFromOffset(aOffset, &point);
if (!aClampToEdge && !aR->Contains(point)) {
- aR->SetWidth(0);
- aR->x = point.x;
+ aR->SetRectX(point.x, 0);
return;
}
if (aClampToEdge) {
point = aR->ClampPoint(point);
}
if (aKeepLeft) {
- aR->SetWidth(point.x - aR->x);
+ aR->SetRightEdge(point.x);
} else {
- aR->SetWidth(aR->XMost() - point.x);
- aR->x = point.x;
+ aR->SetLeftEdge(point.x);
}
}
static nsTextFrame*
GetTextFrameForContent(nsIContent* aContent, bool aFlushLayout)
{
nsIDocument* doc = aContent->OwnerDoc();
nsIPresShell* presShell = doc->GetShell();
--- a/dom/base/nsScreen.cpp
+++ b/dom/base/nsScreen.cpp
@@ -128,22 +128,20 @@ nsScreen::GetRect(nsRect& aRect)
context->GetRect(aRect);
LayoutDevicePoint screenTopLeftDev =
LayoutDevicePixel::FromAppUnits(aRect.TopLeft(),
context->AppUnitsPerDevPixel());
DesktopPoint screenTopLeftDesk =
screenTopLeftDev / context->GetDesktopToDeviceScale();
- aRect.x = NSToIntRound(screenTopLeftDesk.x);
- aRect.y = NSToIntRound(screenTopLeftDesk.y);
-
- aRect.SetHeight(nsPresContext::AppUnitsToIntCSSPixels(aRect.Height()));
- aRect.SetWidth(nsPresContext::AppUnitsToIntCSSPixels(aRect.Width()));
-
+ aRect.SetRect(NSToIntRound(screenTopLeftDesk.x),
+ NSToIntRound(screenTopLeftDesk.y),
+ nsPresContext::AppUnitsToIntCSSPixels(aRect.Width()),
+ nsPresContext::AppUnitsToIntCSSPixels(aRect.Height()));
return NS_OK;
}
nsresult
nsScreen::GetAvailRect(nsRect& aRect)
{
// Return window inner rect to prevent fingerprinting.
if (ShouldResistFingerprinting()) {
@@ -161,24 +159,22 @@ nsScreen::GetAvailRect(nsRect& aRect)
LayoutDevicePoint screenTopLeftDev =
LayoutDevicePixel::FromAppUnits(r.TopLeft(),
context->AppUnitsPerDevPixel());
DesktopPoint screenTopLeftDesk =
screenTopLeftDev / context->GetDesktopToDeviceScale();
context->GetClientRect(aRect);
- aRect.x = NSToIntRound(screenTopLeftDesk.x) +
- nsPresContext::AppUnitsToIntCSSPixels(aRect.x - r.x);
- aRect.y = NSToIntRound(screenTopLeftDesk.y) +
- nsPresContext::AppUnitsToIntCSSPixels(aRect.y - r.y);
-
- aRect.SetHeight(nsPresContext::AppUnitsToIntCSSPixels(aRect.Height()));
- aRect.SetWidth(nsPresContext::AppUnitsToIntCSSPixels(aRect.Width()));
-
+ aRect.SetRect(NSToIntRound(screenTopLeftDesk.x) +
+ nsPresContext::AppUnitsToIntCSSPixels(aRect.X() - r.X()),
+ NSToIntRound(screenTopLeftDesk.y) +
+ nsPresContext::AppUnitsToIntCSSPixels(aRect.Y() - r.Y()),
+ nsPresContext::AppUnitsToIntCSSPixels(aRect.Width()),
+ nsPresContext::AppUnitsToIntCSSPixels(aRect.Height()));
return NS_OK;
}
mozilla::dom::ScreenOrientation*
nsScreen::Orientation() const
{
return mScreenOrientation;
}
@@ -318,25 +314,30 @@ JSObject*
nsScreen::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return ScreenBinding::Wrap(aCx, this, aGivenProto);
}
nsresult
nsScreen::GetWindowInnerRect(nsRect& aRect)
{
- aRect.x = 0;
- aRect.y = 0;
+ aRect.MoveTo(0, 0);
nsCOMPtr<nsPIDOMWindowInner> win = GetOwner();
if (!win) {
return NS_ERROR_FAILURE;
}
- nsresult rv = win->GetInnerWidth(&aRect.width);
+ nscoord width = aRect.Width();
+ nsresult rv = win->GetInnerWidth(&width);
+ aRect.SetWidth(width);
NS_ENSURE_SUCCESS(rv, rv);
- return win->GetInnerHeight(&aRect.height);
+
+ nscoord height = aRect.Height();
+ rv = win->GetInnerHeight(&height);
+ aRect.SetHeight(height);
+ return rv;
}
bool nsScreen::ShouldResistFingerprinting() const
{
bool resist = false;
nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner();
if (owner) {
resist = nsContentUtils::ShouldResistFingerprinting(owner->GetDocShell());
--- a/dom/base/nsScreen.h
+++ b/dom/base/nsScreen.h
@@ -35,24 +35,24 @@ public:
}
nsPIDOMWindowOuter* GetOuter() const;
int32_t GetTop(ErrorResult& aRv)
{
nsRect rect;
aRv = GetRect(rect);
- return rect.y;
+ return rect.Y();
}
int32_t GetLeft(ErrorResult& aRv)
{
nsRect rect;
aRv = GetRect(rect);
- return rect.x;
+ return rect.X();
}
int32_t GetWidth(ErrorResult& aRv)
{
nsRect rect;
if (IsDeviceSizePageSize()) {
if (nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner()) {
int32_t innerWidth = 0;
@@ -85,24 +85,24 @@ public:
{
return GetPixelDepth(aRv);
}
int32_t GetAvailTop(ErrorResult& aRv)
{
nsRect rect;
aRv = GetAvailRect(rect);
- return rect.y;
+ return rect.Y();
}
int32_t GetAvailLeft(ErrorResult& aRv)
{
nsRect rect;
aRv = GetAvailRect(rect);
- return rect.x;
+ return rect.X();
}
int32_t GetAvailWidth(ErrorResult& aRv)
{
nsRect rect;
aRv = GetAvailRect(rect);
return rect.Width();
}
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -420,17 +420,17 @@ public:
}
Matrix transform =
mFinalTarget->GetTransform().PostTranslate(-aRect.TopLeft() + mOffset);
dt->SetTransform(transform);
if (transform.Invert()) {
- gfx::Rect dtBounds(0, 0, aRect.width, aRect.height);
+ gfx::Rect dtBounds(0, 0, aRect.Width(), aRect.Height());
gfx::Rect fillRect = transform.TransformBounds(dtBounds);
dt->FillRect(fillRect, CanvasGeneralPattern().ForStyle(mCtx, aStyle, dt));
}
return dt->Snapshot();
}
~AdjustedTargetForFilter()
{
@@ -1481,17 +1481,17 @@ bool CanvasRenderingContext2D::SwitchRen
mRenderingMode = attemptedMode;
return true;
}
bool
CanvasRenderingContext2D::CopyBufferProvider(PersistentBufferProvider& aOld,
DrawTarget& aTarget,
- IntRect aCopyRect)
+ const IntRect& aCopyRect)
{
// Borrowing the snapshot must be done after ReturnTarget.
RefPtr<SourceSurface> snapshot = aOld.BorrowSnapshot();
if (!snapshot) {
return false;
}
@@ -4210,17 +4210,17 @@ CanvasRenderingContext2D::AddHitRegion(c
if (!path) {
aError.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return;
}
// get the bounds of the current path. They are relative to the canvas
gfx::Rect bounds(path->GetBounds(mTarget->GetTransform()));
- if ((bounds.width == 0) || (bounds.height == 0) || !bounds.IsFinite()) {
+ if (bounds.IsZeroArea() || !bounds.IsFinite()) {
// The specified region has no pixels.
aError.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return;
}
// remove old hit region first
RemoveHitRegion(aOptions.mId);
@@ -4274,17 +4274,17 @@ CanvasRenderingContext2D::ClearHitRegion
bool
CanvasRenderingContext2D::GetHitRegionRect(Element* aElement, nsRect& aRect)
{
for (unsigned int x = 0; x < mHitRegionsOptions.Length(); x++) {
RegionInfo& info = mHitRegionsOptions[x];
if (info.mElement == aElement) {
gfx::Rect bounds(info.mPath->GetBounds());
- gfxRect rect(bounds.x, bounds.y, bounds.width, bounds.height);
+ gfxRect rect(bounds.X(), bounds.Y(), bounds.Width(), bounds.Height());
aRect = nsLayoutUtils::RoundGfxRectToAppRect(rect, AppUnitsPerCSSPixel());
return true;
}
}
return false;
}
@@ -4739,17 +4739,17 @@ CanvasRenderingContext2D::DrawOrMeasureT
baselineAnchor -= (fontMetrics.emAscent - fontMetrics.emDescent) * .5f;
}
processor.mPt.x -= baselineAnchor;
} else {
processor.mPt.y += baselineAnchor;
}
// correct bounding box to get it to be the correct size/position
- processor.mBoundingBox.width = totalWidth;
+ processor.mBoundingBox.SetWidth(totalWidth);
processor.mBoundingBox.MoveBy(gfxPoint(processor.mPt.x, processor.mPt.y));
processor.mPt.x *= processor.mAppUnitsPerDevPixel;
processor.mPt.y *= processor.mAppUnitsPerDevPixel;
EnsureTarget();
if (!IsTargetValid()) {
return NS_ERROR_FAILURE;
@@ -5398,64 +5398,64 @@ CanvasRenderingContext2D::DrawImage(cons
}
void
CanvasRenderingContext2D::DrawDirectlyToCanvas(
const nsLayoutUtils::DirectDrawInfo& aImage,
gfx::Rect* aBounds,
gfx::Rect aDest,
gfx::Rect aSrc,
- gfx::IntSize aImgSize)
-{
- MOZ_ASSERT(aSrc.width > 0 && aSrc.height > 0,
- "Need positive source width and height");
+ const gfx::IntSize& aImgSize)
+{
+ MOZ_ASSERT(!aSrc.IsEmpty(), "Need positive source width and height");
AdjustedTarget tempTarget(this, aBounds->IsEmpty() ? nullptr: aBounds);
if (!tempTarget) {
return;
}
// Get any existing transforms on the context, including transformations used
// for context shadow.
Matrix matrix = tempTarget->GetTransform();
gfxMatrix contextMatrix = ThebesMatrix(matrix);
gfxSize contextScale(contextMatrix.ScaleFactors(true));
// Scale the dest rect to include the context scale.
aDest.Scale(contextScale.width, contextScale.height);
// Scale the image size to the dest rect, and adjust the source rect to match.
- gfxSize scale(aDest.width / aSrc.width, aDest.height / aSrc.height);
+ gfxSize scale(aDest.Width() / aSrc.Width(), aDest.Height() / aSrc.Height());
IntSize scaledImageSize = IntSize::Ceil(aImgSize.width * scale.width,
aImgSize.height * scale.height);
aSrc.Scale(scale.width, scale.height);
// We're wrapping tempTarget's (our) DrawTarget here, so we need to restore
// the matrix even though this is a temp gfxContext.
AutoRestoreTransform autoRestoreTransform(mTarget);
RefPtr<gfxContext> context = gfxContext::CreateOrNull(tempTarget);
if (!context) {
gfxDevCrash(LogReason::InvalidContext) << "Canvas context problem";
return;
}
context->SetMatrixDouble(contextMatrix.
PreScale(1.0 / contextScale.width,
1.0 / contextScale.height).
- PreTranslate(aDest.x - aSrc.x, aDest.y - aSrc.y));
+ PreTranslate(aDest.X() - aSrc.X(),
+ aDest.Y() - aSrc.Y()));
// FLAG_CLAMP is added for increased performance, since we never tile here.
uint32_t modifiedFlags = aImage.mDrawingFlags | imgIContainer::FLAG_CLAMP;
CSSIntSize sz(scaledImageSize.width, scaledImageSize.height); // XXX hmm is scaledImageSize really in CSS pixels?
SVGImageContext svgContext(Some(sz));
auto result = aImage.mImgContainer->
Draw(context, scaledImageSize,
- ImageRegion::Create(gfxRect(aSrc.x, aSrc.y, aSrc.width, aSrc.height)),
+ ImageRegion::Create(gfxRect(aSrc.X(), aSrc.Y(), aSrc.Width(), aSrc.Height())),
aImage.mWhichFrame, SamplingFilter::GOOD, Some(svgContext), modifiedFlags, CurrentState().globalAlpha);
if (result != ImgDrawResult::SUCCESS) {
NS_WARNING("imgIContainer::Draw failed");
}
}
void
@@ -5892,25 +5892,25 @@ CanvasRenderingContext2D::GetImageDataAr
do {
JS::AutoCheckCannotGC nogc;
bool isShared;
uint8_t* data = JS_GetUint8ClampedArrayData(darray, &isShared, nogc);
MOZ_ASSERT(!isShared); // Should not happen, data was created above
uint32_t srcStride = rawData.mStride;
- uint8_t* src = rawData.mData + srcReadRect.y * srcStride + srcReadRect.x * 4;
+ uint8_t* src = rawData.mData + srcReadRect.Y() * srcStride + srcReadRect.X() * 4;
// Return all-white, opaque pixel data if no permission.
if (usePlaceholder) {
memset(data, 0xFF, len.value());
break;
}
- uint8_t* dst = data + dstWriteRect.y * (aWidth * 4) + dstWriteRect.x * 4;
+ uint8_t* dst = data + dstWriteRect.Y() * (aWidth * 4) + dstWriteRect.X() * 4;
if (mOpaque) {
SwizzleData(src, srcStride, SurfaceFormat::X8R8G8B8_UINT32,
dst, aWidth * 4, SurfaceFormat::R8G8B8A8,
dstWriteRect.Size());
} else {
UnpremultiplyData(src, srcStride, SurfaceFormat::A8R8G8B8_UINT32,
dst, aWidth * 4, SurfaceFormat::R8G8B8A8,
@@ -6060,17 +6060,17 @@ CanvasRenderingContext2D::PutImageData_e
DataSourceSurface::MappedSurface map;
RefPtr<DataSourceSurface> sourceSurface;
uint8_t* lockedBits = nullptr;
uint8_t* dstData;
IntSize dstSize;
int32_t dstStride;
SurfaceFormat dstFormat;
if (mTarget->LockBits(&lockedBits, &dstSize, &dstStride, &dstFormat)) {
- dstData = lockedBits + dirtyRect.y * dstStride + dirtyRect.x * 4;
+ dstData = lockedBits + dirtyRect.Y() * dstStride + dirtyRect.X() * 4;
} else {
sourceSurface =
Factory::CreateDataSourceSurface(dirtyRect.Size(),
SurfaceFormat::B8G8R8A8,
false);
// In certain scenarios, requesting larger than 8k image fails. Bug 803568
// covers the details of how to run into it, but the full detailed
@@ -6087,31 +6087,31 @@ CanvasRenderingContext2D::PutImageData_e
if (!dstData) {
return NS_ERROR_OUT_OF_MEMORY;
}
dstStride = map.mStride;
dstFormat = sourceSurface->GetFormat();
}
IntRect srcRect = dirtyRect - IntPoint(aX, aY);
- uint8_t* srcData = aArray->Data() + srcRect.y * (aW * 4) + srcRect.x * 4;
+ uint8_t* srcData = aArray->Data() + srcRect.Y() * (aW * 4) + srcRect.X() * 4;
PremultiplyData(srcData, aW * 4, SurfaceFormat::R8G8B8A8,
dstData, dstStride,
mOpaque ? SurfaceFormat::X8R8G8B8_UINT32 : SurfaceFormat::A8R8G8B8_UINT32,
dirtyRect.Size());
if (lockedBits) {
mTarget->ReleaseBits(lockedBits);
} else if (sourceSurface) {
sourceSurface->Unmap();
mTarget->CopySurface(sourceSurface, dirtyRect - dirtyRect.TopLeft(), dirtyRect.TopLeft());
}
- Redraw(gfx::Rect(dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height));
+ Redraw(gfx::Rect(dirtyRect.X(), dirtyRect.Y(), dirtyRect.Width(), dirtyRect.Height()));
return NS_OK;
}
static already_AddRefed<ImageData>
CreateImageData(JSContext* aCx, CanvasRenderingContext2D* aContext,
uint32_t aW, uint32_t aH, ErrorResult& aError)
{
--- a/dom/canvas/CanvasRenderingContext2D.h
+++ b/dom/canvas/CanvasRenderingContext2D.h
@@ -563,17 +563,17 @@ protected:
nsresult PutImageData_explicit(int32_t aX, int32_t aY, uint32_t aW, uint32_t aH,
dom::Uint8ClampedArray* aArray,
bool aHasDirtyRect, int32_t aDirtyX, int32_t aDirtyY,
int32_t aDirtyWidth, int32_t aDirtyHeight);
bool CopyBufferProvider(layers::PersistentBufferProvider& aOld,
gfx::DrawTarget& aTarget,
- gfx::IntRect aCopyRect);
+ const gfx::IntRect& aCopyRect);
/**
* Internal method to complete initialisation, expects mTarget to have been set
*/
nsresult Initialize(int32_t aWidth, int32_t aHeight);
nsresult InitializeWithTarget(mozilla::gfx::DrawTarget* aSurface,
int32_t aWidth, int32_t aHeight);
@@ -727,19 +727,19 @@ protected:
void DrawImage(const CanvasImageSource& aImgElt,
double aSx, double aSy, double aSw, double aSh,
double aDx, double aDy, double aDw, double aDh,
uint8_t aOptional_argc, mozilla::ErrorResult& aError);
void DrawDirectlyToCanvas(const nsLayoutUtils::DirectDrawInfo& aImage,
mozilla::gfx::Rect* aBounds,
- mozilla::gfx::Rect aDest,
- mozilla::gfx::Rect aSrc,
- gfx::IntSize aImgSize);
+ mozilla::gfx::Rect aDest, // Modified locally
+ mozilla::gfx::Rect aSrc, // for easier computation
+ const gfx::IntSize& aImgSize);
nsString& GetFont()
{
/* will initilize the value if not set, else does nothing */
GetCurrentFontStyle();
return CurrentState().font;
}
--- a/dom/canvas/ImageBitmap.cpp
+++ b/dom/canvas/ImageBitmap.cpp
@@ -156,38 +156,36 @@ ImageBitmapShutdownObserver::Observe(nsI
* and height.
*/
static IntRect
FixUpNegativeDimension(const IntRect& aRect, ErrorResult& aRv)
{
gfx::IntRect rect = aRect;
// fix up negative dimensions
- if (rect.width < 0) {
- CheckedInt32 checkedX = CheckedInt32(rect.x) + rect.width;
+ if (rect.Width() < 0) {
+ CheckedInt32 checkedX = CheckedInt32(rect.X()) + rect.Width();
if (!checkedX.isValid()) {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return rect;
}
- rect.x = checkedX.value();
- rect.width = -(rect.width);
+ rect.SetRectX(checkedX.value(), -rect.Width());
}
- if (rect.height < 0) {
- CheckedInt32 checkedY = CheckedInt32(rect.y) + rect.height;
+ if (rect.Height() < 0) {
+ CheckedInt32 checkedY = CheckedInt32(rect.Y()) + rect.Height();
if (!checkedY.isValid()) {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return rect;
}
- rect.y = checkedY.value();
- rect.height = -(rect.height);
+ rect.SetRectY(checkedY.value(), -rect.Height());
}
return rect;
}
/*
* This helper function copies the data of the given DataSourceSurface,
* _aSurface_, in the given area, _aCropRect_, into a new DataSourceSurface.
@@ -215,18 +213,18 @@ CropAndCopyDataSourceSurface(DataSourceS
// We cannot keep using aSurface->GetFormat() to create new DataSourceSurface,
// since it might be SurfaceFormat::B8G8R8X8 which does not handle opacity,
// however the specification explicitly define that "If any of the pixels on
// this rectangle are outside the area where the input bitmap was placed, then
// they will be transparent black in output."
// So, instead, we force the output format to be SurfaceFormat::B8G8R8A8.
const SurfaceFormat format = SurfaceFormat::B8G8R8A8;
const int bytesPerPixel = BytesPerPixel(format);
- const IntSize dstSize = IntSize(positiveCropRect.width,
- positiveCropRect.height);
+ const IntSize dstSize = IntSize(positiveCropRect.Width(),
+ positiveCropRect.Height());
const uint32_t dstStride = dstSize.width * bytesPerPixel;
// Create a new SourceSurface.
RefPtr<DataSourceSurface> dstDataSurface =
Factory::CreateDataSourceSurfaceWithStride(dstSize, format, dstStride, true);
if (NS_WARN_IF(!dstDataSurface)) {
return nullptr;
@@ -243,27 +241,28 @@ CropAndCopyDataSourceSurface(DataSourceS
// Copy the raw data into the newly created DataSourceSurface.
DataSourceSurface::ScopedMap srcMap(aSurface, DataSourceSurface::READ);
DataSourceSurface::ScopedMap dstMap(dstDataSurface, DataSourceSurface::WRITE);
if (NS_WARN_IF(!srcMap.IsMapped()) ||
NS_WARN_IF(!dstMap.IsMapped())) {
return nullptr;
}
- uint8_t* srcBufferPtr = srcMap.GetData() + surfPortion.y * srcMap.GetStride()
- + surfPortion.x * bytesPerPixel;
+ uint8_t* srcBufferPtr = srcMap.GetData() + surfPortion.Y() * srcMap.GetStride()
+ + surfPortion.X() * bytesPerPixel;
uint8_t* dstBufferPtr = dstMap.GetData() + dest.y * dstMap.GetStride()
+ dest.x * bytesPerPixel;
CheckedInt<uint32_t> copiedBytesPerRaw =
- CheckedInt<uint32_t>(surfPortion.width) * bytesPerPixel;
+ CheckedInt<uint32_t>(surfPortion.Width()) * bytesPerPixel;
if (!copiedBytesPerRaw.isValid()) {
return nullptr;
}
- for (int i = 0; i < surfPortion.height; ++i) {
+ auto surfPortionHeight = surfPortion.Height();
+ for (int i = 0; i < surfPortionHeight; ++i) {
memcpy(dstBufferPtr, srcBufferPtr, copiedBytesPerRaw.value());
srcBufferPtr += srcMap.GetStride();
dstBufferPtr += dstMap.GetStride();
}
}
return dstDataSurface.forget();
}
@@ -1525,20 +1524,20 @@ ImageBitmap::ReadStructuredClone(JSConte
/*static*/ bool
ImageBitmap::WriteStructuredClone(JSStructuredCloneWriter* aWriter,
nsTArray<RefPtr<DataSourceSurface>>& aClonedSurfaces,
ImageBitmap* aImageBitmap)
{
MOZ_ASSERT(aWriter);
MOZ_ASSERT(aImageBitmap);
- const uint32_t picRectX = BitwiseCast<uint32_t>(aImageBitmap->mPictureRect.x);
- const uint32_t picRectY = BitwiseCast<uint32_t>(aImageBitmap->mPictureRect.y);
- const uint32_t picRectWidth = BitwiseCast<uint32_t>(aImageBitmap->mPictureRect.width);
- const uint32_t picRectHeight = BitwiseCast<uint32_t>(aImageBitmap->mPictureRect.height);
+ const uint32_t picRectX = BitwiseCast<uint32_t>(aImageBitmap->mPictureRect.X());
+ const uint32_t picRectY = BitwiseCast<uint32_t>(aImageBitmap->mPictureRect.Y());
+ const uint32_t picRectWidth = BitwiseCast<uint32_t>(aImageBitmap->mPictureRect.Width());
+ const uint32_t picRectHeight = BitwiseCast<uint32_t>(aImageBitmap->mPictureRect.Height());
const uint32_t alphaType = BitwiseCast<uint32_t>(aImageBitmap->mAlphaType);
const uint32_t isCroppingAreaOutSideOfSourceImage = aImageBitmap->mIsCroppingAreaOutSideOfSourceImage ? 1 : 0;
// Indexing the cloned surfaces and send the index to the receiver.
uint32_t index = aClonedSurfaces.Length();
if (NS_WARN_IF(!JS_WriteUint32Pair(aWriter, SCTAG_DOM_IMAGEBITMAP, index)) ||
NS_WARN_IF(!JS_WriteUint32Pair(aWriter, picRectX, picRectY)) ||
@@ -1826,17 +1825,17 @@ ImageBitmap::MapDataInto(JSContext* aCx,
// Case 2:
// If the image bitmap is going to be accessed in YUV422/YUV422 series with a
// cropping area starts at an odd x or y coordinate.
if (aFormat == ImageBitmapFormat::YUV422P ||
aFormat == ImageBitmapFormat::YUV420P ||
aFormat == ImageBitmapFormat::YUV420SP_NV12 ||
aFormat == ImageBitmapFormat::YUV420SP_NV21) {
- if ((mPictureRect.x & 1) || (mPictureRect.y & 1)) {
+ if ((mPictureRect.X() & 1) || (mPictureRect.Y() & 1)) {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return promise.forget();
}
}
AsyncMapDataIntoBufferSource(aCx, promise, this, aBuffer, aOffset, aFormat);
return promise.forget();
}
--- a/dom/events/ContentEventHandler.cpp
+++ b/dom/events/ContentEventHandler.cpp
@@ -1565,25 +1565,25 @@ ContentEventHandler::OnQueryTextContent(
return NS_OK;
}
void
ContentEventHandler::EnsureNonEmptyRect(nsRect& aRect) const
{
// See the comment in ContentEventHandler.h why this doesn't set them to
// one device pixel.
- aRect.height = std::max(1, aRect.height);
- aRect.width = std::max(1, aRect.width);
+ aRect.SetHeight(std::max(1, aRect.Height()));
+ aRect.SetWidth(std::max(1, aRect.Width()));
}
void
ContentEventHandler::EnsureNonEmptyRect(LayoutDeviceIntRect& aRect) const
{
- aRect.height = std::max(1, aRect.height);
- aRect.width = std::max(1, aRect.width);
+ aRect.SetHeight(std::max(1, aRect.Height()));
+ aRect.SetWidth(std::max(1, aRect.Width()));
}
ContentEventHandler::NodePosition
ContentEventHandler::GetNodePositionHavingFlatText(
const NodePosition& aNodePosition)
{
return GetNodePositionHavingFlatText(aNodePosition.Container(),
aNodePosition.Offset());
@@ -1823,24 +1823,24 @@ ContentEventHandler::GetLineBreakerRectB
if (NS_WARN_IF(!fontMetrics)) {
return FrameRelativeRect();
}
const WritingMode kWritingMode = frameForFontMetrics->GetWritingMode();
nscoord baseline = aFrame->GetCaretBaseline();
if (kWritingMode.IsVertical()) {
if (kWritingMode.IsLineInverted()) {
- result.mRect.x = baseline - fontMetrics->MaxDescent();
+ result.mRect.MoveToX(baseline - fontMetrics->MaxDescent());
} else {
- result.mRect.x = baseline - fontMetrics->MaxAscent();
+ result.mRect.MoveToX(baseline - fontMetrics->MaxAscent());
}
- result.mRect.width = fontMetrics->MaxHeight();
+ result.mRect.SetWidth(fontMetrics->MaxHeight());
} else {
- result.mRect.y = baseline - fontMetrics->MaxAscent();
- result.mRect.height = fontMetrics->MaxHeight();
+ result.mRect.SetRectY(baseline - fontMetrics->MaxAscent(),
+ fontMetrics->MaxHeight());
}
// If aFrame isn't a <br> frame, caret should be at outside of it because
// the line break is before its open tag. For example, case of
// |<div><p>some text</p></div>|, caret is before <p> element and in <div>
// element, the caret should be left of top-left corner of <p> element like:
//
// +-<div>------------------- <div>'s border box
@@ -1851,26 +1851,25 @@ ContentEventHandler::GetLineBreakerRectB
// ^- caret
//
// However, this is a hack for unusual scenario. This hack shouldn't be
// used as far as possible.
if (!aFrame->IsBrFrame()) {
if (kWritingMode.IsVertical()) {
if (kWritingMode.IsLineInverted()) {
// above of top-left corner of aFrame.
- result.mRect.x = 0;
+ result.mRect.MoveToX(0);
} else {
// above of top-right corner of aFrame.
- result.mRect.x = aFrame->GetRect().XMost() - result.mRect.width;
+ result.mRect.MoveToX(aFrame->GetRect().XMost() - result.mRect.Width());
}
result.mRect.y = -aFrame->PresContext()->AppUnitsPerDevPixel();
} else {
// left of top-left corner of aFrame.
- result.mRect.x = -aFrame->PresContext()->AppUnitsPerDevPixel();
- result.mRect.y = 0;
+ result.mRect.MoveTo(-aFrame->PresContext()->AppUnitsPerDevPixel(), 0);
}
}
return result;
}
ContentEventHandler::FrameRelativeRect
ContentEventHandler::GuessLineBreakerRectAfter(nsIContent* aTextContent)
{
@@ -1889,22 +1888,22 @@ ContentEventHandler::GuessLineBreakerRec
nsIFrame* lastTextFrame = nullptr;
nsresult rv = GetFrameForTextRect(aTextContent, length, true, &lastTextFrame);
if (NS_WARN_IF(NS_FAILED(rv)) || NS_WARN_IF(!lastTextFrame)) {
return result;
}
const nsRect kLastTextFrameRect = lastTextFrame->GetRect();
if (lastTextFrame->GetWritingMode().IsVertical()) {
// Below of the last text frame.
- result.mRect.SetRect(0, kLastTextFrameRect.height,
- kLastTextFrameRect.width, 0);
+ result.mRect.SetRect(0, kLastTextFrameRect.Height(),
+ kLastTextFrameRect.Width(), 0);
} else {
// Right of the last text frame (not bidi-aware).
- result.mRect.SetRect(kLastTextFrameRect.width, 0,
- 0, kLastTextFrameRect.height);
+ result.mRect.SetRect(kLastTextFrameRect.Width(), 0,
+ 0, kLastTextFrameRect.Height());
}
result.mBaseFrame = lastTextFrame;
return result;
}
ContentEventHandler::FrameRelativeRect
ContentEventHandler::GuessFirstCaretRectIn(nsIFrame* aFrame)
{
@@ -1917,39 +1916,39 @@ ContentEventHandler::GuessFirstCaretRect
RefPtr<nsFontMetrics> fontMetrics =
nsLayoutUtils::GetInflatedFontMetricsForFrame(aFrame);
const nscoord kMaxHeight =
fontMetrics ? fontMetrics->MaxHeight() :
16 * presContext->AppUnitsPerDevPixel();
nsRect caretRect;
const nsRect kContentRect = aFrame->GetContentRect() - aFrame->GetPosition();
- caretRect.y = kContentRect.y;
+ caretRect.MoveToY(kContentRect.Y());
if (!kWritingMode.IsVertical()) {
if (kWritingMode.IsBidiLTR()) {
- caretRect.x = kContentRect.x;
+ caretRect.MoveToX(kContentRect.X());
} else {
// Move 1px left for the space of caret itself.
const nscoord kOnePixel = presContext->AppUnitsPerDevPixel();
- caretRect.x = kContentRect.XMost() - kOnePixel;
+ caretRect.MoveToX(kContentRect.XMost() - kOnePixel);
}
- caretRect.height = kMaxHeight;
+ caretRect.SetHeight(kMaxHeight);
// However, don't add kOnePixel here because it may cause 2px width at
// aligning the edge to device pixels.
- caretRect.width = 1;
+ caretRect.SetWidth(1);
} else {
if (kWritingMode.IsVerticalLR()) {
- caretRect.x = kContentRect.x;
+ caretRect.MoveToX(kContentRect.X());
} else {
- caretRect.x = kContentRect.XMost() - kMaxHeight;
+ caretRect.MoveToX(kContentRect.XMost() - kMaxHeight);
}
- caretRect.width = kMaxHeight;
+ caretRect.SetWidth(kMaxHeight);
// Don't add app units for a device pixel because it may cause 2px height
// at aligning the edge to device pixels.
- caretRect.height = 1;
+ caretRect.SetHeight(1);
}
return FrameRelativeRect(caretRect, aFrame);
}
nsresult
ContentEventHandler::OnQueryTextRectArray(WidgetQueryContentEvent* aEvent)
{
nsresult rv = Init(aEvent);
@@ -2094,22 +2093,20 @@ ContentEventHandler::OnQueryTextRectArra
// use this path if it's a <br> frame because trusting <br> frame's rect
// is better than guessing the rect from the previous character.)
if (!firstFrame->IsBrFrame() && aEvent->mInput.mOffset != offset) {
baseFrame = lastFrame;
brRect = lastCharRect;
if (!wasLineBreaker) {
if (isVertical) {
// Right of the last character.
- brRect.y = brRect.YMost() + 1;
- brRect.height = 1;
+ brRect.SetRectY(brRect.YMost() + 1, 1);
} else {
// Under the last character.
- brRect.x = brRect.XMost() + 1;
- brRect.width = 1;
+ brRect.SetRectX(brRect.XMost() + 1, 1);
}
}
}
// If it's not a <br> frame and it's the first character rect at the
// queried range, we need to the previous character of the start of
// the queried range if there is a text node.
else if (!firstFrame->IsBrFrame() && lastTextContent) {
FrameRelativeRect brRectRelativeToLastTextFrame =
@@ -2226,23 +2223,21 @@ ContentEventHandler::OnQueryTextRectArra
// means that the offset is too large or the query range is collapsed.
if (offset < kEndOffset || aEvent->mReply.mRectArray.IsEmpty()) {
// If we've already retrieved some character rects before current offset,
// we can guess the last rect from the last character's rect unless it's a
// line breaker. (If it's a line breaker, the caret rect is in next line.)
if (!aEvent->mReply.mRectArray.IsEmpty() && !wasLineBreaker) {
rect = aEvent->mReply.mRectArray.LastElement();
if (isVertical) {
- rect.y = rect.YMost() + 1;
- rect.height = 1;
- MOZ_ASSERT(rect.width);
+ rect.SetRectY(rect.YMost() + 1, 1);
+ MOZ_ASSERT(rect.Width());
} else {
- rect.x = rect.XMost() + 1;
- rect.width = 1;
- MOZ_ASSERT(rect.height);
+ rect.SetRectX(rect.XMost() + 1, 1);
+ MOZ_ASSERT(rect.Height());
}
aEvent->mReply.mRectArray.AppendElement(rect);
} else {
// Note that don't use eQueryCaretRect here because if caret is at the
// end of the content, it returns actual caret rect instead of computing
// the rect itself. It means that the result depends on caret position.
// So, we shouldn't use it for consistency result in automated tests.
WidgetQueryContentEvent queryTextRect(eQueryTextRect, *aEvent);
@@ -2252,19 +2247,19 @@ ContentEventHandler::OnQueryTextRectArra
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
if (NS_WARN_IF(!queryTextRect.mSucceeded)) {
return NS_ERROR_FAILURE;
}
MOZ_ASSERT(!queryTextRect.mReply.mRect.IsEmpty());
if (queryTextRect.mReply.mWritingMode.IsVertical()) {
- queryTextRect.mReply.mRect.height = 1;
+ queryTextRect.mReply.mRect.SetHeight(1);
} else {
- queryTextRect.mReply.mRect.width = 1;
+ queryTextRect.mReply.mRect.SetWidth(1);
}
aEvent->mReply.mRectArray.AppendElement(queryTextRect.mReply.mRect);
}
}
aEvent->mSucceeded = true;
return NS_OK;
}
@@ -2398,21 +2393,19 @@ ContentEventHandler::OnQueryTextRect(Wid
rv = ConvertToRootRelativeOffset(firstFrame, rect);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
frameRect = rect;
// Exclude the rect before start point of the queried range.
firstFrame->GetPointFromOffset(firstFrame.mOffsetInNode, &ptOffset);
if (firstFrame->GetWritingMode().IsVertical()) {
- rect.y += ptOffset.y;
- rect.height -= ptOffset.y;
+ rect.SetTopEdge(rect.Y() + ptOffset.y);
} else {
- rect.x += ptOffset.x;
- rect.width -= ptOffset.x;
+ rect.SetLeftEdge(rect.X() + ptOffset.x);
}
}
// If first frame causes a line breaker but it's not a <br> frame, we cannot
// compute proper rect only with the frame because typically caret is at
// right of the last character of it. For example, if caret is after "c" of
// |<p>abc</p><p>def</p>|, IME may query a line breaker's rect after "c".
// Then, if we compute it only with the 2nd <p>'s block frame, the result
// will be:
@@ -2542,19 +2535,19 @@ ContentEventHandler::OnQueryTextRect(Wid
return rv;
}
}
// Shrink the last frame for cutting off the text after the query range.
if (lastFrame->IsTextFrame()) {
lastFrame->GetPointFromOffset(lastFrame.mOffsetInNode, &ptOffset);
if (lastFrame->GetWritingMode().IsVertical()) {
- frameRect.height -= lastFrame->GetRect().height - ptOffset.y;
+ frameRect.SetHeight(frameRect.Height() - lastFrame->GetRect().Height() + ptOffset.y);
} else {
- frameRect.width -= lastFrame->GetRect().width - ptOffset.x;
+ frameRect.SetWidth(frameRect.Width() - lastFrame->GetRect().Width() + ptOffset.x);
}
// UnionRect() requires non-empty rect. So, let's make sure to get
// non-empty rect from the last frame.
EnsureNonEmptyRect(frameRect);
if (firstFrame.mFrame == lastFrame.mFrame) {
rect.IntersectRect(rect, frameRect);
} else {
@@ -2629,19 +2622,19 @@ ContentEventHandler::OnQueryCaretRect(Wi
queryTextRectEvent.InitForQueryTextRect(aEvent->mInput.mOffset, 1, options);
rv = OnQueryTextRect(&queryTextRectEvent);
if (NS_WARN_IF(NS_FAILED(rv)) || NS_WARN_IF(!queryTextRectEvent.mSucceeded)) {
return NS_ERROR_FAILURE;
}
queryTextRectEvent.mReply.mString.Truncate();
aEvent->mReply = queryTextRectEvent.mReply;
if (aEvent->GetWritingMode().IsVertical()) {
- aEvent->mReply.mRect.height = 1;
+ aEvent->mReply.mRect.SetHeight(1);
} else {
- aEvent->mReply.mRect.width = 1;
+ aEvent->mReply.mRect.SetWidth(1);
}
// Returning empty rect may cause native IME confused, let's make sure to
// return non-empty rect.
aEvent->mSucceeded = true;
return NS_OK;
}
nsresult
@@ -2808,18 +2801,19 @@ ContentEventHandler::OnQueryDOMWidgetHit
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
nsIFrame* docFrame = shell->GetRootFrame();
NS_ENSURE_TRUE(docFrame, NS_ERROR_FAILURE);
LayoutDeviceIntPoint eventLoc =
aEvent->mRefPoint + aEvent->mWidget->WidgetToScreenOffset();
CSSIntRect docFrameRect = docFrame->GetScreenRect();
CSSIntPoint eventLocCSS(
- docFrame->PresContext()->DevPixelsToIntCSSPixels(eventLoc.x) - docFrameRect.x,
- docFrame->PresContext()->DevPixelsToIntCSSPixels(eventLoc.y) - docFrameRect.y);
+ docFrame->PresContext()->DevPixelsToIntCSSPixels(eventLoc.x) - docFrameRect.X(),
+ docFrame->PresContext()->DevPixelsToIntCSSPixels(eventLoc.y) - docFrameRect.Y()
+ );
Element* contentUnderMouse =
mDocument->ElementFromPointHelper(eventLocCSS.x, eventLocCSS.y, false, false);
if (contentUnderMouse) {
nsIWidget* targetWidget = nullptr;
nsIFrame* targetFrame = contentUnderMouse->GetPrimaryFrame();
nsIObjectFrame* pluginFrame = do_QueryFrame(targetFrame);
if (pluginFrame) {
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -2894,28 +2894,28 @@ EventStateManager::DecideGestureEvent(Wi
#endif
nsIScrollableFrame* scrollableFrame = do_QueryFrame(current);
if (scrollableFrame) {
if (current->IsFrameOfType(nsIFrame::eXULBox)) {
displayPanFeedback = true;
nsRect scrollRange = scrollableFrame->GetScrollRange();
- bool canScrollHorizontally = scrollRange.width > 0;
+ bool canScrollHorizontally = scrollRange.Width() > 0;
if (targetFrame->IsMenuFrame()) {
// menu frames report horizontal scroll when they have submenus
// and we don't want that
canScrollHorizontally = false;
displayPanFeedback = false;
}
// Vertical panning has priority over horizontal panning, so
// when vertical movement is possible we can just finish the loop.
- if (scrollRange.height > 0) {
+ if (scrollRange.Height() > 0) {
panDirection = WidgetGestureNotifyEvent::ePanVertical;
break;
}
if (canScrollHorizontally) {
panDirection = WidgetGestureNotifyEvent::ePanHorizontal;
displayPanFeedback = false;
}
@@ -4379,18 +4379,18 @@ EventStateManager::NotifyMouseOver(Widge
// refpoint is in. It may not be the exact center of the window if
// the platform requires rounding the coordinate.
static LayoutDeviceIntPoint
GetWindowClientRectCenter(nsIWidget* aWidget)
{
NS_ENSURE_TRUE(aWidget, LayoutDeviceIntPoint(0, 0));
LayoutDeviceIntRect rect = aWidget->GetClientBounds();
- LayoutDeviceIntPoint point(rect.x + rect.width / 2,
- rect.y + rect.height / 2);
+ LayoutDeviceIntPoint point(rect.X() + rect.Width() / 2,
+ rect.Y() + rect.Height() / 2);
int32_t round = aWidget->RoundsWidgetCoordinatesTo();
point.x = point.x / round * round;
point.y = point.y / round * round;
return point - aWidget->WidgetToScreenOffset();
}
void
EventStateManager::GeneratePointerEnterExit(EventMessage aMessage,
--- a/dom/events/WheelHandlingHelper.cpp
+++ b/dom/events/WheelHandlingHelper.cpp
@@ -68,20 +68,20 @@ WheelHandlingUtils::CanScrollOn(nsIScrol
NS_ASSERTION(aDirectionX || aDirectionY,
"One of the delta values must be non-zero at least");
nsPoint scrollPt = aScrollFrame->GetScrollPosition();
nsRect scrollRange = aScrollFrame->GetScrollRange();
uint32_t directions = aScrollFrame->GetPerceivedScrollingDirections();
return (aDirectionX && (directions & nsIScrollableFrame::HORIZONTAL) &&
- CanScrollInRange(scrollRange.x, scrollPt.x,
+ CanScrollInRange(scrollRange.X(), scrollPt.x,
scrollRange.XMost(), aDirectionX)) ||
(aDirectionY && (directions & nsIScrollableFrame::VERTICAL) &&
- CanScrollInRange(scrollRange.y, scrollPt.y,
+ CanScrollInRange(scrollRange.Y(), scrollPt.y,
scrollRange.YMost(), aDirectionY));
}
/*static*/ Maybe<layers::ScrollDirection>
WheelHandlingUtils::GetDisregardedWheelScrollDirection(const nsIFrame* aFrame)
{
nsIContent* content = aFrame->GetContent();
if (!content) {
--- a/dom/html/HTMLCanvasElement.cpp
+++ b/dom/html/HTMLCanvasElement.cpp
@@ -612,18 +612,18 @@ nsresult HTMLCanvasElement::GetEventTarg
WidgetMouseEventBase* evt = (WidgetMouseEventBase*)aVisitor.mEvent;
if (mCurrentContext) {
nsIFrame *frame = GetPrimaryFrame();
if (!frame)
return NS_OK;
nsPoint ptInRoot = nsLayoutUtils::GetEventCoordinatesRelativeTo(evt, frame);
nsRect paddingRect = frame->GetContentRectRelativeToSelf();
Point hitpoint;
- hitpoint.x = (ptInRoot.x - paddingRect.x) / AppUnitsPerCSSPixel();
- hitpoint.y = (ptInRoot.y - paddingRect.y) / AppUnitsPerCSSPixel();
+ hitpoint.x = (ptInRoot.x - paddingRect.X()) / AppUnitsPerCSSPixel();
+ hitpoint.y = (ptInRoot.y - paddingRect.Y()) / AppUnitsPerCSSPixel();
evt->region = mCurrentContext->GetHitRegion(hitpoint);
aVisitor.mCanHandle = true;
}
}
return nsGenericHTMLElement::GetEventTargetParent(aVisitor);
}
--- a/dom/html/ImageDocument.cpp
+++ b/dom/html/ImageDocument.cpp
@@ -430,18 +430,18 @@ ImageDocument::ScrollImageTo(int32_t aX,
float ratio = GetRatio();
// Don't try to scroll image if the document is not visible (mVisibleWidth or
// mVisibleHeight is zero).
if (ratio <= 0.0) {
return;
}
nsRect portRect = sf->GetScrollPortRect();
- sf->ScrollTo(nsPoint(nsPresContext::CSSPixelsToAppUnits(aX/ratio) - portRect.width/2,
- nsPresContext::CSSPixelsToAppUnits(aY/ratio) - portRect.height/2),
+ sf->ScrollTo(nsPoint(nsPresContext::CSSPixelsToAppUnits(aX/ratio) - portRect.Width()/2,
+ nsPresContext::CSSPixelsToAppUnits(aY/ratio) - portRect.Height()/2),
nsIScrollableFrame::INSTANT);
}
void
ImageDocument::RestoreImage()
{
if (!mImageContent) {
return;
@@ -732,18 +732,18 @@ ImageDocument::CheckOverflowing(bool cha
{
nsPresContext* context = GetPresContext();
if (!context) {
return NS_OK;
}
nsRect visibleArea = context->GetVisibleArea();
- mVisibleWidth = nsPresContext::AppUnitsToFloatCSSPixels(visibleArea.width);
- mVisibleHeight = nsPresContext::AppUnitsToFloatCSSPixels(visibleArea.height);
+ mVisibleWidth = nsPresContext::AppUnitsToFloatCSSPixels(visibleArea.Width());
+ mVisibleHeight = nsPresContext::AppUnitsToFloatCSSPixels(visibleArea.Height());
}
bool imageWasOverflowing = ImageIsOverflowing();
bool imageWasOverflowingVertically = mImageIsOverflowingVertically;
mImageIsOverflowingHorizontally = mImageWidth > mVisibleWidth;
mImageIsOverflowingVertically = mImageHeight > mVisibleHeight;
bool windowBecameBigEnough = imageWasOverflowing && !ImageIsOverflowing();
bool verticalOverflowChanged =
--- a/dom/html/nsGenericHTMLElement.h
+++ b/dom/html/nsGenericHTMLElement.h
@@ -209,24 +209,24 @@ public:
mozilla::CSSIntRect rcFrame;
return GetOffsetRect(rcFrame);
}
int32_t OffsetTop()
{
mozilla::CSSIntRect rcFrame;
GetOffsetRect(rcFrame);
- return rcFrame.y;
+ return rcFrame.Y();
}
int32_t OffsetLeft()
{
mozilla::CSSIntRect rcFrame;
GetOffsetRect(rcFrame);
- return rcFrame.x;
+ return rcFrame.X();
}
int32_t OffsetWidth()
{
mozilla::CSSIntRect rcFrame;
GetOffsetRect(rcFrame);
return rcFrame.Width();
}
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -899,26 +899,26 @@ TabChild::SetDimensions(uint32_t aFlags,
}
NS_IMETHODIMP
TabChild::GetDimensions(uint32_t aFlags, int32_t* aX,
int32_t* aY, int32_t* aCx, int32_t* aCy)
{
ScreenIntRect rect = GetOuterRect();
if (aX) {
- *aX = rect.x;
+ *aX = rect.X();
}
if (aY) {
- *aY = rect.y;
+ *aY = rect.Y();
}
if (aCx) {
- *aCx = rect.width;
+ *aCx = rect.Width();
}
if (aCy) {
- *aCy = rect.height;
+ *aCy = rect.Height();
}
return NS_OK;
}
NS_IMETHODIMP
TabChild::SetFocus()
{
@@ -1310,18 +1310,18 @@ TabChild::RecvUpdateDimensions(const Dim
// Set the size on the document viewer before we update the widget and
// trigger a reflow. Otherwise the MobileViewportManager reads the stale
// size from the content viewer when it computes a new CSS viewport.
nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(WebNavigation());
baseWin->SetPositionAndSize(0, 0, screenSize.width, screenSize.height,
nsIBaseWindow::eRepaint);
- mPuppetWidget->Resize(screenRect.x + mClientOffset.x + mChromeOffset.x,
- screenRect.y + mClientOffset.y + mChromeOffset.y,
+ mPuppetWidget->Resize(screenRect.X() + mClientOffset.x + mChromeOffset.x,
+ screenRect.Y() + mClientOffset.y + mChromeOffset.y,
screenSize.width, screenSize.height, true);
return IPC_OK();
}
mozilla::ipc::IPCResult
TabChild::RecvSizeModeChanged(const nsSizeMode& aSizeMode)
{
@@ -3273,18 +3273,18 @@ TabChild::RecvUIResolutionChanged(const
RefPtr<nsPresContext> presContext = document->GetPresContext();
if (presContext) {
presContext->UIResolutionChangedSync();
}
ScreenIntSize screenSize = GetInnerSize();
if (mHasValidInnerSize && oldScreenSize != screenSize) {
ScreenIntRect screenRect = GetOuterRect();
- mPuppetWidget->Resize(screenRect.x + mClientOffset.x + mChromeOffset.x,
- screenRect.y + mClientOffset.y + mChromeOffset.y,
+ mPuppetWidget->Resize(screenRect.X() + mClientOffset.x + mChromeOffset.x,
+ screenRect.Y() + mClientOffset.y + mChromeOffset.y,
screenSize.width, screenSize.height, true);
nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(WebNavigation());
baseWin->SetPositionAndSize(0, 0, screenSize.width, screenSize.height,
nsIBaseWindow::eRepaint);
}
return IPC_OK();
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -3332,21 +3332,21 @@ TabParent::RecvInvokeDragSession(nsTArra
do_GetService("@mozilla.org/widget/dragservice;1");
if (dragService) {
dragService->MaybeAddChildProcess(Manager()->AsContentParent());
}
}
if (aVisualDnDData.type() == OptionalShmem::Tvoid_t ||
!aVisualDnDData.get_Shmem().IsReadable() ||
- aVisualDnDData.get_Shmem().Size<char>() < aDragRect.height * aStride) {
+ aVisualDnDData.get_Shmem().Size<char>() < aDragRect.Height() * aStride) {
mDnDVisualization = nullptr;
} else {
mDnDVisualization =
- gfx::CreateDataSourceSurfaceFromData(gfx::IntSize(aDragRect.width, aDragRect.height),
+ gfx::CreateDataSourceSurfaceFromData(gfx::IntSize(aDragRect.Width(), aDragRect.Height()),
static_cast<gfx::SurfaceFormat>(aFormat),
aVisualDnDData.get_Shmem().get<uint8_t>(),
aStride);
}
mDragValid = true;
mDragRect = aDragRect;
mDragPrincipalURISpec = aPrincipalURISpec;
--- a/dom/media/MediaData.cpp
+++ b/dom/media/MediaData.cpp
@@ -118,32 +118,32 @@ static bool ValidateBufferAndPicture(con
// in the decoder
if (aBuffer.mPlanes[1].mWidth != aBuffer.mPlanes[2].mWidth ||
aBuffer.mPlanes[1].mHeight != aBuffer.mPlanes[2].mHeight) {
NS_ERROR("C planes with different sizes");
return false;
}
// The following situations could be triggered by invalid input
- if (aPicture.width <= 0 || aPicture.height <= 0) {
+ if (aPicture.Width() <= 0 || aPicture.Height() <= 0) {
// In debug mode, makes the error more noticeable
MOZ_ASSERT(false, "Empty picture rect");
return false;
}
if (!ValidatePlane(aBuffer.mPlanes[0]) ||
!ValidatePlane(aBuffer.mPlanes[1]) ||
!ValidatePlane(aBuffer.mPlanes[2])) {
NS_WARNING("Invalid plane size");
return false;
}
// Ensure the picture size specified in the headers can be extracted out of
// the frame we've been supplied without indexing out of bounds.
- CheckedUint32 xLimit = aPicture.x + CheckedUint32(aPicture.width);
- CheckedUint32 yLimit = aPicture.y + CheckedUint32(aPicture.height);
+ CheckedUint32 xLimit = aPicture.X() + CheckedUint32(aPicture.Width());
+ CheckedUint32 yLimit = aPicture.Y() + CheckedUint32(aPicture.Height());
if (!xLimit.isValid() || xLimit.value() > aBuffer.mPlanes[0].mStride ||
!yLimit.isValid() || yLimit.value() > aBuffer.mPlanes[0].mHeight) {
// The specified picture dimensions can't be contained inside the video
// frame, we'll stomp memory if we try to copy it. Fail.
NS_WARNING("Overflowing picture rect");
return false;
}
return true;
@@ -244,18 +244,18 @@ ConstructPlanarYCbCrData(const VideoInfo
data.mYStride = Y.mStride;
data.mYSkip = Y.mSkip;
data.mCbChannel = Cb.mData + Cb.mOffset;
data.mCrChannel = Cr.mData + Cr.mOffset;
data.mCbCrSize = IntSize(Cb.mWidth, Cb.mHeight);
data.mCbCrStride = Cb.mStride;
data.mCbSkip = Cb.mSkip;
data.mCrSkip = Cr.mSkip;
- data.mPicX = aPicture.x;
- data.mPicY = aPicture.y;
+ data.mPicX = aPicture.X();
+ data.mPicY = aPicture.Y();
data.mPicSize = aPicture.Size();
data.mStereoMode = aInfo.mStereoMode;
data.mYUVColorSpace = aBuffer.mYUVColorSpace;
data.mBitDepth = aBuffer.mBitDepth;
return data;
}
/* static */ bool
--- a/dom/media/MediaInfo.h
+++ b/dom/media/MediaInfo.h
@@ -292,21 +292,19 @@ public:
}
gfx::IntRect imageRect = ImageRect();
int64_t w = (aWidth * imageRect.Width()) / mImage.width;
int64_t h = (aHeight * imageRect.Height()) / mImage.height;
if (!w || !h) {
return imageRect;
}
-
- imageRect.x = (imageRect.x * aWidth) / mImage.width;
- imageRect.y = (imageRect.y * aHeight) / mImage.height;
- imageRect.SetWidth(w);
- imageRect.SetHeight(h);
+ imageRect.SetRect(imageRect.X() * aWidth / mImage.width,
+ imageRect.Y() * aHeight / mImage.height,
+ w, h);
return imageRect;
}
Rotation ToSupportedRotation(int32_t aDegree) const
{
switch (aDegree) {
case 90:
return kDegree_90;
--- a/dom/media/VideoUtils.cpp
+++ b/dom/media/VideoUtils.cpp
@@ -177,24 +177,24 @@ IsValidVideoRegion(const gfx::IntSize& a
const gfx::IntRect& aPicture,
const gfx::IntSize& aDisplay)
{
return
aFrame.width <= PlanarYCbCrImage::MAX_DIMENSION &&
aFrame.height <= PlanarYCbCrImage::MAX_DIMENSION &&
aFrame.width * aFrame.height <= MAX_VIDEO_WIDTH * MAX_VIDEO_HEIGHT &&
aFrame.width * aFrame.height != 0 &&
- aPicture.width <= PlanarYCbCrImage::MAX_DIMENSION &&
- aPicture.x < PlanarYCbCrImage::MAX_DIMENSION &&
- aPicture.x + aPicture.width < PlanarYCbCrImage::MAX_DIMENSION &&
- aPicture.height <= PlanarYCbCrImage::MAX_DIMENSION &&
- aPicture.y < PlanarYCbCrImage::MAX_DIMENSION &&
- aPicture.y + aPicture.height < PlanarYCbCrImage::MAX_DIMENSION &&
- aPicture.width * aPicture.height <= MAX_VIDEO_WIDTH * MAX_VIDEO_HEIGHT &&
- aPicture.width * aPicture.height != 0 &&
+ aPicture.Width() <= PlanarYCbCrImage::MAX_DIMENSION &&
+ aPicture.X() < PlanarYCbCrImage::MAX_DIMENSION &&
+ aPicture.XMost() < PlanarYCbCrImage::MAX_DIMENSION &&
+ aPicture.Height() <= PlanarYCbCrImage::MAX_DIMENSION &&
+ aPicture.Y() < PlanarYCbCrImage::MAX_DIMENSION &&
+ aPicture.YMost() < PlanarYCbCrImage::MAX_DIMENSION &&
+ aPicture.Width() * aPicture.Height() <= MAX_VIDEO_WIDTH * MAX_VIDEO_HEIGHT &&
+ !aPicture.IsZeroArea()&&
aDisplay.width <= PlanarYCbCrImage::MAX_DIMENSION &&
aDisplay.height <= PlanarYCbCrImage::MAX_DIMENSION &&
aDisplay.width * aDisplay.height <= MAX_VIDEO_WIDTH * MAX_VIDEO_HEIGHT &&
aDisplay.width * aDisplay.height != 0;
}
already_AddRefed<SharedThreadPool> GetMediaThreadPool(MediaThreadType aType)
{
--- a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp
+++ b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp
@@ -646,18 +646,18 @@ WMFVideoMFTManager::InitInternal()
{
// The H264 SanityTest uses a 132x132 videos to determine if DXVA can be used.
// so we want to use the software decoder for videos with lower resolutions.
static const int MIN_H264_HW_WIDTH = 132;
static const int MIN_H264_HW_HEIGHT = 132;
mUseHwAccel = false; // default value; changed if D3D setup succeeds.
bool useDxva = (mStreamType != H264 ||
- (mVideoInfo.ImageRect().width > MIN_H264_HW_WIDTH &&
- mVideoInfo.ImageRect().height > MIN_H264_HW_HEIGHT)) &&
+ (mVideoInfo.ImageRect().Width() > MIN_H264_HW_WIDTH &&
+ mVideoInfo.ImageRect().Height() > MIN_H264_HW_HEIGHT)) &&
InitializeDXVA();
RefPtr<MFTDecoder> decoder;
HRESULT hr;
if (mStreamType == VP9 && useDxva && mCheckForAMDDecoder &&
gfxPrefs::PDMWMFAMDVP9DecoderEnabled()) {
if ((decoder = LoadAMDVP9Decoder())) {
@@ -740,33 +740,33 @@ WMFVideoMFTManager::InitInternal()
// re-do initialization.
return InitInternal();
}
LOG("Video Decoder initialized, Using DXVA: %s",
(mUseHwAccel ? "Yes" : "No"));
if (mDXVA2Manager) {
- hr = mDXVA2Manager->ConfigureForSize(mVideoInfo.ImageRect().width,
- mVideoInfo.ImageRect().height);
+ hr = mDXVA2Manager->ConfigureForSize(mVideoInfo.ImageRect().Width(),
+ mVideoInfo.ImageRect().Height());
NS_ENSURE_TRUE(SUCCEEDED(hr),
MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
RESULT_DETAIL("Fail to configure image size for "
"DXVA2Manager.")));
} else {
mYUVColorSpace = GetYUVColorSpace(outputType);
- GetDefaultStride(outputType, mVideoInfo.ImageRect().width, &mVideoStride);
+ GetDefaultStride(outputType, mVideoInfo.ImageRect().Width(), &mVideoStride);
}
LOG("WMFVideoMFTManager frame geometry stride=%u picture=(%d, %d, %d, %d) "
"display=(%d,%d)",
mVideoStride,
- mVideoInfo.ImageRect().x,
- mVideoInfo.ImageRect().y,
- mVideoInfo.ImageRect().width,
- mVideoInfo.ImageRect().height,
+ mVideoInfo.ImageRect().X(),
+ mVideoInfo.ImageRect().Y(),
+ mVideoInfo.ImageRect().Width(),
+ mVideoInfo.ImageRect().Height(),
mVideoInfo.mDisplay.width,
mVideoInfo.mDisplay.height);
if (!mUseHwAccel) {
RefPtr<ID3D11Device> device =
gfx::DeviceManagerDx::Get()->GetCompositorDevice();
if (!device) {
device = gfx::DeviceManagerDx::Get()->GetContentDevice();
@@ -802,31 +802,31 @@ WMFVideoMFTManager::SetDecoderMediaTypes
MFVideoInterlace_MixedInterlaceOrProgressive);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
hr = inputType->SetUINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
hr = MFSetAttributeSize(inputType,
MF_MT_FRAME_SIZE,
- mVideoInfo.ImageRect().width,
- mVideoInfo.ImageRect().height);
+ mVideoInfo.ImageRect().Width(),
+ mVideoInfo.ImageRect().Height());
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
RefPtr<IMFMediaType> outputType;
hr = wmf::MFCreateMediaType(getter_AddRefs(outputType));
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
hr = outputType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
hr = MFSetAttributeSize(outputType,
MF_MT_FRAME_SIZE,
- mVideoInfo.ImageRect().width,
- mVideoInfo.ImageRect().height);
+ mVideoInfo.ImageRect().Width(),
+ mVideoInfo.ImageRect().Height());
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
GUID outputSubType = mUseHwAccel ? MFVideoFormat_NV12 : MFVideoFormat_YV12;
hr = outputType->SetGUID(MF_MT_SUBTYPE, outputSubType);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
return mDecoder->SetMediaTypes(inputType, outputType);
}
@@ -1131,17 +1131,17 @@ WMFVideoMFTManager::Output(int64_t aStre
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
if (!mUseHwAccel) {
// The stride may have changed, recheck for it.
RefPtr<IMFMediaType> outputType;
hr = mDecoder->GetOutputMediaType(outputType);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
mYUVColorSpace = GetYUVColorSpace(outputType);
- hr = GetDefaultStride(outputType, mVideoInfo.ImageRect().width,
+ hr = GetDefaultStride(outputType, mVideoInfo.ImageRect().Width(),
&mVideoStride);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
}
// Catch infinite loops, but some decoders perform at least 2 stream
// changes on consecutive calls, so be permissive.
// 100 is arbitrarily > 2.
NS_ENSURE_TRUE(typeChangeCount < 100, MF_E_TRANSFORM_STREAM_CHANGE);
// Loop back and try decoding again...
--- a/dom/media/webm/WebMDemuxer.cpp
+++ b/dom/media/webm/WebMDemuxer.cpp
@@ -344,24 +344,20 @@ WebMDemuxer::ReadMetadata()
unsigned int cropH = params.crop_right + params.crop_left;
unsigned int cropV = params.crop_bottom + params.crop_top;
gfx::IntRect pictureRect(params.crop_left,
params.crop_top,
params.width - cropH,
params.height - cropV);
// If the cropping data appears invalid then use the frame data
- if (pictureRect.width <= 0 ||
- pictureRect.height <= 0 ||
- pictureRect.x < 0 ||
- pictureRect.y < 0) {
- pictureRect.x = 0;
- pictureRect.y = 0;
- pictureRect.width = params.width;
- pictureRect.height = params.height;
+ if (pictureRect.IsEmpty() ||
+ pictureRect.X() < 0 ||
+ pictureRect.Y() < 0) {
+ pictureRect.SetRect(0, 0, params.width, params.height);
}
// Validate the container-reported frame and pictureRect sizes. This
// ensures that our video frame creation code doesn't overflow.
gfx::IntSize displaySize(params.display_width, params.display_height);
gfx::IntSize frameSize(params.width, params.height);
if (!IsValidVideoRegion(frameSize, pictureRect, displaySize)) {
// Video track's frame sizes will overflow. Ignore the video track.
--- a/dom/plugins/ipc/PluginInstanceChild.cpp
+++ b/dom/plugins/ipc/PluginInstanceChild.cpp
@@ -2083,20 +2083,20 @@ PluginInstanceChild::ImmSetCandidateWind
return FALSE;
}
CandidateWindowPosition position;
position.mPoint.x = aForm->ptCurrentPos.x;
position.mPoint.y = aForm->ptCurrentPos.y;
position.mExcludeRect = !!(aForm->dwStyle & CFS_EXCLUDE);
if (position.mExcludeRect) {
- position.mRect.x = aForm->rcArea.left;
- position.mRect.y = aForm->rcArea.top;
- position.mRect.width = aForm->rcArea.right - aForm->rcArea.left;
- position.mRect.height = aForm->rcArea.bottom - aForm->rcArea.top;
+ position.mRect.SetRect(aForm->rcArea.left,
+ aForm->rcArea.top,
+ aForm->rcArea.right - aForm->rcArea.left,
+ aForm->rcArea.bottom - aForm->rcArea.top);
}
sCurrentPluginInstance->SendSetCandidateWindow(position);
return TRUE;
}
// static
BOOL
@@ -3347,37 +3347,37 @@ PluginInstanceChild::PaintRectToPlatform
NS_ASSERTION(aSurface->GetType() == gfxSurfaceType::Xlib,
"Non supported platform surface type");
NPEvent pluginEvent;
XGraphicsExposeEvent& exposeEvent = pluginEvent.xgraphicsexpose;
exposeEvent.type = GraphicsExpose;
exposeEvent.display = mWsInfo.display;
exposeEvent.drawable = static_cast<gfxXlibSurface*>(aSurface)->XDrawable();
- exposeEvent.x = aRect.x;
- exposeEvent.y = aRect.y;
- exposeEvent.width = aRect.width;
- exposeEvent.height = aRect.height;
+ exposeEvent.x = aRect.X();
+ exposeEvent.y = aRect.Y();
+ exposeEvent.width = aRect.Width();
+ exposeEvent.height = aRect.Height();
exposeEvent.count = 0;
// information not set:
exposeEvent.serial = 0;
exposeEvent.send_event = False;
exposeEvent.major_code = 0;
exposeEvent.minor_code = 0;
mPluginIface->event(&mData, reinterpret_cast<void*>(&exposeEvent));
}
#elif defined(XP_WIN)
NS_ASSERTION(SharedDIBSurface::IsSharedDIBSurface(aSurface),
"Expected (SharedDIB) image surface.");
// This rect is in the window coordinate space. aRect is in the plugin
// coordinate space.
RECT rect = {
- mWindow.x + aRect.x,
- mWindow.y + aRect.y,
+ mWindow.x + aRect.X(),
+ mWindow.y + aRect.Y(),
mWindow.x + aRect.XMost(),
mWindow.y + aRect.YMost()
};
NPEvent paintEvent = {
WM_PAINT,
uintptr_t(mWindow.window),
intptr_t(&rect)
};
@@ -3410,18 +3410,18 @@ PluginInstanceChild::PaintRectToSurface(
if (mHelperSurface) {
// On X11 we can paint to non Xlib surface only with HelperSurface
renderSurface = mHelperSurface;
}
#endif
if (mIsTransparent && !CanPaintOnBackground()) {
RefPtr<DrawTarget> dt = CreateDrawTargetForSurface(renderSurface);
- gfx::Rect rect(plPaintRect.x, plPaintRect.y,
- plPaintRect.width, plPaintRect.height);
+ gfx::Rect rect(plPaintRect.X(), plPaintRect.Y(),
+ plPaintRect.Width(), plPaintRect.Height());
// Moz2D treats OP_SOURCE operations as unbounded, so we need to
// clip to the rect that we want to fill:
dt->PushClipRect(rect);
dt->FillRect(rect, ColorPattern(aColor), // aColor is already a device color
DrawOptions(1.f, CompositionOp::OP_SOURCE));
dt->PopClip();
dt->Flush();
}
@@ -3483,18 +3483,18 @@ PluginInstanceChild::PaintRectWithAlphaE
rect =
gfxAlphaRecovery::AlignRectForSubimageRecovery(aRect,
surfaceAsImage);
}
}
RefPtr<gfxImageSurface> whiteImage;
RefPtr<gfxImageSurface> blackImage;
- gfxRect targetRect(rect.x, rect.y, rect.width, rect.height);
- IntSize targetSize(rect.width, rect.height);
+ gfxRect targetRect(rect.X(), rect.Y(), rect.Width(), rect.Height());
+ IntSize targetSize(rect.Width(), rect.Height());
gfxPoint deviceOffset = -targetRect.TopLeft();
// We always use a temporary "white image"
whiteImage = new gfxImageSurface(targetSize, SurfaceFormat::X8R8G8B8_UINT32);
if (whiteImage->CairoStatus()) {
return;
}
@@ -3552,17 +3552,17 @@ PluginInstanceChild::PaintRectWithAlphaE
// If we had to use a temporary black surface, copy the pixels
// with alpha back to the target
if (!useSurfaceSubimageForBlack) {
RefPtr<DrawTarget> dt = CreateDrawTargetForSurface(aSurface);
RefPtr<SourceSurface> surface =
gfxPlatform::GetSourceSurfaceForSurface(dt, blackImage);
dt->CopySurface(surface,
- IntRect(0, 0, rect.width, rect.height),
+ IntRect(0, 0, rect.Width(), rect.Height()),
rect.TopLeft());
}
}
bool
PluginInstanceChild::CanPaintOnBackground()
{
return (mBackground &&
@@ -3682,17 +3682,17 @@ PluginInstanceChild::ShowPluginFrame()
rect.SetRect(0, 0, mWindow.width, mWindow.height);
}
bool haveTransparentPixels =
gfxContentType::COLOR_ALPHA == mCurrentSurface->GetContentType();
PLUGIN_LOG_DEBUG(
("[InstanceChild][%p] Painting%s <x=%d,y=%d, w=%d,h=%d> on surface <w=%d,h=%d>",
this, haveTransparentPixels ? " with alpha" : "",
- rect.x, rect.y, rect.width, rect.height,
+ rect.X(), rect.Y(), rect.Width(), rect.Height(),
mCurrentSurface->GetSize().width, mCurrentSurface->GetSize().height));
if (CanPaintOnBackground()) {
PLUGIN_LOG_DEBUG((" (on background)"));
// Source the background pixels ...
{
RefPtr<gfxASurface> surface =
mHelperSurface ? mHelperSurface : mCurrentSurface;
@@ -3740,17 +3740,17 @@ PluginInstanceChild::ShowPluginFrame()
// browser. We may have painted a transparent plugin using
// the opaque-plugin path, which can result in wrong pixels.
// We also don't want to pay the expense of forwarding the
// surface for plugins that might really be invisible.
mAccumulatedInvalidRect.SetRect(0, 0, mWindow.width, mWindow.height);
return true;
}
- NPRect r = { (uint16_t)rect.y, (uint16_t)rect.x,
+ NPRect r = { (uint16_t)rect.Y(), (uint16_t)rect.X(),
(uint16_t)rect.YMost(), (uint16_t)rect.XMost() };
SurfaceDescriptor currSurf;
#ifdef MOZ_X11
if (mCurrentSurface->GetType() == gfxSurfaceType::Xlib) {
gfxXlibSurface *xsurf = static_cast<gfxXlibSurface*>(mCurrentSurface.get());
currSurf = SurfaceDescriptorX11(xsurf);
// Need to sync all pending x-paint requests
// before giving drawable to another process
@@ -3813,18 +3813,18 @@ PluginInstanceChild::ReadbackDifferenceR
if (mCurrentSurface->GetContentType() != mBackSurface->GetContentType())
return false;
if (mSurfaceDifferenceRect.IsEmpty())
return true;
PLUGIN_LOG_DEBUG(
("[InstanceChild][%p] Reading back part of <x=%d,y=%d, w=%d,h=%d>",
- this, mSurfaceDifferenceRect.x, mSurfaceDifferenceRect.y,
- mSurfaceDifferenceRect.width, mSurfaceDifferenceRect.height));
+ this, mSurfaceDifferenceRect.X(), mSurfaceDifferenceRect.Y(),
+ mSurfaceDifferenceRect.Width(), mSurfaceDifferenceRect.Height()));
// Read back previous content
RefPtr<DrawTarget> dt = CreateDrawTargetForSurface(mCurrentSurface);
RefPtr<SourceSurface> source =
gfxPlatform::GetSourceSurfaceForSurface(dt, mBackSurface);
// Subtract from mSurfaceDifferenceRect area which is overlapping with rect
nsIntRegion result;
result.Sub(mSurfaceDifferenceRect, nsIntRegion(rect));
--- a/dom/plugins/ipc/PluginInstanceParent.cpp
+++ b/dom/plugins/ipc/PluginInstanceParent.cpp
@@ -778,17 +778,17 @@ PluginInstanceParent::SetCurrentImage(Im
holder.mFrameID = ++mFrameID;
AutoTArray<ImageContainer::NonOwningImage,1> imageList;
imageList.AppendElement(holder);
mImageContainer->SetCurrentImages(imageList);
// Invalidate our area in the page so the image gets flushed.
gfx::IntRect rect = aImage->GetPictureRect();
- NPRect nprect = {uint16_t(rect.x), uint16_t(rect.y), uint16_t(rect.width), uint16_t(rect.height)};
+ NPRect nprect = {uint16_t(rect.X()), uint16_t(rect.Y()), uint16_t(rect.Width()), uint16_t(rect.Height())};
RecvNPN_InvalidateRect(nprect);
RecordDrawingModel();
}
mozilla::ipc::IPCResult
PluginInstanceParent::RecvShowDirectDXGISurface(const WindowsHandle& handle,
const gfx::IntRect& dirty)
@@ -1106,17 +1106,17 @@ PluginInstanceParent::SetBackgroundUnkno
}
nsresult
PluginInstanceParent::BeginUpdateBackground(const nsIntRect& aRect,
DrawTarget** aDrawTarget)
{
PLUGIN_LOG_DEBUG(
("[InstanceParent][%p] BeginUpdateBackground for <x=%d,y=%d, w=%d,h=%d>",
- this, aRect.x, aRect.y, aRect.width, aRect.height));
+ this, aRect.X(), aRect.Y(), aRect.Width(), aRect.Height()));
if (!mBackground) {
// XXX if we failed to create a background surface on one
// update, there's no guarantee that later updates will be for
// the entire background area until successful. We might want
// to fix that eventually.
MOZ_ASSERT(aRect.TopLeft() == nsIntPoint(0, 0),
"Expecting rect for whole frame");
@@ -1139,17 +1139,17 @@ PluginInstanceParent::BeginUpdateBackgro
return NS_OK;
}
nsresult
PluginInstanceParent::EndUpdateBackground(const nsIntRect& aRect)
{
PLUGIN_LOG_DEBUG(
("[InstanceParent][%p] EndUpdateBackground for <x=%d,y=%d, w=%d,h=%d>",
- this, aRect.x, aRect.y, aRect.width, aRect.height));
+ this, aRect.X(), aRect.Y(), aRect.Width(), aRect.Height()));
#ifdef MOZ_X11
// Have to XSync here to avoid the plugin trying to draw with this
// surface racing with its creation in the X server. We also want
// to avoid the plugin drawing onto stale pixels, then handing us
// back a front surface from those pixels that we might
// recomposite for "a while" until the next update. This XSync
// still doesn't guarantee that the plugin draws onto a consistent
--- a/dom/svg/SVGFEImageElement.cpp
+++ b/dom/svg/SVGFEImageElement.cpp
@@ -243,21 +243,21 @@ SVGFEImageElement::GetPrimitiveDescripti
return FilterPrimitiveDescription(PrimitiveType::Empty);
}
IntSize nativeSize;
imageContainer->GetWidth(&nativeSize.width);
imageContainer->GetHeight(&nativeSize.height);
Matrix viewBoxTM =
- SVGContentUtils::GetViewBoxTransform(aFilterSubregion.width, aFilterSubregion.height,
+ SVGContentUtils::GetViewBoxTransform(aFilterSubregion.Width(), aFilterSubregion.Height(),
0, 0, nativeSize.width, nativeSize.height,
mPreserveAspectRatio);
Matrix TM = viewBoxTM;
- TM.PostTranslate(aFilterSubregion.x, aFilterSubregion.y);
+ TM.PostTranslate(aFilterSubregion.X(), aFilterSubregion.Y());
SamplingFilter samplingFilter = nsLayoutUtils::GetSamplingFilterForFrame(frame);
FilterPrimitiveDescription descr(PrimitiveType::Image);
descr.Attributes().Set(eImageFilter, (uint32_t)samplingFilter);
descr.Attributes().Set(eImageTransform, TM);
// Append the image to aInputImages and store its index in the description.
--- a/dom/svg/SVGFETurbulenceElement.cpp
+++ b/dom/svg/SVGFETurbulenceElement.cpp
@@ -151,18 +151,18 @@ SVGFETurbulenceElement::GetPrimitiveDesc
// If a frequency in user space units is zero, then it will also be zero in
// filter space. During the conversion we use a dummy period length of 1
// for those frequencies but then ignore the converted length and use 0
// for the converted frequency. This avoids division by zero.
gfxRect firstPeriodInUserSpace(0, 0,
fX == 0 ? 1 : (1 / fX),
fY == 0 ? 1 : (1 / fY));
gfxRect firstPeriodInFilterSpace = aInstance->UserSpaceToFilterSpace(firstPeriodInUserSpace);
- Size frequencyInFilterSpace(fX == 0 ? 0 : (1 / firstPeriodInFilterSpace.width),
- fY == 0 ? 0 : (1 / firstPeriodInFilterSpace.height));
+ Size frequencyInFilterSpace(fX == 0 ? 0 : (1 / firstPeriodInFilterSpace.Width()),
+ fY == 0 ? 0 : (1 / firstPeriodInFilterSpace.Height()));
gfxPoint offset = firstPeriodInFilterSpace.TopLeft();
FilterPrimitiveDescription descr(PrimitiveType::Turbulence);
descr.Attributes().Set(eTurbulenceOffset, IntPoint::Truncate(offset.x, offset.y));
descr.Attributes().Set(eTurbulenceBaseFrequency, frequencyInFilterSpace);
descr.Attributes().Set(eTurbulenceSeed, seed);
descr.Attributes().Set(eTurbulenceNumOctaves, octaves);
descr.Attributes().Set(eTurbulenceStitchable, stitch == SVG_STITCHTYPE_STITCH);
--- a/dom/svg/SVGImageElement.cpp
+++ b/dom/svg/SVGImageElement.cpp
@@ -245,20 +245,20 @@ SVGImageElement::IsAttributeMapped(const
/* For the purposes of the update/invalidation logic pretend to
be a rectangle. */
bool
SVGImageElement::GetGeometryBounds(Rect* aBounds,
const StrokeOptions& aStrokeOptions,
const Matrix& aToBoundsSpace,
const Matrix* aToNonScalingStrokeSpace)
{
- Rect rect;
- GetAnimatedLengthValues(&rect.x, &rect.y, &rect.width,
- &rect.height, nullptr);
+ float x = 0.f, y = 0.f, width = 0.f, height = 0.f;
+ GetAnimatedLengthValues(&x, &y, &width, &height, nullptr);
+ Rect rect(x, y, width, height);
if (rect.IsEmpty()) {
// Rendering of the element disabled
rect.SetEmpty(); // Make sure width/height are zero and not negative
}
*aBounds = aToBoundsSpace.TransformBounds(rect);
return true;
}
--- a/dom/svg/SVGRect.cpp
+++ b/dom/svg/SVGRect.cpp
@@ -47,12 +47,12 @@ NS_NewSVGRect(nsIContent* aParent, float
new mozilla::dom::SVGRect(aParent, aX, aY, aWidth, aHeight);
return rect.forget();
}
already_AddRefed<mozilla::dom::SVGRect>
NS_NewSVGRect(nsIContent* aParent, const Rect& aRect)
{
- return NS_NewSVGRect(aParent, aRect.x, aRect.y,
- aRect.width, aRect.height);
+ return NS_NewSVGRect(aParent, aRect.X(), aRect.Y(),
+ aRect.Width(), aRect.Height());
}
--- a/dom/svg/SVGRectElement.cpp
+++ b/dom/svg/SVGRectElement.cpp
@@ -113,21 +113,20 @@ SVGRectElement::GetLengthInfo()
// SVGGeometryElement methods
bool
SVGRectElement::GetGeometryBounds(Rect* aBounds,
const StrokeOptions& aStrokeOptions,
const Matrix& aToBoundsSpace,
const Matrix* aToNonScalingStrokeSpace)
{
- Rect rect;
- Float rx, ry;
- GetAnimatedLengthValues(&rect.x, &rect.y, &rect.width,
- &rect.height, &rx, &ry, nullptr);
+ Float x, y, width, height, rx, ry;
+ GetAnimatedLengthValues(&x, &y, &width, &height, &rx, &ry, nullptr);
+ Rect rect(x, y, width, height);
if (rect.IsEmpty()) {
// Rendering of the element disabled
rect.SetEmpty(); // Make sure width/height are zero and not negative
// We still want the x/y position from 'rect'
*aBounds = aToBoundsSpace.TransformBounds(rect);
return true;
}