blob: 82c94c213c5d2a4b6e035b5ed294ba9c47fe6429 [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "core/css/properties/longhands/ColumnGap.h"
#include "core/css/parser/CSSParserContext.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSLonghand {
const CSSValue* ColumnGap::ParseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context,
const CSSParserLocalContext&) const {
if (range.Peek().Id() == CSSValueNormal)
return CSSPropertyParserHelpers::ConsumeIdent(range);
return CSSPropertyParserHelpers::ConsumeLengthOrPercent(
range, context.Mode(), kValueRangeNonNegative);
}
const CSSValue* ColumnGap::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject*,
Node* styled_node,
bool allow_visited_style) const {
if (style.ColumnGap().IsNormal())
return CSSIdentifierValue::Create(CSSValueNormal);
return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(
style.ColumnGap().GetLength(), style);
}
} // namespace CSSLonghand
} // namespace blink