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 05:38:33 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
// vim:cindent:ts=4:et:sw=4:
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1998-04-30 17:57:09 +00: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 05:38:33 +00:00
|
|
|
/*
|
|
|
|
* Web-compatible algorithms that determine column and table widths,
|
|
|
|
* used for CSS2's 'table-layout: auto'.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BasicTableLayoutStrategy_h_
|
|
|
|
#define BasicTableLayoutStrategy_h_
|
1998-04-30 17:57:09 +00:00
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
1998-04-30 17:57:09 +00:00
|
|
|
#include "nsITableLayoutStrategy.h"
|
|
|
|
|
|
|
|
class nsTableFrame;
|
|
|
|
|
|
|
|
class BasicTableLayoutStrategy : public nsITableLayoutStrategy
|
|
|
|
{
|
|
|
|
public:
|
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 05:38:33 +00:00
|
|
|
BasicTableLayoutStrategy(nsTableFrame *aTableFrame);
|
|
|
|
virtual ~BasicTableLayoutStrategy();
|
|
|
|
|
|
|
|
// nsITableLayoutStrategy implementation
|
2014-07-24 17:03:25 +00:00
|
|
|
virtual nscoord GetMinISize(nsRenderingContext* aRenderingContext) MOZ_OVERRIDE;
|
|
|
|
virtual nscoord GetPrefISize(nsRenderingContext* aRenderingContext,
|
2012-09-14 16:10:08 +00:00
|
|
|
bool aComputingSize) MOZ_OVERRIDE;
|
2014-07-24 17:03:26 +00:00
|
|
|
virtual void MarkIntrinsicISizesDirty() MOZ_OVERRIDE;
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual void ComputeColumnWidths(const nsHTMLReflowState& aReflowState) MOZ_OVERRIDE;
|
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 05:38:33 +00:00
|
|
|
|
|
|
|
private:
|
2008-01-18 04:18:21 +00:00
|
|
|
// NOTE: Using prefix "BTLS" to avoid overlapping names with
|
2014-07-24 17:03:26 +00:00
|
|
|
// the values of nsLayoutUtils::IntrinsicISizeType
|
2008-01-18 04:18:21 +00:00
|
|
|
enum BtlsWidthType { BTLS_MIN_WIDTH,
|
|
|
|
BTLS_PREF_WIDTH,
|
|
|
|
BTLS_FINAL_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 05:38:33 +00:00
|
|
|
// Compute intrinsic width member variables on the columns.
|
2014-07-24 17:03:26 +00:00
|
|
|
void ComputeColumnIntrinsicISizes(nsRenderingContext* aRenderingContext);
|
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 05:38:33 +00:00
|
|
|
|
2008-01-18 04:18:21 +00:00
|
|
|
// Distribute a colspanning cell's percent width (if any) to its columns.
|
|
|
|
void DistributePctWidthToColumns(float aSpanPrefPct,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aFirstCol,
|
|
|
|
int32_t aColCount);
|
2008-01-18 04:18:21 +00:00
|
|
|
|
|
|
|
// Distribute a width of some BltsWidthType type to a set of columns.
|
|
|
|
// aWidth: The amount of width to be distributed
|
|
|
|
// aFirstCol: The index (in the table) of the first column to be
|
|
|
|
// considered for receiving width
|
|
|
|
// aColCount: The number of consecutive columns (starting with aFirstCol)
|
|
|
|
// to be considered for receiving width
|
|
|
|
// aWidthType: The type of width being distributed. (BTLS_MIN_WIDTH and
|
|
|
|
// BTLS_PREF_WIDTH are intended to be used for dividing up
|
|
|
|
// colspan's min & pref width. BTLS_FINAL_WIDTH is intended
|
|
|
|
// to be used for distributing the table's final width across
|
|
|
|
// all its columns)
|
2011-10-17 14:59:28 +00:00
|
|
|
// aSpanHasSpecifiedWidth: Should be true iff:
|
2008-01-18 04:18:21 +00:00
|
|
|
// - We're distributing a colspanning cell's
|
|
|
|
// pref or min width to its columns
|
|
|
|
// - The colspanning cell has a specified width.
|
|
|
|
void DistributeWidthToColumns(nscoord aWidth,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aFirstCol,
|
|
|
|
int32_t aColCount,
|
2008-01-18 04:18:21 +00:00
|
|
|
BtlsWidthType aWidthType,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aSpanHasSpecifiedWidth);
|
2008-01-18 04:18:21 +00: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 05:38:33 +00:00
|
|
|
// Compute the min and pref widths of the table from the width
|
|
|
|
// variables on the columns.
|
2014-07-24 17:03:26 +00:00
|
|
|
void ComputeIntrinsicISizes(nsRenderingContext* aRenderingContext);
|
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 05:38:33 +00:00
|
|
|
|
|
|
|
nsTableFrame *mTableFrame;
|
|
|
|
nscoord mMinWidth;
|
|
|
|
nscoord mPrefWidth;
|
|
|
|
nscoord mPrefWidthPctExpand;
|
|
|
|
nscoord mLastCalcWidth;
|
1998-04-30 17:57:09 +00:00
|
|
|
};
|
1998-05-08 21:12:12 +00: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 05:38:33 +00:00
|
|
|
#endif /* !defined(BasicTableLayoutStrategy_h_) */
|