Bug 1477533 - Use static const class variable to represent column-count: auto. r=heycam

NS_STYLE_COLUMN_COUNT_UNLIMITED is unused, so I remove it.

MozReview-Commit-ID: HLHLn9ZbkUY

--HG--
extra : rebase_source : 9bf00e1db00051c4454719e205633717fabde050
This commit is contained in:
Ting-Yu Lin 2018-07-20 17:09:31 -07:00
Родитель 47579db045
Коммит 582327218e
6 изменённых файлов: 16 добавлений и 19 удалений

Просмотреть файл

@ -3303,7 +3303,7 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState,
nsContainerFrame* columnSetFrame = nullptr;
RefPtr<ComputedStyle> innerSC = fieldsetContentStyle;
const nsStyleColumn* columns = fieldsetContentStyle->StyleColumn();
if (columns->mColumnCount != NS_STYLE_COLUMN_COUNT_AUTO ||
if (columns->mColumnCount != nsStyleColumn::kColumnCountAuto ||
columns->mColumnWidth.GetUnit() != eStyleUnit_Auto) {
columnSetFrame =
NS_NewColumnSetFrame(mPresShell, fieldsetContentStyle,
@ -3925,7 +3925,7 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
nsContainerFrame* columnSetFrame = nullptr;
RefPtr<ComputedStyle> innerSC = outerSC;
const nsStyleColumn* columns = outerSC->StyleColumn();
if (columns->mColumnCount != NS_STYLE_COLUMN_COUNT_AUTO ||
if (columns->mColumnCount != nsStyleColumn::kColumnCountAuto ||
columns->mColumnWidth.GetUnit() != eStyleUnit_Auto) {
columnSetFrame =
NS_NewColumnSetFrame(mPresShell, outerSC,
@ -11015,7 +11015,7 @@ nsCSSFrameConstructor::ConstructBlock(nsFrameConstructorState& aState,
RefPtr<ComputedStyle> blockStyle = aComputedStyle;
const nsStyleColumn* columns = aComputedStyle->StyleColumn();
if (columns->mColumnCount != NS_STYLE_COLUMN_COUNT_AUTO
if (columns->mColumnCount != nsStyleColumn::kColumnCountAuto
|| columns->mColumnWidth.GetUnit() != eStyleUnit_Auto) {
nsContainerFrame* columnSetFrame =
NS_NewColumnSetFrame(mPresShell, aComputedStyle,

Просмотреть файл

@ -1187,7 +1187,7 @@ nsComputedDOMStyle::DoGetColumnCount()
const nsStyleColumn* column = StyleColumn();
if (column->mColumnCount == NS_STYLE_COLUMN_COUNT_AUTO) {
if (column->mColumnCount == nsStyleColumn::kColumnCountAuto) {
val->SetIdent(eCSSKeyword_auto);
} else {
val->SetNumber(column->mColumnCount);

Просмотреть файл

@ -979,10 +979,6 @@ enum class StyleWhiteSpace : uint8_t {
#define NS_STYLE_PAGE_BREAK_LEFT 3
#define NS_STYLE_PAGE_BREAK_RIGHT 4
// See nsStyleColumn
#define NS_STYLE_COLUMN_COUNT_AUTO 0
#define NS_STYLE_COLUMN_COUNT_UNLIMITED (-1)
#define NS_STYLE_COLUMN_FILL_AUTO 0
#define NS_STYLE_COLUMN_FILL_BALANCE 1

Просмотреть файл

@ -753,10 +753,10 @@ nsStyleXUL::CalcDifference(const nsStyleXUL& aNewData) const
// nsStyleColumn
//
/* static */ const uint32_t nsStyleColumn::kMaxColumnCount;
/* static */ const uint32_t nsStyleColumn::kColumnCountAuto;
nsStyleColumn::nsStyleColumn(const nsPresContext* aContext)
: mColumnCount(NS_STYLE_COLUMN_COUNT_AUTO)
, mColumnWidth(eStyleUnit_Auto)
: mColumnWidth(eStyleUnit_Auto)
, mColumnRuleColor(StyleComplexColor::CurrentColor())
, mColumnRuleStyle(NS_STYLE_BORDER_STYLE_NONE)
, mColumnFill(NS_STYLE_COLUMN_FILL_BALANCE)

Просмотреть файл

@ -2806,13 +2806,14 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColumn
nsChangeHint CalcDifference(const nsStyleColumn& aNewData) const;
/**
* This is the maximum number of columns we can process. It's used in both
* nsColumnSetFrame and nsRuleNode.
*/
// This is the maximum number of columns we can process. It's used in
// nsColumnSetFrame.
static const uint32_t kMaxColumnCount = 1000;
uint32_t mColumnCount; // NS_STYLE_COLUMN_COUNT_* or another integer
// This represents the value of column-count: auto.
static const uint32_t kColumnCountAuto = 0;
uint32_t mColumnCount = kColumnCountAuto;
nsStyleCoord mColumnWidth; // coord, auto
mozilla::StyleComplexColor mColumnRuleColor;

Просмотреть файл

@ -5379,21 +5379,21 @@ clip-path
#[allow(unused_unsafe)]
pub fn set_column_count(&mut self, v: longhands::column_count::computed_value::T) {
use gecko_bindings::structs::{NS_STYLE_COLUMN_COUNT_AUTO, nsStyleColumn_kMaxColumnCount};
use gecko_bindings::structs::{nsStyleColumn_kColumnCountAuto, nsStyleColumn_kMaxColumnCount};
self.gecko.mColumnCount = match v {
ColumnCount::Integer(integer) => {
cmp::min(integer.0 as u32, unsafe { nsStyleColumn_kMaxColumnCount })
},
ColumnCount::Auto => NS_STYLE_COLUMN_COUNT_AUTO
ColumnCount::Auto => nsStyleColumn_kColumnCountAuto
};
}
${impl_simple_copy('column_count', 'mColumnCount')}
pub fn clone_column_count(&self) -> longhands::column_count::computed_value::T {
use gecko_bindings::structs::{NS_STYLE_COLUMN_COUNT_AUTO, nsStyleColumn_kMaxColumnCount};
if self.gecko.mColumnCount != NS_STYLE_COLUMN_COUNT_AUTO {
use gecko_bindings::structs::{nsStyleColumn_kColumnCountAuto, nsStyleColumn_kMaxColumnCount};
if self.gecko.mColumnCount != nsStyleColumn_kColumnCountAuto {
debug_assert!(self.gecko.mColumnCount >= 1 &&
self.gecko.mColumnCount <= nsStyleColumn_kMaxColumnCount);
ColumnCount::Integer((self.gecko.mColumnCount as i32).into())