Commit 2be78435 authored by Anders Hartvoll Ruud's avatar Anders Hartvoll Ruud Committed by Commit Bot

[css-properties-values-api] Rename PropertyDescriptor to PropertyDefinition

We changed the name of PropertyDescriptor once @property was added to
the spec to avoid confusion with the at-rule descriptors. This CL is not
a web-facing change that's strictly necessary, but it's nice to align
the naming with the spec.

R=futhark@chromium.org

Change-Id: I49dbecae5bdccd06e8c75f2c01405d103dbc44f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1724522Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682214}
parent 92b77497
......@@ -5,7 +5,7 @@
#include "third_party/blink/public/web/web_script_source.h"
#include "third_party/blink/renderer/core/animation/animatable.h"
#include "third_party/blink/renderer/core/css/css_style_sheet.h"
#include "third_party/blink/renderer/core/css/property_descriptor.h"
#include "third_party/blink/renderer/core/css/property_definition.h"
#include "third_party/blink/renderer/core/css/property_registration.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/page/page.h"
......@@ -49,12 +49,12 @@ TEST_F(AnimationSimTest, CustomPropertyBaseComputedStyle) {
// inherits: false
// })
DummyExceptionStateForTesting exception_state;
PropertyDescriptor* property_descriptor = PropertyDescriptor::Create();
property_descriptor->setName("--x");
property_descriptor->setSyntax("<percentage>");
property_descriptor->setInitialValue("0%");
property_descriptor->setInherits(false);
PropertyRegistration::registerProperty(&GetDocument(), property_descriptor,
PropertyDefinition* property_definition = PropertyDefinition::Create();
property_definition->setName("--x");
property_definition->setSyntax("<percentage>");
property_definition->setInitialValue("0%");
property_definition->setInherits(false);
PropertyRegistration::registerProperty(&GetDocument(), property_definition,
exception_state);
EXPECT_FALSE(exception_state.HadException());
......
......@@ -39,7 +39,7 @@
#include "third_party/blink/renderer/core/animation/invalidatable_interpolation.h"
#include "third_party/blink/renderer/core/animation/string_keyframe.h"
#include "third_party/blink/renderer/core/css/css_primitive_value.h"
#include "third_party/blink/renderer/core/css/property_descriptor.h"
#include "third_party/blink/renderer/core/css/property_definition.h"
#include "third_party/blink/renderer/core/css/property_registration.h"
#include "third_party/blink/renderer/core/css/property_registry.h"
#include "third_party/blink/renderer/core/css/resolver/style_resolver.h"
......@@ -140,12 +140,12 @@ const PropertySpecificKeyframeVector& ConstructEffectAndGetKeyframes(
const String& zero_value,
const String& one_value,
ExceptionState& exception_state) {
PropertyDescriptor* property_descriptor = PropertyDescriptor::Create();
property_descriptor->setName(property_name);
property_descriptor->setSyntax(type);
property_descriptor->setInitialValue(zero_value);
property_descriptor->setInherits(false);
PropertyRegistration::registerProperty(document, property_descriptor,
PropertyDefinition* property_definition = PropertyDefinition::Create();
property_definition->setName(property_name);
property_definition->setSyntax(type);
property_definition->setInitialValue(zero_value);
property_definition->setInherits(false);
PropertyRegistration::registerProperty(document, property_definition,
exception_state);
StringKeyframeVector keyframes =
......
......@@ -606,7 +606,7 @@ core_dictionary_idl_files =
"css/font_face_descriptors.idl",
"css/font_face_set_load_event_init.idl",
"css/media_query_list_event_init.idl",
"css/property_descriptor.idl",
"css/property_definition.idl",
"css/cssom/css_matrix_component_options.idl",
"css/cssom/css_numeric_type.idl",
"dom/element_creation_options.idl",
......
......@@ -15,7 +15,7 @@
#include "third_party/blink/renderer/core/css/parser/css_tokenizer.h"
#include "third_party/blink/renderer/core/css/properties/css_property_ref.h"
#include "third_party/blink/renderer/core/css/properties/longhand.h"
#include "third_party/blink/renderer/core/css/property_descriptor.h"
#include "third_party/blink/renderer/core/css/property_definition.h"
#include "third_party/blink/renderer/core/css/property_registration.h"
#include "third_party/blink/renderer/core/css/property_registry.h"
#include "third_party/blink/renderer/core/css/rule_set.h"
......@@ -68,12 +68,12 @@ void RegisterProperty(Document& document,
const String& initial_value,
bool is_inherited) {
DummyExceptionStateForTesting exception_state;
PropertyDescriptor* property_descriptor = PropertyDescriptor::Create();
property_descriptor->setName(name);
property_descriptor->setSyntax(syntax);
property_descriptor->setInitialValue(initial_value);
property_descriptor->setInherits(is_inherited);
PropertyRegistration::registerProperty(&document, property_descriptor,
PropertyDefinition* property_definition = PropertyDefinition::Create();
property_definition->setName(name);
property_definition->setSyntax(syntax);
property_definition->setInitialValue(initial_value);
property_definition->setInherits(is_inherited);
PropertyRegistration::registerProperty(&document, property_definition,
exception_state);
ASSERT_FALSE(exception_state.HadException());
}
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
dictionary PropertyDescriptor {
dictionary PropertyDefinition {
required DOMString name;
DOMString syntax = "*";
required boolean inherits;
......
......@@ -16,7 +16,7 @@
#include "third_party/blink/renderer/core/css/parser/css_parser_context.h"
#include "third_party/blink/renderer/core/css/parser/css_tokenizer.h"
#include "third_party/blink/renderer/core/css/parser/css_variable_parser.h"
#include "third_party/blink/renderer/core/css/property_descriptor.h"
#include "third_party/blink/renderer/core/css/property_definition.h"
#include "third_party/blink/renderer/core/css/property_registry.h"
#include "third_party/blink/renderer/core/css/resolver/style_builder_converter.h"
#include "third_party/blink/renderer/core/css/style_change_reason.h"
......@@ -152,14 +152,14 @@ PropertyRegistration* PropertyRegistration::MaybeCreate(
void PropertyRegistration::registerProperty(
ExecutionContext* execution_context,
const PropertyDescriptor* descriptor,
const PropertyDefinition* property_definition,
ExceptionState& exception_state) {
// Bindings code ensures these are set.
DCHECK(descriptor->hasName());
DCHECK(descriptor->hasInherits());
DCHECK(descriptor->hasSyntax());
DCHECK(property_definition->hasName());
DCHECK(property_definition->hasInherits());
DCHECK(property_definition->hasSyntax());
String name = descriptor->name();
String name = property_definition->name();
if (!CSSVariableParser::IsValidVariableName(name)) {
exception_state.ThrowDOMException(
DOMExceptionCode::kSyntaxError,
......@@ -177,7 +177,7 @@ void PropertyRegistration::registerProperty(
}
base::Optional<CSSSyntaxDescriptor> syntax_descriptor =
CSSSyntaxStringParser(descriptor->syntax()).Parse();
CSSSyntaxStringParser(property_definition->syntax()).Parse();
if (!syntax_descriptor) {
exception_state.ThrowDOMException(
DOMExceptionCode::kSyntaxError,
......@@ -190,8 +190,8 @@ void PropertyRegistration::registerProperty(
const CSSValue* initial = nullptr;
scoped_refptr<CSSVariableData> initial_variable_data;
if (descriptor->hasInitialValue()) {
CSSTokenizer tokenizer(descriptor->initialValue());
if (property_definition->hasInitialValue()) {
CSSTokenizer tokenizer(property_definition->initialValue());
const auto tokens = tokenizer.TokenizeToEOF();
bool is_animation_tainted = false;
initial = syntax_descriptor->Parse(CSSParserTokenRange(tokens),
......@@ -222,9 +222,10 @@ void PropertyRegistration::registerProperty(
}
}
registry.RegisterProperty(
atomic_name, *MakeGarbageCollected<PropertyRegistration>(
atomic_name, *syntax_descriptor, descriptor->inherits(),
initial, std::move(initial_variable_data)));
atomic_name,
*MakeGarbageCollected<PropertyRegistration>(
atomic_name, *syntax_descriptor, property_definition->inherits(),
initial, std::move(initial_variable_data)));
document->GetStyleEngine().CustomPropertyRegistered();
}
......
......@@ -18,7 +18,7 @@ namespace blink {
class ExceptionState;
class ExecutionContext;
class PropertyDescriptor;
class PropertyDefinition;
class StyleRuleProperty;
using CSSInterpolationTypes = Vector<std::unique_ptr<CSSInterpolationType>>;
......@@ -31,7 +31,7 @@ class CORE_EXPORT PropertyRegistration
StyleRuleProperty&);
static void registerProperty(ExecutionContext*,
const PropertyDescriptor*,
const PropertyDefinition*,
ExceptionState&);
static const PropertyRegistration* From(const ExecutionContext*,
......
......@@ -7,5 +7,5 @@
ImplementedAs=PropertyRegistration
] partial interface CSS {
[RuntimeEnabled=CSSVariables2, MeasureAs=CSSRegisterProperty, CallWith=ExecutionContext, RaisesException]
static void registerProperty(PropertyDescriptor descriptor);
static void registerProperty(PropertyDefinition definition);
};
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