Commit dc692089 authored by Bugs Nash's avatar Bugs Nash Committed by Commit Bot

Moved CSSPropertyColor to appropriate API and renamed color APIs

This patch fixes an error introduced in patch crrev.com/2882603002,
where the CSSPropertyBackgroundColor property was pulled out into a
single property API when it should have been grouped with the
CSSPropertyColor property. This error left CSSPropertyColor parsing
logic to fall through to border color parsing logic.

This patch
- moved CSSPropertyColor to be grouped with CSSPropertyBorderColor in
  existing API implementation
- renamed CSSPropertyAPIBackgroundColor to CSSPropertyAPIColor as a
  group API name for CSSPropertyColor and CSSPropertyBorderColor
- because CSSPropertyAPIColor was already taken as an API name,
  renamed the pre-existing CSSPropertyAPIColor to
  CSSPropertyAPIColorNoQuirks (the difference between the 2 APIs
  parsing logic is only whether quirks mode is permitted)

Bug: 668012
Change-Id: I119a2cafbd51b93bd1c9323745aae728cc74a2ca
Reviewed-on: https://chromium-review.googlesource.com/562944Reviewed-by: default avatarmeade_UTC10 <meade@chromium.org>
Reviewed-by: default avatarEric Willigers <ericwilligers@chromium.org>
Reviewed-by: default avatarSuzy Howlett <suzyh@chromium.org>
Commit-Queue: Bugs Nash <bugsnash@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485190}
parent 1657a919
...@@ -465,7 +465,6 @@ css_properties("make_core_generated_css_property_apis") { ...@@ -465,7 +465,6 @@ css_properties("make_core_generated_css_property_apis") {
"$blink_core_output_dir/css/properties/CSSPropertyAPIAnimationIterationCount.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIAnimationIterationCount.h",
"$blink_core_output_dir/css/properties/CSSPropertyAPIAnimationName.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIAnimationName.h",
"$blink_core_output_dir/css/properties/CSSPropertyAPIAnimationPlayState.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIAnimationPlayState.h",
"$blink_core_output_dir/css/properties/CSSPropertyAPIBackgroundColor.h",
"$blink_core_output_dir/css/properties/CSSPropertyAPIBaselineShift.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIBaselineShift.h",
"$blink_core_output_dir/css/properties/CSSPropertyAPIBorderImageOutset.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIBorderImageOutset.h",
"$blink_core_output_dir/css/properties/CSSPropertyAPIBorderImageRepeat.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIBorderImageRepeat.h",
...@@ -478,6 +477,7 @@ css_properties("make_core_generated_css_property_apis") { ...@@ -478,6 +477,7 @@ css_properties("make_core_generated_css_property_apis") {
"$blink_core_output_dir/css/properties/CSSPropertyAPIClip.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIClip.h",
"$blink_core_output_dir/css/properties/CSSPropertyAPIClipPath.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIClipPath.h",
"$blink_core_output_dir/css/properties/CSSPropertyAPIColor.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIColor.h",
"$blink_core_output_dir/css/properties/CSSPropertyAPIColorNoQuirks.h",
"$blink_core_output_dir/css/properties/CSSPropertyAPIColumnCount.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIColumnCount.h",
"$blink_core_output_dir/css/properties/CSSPropertyAPIColumnGap.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIColumnGap.h",
"$blink_core_output_dir/css/properties/CSSPropertyAPIColumnRuleWidth.h", "$blink_core_output_dir/css/properties/CSSPropertyAPIColumnRuleWidth.h",
......
...@@ -381,7 +381,6 @@ blink_core_sources("css") { ...@@ -381,7 +381,6 @@ blink_core_sources("css") {
"properties/CSSPropertyAPIAnimationIterationCount.cpp", "properties/CSSPropertyAPIAnimationIterationCount.cpp",
"properties/CSSPropertyAPIAnimationName.cpp", "properties/CSSPropertyAPIAnimationName.cpp",
"properties/CSSPropertyAPIAnimationPlayState.cpp", "properties/CSSPropertyAPIAnimationPlayState.cpp",
"properties/CSSPropertyAPIBackgroundColor.cpp",
"properties/CSSPropertyAPIBaselineShift.cpp", "properties/CSSPropertyAPIBaselineShift.cpp",
"properties/CSSPropertyAPIBorderImageOutset.cpp", "properties/CSSPropertyAPIBorderImageOutset.cpp",
"properties/CSSPropertyAPIBorderImageRepeat.cpp", "properties/CSSPropertyAPIBorderImageRepeat.cpp",
...@@ -394,6 +393,7 @@ blink_core_sources("css") { ...@@ -394,6 +393,7 @@ blink_core_sources("css") {
"properties/CSSPropertyAPIClip.cpp", "properties/CSSPropertyAPIClip.cpp",
"properties/CSSPropertyAPIClipPath.cpp", "properties/CSSPropertyAPIClipPath.cpp",
"properties/CSSPropertyAPIColor.cpp", "properties/CSSPropertyAPIColor.cpp",
"properties/CSSPropertyAPIColorNoQuirks.cpp",
"properties/CSSPropertyAPIColumnCount.cpp", "properties/CSSPropertyAPIColumnCount.cpp",
"properties/CSSPropertyAPIColumnGap.cpp", "properties/CSSPropertyAPIColumnGap.cpp",
"properties/CSSPropertyAPIColumnRuleWidth.cpp", "properties/CSSPropertyAPIColumnRuleWidth.cpp",
......
...@@ -398,6 +398,8 @@ ...@@ -398,6 +398,8 @@
// Other properties can depend upon high priority properties (e.g. font-size / ems) // Other properties can depend upon high priority properties (e.g. font-size / ems)
{ {
name: "color", name: "color",
api_class: "CSSPropertyAPIColor",
api_methods: ["parseSingleValue"],
custom_all: true, custom_all: true,
inherited: true, inherited: true,
interpolable: true, interpolable: true,
...@@ -690,7 +692,7 @@ ...@@ -690,7 +692,7 @@
}, },
{ {
name: "background-color", name: "background-color",
api_class: true, api_class: "CSSPropertyAPIColor",
api_methods: ["parseSingleValue"], api_methods: ["parseSingleValue"],
custom_all: true, custom_all: true,
interpolable: true, interpolable: true,
...@@ -1302,7 +1304,7 @@ ...@@ -1302,7 +1304,7 @@
}, },
{ {
name: "flood-color", name: "flood-color",
api_class: "CSSPropertyAPIColor", api_class: "CSSPropertyAPIColorNoQuirks",
api_methods: ["parseSingleValue"], api_methods: ["parseSingleValue"],
converter: "ConvertColor", converter: "ConvertColor",
interpolable: true, interpolable: true,
...@@ -1547,7 +1549,7 @@ ...@@ -1547,7 +1549,7 @@
}, },
{ {
name: "lighting-color", name: "lighting-color",
api_class: "CSSPropertyAPIColor", api_class: "CSSPropertyAPIColorNoQuirks",
api_methods: ["parseSingleValue"], api_methods: ["parseSingleValue"],
converter: "ConvertColor", converter: "ConvertColor",
interpolable: true, interpolable: true,
...@@ -2360,7 +2362,7 @@ ...@@ -2360,7 +2362,7 @@
}, },
{ {
name: "stop-color", name: "stop-color",
api_class: "CSSPropertyAPIColor", api_class: "CSSPropertyAPIColorNoQuirks",
api_methods: ["parseSingleValue"], api_methods: ["parseSingleValue"],
converter: "ConvertColor", converter: "ConvertColor",
interpolable: true, interpolable: true,
...@@ -2954,7 +2956,7 @@ ...@@ -2954,7 +2956,7 @@
}, },
{ {
name: "column-rule-color", name: "column-rule-color",
api_class: "CSSPropertyAPIColor", api_class: "CSSPropertyAPIColorNoQuirks",
api_methods: ["parseSingleValue"], api_methods: ["parseSingleValue"],
custom_all: true, custom_all: true,
interpolable: true, interpolable: true,
...@@ -3190,7 +3192,7 @@ ...@@ -3190,7 +3192,7 @@
}, },
{ {
name: "-webkit-tap-highlight-color", name: "-webkit-tap-highlight-color",
api_class: "CSSPropertyAPIColor", api_class: "CSSPropertyAPIColorNoQuirks",
api_methods: ["parseSingleValue"], api_methods: ["parseSingleValue"],
converter: "ConvertColor", converter: "ConvertColor",
inherited: true, inherited: true,
...@@ -3207,7 +3209,7 @@ ...@@ -3207,7 +3209,7 @@
}, },
{ {
name: "-webkit-text-emphasis-color", name: "-webkit-text-emphasis-color",
api_class: "CSSPropertyAPIColor", api_class: "CSSPropertyAPIColorNoQuirks",
api_methods: ["parseSingleValue"], api_methods: ["parseSingleValue"],
custom_all: true, custom_all: true,
inherited: true, inherited: true,
...@@ -3235,7 +3237,7 @@ ...@@ -3235,7 +3237,7 @@
}, },
{ {
name: "-webkit-text-fill-color", name: "-webkit-text-fill-color",
api_class: "CSSPropertyAPIColor", api_class: "CSSPropertyAPIColorNoQuirks",
api_methods: ["parseSingleValue"], api_methods: ["parseSingleValue"],
custom_all: true, custom_all: true,
inherited: true, inherited: true,
...@@ -3255,7 +3257,7 @@ ...@@ -3255,7 +3257,7 @@
}, },
{ {
name: "-webkit-text-stroke-color", name: "-webkit-text-stroke-color",
api_class: "CSSPropertyAPIColor", api_class: "CSSPropertyAPIColorNoQuirks",
api_methods: ["parseSingleValue"], api_methods: ["parseSingleValue"],
custom_all: true, custom_all: true,
inherited: true, inherited: true,
...@@ -3427,7 +3429,7 @@ ...@@ -3427,7 +3429,7 @@
{ {
name: "-webkit-border-end-color", name: "-webkit-border-end-color",
api_class: "CSSPropertyAPIColor", api_class: "CSSPropertyAPIColorNoQuirks",
api_methods: ["parseSingleValue"], api_methods: ["parseSingleValue"],
direction_aware: true, direction_aware: true,
}, },
...@@ -3443,7 +3445,7 @@ ...@@ -3443,7 +3445,7 @@
}, },
{ {
name: "-webkit-border-start-color", name: "-webkit-border-start-color",
api_class: "CSSPropertyAPIColor", api_class: "CSSPropertyAPIColorNoQuirks",
api_methods: ["parseSingleValue"], api_methods: ["parseSingleValue"],
direction_aware: true, direction_aware: true,
}, },
...@@ -3459,7 +3461,7 @@ ...@@ -3459,7 +3461,7 @@
}, },
{ {
name: "-webkit-border-before-color", name: "-webkit-border-before-color",
api_class: "CSSPropertyAPIColor", api_class: "CSSPropertyAPIColorNoQuirks",
api_methods: ["parseSingleValue"], api_methods: ["parseSingleValue"],
direction_aware: true, direction_aware: true,
}, },
...@@ -3475,7 +3477,7 @@ ...@@ -3475,7 +3477,7 @@
}, },
{ {
name: "-webkit-border-after-color", name: "-webkit-border-after-color",
api_class: "CSSPropertyAPIColor", api_class: "CSSPropertyAPIColorNoQuirks",
api_methods: ["parseSingleValue"], api_methods: ["parseSingleValue"],
direction_aware: true, direction_aware: true,
}, },
......
...@@ -1243,7 +1243,6 @@ const CSSValue* CSSPropertyParser::ParseSingleValue( ...@@ -1243,7 +1243,6 @@ const CSSValue* CSSPropertyParser::ParseSingleValue(
case CSSPropertyGridRowGap: case CSSPropertyGridRowGap:
return ConsumeLengthOrPercent(range_, context_->Mode(), return ConsumeLengthOrPercent(range_, context_->Mode(),
kValueRangeNonNegative); kValueRangeNonNegative);
case CSSPropertyColor:
case CSSPropertyBorderBottomColor: case CSSPropertyBorderBottomColor:
case CSSPropertyBorderLeftColor: case CSSPropertyBorderLeftColor:
case CSSPropertyBorderRightColor: case CSSPropertyBorderRightColor:
......
...@@ -5,16 +5,17 @@ ...@@ -5,16 +5,17 @@
#include "core/css/properties/CSSPropertyAPIColor.h" #include "core/css/properties/CSSPropertyAPIColor.h"
#include "core/css/parser/CSSParserContext.h" #include "core/css/parser/CSSParserContext.h"
#include "core/css/parser/CSSParserMode.h"
#include "core/css/parser/CSSPropertyParserHelpers.h" #include "core/css/parser/CSSPropertyParserHelpers.h"
class CSSParserLocalContext;
namespace blink { namespace blink {
const CSSValue* CSSPropertyAPIColor::parseSingleValue( const CSSValue* CSSPropertyAPIColor::parseSingleValue(
CSSParserTokenRange& range, CSSParserTokenRange& range,
const CSSParserContext& context, const CSSParserContext& context,
const CSSParserLocalContext&) { const CSSParserLocalContext&) {
return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); return CSSPropertyParserHelpers::ConsumeColor(
range, context.Mode(), IsQuirksModeBehavior(context.Mode()));
} }
} // namespace blink } // namespace blink
...@@ -2,20 +2,19 @@ ...@@ -2,20 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "core/css/properties/CSSPropertyAPIBackgroundColor.h" #include "core/css/properties/CSSPropertyAPIColorNoQuirks.h"
#include "core/css/parser/CSSParserContext.h" #include "core/css/parser/CSSParserContext.h"
#include "core/css/parser/CSSParserMode.h"
#include "core/css/parser/CSSPropertyParserHelpers.h" #include "core/css/parser/CSSPropertyParserHelpers.h"
class CSSParserLocalContext;
namespace blink { namespace blink {
const CSSValue* CSSPropertyAPIBackgroundColor::parseSingleValue( const CSSValue* CSSPropertyAPIColorNoQuirks::parseSingleValue(
CSSParserTokenRange& range, CSSParserTokenRange& range,
const CSSParserContext& context, const CSSParserContext& context,
const CSSParserLocalContext&) { const CSSParserLocalContext&) {
return CSSPropertyParserHelpers::ConsumeColor( return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode());
range, context.Mode(), IsQuirksModeBehavior(context.Mode()));
} }
} // namespace blink } // 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