2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 14:30:37 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-04-13 20:24:54 +00:00
|
|
|
*
|
2004-04-18 14:30:37 +00:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1998-04-13 20:24:54 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1998-04-13 20:24:54 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 14:30:37 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-28 20:14:13 +00:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 03:40:37 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Contributor(s):
|
2000-02-02 22:24:56 +00:00
|
|
|
* Pierre Phaneuf <pp@ludusdesign.com>
|
2001-09-28 20:14:13 +00:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 14:30:37 +00:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-28 20:14:13 +00:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-18 14:30:37 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-28 20:14:13 +00:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-18 14:30:37 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-28 20:14:13 +00:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-12-14 00:24:33 +00:00
|
|
|
#include "nsTableFrame.h"
|
1999-01-03 19:22:40 +00:00
|
|
|
#include "nsTableColFrame.h"
|
1999-12-14 00:24:33 +00:00
|
|
|
#include "nsTableCellFrame.h"
|
1998-11-11 19:56:02 +00:00
|
|
|
#include "nsTableFrame.h"
|
2001-11-29 15:41:07 +00:00
|
|
|
#include "nsTableRowGroupFrame.h"
|
2004-03-09 06:48:35 +00:00
|
|
|
#include "nsTablePainter.h"
|
2002-05-10 18:22:41 +00:00
|
|
|
#include "nsReflowPath.h"
|
2003-02-22 00:32:13 +00:00
|
|
|
#include "nsStyleContext.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsStyleConsts.h"
|
2004-07-31 23:15:21 +00:00
|
|
|
#include "nsPresContext.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsIRenderingContext.h"
|
|
|
|
#include "nsCSSRendering.h"
|
|
|
|
#include "nsIContent.h"
|
2005-01-12 19:45:38 +00:00
|
|
|
#include "nsGenericHTMLElement.h"
|
1998-10-06 00:44:35 +00:00
|
|
|
#include "nsHTMLParts.h"
|
1998-05-01 20:44:55 +00:00
|
|
|
#include "nsHTMLAtoms.h"
|
1998-05-21 23:43:18 +00:00
|
|
|
#include "nsIView.h"
|
1999-02-24 05:54:31 +00:00
|
|
|
#include "nsLayoutAtoms.h"
|
1999-10-22 02:06:22 +00:00
|
|
|
#include "nsIPresShell.h"
|
1999-07-28 08:09:02 +00:00
|
|
|
#include "nsCOMPtr.h"
|
1999-09-30 14:11:16 +00:00
|
|
|
#include "nsIDOMHTMLTableCellElement.h"
|
2001-08-17 03:13:07 +00:00
|
|
|
#ifdef ACCESSIBILITY
|
2001-04-01 01:01:33 +00:00
|
|
|
#include "nsIAccessibilityService.h"
|
2001-08-17 03:13:07 +00:00
|
|
|
#endif
|
2001-04-01 01:01:33 +00:00
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
#include "nsIDOMNode.h"
|
2001-09-21 13:43:18 +00:00
|
|
|
#include "nsINameSpaceManager.h"
|
2006-01-26 02:29:17 +00:00
|
|
|
#include "nsDisplayList.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2000-04-13 20:21:32 +00:00
|
|
|
//TABLECELL SELECTION
|
|
|
|
#include "nsIFrameSelection.h"
|
2000-04-13 22:39:39 +00:00
|
|
|
#include "nsILookAndFeel.h"
|
2000-04-13 20:21:32 +00:00
|
|
|
|
1998-06-23 23:23:21 +00:00
|
|
|
|
2000-01-04 05:31:56 +00:00
|
|
|
nsTableCellFrame::nsTableCellFrame()
|
|
|
|
{
|
2002-03-16 21:46:29 +00:00
|
|
|
mBits.mColIndex = 0;
|
2000-01-04 05:31:56 +00:00
|
|
|
mPriorAvailWidth = 0;
|
2002-03-16 21:46:29 +00:00
|
|
|
|
|
|
|
SetContentEmpty(PR_FALSE);
|
|
|
|
SetNeedSpecialReflow(PR_FALSE);
|
|
|
|
SetHadSpecialReflow(PR_FALSE);
|
|
|
|
SetHasPctOverHeight(PR_FALSE);
|
2002-05-09 14:44:02 +00:00
|
|
|
SetNeedPass2Reflow(PR_TRUE);
|
2002-03-16 21:46:29 +00:00
|
|
|
|
2001-01-25 15:55:51 +00:00
|
|
|
#ifdef DEBUG_TABLE_REFLOW_TIMING
|
|
|
|
mTimer = new nsReflowTimer(this);
|
|
|
|
mBlockTimer = new nsReflowTimer(this);
|
|
|
|
#endif
|
2000-01-04 05:31:56 +00:00
|
|
|
}
|
|
|
|
|
1999-10-17 03:30:11 +00:00
|
|
|
nsTableCellFrame::~nsTableCellFrame()
|
|
|
|
{
|
2001-01-25 15:55:51 +00:00
|
|
|
#ifdef DEBUG_TABLE_REFLOW_TIMING
|
|
|
|
nsTableFrame::DebugReflowDone(this);
|
|
|
|
#endif
|
1999-10-17 03:30:11 +00:00
|
|
|
}
|
|
|
|
|
2001-11-05 00:15:51 +00:00
|
|
|
nsTableCellFrame*
|
|
|
|
nsTableCellFrame::GetNextCell() const
|
|
|
|
{
|
2003-07-07 02:01:29 +00:00
|
|
|
nsIFrame* childFrame = GetNextSibling();
|
2001-11-05 00:15:51 +00:00
|
|
|
while (childFrame) {
|
2003-10-31 20:19:18 +00:00
|
|
|
if (IS_TABLE_CELL(childFrame->GetType())) {
|
2001-11-05 00:15:51 +00:00
|
|
|
return (nsTableCellFrame*)childFrame;
|
|
|
|
}
|
2003-07-07 02:01:29 +00:00
|
|
|
childFrame = childFrame->GetNextSibling();
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
|
1999-02-25 05:31:15 +00:00
|
|
|
NS_IMETHODIMP
|
2006-03-09 18:55:21 +00:00
|
|
|
nsTableCellFrame::Init(nsIContent* aContent,
|
1999-02-25 05:31:15 +00:00
|
|
|
nsIFrame* aParent,
|
2003-02-22 00:32:13 +00:00
|
|
|
nsStyleContext* aContext,
|
1999-02-25 05:31:15 +00:00
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
// Let the base class do its initialization
|
2006-03-09 18:55:21 +00:00
|
|
|
rv = nsHTMLContainerFrame::Init(aContent, aParent, aContext, aPrevInFlow);
|
1999-02-25 05:31:15 +00:00
|
|
|
|
|
|
|
if (aPrevInFlow) {
|
|
|
|
// Set the column index
|
|
|
|
nsTableCellFrame* cellFrame = (nsTableCellFrame*)aPrevInFlow;
|
1999-12-13 22:56:31 +00:00
|
|
|
PRInt32 colIndex;
|
|
|
|
cellFrame->GetColIndex(colIndex);
|
2004-04-21 15:49:29 +00:00
|
|
|
SetColIndex(colIndex);
|
1999-02-25 05:31:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
2001-12-07 14:51:12 +00:00
|
|
|
|
|
|
|
// nsIPercentHeightObserver methods
|
|
|
|
|
2002-04-10 21:32:41 +00:00
|
|
|
void
|
2001-12-07 14:51:12 +00:00
|
|
|
nsTableCellFrame::NotifyPercentHeight(const nsHTMLReflowState& aReflowState)
|
|
|
|
{
|
2002-04-06 22:42:39 +00:00
|
|
|
if (!NeedSpecialReflow()) {
|
2001-12-07 14:51:12 +00:00
|
|
|
// Only initiate a special reflow if we will be able to construct a computed height
|
|
|
|
// on the cell that will result in the frame getting a computed height. This can only
|
2002-04-01 06:46:17 +00:00
|
|
|
// happen (but not sufficient) if there is no computed height already set between the
|
2001-12-07 14:51:12 +00:00
|
|
|
// initiating frame and the cell.
|
|
|
|
for (const nsHTMLReflowState* rs = aReflowState.parentReflowState; rs; rs = rs->parentReflowState) {
|
|
|
|
if ((NS_UNCONSTRAINEDSIZE != rs->mComputedHeight) && (0 != rs->mComputedHeight)) {
|
2002-04-10 21:32:41 +00:00
|
|
|
return;
|
2001-12-07 14:51:12 +00:00
|
|
|
}
|
|
|
|
// stop when we reach the cell frame
|
|
|
|
if (rs->frame == this) {
|
2002-04-01 06:46:17 +00:00
|
|
|
nsTableFrame::RequestSpecialHeightReflow(*rs);
|
2002-04-10 21:32:41 +00:00
|
|
|
return;
|
2001-12-07 14:51:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
NS_ASSERTION(PR_FALSE, "program error in NotifyPercentHeight");
|
|
|
|
}
|
2002-04-10 21:32:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// The cell needs to observe its block and things inside its block but nothing below that
|
|
|
|
PRBool
|
|
|
|
nsTableCellFrame::NeedsToObserve(const nsHTMLReflowState& aReflowState)
|
|
|
|
{
|
|
|
|
PRBool result = PR_FALSE;
|
|
|
|
const nsHTMLReflowState* parentRS = aReflowState.parentReflowState;
|
|
|
|
if (parentRS && (parentRS->mPercentHeightObserver == this)) { // cell observes the parent
|
|
|
|
result = PR_TRUE;
|
|
|
|
parentRS = parentRS->parentReflowState;
|
|
|
|
if (parentRS && (parentRS->mPercentHeightObserver == this)) { // cell observers the grand parent
|
|
|
|
parentRS = parentRS->parentReflowState;
|
|
|
|
if (parentRS && (parentRS->mPercentHeightObserver == this)) {
|
|
|
|
// cell observes the great grand parent, so we have gone too deep
|
|
|
|
result = PR_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
2001-12-07 14:51:12 +00:00
|
|
|
}
|
1999-02-25 05:31:15 +00:00
|
|
|
|
2001-04-16 14:51:52 +00:00
|
|
|
nsresult
|
|
|
|
nsTableCellFrame::GetRowIndex(PRInt32 &aRowIndex) const
|
|
|
|
{
|
|
|
|
nsresult result;
|
2003-07-07 02:01:29 +00:00
|
|
|
nsTableRowFrame* row = NS_STATIC_CAST(nsTableRowFrame*, GetParent());
|
2001-04-16 14:51:52 +00:00
|
|
|
if (row) {
|
|
|
|
aRowIndex = row->GetRowIndex();
|
|
|
|
result = NS_OK;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
aRowIndex = 0;
|
|
|
|
result = NS_ERROR_NOT_INITIALIZED;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsTableCellFrame::GetColIndex(PRInt32 &aColIndex) const
|
|
|
|
{
|
2006-02-21 21:33:47 +00:00
|
|
|
if (GetPrevInFlow()) {
|
2001-04-16 14:51:52 +00:00
|
|
|
return ((nsTableCellFrame*)GetFirstInFlow())->GetColIndex(aColIndex);
|
|
|
|
}
|
|
|
|
else {
|
2001-12-07 14:51:12 +00:00
|
|
|
aColIndex = mBits.mColIndex;
|
2001-04-16 14:51:52 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-01-04 05:31:56 +00:00
|
|
|
NS_IMETHODIMP
|
2005-09-07 16:49:21 +00:00
|
|
|
nsTableCellFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
2000-01-04 05:31:56 +00:00
|
|
|
nsIAtom* aAttribute,
|
2003-07-11 21:16:12 +00:00
|
|
|
PRInt32 aModType)
|
2000-01-04 05:31:56 +00:00
|
|
|
{
|
|
|
|
// let the table frame decide what to do
|
2006-03-04 05:26:57 +00:00
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
|
|
|
if (tableFrame) {
|
2005-09-07 16:49:21 +00:00
|
|
|
tableFrame->AttributeChangedFor(this, mContent, aAttribute);
|
2000-01-04 05:31:56 +00:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-11-30 15:05:51 +00:00
|
|
|
void nsTableCellFrame::SetPass1MaxElementWidth(nscoord aMaxWidth,
|
|
|
|
nscoord aMaxElementWidth)
|
1999-09-30 14:11:16 +00:00
|
|
|
{
|
2001-11-30 15:05:51 +00:00
|
|
|
nscoord maxElemWidth = aMaxElementWidth;
|
2005-03-06 18:33:12 +00:00
|
|
|
if (eCompatibility_NavQuirks == GetPresContext()->CompatibilityMode()) {
|
|
|
|
// check for fixed width and not nowrap and not pre
|
|
|
|
const nsStylePosition* stylePosition = GetStylePosition();
|
|
|
|
if (stylePosition->mWidth.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
if (GetContent()->HasAttr(kNameSpaceID_None, nsHTMLAtoms::nowrap)) {
|
|
|
|
// set the max element size to the value of the fixed width (NAV/IE quirk)
|
|
|
|
maxElemWidth = NS_MAX(maxElemWidth, stylePosition->mWidth.GetCoordValue());
|
|
|
|
}
|
2001-09-21 13:43:18 +00:00
|
|
|
}
|
|
|
|
}
|
2001-11-30 15:05:51 +00:00
|
|
|
mPass1MaxElementWidth = maxElemWidth;
|
1999-09-30 14:11:16 +00:00
|
|
|
}
|
|
|
|
|
1999-08-01 22:21:03 +00:00
|
|
|
NS_IMETHODIMP
|
2005-02-07 01:58:25 +00:00
|
|
|
nsTableCellFrame::AppendFrames(nsIAtom* aListName,
|
1999-08-01 22:21:03 +00:00
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(PR_FALSE, "unsupported operation");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-02-07 01:58:25 +00:00
|
|
|
nsTableCellFrame::InsertFrames(nsIAtom* aListName,
|
1999-08-01 22:21:03 +00:00
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(PR_FALSE, "unsupported operation");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-02-07 01:58:25 +00:00
|
|
|
nsTableCellFrame::RemoveFrame(nsIAtom* aListName,
|
1999-08-01 22:21:03 +00:00
|
|
|
nsIFrame* aOldFrame)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(PR_FALSE, "unsupported operation");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2004-04-21 15:49:29 +00:00
|
|
|
void nsTableCellFrame::SetColIndex(PRInt32 aColIndex)
|
1999-07-28 08:09:02 +00:00
|
|
|
{
|
2001-12-07 14:51:12 +00:00
|
|
|
mBits.mColIndex = aColIndex;
|
1999-07-28 08:09:02 +00:00
|
|
|
}
|
|
|
|
|
2001-05-03 23:57:08 +00:00
|
|
|
|
|
|
|
//ASSURE DIFFERENT COLORS for selection
|
|
|
|
inline nscolor EnsureDifferentColors(nscolor colorA, nscolor colorB)
|
|
|
|
{
|
|
|
|
if (colorA == colorB)
|
|
|
|
{
|
|
|
|
nscolor res;
|
|
|
|
res = NS_RGB(NS_GET_R(colorA) ^ 0xff,
|
|
|
|
NS_GET_G(colorA) ^ 0xff,
|
|
|
|
NS_GET_B(colorA) ^ 0xff);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
return colorA;
|
|
|
|
}
|
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
void
|
|
|
|
nsTableCellFrame::DecorateForSelection(nsIRenderingContext& aRenderingContext,
|
|
|
|
nsPoint aPt)
|
2001-05-03 23:57:08 +00:00
|
|
|
{
|
2006-01-26 02:29:17 +00:00
|
|
|
NS_ASSERTION(GetStateBits() & NS_FRAME_SELECTED_CONTENT,
|
|
|
|
"Should only be called for selected cells");
|
2001-05-03 23:57:08 +00:00
|
|
|
PRInt16 displaySelection;
|
2006-01-26 02:29:17 +00:00
|
|
|
nsPresContext* presContext = GetPresContext();
|
|
|
|
displaySelection = DisplaySelection(presContext);
|
2001-05-03 23:57:08 +00:00
|
|
|
if (displaySelection) {
|
2006-01-26 02:29:17 +00:00
|
|
|
nsIFrameSelection *frameSelection =
|
|
|
|
presContext->PresShell()->FrameSelection();
|
|
|
|
|
|
|
|
PRBool tableCellSelectionMode;
|
|
|
|
nsresult result =
|
|
|
|
frameSelection->GetTableCellSelection(&tableCellSelectionMode);
|
|
|
|
if (NS_SUCCEEDED(result) && tableCellSelectionMode) {
|
|
|
|
nscolor bordercolor;
|
|
|
|
if (displaySelection == nsISelectionController::SELECTION_DISABLED) {
|
|
|
|
bordercolor = NS_RGB(176,176,176);// disabled color
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
presContext->LookAndFeel()->
|
|
|
|
GetColor(nsILookAndFeel::eColor_TextSelectBackground,
|
|
|
|
bordercolor);
|
|
|
|
}
|
|
|
|
GET_PIXELS_TO_TWIPS(presContext, p2t);
|
|
|
|
if ((mRect.width >(3*p2t)) && (mRect.height > (3*p2t)))
|
|
|
|
{
|
|
|
|
//compare bordercolor to ((nsStyleColor *)myColor)->mBackgroundColor)
|
|
|
|
bordercolor = EnsureDifferentColors(bordercolor,
|
|
|
|
GetStyleBackground()->mBackgroundColor);
|
|
|
|
nsIRenderingContext::AutoPushTranslation
|
|
|
|
translate(&aRenderingContext, aPt.x, aPt.y);
|
|
|
|
nscoord onePixel = NSToCoordRound(p2t);
|
|
|
|
|
|
|
|
aRenderingContext.SetColor(bordercolor);
|
|
|
|
aRenderingContext.DrawLine(onePixel, 0, mRect.width, 0);
|
|
|
|
aRenderingContext.DrawLine(0, onePixel, 0, mRect.height);
|
|
|
|
aRenderingContext.DrawLine(onePixel, mRect.height, mRect.width, mRect.height);
|
|
|
|
aRenderingContext.DrawLine(mRect.width, onePixel, mRect.width, mRect.height);
|
|
|
|
//middle
|
|
|
|
aRenderingContext.DrawRect(onePixel, onePixel, mRect.width-onePixel,
|
|
|
|
mRect.height-onePixel);
|
|
|
|
//shading
|
|
|
|
aRenderingContext.DrawLine(2*onePixel, mRect.height-2*onePixel,
|
|
|
|
mRect.width-onePixel, mRect.height- (2*onePixel));
|
|
|
|
aRenderingContext.DrawLine(mRect.width - (2*onePixel), 2*onePixel,
|
|
|
|
mRect.width - (2*onePixel), mRect.height-onePixel);
|
2001-05-03 23:57:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-03-07 15:23:08 +00:00
|
|
|
void
|
2006-01-26 02:29:17 +00:00
|
|
|
nsTableCellFrame::PaintBackground(nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsPoint aPt)
|
2002-03-07 15:23:08 +00:00
|
|
|
{
|
2006-01-26 02:29:17 +00:00
|
|
|
nsRect rect(aPt, GetSize());
|
|
|
|
nsCSSRendering::PaintBackground(GetPresContext(), aRenderingContext, this,
|
|
|
|
aDirtyRect, rect, *GetStyleBorder(),
|
|
|
|
*GetStylePadding(), PR_TRUE);
|
2002-03-07 15:23:08 +00:00
|
|
|
}
|
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
// Called by nsTablePainter
|
|
|
|
void
|
|
|
|
nsTableCellFrame::PaintCellBackground(nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect, nsPoint aPt)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2006-01-26 02:29:17 +00:00
|
|
|
if (!GetStyleVisibility()->IsVisible())
|
|
|
|
return;
|
|
|
|
if (GetContentEmpty() &&
|
|
|
|
NS_STYLE_TABLE_EMPTY_CELLS_HIDE == GetStyleTableBorder()->mEmptyCells)
|
|
|
|
return;
|
2002-02-26 00:27:42 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
PaintBackground(aRenderingContext, aDirtyRect, aPt);
|
|
|
|
}
|
2002-03-07 15:23:08 +00:00
|
|
|
|
2006-01-29 18:48:58 +00:00
|
|
|
MOZ_DECL_CTOR_COUNTER(nsDisplayTableCellBackground)
|
2006-01-26 02:29:17 +00:00
|
|
|
class nsDisplayTableCellBackground : public nsDisplayItem {
|
|
|
|
public:
|
2006-03-14 20:43:18 +00:00
|
|
|
nsDisplayTableCellBackground(nsTableCellFrame* aFrame) : nsDisplayItem(aFrame) {
|
2006-01-29 18:48:58 +00:00
|
|
|
MOZ_COUNT_CTOR(nsDisplayTableCellBackground);
|
|
|
|
}
|
|
|
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
|
|
|
virtual ~nsDisplayTableCellBackground() {
|
|
|
|
MOZ_COUNT_DTOR(nsDisplayTableCellBackground);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
virtual nsIFrame* HitTest(nsDisplayListBuilder* aBuilder, nsPoint aPt) { return mFrame; }
|
|
|
|
virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx,
|
|
|
|
const nsRect& aDirtyRect);
|
|
|
|
NS_DISPLAY_DECL_NAME("TableCellBackground")
|
|
|
|
};
|
|
|
|
|
|
|
|
void nsDisplayTableCellBackground::Paint(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsIRenderingContext* aCtx, const nsRect& aDirtyRect)
|
|
|
|
{
|
2006-03-14 20:43:18 +00:00
|
|
|
NS_STATIC_CAST(nsTableCellFrame*, mFrame)->
|
|
|
|
PaintBackground(*aCtx, aDirtyRect, aBuilder->ToReferenceFrame(mFrame));
|
2006-01-26 02:29:17 +00:00
|
|
|
}
|
1998-05-26 23:17:29 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
static void
|
|
|
|
PaintTableCellSelection(nsIFrame* aFrame, nsIRenderingContext* aCtx,
|
|
|
|
const nsRect& aRect, nsPoint aPt)
|
|
|
|
{
|
|
|
|
NS_STATIC_CAST(nsTableCellFrame*, aFrame)->DecorateForSelection(*aCtx, aPt);
|
|
|
|
}
|
2002-02-26 00:27:42 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
|
|
|
{
|
|
|
|
if (!IsVisibleInSelection(aBuilder))
|
|
|
|
return NS_OK;
|
2004-11-11 15:07:22 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
PRInt32 emptyCellStyle = GetContentEmpty() ? GetStyleTableBorder()->mEmptyCells
|
|
|
|
: NS_STYLE_TABLE_EMPTY_CELLS_SHOW;
|
|
|
|
// take account of 'empty-cells'
|
|
|
|
if (GetStyleVisibility()->IsVisible() &&
|
|
|
|
(NS_STYLE_TABLE_EMPTY_CELLS_HIDE != emptyCellStyle)) {
|
2006-03-04 05:26:57 +00:00
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
2006-01-26 02:29:17 +00:00
|
|
|
|
|
|
|
// display background if we need to. Note that we don't try to display
|
|
|
|
// a background item to catch events; our anonymous inner block will catch
|
|
|
|
// events for us.
|
|
|
|
if (!tableFrame->IsBorderCollapse() ||
|
|
|
|
aBuilder->IsAtRootOfPseudoStackingContext()) {
|
|
|
|
// The cell background was not painted by the nsTablePainter,
|
|
|
|
// so we need to do it. We have special background processing here
|
|
|
|
// so we need to duplicate some code from nsFrame::DisplayBorderBackgroundOutline
|
|
|
|
if (!GetStyleBackground()->IsTransparent() ||
|
|
|
|
GetStyleDisplay()->mAppearance) {
|
|
|
|
nsresult rv = aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
|
|
|
|
nsDisplayTableCellBackground(this));
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// display borders if we need to
|
|
|
|
if (!tableFrame->IsBorderCollapse() && HasBorder() &&
|
|
|
|
emptyCellStyle == NS_STYLE_TABLE_EMPTY_CELLS_SHOW) {
|
|
|
|
nsresult rv = aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
|
|
|
|
nsDisplayBorder(this));
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
1998-07-27 07:37:57 +00:00
|
|
|
}
|
2004-03-09 06:48:35 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
// and display the selection border if we need to
|
|
|
|
PRBool isSelected =
|
|
|
|
(GetStateBits() & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT;
|
|
|
|
if (isSelected) {
|
|
|
|
nsresult rv = aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
|
|
|
|
nsDisplayGeneric(this, ::PaintTableCellSelection, "TableCellSelection"));
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
}
|
1998-05-26 23:17:29 +00:00
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
// the 'empty-cells' property has no effect on 'outline'
|
|
|
|
nsresult rv = DisplayOutline(aBuilder, aLists);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
PRBool quirkyClip = HasPctOverHeight() &&
|
|
|
|
eCompatibility_NavQuirks == GetPresContext()->CompatibilityMode();
|
|
|
|
nsIFrame* kid = mFrames.FirstChild();
|
|
|
|
NS_ASSERTION(kid && !kid->GetNextSibling(), "Table cells should have just one child");
|
2006-03-04 05:26:57 +00:00
|
|
|
if (!quirkyClip) {
|
2006-01-26 02:29:17 +00:00
|
|
|
// The child's background will go in our BorderBackground() list.
|
|
|
|
// This isn't a problem since it won't have a real background except for
|
|
|
|
// event handling. We do not call BuildDisplayListForNonBlockChildren
|
|
|
|
// because that/ would put the child's background in the Content() list
|
|
|
|
// which isn't right (e.g., would end up on top of our child floats for
|
|
|
|
// event handling).
|
|
|
|
return BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aLists);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
2006-01-26 02:29:17 +00:00
|
|
|
|
|
|
|
// Unfortunately there is some wacky clipping to do
|
|
|
|
nsDisplayListCollection set;
|
|
|
|
rv = BuildDisplayListForChild(aBuilder, kid, aDirtyRect, set);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
nsRect clip = GetOverflowRect();
|
|
|
|
if (quirkyClip) {
|
|
|
|
clip = nsRect(nsPoint(0, 0), GetSize());
|
|
|
|
}
|
|
|
|
return OverflowClip(aBuilder, set, aLists, clip + aBuilder->ToReferenceFrame(this));
|
2000-03-22 02:43:08 +00:00
|
|
|
}
|
|
|
|
|
1999-06-01 23:04:13 +00:00
|
|
|
//null range means the whole thing
|
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableCellFrame::SetSelected(nsPresContext* aPresContext,
|
2001-03-13 06:38:59 +00:00
|
|
|
nsIDOMRange* aRange,
|
|
|
|
PRBool aSelected,
|
|
|
|
nsSpread aSpread)
|
1999-06-01 23:04:13 +00:00
|
|
|
{
|
|
|
|
//traverse through children unselect tables
|
1999-09-21 22:58:14 +00:00
|
|
|
#if 0
|
1999-09-17 23:33:39 +00:00
|
|
|
if ((aSpread == eSpreadDown)){
|
2004-01-09 14:20:53 +00:00
|
|
|
nsIFrame* kid = GetFirstChild(nsnull);
|
1999-06-01 23:04:13 +00:00
|
|
|
while (nsnull != kid) {
|
2003-07-07 02:01:29 +00:00
|
|
|
kid->SetSelected(nsnull, aSelected, eSpreadDown);
|
|
|
|
kid = kid->GetNextSibling();
|
1999-06-01 23:04:13 +00:00
|
|
|
}
|
|
|
|
}
|
1999-09-21 22:58:14 +00:00
|
|
|
//return nsFrame::SetSelected(aRange,aSelected,eSpreadNone);
|
|
|
|
#endif
|
2000-03-21 06:04:02 +00:00
|
|
|
// Must call base class to set mSelected state and trigger repaint of frame
|
|
|
|
// Note that in current version, aRange and aSpread are ignored,
|
|
|
|
// only this frame is considered
|
|
|
|
nsFrame::SetSelected(aPresContext, aRange, aSelected, aSpread);
|
2000-04-30 18:56:26 +00:00
|
|
|
|
2004-08-29 03:08:44 +00:00
|
|
|
PRBool tableCellSelectionMode;
|
|
|
|
nsresult result = aPresContext->PresShell()->FrameSelection()->GetTableCellSelection(&tableCellSelectionMode);
|
|
|
|
if (NS_SUCCEEDED(result) && tableCellSelectionMode) {
|
|
|
|
// Selection can affect content, border and outline
|
|
|
|
Invalidate(GetOverflowRect(), PR_FALSE);
|
2000-04-30 18:56:26 +00:00
|
|
|
}
|
1999-09-21 22:58:14 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-20 17:45:07 +00:00
|
|
|
PRIntn
|
|
|
|
nsTableCellFrame::GetSkipSides() const
|
|
|
|
{
|
|
|
|
PRIntn skip = 0;
|
2006-02-21 21:33:47 +00:00
|
|
|
if (nsnull != GetPrevInFlow()) {
|
1998-10-20 17:45:07 +00:00
|
|
|
skip |= 1 << NS_SIDE_TOP;
|
|
|
|
}
|
2006-02-21 21:33:47 +00:00
|
|
|
if (nsnull != GetNextInFlow()) {
|
1998-10-20 17:45:07 +00:00
|
|
|
skip |= 1 << NS_SIDE_BOTTOM;
|
|
|
|
}
|
|
|
|
return skip;
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-06-01 23:04:13 +00:00
|
|
|
PRBool nsTableCellFrame::ParentDisablesSelection() const //override default behavior
|
|
|
|
{
|
|
|
|
PRBool returnval;
|
|
|
|
if (NS_FAILED(GetSelected(&returnval)))
|
|
|
|
return PR_FALSE;
|
|
|
|
if (returnval)
|
|
|
|
return PR_TRUE;
|
|
|
|
return nsFrame::ParentDisablesSelection();
|
|
|
|
}
|
|
|
|
|
2005-03-18 02:15:44 +00:00
|
|
|
/* virtual */ void
|
|
|
|
nsTableCellFrame::GetSelfOverflow(nsRect& aOverflowArea)
|
|
|
|
{
|
|
|
|
aOverflowArea = nsRect(nsPoint(0,0), GetSize());
|
|
|
|
}
|
1998-12-21 06:38:18 +00:00
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
// Align the cell's child frame within the cell
|
2001-04-01 01:01:33 +00:00
|
|
|
|
2005-02-07 01:58:25 +00:00
|
|
|
void nsTableCellFrame::VerticallyAlignChild(const nsHTMLReflowState& aReflowState,
|
2000-06-05 08:25:11 +00:00
|
|
|
nscoord aMaxAscent)
|
1998-04-25 18:48:48 +00:00
|
|
|
{
|
2003-05-15 03:42:21 +00:00
|
|
|
const nsStyleTextReset* textStyle = GetStyleTextReset();
|
1998-12-23 15:47:43 +00:00
|
|
|
/* XXX: remove tableFrame when border-collapse inherits */
|
2005-02-07 01:58:25 +00:00
|
|
|
nsPresContext* presContext = GetPresContext();
|
|
|
|
GET_PIXELS_TO_TWIPS(presContext, p2t);
|
2003-03-21 19:35:36 +00:00
|
|
|
nsMargin borderPadding = nsTableFrame::GetBorderPadding(aReflowState, p2t, this);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-07-28 08:09:02 +00:00
|
|
|
nscoord topInset = borderPadding.top;
|
|
|
|
nscoord bottomInset = borderPadding.bottom;
|
2000-07-28 09:19:26 +00:00
|
|
|
|
2000-06-05 08:25:11 +00:00
|
|
|
// As per bug 10207, we map 'sub', 'super', 'text-top', 'text-bottom',
|
|
|
|
// length and percentage values to 'baseline'
|
|
|
|
// XXX It seems that we don't get to see length and percentage values here
|
|
|
|
// because the Style System has already fixed the error and mapped them
|
|
|
|
// to whatever is inherited from the parent, i.e, 'middle' in most cases.
|
|
|
|
PRUint8 verticalAlignFlags = NS_STYLE_VERTICAL_ALIGN_BASELINE;
|
|
|
|
if (textStyle->mVerticalAlign.GetUnit() == eStyleUnit_Enumerated) {
|
|
|
|
verticalAlignFlags = textStyle->mVerticalAlign.GetIntValue();
|
|
|
|
if (verticalAlignFlags != NS_STYLE_VERTICAL_ALIGN_TOP &&
|
|
|
|
verticalAlignFlags != NS_STYLE_VERTICAL_ALIGN_MIDDLE &&
|
|
|
|
verticalAlignFlags != NS_STYLE_VERTICAL_ALIGN_BOTTOM)
|
|
|
|
{
|
|
|
|
verticalAlignFlags = NS_STYLE_VERTICAL_ALIGN_BASELINE;
|
|
|
|
}
|
2000-07-28 09:19:26 +00:00
|
|
|
}
|
2000-06-05 08:25:11 +00:00
|
|
|
|
1999-07-28 08:09:02 +00:00
|
|
|
nscoord height = mRect.height;
|
|
|
|
nsIFrame* firstKid = mFrames.FirstChild();
|
2004-11-06 07:07:43 +00:00
|
|
|
NS_ASSERTION(firstKid, "Frame construction error, a table cell always has an inner cell frame");
|
2003-07-07 02:01:29 +00:00
|
|
|
nsRect kidRect = firstKid->GetRect();
|
1999-07-28 08:09:02 +00:00
|
|
|
nscoord childHeight = kidRect.height;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-07-28 08:09:02 +00:00
|
|
|
// Vertically align the child
|
|
|
|
nscoord kidYTop = 0;
|
|
|
|
switch (verticalAlignFlags)
|
|
|
|
{
|
|
|
|
case NS_STYLE_VERTICAL_ALIGN_BASELINE:
|
1999-08-27 04:29:05 +00:00
|
|
|
// Align the baselines of the child frame with the baselines of
|
2000-06-05 08:25:11 +00:00
|
|
|
// other children in the same row which have 'vertical-align: baseline'
|
|
|
|
kidYTop = topInset + aMaxAscent - GetDesiredAscent();
|
|
|
|
break;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-07-28 08:09:02 +00:00
|
|
|
case NS_STYLE_VERTICAL_ALIGN_TOP:
|
1999-08-27 04:29:05 +00:00
|
|
|
// Align the top of the child frame with the top of the content area,
|
1999-07-28 08:09:02 +00:00
|
|
|
kidYTop = topInset;
|
|
|
|
break;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-07-28 08:09:02 +00:00
|
|
|
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
|
1999-08-27 04:29:05 +00:00
|
|
|
// Align the bottom of the child frame with the bottom of the content area,
|
1999-07-28 08:09:02 +00:00
|
|
|
kidYTop = height - childHeight - bottomInset;
|
|
|
|
break;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-07-28 08:09:02 +00:00
|
|
|
default:
|
|
|
|
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
|
1999-08-27 04:29:05 +00:00
|
|
|
// Align the middle of the child frame with the middle of the content area,
|
|
|
|
kidYTop = (height - childHeight - bottomInset + topInset) / 2;
|
2006-01-21 09:54:07 +00:00
|
|
|
kidYTop = nsTableFrame::RoundToPixel(kidYTop, p2t, eAlwaysRoundDown);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
2004-09-18 19:04:13 +00:00
|
|
|
// if the content is larger than the cell height align from top
|
|
|
|
kidYTop = PR_MAX(0, kidYTop);
|
|
|
|
|
2003-07-07 02:01:29 +00:00
|
|
|
firstKid->SetPosition(nsPoint(kidRect.x, kidYTop));
|
2003-09-13 16:26:30 +00:00
|
|
|
nsHTMLReflowMetrics desiredSize(PR_FALSE);
|
|
|
|
desiredSize.width = mRect.width;
|
|
|
|
desiredSize.height = mRect.height;
|
2005-03-18 02:15:44 +00:00
|
|
|
GetSelfOverflow(desiredSize.mOverflowArea);
|
2004-12-27 15:05:18 +00:00
|
|
|
ConsiderChildOverflow(desiredSize.mOverflowArea, firstKid);
|
2004-07-16 16:56:21 +00:00
|
|
|
FinishAndStoreOverflow(&desiredSize);
|
1999-11-19 15:33:29 +00:00
|
|
|
if (kidYTop != kidRect.y) {
|
|
|
|
// Make sure any child views are correctly positioned. We know the inner table
|
|
|
|
// cell won't have a view
|
2004-12-27 15:05:18 +00:00
|
|
|
nsContainerFrame::PositionChildViews(firstKid);
|
1999-11-19 15:33:29 +00:00
|
|
|
}
|
2004-03-28 06:31:03 +00:00
|
|
|
if (HasView()) {
|
2005-02-07 01:58:25 +00:00
|
|
|
nsContainerFrame::SyncFrameViewAfterReflow(presContext, this,
|
|
|
|
GetView(),
|
|
|
|
&desiredSize.mOverflowArea, 0);
|
2004-03-28 06:31:03 +00:00
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2000-06-05 08:25:11 +00:00
|
|
|
// As per bug 10207, we map 'sub', 'super', 'text-top', 'text-bottom',
|
|
|
|
// length and percentage values to 'baseline'
|
|
|
|
// XXX It seems that we don't get to see length and percentage values here
|
|
|
|
// because the Style System has already fixed the error and mapped them
|
|
|
|
// to whatever is inherited from the parent, i.e, 'middle' in most cases.
|
|
|
|
PRBool
|
|
|
|
nsTableCellFrame::HasVerticalAlignBaseline()
|
|
|
|
{
|
2003-05-15 03:42:21 +00:00
|
|
|
const nsStyleTextReset* textStyle = GetStyleTextReset();
|
2000-06-05 08:25:11 +00:00
|
|
|
if (textStyle->mVerticalAlign.GetUnit() == eStyleUnit_Enumerated) {
|
|
|
|
PRUint8 verticalAlignFlags = textStyle->mVerticalAlign.GetIntValue();
|
|
|
|
if (verticalAlignFlags == NS_STYLE_VERTICAL_ALIGN_TOP ||
|
|
|
|
verticalAlignFlags == NS_STYLE_VERTICAL_ALIGN_MIDDLE ||
|
|
|
|
verticalAlignFlags == NS_STYLE_VERTICAL_ALIGN_BOTTOM)
|
|
|
|
{
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
|
|
|
|
1998-09-15 17:58:24 +00:00
|
|
|
PRInt32 nsTableCellFrame::GetRowSpan()
|
|
|
|
{
|
|
|
|
PRInt32 rowSpan=1;
|
2005-01-12 19:45:38 +00:00
|
|
|
nsGenericHTMLElement *hc = nsGenericHTMLElement::FromContent(mContent);
|
2002-05-23 00:00:34 +00:00
|
|
|
|
|
|
|
if (hc) {
|
2005-01-25 00:02:58 +00:00
|
|
|
const nsAttrValue* attr = hc->GetParsedAttr(nsHTMLAtoms::rowspan);
|
|
|
|
if (attr && attr->Type() == nsAttrValue::eInteger) {
|
|
|
|
rowSpan = attr->GetIntegerValue();
|
1998-09-15 17:58:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return rowSpan;
|
|
|
|
}
|
1998-05-21 23:43:18 +00:00
|
|
|
|
1998-09-15 17:58:24 +00:00
|
|
|
PRInt32 nsTableCellFrame::GetColSpan()
|
|
|
|
{
|
|
|
|
PRInt32 colSpan=1;
|
2005-01-12 19:45:38 +00:00
|
|
|
nsGenericHTMLElement *hc = nsGenericHTMLElement::FromContent(mContent);
|
2002-05-23 00:00:34 +00:00
|
|
|
|
|
|
|
if (hc) {
|
2005-01-25 00:02:58 +00:00
|
|
|
const nsAttrValue* attr = hc->GetParsedAttr(nsHTMLAtoms::colspan);
|
|
|
|
if (attr && attr->Type() == nsAttrValue::eInteger) {
|
|
|
|
colSpan = attr->GetIntegerValue();
|
1998-09-15 17:58:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return colSpan;
|
|
|
|
}
|
1998-05-21 23:43:18 +00:00
|
|
|
|
2003-04-05 15:36:31 +00:00
|
|
|
#ifdef DEBUG
|
2001-02-07 04:31:38 +00:00
|
|
|
#define PROBABLY_TOO_LARGE 1000000
|
1999-08-20 13:32:23 +00:00
|
|
|
static
|
1999-04-29 17:43:41 +00:00
|
|
|
void DebugCheckChildSize(nsIFrame* aChild,
|
|
|
|
nsHTMLReflowMetrics& aMet,
|
|
|
|
nsSize& aAvailSize,
|
|
|
|
PRBool aIsPass2Reflow)
|
1999-03-13 12:49:37 +00:00
|
|
|
{
|
1999-04-29 17:43:41 +00:00
|
|
|
if (aIsPass2Reflow) {
|
2001-02-07 04:31:38 +00:00
|
|
|
if ((aMet.width < 0) || (aMet.width > PROBABLY_TOO_LARGE)) {
|
2000-10-28 22:17:53 +00:00
|
|
|
printf("WARNING: cell content %p has large width %d \n", aChild, aMet.width);
|
1999-04-29 17:43:41 +00:00
|
|
|
}
|
1999-03-13 12:49:37 +00:00
|
|
|
}
|
2003-01-09 14:26:32 +00:00
|
|
|
if (aMet.mComputeMEW) {
|
|
|
|
nscoord tmp = aMet.mMaxElementWidth;
|
2001-02-07 04:31:38 +00:00
|
|
|
if ((tmp < 0) || (tmp > PROBABLY_TOO_LARGE)) {
|
2000-10-28 22:17:53 +00:00
|
|
|
printf("WARNING: cell content %p has large max element width %d \n", aChild, tmp);
|
1999-03-13 12:49:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-04-05 15:36:31 +00:00
|
|
|
#endif
|
1999-03-13 12:49:37 +00:00
|
|
|
|
2005-11-20 22:05:24 +00:00
|
|
|
// the computed height for the cell, which descendants use for percent height calculations
|
2001-11-29 15:41:07 +00:00
|
|
|
// it is the height (minus border, padding) of the cell's first in flow during its final
|
|
|
|
// reflow without an unconstrained height.
|
|
|
|
static nscoord
|
2004-07-31 23:15:21 +00:00
|
|
|
CalcUnpaginagedHeight(nsPresContext* aPresContext,
|
2001-11-29 15:41:07 +00:00
|
|
|
nsTableCellFrame& aCellFrame,
|
|
|
|
nsTableFrame& aTableFrame,
|
|
|
|
nscoord aVerticalBorderPadding)
|
|
|
|
{
|
|
|
|
const nsTableCellFrame* firstCellInFlow = (nsTableCellFrame*)aCellFrame.GetFirstInFlow();
|
|
|
|
nsTableFrame* firstTableInFlow = (nsTableFrame*)aTableFrame.GetFirstInFlow();
|
2003-07-07 02:01:29 +00:00
|
|
|
nsTableRowFrame* row
|
|
|
|
= NS_STATIC_CAST(nsTableRowFrame*, firstCellInFlow->GetParent());
|
|
|
|
nsTableRowGroupFrame* firstRGInFlow
|
|
|
|
= NS_STATIC_CAST(nsTableRowGroupFrame*, row->GetParent());
|
2001-11-29 15:41:07 +00:00
|
|
|
|
|
|
|
PRInt32 rowIndex;
|
|
|
|
firstCellInFlow->GetRowIndex(rowIndex);
|
|
|
|
PRInt32 rowSpan = aTableFrame.GetEffectiveRowSpan(*firstCellInFlow);
|
|
|
|
nscoord cellSpacing = firstTableInFlow->GetCellSpacingX();
|
|
|
|
|
|
|
|
nscoord computedHeight = ((rowSpan - 1) * cellSpacing) - aVerticalBorderPadding;
|
|
|
|
PRInt32 rowX;
|
|
|
|
for (row = firstRGInFlow->GetFirstRow(), rowX = 0; row; row = row->GetNextRow(), rowX++) {
|
|
|
|
if (rowX > rowIndex + rowSpan - 1) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (rowX >= rowIndex) {
|
|
|
|
computedHeight += row->GetUnpaginatedHeight(aPresContext);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return computedHeight;
|
|
|
|
}
|
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext,
|
1999-04-29 17:43:41 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
1998-10-02 04:10:00 +00:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
1999-04-29 17:43:41 +00:00
|
|
|
nsReflowStatus& aStatus)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2000-04-21 21:36:33 +00:00
|
|
|
DO_GLOBAL_REFLOW_COUNT("nsTableCellFrame", aReflowState.reason);
|
2001-11-14 13:40:03 +00:00
|
|
|
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
2001-10-29 01:43:59 +00:00
|
|
|
#if defined DEBUG_TABLE_REFLOW_TIMING
|
2001-01-25 15:55:51 +00:00
|
|
|
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState);
|
|
|
|
#endif
|
2006-01-21 09:54:07 +00:00
|
|
|
GET_PIXELS_TO_TWIPS(aPresContext, p2t);
|
2001-11-01 15:31:13 +00:00
|
|
|
|
|
|
|
// work around pixel rounding errors, round down to ensure we don't exceed the avail height in
|
|
|
|
nscoord availHeight = aReflowState.availableHeight;
|
|
|
|
if (NS_UNCONSTRAINEDSIZE != availHeight) {
|
|
|
|
availHeight = nsTableFrame::RoundToPixel(availHeight, p2t, eAlwaysRoundDown);
|
|
|
|
}
|
|
|
|
|
1998-10-30 07:57:44 +00:00
|
|
|
nsresult rv = NS_OK;
|
2001-11-05 00:15:51 +00:00
|
|
|
|
2002-04-01 06:46:17 +00:00
|
|
|
// see if a special height reflow needs to occur due to having a pct height
|
2002-04-10 21:32:41 +00:00
|
|
|
if (!NeedSpecialReflow())
|
|
|
|
nsTableFrame::CheckRequestSpecialHeightReflow(aReflowState);
|
2002-04-01 06:46:17 +00:00
|
|
|
|
1999-04-09 21:09:52 +00:00
|
|
|
// this should probably be cached somewhere
|
2003-12-24 21:51:50 +00:00
|
|
|
nsCompatibility compatMode = aPresContext->CompatibilityMode();
|
1998-10-30 07:57:44 +00:00
|
|
|
|
1998-06-03 00:43:53 +00:00
|
|
|
// Initialize out parameter
|
2003-01-09 14:26:32 +00:00
|
|
|
if (aDesiredSize.mComputeMEW) {
|
|
|
|
aDesiredSize.mMaxElementWidth = 0;
|
1998-06-03 00:43:53 +00:00
|
|
|
}
|
|
|
|
|
1998-05-12 04:17:56 +00:00
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
2001-11-01 15:31:13 +00:00
|
|
|
nsSize availSize(aReflowState.availableWidth, availHeight);
|
1999-05-11 22:03:29 +00:00
|
|
|
|
2004-12-01 03:50:03 +00:00
|
|
|
PRBool noBorderBeforeReflow = GetContentEmpty() &&
|
|
|
|
GetStyleTableBorder()->mEmptyCells != NS_STYLE_TABLE_EMPTY_CELLS_SHOW;
|
1998-12-23 15:47:43 +00:00
|
|
|
/* XXX: remove tableFrame when border-collapse inherits */
|
2006-03-04 05:26:57 +00:00
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
|
|
|
if (!tableFrame)
|
|
|
|
ABORT1(NS_ERROR_NULL_POINTER);
|
2001-11-05 00:15:51 +00:00
|
|
|
|
2000-02-12 01:55:40 +00:00
|
|
|
nsMargin borderPadding = aReflowState.mComputedPadding;
|
1999-04-09 21:09:52 +00:00
|
|
|
nsMargin border;
|
2002-02-19 15:48:28 +00:00
|
|
|
GetBorderWidth(p2t, border);
|
2004-12-01 03:50:03 +00:00
|
|
|
if ((NS_UNCONSTRAINEDSIZE == availSize.width) || !noBorderBeforeReflow) {
|
1999-04-09 21:09:52 +00:00
|
|
|
borderPadding += border;
|
|
|
|
}
|
|
|
|
|
|
|
|
nscoord topInset = borderPadding.top;
|
|
|
|
nscoord rightInset = borderPadding.right;
|
1998-05-12 22:28:01 +00:00
|
|
|
nscoord bottomInset = borderPadding.bottom;
|
1999-04-09 21:09:52 +00:00
|
|
|
nscoord leftInset = borderPadding.left;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-07-06 21:00:11 +00:00
|
|
|
// reduce available space by insets, if we're in a constrained situation
|
1998-06-26 00:48:44 +00:00
|
|
|
if (NS_UNCONSTRAINEDSIZE!=availSize.width)
|
1998-07-06 21:00:11 +00:00
|
|
|
availSize.width -= leftInset+rightInset;
|
1998-06-26 00:48:44 +00:00
|
|
|
if (NS_UNCONSTRAINEDSIZE!=availSize.height)
|
1998-11-22 08:56:19 +00:00
|
|
|
availSize.height -= topInset+bottomInset;
|
1998-06-26 00:48:44 +00:00
|
|
|
|
1999-08-29 04:18:00 +00:00
|
|
|
PRBool isStyleChanged = PR_FALSE;
|
2001-03-13 06:38:59 +00:00
|
|
|
if (eReflowReason_Incremental == aReflowState.reason) {
|
2002-05-10 18:22:41 +00:00
|
|
|
// if the path has a reflow command then the cell must be the target of a style change
|
|
|
|
nsHTMLReflowCommand* command = aReflowState.path->mReflowCommand;
|
|
|
|
if (command) {
|
|
|
|
// if there are other reflow commands targeted at the cell's block, these will
|
|
|
|
// be subsumed by the style change reflow
|
|
|
|
nsReflowType type;
|
|
|
|
command->GetType(type);
|
|
|
|
if (eReflowType_StyleChanged == type) {
|
|
|
|
isStyleChanged = PR_TRUE;
|
1998-10-30 07:57:44 +00:00
|
|
|
}
|
2002-05-10 18:22:41 +00:00
|
|
|
else NS_ASSERTION(PR_FALSE, "table cell target of illegal incremental reflow type");
|
1998-10-30 07:57:44 +00:00
|
|
|
}
|
2002-05-10 18:22:41 +00:00
|
|
|
// else the reflow command will be passed down to the child
|
1998-07-16 22:15:02 +00:00
|
|
|
}
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
// Try to reflow the child into the available space. It might not
|
|
|
|
// fit or might need continuing.
|
1998-04-23 17:29:07 +00:00
|
|
|
if (availSize.height < 0)
|
|
|
|
availSize.height = 1;
|
1998-09-24 16:37:22 +00:00
|
|
|
|
2003-01-09 14:26:32 +00:00
|
|
|
nsHTMLReflowMetrics kidSize(NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth ||
|
|
|
|
aDesiredSize.mComputeMEW,
|
|
|
|
aDesiredSize.mFlags);
|
1998-06-03 00:43:53 +00:00
|
|
|
kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0;
|
1999-01-05 23:31:18 +00:00
|
|
|
SetPriorAvailWidth(aReflowState.availableWidth);
|
1999-01-15 22:52:05 +00:00
|
|
|
nsIFrame* firstKid = mFrames.FirstChild();
|
2004-11-06 07:07:43 +00:00
|
|
|
NS_ASSERTION(firstKid, "Frame construction error, a table cell always has an inner cell frame");
|
2001-11-05 00:15:51 +00:00
|
|
|
|
2001-11-29 15:41:07 +00:00
|
|
|
nscoord computedPaginatedHeight = 0;
|
|
|
|
|
2001-12-07 14:51:12 +00:00
|
|
|
if (aReflowState.mFlags.mSpecialHeightReflow ||
|
2002-04-10 21:32:41 +00:00
|
|
|
(HadSpecialReflow() && (eReflowReason_Incremental == aReflowState.reason))) {
|
2001-11-05 00:15:51 +00:00
|
|
|
((nsHTMLReflowState&)aReflowState).mComputedHeight = mRect.height - topInset - bottomInset;
|
2001-11-27 01:45:46 +00:00
|
|
|
DISPLAY_REFLOW_CHANGE();
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
2004-03-03 18:24:20 +00:00
|
|
|
else if (aPresContext->IsPaginated()) {
|
2001-11-29 15:41:07 +00:00
|
|
|
computedPaginatedHeight = CalcUnpaginagedHeight(aPresContext, (nsTableCellFrame&)*this, *tableFrame, topInset + bottomInset);
|
|
|
|
if (computedPaginatedHeight > 0) {
|
|
|
|
((nsHTMLReflowState&)aReflowState).mComputedHeight = computedPaginatedHeight;
|
|
|
|
DISPLAY_REFLOW_CHANGE();
|
|
|
|
}
|
|
|
|
}
|
2001-11-28 00:50:08 +00:00
|
|
|
else {
|
|
|
|
SetHasPctOverHeight(PR_FALSE);
|
|
|
|
}
|
1998-10-01 04:46:11 +00:00
|
|
|
|
2002-05-10 18:22:41 +00:00
|
|
|
// If it was a style change targeted at us, then reflow the child with a style change reason
|
|
|
|
nsReflowReason reason = aReflowState.reason;
|
1999-08-29 04:18:00 +00:00
|
|
|
if (isStyleChanged) {
|
2002-05-10 18:22:41 +00:00
|
|
|
reason = eReflowReason_StyleChange;
|
2001-03-26 06:13:56 +00:00
|
|
|
// the following could be optimized with a fair amount of effort
|
|
|
|
tableFrame->SetNeedStrategyInit(PR_TRUE);
|
1999-08-29 04:18:00 +00:00
|
|
|
}
|
|
|
|
|
2002-05-10 18:22:41 +00:00
|
|
|
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, firstKid, availSize, reason);
|
2005-08-30 16:14:53 +00:00
|
|
|
// mIPercentHeightObserver is for non table related frames inside cells in quirks mode
|
|
|
|
kidReflowState.mPercentHeightObserver = (eCompatibility_NavQuirks == compatMode) ? (nsIPercentHeightObserver *)this : nsnull;
|
2002-05-10 18:22:41 +00:00
|
|
|
|
1999-11-19 15:33:29 +00:00
|
|
|
// Assume the inner child will stay positioned exactly where it is. Later in
|
|
|
|
// VerticallyAlignChild() we'll move it if it turns out to be wrong. This
|
|
|
|
// avoids excessive movement and is more stable
|
|
|
|
nsPoint kidOrigin;
|
2001-11-22 19:34:59 +00:00
|
|
|
if (isStyleChanged ||
|
|
|
|
(eReflowReason_Initial == aReflowState.reason) ||
|
|
|
|
(eReflowReason_StyleChange == aReflowState.reason)) {
|
1999-11-19 15:33:29 +00:00
|
|
|
kidOrigin.MoveTo(leftInset, topInset);
|
|
|
|
} else {
|
2000-02-12 01:55:40 +00:00
|
|
|
// handle percent padding-left which was 0 during initial reflow
|
2001-02-07 09:57:26 +00:00
|
|
|
if (eStyleUnit_Percent == aReflowState.mStylePadding->mPadding.GetLeftUnit()) {
|
2003-07-07 02:01:29 +00:00
|
|
|
nsRect kidRect = firstKid->GetRect();
|
2000-02-12 01:55:40 +00:00
|
|
|
// only move in the x direction for the same reason as above
|
|
|
|
kidOrigin.MoveTo(leftInset, kidRect.y);
|
2003-07-07 02:01:29 +00:00
|
|
|
firstKid->SetPosition(nsPoint(leftInset, kidRect.y));
|
2000-02-12 01:55:40 +00:00
|
|
|
}
|
2003-07-07 02:01:29 +00:00
|
|
|
kidOrigin = firstKid->GetPosition();
|
1999-11-19 15:33:29 +00:00
|
|
|
}
|
2006-03-04 05:26:57 +00:00
|
|
|
|
2001-10-29 01:43:59 +00:00
|
|
|
#if defined DEBUG_TABLE_REFLOW_TIMING
|
2001-01-25 15:55:51 +00:00
|
|
|
nsTableFrame::DebugReflow(firstKid, (nsHTMLReflowState&)kidReflowState);
|
|
|
|
#endif
|
2001-12-07 14:51:12 +00:00
|
|
|
nscoord priorBlockHeight = GetLastBlockHeight();
|
1999-11-19 15:33:29 +00:00
|
|
|
ReflowChild(firstKid, aPresContext, kidSize, kidReflowState,
|
|
|
|
kidOrigin.x, kidOrigin.y, 0, aStatus);
|
2001-12-07 14:51:12 +00:00
|
|
|
SetLastBlockHeight(kidSize.height);
|
2000-09-11 02:47:02 +00:00
|
|
|
if (isStyleChanged) {
|
2004-08-26 00:07:56 +00:00
|
|
|
Invalidate(GetOverflowRect(), PR_FALSE);
|
2000-09-11 02:47:02 +00:00
|
|
|
}
|
2001-11-28 00:50:08 +00:00
|
|
|
|
2001-10-29 01:43:59 +00:00
|
|
|
#if defined DEBUG_TABLE_REFLOW_TIMING
|
2001-01-25 15:55:51 +00:00
|
|
|
nsTableFrame::DebugReflow(firstKid, (nsHTMLReflowState&)kidReflowState, &kidSize, aStatus);
|
|
|
|
#endif
|
1999-08-21 06:38:07 +00:00
|
|
|
|
1998-09-09 20:00:40 +00:00
|
|
|
#ifdef NS_DEBUG
|
1999-04-29 17:43:41 +00:00
|
|
|
DebugCheckChildSize(firstKid, kidSize, availSize, (NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth));
|
1998-12-08 19:18:33 +00:00
|
|
|
#endif
|
|
|
|
|
1999-04-09 21:09:52 +00:00
|
|
|
// 0 dimensioned cells need to be treated specially in Standard/NavQuirks mode
|
1999-09-10 18:55:46 +00:00
|
|
|
// see testcase "emptyCells.html"
|
2000-01-28 02:19:45 +00:00
|
|
|
if ((0 == kidSize.width) || (0 == kidSize.height)) { // XXX why was this &&
|
|
|
|
SetContentEmpty(PR_TRUE);
|
2004-12-01 03:50:03 +00:00
|
|
|
if (NS_UNCONSTRAINEDSIZE == kidReflowState.availableWidth &&
|
|
|
|
GetStyleTableBorder()->mEmptyCells != NS_STYLE_TABLE_EMPTY_CELLS_SHOW) {
|
1999-04-09 21:09:52 +00:00
|
|
|
// need to reduce the insets by border if the cell is empty
|
|
|
|
leftInset -= border.left;
|
|
|
|
rightInset -= border.right;
|
|
|
|
topInset -= border.top;
|
|
|
|
bottomInset -= border.bottom;
|
|
|
|
}
|
2000-01-28 02:19:45 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
SetContentEmpty(PR_FALSE);
|
2004-12-01 03:50:03 +00:00
|
|
|
if ((eReflowReason_Incremental == aReflowState.reason) && noBorderBeforeReflow) {
|
2001-11-06 23:05:32 +00:00
|
|
|
// need to consider borders, since they were factored out above
|
|
|
|
leftInset += border.left;
|
|
|
|
rightInset += border.right;
|
|
|
|
topInset += border.top;
|
|
|
|
bottomInset += border.bottom;
|
|
|
|
kidOrigin.MoveTo(leftInset, topInset);
|
|
|
|
}
|
1998-12-10 19:57:42 +00:00
|
|
|
}
|
1999-09-10 18:55:46 +00:00
|
|
|
|
2003-05-15 03:42:21 +00:00
|
|
|
const nsStylePosition* pos = GetStylePosition();
|
1999-09-10 18:55:46 +00:00
|
|
|
|
|
|
|
// calculate the min cell width
|
2004-03-09 06:48:35 +00:00
|
|
|
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
2001-09-26 13:49:26 +00:00
|
|
|
nscoord smallestMinWidth = 0;
|
1999-09-10 18:55:46 +00:00
|
|
|
if (eCompatibility_NavQuirks == compatMode) {
|
|
|
|
if ((pos->mWidth.GetUnit() != eStyleUnit_Coord) &&
|
|
|
|
(pos->mWidth.GetUnit() != eStyleUnit_Percent)) {
|
1999-10-18 13:45:41 +00:00
|
|
|
if (PR_TRUE == GetContentEmpty()) {
|
|
|
|
if (border.left > 0)
|
|
|
|
smallestMinWidth += onePixel;
|
|
|
|
if (border.right > 0)
|
|
|
|
smallestMinWidth += onePixel;
|
|
|
|
}
|
1999-09-10 18:55:46 +00:00
|
|
|
}
|
1999-10-05 04:21:00 +00:00
|
|
|
}
|
2000-02-01 03:23:29 +00:00
|
|
|
PRInt32 colspan = tableFrame->GetEffectiveColSpan(*this);
|
1999-10-05 04:21:00 +00:00
|
|
|
if (colspan > 1) {
|
|
|
|
smallestMinWidth = PR_MAX(smallestMinWidth, colspan * onePixel);
|
|
|
|
nscoord spacingX = tableFrame->GetCellSpacingX();
|
|
|
|
nscoord spacingExtra = spacingX * (colspan - 1);
|
|
|
|
smallestMinWidth += spacingExtra;
|
2000-02-12 01:55:40 +00:00
|
|
|
if (aReflowState.mComputedPadding.left > 0) {
|
1999-10-05 04:21:00 +00:00
|
|
|
smallestMinWidth -= onePixel;
|
1999-09-10 18:55:46 +00:00
|
|
|
}
|
|
|
|
}
|
1999-10-05 04:21:00 +00:00
|
|
|
|
1999-09-13 14:35:00 +00:00
|
|
|
if ((0 == kidSize.width) && (NS_UNCONSTRAINEDSIZE != kidReflowState.availableWidth)) {
|
|
|
|
// empty content has to be forced to the assigned width for resize or incremental reflow
|
|
|
|
kidSize.width = kidReflowState.availableWidth;
|
1998-11-25 18:43:56 +00:00
|
|
|
}
|
1999-04-09 21:09:52 +00:00
|
|
|
if (0 == kidSize.height) {
|
|
|
|
if ((pos->mHeight.GetUnit() != eStyleUnit_Coord) &&
|
|
|
|
(pos->mHeight.GetUnit() != eStyleUnit_Percent)) {
|
2002-11-13 15:38:48 +00:00
|
|
|
PRInt32 pixHeight = (eCompatibility_NavQuirks == compatMode) ? 1 : 0;
|
1999-04-09 21:09:52 +00:00
|
|
|
kidSize.height = NSIntPixelsToTwips(pixHeight, p2t);
|
|
|
|
}
|
1998-12-05 05:27:21 +00:00
|
|
|
}
|
1999-04-09 21:09:52 +00:00
|
|
|
// end 0 dimensioned cells
|
1998-12-08 19:18:33 +00:00
|
|
|
|
1999-09-10 18:55:46 +00:00
|
|
|
kidSize.width = PR_MAX(kidSize.width, smallestMinWidth);
|
2001-01-25 22:57:53 +00:00
|
|
|
if (!tableFrame->IsAutoLayout()) {
|
|
|
|
// a cell in a fixed layout table is constrained to the avail width
|
2004-11-14 14:47:59 +00:00
|
|
|
// if we need to shorten the cell the previous non overflowing block
|
|
|
|
// will get some overflow area
|
|
|
|
if (kidSize.width > availSize.width) {
|
|
|
|
kidSize.width = availSize.width;
|
|
|
|
firstKid->FinishAndStoreOverflow(&kidSize);
|
|
|
|
}
|
2001-01-25 22:57:53 +00:00
|
|
|
}
|
2001-01-11 23:22:44 +00:00
|
|
|
//if (eReflowReason_Resize == aReflowState.reason) {
|
|
|
|
// NS_ASSERTION(kidSize.width <= availSize.width, "child needed more space during resize reflow");
|
|
|
|
//}
|
1998-06-05 02:36:25 +00:00
|
|
|
// Place the child
|
2001-12-07 14:51:12 +00:00
|
|
|
FinishReflowChild(firstKid, aPresContext, &kidReflowState, kidSize,
|
1999-11-19 15:33:29 +00:00
|
|
|
kidOrigin.x, kidOrigin.y, 0);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-04-09 21:09:52 +00:00
|
|
|
// first, compute the height which can be set w/o being restricted by aMaxSize.height
|
1999-09-13 14:35:00 +00:00
|
|
|
nscoord cellHeight = kidSize.height;
|
2001-08-08 01:13:35 +00:00
|
|
|
|
1999-09-13 14:35:00 +00:00
|
|
|
if (NS_UNCONSTRAINEDSIZE != cellHeight) {
|
|
|
|
cellHeight += topInset + bottomInset;
|
2001-11-01 15:31:13 +00:00
|
|
|
// work around block rounding errors, round down to ensure we don't exceed the avail height in
|
|
|
|
nsPixelRound roundMethod = (NS_UNCONSTRAINEDSIZE == availHeight) ? eAlwaysRoundUp : eAlwaysRoundDown;
|
|
|
|
cellHeight = nsTableFrame::RoundToPixel(cellHeight, p2t, roundMethod);
|
1999-09-13 14:35:00 +00:00
|
|
|
}
|
1999-08-19 19:52:37 +00:00
|
|
|
|
1998-06-05 02:36:25 +00:00
|
|
|
// next determine the cell's width
|
1998-07-06 21:00:11 +00:00
|
|
|
nscoord cellWidth = kidSize.width; // at this point, we've factored in the cell's style attributes
|
1998-07-02 17:40:56 +00:00
|
|
|
|
1999-09-13 14:35:00 +00:00
|
|
|
// factor in border and padding
|
|
|
|
if (NS_UNCONSTRAINEDSIZE != cellWidth) {
|
|
|
|
cellWidth += leftInset + rightInset;
|
|
|
|
}
|
2001-03-25 23:06:08 +00:00
|
|
|
cellWidth = nsTableFrame::RoundToPixel(cellWidth, p2t); // work around block rounding errors
|
1998-07-31 00:32:27 +00:00
|
|
|
|
1998-06-05 02:36:25 +00:00
|
|
|
// set the cell's desired size and max element size
|
1999-09-13 14:35:00 +00:00
|
|
|
aDesiredSize.width = cellWidth;
|
|
|
|
aDesiredSize.height = cellHeight;
|
|
|
|
aDesiredSize.ascent = topInset;
|
1998-04-13 20:24:54 +00:00
|
|
|
aDesiredSize.descent = bottomInset;
|
2000-07-28 09:19:26 +00:00
|
|
|
|
2000-06-05 08:25:11 +00:00
|
|
|
aDesiredSize.ascent += kidSize.ascent;
|
|
|
|
aDesiredSize.descent += kidSize.descent;
|
2003-09-13 16:26:30 +00:00
|
|
|
|
|
|
|
// the overflow area will be computed when the child will be vertically aligned
|
2000-07-28 09:19:26 +00:00
|
|
|
|
2003-01-09 14:26:32 +00:00
|
|
|
if (aDesiredSize.mComputeMEW) {
|
|
|
|
aDesiredSize.mMaxElementWidth =
|
|
|
|
PR_MAX(smallestMinWidth, kidSize.mMaxElementWidth);
|
|
|
|
if (NS_UNCONSTRAINEDSIZE != aDesiredSize.mMaxElementWidth) {
|
|
|
|
aDesiredSize.mMaxElementWidth = nsTableFrame::RoundToPixel(
|
|
|
|
aDesiredSize.mMaxElementWidth + leftInset + rightInset, p2t);
|
2001-03-13 06:38:59 +00:00
|
|
|
}
|
1998-04-20 22:49:15 +00:00
|
|
|
}
|
2002-06-19 23:16:33 +00:00
|
|
|
if (aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH) {
|
|
|
|
aDesiredSize.mMaximumWidth = kidSize.mMaximumWidth;
|
|
|
|
if (NS_UNCONSTRAINEDSIZE != aDesiredSize.mMaximumWidth) {
|
|
|
|
aDesiredSize.mMaximumWidth += leftInset + rightInset;
|
|
|
|
aDesiredSize.mMaximumWidth = nsTableFrame::RoundToPixel(aDesiredSize.mMaximumWidth, p2t);
|
|
|
|
}
|
|
|
|
// make sure the preferred width is at least as big as the max element width
|
2003-01-09 14:26:32 +00:00
|
|
|
if (aDesiredSize.mComputeMEW) {
|
|
|
|
aDesiredSize.mMaximumWidth = PR_MAX(aDesiredSize.mMaximumWidth, aDesiredSize.mMaxElementWidth);
|
2002-06-19 23:16:33 +00:00
|
|
|
}
|
|
|
|
}
|
1998-10-02 20:36:35 +00:00
|
|
|
|
2001-12-07 14:51:12 +00:00
|
|
|
if (aReflowState.mFlags.mSpecialHeightReflow) {
|
2001-11-28 00:50:08 +00:00
|
|
|
if (aDesiredSize.height > mRect.height) {
|
2001-12-07 14:51:12 +00:00
|
|
|
// set a bit indicating that the pct height contents exceeded
|
2001-11-28 00:50:08 +00:00
|
|
|
// the height that they could honor in the pass 2 reflow
|
|
|
|
SetHasPctOverHeight(PR_TRUE);
|
|
|
|
}
|
2002-03-16 21:46:29 +00:00
|
|
|
if (NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) {
|
|
|
|
aDesiredSize.height = mRect.height;
|
|
|
|
}
|
2001-11-05 00:15:51 +00:00
|
|
|
SetNeedSpecialReflow(PR_FALSE);
|
2001-12-07 14:51:12 +00:00
|
|
|
SetHadSpecialReflow(PR_TRUE);
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
2002-04-06 22:42:39 +00:00
|
|
|
else if (HadSpecialReflow()) {
|
2002-06-19 22:42:41 +00:00
|
|
|
if (eReflowReason_Incremental == aReflowState.reason) {
|
2002-04-06 22:42:39 +00:00
|
|
|
// with an unconstrained height, if the block height value hasn't changed,
|
|
|
|
// use the last height of the cell.
|
|
|
|
if ((NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) &&
|
|
|
|
(GetLastBlockHeight() == priorBlockHeight)) {
|
|
|
|
aDesiredSize.height = mRect.height;
|
|
|
|
}
|
2001-12-11 15:02:36 +00:00
|
|
|
}
|
2002-04-06 22:42:39 +00:00
|
|
|
// XXX should probably call SetHadSpecialReflow(PR_FALSE) when things change so that
|
|
|
|
// nothing inside the cell has a percent height, but it is not easy determining this
|
2001-11-28 00:50:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// remember the desired size for this reflow
|
|
|
|
SetDesiredSize(aDesiredSize);
|
2001-11-05 00:15:51 +00:00
|
|
|
|
2001-10-29 01:43:59 +00:00
|
|
|
#if defined DEBUG_TABLE_REFLOW_TIMING
|
2001-01-25 15:55:51 +00:00
|
|
|
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState, &aDesiredSize, aStatus);
|
|
|
|
#endif
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2002-05-09 14:44:02 +00:00
|
|
|
if (NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) {
|
|
|
|
SetNeedPass2Reflow(PR_TRUE);
|
|
|
|
}
|
|
|
|
else if ((eReflowReason_Initial == aReflowState.reason) ||
|
|
|
|
(eReflowReason_Resize == aReflowState.reason)) {
|
|
|
|
SetNeedPass2Reflow(PR_FALSE);
|
|
|
|
}
|
|
|
|
|
2002-05-28 22:50:43 +00:00
|
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-09-15 17:58:24 +00:00
|
|
|
/* ----- global methods ----- */
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-08-01 18:26:45 +00:00
|
|
|
NS_IMPL_ADDREF_INHERITED(nsTableCellFrame, nsHTMLContainerFrame)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(nsTableCellFrame, nsHTMLContainerFrame)
|
1999-07-31 22:11:50 +00:00
|
|
|
|
1999-08-01 18:26:45 +00:00
|
|
|
nsresult nsTableCellFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|
|
|
{
|
|
|
|
if (NULL == aInstancePtr) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
2001-04-01 01:01:33 +00:00
|
|
|
|
2000-02-02 22:24:56 +00:00
|
|
|
if (aIID.Equals(NS_GET_IID(nsITableCellLayout))) {
|
1999-08-04 02:04:45 +00:00
|
|
|
*aInstancePtr = (void*) (nsITableCellLayout *)this;
|
1999-08-01 18:26:45 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2001-12-07 14:51:12 +00:00
|
|
|
if (aIID.Equals(NS_GET_IID(nsIPercentHeightObserver))) {
|
|
|
|
*aInstancePtr = (void*) (nsIPercentHeightObserver *)this;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2001-05-17 23:52:32 +00:00
|
|
|
|
|
|
|
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
|
|
|
|
}
|
|
|
|
|
2001-08-17 03:13:07 +00:00
|
|
|
#ifdef ACCESSIBILITY
|
2001-05-17 23:52:32 +00:00
|
|
|
NS_IMETHODIMP nsTableCellFrame::GetAccessible(nsIAccessible** aAccessible)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIAccessibilityService> accService = do_GetService("@mozilla.org/accessibilityService;1");
|
|
|
|
|
|
|
|
if (accService) {
|
|
|
|
return accService->CreateHTMLTableCellAccessible(NS_STATIC_CAST(nsIFrame*, this), aAccessible);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_ERROR_FAILURE;
|
1999-08-01 18:26:45 +00:00
|
|
|
}
|
2001-08-17 03:13:07 +00:00
|
|
|
#endif
|
1999-07-31 22:11:50 +00:00
|
|
|
|
1999-08-04 02:04:45 +00:00
|
|
|
/* This is primarily for editor access via nsITableLayout */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableCellFrame::GetCellIndexes(PRInt32 &aRowIndex, PRInt32 &aColIndex)
|
|
|
|
{
|
|
|
|
nsresult res = GetRowIndex(aRowIndex);
|
|
|
|
if (NS_FAILED(res))
|
|
|
|
{
|
|
|
|
aColIndex = 0;
|
|
|
|
return res;
|
|
|
|
}
|
2001-12-07 14:51:12 +00:00
|
|
|
aColIndex = mBits.mColIndex;
|
1999-08-04 02:04:45 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-03-23 04:24:58 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableCellFrame::GetPreviousCellInColumn(nsITableCellLayout **aCellLayout)
|
|
|
|
{
|
|
|
|
if (!aCellLayout) return NS_ERROR_NULL_POINTER;
|
|
|
|
*aCellLayout = nsnull;
|
|
|
|
|
2006-03-04 05:26:57 +00:00
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
|
|
|
if (!tableFrame)
|
|
|
|
return NS_ERROR_FAILURE;
|
2000-03-23 04:24:58 +00:00
|
|
|
|
|
|
|
// Get current cell location
|
|
|
|
PRInt32 rowIndex, colIndex;
|
|
|
|
GetCellIndexes(rowIndex, colIndex);
|
|
|
|
if (colIndex > 0)
|
|
|
|
{
|
|
|
|
// Get the cellframe at previous colIndex
|
|
|
|
nsTableCellFrame *cellFrame = tableFrame->GetCellFrameAt(rowIndex, colIndex-1);
|
2002-11-13 15:38:48 +00:00
|
|
|
if (!cellFrame) return NS_ERROR_FAILURE;
|
|
|
|
return CallQueryInterface(cellFrame, aCellLayout);
|
2000-03-23 04:24:58 +00:00
|
|
|
}
|
2002-11-13 15:38:48 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
2000-03-23 04:24:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableCellFrame::GetNextCellInColumn(nsITableCellLayout **aCellLayout)
|
|
|
|
{
|
|
|
|
if (!aCellLayout) return NS_ERROR_NULL_POINTER;
|
|
|
|
*aCellLayout = nsnull;
|
|
|
|
|
2006-03-04 05:26:57 +00:00
|
|
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
|
|
|
if (!tableFrame)
|
|
|
|
return NS_ERROR_FAILURE;
|
2000-03-23 04:24:58 +00:00
|
|
|
|
|
|
|
// Get current cell location
|
|
|
|
PRInt32 rowIndex, colIndex;
|
|
|
|
GetCellIndexes(rowIndex, colIndex);
|
|
|
|
|
|
|
|
// Get the cellframe at next colIndex
|
|
|
|
nsTableCellFrame *cellFrame = tableFrame->GetCellFrameAt(rowIndex, colIndex+1);
|
2002-11-13 15:38:48 +00:00
|
|
|
if (!cellFrame) return NS_ERROR_FAILURE;
|
|
|
|
return CallQueryInterface(cellFrame, aCellLayout);
|
2000-03-23 04:24:58 +00:00
|
|
|
}
|
|
|
|
|
2005-11-04 02:38:33 +00:00
|
|
|
nsIFrame*
|
2002-02-19 15:48:28 +00:00
|
|
|
NS_NewTableCellFrame(nsIPresShell* aPresShell,
|
2005-11-04 02:38:33 +00:00
|
|
|
PRBool aIsBorderCollapse)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2005-11-04 02:38:33 +00:00
|
|
|
if (aIsBorderCollapse)
|
|
|
|
return new (aPresShell) nsBCTableCellFrame;
|
|
|
|
else
|
|
|
|
return new (aPresShell) nsTableCellFrame;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
1998-05-21 23:43:18 +00:00
|
|
|
|
2002-02-19 15:48:28 +00:00
|
|
|
nsMargin*
|
|
|
|
nsTableCellFrame::GetBorderWidth(float aPixelsToTwips,
|
|
|
|
nsMargin& aBorder) const
|
1998-12-23 15:47:43 +00:00
|
|
|
{
|
2005-04-29 15:44:38 +00:00
|
|
|
aBorder = GetStyleBorder()->GetBorder();
|
2002-02-19 15:48:28 +00:00
|
|
|
return &aBorder;
|
1998-12-23 15:47:43 +00:00
|
|
|
}
|
1998-07-11 00:00:31 +00:00
|
|
|
|
2003-10-31 20:19:18 +00:00
|
|
|
nsIAtom*
|
|
|
|
nsTableCellFrame::GetType() const
|
1999-02-24 05:54:31 +00:00
|
|
|
{
|
2003-10-31 20:19:18 +00:00
|
|
|
return nsLayoutAtoms::tableCellFrame;
|
1999-02-24 05:54:31 +00:00
|
|
|
}
|
|
|
|
|
1999-11-01 22:12:45 +00:00
|
|
|
#ifdef DEBUG
|
1998-11-19 17:22:29 +00:00
|
|
|
NS_IMETHODIMP
|
2001-11-14 01:33:42 +00:00
|
|
|
nsTableCellFrame::GetFrameName(nsAString& aResult) const
|
1998-11-19 17:22:29 +00:00
|
|
|
{
|
2001-11-14 01:33:42 +00:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("TableCell"), aResult);
|
1998-11-19 17:22:29 +00:00
|
|
|
}
|
1999-11-01 22:12:45 +00:00
|
|
|
#endif
|
1999-02-11 06:22:33 +00:00
|
|
|
|
2002-02-19 15:48:28 +00:00
|
|
|
// nsBCTableCellFrame
|
|
|
|
|
|
|
|
nsBCTableCellFrame::nsBCTableCellFrame()
|
|
|
|
:nsTableCellFrame()
|
|
|
|
{
|
|
|
|
mTopBorder = mRightBorder = mBottomBorder = mLeftBorder = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsBCTableCellFrame::~nsBCTableCellFrame()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-10-31 20:19:18 +00:00
|
|
|
nsIAtom*
|
|
|
|
nsBCTableCellFrame::GetType() const
|
2002-02-19 15:48:28 +00:00
|
|
|
{
|
2003-10-31 20:19:18 +00:00
|
|
|
return nsLayoutAtoms::bcTableCellFrame;
|
2002-02-19 15:48:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsBCTableCellFrame::GetFrameName(nsAString& aResult) const
|
|
|
|
{
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("BCTableCell"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
nsMargin*
|
|
|
|
nsBCTableCellFrame::GetBorderWidth(float aPixelsToTwips,
|
|
|
|
nsMargin& aBorder) const
|
|
|
|
{
|
2005-04-07 18:04:38 +00:00
|
|
|
aBorder.top = BC_BORDER_BOTTOM_HALF_COORD(aPixelsToTwips, mTopBorder);
|
|
|
|
aBorder.right = BC_BORDER_LEFT_HALF_COORD(aPixelsToTwips, mRightBorder);
|
|
|
|
aBorder.bottom = BC_BORDER_TOP_HALF_COORD(aPixelsToTwips, mBottomBorder);
|
|
|
|
aBorder.left = BC_BORDER_RIGHT_HALF_COORD(aPixelsToTwips, mLeftBorder);
|
2002-02-19 15:48:28 +00:00
|
|
|
return &aBorder;
|
|
|
|
}
|
|
|
|
|
2005-04-07 18:04:38 +00:00
|
|
|
BCPixelSize
|
2002-02-19 15:48:28 +00:00
|
|
|
nsBCTableCellFrame::GetBorderWidth(PRUint8 aSide) const
|
|
|
|
{
|
|
|
|
switch(aSide) {
|
|
|
|
case NS_SIDE_TOP:
|
2005-04-07 18:04:38 +00:00
|
|
|
return BC_BORDER_BOTTOM_HALF(mTopBorder);
|
2002-02-19 15:48:28 +00:00
|
|
|
case NS_SIDE_RIGHT:
|
2005-04-07 18:04:38 +00:00
|
|
|
return BC_BORDER_LEFT_HALF(mRightBorder);
|
2002-02-19 15:48:28 +00:00
|
|
|
case NS_SIDE_BOTTOM:
|
2005-04-07 18:04:38 +00:00
|
|
|
return BC_BORDER_TOP_HALF(mBottomBorder);
|
2002-02-19 15:48:28 +00:00
|
|
|
default:
|
2005-04-07 18:04:38 +00:00
|
|
|
return BC_BORDER_RIGHT_HALF(mLeftBorder);
|
2002-02-19 15:48:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsBCTableCellFrame::SetBorderWidth(PRUint8 aSide,
|
2005-04-07 18:04:38 +00:00
|
|
|
BCPixelSize aValue)
|
2002-02-19 15:48:28 +00:00
|
|
|
{
|
|
|
|
switch(aSide) {
|
|
|
|
case NS_SIDE_TOP:
|
|
|
|
mTopBorder = aValue;
|
|
|
|
break;
|
|
|
|
case NS_SIDE_RIGHT:
|
|
|
|
mRightBorder = aValue;
|
|
|
|
break;
|
|
|
|
case NS_SIDE_BOTTOM:
|
|
|
|
mBottomBorder = aValue;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
mLeftBorder = aValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-18 02:15:44 +00:00
|
|
|
/* virtual */ void
|
|
|
|
nsBCTableCellFrame::GetSelfOverflow(nsRect& aOverflowArea)
|
|
|
|
{
|
|
|
|
nsMargin halfBorder;
|
2006-01-21 09:54:07 +00:00
|
|
|
GET_PIXELS_TO_TWIPS(GetPresContext(), p2t);
|
2005-04-07 18:04:38 +00:00
|
|
|
halfBorder.top = BC_BORDER_TOP_HALF_COORD(p2t, mTopBorder);
|
|
|
|
halfBorder.right = BC_BORDER_RIGHT_HALF_COORD(p2t, mRightBorder);
|
|
|
|
halfBorder.bottom = BC_BORDER_BOTTOM_HALF_COORD(p2t, mBottomBorder);
|
|
|
|
halfBorder.left = BC_BORDER_LEFT_HALF_COORD(p2t, mLeftBorder);
|
2005-03-18 02:15:44 +00:00
|
|
|
|
|
|
|
nsRect overflow(nsPoint(0,0), GetSize());
|
|
|
|
overflow.Inflate(halfBorder);
|
|
|
|
aOverflowArea = overflow;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-07 15:23:08 +00:00
|
|
|
void
|
2006-01-26 02:29:17 +00:00
|
|
|
nsBCTableCellFrame::PaintBackground(nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsPoint aPt)
|
2002-03-07 15:23:08 +00:00
|
|
|
{
|
2006-01-26 02:29:17 +00:00
|
|
|
// make border-width reflect the half of the border-collapse
|
|
|
|
// assigned border that's inside the cell
|
|
|
|
nsPresContext* presContext = GetPresContext();
|
|
|
|
GET_PIXELS_TO_TWIPS(presContext, p2t);
|
|
|
|
nsMargin borderWidth;
|
|
|
|
GetBorderWidth(p2t, borderWidth);
|
2002-03-07 15:23:08 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
nsStyleBorder myBorder(*GetStyleBorder());
|
|
|
|
|
|
|
|
NS_FOR_CSS_SIDES(side) {
|
|
|
|
myBorder.SetBorderWidth(side, borderWidth.side(side));
|
2002-03-07 15:23:08 +00:00
|
|
|
}
|
2006-01-26 02:29:17 +00:00
|
|
|
|
|
|
|
nsRect rect(aPt, GetSize());
|
|
|
|
nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
|
|
|
|
aDirtyRect, rect, myBorder, *GetStylePadding(),
|
|
|
|
PR_TRUE);
|
2002-03-07 15:23:08 +00:00
|
|
|
}
|