2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifndef CellData_h__
|
|
|
|
#define CellData_h__
|
|
|
|
|
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nsCoord.h"
|
2011-06-24 10:41:16 -07:00
|
|
|
#include "mozilla/gfx/Types.h"
|
2013-04-10 09:56:22 -07:00
|
|
|
#include "mozilla/StandardInteger.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsTableCellFrame;
|
|
|
|
class nsCellMap;
|
|
|
|
class BCCellData;
|
|
|
|
|
2008-07-16 08:02:18 -07:00
|
|
|
|
2011-09-25 21:52:33 -07:00
|
|
|
#define MAX_ROWSPAN 65534 // the cellmap can not handle more.
|
|
|
|
#define MAX_COLSPAN 1000 // limit as IE and opera do. If this ever changes,
|
|
|
|
// change COL_SPAN_OFFSET/COL_SPAN_SHIFT accordingly.
|
2008-07-16 08:02:18 -07:00
|
|
|
|
2010-04-27 09:15:01 -07:00
|
|
|
/**
|
2007-03-22 10:30:00 -07:00
|
|
|
* Data stored by nsCellMap to rationalize rowspan and colspan cells.
|
|
|
|
*/
|
|
|
|
class CellData
|
|
|
|
{
|
|
|
|
public:
|
2010-04-27 09:15:01 -07:00
|
|
|
/** Initialize the mOrigCell pointer
|
|
|
|
* @param aOrigCell the table cell frame which will be stored in mOrigCell.
|
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
void Init(nsTableCellFrame* aCellFrame);
|
|
|
|
|
|
|
|
/** does a cell originate from here
|
|
|
|
* @return is true if a cell corresponds to this cellmap entry
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsOrig() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** is the celldata valid
|
2010-04-27 09:15:01 -07:00
|
|
|
* @return is true if no cell originates and the cell is not spanned by
|
2007-03-22 10:30:00 -07:00
|
|
|
* a row- or colspan. mBits are 0 in this case and mOrigCell is
|
2012-07-30 07:20:58 -07:00
|
|
|
* nullptr
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsDead() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** is the entry spanned by row- or a colspan
|
|
|
|
* @return is true if the entry is spanned by a row- or colspan
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsSpan() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** is the entry spanned by rowspan
|
|
|
|
* @return is true if the entry is spanned by a rowspan
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsRowSpan() const;
|
2010-04-27 09:15:01 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/** is the entry spanned by a zero rowspan
|
2010-04-27 09:15:01 -07:00
|
|
|
* zero rowspans span all cells starting from the originating cell down to
|
2007-03-22 10:30:00 -07:00
|
|
|
* the end of the rowgroup or a cell originating in the same column
|
|
|
|
* @return is true if the entry is spanned by a zero rowspan
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsZeroRowSpan() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** mark the current entry as spanned by a zero rowspan
|
|
|
|
* @param aIsZero if true mark the entry as covered by a zero rowspan
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetZeroRowSpan(bool aIsZero);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** get the distance from the current entry to the corresponding origin of the rowspan
|
|
|
|
* @return containing the distance in the column to the originating cell
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t GetRowSpanOffset() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** set the distance from the current entry to the corresponding origin of the rowspan
|
|
|
|
* @param the distance in the column to the originating cell
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
void SetRowSpanOffset(uint32_t aSpan);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** is the entry spanned by colspan
|
|
|
|
* @return is true if the entry is spanned by a colspan
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsColSpan() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** is the entry spanned by a zero colspan
|
2010-04-27 09:15:01 -07:00
|
|
|
* zero colspans span all cells starting from the originating cell towards
|
|
|
|
* the end of the colgroup or a cell originating in the same row
|
2007-03-22 10:30:00 -07:00
|
|
|
* or a rowspanned entry
|
|
|
|
* @return is true if the entry is spanned by a zero colspan
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsZeroColSpan() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** mark the current entry as spanned by a zero colspan
|
|
|
|
* @param aIsZero if true mark the entry as covered by a zero colspan
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetZeroColSpan(bool aIsZero);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** get the distance from the current entry to the corresponding origin of the colspan
|
|
|
|
* @return containing the distance in the row to the originating cell
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t GetColSpanOffset() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** set the distance from the current entry to the corresponding origin of the colspan
|
|
|
|
* @param the distance in the column to the originating cell
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
void SetColSpanOffset(uint32_t aSpan);
|
2010-04-27 09:15:01 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/** is the entry spanned by a row- and a colspan
|
|
|
|
* @return is true if the entry is spanned by a row- and a colspan
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsOverlap() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** mark the current entry as spanned by a row- and a colspan
|
|
|
|
* @param aOverlap if true mark the entry as covered by a row- and a colspan
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetOverlap(bool aOverlap);
|
2010-04-27 09:15:01 -07:00
|
|
|
|
|
|
|
/** get the table cell frame for this entry
|
2012-07-30 07:20:58 -07:00
|
|
|
* @return a pointer to the cellframe, this will be nullptr when the entry
|
2007-03-22 10:30:00 -07:00
|
|
|
* is only a spanned entry
|
|
|
|
*/
|
|
|
|
nsTableCellFrame* GetCellFrame() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend class nsCellMap;
|
|
|
|
friend class BCCellData;
|
|
|
|
|
|
|
|
/** constructor.
|
2010-04-27 09:15:01 -07:00
|
|
|
* @param aOrigCell the table cell frame which will be stored in mOrigCell.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
|
|
|
CellData(nsTableCellFrame* aOrigCell); // implemented in nsCellMap.cpp
|
|
|
|
|
|
|
|
/** destructor */
|
|
|
|
~CellData(); // implemented in nsCellMap.cpp
|
2010-04-27 09:15:01 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
|
|
|
|
// this union relies on the assumption that an object (not primitive type) does
|
2010-04-27 09:15:01 -07:00
|
|
|
// not start on an odd bit boundary. If mSpan is 0 then mOrigCell is in effect
|
2007-03-22 10:30:00 -07:00
|
|
|
// and the data does not represent a span. If mSpan is 1, then mBits is in
|
|
|
|
// effect and the data represents a span.
|
2013-04-10 09:56:22 -07:00
|
|
|
// mBits must match the size of mOrigCell on both 32- and 64-bit platforms.
|
2007-03-22 10:30:00 -07:00
|
|
|
union {
|
|
|
|
nsTableCellFrame* mOrigCell;
|
2013-04-10 09:56:22 -07:00
|
|
|
uintptr_t mBits;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// Border Collapsing Cell Data
|
2010-04-27 09:15:01 -07:00
|
|
|
enum BCBorderOwner
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
eTableOwner = 0,
|
2010-04-27 09:15:01 -07:00
|
|
|
eColGroupOwner = 1,
|
|
|
|
eAjaColGroupOwner = 2, // col group to the left
|
2007-03-22 10:30:00 -07:00
|
|
|
eColOwner = 3,
|
|
|
|
eAjaColOwner = 4, // col to the left
|
2010-04-27 09:15:01 -07:00
|
|
|
eRowGroupOwner = 5,
|
2007-03-22 10:30:00 -07:00
|
|
|
eAjaRowGroupOwner = 6, // row group above
|
2010-04-27 09:15:01 -07:00
|
|
|
eRowOwner = 7,
|
2007-03-22 10:30:00 -07:00
|
|
|
eAjaRowOwner = 8, // row above
|
|
|
|
eCellOwner = 9,
|
|
|
|
eAjaCellOwner = 10 // cell to the top or to the left
|
|
|
|
};
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
typedef uint16_t BCPixelSize;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// These are the max sizes that are stored. If they are exceeded, then the max is stored and
|
|
|
|
// the actual value is computed when needed.
|
2012-10-19 19:01:43 -07:00
|
|
|
#define MAX_BORDER_WIDTH nscoord((1u << (sizeof(BCPixelSize) * 8)) - 1)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-07-08 17:16:52 -07:00
|
|
|
static inline nscoord
|
2012-08-22 08:56:38 -07:00
|
|
|
BC_BORDER_TOP_HALF_COORD(int32_t p2t, uint16_t px) { return (px - px / 2) * p2t; }
|
2010-07-08 17:16:52 -07:00
|
|
|
static inline nscoord
|
2012-08-22 08:56:38 -07:00
|
|
|
BC_BORDER_RIGHT_HALF_COORD(int32_t p2t, uint16_t px) { return ( px / 2) * p2t; }
|
2010-07-08 17:16:52 -07:00
|
|
|
static inline nscoord
|
2012-08-22 08:56:38 -07:00
|
|
|
BC_BORDER_BOTTOM_HALF_COORD(int32_t p2t, uint16_t px) { return ( px / 2) * p2t; }
|
2010-07-08 17:16:52 -07:00
|
|
|
static inline nscoord
|
2012-08-22 08:56:38 -07:00
|
|
|
BC_BORDER_LEFT_HALF_COORD(int32_t p2t, uint16_t px) { return (px - px / 2) * p2t; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#define BC_BORDER_TOP_HALF(px) ((px) - (px) / 2)
|
|
|
|
#define BC_BORDER_RIGHT_HALF(px) ((px) / 2)
|
|
|
|
#define BC_BORDER_BOTTOM_HALF(px) ((px) / 2)
|
|
|
|
#define BC_BORDER_LEFT_HALF(px) ((px) - (px) / 2)
|
|
|
|
|
|
|
|
// BCData stores the top and left border info and the corner connecting the two.
|
|
|
|
class BCData
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
BCData();
|
|
|
|
|
|
|
|
~BCData();
|
|
|
|
|
|
|
|
nscoord GetLeftEdge(BCBorderOwner& aOwner,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool& aStart) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void SetLeftEdge(BCBorderOwner aOwner,
|
|
|
|
nscoord aSize,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aStart);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nscoord GetTopEdge(BCBorderOwner& aOwner,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool& aStart) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void SetTopEdge(BCBorderOwner aOwner,
|
|
|
|
nscoord aSize,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aStart);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-04-27 09:15:02 -07:00
|
|
|
BCPixelSize GetCorner(mozilla::css::Side& aCornerOwner,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool& aBevel) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void SetCorner(BCPixelSize aSubSize,
|
2010-04-27 09:15:02 -07:00
|
|
|
mozilla::css::Side aOwner,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aBevel);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsLeftStart() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetLeftStart(bool aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsTopStart() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetTopStart(bool aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-04-27 09:15:01 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
BCPixelSize mLeftSize; // size in pixels of left border
|
|
|
|
BCPixelSize mTopSize; // size in pixels of top border
|
|
|
|
BCPixelSize mCornerSubSize; // size of the largest border not in the
|
|
|
|
// dominant plane (for example, if corner is
|
|
|
|
// owned by the segment to its top or bottom,
|
|
|
|
// then the size is the max of the border
|
|
|
|
// sizes of the segments to its left or right.
|
2010-04-27 09:15:01 -07:00
|
|
|
unsigned mLeftOwner: 4; // owner of left border
|
|
|
|
unsigned mTopOwner: 4; // owner of top border
|
2007-03-22 10:30:00 -07:00
|
|
|
unsigned mLeftStart: 1; // set if this is the start of a vertical border segment
|
|
|
|
unsigned mTopStart: 1; // set if this is the start of a horizontal border segment
|
2010-04-27 09:15:02 -07:00
|
|
|
unsigned mCornerSide: 2; // mozilla::css::Side of the owner of the upper left corner relative to the corner
|
2007-03-22 10:30:00 -07:00
|
|
|
unsigned mCornerBevel: 1; // is the corner beveled (only two segments, perpendicular, not dashed or dotted).
|
|
|
|
};
|
|
|
|
|
|
|
|
// BCCellData entries replace CellData entries in the cell map if the border collapsing model is in
|
2010-04-27 09:15:01 -07:00
|
|
|
// effect. BCData for a row and col entry contains the left and top borders of cell at that row and
|
2007-03-22 10:30:00 -07:00
|
|
|
// col and the corner connecting the two. The right borders of the cells in the last col and the bottom
|
|
|
|
// borders of the last row are stored in separate BCData entries in the cell map.
|
|
|
|
class BCCellData : public CellData
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
BCCellData(nsTableCellFrame* aOrigCell);
|
|
|
|
~BCCellData();
|
|
|
|
|
|
|
|
BCData mData;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-09-25 21:52:33 -07:00
|
|
|
// The layout of a celldata is as follows. The top 10 bits are the colspan
|
|
|
|
// offset (which is enough to represent our allowed values 1-1000 for colspan).
|
|
|
|
// Then there are three bits of flags. Then 16 bits of rowspan offset (which
|
|
|
|
// lets us represent numbers up to 65535. Then another 3 bits of flags.
|
|
|
|
|
|
|
|
// num bits to shift right to get right aligned col span
|
|
|
|
#define COL_SPAN_SHIFT 22
|
|
|
|
// num bits to shift right to get right aligned row span
|
|
|
|
#define ROW_SPAN_SHIFT 3
|
|
|
|
|
|
|
|
// the col offset to the data containing the original cell.
|
|
|
|
#define COL_SPAN_OFFSET (0x3FF << COL_SPAN_SHIFT)
|
|
|
|
// the row offset to the data containing the original cell
|
|
|
|
#define ROW_SPAN_OFFSET (0xFFFF << ROW_SPAN_SHIFT)
|
|
|
|
|
|
|
|
// And the flags
|
2010-04-27 09:15:01 -07:00
|
|
|
#define SPAN 0x00000001 // there a row or col span
|
2007-03-22 10:30:00 -07:00
|
|
|
#define ROW_SPAN 0x00000002 // there is a row span
|
|
|
|
#define ROW_SPAN_0 0x00000004 // the row span is 0
|
2011-09-25 21:52:33 -07:00
|
|
|
#define COL_SPAN (1 << (COL_SPAN_SHIFT - 3)) // there is a col span
|
|
|
|
#define COL_SPAN_0 (1 << (COL_SPAN_SHIFT - 2)) // the col span is 0
|
|
|
|
#define OVERLAP (1 << (COL_SPAN_SHIFT - 1)) // there is a row span and
|
|
|
|
// col span but not by
|
|
|
|
// same cell
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
inline nsTableCellFrame* CellData::GetCellFrame() const
|
|
|
|
{
|
|
|
|
if (SPAN != (SPAN & mBits)) {
|
|
|
|
return mOrigCell;
|
|
|
|
}
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2010-04-27 09:15:01 -07:00
|
|
|
inline void CellData::Init(nsTableCellFrame* aCellFrame)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
mOrigCell = aCellFrame;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool CellData::IsOrig() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-07-30 07:20:58 -07:00
|
|
|
return ((nullptr != mOrigCell) && (SPAN != (SPAN & mBits)));
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool CellData::IsDead() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return (0 == mBits);
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool CellData::IsSpan() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return (SPAN == (SPAN & mBits));
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool CellData::IsRowSpan() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2010-04-27 09:15:01 -07:00
|
|
|
return (SPAN == (SPAN & mBits)) &&
|
2007-03-22 10:30:00 -07:00
|
|
|
(ROW_SPAN == (ROW_SPAN & mBits));
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool CellData::IsZeroRowSpan() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2010-04-27 09:15:01 -07:00
|
|
|
return (SPAN == (SPAN & mBits)) &&
|
2007-03-22 10:30:00 -07:00
|
|
|
(ROW_SPAN == (ROW_SPAN & mBits)) &&
|
|
|
|
(ROW_SPAN_0 == (ROW_SPAN_0 & mBits));
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline void CellData::SetZeroRowSpan(bool aIsZeroSpan)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
if (SPAN == (SPAN & mBits)) {
|
|
|
|
if (aIsZeroSpan) {
|
|
|
|
mBits |= ROW_SPAN_0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
mBits &= ~ROW_SPAN_0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
inline uint32_t CellData::GetRowSpanOffset() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
if ((SPAN == (SPAN & mBits)) && ((ROW_SPAN == (ROW_SPAN & mBits)))) {
|
2012-08-22 08:56:38 -07:00
|
|
|
return (uint32_t)((mBits & ROW_SPAN_OFFSET) >> ROW_SPAN_SHIFT);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
inline void CellData::SetRowSpanOffset(uint32_t aSpan)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
mBits &= ~ROW_SPAN_OFFSET;
|
|
|
|
mBits |= (aSpan << ROW_SPAN_SHIFT);
|
|
|
|
mBits |= SPAN;
|
|
|
|
mBits |= ROW_SPAN;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool CellData::IsColSpan() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2010-04-27 09:15:01 -07:00
|
|
|
return (SPAN == (SPAN & mBits)) &&
|
2007-03-22 10:30:00 -07:00
|
|
|
(COL_SPAN == (COL_SPAN & mBits));
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool CellData::IsZeroColSpan() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2010-04-27 09:15:01 -07:00
|
|
|
return (SPAN == (SPAN & mBits)) &&
|
2007-03-22 10:30:00 -07:00
|
|
|
(COL_SPAN == (COL_SPAN & mBits)) &&
|
|
|
|
(COL_SPAN_0 == (COL_SPAN_0 & mBits));
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline void CellData::SetZeroColSpan(bool aIsZeroSpan)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
if (SPAN == (SPAN & mBits)) {
|
|
|
|
if (aIsZeroSpan) {
|
|
|
|
mBits |= COL_SPAN_0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
mBits &= ~COL_SPAN_0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
inline uint32_t CellData::GetColSpanOffset() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
if ((SPAN == (SPAN & mBits)) && ((COL_SPAN == (COL_SPAN & mBits)))) {
|
2012-08-22 08:56:38 -07:00
|
|
|
return (uint32_t)((mBits & COL_SPAN_OFFSET) >> COL_SPAN_SHIFT);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
inline void CellData::SetColSpanOffset(uint32_t aSpan)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
mBits &= ~COL_SPAN_OFFSET;
|
|
|
|
mBits |= (aSpan << COL_SPAN_SHIFT);
|
|
|
|
|
|
|
|
mBits |= SPAN;
|
|
|
|
mBits |= COL_SPAN;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool CellData::IsOverlap() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return (SPAN == (SPAN & mBits)) && (OVERLAP == (OVERLAP & mBits));
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline void CellData::SetOverlap(bool aOverlap)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
if (SPAN == (SPAN & mBits)) {
|
|
|
|
if (aOverlap) {
|
|
|
|
mBits |= OVERLAP;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
mBits &= ~OVERLAP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
inline BCData::BCData()
|
|
|
|
{
|
|
|
|
mLeftOwner = mTopOwner = eCellOwner;
|
|
|
|
mLeftStart = mTopStart = 1;
|
2010-04-27 09:15:02 -07:00
|
|
|
mLeftSize = mCornerSubSize = mTopSize = 0;
|
|
|
|
mCornerSide = NS_SIDE_TOP;
|
2011-10-17 07:59:28 -07:00
|
|
|
mCornerBevel = false;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
inline BCData::~BCData()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
inline nscoord BCData::GetLeftEdge(BCBorderOwner& aOwner,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool& aStart) const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
aOwner = (BCBorderOwner)mLeftOwner;
|
2011-09-28 23:19:26 -07:00
|
|
|
aStart = (bool)mLeftStart;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
return (nscoord)mLeftSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void BCData::SetLeftEdge(BCBorderOwner aOwner,
|
|
|
|
nscoord aSize,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aStart)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
mLeftOwner = aOwner;
|
|
|
|
mLeftSize = (aSize > MAX_BORDER_WIDTH) ? MAX_BORDER_WIDTH : aSize;
|
|
|
|
mLeftStart = aStart;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline nscoord BCData::GetTopEdge(BCBorderOwner& aOwner,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool& aStart) const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
aOwner = (BCBorderOwner)mTopOwner;
|
2011-09-28 23:19:26 -07:00
|
|
|
aStart = (bool)mTopStart;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
return (nscoord)mTopSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void BCData::SetTopEdge(BCBorderOwner aOwner,
|
|
|
|
nscoord aSize,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aStart)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
mTopOwner = aOwner;
|
|
|
|
mTopSize = (aSize > MAX_BORDER_WIDTH) ? MAX_BORDER_WIDTH : aSize;
|
|
|
|
mTopStart = aStart;
|
|
|
|
}
|
|
|
|
|
2010-04-27 09:15:02 -07:00
|
|
|
inline BCPixelSize BCData::GetCorner(mozilla::css::Side& aOwnerSide,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool& aBevel) const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2010-04-27 09:15:02 -07:00
|
|
|
aOwnerSide = mozilla::css::Side(mCornerSide);
|
2011-09-28 23:19:26 -07:00
|
|
|
aBevel = (bool)mCornerBevel;
|
2007-03-22 10:30:00 -07:00
|
|
|
return mCornerSubSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void BCData::SetCorner(BCPixelSize aSubSize,
|
2010-04-27 09:15:02 -07:00
|
|
|
mozilla::css::Side aOwnerSide,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aBevel)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
mCornerSubSize = aSubSize;
|
|
|
|
mCornerSide = aOwnerSide;
|
|
|
|
mCornerBevel = aBevel;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool BCData::IsLeftStart() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-09-28 23:19:26 -07:00
|
|
|
return (bool)mLeftStart;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline void BCData::SetLeftStart(bool aValue)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
mLeftStart = aValue;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool BCData::IsTopStart() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-09-28 23:19:26 -07:00
|
|
|
return (bool)mTopStart;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline void BCData::SetTopStart(bool aValue)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
mTopStart = aValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|