Bug 1395312 part 1. Add a method on nsTableCellFrame to determine whether it should paint borders and backgrounds. r=heycam
MozReview-Commit-ID: 7bLn4Fa3qP8
This commit is contained in:
@@ -470,18 +470,33 @@ PaintTableCellSelection(nsIFrame* aFrame, DrawTarget* aDrawTarget,
|
||||
aPt);
|
||||
}
|
||||
|
||||
bool
|
||||
nsTableCellFrame::ShouldPaintBordersAndBackgrounds() const
|
||||
{
|
||||
// If we're not visible, we don't paint.
|
||||
if (!StyleVisibility()->IsVisible()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Consider 'empty-cells', but only in separated borders mode.
|
||||
if (!GetContentEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
nsTableFrame* tableFrame = GetTableFrame();
|
||||
if (tableFrame->IsBorderCollapse()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return StyleTableBorder()->mEmptyCells == NS_STYLE_TABLE_EMPTY_CELLS_SHOW;
|
||||
}
|
||||
|
||||
void
|
||||
nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists)
|
||||
{
|
||||
DO_GLOBAL_REFLOW_COUNT_DSP("nsTableCellFrame");
|
||||
nsTableFrame* tableFrame = GetTableFrame();
|
||||
int32_t emptyCellStyle = GetContentEmpty() && !tableFrame->IsBorderCollapse() ?
|
||||
StyleTableBorder()->mEmptyCells
|
||||
: NS_STYLE_TABLE_EMPTY_CELLS_SHOW;
|
||||
// take account of 'empty-cells'
|
||||
if (StyleVisibility()->IsVisible() &&
|
||||
(NS_STYLE_TABLE_EMPTY_CELLS_HIDE != emptyCellStyle)) {
|
||||
if (ShouldPaintBordersAndBackgrounds()) {
|
||||
// display outset box-shadows if we need to.
|
||||
bool hasBoxShadow = !!StyleEffects()->mBoxShadow;
|
||||
if (hasBoxShadow) {
|
||||
@@ -506,7 +521,7 @@ nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
|
||||
// display borders if we need to
|
||||
ProcessBorders(tableFrame, aBuilder, aLists);
|
||||
ProcessBorders(GetTableFrame(), aBuilder, aLists);
|
||||
|
||||
// and display the selection border if we need to
|
||||
if (IsSelected()) {
|
||||
|
||||
@@ -196,7 +196,7 @@ public:
|
||||
/** set the desired size returned by this frame during its last reflow */
|
||||
inline void SetDesiredSize(const ReflowOutput & aDesiredSize);
|
||||
|
||||
bool GetContentEmpty();
|
||||
bool GetContentEmpty() const;
|
||||
void SetContentEmpty(bool aContentEmpty);
|
||||
|
||||
bool HasPctOverBSize();
|
||||
@@ -224,6 +224,8 @@ public:
|
||||
virtual void InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey = 0) override;
|
||||
virtual void InvalidateFrameForRemoval() override { InvalidateFrameSubtree(); }
|
||||
|
||||
bool ShouldPaintBordersAndBackgrounds() const;
|
||||
|
||||
protected:
|
||||
nsTableCellFrame(nsStyleContext* aContext, nsTableFrame* aTableFrame,
|
||||
ClassID aID);
|
||||
@@ -264,7 +266,7 @@ inline void nsTableCellFrame::SetDesiredSize(const ReflowOutput & aDesiredSize)
|
||||
mDesiredSize = aDesiredSize.Size(wm).ConvertTo(GetWritingMode(), wm);
|
||||
}
|
||||
|
||||
inline bool nsTableCellFrame::GetContentEmpty()
|
||||
inline bool nsTableCellFrame::GetContentEmpty() const
|
||||
{
|
||||
return HasAnyStateBits(NS_TABLE_CELL_CONTENT_EMPTY);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user