Backed out 2 changesets (bug 1932051) for causing bc failures @browser_passwords_upda...
[gecko.git] / layout / tables / BasicTableLayoutStrategy.h
blob6b5f290f4b28652d606723e395be8b43770eb69e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 // vim:cindent:ts=4:et:sw=4:
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /*
8 * Web-compatible algorithms that determine column and table isizes,
9 * used for CSS2's 'table-layout: auto'.
12 #ifndef BasicTableLayoutStrategy_h_
13 #define BasicTableLayoutStrategy_h_
15 #include "mozilla/Attributes.h"
16 #include "nsITableLayoutStrategy.h"
18 class nsTableFrame;
20 class BasicTableLayoutStrategy : public nsITableLayoutStrategy {
21 public:
22 explicit BasicTableLayoutStrategy(nsTableFrame* aTableFrame);
23 virtual ~BasicTableLayoutStrategy();
25 // nsITableLayoutStrategy implementation
26 virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
27 virtual nscoord GetPrefISize(gfxContext* aRenderingContext,
28 bool aComputingSize) override;
29 virtual void MarkIntrinsicISizesDirty() override;
30 virtual void ComputeColumnISizes(const ReflowInput& aReflowInput) override;
32 private:
33 // NOTE: Using prefix "BTLS" to avoid overlapping names with
34 // the values of mozilla::IntrinsicISizeType.
35 enum class BtlsISizeType : uint8_t { MinISize, PrefISize, FinalISize };
37 // Compute intrinsic isize member variables on the columns.
38 void ComputeColumnIntrinsicISizes(gfxContext* aRenderingContext);
40 // Distribute a colspanning cell's percent isize (if any) to its columns.
41 void DistributePctISizeToColumns(float aSpanPrefPct, int32_t aFirstCol,
42 int32_t aColCount);
44 // Distribute an isize of some BltsISizeType type to a set of columns.
45 // aISize: The amount of isize to be distributed
46 // aFirstCol: The index (in the table) of the first column to be
47 // considered for receiving isize
48 // aColCount: The number of consecutive columns (starting with aFirstCol)
49 // to be considered for receiving isize
50 // aISizeType: The type of isize being distributed. (BTLS_MIN_ISIZE and
51 // BTLS_PREF_ISIZE are intended to be used for dividing up
52 // colspan's min & pref isize. BTLS_FINAL_ISIZE is intended
53 // to be used for distributing the table's final isize across
54 // all its columns)
55 // aSpanHasSpecifiedISize: Should be true iff:
56 // - We're distributing a colspanning cell's
57 // pref or min isize to its columns
58 // - The colspanning cell has a specified isize.
59 void DistributeISizeToColumns(nscoord aISize, int32_t aFirstCol,
60 int32_t aColCount, BtlsISizeType aISizeType,
61 bool aSpanHasSpecifiedISize);
63 // Compute the min and pref isizes of the table from the isize
64 // variables on the columns.
65 void ComputeIntrinsicISizes(gfxContext* aRenderingContext);
67 nsTableFrame* mTableFrame;
68 nscoord mMinISize;
69 nscoord mPrefISize;
70 nscoord mPrefISizePctExpand;
71 nscoord mLastCalcISize;
74 #endif /* !defined(BasicTableLayoutStrategy_h_) */