Commit 7995bd56 authored by aazzam's avatar aazzam Committed by Commit bot

Implements CSSPropertyAPI for the font-size-adjust property.

A part of Project Ribbon, separating the parsing logic for CSS
properties from the parser into an API. This patch removes
CSSPropertyFontSizeAdjust from the switch statement in
parseSingleValue, and calls the API instead.

A function pointer to the parseSingleValue function from the API for the
page property is stored in a CSSPropertyDescriptor, and is called from
CSSPropertyParser.

This patch:
- Adds CSSPropertyAPIFontSizeAdjust.cpp to the BUILD.gn file.
- Adds api_class flag to CSSProperties.in, which indicates that
  CSSPropertyAPIFontSizeAdjust.h is generated.
- Moves the parsing logic for page from CSSPropertyParser.cpp to
  CSSPropertyAPIFontSizeAdjust.cpp, which implements
  CSSPropertyAPI.h.

BUG=668012

Review-Url: https://codereview.chromium.org/2617443005
Cr-Commit-Position: refs/heads/master@{#442814}
parent b9937a42
......@@ -347,6 +347,7 @@ blink_core_sources("css") {
"properties/CSSPropertyAPICaretColor.cpp",
"properties/CSSPropertyAPIClip.cpp",
"properties/CSSPropertyAPIColumnGap.cpp",
"properties/CSSPropertyAPIFontSizeAdjust.cpp",
"properties/CSSPropertyAPISize.cpp",
"properties/CSSPropertyAPITextDecorationColor.cpp",
"properties/CSSPropertyAPITextDecorationSkip.cpp",
......
......@@ -166,7 +166,7 @@ direction inherited, custom_value, keyword_only, keywords=[ltr|rtl], initial_key
font-family inherited, font, type_name=FontDescription::FamilyDescription, name_for_methods=FamilyDescription, converter=convertFontFamily
font-kerning inherited, font, type_name=FontDescription::Kerning, name_for_methods=Kerning
font-size interpolable, inherited, font, name_for_methods=Size, getter=getSize, converter=convertFontSize
font-size-adjust runtime_flag=CSSFontSizeAdjust, interpolable, inherited, font, name_for_methods=SizeAdjust, converter=convertFontSizeAdjust
font-size-adjust runtime_flag=CSSFontSizeAdjust, interpolable, inherited, font, name_for_methods=SizeAdjust, converter=convertFontSizeAdjust, api_class
font-stretch inherited, font, type_name=FontStretch, name_for_methods=Stretch
font-style inherited, font, type_name=FontStyle, name_for_methods=Style
font-variant-ligatures inherited, font, type_name=VariantLigatures, name_for_methods=VariantLigatures, converter=convertFontVariantLigatures
......
......@@ -2588,12 +2588,6 @@ static CSSValue* consumeReflect(CSSParserTokenRange& range,
return CSSReflectValue::create(direction, offset, mask);
}
static CSSValue* consumeFontSizeAdjust(CSSParserTokenRange& range) {
if (range.peek().id() == CSSValueNone)
return consumeIdent(range);
return consumeNumber(range, ValueRangeNonNegative);
}
static CSSValue* consumeImageOrientation(CSSParserTokenRange& range) {
if (range.peek().id() == CSSValueFromImage)
return consumeIdent(range);
......@@ -3624,9 +3618,6 @@ const CSSValue* CSSPropertyParser::parseSingleValue(
return consumeWebkitBorderImage(property, m_range, m_context);
case CSSPropertyWebkitBoxReflect:
return consumeReflect(m_range, m_context);
case CSSPropertyFontSizeAdjust:
ASSERT(RuntimeEnabledFeatures::cssFontSizeAdjustEnabled());
return consumeFontSizeAdjust(m_range);
case CSSPropertyImageOrientation:
ASSERT(RuntimeEnabledFeatures::imageOrientationEnabled());
return consumeImageOrientation(m_range);
......
// 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/CSSPropertyAPIFontSizeAdjust.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "platform/RuntimeEnabledFeatures.h"
namespace blink {
const CSSValue* CSSPropertyAPIFontSizeAdjust::parseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context) {
DCHECK(RuntimeEnabledFeatures::cssFontSizeAdjustEnabled());
if (range.peek().id() == CSSValueNone)
return CSSPropertyParserHelpers::consumeIdent(range);
return CSSPropertyParserHelpers::consumeNumber(range, ValueRangeNonNegative);
}
} // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment