Bug 1326209 part 1 - Make nsCSSRendering::DrawTableBorderSegment take nscolor for background color. r?dholbert
MozReview-Commit-ID: sSPtxzIf9H
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -4459,27 +4459,27 @@ GetDashInfo(nscoord aBorderLength,
nscoord half = RoundIntToPixel(extra / 2, aTwipsPerPixel);
aStartDashLength += half;
aEndDashLength += (extra - half);
}
}
}
void
-nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
- uint8_t aBorderStyle,
- nscolor aBorderColor,
- const nsStyleBackground* aBGColor,
- const nsRect& aBorder,
- int32_t aAppUnitsPerDevPixel,
- int32_t aAppUnitsPerCSSPixel,
- uint8_t aStartBevelSide,
- nscoord aStartBevelOffset,
- uint8_t aEndBevelSide,
- nscoord aEndBevelOffset)
+nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
+ uint8_t aBorderStyle,
+ nscolor aBorderColor,
+ nscolor aBGColor,
+ const nsRect& aBorder,
+ int32_t aAppUnitsPerDevPixel,
+ int32_t aAppUnitsPerCSSPixel,
+ uint8_t aStartBevelSide,
+ nscoord aStartBevelOffset,
+ uint8_t aEndBevelSide,
+ nscoord aEndBevelOffset)
{
bool horizontal = ((eSideTop == aStartBevelSide) || (eSideBottom == aStartBevelSide));
nscoord twipsPerPixel = NSIntPixelsToAppUnits(1, aAppUnitsPerCSSPixel);
uint8_t ridgeGroove = NS_STYLE_BORDER_STYLE_RIDGE;
if ((twipsPerPixel >= aBorder.width) || (twipsPerPixel >= aBorder.height) ||
(NS_STYLE_BORDER_STYLE_DASHED == aBorderStyle) || (NS_STYLE_BORDER_STYLE_DOTTED == aBorderStyle)) {
// no beveling for 1 pixel border, dash or dot
@@ -4559,18 +4559,17 @@ nsCSSRendering::DrawTableBorderSegment(D
nscoord startBevel = (aStartBevelOffset > 0)
? RoundFloatToPixel(0.5f * (float)aStartBevelOffset, twipsPerPixel, true) : 0;
nscoord endBevel = (aEndBevelOffset > 0)
? RoundFloatToPixel(0.5f * (float)aEndBevelOffset, twipsPerPixel, true) : 0;
mozilla::Side ridgeGrooveSide = (horizontal) ? eSideTop : eSideLeft;
// FIXME: In theory, this should use the visited-dependent
// background color, but I don't care.
nscolor bevelColor = MakeBevelColor(ridgeGrooveSide, ridgeGroove,
- aBGColor->mBackgroundColor,
- aBorderColor);
+ aBGColor, aBorderColor);
nsRect rect(aBorder);
nscoord half;
if (horizontal) { // top, bottom
half = RoundFloatToPixel(0.5f * (float)aBorder.height, twipsPerPixel);
rect.height = half;
if (eSideTop == aStartBevelSide) {
rect.x += startBevel;
rect.width -= startBevel;
@@ -4599,17 +4598,17 @@ nsCSSRendering::DrawTableBorderSegment(D
endBevel);
}
rect = aBorder;
ridgeGrooveSide = (eSideTop == ridgeGrooveSide) ? eSideBottom : eSideRight;
// FIXME: In theory, this should use the visited-dependent
// background color, but I don't care.
bevelColor = MakeBevelColor(ridgeGrooveSide, ridgeGroove,
- aBGColor->mBackgroundColor, aBorderColor);
+ aBGColor, aBorderColor);
if (horizontal) {
rect.y = rect.y + half;
rect.height = aBorder.height - half;
if (eSideBottom == aStartBevelSide) {
rect.x += startBevel;
rect.width -= startBevel;
}
if (eSideBottom == aEndBevelSide) {
--- a/layout/painting/nsCSSRendering.h
+++ b/layout/painting/nsCSSRendering.h
@@ -709,27 +709,27 @@ struct nsCSSRendering {
* Called when we've finished using a display list. When all
* BeginFrameTreeLocked calls have been balanced by an EndFrameTreeLocked,
* the frame tree may start changing again.
*/
static void EndFrameTreesLocked();
// Draw a border segment in the table collapsing border model without
// beveling corners
- static void DrawTableBorderSegment(DrawTarget& aDrawTarget,
- uint8_t aBorderStyle,
- nscolor aBorderColor,
- const nsStyleBackground* aBGColor,
- const nsRect& aBorderRect,
- int32_t aAppUnitsPerDevPixel,
- int32_t aAppUnitsPerCSSPixel,
- uint8_t aStartBevelSide = 0,
- nscoord aStartBevelOffset = 0,
- uint8_t aEndBevelSide = 0,
- nscoord aEndBevelOffset = 0);
+ static void DrawTableBorderSegment(DrawTarget& aDrawTarget,
+ uint8_t aBorderStyle,
+ nscolor aBorderColor,
+ nscolor aBGColor,
+ const nsRect& aBorderRect,
+ int32_t aAppUnitsPerDevPixel,
+ int32_t aAppUnitsPerCSSPixel,
+ uint8_t aStartBevelSide = 0,
+ nscoord aStartBevelOffset = 0,
+ uint8_t aEndBevelSide = 0,
+ nscoord aEndBevelOffset = 0);
// NOTE: pt, dirtyRect, lineSize, ascent, offset in the following
// structs are non-rounded device pixels, not app units.
struct DecorationRectParams
{
// The width [length] and the height [thickness] of the decoration
// line. This is a "logical" size in textRun orientation, so that
// for a vertical textrun, width will actually be a physical height;
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -6357,17 +6357,17 @@ public:
void StoreColumnWidth(int32_t aIndex);
bool BlockDirSegmentOwnsCorner();
nsTableFrame* mTable;
nsTableFrame* mTableFirstInFlow;
nsTableCellMap* mTableCellMap;
nsCellMap* mCellMap;
WritingMode mTableWM;
- const nsStyleBackground* mTableBgColor;
+ nscolor mTableBgColor;
nsTableFrame::RowGroupArray mRowGroups;
nsTableRowGroupFrame* mPrevRg;
nsTableRowGroupFrame* mRg;
bool mIsRepeatedHeader;
bool mIsRepeatedFooter;
nsTableRowGroupFrame* mStartRg; // first row group in the damagearea
int32_t mRgIndex; // current row group index in the
@@ -6475,17 +6475,17 @@ BCPaintBorderIterator::BCPaintBorderIter
// Get the ordered row groups
mTable->OrderRowGroups(mRowGroups);
// initialize to a non existing index
mRepeatedHeaderRowIndex = -99;
nsIFrame* bgFrame =
nsCSSRendering::FindNonTransparentBackgroundFrame(aTable);
- mTableBgColor = bgFrame->StyleBackground();
+ mTableBgColor = bgFrame->StyleBackground()->mBackgroundColor;
}
bool
BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect)
{
nsSize containerSize = mTable->GetSize();
LogicalRect dirtyRect(mTableWM, aDirtyRect, containerSize);
uint32_t startRowIndex, endRowIndex, startColIndex, endColIndex;