mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 13:55:43 +00:00
Bug 1316549 Part 4 - Use logical names for ComputeEllipseLineInterceptDiff(). r=dbaron
This patch is just renames. No logic change for the function. MozReview-Commit-ID: K7w0YL3G3gu --HG-- extra : rebase_source : d72ecdcb4d4455f4950c8673c81fbfc7c1b4f54c
This commit is contained in:
parent
ece375de5b
commit
62055a1981
@ -637,7 +637,7 @@ nsFloatManager::FloatInfo::LineLeft(WritingMode aWM,
|
||||
}
|
||||
|
||||
nscoord lineLeftDiff =
|
||||
ComputeEllipseXInterceptDiff(
|
||||
ComputeEllipseLineInterceptDiff(
|
||||
ShapeBoxRect().y, ShapeBoxRect().YMost(),
|
||||
blockStartCornerRadiusL, blockStartCornerRadiusB,
|
||||
blockEndCornerRadiusL, blockEndCornerRadiusB,
|
||||
@ -695,7 +695,7 @@ nsFloatManager::FloatInfo::LineRight(WritingMode aWM,
|
||||
}
|
||||
|
||||
nscoord lineRightDiff =
|
||||
ComputeEllipseXInterceptDiff(
|
||||
ComputeEllipseLineInterceptDiff(
|
||||
ShapeBoxRect().y, ShapeBoxRect().YMost(),
|
||||
blockStartCornerRadiusL, blockStartCornerRadiusB,
|
||||
blockEndCornerRadiusL, blockEndCornerRadiusB,
|
||||
@ -709,29 +709,30 @@ nsFloatManager::FloatInfo::LineRight(WritingMode aWM,
|
||||
}
|
||||
|
||||
/* static */ nscoord
|
||||
nsFloatManager::FloatInfo::ComputeEllipseXInterceptDiff(
|
||||
const nscoord aShapeBoxY, const nscoord aShapeBoxYMost,
|
||||
const nscoord aTopCornerRadiusX, const nscoord aTopCornerRadiusY,
|
||||
const nscoord aBottomCornerRadiusX, const nscoord aBottomCornerRadiusY,
|
||||
const nscoord aBandY, const nscoord aBandYMost)
|
||||
nsFloatManager::FloatInfo::ComputeEllipseLineInterceptDiff(
|
||||
const nscoord aShapeBoxBStart, const nscoord aShapeBoxBEnd,
|
||||
const nscoord aBStartCornerRadiusL, const nscoord aBStartCornerRadiusB,
|
||||
const nscoord aBEndCornerRadiusL, const nscoord aBEndCornerRadiusB,
|
||||
const nscoord aBandBStart, const nscoord aBandBEnd)
|
||||
{
|
||||
// An Example for the band intersects with the top right corner of an ellipse.
|
||||
// An example for the band intersecting with the top right corner of an
|
||||
// ellipse with writing-mode horizontal-tb.
|
||||
//
|
||||
// xIntercept xDiff
|
||||
// lineIntercept lineDiff
|
||||
// | |
|
||||
// +---------------------------------|-------|-+---- aShapeBoxY
|
||||
// +---------------------------------|-------|-+---- aShapeBoxBStart
|
||||
// | ##########^ | | |
|
||||
// | ##############|#### | | |
|
||||
// +---------#################|######|-------|-+---- aBandY
|
||||
// +---------#################|######|-------|-+---- aBandBStart
|
||||
// | ###################|######|## | |
|
||||
// | # aTopCornerRadiusY |######|### | |
|
||||
// | aBStartCornerRadiusB |######|### | |
|
||||
// | ######################|######|##### | |
|
||||
// +---#######################|<-----------><->^---- aBandYMost
|
||||
// +---#######################|<-----------><->^---- aBandBEnd
|
||||
// | ########################|############## |
|
||||
// | ########################|############## |---- y
|
||||
// | ########################|############## |---- b
|
||||
// | #########################|############### |
|
||||
// | ######################## v<-------------->v
|
||||
// |######################### aTopCornerRadiusX|
|
||||
// |###################### aBStartCornerRadiusL|
|
||||
// |###########################################|
|
||||
// |###########################################|
|
||||
// |###########################################|
|
||||
@ -747,34 +748,34 @@ nsFloatManager::FloatInfo::ComputeEllipseXInterceptDiff(
|
||||
// | ######################### |
|
||||
// | ################### |
|
||||
// | ########### |
|
||||
// +-------------------------------------------+----- aShapeBoxYMost
|
||||
// +-------------------------------------------+----- aShapeBoxBEnd
|
||||
|
||||
NS_ASSERTION(aShapeBoxY <= aShapeBoxYMost, "Bad shape box coordinates!");
|
||||
NS_ASSERTION(aBandY <= aBandYMost, "Bad band coordinates!");
|
||||
NS_ASSERTION(aShapeBoxBStart <= aShapeBoxBEnd, "Bad shape box coordinates!");
|
||||
NS_ASSERTION(aBandBStart <= aBandBEnd, "Bad band coordinates!");
|
||||
|
||||
nscoord xDiff = 0;
|
||||
nscoord lineDiff = 0;
|
||||
|
||||
// If the band intersects both the top and bottom corners, we don't need
|
||||
// to enter either branch because the correct xDiff is 0.
|
||||
if (aTopCornerRadiusY > 0 &&
|
||||
aBandYMost >= aShapeBoxY &&
|
||||
aBandYMost <= aShapeBoxY + aTopCornerRadiusY) {
|
||||
// The band intersects only the top corner.
|
||||
nscoord y = aTopCornerRadiusY - (aBandYMost - aShapeBoxY);
|
||||
nscoord xIntercept =
|
||||
XInterceptAtY(y, aTopCornerRadiusX, aTopCornerRadiusY);
|
||||
xDiff = aTopCornerRadiusX - xIntercept;
|
||||
} else if (aBottomCornerRadiusY > 0 &&
|
||||
aBandY >= aShapeBoxYMost - aBottomCornerRadiusY &&
|
||||
aBandY <= aShapeBoxYMost) {
|
||||
// The band intersects only the bottom corner.
|
||||
nscoord y = aBottomCornerRadiusY - (aShapeBoxYMost - aBandY);
|
||||
nscoord xIntercept =
|
||||
XInterceptAtY(y, aBottomCornerRadiusX, aBottomCornerRadiusY);
|
||||
xDiff = aBottomCornerRadiusX - xIntercept;
|
||||
// If the band intersects both the block-start and block-end corners, we
|
||||
// don't need to enter either branch because the correct lineDiff is 0.
|
||||
if (aBStartCornerRadiusB > 0 &&
|
||||
aBandBEnd >= aShapeBoxBStart &&
|
||||
aBandBEnd <= aShapeBoxBStart + aBStartCornerRadiusB) {
|
||||
// The band intersects only the block-start corner.
|
||||
nscoord b = aBStartCornerRadiusB - (aBandBEnd - aShapeBoxBStart);
|
||||
nscoord lineIntercept =
|
||||
XInterceptAtY(b, aBStartCornerRadiusL, aBStartCornerRadiusB);
|
||||
lineDiff = aBStartCornerRadiusL - lineIntercept;
|
||||
} else if (aBEndCornerRadiusB > 0 &&
|
||||
aBandBStart >= aShapeBoxBEnd - aBEndCornerRadiusB &&
|
||||
aBandBStart <= aShapeBoxBEnd) {
|
||||
// The band intersects only the block-end corner.
|
||||
nscoord b = aBEndCornerRadiusB - (aShapeBoxBEnd - aBandBStart);
|
||||
nscoord lineIntercept =
|
||||
XInterceptAtY(b, aBEndCornerRadiusL, aBEndCornerRadiusB);
|
||||
lineDiff = aBEndCornerRadiusL - lineIntercept;
|
||||
}
|
||||
|
||||
return xDiff;
|
||||
return lineDiff;
|
||||
}
|
||||
|
||||
/* static */ nscoord
|
||||
|
@ -349,18 +349,19 @@ private:
|
||||
return aShapeType == ShapeType::Margin ? BEnd() : ShapeBoxRect().YMost();
|
||||
}
|
||||
|
||||
// Compute the minimum x-axis difference between the bounding shape box
|
||||
// and its rounded corner within the given band (y-axis region). This is
|
||||
// used as a helper function to compute the LineRight() and LineLeft().
|
||||
// See the picture in the implementation for an example.
|
||||
// Compute the minimum line-axis difference between the bounding shape
|
||||
// box and its rounded corner within the given band (block-axis region).
|
||||
// This is used as a helper function to compute the LineRight() and
|
||||
// LineLeft(). See the picture in the implementation for an example.
|
||||
// RadiusL and RadiusB stand for radius on the line-axis and block-axis.
|
||||
//
|
||||
// Returns the x-axis diff, or 0 if there's no rounded corner within
|
||||
// the given band.
|
||||
static nscoord ComputeEllipseXInterceptDiff(
|
||||
const nscoord aShapeBoxY, const nscoord aShapeBoxYMost,
|
||||
const nscoord aTopCornerRadiusX, const nscoord aTopCornerRadiusY,
|
||||
const nscoord aBottomCornerRadiusX, const nscoord aBottomCornerRadiusY,
|
||||
const nscoord aBandY, const nscoord aBandYMost);
|
||||
// Returns radius-x diff on the line-axis, or 0 if there's no rounded
|
||||
// corner within the given band.
|
||||
static nscoord ComputeEllipseLineInterceptDiff(
|
||||
const nscoord aShapeBoxBStart, const nscoord aShapeBoxBEnd,
|
||||
const nscoord aBStartCornerRadiusL, const nscoord aBStartCornerRadiusB,
|
||||
const nscoord aBEndCornerRadiusL, const nscoord aBEndCornerRadiusB,
|
||||
const nscoord aBandBStart, const nscoord aBandBEnd);
|
||||
|
||||
static nscoord XInterceptAtY(const nscoord aY, const nscoord aRadiusX,
|
||||
const nscoord aRadiusY);
|
||||
|
Loading…
Reference in New Issue
Block a user