Commit f812e777 authored by aazzam's avatar aazzam Committed by Commit bot

Implements CSSPropertyAPI for the page property.

A part of Project Ribbon, separating the parsing logic for CSS
properties from the parser into an API. This patch removes
CSSPropertyPage 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 CSSPropertyAPIPage.cpp to the BUILD.gn file.
- Adds api_class flag to CSSProperties.in, which indicates that
  CSSPropertyAPIPage.h is generated.
- Moves the parsing logic for page from CSSPropertyParser.cpp to
  CSSPropertyAPIPage.cpp, which implements CSSPropertyAPI.h.

BUG=668012

Review-Url: https://codereview.chromium.org/2618523003
Cr-Commit-Position: refs/heads/master@{#442879}
parent 15f17c04
......@@ -352,6 +352,7 @@ blink_core_sources("css") {
"properties/CSSPropertyAPIFontVariationSettings.cpp",
"properties/CSSPropertyAPIOffsetPosition.cpp",
"properties/CSSPropertyAPIOutlineOffset.cpp",
"properties/CSSPropertyAPIPage.cpp",
"properties/CSSPropertyAPISize.cpp",
"properties/CSSPropertyAPITextDecorationColor.cpp",
"properties/CSSPropertyAPITextDecorationSkip.cpp",
......
......@@ -516,7 +516,7 @@ max-block-size direction_aware
// TODO(timloh): This seems wrong, most of these shouldn't reach the StyleBuilder
all builder_skip
page builder_skip
page builder_skip, api_class
-webkit-font-size-delta builder_skip
-webkit-text-decorations-in-effect inherited, builder_skip
......
......@@ -329,12 +329,6 @@ static CSSValue* consumeFontFeatureSettings(CSSParserTokenRange& range) {
return settings;
}
static CSSValue* consumePage(CSSParserTokenRange& range) {
if (range.peek().id() == CSSValueAuto)
return consumeIdent(range);
return consumeCustomIdent(range);
}
static CSSValue* consumeQuotes(CSSParserTokenRange& range) {
if (range.peek().id() == CSSValueNone)
return consumeIdent(range);
......@@ -3228,8 +3222,6 @@ const CSSValue* CSSPropertyParser::parseSingleValue(
return cssPropertyDesc.parseSingleValue(m_range, m_context);
switch (property) {
case CSSPropertyPage:
return consumePage(m_range);
case CSSPropertyQuotes:
return consumeQuotes(m_range);
case CSSPropertyWebkitHighlight:
......
// 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/CSSPropertyAPIPage.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
namespace blink {
const CSSValue* CSSPropertyAPIPage::parseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context) {
if (range.peek().id() == CSSValueAuto)
return CSSPropertyParserHelpers::consumeIdent(range);
return CSSPropertyParserHelpers::consumeCustomIdent(range);
}
} // 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