2004-03-09 09:48:35 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2004-03-09 09:48:35 +03:00
|
|
|
|
|
|
|
#include "nsTableFrame.h"
|
|
|
|
#include "nsTableRowGroupFrame.h"
|
|
|
|
#include "nsTableRowFrame.h"
|
|
|
|
#include "nsTableColGroupFrame.h"
|
|
|
|
#include "nsTableColFrame.h"
|
|
|
|
#include "nsTableCellFrame.h"
|
|
|
|
#include "nsTablePainter.h"
|
|
|
|
#include "nsCSSRendering.h"
|
2006-01-26 05:29:17 +03:00
|
|
|
#include "nsDisplayList.h"
|
2015-05-04 10:09:25 +03:00
|
|
|
#include "mozilla/WritingModes.h"
|
2004-03-09 09:48:35 +03:00
|
|
|
|
2004-04-18 22:17:00 +04:00
|
|
|
/* ~*~ Table Background Painting ~*~
|
2004-03-09 09:48:35 +03:00
|
|
|
|
2004-04-18 22:17:00 +04:00
|
|
|
Mozilla's Table Background painting follows CSS2.1:17.5.1
|
2004-03-09 09:48:35 +03:00
|
|
|
That section does not, however, describe the effect of
|
|
|
|
borders on background image positioning. What we do is:
|
|
|
|
|
|
|
|
- in separate borders, the borders are passed in so that
|
|
|
|
their width figures in image positioning, even for rows/cols, which
|
|
|
|
don't have visible borders. This is done to allow authors
|
|
|
|
to position row backgrounds by, for example, aligning the
|
|
|
|
top left corner with the top left padding corner of the
|
|
|
|
top left table cell in the row in cases where all cells
|
|
|
|
have consistent border widths. If we didn't honor these
|
|
|
|
invisible borders, there would be no way to align
|
|
|
|
backgrounds with the padding edges, and designs would be
|
|
|
|
lost underneath the border.
|
|
|
|
|
|
|
|
- in collapsing borders, because the borders collapse, we
|
|
|
|
use the -continuous border- width to synthesize a border
|
|
|
|
style and pass that in instead of using the element's
|
|
|
|
assigned style directly.
|
|
|
|
|
|
|
|
The continuous border on a given edge of an element is
|
|
|
|
the collapse of all borders guaranteed to be continuous
|
|
|
|
along that edge. Cell borders are ignored (because, for
|
|
|
|
example, setting a thick border on the leftmost cell
|
|
|
|
should not shift the row background over; this way a
|
|
|
|
striped background set on <tr> will line up across rows
|
|
|
|
even if the cells are assigned arbitrary border widths.
|
|
|
|
|
2005-11-21 01:05:24 +03:00
|
|
|
For example, the continuous border on the top edge of a
|
2004-03-09 09:48:35 +03:00
|
|
|
row group is the collapse of any row group, row, and
|
|
|
|
table borders involved. (The first row group's top would
|
|
|
|
be [table-top + row group top + first row top]. It's bottom
|
|
|
|
would be [row group bottom + last row bottom + next row
|
|
|
|
top + next row group top].)
|
|
|
|
The top edge of a column group likewise includes the
|
|
|
|
table top, row group top, and first row top borders. However,
|
|
|
|
it *also* includes its own top border, since that is guaranteed
|
|
|
|
to be continuous. It does not include column borders because
|
|
|
|
those are not guaranteed to be continuous: there may be two
|
|
|
|
columns with different borders in a single column group.
|
|
|
|
|
|
|
|
An alternative would be to define the continuous border as
|
|
|
|
[table? + row group + row] for horizontal
|
|
|
|
[table? + col group + col] for vertical
|
|
|
|
This makes it easier to line up backgrounds across elements
|
|
|
|
despite varying border widths, but it does not give much
|
|
|
|
flexibility in aligning /to/ those border widths.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* ~*~ TableBackgroundPainter ~*~
|
|
|
|
|
|
|
|
The TableBackgroundPainter is created and destroyed in one painting call.
|
|
|
|
Its principal function is PaintTable, which paints all table element
|
|
|
|
backgrounds. The initial code in that method sets up an array of column
|
|
|
|
data that caches the background styles and the border sizes for the
|
|
|
|
columns and colgroups in TableBackgroundData structs in mCols. Data for
|
|
|
|
BC borders are calculated and stashed in a synthesized border style struct
|
|
|
|
in the data struct since collapsed borders aren't the same width as style-
|
|
|
|
assigned borders. The data struct optimizes by only doing this if there's
|
|
|
|
an image background; otherwise we don't care. //XXX should also check background-origin
|
2015-02-08 09:35:58 +03:00
|
|
|
The class then loops through the row groups, rows, and cells. At the cell
|
|
|
|
level, it paints the backgrounds, one over the other, inside the cell rect.
|
2004-03-09 09:48:35 +03:00
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
The exception to this pattern is when a table element creates a (pseudo)
|
|
|
|
stacking context. Elements with stacking contexts (e.g., 'opacity' applied)
|
|
|
|
are <dfn>passed through</dfn>, which means their data (and their
|
|
|
|
descendants' data) are not cached. The full loop is still executed, however,
|
|
|
|
so that underlying layers can get painted at the cell level.
|
2004-03-09 09:48:35 +03:00
|
|
|
|
|
|
|
The TableBackgroundPainter is then destroyed.
|
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
Elements with stacking contexts set up their own painter to finish the
|
|
|
|
painting process, since they were skipped. They call the appropriate
|
|
|
|
sub-part of the loop (e.g. PaintRow) which will paint the frame and
|
2014-08-20 05:24:58 +04:00
|
|
|
descendants.
|
2015-04-17 21:42:05 +03:00
|
|
|
|
|
|
|
XXX views are going
|
2004-03-09 09:48:35 +03:00
|
|
|
*/
|
|
|
|
|
2015-05-04 10:09:25 +03:00
|
|
|
using namespace mozilla;
|
2015-02-06 07:45:56 +03:00
|
|
|
using namespace mozilla::image;
|
|
|
|
|
2004-03-09 09:48:35 +03:00
|
|
|
TableBackgroundPainter::TableBackgroundData::TableBackgroundData()
|
2015-02-08 09:35:58 +03:00
|
|
|
: mFrame(nullptr)
|
|
|
|
, mVisible(false)
|
|
|
|
, mUsesSynthBorder(false)
|
2004-03-09 09:48:35 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-02-08 09:35:58 +03:00
|
|
|
TableBackgroundPainter::TableBackgroundData::TableBackgroundData(nsIFrame* aFrame)
|
|
|
|
: mFrame(aFrame)
|
|
|
|
, mRect(aFrame->GetRect())
|
|
|
|
, mVisible(mFrame->IsVisibleForPainting())
|
|
|
|
, mUsesSynthBorder(false)
|
2004-03-09 09:48:35 +03:00
|
|
|
{
|
2004-12-01 06:51:35 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline bool
|
2015-02-08 09:35:58 +03:00
|
|
|
TableBackgroundPainter::TableBackgroundData::ShouldSetBCBorder() const
|
2004-03-09 09:48:35 +03:00
|
|
|
{
|
|
|
|
/* we only need accurate border data when positioning background images*/
|
2010-04-03 05:58:26 +04:00
|
|
|
if (!mVisible) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2009-02-20 08:29:21 +03:00
|
|
|
}
|
|
|
|
|
2013-02-17 01:51:02 +04:00
|
|
|
const nsStyleBackground *bg = mFrame->StyleBackground();
|
2010-04-03 05:58:26 +04:00
|
|
|
NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, bg) {
|
|
|
|
if (!bg->mLayers[i].mImage.IsEmpty())
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2009-02-20 08:29:21 +03:00
|
|
|
}
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
|
2015-02-08 09:35:58 +03:00
|
|
|
void
|
|
|
|
TableBackgroundPainter::TableBackgroundData::SetBCBorder(const nsMargin& aBorder)
|
2004-03-09 09:48:35 +03:00
|
|
|
{
|
2015-02-08 09:35:58 +03:00
|
|
|
mUsesSynthBorder = true;
|
|
|
|
mSynthBorderWidths = aBorder;
|
|
|
|
}
|
2004-03-09 09:48:35 +03:00
|
|
|
|
2015-02-08 09:35:58 +03:00
|
|
|
nsStyleBorder
|
|
|
|
TableBackgroundPainter::TableBackgroundData::StyleBorder(const nsStyleBorder& aZeroBorder) const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mVisible, "Don't call StyleBorder on an invisible TableBackgroundData");
|
|
|
|
|
|
|
|
if (mUsesSynthBorder) {
|
|
|
|
nsStyleBorder result = aZeroBorder;
|
|
|
|
NS_FOR_CSS_SIDES(side) {
|
|
|
|
result.SetBorderWidth(side, mSynthBorderWidths.Side(side));
|
|
|
|
}
|
|
|
|
return result;
|
2005-04-29 19:44:38 +04:00
|
|
|
}
|
2015-02-08 09:35:58 +03:00
|
|
|
|
|
|
|
MOZ_ASSERT(mFrame);
|
|
|
|
|
|
|
|
return *mFrame->StyleBorder();
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
TableBackgroundPainter::TableBackgroundPainter(nsTableFrame* aTableFrame,
|
|
|
|
Origin aOrigin,
|
2006-01-26 05:29:17 +03:00
|
|
|
nsPresContext* aPresContext,
|
2011-04-08 05:04:40 +04:00
|
|
|
nsRenderingContext& aRenderingContext,
|
2008-03-21 04:18:30 +03:00
|
|
|
const nsRect& aDirtyRect,
|
2009-09-13 02:44:18 +04:00
|
|
|
const nsPoint& aRenderPt,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aBGPaintFlags)
|
2004-03-09 09:48:35 +03:00
|
|
|
: mPresContext(aPresContext),
|
|
|
|
mRenderingContext(aRenderingContext),
|
2008-03-21 04:18:30 +03:00
|
|
|
mRenderPt(aRenderPt),
|
2004-03-09 09:48:35 +03:00
|
|
|
mDirtyRect(aDirtyRect),
|
|
|
|
mOrigin(aOrigin),
|
2009-09-13 02:44:18 +04:00
|
|
|
mZeroBorder(aPresContext),
|
|
|
|
mBGPaintFlags(aBGPaintFlags)
|
2004-03-09 09:48:35 +03:00
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(TableBackgroundPainter);
|
|
|
|
|
2005-04-29 19:44:38 +04:00
|
|
|
NS_FOR_CSS_SIDES(side) {
|
|
|
|
mZeroBorder.SetBorderStyle(side, NS_STYLE_BORDER_STYLE_SOLID);
|
|
|
|
mZeroBorder.SetBorderWidth(side, 0);
|
|
|
|
}
|
2004-03-09 09:48:35 +03:00
|
|
|
|
|
|
|
mIsBorderCollapse = aTableFrame->IsBorderCollapse();
|
|
|
|
#ifdef DEBUG
|
|
|
|
mCompatMode = mPresContext->CompatibilityMode();
|
|
|
|
#endif
|
|
|
|
mNumCols = aTableFrame->GetColCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
TableBackgroundPainter::~TableBackgroundPainter()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(TableBackgroundPainter);
|
|
|
|
}
|
|
|
|
|
2015-02-06 07:45:56 +03:00
|
|
|
DrawResult
|
2004-03-09 09:48:35 +03:00
|
|
|
TableBackgroundPainter::PaintTableFrame(nsTableFrame* aTableFrame,
|
|
|
|
nsTableRowGroupFrame* aFirstRowGroup,
|
|
|
|
nsTableRowGroupFrame* aLastRowGroup,
|
2009-07-22 04:44:52 +04:00
|
|
|
const nsMargin& aDeflate)
|
2004-03-09 09:48:35 +03:00
|
|
|
{
|
2015-02-08 09:35:58 +03:00
|
|
|
MOZ_ASSERT(aTableFrame, "null frame");
|
|
|
|
TableBackgroundData tableData(aTableFrame);
|
2004-03-09 09:48:35 +03:00
|
|
|
tableData.mRect.MoveTo(0,0); //using table's coords
|
2009-07-22 04:44:52 +04:00
|
|
|
tableData.mRect.Deflate(aDeflate);
|
2015-06-20 23:00:26 +03:00
|
|
|
WritingMode wm = aTableFrame->GetWritingMode();
|
2004-03-09 09:48:35 +03:00
|
|
|
if (mIsBorderCollapse && tableData.ShouldSetBCBorder()) {
|
|
|
|
if (aFirstRowGroup && aLastRowGroup && mNumCols > 0) {
|
|
|
|
//only handle non-degenerate tables; we need a more robust BC model
|
|
|
|
//to make degenerate tables' borders reasonable to deal with
|
2015-06-24 19:56:54 +03:00
|
|
|
LogicalMargin border(wm);
|
|
|
|
LogicalMargin tempBorder(wm);
|
2004-03-09 09:48:35 +03:00
|
|
|
nsTableColFrame* colFrame = aTableFrame->GetColFrame(mNumCols - 1);
|
|
|
|
if (colFrame) {
|
2015-06-24 19:56:54 +03:00
|
|
|
colFrame->GetContinuousBCBorderWidth(wm, tempBorder);
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
2015-06-24 19:56:54 +03:00
|
|
|
border.IEnd(wm) = tempBorder.IEnd(wm);
|
2004-03-09 09:48:35 +03:00
|
|
|
|
2015-06-24 19:56:54 +03:00
|
|
|
aLastRowGroup->GetContinuousBCBorderWidth(wm, tempBorder);
|
|
|
|
border.BEnd(wm) = tempBorder.BEnd(wm);
|
2004-03-09 09:48:35 +03:00
|
|
|
|
|
|
|
nsTableRowFrame* rowFrame = aFirstRowGroup->GetFirstRow();
|
|
|
|
if (rowFrame) {
|
2015-06-24 19:56:54 +03:00
|
|
|
rowFrame->GetContinuousBCBorderWidth(wm, tempBorder);
|
|
|
|
border.BStart(wm) = tempBorder.BStart(wm);
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
|
2015-06-27 21:16:10 +03:00
|
|
|
border.IStart(wm) = aTableFrame->GetContinuousIStartBCBorderWidth();
|
2004-03-09 09:48:35 +03:00
|
|
|
|
2015-06-24 19:56:54 +03:00
|
|
|
tableData.SetBCBorder(border.GetPhysicalMargin(wm));
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
}
|
2015-02-06 07:45:56 +03:00
|
|
|
|
|
|
|
DrawResult result = DrawResult::SUCCESS;
|
|
|
|
|
2004-03-09 09:48:35 +03:00
|
|
|
if (tableData.IsVisible()) {
|
2015-02-06 07:45:56 +03:00
|
|
|
result =
|
|
|
|
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
|
|
|
|
tableData.mFrame, mDirtyRect,
|
|
|
|
tableData.mRect + mRenderPt,
|
|
|
|
tableData.mFrame->StyleContext(),
|
|
|
|
tableData.StyleBorder(mZeroBorder),
|
|
|
|
mBGPaintFlags);
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
2015-02-06 07:45:56 +03:00
|
|
|
|
|
|
|
return result;
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TableBackgroundPainter::TranslateContext(nscoord aDX,
|
|
|
|
nscoord aDY)
|
|
|
|
{
|
2008-03-21 04:18:30 +03:00
|
|
|
mRenderPt += nsPoint(aDX, aDY);
|
2015-02-08 09:35:58 +03:00
|
|
|
for (auto& col : mCols) {
|
|
|
|
col.mCol.mRect.MoveBy(-aDX, -aDY);
|
|
|
|
}
|
|
|
|
for (auto& colGroup : mColGroups) {
|
|
|
|
colGroup.mRect.MoveBy(-aDX, -aDY);
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-08 09:35:58 +03:00
|
|
|
TableBackgroundPainter::ColData::ColData(nsIFrame* aFrame, TableBackgroundData& aColGroupBGData)
|
|
|
|
: mCol(aFrame)
|
|
|
|
, mColGroup(aColGroupBGData)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-02-06 07:45:56 +03:00
|
|
|
DrawResult
|
2009-07-22 04:44:52 +04:00
|
|
|
TableBackgroundPainter::PaintTable(nsTableFrame* aTableFrame,
|
|
|
|
const nsMargin& aDeflate,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aPaintTableBackground)
|
2004-03-09 09:48:35 +03:00
|
|
|
{
|
|
|
|
NS_PRECONDITION(aTableFrame, "null table frame");
|
|
|
|
|
2007-06-05 22:55:26 +04:00
|
|
|
nsTableFrame::RowGroupArray rowGroups;
|
|
|
|
aTableFrame->OrderRowGroups(rowGroups);
|
2015-06-24 19:56:54 +03:00
|
|
|
WritingMode wm = aTableFrame->GetWritingMode();
|
2004-03-09 09:48:35 +03:00
|
|
|
|
2015-02-06 07:45:56 +03:00
|
|
|
DrawResult result = DrawResult::SUCCESS;
|
|
|
|
|
2007-06-05 22:55:26 +04:00
|
|
|
if (rowGroups.Length() < 1) { //degenerate case
|
2009-07-22 04:44:52 +04:00
|
|
|
if (aPaintTableBackground) {
|
2012-07-30 18:20:58 +04:00
|
|
|
PaintTableFrame(aTableFrame, nullptr, nullptr, nsMargin(0,0,0,0));
|
2009-07-22 04:44:52 +04:00
|
|
|
}
|
2004-03-09 09:48:35 +03:00
|
|
|
/* No cells; nothing else to paint */
|
2015-02-06 07:45:56 +03:00
|
|
|
return result;
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
|
2009-07-22 04:44:52 +04:00
|
|
|
if (aPaintTableBackground) {
|
|
|
|
PaintTableFrame(aTableFrame, rowGroups[0], rowGroups[rowGroups.Length() - 1],
|
|
|
|
aDeflate);
|
|
|
|
}
|
2004-03-09 09:48:35 +03:00
|
|
|
|
|
|
|
/*Set up column background/border data*/
|
|
|
|
if (mNumCols > 0) {
|
|
|
|
nsFrameList& colGroupList = aTableFrame->GetColGroups();
|
|
|
|
NS_ASSERTION(colGroupList.FirstChild(), "table should have at least one colgroup");
|
|
|
|
|
2015-02-08 09:35:58 +03:00
|
|
|
// Collect all col group frames first so that we know how many there are.
|
|
|
|
nsTArray<nsTableColGroupFrame*> colGroupFrames;
|
2007-07-08 11:08:04 +04:00
|
|
|
for (nsTableColGroupFrame* cgFrame = static_cast<nsTableColGroupFrame*>(colGroupList.FirstChild());
|
|
|
|
cgFrame; cgFrame = static_cast<nsTableColGroupFrame*>(cgFrame->GetNextSibling())) {
|
2004-03-09 09:48:35 +03:00
|
|
|
|
|
|
|
if (cgFrame->GetColCount() < 1) {
|
|
|
|
//No columns, no cells, so no need for data
|
|
|
|
continue;
|
|
|
|
}
|
2015-02-08 09:35:58 +03:00
|
|
|
colGroupFrames.AppendElement(cgFrame);
|
|
|
|
}
|
2004-03-09 09:48:35 +03:00
|
|
|
|
2015-02-08 09:35:58 +03:00
|
|
|
// Ensure that mColGroups won't reallocate during the loop below, because
|
|
|
|
// we grab references to its contents and need those to stay valid until
|
|
|
|
// mColGroups is destroyed as part of TablePainter destruction.
|
|
|
|
mColGroups.SetCapacity(colGroupFrames.Length());
|
|
|
|
|
2015-06-24 19:56:54 +03:00
|
|
|
LogicalMargin border(wm);
|
2015-06-27 21:16:18 +03:00
|
|
|
/* BC iStart borders aren't stored on cols, but the previous column's
|
|
|
|
iEnd border is the next one's iStart border.*/
|
|
|
|
//Start with table's iStart border.
|
|
|
|
nscoord lastIStartBorder = aTableFrame->GetContinuousIStartBCBorderWidth();
|
2015-02-08 09:35:58 +03:00
|
|
|
|
|
|
|
for (nsTableColGroupFrame* cgFrame : colGroupFrames) {
|
2004-03-09 09:48:35 +03:00
|
|
|
/*Create data struct for column group*/
|
2015-02-08 09:35:58 +03:00
|
|
|
TableBackgroundData& cgData = *mColGroups.AppendElement(TableBackgroundData(cgFrame));
|
|
|
|
if (mIsBorderCollapse && cgData.ShouldSetBCBorder()) {
|
2015-06-27 21:16:18 +03:00
|
|
|
border.IStart(wm) = lastIStartBorder;
|
2015-06-24 19:56:54 +03:00
|
|
|
cgFrame->GetContinuousBCBorderWidth(wm, border);
|
|
|
|
cgData.SetBCBorder(border.GetPhysicalMargin(wm));
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2004-03-09 09:48:35 +03:00
|
|
|
/*Loop over columns in this colgroup*/
|
2006-03-04 08:26:57 +03:00
|
|
|
for (nsTableColFrame* col = cgFrame->GetFirstColumn(); col;
|
2007-07-08 11:08:04 +04:00
|
|
|
col = static_cast<nsTableColFrame*>(col->GetNextSibling())) {
|
2015-02-08 09:35:58 +03:00
|
|
|
MOZ_ASSERT(size_t(col->GetColIndex()) == mCols.Length());
|
|
|
|
// Store a reference to the colGroup in the ColData element.
|
|
|
|
ColData& colData = *mCols.AppendElement(ColData(col, cgData));
|
2006-03-04 08:26:57 +03:00
|
|
|
//Bring column mRect into table's coord system
|
2015-02-08 09:35:58 +03:00
|
|
|
colData.mCol.mRect.MoveBy(cgData.mRect.x, cgData.mRect.y);
|
2006-03-04 08:26:57 +03:00
|
|
|
if (mIsBorderCollapse) {
|
2015-06-27 21:16:18 +03:00
|
|
|
border.IStart(wm) = lastIStartBorder;
|
|
|
|
lastIStartBorder = col->GetContinuousBCBorderWidth(wm, border);
|
2015-02-08 09:35:58 +03:00
|
|
|
if (colData.mCol.ShouldSetBCBorder()) {
|
2015-06-24 19:56:54 +03:00
|
|
|
colData.mCol.SetBCBorder(border.GetPhysicalMargin(wm));
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
for (uint32_t i = 0; i < rowGroups.Length(); i++) {
|
2007-06-05 22:55:26 +04:00
|
|
|
nsTableRowGroupFrame* rg = rowGroups[i];
|
2015-02-08 09:35:58 +03:00
|
|
|
TableBackgroundData rowGroupBGData(rg);
|
2004-12-01 06:51:35 +03:00
|
|
|
// Need to compute the right rect via GetOffsetTo, since the row
|
|
|
|
// group may not be a child of the table.
|
2015-02-08 09:35:58 +03:00
|
|
|
rowGroupBGData.mRect.MoveTo(rg->GetOffsetTo(aTableFrame));
|
2014-08-20 05:24:58 +04:00
|
|
|
|
|
|
|
// We have to draw backgrounds not only within the overflow region of this
|
|
|
|
// row group, but also possibly (in the case of column / column group
|
|
|
|
// backgrounds) at its pre-relative-positioning location.
|
|
|
|
nsRect rgVisualOverflow = rg->GetVisualOverflowRectRelativeToSelf();
|
|
|
|
nsRect rgOverflowRect = rgVisualOverflow + rg->GetPosition();
|
|
|
|
nsRect rgNormalRect = rgVisualOverflow + rg->GetNormalPosition();
|
|
|
|
|
|
|
|
if (rgOverflowRect.Union(rgNormalRect).Intersects(mDirtyRect - mRenderPt)) {
|
2015-10-14 23:30:12 +03:00
|
|
|
result &=
|
2015-02-06 07:45:56 +03:00
|
|
|
PaintRowGroup(rg, rowGroupBGData, rg->IsPseudoStackingContextFromStyle());
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
}
|
2015-02-06 07:45:56 +03:00
|
|
|
|
|
|
|
return result;
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
|
2015-02-06 07:45:56 +03:00
|
|
|
DrawResult
|
2015-02-08 09:35:58 +03:00
|
|
|
TableBackgroundPainter::PaintRowGroup(nsTableRowGroupFrame* aFrame)
|
|
|
|
{
|
2015-02-06 07:45:56 +03:00
|
|
|
return PaintRowGroup(aFrame, TableBackgroundData(aFrame), false);
|
2015-02-08 09:35:58 +03:00
|
|
|
}
|
|
|
|
|
2015-02-06 07:45:56 +03:00
|
|
|
DrawResult
|
2004-03-09 09:48:35 +03:00
|
|
|
TableBackgroundPainter::PaintRowGroup(nsTableRowGroupFrame* aFrame,
|
2015-02-08 09:35:58 +03:00
|
|
|
TableBackgroundData aRowGroupBGData,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aPassThrough)
|
2004-03-09 09:48:35 +03:00
|
|
|
{
|
2015-02-08 09:35:58 +03:00
|
|
|
MOZ_ASSERT(aFrame, "null frame");
|
2004-12-01 06:51:35 +03:00
|
|
|
|
2004-03-09 09:48:35 +03:00
|
|
|
nsTableRowFrame* firstRow = aFrame->GetFirstRow();
|
2015-06-20 23:00:26 +03:00
|
|
|
WritingMode wm = aFrame->GetWritingMode();
|
2004-03-09 09:48:35 +03:00
|
|
|
|
|
|
|
/* Load row group data */
|
2015-02-08 09:35:58 +03:00
|
|
|
if (aPassThrough) {
|
|
|
|
aRowGroupBGData.MakeInvisible();
|
|
|
|
} else {
|
|
|
|
if (mIsBorderCollapse && aRowGroupBGData.ShouldSetBCBorder()) {
|
2015-06-20 23:00:26 +03:00
|
|
|
LogicalMargin border(wm);
|
2004-03-09 09:48:35 +03:00
|
|
|
if (firstRow) {
|
2015-06-20 23:00:26 +03:00
|
|
|
//pick up first row's bstart border (= rg bstart border)
|
|
|
|
firstRow->GetContinuousBCBorderWidth(wm, border);
|
|
|
|
/* (row group doesn't store its bstart border) */
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
//overwrite sides+bottom borders with rg's own
|
2015-06-20 23:00:26 +03:00
|
|
|
aFrame->GetContinuousBCBorderWidth(wm, border);
|
|
|
|
aRowGroupBGData.SetBCBorder(border.GetPhysicalMargin(wm));
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
2015-02-08 09:35:58 +03:00
|
|
|
aPassThrough = !aRowGroupBGData.IsVisible();
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* translate everything into row group coord system*/
|
|
|
|
if (eOrigin_TableRowGroup != mOrigin) {
|
2015-02-08 09:35:58 +03:00
|
|
|
TranslateContext(aRowGroupBGData.mRect.x, aRowGroupBGData.mRect.y);
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
2015-02-08 09:35:58 +03:00
|
|
|
nsRect rgRect = aRowGroupBGData.mRect;
|
|
|
|
aRowGroupBGData.mRect.MoveTo(0, 0);
|
2004-03-09 09:48:35 +03:00
|
|
|
|
2006-09-20 20:42:13 +04:00
|
|
|
/* Find the right row to start with */
|
|
|
|
|
2008-03-21 04:18:30 +03:00
|
|
|
// Note that mDirtyRect - mRenderPt is guaranteed to be in the row
|
|
|
|
// group's coordinate system here, so passing its .y to
|
|
|
|
// GetFirstRowContaining is ok.
|
2014-08-20 05:24:58 +04:00
|
|
|
nscoord overflowAbove;
|
|
|
|
nsIFrame* cursor = aFrame->GetFirstRowContaining(mDirtyRect.y - mRenderPt.y, &overflowAbove);
|
2006-09-20 20:42:13 +04:00
|
|
|
|
|
|
|
// Sadly, it seems like there may be non-row frames in there... or something?
|
|
|
|
// There are certainly null-checks in GetFirstRow() and GetNextRow(). :(
|
2006-12-26 20:47:52 +03:00
|
|
|
while (cursor && cursor->GetType() != nsGkAtoms::tableRowFrame) {
|
2006-09-20 20:42:13 +04:00
|
|
|
cursor = cursor->GetNextSibling();
|
|
|
|
}
|
|
|
|
|
|
|
|
// It's OK if cursor is null here.
|
2015-04-17 21:42:05 +03:00
|
|
|
nsTableRowFrame* row = static_cast<nsTableRowFrame*>(cursor);
|
2006-09-20 20:42:13 +04:00
|
|
|
if (!row) {
|
|
|
|
// No useful cursor; just start at the top. Don't bother to set up a
|
|
|
|
// cursor; if we've gotten this far then we've already built the display
|
|
|
|
// list for the rowgroup, so not having a cursor means that there's some
|
|
|
|
// good reason we don't have a cursor and we shouldn't create one here.
|
|
|
|
row = firstRow;
|
|
|
|
}
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2015-02-06 07:45:56 +03:00
|
|
|
DrawResult result = DrawResult::SUCCESS;
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2006-09-20 20:42:13 +04:00
|
|
|
/* Finally paint */
|
|
|
|
for (; row; row = row->GetNextRow()) {
|
2015-02-08 09:35:58 +03:00
|
|
|
TableBackgroundData rowBackgroundData(row);
|
|
|
|
|
2014-08-20 05:24:58 +04:00
|
|
|
// Be sure to consider our positions both pre- and post-relative
|
|
|
|
// positioning, since we potentially need to paint at both places.
|
2015-02-08 09:35:58 +03:00
|
|
|
nscoord rowY = std::min(rowBackgroundData.mRect.y, row->GetNormalPosition().y);
|
2006-09-20 20:42:13 +04:00
|
|
|
|
2014-08-20 05:24:58 +04:00
|
|
|
// Intersect wouldn't handle rowspans.
|
|
|
|
if (cursor &&
|
|
|
|
(mDirtyRect.YMost() - mRenderPt.y) <= (rowY - overflowAbove)) {
|
2006-09-20 20:42:13 +04:00
|
|
|
// All done; cells originating in later rows can't intersect mDirtyRect.
|
|
|
|
break;
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2015-10-14 23:30:12 +03:00
|
|
|
result &=
|
2015-02-06 07:45:56 +03:00
|
|
|
PaintRow(row, aRowGroupBGData, rowBackgroundData,
|
|
|
|
aPassThrough || row->IsPseudoStackingContextFromStyle());
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* translate back into table coord system */
|
|
|
|
if (eOrigin_TableRowGroup != mOrigin) {
|
|
|
|
TranslateContext(-rgRect.x, -rgRect.y);
|
|
|
|
}
|
2015-02-06 07:45:56 +03:00
|
|
|
|
|
|
|
return result;
|
2015-02-08 09:35:58 +03:00
|
|
|
}
|
2004-03-09 09:48:35 +03:00
|
|
|
|
2015-02-06 07:45:56 +03:00
|
|
|
DrawResult
|
2015-02-08 09:35:58 +03:00
|
|
|
TableBackgroundPainter::PaintRow(nsTableRowFrame* aFrame)
|
|
|
|
{
|
|
|
|
return PaintRow(aFrame, TableBackgroundData(), TableBackgroundData(aFrame), false);
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
|
2015-02-06 07:45:56 +03:00
|
|
|
DrawResult
|
2004-03-09 09:48:35 +03:00
|
|
|
TableBackgroundPainter::PaintRow(nsTableRowFrame* aFrame,
|
2015-02-08 09:35:58 +03:00
|
|
|
const TableBackgroundData& aRowGroupBGData,
|
|
|
|
TableBackgroundData aRowBGData,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aPassThrough)
|
2004-03-09 09:48:35 +03:00
|
|
|
{
|
2015-02-08 09:35:58 +03:00
|
|
|
MOZ_ASSERT(aFrame, "null frame");
|
2004-12-01 06:51:35 +03:00
|
|
|
|
2004-03-09 09:48:35 +03:00
|
|
|
/* Load row data */
|
2015-06-20 23:00:26 +03:00
|
|
|
WritingMode wm = aFrame->GetWritingMode();
|
2015-02-08 09:35:58 +03:00
|
|
|
if (aPassThrough) {
|
|
|
|
aRowBGData.MakeInvisible();
|
|
|
|
} else {
|
|
|
|
if (mIsBorderCollapse && aRowBGData.ShouldSetBCBorder()) {
|
2015-06-20 23:00:26 +03:00
|
|
|
LogicalMargin border(wm);
|
2004-03-09 09:48:35 +03:00
|
|
|
nsTableRowFrame* nextRow = aFrame->GetNextRow();
|
2015-06-27 21:16:10 +03:00
|
|
|
if (nextRow) { //outer bStart after us is inner bEnd for us
|
2015-06-20 23:00:26 +03:00
|
|
|
border.BEnd(wm) = nextRow->GetOuterBStartContBCBorderWidth();
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
2015-06-27 21:16:10 +03:00
|
|
|
else { //acquire rg's bEnd border
|
2007-07-08 11:08:04 +04:00
|
|
|
nsTableRowGroupFrame* rowGroup = static_cast<nsTableRowGroupFrame*>(aFrame->GetParent());
|
2015-06-20 23:00:26 +03:00
|
|
|
rowGroup->GetContinuousBCBorderWidth(wm, border);
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
2015-06-27 21:16:10 +03:00
|
|
|
//get the rest of the borders; will overwrite all but bEnd
|
2015-06-20 23:00:26 +03:00
|
|
|
aFrame->GetContinuousBCBorderWidth(wm, border);
|
2004-03-09 09:48:35 +03:00
|
|
|
|
2015-06-20 23:00:26 +03:00
|
|
|
aRowBGData.SetBCBorder(border.GetPhysicalMargin(wm));
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
2015-02-08 09:35:58 +03:00
|
|
|
aPassThrough = !aRowBGData.IsVisible();
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Translate */
|
|
|
|
if (eOrigin_TableRow == mOrigin) {
|
|
|
|
/* If we originate from the row, then make the row the origin. */
|
2015-02-08 09:35:58 +03:00
|
|
|
aRowBGData.mRect.MoveTo(0, 0);
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
//else: Use row group's coord system -> no translation necessary
|
|
|
|
|
2015-02-06 07:45:56 +03:00
|
|
|
DrawResult result = DrawResult::SUCCESS;
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2004-03-09 09:48:35 +03:00
|
|
|
for (nsTableCellFrame* cell = aFrame->GetFirstCell(); cell; cell = cell->GetNextCell()) {
|
2014-08-20 05:24:58 +04:00
|
|
|
nsRect cellBGRect, rowBGRect, rowGroupBGRect, colBGRect;
|
2015-02-08 09:35:58 +03:00
|
|
|
ComputeCellBackgrounds(cell, aRowGroupBGData, aRowBGData,
|
|
|
|
cellBGRect, rowBGRect,
|
2014-08-20 05:24:58 +04:00
|
|
|
rowGroupBGRect, colBGRect);
|
|
|
|
|
|
|
|
// Find the union of all the cell background layers.
|
|
|
|
nsRect combinedRect(cellBGRect);
|
|
|
|
combinedRect.UnionRect(combinedRect, rowBGRect);
|
|
|
|
combinedRect.UnionRect(combinedRect, rowGroupBGRect);
|
|
|
|
combinedRect.UnionRect(combinedRect, colBGRect);
|
|
|
|
|
|
|
|
if (combinedRect.Intersects(mDirtyRect)) {
|
|
|
|
bool passCell = aPassThrough || cell->IsPseudoStackingContextFromStyle();
|
2015-10-14 23:30:12 +03:00
|
|
|
result &=
|
|
|
|
PaintCell(cell, aRowGroupBGData, aRowBGData, cellBGRect, rowBGRect,
|
|
|
|
rowGroupBGRect, colBGRect, passCell);
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
}
|
2015-02-06 07:45:56 +03:00
|
|
|
|
|
|
|
return result;
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
|
2015-02-06 07:45:56 +03:00
|
|
|
DrawResult
|
2004-03-09 09:48:35 +03:00
|
|
|
TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
|
2015-02-08 09:35:58 +03:00
|
|
|
const TableBackgroundData& aRowGroupBGData,
|
|
|
|
const TableBackgroundData& aRowBGData,
|
2014-08-20 05:24:58 +04:00
|
|
|
nsRect& aCellBGRect,
|
|
|
|
nsRect& aRowBGRect,
|
|
|
|
nsRect& aRowGroupBGRect,
|
|
|
|
nsRect& aColBGRect,
|
|
|
|
bool aPassSelf)
|
2004-03-09 09:48:35 +03:00
|
|
|
{
|
2015-02-08 09:35:58 +03:00
|
|
|
MOZ_ASSERT(aCell, "null frame");
|
2004-03-09 09:48:35 +03:00
|
|
|
|
|
|
|
const nsStyleTableBorder* cellTableStyle;
|
2013-02-17 01:51:02 +04:00
|
|
|
cellTableStyle = aCell->StyleTableBorder();
|
2014-12-01 23:15:41 +03:00
|
|
|
if (NS_STYLE_TABLE_EMPTY_CELLS_SHOW != cellTableStyle->mEmptyCells &&
|
|
|
|
aCell->GetContentEmpty() && !mIsBorderCollapse) {
|
2015-02-06 07:45:56 +03:00
|
|
|
return DrawResult::SUCCESS;
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t colIndex;
|
2004-03-09 09:48:35 +03:00
|
|
|
aCell->GetColIndex(colIndex);
|
2015-02-08 09:35:58 +03:00
|
|
|
// We're checking mNumCols instead of mCols.Length() here because mCols can
|
|
|
|
// be empty even if mNumCols > 0.
|
|
|
|
NS_ASSERTION(size_t(colIndex) < mNumCols, "out-of-bounds column index");
|
2015-02-06 07:45:56 +03:00
|
|
|
if (size_t(colIndex) >= mNumCols) {
|
|
|
|
return DrawResult::SUCCESS;
|
|
|
|
}
|
2015-02-08 09:35:58 +03:00
|
|
|
|
|
|
|
// If callers call PaintRowGroup or PaintRow directly, we haven't processed
|
|
|
|
// our columns. Ignore column / col group backgrounds in that case.
|
|
|
|
bool haveColumns = !mCols.IsEmpty();
|
2004-03-09 09:48:35 +03:00
|
|
|
|
2015-02-06 07:45:56 +03:00
|
|
|
DrawResult result = DrawResult::SUCCESS;
|
|
|
|
|
2004-03-09 09:48:35 +03:00
|
|
|
//Paint column group background
|
2015-02-08 09:35:58 +03:00
|
|
|
if (haveColumns && mCols[colIndex].mColGroup.IsVisible()) {
|
2015-10-14 23:30:12 +03:00
|
|
|
result &=
|
2015-02-06 07:45:56 +03:00
|
|
|
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
|
|
|
|
mCols[colIndex].mColGroup.mFrame, mDirtyRect,
|
|
|
|
mCols[colIndex].mColGroup.mRect + mRenderPt,
|
|
|
|
mCols[colIndex].mColGroup.mFrame->StyleContext(),
|
|
|
|
mCols[colIndex].mColGroup.StyleBorder(mZeroBorder),
|
|
|
|
mBGPaintFlags, &aColBGRect);
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//Paint column background
|
2015-02-08 09:35:58 +03:00
|
|
|
if (haveColumns && mCols[colIndex].mCol.IsVisible()) {
|
2015-10-14 23:30:12 +03:00
|
|
|
result &=
|
2015-02-06 07:45:56 +03:00
|
|
|
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
|
|
|
|
mCols[colIndex].mCol.mFrame, mDirtyRect,
|
|
|
|
mCols[colIndex].mCol.mRect + mRenderPt,
|
|
|
|
mCols[colIndex].mCol.mFrame->StyleContext(),
|
|
|
|
mCols[colIndex].mCol.StyleBorder(mZeroBorder),
|
|
|
|
mBGPaintFlags, &aColBGRect);
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//Paint row group background
|
2015-02-08 09:35:58 +03:00
|
|
|
if (aRowGroupBGData.IsVisible()) {
|
2015-10-14 23:30:12 +03:00
|
|
|
result &=
|
2015-02-06 07:45:56 +03:00
|
|
|
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
|
|
|
|
aRowGroupBGData.mFrame, mDirtyRect,
|
|
|
|
aRowGroupBGData.mRect + mRenderPt,
|
|
|
|
aRowGroupBGData.mFrame->StyleContext(),
|
|
|
|
aRowGroupBGData.StyleBorder(mZeroBorder),
|
|
|
|
mBGPaintFlags, &aRowGroupBGRect);
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//Paint row background
|
2015-02-08 09:35:58 +03:00
|
|
|
if (aRowBGData.IsVisible()) {
|
2015-10-14 23:30:12 +03:00
|
|
|
result &=
|
2015-02-06 07:45:56 +03:00
|
|
|
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
|
|
|
|
aRowBGData.mFrame, mDirtyRect,
|
|
|
|
aRowBGData.mRect + mRenderPt,
|
|
|
|
aRowBGData.mFrame->StyleContext(),
|
|
|
|
aRowBGData.StyleBorder(mZeroBorder),
|
|
|
|
mBGPaintFlags, &aRowBGRect);
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//Paint cell background in border-collapse unless we're just passing
|
|
|
|
if (mIsBorderCollapse && !aPassSelf) {
|
2015-10-14 23:30:12 +03:00
|
|
|
result &=
|
2015-02-06 07:45:56 +03:00
|
|
|
aCell->PaintCellBackground(mRenderingContext, mDirtyRect,
|
|
|
|
aCellBGRect.TopLeft(), mBGPaintFlags);
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
2015-02-06 07:45:56 +03:00
|
|
|
|
|
|
|
return result;
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
2014-08-20 05:24:58 +04:00
|
|
|
|
|
|
|
void
|
|
|
|
TableBackgroundPainter::ComputeCellBackgrounds(nsTableCellFrame* aCell,
|
2015-02-08 09:35:58 +03:00
|
|
|
const TableBackgroundData& aRowGroupBGData,
|
|
|
|
const TableBackgroundData& aRowBGData,
|
2014-08-20 05:24:58 +04:00
|
|
|
nsRect& aCellBGRect,
|
|
|
|
nsRect& aRowBGRect,
|
|
|
|
nsRect& aRowGroupBGRect,
|
|
|
|
nsRect& aColBGRect)
|
|
|
|
{
|
|
|
|
// We need to compute table background layer rects for this cell space,
|
|
|
|
// adjusted for possible relative positioning. This behavior is not specified
|
|
|
|
// at the time of this writing, but the approach below should be web
|
|
|
|
// compatible.
|
|
|
|
//
|
|
|
|
// Our goal is that relative positioning of a table part should leave
|
|
|
|
// backgrounds *under* that part unchanged. ("Under" being defined by CSS 2.1
|
|
|
|
// Section 17.5.1.) If a cell is positioned, we do not expect the row
|
|
|
|
// background to move. On the other hand, the backgrounds of layers *above*
|
|
|
|
// the positioned part are taken along for the ride -- for example,
|
|
|
|
// positioning a row group will also cause the row background to be drawn in
|
|
|
|
// the new location, unless it has further positioning applied.
|
|
|
|
//
|
|
|
|
// Each table part layer has its position stored in the coordinate space of
|
|
|
|
// the layer below (which is to say, its geometric parent), and the stored
|
|
|
|
// position is the post-relative-positioning one. The position of each
|
|
|
|
// background layer rect is thus determined by peeling off successive table
|
|
|
|
// part layers, removing the contribution of each layer's positioning one by
|
|
|
|
// one. Every rect we generate will be the same size, the size of the cell
|
|
|
|
// space.
|
|
|
|
|
|
|
|
// We cannot rely on the row group background data to be available, since some
|
|
|
|
// callers enter through PaintRow.
|
|
|
|
nsIFrame* rowGroupFrame =
|
2015-02-08 09:35:58 +03:00
|
|
|
aRowGroupBGData.mFrame ? aRowGroupBGData.mFrame : aRowBGData.mFrame->GetParent();
|
2014-08-20 05:24:58 +04:00
|
|
|
|
|
|
|
// The cell background goes at the cell's position, translated to use the same
|
2015-02-08 09:35:58 +03:00
|
|
|
// coordinate system as aRowBGData.
|
|
|
|
aCellBGRect = aCell->GetRect() + aRowBGData.mRect.TopLeft() + mRenderPt;
|
2014-08-20 05:24:58 +04:00
|
|
|
|
|
|
|
// The row background goes at the normal position of the cell, which is to say
|
|
|
|
// the position without relative positioning applied.
|
|
|
|
aRowBGRect = aCellBGRect + (aCell->GetNormalPosition() - aCell->GetPosition());
|
|
|
|
|
|
|
|
// The row group background goes at the position we'd find the cell if neither
|
|
|
|
// the cell's relative positioning nor the row's were applied.
|
|
|
|
aRowGroupBGRect = aRowBGRect +
|
2015-02-08 09:35:58 +03:00
|
|
|
(aRowBGData.mFrame->GetNormalPosition() - aRowBGData.mFrame->GetPosition());
|
2014-08-20 05:24:58 +04:00
|
|
|
|
|
|
|
// The column and column group backgrounds (they're always at the same
|
|
|
|
// location, since relative positioning doesn't apply to columns or column
|
|
|
|
// groups) are drawn at the position we'd find the cell if none of the cell's,
|
|
|
|
// row's, or row group's relative positioning were applied.
|
|
|
|
aColBGRect = aRowGroupBGRect +
|
|
|
|
(rowGroupFrame->GetNormalPosition() - rowGroupFrame->GetPosition());
|
|
|
|
|
|
|
|
}
|