2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 18:30:37 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
2004-04-18 18:30:37 +04: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-14 00:24:54 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04: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-14 00:24:54 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
2000-02-03 01:24:56 +03:00
|
|
|
* Pierre Phaneuf <pp@ludusdesign.com>
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 18:30:37 +04: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-29 00:14:13 +04: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 18:30:37 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04: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 18:30:37 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nsTableOuterFrame.h"
|
|
|
|
#include "nsTableFrame.h"
|
2003-02-22 03:32:13 +03:00
|
|
|
#include "nsStyleContext.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nsStyleConsts.h"
|
2004-08-01 03:15:21 +04:00
|
|
|
#include "nsPresContext.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nsIRenderingContext.h"
|
|
|
|
#include "nsCSSRendering.h"
|
|
|
|
#include "nsIContent.h"
|
1998-07-02 21:40:56 +04:00
|
|
|
#include "prinrval.h"
|
2007-01-30 03:06:41 +03:00
|
|
|
#include "nsGkAtoms.h"
|
1999-08-10 07:52:15 +04:00
|
|
|
#include "nsHTMLParts.h"
|
|
|
|
#include "nsIPresShell.h"
|
2001-08-17 07:13:07 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2001-04-01 05:01:33 +04:00
|
|
|
#include "nsIAccessibilityService.h"
|
2001-08-17 07:13:07 +04:00
|
|
|
#endif
|
2001-04-01 05:01:33 +04:00
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
#include "nsIDOMNode.h"
|
2006-01-26 05:29:17 +03:00
|
|
|
#include "nsDisplayList.h"
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
#include "nsLayoutUtils.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2000-03-02 09:09:37 +03:00
|
|
|
/* ----------- nsTableCaptionFrame ---------- */
|
|
|
|
|
2000-01-28 05:19:45 +03:00
|
|
|
#define NS_TABLE_FRAME_CAPTION_LIST_INDEX 0
|
2000-04-29 01:05:31 +04:00
|
|
|
#define NO_SIDE 100
|
2000-01-28 05:19:45 +03:00
|
|
|
|
|
|
|
// caption frame
|
2006-03-27 01:30:36 +04:00
|
|
|
nsTableCaptionFrame::nsTableCaptionFrame(nsStyleContext* aContext):
|
|
|
|
nsBlockFrame(aContext)
|
2000-01-28 05:19:45 +03:00
|
|
|
{
|
|
|
|
// shrink wrap
|
2002-12-19 03:12:08 +03:00
|
|
|
SetFlags(NS_BLOCK_SPACE_MGR);
|
2000-01-28 05:19:45 +03:00
|
|
|
}
|
|
|
|
|
2000-03-02 09:09:37 +03:00
|
|
|
nsTableCaptionFrame::~nsTableCaptionFrame()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-10-31 23:19:18 +03:00
|
|
|
nsIAtom*
|
|
|
|
nsTableCaptionFrame::GetType() const
|
2000-01-28 05:19:45 +03:00
|
|
|
{
|
2006-12-26 20:47:52 +03:00
|
|
|
return nsGkAtoms::tableCaptionFrame;
|
2000-01-28 05:19:45 +03:00
|
|
|
}
|
|
|
|
|
2007-01-23 07:06:56 +03:00
|
|
|
/* virtual */ nscoord
|
|
|
|
nsTableOuterFrame::GetBaseline() const
|
|
|
|
{
|
|
|
|
nsIFrame* kid = mFrames.FirstChild();
|
|
|
|
if (!kid) {
|
|
|
|
NS_NOTREACHED("no inner table");
|
|
|
|
return nsHTMLContainerFrame::GetBaseline();
|
|
|
|
}
|
|
|
|
|
|
|
|
return kid->GetBaseline() + kid->GetPosition().y;
|
|
|
|
}
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
/* virtual */ nsSize
|
|
|
|
nsTableCaptionFrame::ComputeAutoSize(nsIRenderingContext *aRenderingContext,
|
|
|
|
nsSize aCBSize, nscoord aAvailableWidth,
|
|
|
|
nsSize aMargin, nsSize aBorder,
|
|
|
|
nsSize aPadding, PRBool aShrinkWrap)
|
|
|
|
{
|
|
|
|
nsSize result = nsBlockFrame::ComputeAutoSize(aRenderingContext, aCBSize,
|
|
|
|
aAvailableWidth, aMargin, aBorder, aPadding, aShrinkWrap);
|
2008-02-27 05:02:20 +03:00
|
|
|
PRUint8 captionSide = GetStyleTableBorder()->mCaptionSide;
|
|
|
|
if (captionSide == NS_STYLE_CAPTION_SIDE_LEFT ||
|
|
|
|
captionSide == NS_STYLE_CAPTION_SIDE_RIGHT) {
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
result.width = GetMinWidth(aRenderingContext);
|
2008-02-27 05:02:20 +03:00
|
|
|
} else if (captionSide == NS_STYLE_CAPTION_SIDE_TOP ||
|
|
|
|
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM) {
|
|
|
|
// The outer frame constrains our available width to the width of
|
|
|
|
// the table. Grow if our min-width is bigger than that, but not
|
|
|
|
// larger than the containing block width. (It would really be nice
|
|
|
|
// to transmit that information another way, so we could grow up to
|
|
|
|
// the table's available width, but that's harder.)
|
|
|
|
nscoord min = GetMinWidth(aRenderingContext);
|
|
|
|
if (min > aCBSize.width)
|
|
|
|
min = aCBSize.width;
|
|
|
|
if (min > result.width)
|
|
|
|
result.width = min;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2007-04-22 23:15:24 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableCaptionFrame::GetParentStyleContextFrame(nsPresContext* aPresContext,
|
|
|
|
nsIFrame** aProviderFrame,
|
|
|
|
PRBool* aIsChild)
|
|
|
|
{
|
2007-05-08 07:59:12 +04:00
|
|
|
NS_PRECONDITION(mContent->GetParent(),
|
|
|
|
"How could we not have a parent here?");
|
|
|
|
|
2007-04-22 23:15:24 +04:00
|
|
|
// The caption's style context parent is the inner frame, unless
|
|
|
|
// it's anonymous.
|
|
|
|
nsIFrame* outerFrame = GetParent();
|
|
|
|
if (outerFrame && outerFrame->GetType() == nsGkAtoms::tableOuterFrame) {
|
|
|
|
nsIFrame* innerFrame = outerFrame->GetFirstChild(nsnull);
|
|
|
|
if (innerFrame) {
|
|
|
|
*aProviderFrame =
|
|
|
|
nsFrame::CorrectStyleParentFrame(innerFrame,
|
|
|
|
GetStyleContext()->GetPseudoType());
|
|
|
|
*aIsChild = PR_FALSE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_NOTREACHED("Where is our inner table frame?");
|
|
|
|
return nsBlockFrame::GetParentStyleContextFrame(aPresContext, aProviderFrame,
|
|
|
|
aIsChild);
|
|
|
|
}
|
|
|
|
|
2007-07-05 19:39:29 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
|
|
|
NS_IMETHODIMP nsTableCaptionFrame::GetAccessible(nsIAccessible** aAccessible)
|
|
|
|
{
|
|
|
|
*aAccessible = nsnull;
|
|
|
|
if (!GetRect().IsEmpty()) {
|
|
|
|
nsCOMPtr<nsIAccessibilityService> accService = do_GetService("@mozilla.org/accessibilityService;1");
|
|
|
|
if (accService) {
|
2007-07-08 11:08:04 +04:00
|
|
|
return accService->CreateHTMLCaptionAccessible(static_cast<nsIFrame*>(this), aAccessible);
|
2007-07-05 19:39:29 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-07-20 12:50:26 +04:00
|
|
|
#ifdef NS_DEBUG
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableCaptionFrame::GetFrameName(nsAString& aResult) const
|
|
|
|
{
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("Caption"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-11-04 05:38:33 +03:00
|
|
|
nsIFrame*
|
2006-03-27 01:30:36 +04:00
|
|
|
NS_NewTableCaptionFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
2000-01-28 05:19:45 +03:00
|
|
|
{
|
2006-03-27 01:30:36 +04:00
|
|
|
return new (aPresShell) nsTableCaptionFrame(aContext);
|
2000-01-28 05:19:45 +03:00
|
|
|
}
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/* ----------- nsTableOuterFrame ---------- */
|
|
|
|
|
1999-08-01 22:26:45 +04:00
|
|
|
NS_IMPL_ADDREF_INHERITED(nsTableOuterFrame, nsHTMLContainerFrame)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(nsTableOuterFrame, nsHTMLContainerFrame)
|
|
|
|
|
2006-03-27 01:30:36 +04:00
|
|
|
nsTableOuterFrame::nsTableOuterFrame(nsStyleContext* aContext):
|
|
|
|
nsHTMLContainerFrame(aContext)
|
2000-03-02 09:09:37 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsTableOuterFrame::~nsTableOuterFrame()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-07-04 06:15:31 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableOuterFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
1999-08-01 22:26:45 +04:00
|
|
|
{
|
2007-07-04 06:15:31 +04:00
|
|
|
NS_PRECONDITION(aInstancePtr, "null out param");
|
2001-04-01 05:01:33 +04:00
|
|
|
|
2007-07-04 06:15:31 +04:00
|
|
|
if (aIID.Equals(NS_GET_IID(nsITableLayout))) {
|
2007-07-08 11:08:04 +04:00
|
|
|
*aInstancePtr = static_cast<nsITableLayout*>(this);
|
1999-08-01 22:26:45 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2001-05-18 03:52:32 +04:00
|
|
|
|
|
|
|
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
|
|
|
|
}
|
|
|
|
|
2001-08-17 07:13:07 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2001-05-18 03:52:32 +04:00
|
|
|
NS_IMETHODIMP nsTableOuterFrame::GetAccessible(nsIAccessible** aAccessible)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIAccessibilityService> accService = do_GetService("@mozilla.org/accessibilityService;1");
|
|
|
|
|
|
|
|
if (accService) {
|
2007-07-08 11:08:04 +04:00
|
|
|
return accService->CreateHTMLTableAccessible(static_cast<nsIFrame*>(this), aAccessible);
|
2001-05-18 03:52:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_ERROR_FAILURE;
|
1999-08-01 22:26:45 +04:00
|
|
|
}
|
2001-08-17 07:13:07 +04:00
|
|
|
#endif
|
2001-05-18 03:52:32 +04:00
|
|
|
|
2004-03-12 07:40:17 +03:00
|
|
|
/* virtual */ PRBool
|
|
|
|
nsTableOuterFrame::IsContainingBlock() const
|
2000-04-29 01:05:31 +04:00
|
|
|
{
|
2004-03-12 07:40:17 +03:00
|
|
|
return PR_FALSE;
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
|
|
|
|
2006-07-20 12:50:26 +04:00
|
|
|
void
|
|
|
|
nsTableOuterFrame::Destroy()
|
|
|
|
{
|
|
|
|
mCaptionFrames.DestroyFrames();
|
|
|
|
nsHTMLContainerFrame::Destroy();
|
|
|
|
}
|
|
|
|
|
2004-01-09 17:20:53 +03:00
|
|
|
nsIFrame*
|
|
|
|
nsTableOuterFrame::GetFirstChild(nsIAtom* aListName) const
|
2000-01-28 05:19:45 +03:00
|
|
|
{
|
2006-12-26 20:47:52 +03:00
|
|
|
if (nsGkAtoms::captionList == aListName) {
|
2005-12-03 18:13:08 +03:00
|
|
|
return mCaptionFrames.FirstChild();
|
2004-01-09 17:20:53 +03:00
|
|
|
}
|
|
|
|
if (!aListName) {
|
|
|
|
return mFrames.FirstChild();
|
|
|
|
}
|
|
|
|
return nsnull;
|
2000-01-28 05:19:45 +03:00
|
|
|
}
|
|
|
|
|
2004-01-09 17:20:53 +03:00
|
|
|
nsIAtom*
|
|
|
|
nsTableOuterFrame::GetAdditionalChildListName(PRInt32 aIndex) const
|
2000-01-28 05:19:45 +03:00
|
|
|
{
|
2004-01-09 17:20:53 +03:00
|
|
|
if (aIndex == NS_TABLE_FRAME_CAPTION_LIST_INDEX) {
|
2006-12-26 20:47:52 +03:00
|
|
|
return nsGkAtoms::captionList;
|
2000-01-28 05:19:45 +03:00
|
|
|
}
|
2004-01-09 17:20:53 +03:00
|
|
|
return nsnull;
|
2000-01-28 05:19:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2006-04-10 04:16:29 +04:00
|
|
|
nsTableOuterFrame::SetInitialChildList(nsIAtom* aListName,
|
2000-01-28 05:19:45 +03:00
|
|
|
nsIFrame* aChildList)
|
|
|
|
{
|
2006-12-26 20:47:52 +03:00
|
|
|
if (nsGkAtoms::captionList == aListName) {
|
2000-01-28 05:19:45 +03:00
|
|
|
// the frame constructor already checked for table-caption display type
|
2005-12-03 18:13:08 +03:00
|
|
|
mCaptionFrames.SetFrames(aChildList);
|
|
|
|
mCaptionFrame = mCaptionFrames.FirstChild();
|
2000-01-28 05:19:45 +03:00
|
|
|
}
|
|
|
|
else {
|
2006-03-18 10:18:54 +03:00
|
|
|
NS_ASSERTION(!aListName, "wrong childlist");
|
|
|
|
NS_ASSERTION(mFrames.IsEmpty(), "Frame leak!");
|
2000-01-28 05:19:45 +03:00
|
|
|
mFrames.SetFrames(aChildList);
|
2002-02-19 18:48:28 +03:00
|
|
|
mInnerTableFrame = nsnull;
|
|
|
|
if (aChildList) {
|
2006-12-26 20:47:52 +03:00
|
|
|
if (nsGkAtoms::tableFrame == aChildList->GetType()) {
|
2002-02-19 18:48:28 +03:00
|
|
|
mInnerTableFrame = (nsTableFrame*)aChildList;
|
|
|
|
}
|
2006-06-29 06:32:36 +04:00
|
|
|
else {
|
|
|
|
NS_ERROR("expected a table frame");
|
|
|
|
return NS_ERROR_INVALID_ARG;
|
|
|
|
}
|
2002-02-19 18:48:28 +03:00
|
|
|
}
|
2000-01-28 05:19:45 +03:00
|
|
|
}
|
|
|
|
|
1998-09-16 21:19:20 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-08-10 07:52:15 +04:00
|
|
|
NS_IMETHODIMP
|
2005-02-07 04:58:25 +03:00
|
|
|
nsTableOuterFrame::AppendFrames(nsIAtom* aListName,
|
1999-08-10 07:52:15 +04:00
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
2000-01-28 05:19:45 +03:00
|
|
|
nsresult rv;
|
1999-08-10 07:52:15 +04:00
|
|
|
|
2005-12-03 18:13:08 +03:00
|
|
|
// We only have two child frames: the inner table and a caption frame.
|
1999-08-10 07:52:15 +04:00
|
|
|
// The inner frame is provided when we're initialized, and it cannot change
|
2006-12-26 20:47:52 +03:00
|
|
|
if (nsGkAtoms::captionList == aListName) {
|
2006-06-29 06:32:36 +04:00
|
|
|
NS_ASSERTION(!aFrameList ||
|
2006-12-26 20:47:52 +03:00
|
|
|
aFrameList->GetType() == nsGkAtoms::tableCaptionFrame,
|
2006-06-29 06:32:36 +04:00
|
|
|
"appending non-caption frame to captionList");
|
2005-12-03 18:13:08 +03:00
|
|
|
mCaptionFrames.AppendFrames(this, aFrameList);
|
|
|
|
mCaptionFrame = mCaptionFrames.FirstChild();
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
rv = NS_OK;
|
2005-12-03 18:13:08 +03:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
// Reflow the new caption frame. It's already marked dirty, so
|
|
|
|
// just tell the pres shell.
|
2007-03-31 01:11:41 +04:00
|
|
|
PresContext()->PresShell()->
|
2007-05-06 23:16:51 +04:00
|
|
|
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
|
|
|
|
NS_FRAME_HAS_DIRTY_CHILDREN);
|
1999-08-10 07:52:15 +04:00
|
|
|
}
|
|
|
|
else {
|
2006-06-29 06:32:36 +04:00
|
|
|
NS_PRECONDITION(PR_FALSE, "unexpected child list");
|
1999-08-10 07:52:15 +04:00
|
|
|
rv = NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-02-07 04:58:25 +03:00
|
|
|
nsTableOuterFrame::InsertFrames(nsIAtom* aListName,
|
1999-08-10 07:52:15 +04:00
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
2006-12-26 20:47:52 +03:00
|
|
|
if (nsGkAtoms::captionList == aListName) {
|
2006-06-29 06:32:36 +04:00
|
|
|
NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
|
|
|
|
"inserting after sibling frame with different parent");
|
|
|
|
NS_ASSERTION(!aFrameList ||
|
2006-12-26 20:47:52 +03:00
|
|
|
aFrameList->GetType() == nsGkAtoms::tableCaptionFrame,
|
2006-06-29 06:32:36 +04:00
|
|
|
"inserting non-caption frame into captionList");
|
2005-12-03 18:13:08 +03:00
|
|
|
mCaptionFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
|
|
|
|
mCaptionFrame = mCaptionFrames.FirstChild();
|
2007-08-03 01:34:58 +04:00
|
|
|
|
|
|
|
// Reflow the new caption frame. It's already marked dirty, so
|
|
|
|
// just tell the pres shell.
|
|
|
|
PresContext()->PresShell()->
|
|
|
|
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
|
|
|
|
NS_FRAME_HAS_DIRTY_CHILDREN);
|
2006-01-26 05:29:17 +03:00
|
|
|
return NS_OK;
|
2005-12-03 18:13:08 +03:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
NS_PRECONDITION(!aPrevFrame, "invalid previous frame");
|
|
|
|
return AppendFrames(aListName, aFrameList);
|
|
|
|
}
|
1999-08-10 07:52:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-02-07 04:58:25 +03:00
|
|
|
nsTableOuterFrame::RemoveFrame(nsIAtom* aListName,
|
1999-08-10 07:52:15 +04:00
|
|
|
nsIFrame* aOldFrame)
|
|
|
|
{
|
|
|
|
// We only have two child frames: the inner table and one caption frame.
|
|
|
|
// The inner frame can't be removed so this should be the caption
|
2006-12-26 20:47:52 +03:00
|
|
|
NS_PRECONDITION(nsGkAtoms::captionList == aListName, "can't remove inner frame");
|
1999-08-10 07:52:15 +04:00
|
|
|
|
2008-02-27 05:02:20 +03:00
|
|
|
if (HasSideCaption()) {
|
1999-08-10 07:52:15 +04:00
|
|
|
// The old caption width had an effect on the inner table width so
|
|
|
|
// we're going to need to reflow it. Mark it dirty
|
2003-07-07 06:01:29 +04:00
|
|
|
mInnerTableFrame->AddStateBits(NS_FRAME_IS_DIRTY);
|
1999-08-10 07:52:15 +04:00
|
|
|
}
|
|
|
|
|
2005-12-03 18:13:08 +03:00
|
|
|
// Remove the frame and destroy it
|
2006-04-10 04:16:29 +04:00
|
|
|
mCaptionFrames.DestroyFrame(aOldFrame);
|
2005-12-03 18:13:08 +03:00
|
|
|
mCaptionFrame = mCaptionFrames.FirstChild();
|
|
|
|
|
2007-03-31 01:11:41 +04:00
|
|
|
PresContext()->PresShell()->
|
2007-05-06 23:16:51 +04:00
|
|
|
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
|
|
|
|
NS_FRAME_HAS_DIRTY_CHILDREN); // also means child removed
|
1999-08-10 07:52:15 +04:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-09-19 16:35:19 +04:00
|
|
|
NS_METHOD
|
2006-01-26 05:29:17 +03:00
|
|
|
nsTableOuterFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
2006-01-26 05:29:17 +03:00
|
|
|
// No border, background or outline are painted because they all belong
|
|
|
|
// to the inner table.
|
|
|
|
if (!IsVisibleInSelection(aBuilder))
|
2001-01-27 17:09:34 +03:00
|
|
|
return NS_OK;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
// If there's no caption, take a short cut to avoid having to create
|
|
|
|
// the special display list set and then sort it.
|
|
|
|
if (!mCaptionFrame)
|
|
|
|
return BuildDisplayListForInnerTable(aBuilder, aDirtyRect, aLists);
|
|
|
|
|
|
|
|
nsDisplayListCollection set;
|
|
|
|
nsresult rv = BuildDisplayListForInnerTable(aBuilder, aDirtyRect, set);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2001-12-09 08:39:45 +03:00
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
nsDisplayListSet captionSet(set, set.BlockBorderBackgrounds());
|
|
|
|
rv = BuildDisplayListForChild(aBuilder, mCaptionFrame, aDirtyRect, captionSet);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2000-01-28 05:19:45 +03:00
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
// Now we have to sort everything by content order, since the caption
|
|
|
|
// may be somewhere inside the table
|
|
|
|
set.SortAllByContentOrder(aBuilder, GetContent());
|
|
|
|
set.MoveTo(aLists);
|
1998-04-17 05:41:24 +04:00
|
|
|
return NS_OK;
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
nsresult
|
|
|
|
nsTableOuterFrame::BuildDisplayListForInnerTable(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
2000-03-22 05:43:08 +03:00
|
|
|
{
|
2006-01-26 05:29:17 +03:00
|
|
|
// Just paint the regular children, but the children's background is our
|
|
|
|
// true background (there should only be one, the real table)
|
|
|
|
nsIFrame* kid = mFrames.FirstChild();
|
|
|
|
// The children should be in content order
|
|
|
|
while (kid) {
|
|
|
|
nsresult rv = BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aLists);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
kid = kid->GetNextSibling();
|
2000-05-16 15:35:12 +04:00
|
|
|
}
|
2006-01-26 05:29:17 +03:00
|
|
|
return NS_OK;
|
2000-03-22 05:43:08 +03:00
|
|
|
}
|
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHODIMP nsTableOuterFrame::SetSelected(nsPresContext* aPresContext,
|
1999-10-26 08:44:41 +04:00
|
|
|
nsIDOMRange *aRange,
|
|
|
|
PRBool aSelected,
|
2008-09-07 18:12:50 +04:00
|
|
|
nsSpread aSpread,
|
|
|
|
SelectionType aType)
|
1999-05-20 04:52:00 +04:00
|
|
|
{
|
2008-09-07 18:12:50 +04:00
|
|
|
nsresult result = nsFrame::SetSelected(aPresContext, aRange,aSelected, aSpread, aType);
|
1999-05-20 04:52:00 +04:00
|
|
|
if (NS_SUCCEEDED(result) && mInnerTableFrame)
|
2008-09-07 18:12:50 +04:00
|
|
|
return mInnerTableFrame->SetSelected(aPresContext, aRange,aSelected, aSpread, aType);
|
1999-05-20 04:52:00 +04:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2000-09-13 02:48:35 +04:00
|
|
|
NS_IMETHODIMP
|
2004-08-01 03:15:21 +04:00
|
|
|
nsTableOuterFrame::GetParentStyleContextFrame(nsPresContext* aPresContext,
|
2002-03-27 05:38:13 +03:00
|
|
|
nsIFrame** aProviderFrame,
|
|
|
|
PRBool* aIsChild)
|
2000-09-13 02:48:35 +04:00
|
|
|
{
|
2002-03-27 05:38:13 +03:00
|
|
|
// The table outer frame and the (inner) table frame split the style
|
|
|
|
// data by giving the table frame the style context associated with
|
|
|
|
// the table content node and creating a style context for the outer
|
|
|
|
// frame that is a *child* of the table frame's style context,
|
2003-07-08 01:57:01 +04:00
|
|
|
// matching the ::-moz-table-outer pseudo-element. html.css has a
|
|
|
|
// rule that causes that pseudo-element (and thus the outer table)
|
|
|
|
// to inherit *some* style properties from the table frame. The
|
|
|
|
// children of the table inherit directly from the inner table, and
|
|
|
|
// the outer table's style context is a leaf.
|
2002-03-27 05:38:13 +03:00
|
|
|
|
|
|
|
if (!mInnerTableFrame) {
|
|
|
|
*aProviderFrame = this;
|
|
|
|
*aIsChild = PR_FALSE;
|
|
|
|
return NS_ERROR_FAILURE;
|
2000-09-13 02:48:35 +04:00
|
|
|
}
|
2002-03-27 05:38:13 +03:00
|
|
|
*aProviderFrame = mInnerTableFrame;
|
|
|
|
*aIsChild = PR_TRUE;
|
|
|
|
return NS_OK;
|
2000-09-13 02:48:35 +04:00
|
|
|
}
|
|
|
|
|
2000-04-29 01:05:31 +04:00
|
|
|
// INCREMENTAL REFLOW HELPER FUNCTIONS
|
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
void
|
2004-08-01 03:15:21 +04:00
|
|
|
nsTableOuterFrame::InitChildReflowState(nsPresContext& aPresContext,
|
2002-02-19 18:48:28 +03:00
|
|
|
nsHTMLReflowState& aReflowState)
|
|
|
|
|
|
|
|
{
|
|
|
|
nsMargin collapseBorder;
|
|
|
|
nsMargin collapsePadding(0,0,0,0);
|
|
|
|
nsMargin* pCollapseBorder = nsnull;
|
|
|
|
nsMargin* pCollapsePadding = nsnull;
|
|
|
|
if ((aReflowState.frame == mInnerTableFrame) && (mInnerTableFrame->IsBorderCollapse())) {
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
collapseBorder = mInnerTableFrame->GetIncludedOuterBCBorder();
|
2003-09-13 20:26:30 +04:00
|
|
|
pCollapseBorder = &collapseBorder;
|
2002-02-19 18:48:28 +03:00
|
|
|
pCollapsePadding = &collapsePadding;
|
|
|
|
}
|
|
|
|
aReflowState.Init(&aPresContext, -1, -1, pCollapseBorder, pCollapsePadding);
|
|
|
|
}
|
|
|
|
|
2000-04-29 01:05:31 +04:00
|
|
|
// get the margin and padding data. nsHTMLReflowState doesn't handle the
|
|
|
|
// case of auto margins
|
|
|
|
void
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
nsTableOuterFrame::GetMargin(nsPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState& aOuterRS,
|
|
|
|
nsIFrame* aChildFrame,
|
|
|
|
nscoord aAvailWidth,
|
|
|
|
nsMargin& aMargin)
|
2002-02-19 18:48:28 +03:00
|
|
|
{
|
2000-04-29 01:05:31 +04:00
|
|
|
// construct a reflow state to compute margin and padding. Auto margins
|
|
|
|
// will not be computed at this time.
|
2002-02-19 18:48:28 +03:00
|
|
|
|
2002-11-08 08:29:34 +03:00
|
|
|
// create and init the child reflow state
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
// XXX We really shouldn't construct a reflow state to do this.
|
|
|
|
nsHTMLReflowState childRS(aPresContext, aOuterRS, aChildFrame,
|
|
|
|
nsSize(aAvailWidth, aOuterRS.availableHeight),
|
|
|
|
-1, -1, PR_FALSE);
|
2002-02-19 18:48:28 +03:00
|
|
|
InitChildReflowState(*aPresContext, childRS);
|
|
|
|
|
2000-09-11 04:02:04 +04:00
|
|
|
aMargin = childRS.mComputedMargin;
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
|
|
|
|
2005-04-07 22:04:38 +04:00
|
|
|
static
|
2000-04-29 01:05:31 +04:00
|
|
|
nscoord CalcAutoMargin(nscoord aAutoMargin,
|
|
|
|
nscoord aOppositeMargin,
|
|
|
|
nscoord aContainBlockSize,
|
2007-02-07 10:46:44 +03:00
|
|
|
nscoord aFrameSize)
|
2000-04-29 01:05:31 +04:00
|
|
|
{
|
|
|
|
nscoord margin;
|
2001-11-19 18:51:28 +03:00
|
|
|
if (NS_AUTOMARGIN == aOppositeMargin)
|
2007-02-22 23:22:12 +03:00
|
|
|
margin = (aContainBlockSize - aFrameSize) / 2;
|
2000-04-29 01:05:31 +04:00
|
|
|
else {
|
|
|
|
margin = aContainBlockSize - aFrameSize - aOppositeMargin;
|
|
|
|
}
|
|
|
|
return PR_MAX(0, margin);
|
|
|
|
}
|
|
|
|
|
2005-04-07 22:04:38 +04:00
|
|
|
static nsSize
|
2000-04-29 01:05:31 +04:00
|
|
|
GetContainingBlockSize(const nsHTMLReflowState& aOuterRS)
|
|
|
|
{
|
|
|
|
nsSize size(0,0);
|
2002-05-14 16:59:55 +04:00
|
|
|
const nsHTMLReflowState* containRS =
|
2004-04-24 21:56:23 +04:00
|
|
|
aOuterRS.mCBReflowState;
|
2000-04-29 01:05:31 +04:00
|
|
|
|
|
|
|
if (containRS) {
|
2007-01-26 03:05:12 +03:00
|
|
|
size.width = containRS->ComputedWidth();
|
2000-04-29 01:05:31 +04:00
|
|
|
if (NS_UNCONSTRAINEDSIZE == size.width) {
|
|
|
|
size.width = 0;
|
|
|
|
}
|
2007-08-02 22:08:05 +04:00
|
|
|
size.height = containRS->ComputedHeight();
|
2000-04-29 01:05:31 +04:00
|
|
|
if (NS_UNCONSTRAINEDSIZE == size.height) {
|
|
|
|
size.height = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
/* virtual */ nscoord
|
|
|
|
nsTableOuterFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
|
2000-04-29 01:05:31 +04:00
|
|
|
{
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
nscoord width = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
|
|
|
|
mInnerTableFrame, nsLayoutUtils::MIN_WIDTH);
|
|
|
|
DISPLAY_MIN_WIDTH(this, width);
|
|
|
|
if (mCaptionFrame) {
|
|
|
|
nscoord capWidth =
|
|
|
|
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, mCaptionFrame,
|
|
|
|
nsLayoutUtils::MIN_WIDTH);
|
2008-02-27 05:02:20 +03:00
|
|
|
if (HasSideCaption()) {
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
width += capWidth;
|
2008-02-27 05:02:20 +03:00
|
|
|
} else {
|
2003-01-09 17:26:32 +03:00
|
|
|
if (capWidth > width) {
|
|
|
|
width = capWidth;
|
2002-11-08 08:29:34 +03:00
|
|
|
}
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
|
|
|
}
|
2003-01-09 17:26:32 +03:00
|
|
|
return width;
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
/* virtual */ nscoord
|
|
|
|
nsTableOuterFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
|
2000-04-29 01:05:31 +04:00
|
|
|
{
|
|
|
|
nscoord maxWidth;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
DISPLAY_PREF_WIDTH(this, maxWidth);
|
2002-11-08 08:29:34 +03:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
maxWidth = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
|
|
|
|
mInnerTableFrame, nsLayoutUtils::PREF_WIDTH);
|
2002-11-08 08:29:34 +03:00
|
|
|
if (mCaptionFrame) {
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
PRUint8 captionSide = GetCaptionSide();
|
|
|
|
switch(captionSide) {
|
2008-02-27 05:02:20 +03:00
|
|
|
case NS_STYLE_CAPTION_SIDE_LEFT:
|
|
|
|
case NS_STYLE_CAPTION_SIDE_RIGHT:
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
{
|
|
|
|
nscoord capMin =
|
|
|
|
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, mCaptionFrame,
|
|
|
|
nsLayoutUtils::MIN_WIDTH);
|
|
|
|
maxWidth += capMin;
|
|
|
|
}
|
2002-11-08 08:29:34 +03:00
|
|
|
break;
|
2008-02-27 05:02:20 +03:00
|
|
|
default:
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
{
|
2008-02-27 05:02:20 +03:00
|
|
|
nsLayoutUtils::IntrinsicWidthType iwt;
|
|
|
|
if (captionSide == NS_STYLE_CAPTION_SIDE_TOP ||
|
|
|
|
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM) {
|
|
|
|
// Don't let the caption's pref width expand the table's pref
|
|
|
|
// width.
|
|
|
|
iwt = nsLayoutUtils::MIN_WIDTH;
|
|
|
|
} else {
|
|
|
|
NS_ASSERTION(captionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE ||
|
|
|
|
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE,
|
|
|
|
"unexpected caption side");
|
|
|
|
iwt = nsLayoutUtils::PREF_WIDTH;
|
|
|
|
}
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
nscoord capPref =
|
|
|
|
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, mCaptionFrame,
|
2008-02-27 05:02:20 +03:00
|
|
|
iwt);
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
maxWidth = PR_MAX(maxWidth, capPref);
|
|
|
|
}
|
2008-02-27 05:02:20 +03:00
|
|
|
break;
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return maxWidth;
|
|
|
|
}
|
|
|
|
|
2008-02-28 20:55:04 +03:00
|
|
|
// Compute the margin-box width of aChildFrame given the inputs. If
|
|
|
|
// aMarginResult is non-null, fill it with the part of the margin-width
|
|
|
|
// that was contributed by the margin.
|
|
|
|
static nscoord
|
|
|
|
ChildShrinkWrapWidth(nsIRenderingContext *aRenderingContext,
|
|
|
|
nsIFrame *aChildFrame,
|
|
|
|
nsSize aCBSize, nscoord aAvailableWidth,
|
|
|
|
nscoord *aMarginResult = nsnull)
|
|
|
|
{
|
|
|
|
// The outer table's children do not use it as a containing block.
|
|
|
|
nsCSSOffsetState offsets(aChildFrame, aRenderingContext, aCBSize.width);
|
|
|
|
nsSize size = aChildFrame->ComputeSize(aRenderingContext, aCBSize,
|
|
|
|
aAvailableWidth,
|
|
|
|
nsSize(offsets.mComputedMargin.LeftRight(),
|
|
|
|
offsets.mComputedMargin.TopBottom()),
|
|
|
|
nsSize(offsets.mComputedBorderPadding.LeftRight() -
|
|
|
|
offsets.mComputedPadding.LeftRight(),
|
|
|
|
offsets.mComputedBorderPadding.TopBottom() -
|
|
|
|
offsets.mComputedPadding.TopBottom()),
|
|
|
|
nsSize(offsets.mComputedPadding.LeftRight(),
|
|
|
|
offsets.mComputedPadding.TopBottom()),
|
|
|
|
PR_TRUE);
|
|
|
|
if (aMarginResult)
|
|
|
|
*aMarginResult = offsets.mComputedMargin.LeftRight();
|
|
|
|
return size.width + offsets.mComputedMargin.LeftRight() +
|
|
|
|
offsets.mComputedBorderPadding.LeftRight();
|
|
|
|
}
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
/* virtual */ nsSize
|
|
|
|
nsTableOuterFrame::ComputeAutoSize(nsIRenderingContext *aRenderingContext,
|
|
|
|
nsSize aCBSize, nscoord aAvailableWidth,
|
|
|
|
nsSize aMargin, nsSize aBorder,
|
|
|
|
nsSize aPadding, PRBool aShrinkWrap)
|
|
|
|
{
|
|
|
|
if (!aShrinkWrap)
|
|
|
|
return nsHTMLContainerFrame::ComputeAutoSize(aRenderingContext, aCBSize,
|
|
|
|
aAvailableWidth, aMargin, aBorder, aPadding, aShrinkWrap);
|
|
|
|
|
|
|
|
// When we're shrink-wrapping, our auto size needs to wrap around the
|
|
|
|
// actual size of the table, which (if it is specified as a percent)
|
|
|
|
// could be something that is not reflected in our GetMinWidth and
|
|
|
|
// GetPrefWidth. See bug 349457 for an example.
|
|
|
|
|
2008-02-28 20:55:04 +03:00
|
|
|
// Match the availableWidth logic in Reflow.
|
|
|
|
PRUint8 captionSide = GetCaptionSide();
|
|
|
|
nscoord width;
|
|
|
|
if (captionSide == NO_SIDE) {
|
|
|
|
width = ChildShrinkWrapWidth(aRenderingContext, mInnerTableFrame,
|
|
|
|
aCBSize, aAvailableWidth);
|
|
|
|
} else if (captionSide == NS_STYLE_CAPTION_SIDE_LEFT ||
|
|
|
|
captionSide == NS_STYLE_CAPTION_SIDE_RIGHT) {
|
|
|
|
nscoord capWidth = ChildShrinkWrapWidth(aRenderingContext, mCaptionFrame,
|
|
|
|
aCBSize, aAvailableWidth);
|
|
|
|
width = capWidth + ChildShrinkWrapWidth(aRenderingContext,
|
|
|
|
mInnerTableFrame, aCBSize,
|
|
|
|
aAvailableWidth - capWidth);
|
|
|
|
} else if (captionSide == NS_STYLE_CAPTION_SIDE_TOP ||
|
|
|
|
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM) {
|
|
|
|
nscoord margin;
|
|
|
|
width = ChildShrinkWrapWidth(aRenderingContext, mInnerTableFrame,
|
|
|
|
aCBSize, aAvailableWidth, &margin);
|
|
|
|
nscoord capWidth = ChildShrinkWrapWidth(aRenderingContext,
|
|
|
|
mCaptionFrame, aCBSize,
|
|
|
|
width - margin);
|
|
|
|
if (capWidth > width)
|
|
|
|
width = capWidth;
|
|
|
|
} else {
|
|
|
|
NS_ASSERTION(captionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE ||
|
|
|
|
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE,
|
|
|
|
"unexpected caption-side");
|
|
|
|
width = ChildShrinkWrapWidth(aRenderingContext, mInnerTableFrame,
|
|
|
|
aCBSize, aAvailableWidth);
|
|
|
|
nscoord capWidth = ChildShrinkWrapWidth(aRenderingContext,
|
|
|
|
mCaptionFrame, aCBSize,
|
|
|
|
aAvailableWidth);
|
|
|
|
if (capWidth > width)
|
|
|
|
width = capWidth;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return nsSize(width, NS_UNCONSTRAINEDSIZE);
|
|
|
|
}
|
2000-04-29 01:05:31 +04:00
|
|
|
|
|
|
|
PRUint8
|
|
|
|
nsTableOuterFrame::GetCaptionSide()
|
1998-06-19 04:34:12 +04:00
|
|
|
{
|
2000-04-29 01:05:31 +04:00
|
|
|
if (mCaptionFrame) {
|
2003-05-15 07:42:21 +04:00
|
|
|
return mCaptionFrame->GetStyleTableBorder()->mCaptionSide;
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
return NO_SIDE; // no caption
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-08 08:29:34 +03:00
|
|
|
PRUint8
|
|
|
|
nsTableOuterFrame::GetCaptionVerticalAlign()
|
|
|
|
{
|
2005-04-07 22:04:38 +04:00
|
|
|
const nsStyleCoord& va = mCaptionFrame->GetStyleTextReset()->mVerticalAlign;
|
|
|
|
return (va.GetUnit() == eStyleUnit_Enumerated)
|
|
|
|
? va.GetIntValue()
|
|
|
|
: NS_STYLE_VERTICAL_ALIGN_TOP;
|
2002-11-08 08:29:34 +03:00
|
|
|
}
|
2000-04-29 01:05:31 +04:00
|
|
|
|
|
|
|
void
|
2004-12-27 18:05:18 +03:00
|
|
|
nsTableOuterFrame::SetDesiredSize(PRUint8 aCaptionSide,
|
2000-04-29 01:05:31 +04:00
|
|
|
const nsMargin& aInnerMargin,
|
|
|
|
const nsMargin& aCaptionMargin,
|
|
|
|
nscoord& aWidth,
|
|
|
|
nscoord& aHeight)
|
|
|
|
{
|
|
|
|
aWidth = aHeight = 0;
|
|
|
|
|
2003-07-07 06:01:29 +04:00
|
|
|
nsRect innerRect = mInnerTableFrame->GetRect();
|
2002-11-08 08:29:34 +03:00
|
|
|
nscoord innerWidth = innerRect.width;
|
2000-04-29 01:05:31 +04:00
|
|
|
|
|
|
|
nsRect captionRect(0,0,0,0);
|
2002-11-08 08:29:34 +03:00
|
|
|
nscoord captionWidth = 0;
|
2000-04-29 01:05:31 +04:00
|
|
|
if (mCaptionFrame) {
|
2003-07-07 06:01:29 +04:00
|
|
|
captionRect = mCaptionFrame->GetRect();
|
2002-11-08 08:29:34 +03:00
|
|
|
captionWidth = captionRect.width;
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
|
|
|
switch(aCaptionSide) {
|
2008-02-27 05:02:20 +03:00
|
|
|
case NS_STYLE_CAPTION_SIDE_LEFT:
|
2002-11-08 08:29:34 +03:00
|
|
|
aWidth = PR_MAX(aInnerMargin.left, aCaptionMargin.left + captionWidth + aCaptionMargin.right) +
|
|
|
|
innerWidth + aInnerMargin.right;
|
|
|
|
break;
|
2008-02-27 05:02:20 +03:00
|
|
|
case NS_STYLE_CAPTION_SIDE_RIGHT:
|
2002-11-08 08:29:34 +03:00
|
|
|
aWidth = PR_MAX(aInnerMargin.right, aCaptionMargin.left + captionWidth + aCaptionMargin.right) +
|
|
|
|
innerWidth + aInnerMargin.left;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
aWidth = aInnerMargin.left + innerWidth + aInnerMargin.right;
|
|
|
|
aWidth = PR_MAX(aWidth, captionRect.XMost() + aCaptionMargin.right);
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
2002-11-08 08:29:34 +03:00
|
|
|
aHeight = innerRect.YMost() + aInnerMargin.bottom;
|
|
|
|
aHeight = PR_MAX(aHeight, captionRect.YMost() + aCaptionMargin.bottom);
|
1998-06-19 04:34:12 +04:00
|
|
|
|
2002-11-08 08:29:34 +03:00
|
|
|
}
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
// XXX This is now unused, but it probably should be used!
|
2002-11-08 08:29:34 +03:00
|
|
|
void
|
2004-12-27 18:05:18 +03:00
|
|
|
nsTableOuterFrame::BalanceLeftRightCaption(PRUint8 aCaptionSide,
|
2002-11-08 08:29:34 +03:00
|
|
|
const nsMargin& aInnerMargin,
|
|
|
|
const nsMargin& aCaptionMargin,
|
|
|
|
nscoord& aInnerWidth,
|
|
|
|
nscoord& aCaptionWidth)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* balance the caption and inner table widths to ensure space for percent widths
|
|
|
|
* Percent widths for captions or the inner table frame can determine how much of the
|
|
|
|
* available width is used and how the available width is distributed between those frames
|
|
|
|
* The inner table frame has already a quite sophisticated treatment of percentage widths
|
|
|
|
* (see BasicTableLayoutStrategy.cpp). So it acts as master in the below computations.
|
|
|
|
* There are four possible scenarios
|
|
|
|
* a) None of the frames have a percentage width - then the aInnerWidth and aCaptionwidth will not change
|
|
|
|
* b) Only the inner frame has a percentage width - this is handled in BasicTableLayoutStrategy.cpp,
|
|
|
|
* both widths will not change
|
|
|
|
* c) Only the caption has a percentage width - then the overall width (ow) will be different depending on
|
|
|
|
* the caption side. For the left side
|
|
|
|
* ow = aCaptionMargin.left + aCaptionWidth + aCaptionMargin.right + aInnerwidth + aInnerMargin.right
|
|
|
|
* aCaptionWidth = capPercent * ow
|
|
|
|
* solving this equation for aCaptionWidth gives:
|
|
|
|
* aCaptionWidth = capPercent/(1-capPercent) *
|
|
|
|
* (aCaptionMargin.left + aCaptionMargin.right + aInnerwidth + aInnerMargin.right)
|
|
|
|
* this result will cause problems for capPercent >= 1, in these cases the algorithm will now bail out
|
2003-03-19 07:35:08 +03:00
|
|
|
* a similar expression can be found for the right case
|
2002-11-08 08:29:34 +03:00
|
|
|
* d) both frames have percent widths in this case the caption width will be the inner width multiplied
|
|
|
|
* by the weight capPercent/innerPercent
|
|
|
|
*/
|
|
|
|
|
1998-06-19 04:34:12 +04:00
|
|
|
|
2002-11-08 08:29:34 +03:00
|
|
|
float capPercent = -1.0;
|
|
|
|
float innerPercent = -1.0;
|
2003-05-15 07:42:21 +04:00
|
|
|
const nsStylePosition* position = mCaptionFrame->GetStylePosition();
|
2002-11-08 08:29:34 +03:00
|
|
|
if (eStyleUnit_Percent == position->mWidth.GetUnit()) {
|
|
|
|
capPercent = position->mWidth.GetPercentValue();
|
|
|
|
if (capPercent >= 1.0)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2003-05-15 07:42:21 +04:00
|
|
|
position = mInnerTableFrame->GetStylePosition();
|
2002-11-08 08:29:34 +03:00
|
|
|
if (eStyleUnit_Percent == position->mWidth.GetUnit()) {
|
|
|
|
innerPercent = position->mWidth.GetPercentValue();
|
|
|
|
if (innerPercent >= 1.0)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((capPercent <= 0.0) && (innerPercent <= 0.0))
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if (innerPercent <= 0.0) {
|
2008-02-27 05:02:20 +03:00
|
|
|
if (NS_STYLE_CAPTION_SIDE_LEFT == aCaptionSide)
|
2002-11-08 08:29:34 +03:00
|
|
|
aCaptionWidth= (nscoord) ((capPercent / (1.0 - capPercent)) * (aCaptionMargin.left + aCaptionMargin.right +
|
|
|
|
aInnerWidth + aInnerMargin.right));
|
|
|
|
else
|
|
|
|
aCaptionWidth= (nscoord) ((capPercent / (1.0 - capPercent)) * (aCaptionMargin.left + aCaptionMargin.right +
|
|
|
|
aInnerWidth + aInnerMargin.left));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
aCaptionWidth = (nscoord) ((capPercent / innerPercent) * aInnerWidth);
|
|
|
|
}
|
|
|
|
}
|
1998-06-19 04:34:12 +04:00
|
|
|
|
2000-04-29 01:05:31 +04:00
|
|
|
nsresult
|
2006-01-21 12:54:07 +03:00
|
|
|
nsTableOuterFrame::GetCaptionOrigin(PRUint32 aCaptionSide,
|
2000-04-29 01:05:31 +04:00
|
|
|
const nsSize& aContainBlockSize,
|
|
|
|
const nsSize& aInnerSize,
|
|
|
|
const nsMargin& aInnerMargin,
|
|
|
|
const nsSize& aCaptionSize,
|
|
|
|
nsMargin& aCaptionMargin,
|
|
|
|
nsPoint& aOrigin)
|
|
|
|
{
|
2008-02-27 05:03:11 +03:00
|
|
|
// FIXME: This function expects computed margin values to be
|
|
|
|
// NS_AUTOMARGIN, but this is no longer the case.
|
2000-04-29 01:05:31 +04:00
|
|
|
aOrigin.x = aOrigin.y = 0;
|
2002-11-08 08:29:34 +03:00
|
|
|
if ((NS_UNCONSTRAINEDSIZE == aInnerSize.width) || (NS_UNCONSTRAINEDSIZE == aInnerSize.height) ||
|
|
|
|
(NS_UNCONSTRAINEDSIZE == aCaptionSize.width) || (NS_UNCONSTRAINEDSIZE == aCaptionSize.height)) {
|
2000-04-29 01:05:31 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
if (!mCaptionFrame) return NS_OK;
|
|
|
|
|
2008-02-27 05:03:11 +03:00
|
|
|
// FIXME: Have two separate switch statements so we can coalesce the
|
|
|
|
// horizontal computation for top and bottom.
|
2000-04-29 01:05:31 +04:00
|
|
|
switch(aCaptionSide) {
|
2008-02-27 05:02:20 +03:00
|
|
|
case NS_STYLE_CAPTION_SIDE_BOTTOM:
|
|
|
|
case NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE: {
|
2000-04-29 01:05:31 +04:00
|
|
|
if (NS_AUTOMARGIN == aCaptionMargin.left) {
|
|
|
|
aCaptionMargin.left = CalcAutoMargin(aCaptionMargin.left, aCaptionMargin.right,
|
2007-02-07 10:46:44 +03:00
|
|
|
aContainBlockSize.width, aCaptionSize.width);
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
|
|
|
aOrigin.x = aCaptionMargin.left;
|
2008-02-27 05:03:11 +03:00
|
|
|
if (aCaptionSide == NS_STYLE_CAPTION_SIDE_BOTTOM) {
|
|
|
|
// We placed the caption using only the table's width as available
|
|
|
|
// width, and we should position it this way as well.
|
|
|
|
aOrigin.x += aInnerMargin.left;
|
|
|
|
}
|
2000-04-29 01:05:31 +04:00
|
|
|
if (NS_AUTOMARGIN == aCaptionMargin.top) {
|
2000-05-10 18:51:37 +04:00
|
|
|
aCaptionMargin.top = 0;
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
2008-02-27 05:03:11 +03:00
|
|
|
// FIXME: Position relative to right edge for RTL. (Based on table
|
|
|
|
// direction or table parent direction?)
|
2003-07-24 03:04:37 +04:00
|
|
|
nsCollapsingMargin marg;
|
|
|
|
marg.Include(aCaptionMargin.top);
|
|
|
|
marg.Include(aInnerMargin.bottom);
|
|
|
|
nscoord collapseMargin = marg.get();
|
2000-05-10 18:51:37 +04:00
|
|
|
if (NS_AUTOMARGIN == aCaptionMargin.bottom) {
|
|
|
|
nscoord height = aInnerSize.height + collapseMargin + aCaptionSize.height;
|
|
|
|
aCaptionMargin.bottom = CalcAutoMargin(aCaptionMargin.bottom, aInnerMargin.top,
|
2007-02-07 10:46:44 +03:00
|
|
|
aContainBlockSize.height, height);
|
2000-05-10 18:51:37 +04:00
|
|
|
}
|
|
|
|
aOrigin.y = aInnerMargin.top + aInnerSize.height + collapseMargin;
|
2003-07-24 03:04:37 +04:00
|
|
|
} break;
|
2008-02-27 05:02:20 +03:00
|
|
|
case NS_STYLE_CAPTION_SIDE_LEFT: {
|
2002-11-08 08:29:34 +03:00
|
|
|
if (NS_AUTOMARGIN == aCaptionMargin.left) {
|
|
|
|
if (NS_AUTOMARGIN != aInnerMargin.left) {
|
|
|
|
aCaptionMargin.left = CalcAutoMargin(aCaptionMargin.left, aCaptionMargin.right,
|
2007-02-07 10:46:44 +03:00
|
|
|
aInnerMargin.left, aCaptionSize.width);
|
2002-11-08 08:29:34 +03:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
// zero for now
|
|
|
|
aCaptionMargin.left = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
aOrigin.x = aCaptionMargin.left;
|
|
|
|
aOrigin.y = aInnerMargin.top;
|
|
|
|
switch(GetCaptionVerticalAlign()) {
|
|
|
|
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
|
|
|
|
aOrigin.y = PR_MAX(0, aInnerMargin.top + ((aInnerSize.height - aCaptionSize.height) / 2));
|
|
|
|
break;
|
|
|
|
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
|
|
|
|
aOrigin.y = PR_MAX(0, aInnerMargin.top + aInnerSize.height - aCaptionSize.height);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2003-07-24 03:04:37 +04:00
|
|
|
} break;
|
2008-02-27 05:02:20 +03:00
|
|
|
case NS_STYLE_CAPTION_SIDE_RIGHT: {
|
2002-11-08 08:29:34 +03:00
|
|
|
if (NS_AUTOMARGIN == aCaptionMargin.left) {
|
|
|
|
if (NS_AUTOMARGIN != aInnerMargin.right) {
|
|
|
|
aCaptionMargin.left = CalcAutoMargin(aCaptionMargin.left, aCaptionMargin.right,
|
2007-02-07 10:46:44 +03:00
|
|
|
aInnerMargin.right, aCaptionSize.width);
|
2002-11-08 08:29:34 +03:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
// zero for now
|
|
|
|
aCaptionMargin.left = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
aOrigin.x = aInnerMargin.left + aInnerSize.width + aCaptionMargin.left;
|
|
|
|
aOrigin.y = aInnerMargin.top;
|
|
|
|
switch(GetCaptionVerticalAlign()) {
|
|
|
|
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
|
|
|
|
aOrigin.y += PR_MAX(0, (aInnerSize.height - aCaptionSize.height) / 2);
|
|
|
|
break;
|
|
|
|
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
|
|
|
|
aOrigin.y += PR_MAX(0, aInnerSize.height - aCaptionSize.height);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2003-07-24 03:04:37 +04:00
|
|
|
} break;
|
|
|
|
default: { // top
|
2008-02-27 05:02:20 +03:00
|
|
|
NS_ASSERTION(aCaptionSide == NS_STYLE_CAPTION_SIDE_TOP ||
|
|
|
|
aCaptionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE,
|
|
|
|
"unexpected caption side");
|
2000-04-29 01:05:31 +04:00
|
|
|
if (NS_AUTOMARGIN == aCaptionMargin.left) {
|
|
|
|
aCaptionMargin.left = CalcAutoMargin(aCaptionMargin.left, aCaptionMargin.right,
|
2007-02-07 10:46:44 +03:00
|
|
|
aContainBlockSize.width, aCaptionSize.width);
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
|
|
|
aOrigin.x = aCaptionMargin.left;
|
2008-02-27 05:03:11 +03:00
|
|
|
if (aCaptionSide == NS_STYLE_CAPTION_SIDE_TOP) {
|
|
|
|
// We placed the caption using only the table's width as available
|
|
|
|
// width, and we should position it this way as well.
|
|
|
|
aOrigin.x += aInnerMargin.left;
|
|
|
|
}
|
|
|
|
// FIXME: Position relative to right edge for RTL. (Based on table
|
|
|
|
// direction or table parent direction?)
|
2000-04-29 01:05:31 +04:00
|
|
|
if (NS_AUTOMARGIN == aCaptionMargin.bottom) {
|
2000-05-10 18:51:37 +04:00
|
|
|
aCaptionMargin.bottom = 0;
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
2000-05-10 18:51:37 +04:00
|
|
|
if (NS_AUTOMARGIN == aCaptionMargin.top) {
|
2003-07-24 03:04:37 +04:00
|
|
|
nsCollapsingMargin marg;
|
|
|
|
marg.Include(aCaptionMargin.bottom);
|
|
|
|
marg.Include(aInnerMargin.top);
|
|
|
|
nscoord collapseMargin = marg.get();
|
2000-05-10 18:51:37 +04:00
|
|
|
nscoord height = aCaptionSize.height + collapseMargin + aInnerSize.height;
|
|
|
|
aCaptionMargin.top = CalcAutoMargin(aCaptionMargin.top, aInnerMargin.bottom,
|
2007-02-07 10:46:44 +03:00
|
|
|
aContainBlockSize.height, height);
|
2000-05-10 18:51:37 +04:00
|
|
|
}
|
|
|
|
aOrigin.y = aCaptionMargin.top;
|
2003-07-24 03:04:37 +04:00
|
|
|
} break;
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-01-21 12:54:07 +03:00
|
|
|
nsTableOuterFrame::GetInnerOrigin(PRUint32 aCaptionSide,
|
2000-04-29 01:05:31 +04:00
|
|
|
const nsSize& aContainBlockSize,
|
|
|
|
const nsSize& aCaptionSize,
|
|
|
|
const nsMargin& aCaptionMargin,
|
|
|
|
const nsSize& aInnerSize,
|
|
|
|
nsMargin& aInnerMargin,
|
|
|
|
nsPoint& aOrigin)
|
|
|
|
{
|
2008-02-27 05:03:11 +03:00
|
|
|
// FIXME: This function expects computed margin values to be
|
|
|
|
// NS_AUTOMARGIN, but this is no longer the case.
|
2000-04-29 01:05:31 +04:00
|
|
|
aOrigin.x = aOrigin.y = 0;
|
2002-11-08 08:29:34 +03:00
|
|
|
if ((NS_UNCONSTRAINEDSIZE == aInnerSize.width) || (NS_UNCONSTRAINEDSIZE == aInnerSize.height) ||
|
|
|
|
(NS_UNCONSTRAINEDSIZE == aCaptionSize.width) || (NS_UNCONSTRAINEDSIZE == aCaptionSize.height)) {
|
2000-04-29 01:05:31 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2002-11-08 08:29:34 +03:00
|
|
|
nscoord minCapWidth = aCaptionSize.width;
|
|
|
|
if (NS_AUTOMARGIN != aCaptionMargin.left)
|
|
|
|
minCapWidth += aCaptionMargin.left;
|
|
|
|
if (NS_AUTOMARGIN != aCaptionMargin.right)
|
|
|
|
minCapWidth += aCaptionMargin.right;
|
|
|
|
|
2000-04-29 01:05:31 +04:00
|
|
|
switch(aCaptionSide) {
|
2008-02-27 05:02:20 +03:00
|
|
|
case NS_STYLE_CAPTION_SIDE_BOTTOM:
|
|
|
|
case NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE: {
|
2000-04-29 01:05:31 +04:00
|
|
|
if (NS_AUTOMARGIN == aInnerMargin.left) {
|
|
|
|
aInnerMargin.left = CalcAutoMargin(aInnerMargin.left, aInnerMargin.right,
|
2007-02-07 10:46:44 +03:00
|
|
|
aContainBlockSize.width, aInnerSize.width);
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
|
|
|
aOrigin.x = aInnerMargin.left;
|
|
|
|
if (NS_AUTOMARGIN == aInnerMargin.bottom) {
|
|
|
|
aInnerMargin.bottom = 0;
|
|
|
|
}
|
|
|
|
if (NS_AUTOMARGIN == aInnerMargin.top) {
|
2003-07-24 03:04:37 +04:00
|
|
|
nsCollapsingMargin marg;
|
|
|
|
marg.Include(aInnerMargin.bottom);
|
|
|
|
marg.Include(aCaptionMargin.top);
|
|
|
|
nscoord collapseMargin = marg.get();
|
2000-04-29 01:05:31 +04:00
|
|
|
nscoord height = aInnerSize.height + collapseMargin + aCaptionSize.height;
|
|
|
|
aInnerMargin.top = CalcAutoMargin(aInnerMargin.top, aCaptionMargin.bottom,
|
2007-02-07 10:46:44 +03:00
|
|
|
aContainBlockSize.height, height);
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
|
|
|
aOrigin.y = aInnerMargin.top;
|
2003-07-24 03:04:37 +04:00
|
|
|
} break;
|
2008-02-27 05:02:20 +03:00
|
|
|
case NS_STYLE_CAPTION_SIDE_LEFT: {
|
2002-11-08 08:29:34 +03:00
|
|
|
|
|
|
|
if (NS_AUTOMARGIN == aInnerMargin.left) {
|
|
|
|
aInnerMargin.left = CalcAutoMargin(aInnerMargin.left, aInnerMargin.right,
|
2007-02-07 10:46:44 +03:00
|
|
|
aContainBlockSize.width, aInnerSize.width);
|
2002-11-08 08:29:34 +03:00
|
|
|
|
|
|
|
}
|
|
|
|
if (aInnerMargin.left < minCapWidth) {
|
|
|
|
// shift the inner table to get some place for the caption
|
|
|
|
aInnerMargin.right += aInnerMargin.left - minCapWidth;
|
|
|
|
aInnerMargin.right = PR_MAX(0, aInnerMargin.right);
|
|
|
|
aInnerMargin.left = minCapWidth;
|
|
|
|
}
|
|
|
|
aOrigin.x = aInnerMargin.left;
|
|
|
|
if (NS_AUTOMARGIN == aInnerMargin.top) {
|
|
|
|
aInnerMargin.top = 0;
|
|
|
|
}
|
|
|
|
aOrigin.y = aInnerMargin.top;
|
|
|
|
switch(GetCaptionVerticalAlign()) {
|
|
|
|
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
|
|
|
|
aOrigin.y = PR_MAX(aInnerMargin.top, (aCaptionSize.height - aInnerSize.height) / 2);
|
|
|
|
break;
|
|
|
|
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
|
|
|
|
aOrigin.y = PR_MAX(aInnerMargin.top, aCaptionSize.height - aInnerSize.height);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2003-07-24 03:04:37 +04:00
|
|
|
} break;
|
2008-02-27 05:02:20 +03:00
|
|
|
case NS_STYLE_CAPTION_SIDE_RIGHT: {
|
2002-11-08 08:29:34 +03:00
|
|
|
if (NS_AUTOMARGIN == aInnerMargin.right) {
|
|
|
|
aInnerMargin.right = CalcAutoMargin(aInnerMargin.left, aInnerMargin.right,
|
2007-02-07 10:46:44 +03:00
|
|
|
aContainBlockSize.width, aInnerSize.width);
|
2002-11-08 08:29:34 +03:00
|
|
|
if (aInnerMargin.right < minCapWidth) {
|
|
|
|
// shift the inner table to get some place for the caption
|
|
|
|
aInnerMargin.left -= aInnerMargin.right - minCapWidth;
|
|
|
|
aInnerMargin.left = PR_MAX(0, aInnerMargin.left);
|
|
|
|
aInnerMargin.right = minCapWidth;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
aOrigin.x = aInnerMargin.left;
|
|
|
|
if (NS_AUTOMARGIN == aInnerMargin.top) {
|
|
|
|
aInnerMargin.top = 0;
|
|
|
|
}
|
|
|
|
aOrigin.y = aInnerMargin.top;
|
|
|
|
switch(GetCaptionVerticalAlign()) {
|
|
|
|
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
|
|
|
|
aOrigin.y = PR_MAX(aInnerMargin.top, (aCaptionSize.height - aInnerSize.height) / 2);
|
|
|
|
break;
|
|
|
|
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
|
|
|
|
aOrigin.y = PR_MAX(aInnerMargin.top, aCaptionSize.height - aInnerSize.height);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2003-07-24 03:04:37 +04:00
|
|
|
} break;
|
|
|
|
default: { // top
|
2008-02-27 05:02:20 +03:00
|
|
|
NS_ASSERTION(aCaptionSide == NS_STYLE_CAPTION_SIDE_TOP ||
|
|
|
|
aCaptionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE ||
|
|
|
|
aCaptionSide == NO_SIDE,
|
|
|
|
"unexpected caption side");
|
2000-05-10 18:51:37 +04:00
|
|
|
if (NS_AUTOMARGIN == aInnerMargin.left) {
|
|
|
|
aInnerMargin.left = CalcAutoMargin(aInnerMargin.left, aInnerMargin.right,
|
2007-02-07 10:46:44 +03:00
|
|
|
aContainBlockSize.width, aInnerSize.width);
|
2000-05-10 18:51:37 +04:00
|
|
|
}
|
|
|
|
aOrigin.x = aInnerMargin.left;
|
|
|
|
if (NS_AUTOMARGIN == aInnerMargin.top) {
|
|
|
|
aInnerMargin.top = 0;
|
|
|
|
}
|
2003-07-24 03:04:37 +04:00
|
|
|
nsCollapsingMargin marg;
|
|
|
|
marg.Include(aCaptionMargin.bottom);
|
|
|
|
marg.Include(aInnerMargin.top);
|
|
|
|
nscoord collapseMargin = marg.get();
|
2000-05-10 18:51:37 +04:00
|
|
|
if (NS_AUTOMARGIN == aInnerMargin.bottom) {
|
|
|
|
nscoord height = aCaptionSize.height + collapseMargin + aInnerSize.height;
|
|
|
|
aInnerMargin.bottom = CalcAutoMargin(aCaptionMargin.bottom, aInnerMargin.top,
|
2007-02-07 10:46:44 +03:00
|
|
|
aContainBlockSize.height, height);
|
2000-05-10 18:51:37 +04:00
|
|
|
}
|
|
|
|
aOrigin.y = aCaptionMargin.top + aCaptionSize.height + collapseMargin;
|
2003-07-24 03:04:37 +04:00
|
|
|
} break;
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
1998-06-19 04:34:12 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-03-29 01:19:31 +04:00
|
|
|
// helper method for determining if this is a nested table or not
|
|
|
|
PRBool
|
|
|
|
nsTableOuterFrame::IsNested(const nsHTMLReflowState& aReflowState) const
|
|
|
|
{
|
|
|
|
// Walk up the reflow state chain until we find a cell or the root
|
|
|
|
const nsHTMLReflowState* rs = aReflowState.parentReflowState;
|
|
|
|
while (rs) {
|
2006-12-26 20:47:52 +03:00
|
|
|
if (nsGkAtoms::tableFrame == rs->frame->GetType()) {
|
2003-10-31 23:19:18 +03:00
|
|
|
return PR_TRUE;
|
2001-03-29 01:19:31 +04:00
|
|
|
}
|
|
|
|
rs = rs->parentReflowState;
|
|
|
|
}
|
2003-10-31 23:19:18 +03:00
|
|
|
return PR_FALSE;
|
2001-03-29 01:19:31 +04:00
|
|
|
}
|
|
|
|
|
2008-02-27 05:01:33 +03:00
|
|
|
void
|
|
|
|
nsTableOuterFrame::OuterBeginReflowChild(nsPresContext* aPresContext,
|
|
|
|
nsIFrame* aChildFrame,
|
|
|
|
const nsHTMLReflowState& aOuterRS,
|
|
|
|
void* aChildRSSpace,
|
|
|
|
nscoord aAvailWidth)
|
2000-04-29 01:05:31 +04:00
|
|
|
{
|
2001-11-07 05:38:49 +03:00
|
|
|
// work around pixel rounding errors, round down to ensure we don't exceed the avail height in
|
|
|
|
nscoord availHeight = aOuterRS.availableHeight;
|
|
|
|
if (NS_UNCONSTRAINEDSIZE != availHeight) {
|
2007-12-21 06:25:36 +03:00
|
|
|
if (mCaptionFrame == aChildFrame) {
|
|
|
|
availHeight = NS_UNCONSTRAINEDSIZE;
|
|
|
|
} else {
|
|
|
|
nsMargin margin;
|
|
|
|
GetMargin(aPresContext, aOuterRS, aChildFrame, aOuterRS.availableWidth,
|
|
|
|
margin);
|
2007-03-23 02:01:14 +03:00
|
|
|
|
2007-12-21 06:25:36 +03:00
|
|
|
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != margin.top, "No unconstrainedsize arithmetic, please");
|
|
|
|
availHeight -= margin.top;
|
|
|
|
|
|
|
|
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != margin.bottom, "No unconstrainedsize arithmetic, please");
|
|
|
|
availHeight -= margin.bottom;
|
|
|
|
}
|
2001-11-07 05:38:49 +03:00
|
|
|
}
|
2002-11-08 08:29:34 +03:00
|
|
|
nsSize availSize(aAvailWidth, availHeight);
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
// create and init the child reflow state, using placement new on
|
|
|
|
// stack space allocated by the caller, so that the caller can destroy
|
|
|
|
// it
|
|
|
|
nsHTMLReflowState &childRS = * new (aChildRSSpace)
|
|
|
|
nsHTMLReflowState(aPresContext, aOuterRS, aChildFrame, availSize,
|
|
|
|
-1, -1, PR_FALSE);
|
2002-02-19 18:48:28 +03:00
|
|
|
InitChildReflowState(*aPresContext, childRS);
|
2002-03-27 08:50:24 +03:00
|
|
|
|
|
|
|
// see if we need to reset top of page due to a caption
|
|
|
|
if (mCaptionFrame) {
|
|
|
|
PRUint8 captionSide = GetCaptionSide();
|
2008-02-27 05:02:20 +03:00
|
|
|
if (((captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM ||
|
|
|
|
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE) &&
|
|
|
|
mCaptionFrame == aChildFrame) ||
|
|
|
|
((captionSide == NS_STYLE_CAPTION_SIDE_TOP ||
|
|
|
|
captionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE) &&
|
|
|
|
mInnerTableFrame == aChildFrame)) {
|
2002-03-27 08:50:24 +03:00
|
|
|
childRS.mFlags.mIsTopOfPage = PR_FALSE;
|
|
|
|
}
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
2008-02-27 05:01:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsTableOuterFrame::OuterDoReflowChild(nsPresContext* aPresContext,
|
|
|
|
nsIFrame* aChildFrame,
|
|
|
|
const nsHTMLReflowState& aChildRS,
|
|
|
|
nsHTMLReflowMetrics& aMetrics,
|
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
2000-04-29 01:05:31 +04:00
|
|
|
|
|
|
|
// use the current position as a best guess for placement
|
2003-07-07 06:01:29 +04:00
|
|
|
nsPoint childPt = aChildFrame->GetPosition();
|
2008-02-27 05:01:33 +03:00
|
|
|
return ReflowChild(aChildFrame, aPresContext, aMetrics, aChildRS,
|
|
|
|
childPt.x, childPt.y, NS_FRAME_NO_MOVE_FRAME, aStatus);
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-12-27 18:05:18 +03:00
|
|
|
nsTableOuterFrame::UpdateReflowMetrics(PRUint8 aCaptionSide,
|
2000-04-29 01:05:31 +04:00
|
|
|
nsHTMLReflowMetrics& aMet,
|
|
|
|
const nsMargin& aInnerMargin,
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
const nsMargin& aCaptionMargin)
|
2000-04-29 01:05:31 +04:00
|
|
|
{
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
SetDesiredSize(aCaptionSide, aInnerMargin, aCaptionMargin,
|
|
|
|
aMet.width, aMet.height);
|
2000-04-29 01:05:31 +04:00
|
|
|
|
2003-09-13 20:26:30 +04:00
|
|
|
aMet.mOverflowArea = nsRect(0, 0, aMet.width, aMet.height);
|
2004-12-27 18:05:18 +03:00
|
|
|
ConsiderChildOverflow(aMet.mOverflowArea, mInnerTableFrame);
|
2003-09-13 20:26:30 +04:00
|
|
|
if (mCaptionFrame) {
|
2004-12-27 18:05:18 +03:00
|
|
|
ConsiderChildOverflow(aMet.mOverflowArea, mCaptionFrame);
|
2003-09-13 20:26:30 +04:00
|
|
|
}
|
2004-07-16 20:56:21 +04:00
|
|
|
FinishAndStoreOverflow(&aMet);
|
2000-04-29 01:05:31 +04:00
|
|
|
}
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
1999-04-04 04:06:48 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
2000-04-29 01:05:31 +04:00
|
|
|
const nsHTMLReflowState& aOuterRS,
|
1999-04-04 04:06:48 +04:00
|
|
|
nsReflowStatus& aStatus)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
DO_GLOBAL_REFLOW_COUNT("nsTableOuterFrame");
|
2001-11-14 16:40:03 +03:00
|
|
|
DISPLAY_REFLOW(aPresContext, this, aOuterRS, aDesiredSize, aStatus);
|
2000-04-29 01:05:31 +04:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
// We desperately need an inner table frame,
|
2006-03-18 10:18:54 +03:00
|
|
|
// if this fails fix the frame constructor
|
|
|
|
if (mFrames.IsEmpty() || !mInnerTableFrame) {
|
|
|
|
NS_ERROR("incomplete children");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
1998-10-09 23:59:45 +04:00
|
|
|
nsresult rv = NS_OK;
|
2000-04-29 01:05:31 +04:00
|
|
|
PRUint8 captionSide = GetCaptionSide();
|
|
|
|
|
1998-06-23 01:59:43 +04:00
|
|
|
// Initialize out parameters
|
2000-04-29 01:05:31 +04:00
|
|
|
aDesiredSize.width = aDesiredSize.height = 0;
|
1998-06-23 01:59:43 +04:00
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
|
|
|
|
// Set up our kids. They're already present, on an overflow list,
|
|
|
|
// or there are none so we'll create them now
|
|
|
|
MoveOverflowToChildList(aPresContext);
|
2001-03-13 09:38:59 +03:00
|
|
|
}
|
2001-02-27 17:52:07 +03:00
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
// Use longs to get more-aligned space.
|
|
|
|
#define LONGS_IN_HTMLRS \
|
|
|
|
((sizeof(nsHTMLReflowState) + sizeof(long) - 1) / sizeof(long))
|
|
|
|
long captionRSSpace[LONGS_IN_HTMLRS];
|
2008-02-27 05:01:33 +03:00
|
|
|
nsHTMLReflowState *captionRS =
|
|
|
|
static_cast<nsHTMLReflowState*>((void*)captionRSSpace);
|
2008-02-27 05:02:20 +03:00
|
|
|
long innerRSSpace[LONGS_IN_HTMLRS];
|
|
|
|
nsHTMLReflowState *innerRS =
|
|
|
|
static_cast<nsHTMLReflowState*>((void*) innerRSSpace);
|
|
|
|
|
2008-04-02 01:53:19 +04:00
|
|
|
nsRect origInnerRect = mInnerTableFrame->GetRect();
|
|
|
|
nsRect origInnerOverflowRect = mInnerTableFrame->GetOverflowRect();
|
|
|
|
PRBool innerFirstReflow =
|
|
|
|
(mInnerTableFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
|
|
|
|
nsRect origCaptionRect;
|
|
|
|
nsRect origCaptionOverflowRect;
|
|
|
|
PRBool captionFirstReflow;
|
|
|
|
if (mCaptionFrame) {
|
|
|
|
origCaptionRect = mCaptionFrame->GetRect();
|
|
|
|
origCaptionOverflowRect = mCaptionFrame->GetOverflowRect();
|
|
|
|
captionFirstReflow =
|
|
|
|
(mCaptionFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
|
|
|
|
}
|
|
|
|
|
2008-02-28 20:55:04 +03:00
|
|
|
// ComputeAutoSize has to match this logic.
|
2008-02-27 05:02:20 +03:00
|
|
|
if (captionSide == NO_SIDE) {
|
|
|
|
// We don't have a caption.
|
|
|
|
OuterBeginReflowChild(aPresContext, mInnerTableFrame, aOuterRS,
|
|
|
|
innerRSSpace, aOuterRS.ComputedWidth());
|
|
|
|
} else if (captionSide == NS_STYLE_CAPTION_SIDE_LEFT ||
|
|
|
|
captionSide == NS_STYLE_CAPTION_SIDE_RIGHT) {
|
|
|
|
// nsTableCaptionFrame::ComputeAutoSize takes care of making side
|
|
|
|
// captions small. Compute the caption's size first, and tell the
|
|
|
|
// table to fit in what's left.
|
|
|
|
OuterBeginReflowChild(aPresContext, mCaptionFrame, aOuterRS,
|
|
|
|
captionRSSpace, aOuterRS.ComputedWidth());
|
|
|
|
nscoord innerAvailWidth = aOuterRS.ComputedWidth() -
|
|
|
|
(captionRS->ComputedWidth() + captionRS->mComputedMargin.LeftRight() +
|
|
|
|
captionRS->mComputedBorderPadding.LeftRight());
|
|
|
|
OuterBeginReflowChild(aPresContext, mInnerTableFrame, aOuterRS,
|
|
|
|
innerRSSpace, innerAvailWidth);
|
|
|
|
|
|
|
|
} else if (captionSide == NS_STYLE_CAPTION_SIDE_TOP ||
|
|
|
|
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM) {
|
|
|
|
// Compute the table's size first, and then prevent the caption from
|
|
|
|
// being wider unless it has to be.
|
|
|
|
//
|
|
|
|
// Note that CSS 2.1 (but not 2.0) says:
|
|
|
|
// The width of the anonymous box is the border-edge width of the
|
|
|
|
// table box inside it
|
|
|
|
// We don't actually make our anonymous box that width (if we did,
|
|
|
|
// it would break 'auto' margins), but this effectively does that.
|
|
|
|
OuterBeginReflowChild(aPresContext, mInnerTableFrame, aOuterRS,
|
|
|
|
innerRSSpace, aOuterRS.ComputedWidth());
|
|
|
|
// It's good that CSS 2.1 says not to include margins, since we
|
|
|
|
// can't, since they already been converted so they exactly
|
|
|
|
// fill the available width (ignoring the margin on one side if
|
2008-02-27 05:03:11 +03:00
|
|
|
// neither are auto). (We take advantage of that later when we call
|
|
|
|
// GetCaptionOrigin, though.)
|
2008-02-27 05:02:20 +03:00
|
|
|
nscoord innerBorderWidth = innerRS->ComputedWidth() +
|
|
|
|
innerRS->mComputedBorderPadding.LeftRight();
|
|
|
|
OuterBeginReflowChild(aPresContext, mCaptionFrame, aOuterRS,
|
|
|
|
captionRSSpace, innerBorderWidth);
|
|
|
|
} else {
|
|
|
|
NS_ASSERTION(captionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE ||
|
|
|
|
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE,
|
|
|
|
"unexpected caption-side");
|
|
|
|
// Size the table and the caption independently.
|
2008-02-27 05:01:33 +03:00
|
|
|
OuterBeginReflowChild(aPresContext, mCaptionFrame, aOuterRS,
|
|
|
|
captionRSSpace, aOuterRS.ComputedWidth());
|
2008-02-27 05:02:20 +03:00
|
|
|
OuterBeginReflowChild(aPresContext, mInnerTableFrame, aOuterRS,
|
|
|
|
innerRSSpace, aOuterRS.ComputedWidth());
|
|
|
|
}
|
|
|
|
|
|
|
|
// First reflow the caption.
|
|
|
|
nsHTMLReflowMetrics captionMet;
|
|
|
|
nsSize captionSize;
|
|
|
|
nsMargin captionMargin;
|
|
|
|
if (mCaptionFrame) {
|
|
|
|
nsReflowStatus capStatus; // don't let the caption cause incomplete
|
2008-02-27 05:01:33 +03:00
|
|
|
rv = OuterDoReflowChild(aPresContext, mCaptionFrame, *captionRS,
|
|
|
|
captionMet, capStatus);
|
2001-03-13 09:38:59 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
2008-02-27 05:01:33 +03:00
|
|
|
captionSize.width = captionMet.width;
|
|
|
|
captionSize.height = captionMet.height;
|
|
|
|
captionMargin = captionRS->mComputedMargin;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
} else {
|
|
|
|
captionSize.SizeTo(0,0);
|
|
|
|
captionMargin.SizeTo(0,0,0,0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Then, now that we know how much to reduce the width of the inner
|
|
|
|
// table to account for side captions, reflow the inner table.
|
|
|
|
nsHTMLReflowMetrics innerMet;
|
2008-02-27 05:02:20 +03:00
|
|
|
rv = OuterDoReflowChild(aPresContext, mInnerTableFrame, *innerRS,
|
|
|
|
innerMet, aStatus);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
nsSize innerSize;
|
2008-02-27 05:02:20 +03:00
|
|
|
innerSize.width = innerMet.width;
|
|
|
|
innerSize.height = innerMet.height;
|
|
|
|
nsMargin innerMargin = innerRS->mComputedMargin;
|
2001-03-13 09:38:59 +03:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
nsSize containSize = GetContainingBlockSize(aOuterRS);
|
2001-03-13 09:38:59 +03:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
// Now that we've reflowed both we can place them.
|
|
|
|
// XXXldb Most of the input variables here are now uninitialized!
|
1998-07-09 18:30:34 +04:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
// XXX Need to recompute inner table's auto margins for the case of side
|
|
|
|
// captions. (Caption's are broken too, but that should be fixed earlier.)
|
2000-04-29 01:05:31 +04:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
if (mCaptionFrame) {
|
|
|
|
nsPoint captionOrigin;
|
|
|
|
GetCaptionOrigin(captionSide, containSize, innerSize,
|
|
|
|
innerMargin, captionSize, captionMargin, captionOrigin);
|
2008-02-27 05:02:20 +03:00
|
|
|
FinishReflowChild(mCaptionFrame, aPresContext, captionRS, captionMet,
|
|
|
|
captionOrigin.x, captionOrigin.y, 0);
|
|
|
|
captionRS->~nsHTMLReflowState();
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
}
|
|
|
|
// XXX If the height is constrained then we need to check whether
|
|
|
|
// everything still fits...
|
2001-03-13 09:38:59 +03:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
nsPoint innerOrigin;
|
|
|
|
GetInnerOrigin(captionSide, containSize, captionSize,
|
|
|
|
captionMargin, innerSize, innerMargin, innerOrigin);
|
2008-02-27 05:02:20 +03:00
|
|
|
FinishReflowChild(mInnerTableFrame, aPresContext, innerRS, innerMet,
|
|
|
|
innerOrigin.x, innerOrigin.y, 0);
|
|
|
|
innerRS->~nsHTMLReflowState();
|
2008-04-02 01:53:19 +04:00
|
|
|
|
2008-04-02 01:53:19 +04:00
|
|
|
nsTableFrame::InvalidateFrame(mInnerTableFrame, origInnerRect,
|
|
|
|
origInnerOverflowRect, innerFirstReflow);
|
|
|
|
if (mCaptionFrame) {
|
|
|
|
nsTableFrame::InvalidateFrame(mCaptionFrame, origCaptionRect,
|
|
|
|
origCaptionOverflowRect, captionFirstReflow);
|
|
|
|
}
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
UpdateReflowMetrics(captionSide, aDesiredSize, innerMargin, captionMargin);
|
1998-06-19 04:34:12 +04:00
|
|
|
|
1998-07-09 18:30:34 +04:00
|
|
|
// Return our desired rect
|
1998-06-19 09:21:45 +04:00
|
|
|
|
2002-05-29 02:50:43 +04:00
|
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aOuterRS, aDesiredSize);
|
1998-10-09 23:59:45 +04:00
|
|
|
return rv;
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
#ifdef NS_DEBUG
|
1998-04-17 05:41:24 +04:00
|
|
|
NS_METHOD nsTableOuterFrame::VerifyTree() const
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
1998-04-17 05:41:24 +04:00
|
|
|
return NS_OK;
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
#endif
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2003-10-31 23:19:18 +03:00
|
|
|
nsIAtom*
|
|
|
|
nsTableOuterFrame::GetType() const
|
1999-02-24 08:54:31 +03:00
|
|
|
{
|
2006-12-26 20:47:52 +03:00
|
|
|
return nsGkAtoms::tableOuterFrame;
|
1999-02-24 08:54:31 +03:00
|
|
|
}
|
1998-04-17 02:21:32 +04:00
|
|
|
|
1999-08-01 20:20:14 +04:00
|
|
|
/* ----- global methods ----- */
|
|
|
|
|
|
|
|
/*------------------ nsITableLayout methods ------------------------------*/
|
1999-08-01 02:11:50 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableOuterFrame::GetCellDataAt(PRInt32 aRowIndex, PRInt32 aColIndex,
|
|
|
|
nsIDOMElement* &aCell, //out params
|
|
|
|
PRInt32& aStartRowIndex, PRInt32& aStartColIndex,
|
|
|
|
PRInt32& aRowSpan, PRInt32& aColSpan,
|
2000-01-26 17:56:06 +03:00
|
|
|
PRInt32& aActualRowSpan, PRInt32& aActualColSpan,
|
1999-08-01 02:11:50 +04:00
|
|
|
PRBool& aIsSelected)
|
|
|
|
{
|
2008-02-07 10:03:26 +03:00
|
|
|
NS_ASSERTION(mInnerTableFrame, "no inner table frame yet?");
|
|
|
|
|
2008-02-07 10:23:00 +03:00
|
|
|
return mInnerTableFrame->GetCellDataAt(aRowIndex, aColIndex, aCell,
|
|
|
|
aStartRowIndex, aStartColIndex,
|
|
|
|
aRowSpan, aColSpan, aActualRowSpan,
|
|
|
|
aActualColSpan, aIsSelected);
|
2008-02-07 10:03:26 +03:00
|
|
|
}
|
|
|
|
|
2008-02-07 10:03:26 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableOuterFrame::GetTableSize(PRInt32& aRowCount, PRInt32& aColCount)
|
2008-02-07 10:03:26 +03:00
|
|
|
{
|
2008-02-07 10:03:26 +03:00
|
|
|
NS_ASSERTION(mInnerTableFrame, "no inner table frame yet?");
|
|
|
|
|
2008-02-07 10:23:00 +03:00
|
|
|
return mInnerTableFrame->GetTableSize(aRowCount, aColCount);
|
2008-02-07 10:03:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableOuterFrame::GetIndexByRowAndColumn(PRInt32 aRow, PRInt32 aColumn,
|
|
|
|
PRInt32 *aIndex)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aIndex);
|
|
|
|
|
|
|
|
NS_ASSERTION(mInnerTableFrame, "no inner table frame yet?");
|
|
|
|
return mInnerTableFrame->GetIndexByRowAndColumn(aRow, aColumn, aIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableOuterFrame::GetRowAndColumnByIndex(PRInt32 aIndex,
|
|
|
|
PRInt32 *aRow, PRInt32 *aColumn)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aRow);
|
|
|
|
NS_ENSURE_ARG_POINTER(aColumn);
|
|
|
|
|
|
|
|
NS_ASSERTION(mInnerTableFrame, "no inner table frame yet?");
|
|
|
|
return mInnerTableFrame->GetRowAndColumnByIndex(aIndex, aRow, aColumn);
|
1999-08-01 20:20:14 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------- end of nsITableLayout implementation ------------------*/
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2005-11-04 05:38:33 +03:00
|
|
|
nsIFrame*
|
2006-03-27 01:30:36 +04:00
|
|
|
NS_NewTableOuterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
2006-03-27 01:30:36 +04:00
|
|
|
return new (aPresShell) nsTableOuterFrame(aContext);
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
1998-09-03 01:59:54 +04:00
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef DEBUG
|
1998-11-19 20:22:29 +03:00
|
|
|
NS_IMETHODIMP
|
2001-11-14 04:33:42 +03:00
|
|
|
nsTableOuterFrame::GetFrameName(nsAString& aResult) const
|
1998-11-19 20:22:29 +03:00
|
|
|
{
|
2001-11-14 04:33:42 +03:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("TableOuter"), aResult);
|
1998-11-19 20:22:29 +03:00
|
|
|
}
|
1999-09-01 05:02:16 +04:00
|
|
|
#endif
|
2003-10-21 08:32:57 +04:00
|
|
|
|