Commit bc68a3bf authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

css: Make CSS an IDL namespace

Blink-V8 bindings haven't supported IDL namespaces for a long
time, however, finally IDL namespaces get supported.

This patch changes `window.CSS` from an IDL interface to an IDL
namespace in conformance to the standard.

Change-Id: I60a7129df48b68e890ed30bf7ed03d7f79228522
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2434404Reviewed-by: default avatarAnders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821692}
parent e4f7d9c3
......@@ -519,8 +519,6 @@ generated_interface_sources_in_core = [
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_count_queuing_strategy.h",
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_csp_violation_report_body.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_csp_violation_report_body.h",
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_css.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_css.h",
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_css_animation.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_css_animation.h",
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_css_condition_rule.cc",
......@@ -1393,7 +1391,10 @@ generated_interface_sources_in_core = [
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_xslt_processor.h",
]
generated_namespace_sources_in_core = []
generated_namespace_sources_in_core = [
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_css.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_css.h",
]
# Generated sources for testing
......
......@@ -32,8 +32,8 @@
[
Exposed=Window,
ImplementedAs=DOMWindowCSS
] interface CSS {
[CallWith=ExecutionContext] static boolean supports(DOMString property, DOMString value);
[CallWith=ExecutionContext] static boolean supports(DOMString conditionText);
static DOMString escape(DOMString ident);
] namespace CSS {
[CallWith=ExecutionContext] boolean supports(DOMString property, DOMString value);
[CallWith=ExecutionContext] boolean supports(DOMString conditionText);
DOMString escape(DOMString ident);
};
......@@ -6,52 +6,52 @@
[
ImplementedAs=CSSUnitValues
] partial interface CSS {
[NewObject] static CSSUnitValue number(double value);
[NewObject] static CSSUnitValue percent(double value);
] partial namespace CSS {
[NewObject] CSSUnitValue number(double value);
[NewObject] CSSUnitValue percent(double value);
// <length>
[NewObject] static CSSUnitValue em(double value);
[NewObject] static CSSUnitValue ex(double value);
[NewObject] static CSSUnitValue ch(double value);
[NewObject] static CSSUnitValue rem(double value);
[NewObject] static CSSUnitValue vw(double value);
[NewObject] static CSSUnitValue vh(double value);
[NewObject] static CSSUnitValue vmin(double value);
[NewObject] static CSSUnitValue vmax(double value);
[NewObject] static CSSUnitValue cm(double value);
[NewObject] static CSSUnitValue mm(double value);
[NewObject] static CSSUnitValue in(double value);
[NewObject] static CSSUnitValue pt(double value);
[NewObject] static CSSUnitValue pc(double value);
[NewObject] static CSSUnitValue px(double value);
[NewObject] static CSSUnitValue Q(double value);
[NewObject] CSSUnitValue em(double value);
[NewObject] CSSUnitValue ex(double value);
[NewObject] CSSUnitValue ch(double value);
[NewObject] CSSUnitValue rem(double value);
[NewObject] CSSUnitValue vw(double value);
[NewObject] CSSUnitValue vh(double value);
[NewObject] CSSUnitValue vmin(double value);
[NewObject] CSSUnitValue vmax(double value);
[NewObject] CSSUnitValue cm(double value);
[NewObject] CSSUnitValue mm(double value);
[NewObject] CSSUnitValue in(double value);
[NewObject] CSSUnitValue pt(double value);
[NewObject] CSSUnitValue pc(double value);
[NewObject] CSSUnitValue px(double value);
[NewObject] CSSUnitValue Q(double value);
// TODO: Currently unsupported length units that are specified
// [NewObject] static CSSUnitValue ic(double value);
// [NewObject] static CSSUnitValue lh(double value);
// [NewObject] static CSSUnitValue rlh(double value);
// [NewObject] static CSSUnitValue vi(double value);
// [NewObject] static CSSUnitValue vb(double value);
// [NewObject] CSSUnitValue ic(double value);
// [NewObject] CSSUnitValue lh(double value);
// [NewObject] CSSUnitValue rlh(double value);
// [NewObject] CSSUnitValue vi(double value);
// [NewObject] CSSUnitValue vb(double value);
// <angle>
[NewObject] static CSSUnitValue deg(double value);
[NewObject] static CSSUnitValue grad(double value);
[NewObject] static CSSUnitValue rad(double value);
[NewObject] static CSSUnitValue turn(double value);
[NewObject] CSSUnitValue deg(double value);
[NewObject] CSSUnitValue grad(double value);
[NewObject] CSSUnitValue rad(double value);
[NewObject] CSSUnitValue turn(double value);
// <time>
[NewObject] static CSSUnitValue s(double value);
[NewObject] static CSSUnitValue ms(double value);
[NewObject] CSSUnitValue s(double value);
[NewObject] CSSUnitValue ms(double value);
// <frequency>
[NewObject] static CSSUnitValue Hz(double value);
[NewObject] static CSSUnitValue kHz(double value);
[NewObject] CSSUnitValue Hz(double value);
[NewObject] CSSUnitValue kHz(double value);
// <resolution>
[NewObject] static CSSUnitValue dpi(double value);
[NewObject] static CSSUnitValue dpcm(double value);
[NewObject] static CSSUnitValue dppx(double value);
[NewObject] CSSUnitValue dpi(double value);
[NewObject] CSSUnitValue dpcm(double value);
[NewObject] CSSUnitValue dppx(double value);
// <flex>
[NewObject] static CSSUnitValue fr(double value);
[NewObject] CSSUnitValue fr(double value);
};
......@@ -5,7 +5,7 @@
// https://drafts.css-houdini.org/css-properties-values-api/#registering-custom-properties
[
ImplementedAs=PropertyRegistration
] partial interface CSS {
] partial namespace CSS {
[MeasureAs=CSSRegisterProperty, CallWith=ExecutionContext, RaisesException]
static void registerProperty(PropertyDefinition definition);
void registerProperty(PropertyDefinition definition);
};
......@@ -9,6 +9,6 @@
RuntimeEnabled=CSSLayoutAPI,
MeasureAs=LayoutWorklet,
SecureContext
] partial interface CSS {
[CallWith=ScriptState] static readonly attribute Worklet layoutWorklet;
] partial namespace CSS {
[CallWith=ScriptState] readonly attribute Worklet layoutWorklet;
};
......@@ -6,6 +6,6 @@
ImplementedAs=CSSAnimationWorklet,
RuntimeEnabled=AnimationWorklet,
SecureContext
] partial interface CSS {
[CallWith=ScriptState] static readonly attribute Worklet animationWorklet;
};
\ No newline at end of file
] partial namespace CSS {
[CallWith=ScriptState] readonly attribute Worklet animationWorklet;
};
......@@ -7,6 +7,6 @@
[
ImplementedAs=CSSPaintWorklet,
SecureContext
] partial interface CSS {
[CallWith=ScriptState,MeasureAs=PaintWorklet] static readonly attribute Worklet paintWorklet;
] partial namespace CSS {
[CallWith=ScriptState,MeasureAs=PaintWorklet] readonly attribute Worklet paintWorklet;
};
This is a testharness.js-based test.
FAIL @@toStringTag exists on the namespace object with the appropriate descriptor assert_own_property: expected property symbol "Symbol(Symbol.toStringTag)" missing
FAIL Object.prototype.toString applied to the namespace object assert_equals: expected "[object CSS]" but got "function CSS() { [native code] }"
FAIL Object.prototype.toString applied after modifying the namespace object's @@toStringTag assert_own_property: Precondition: @@toStringTag on the namespace object expected property symbol "Symbol(Symbol.toStringTag)" missing
FAIL Object.prototype.toString applied after deleting @@toStringTag assert_own_property: Precondition: @@toStringTag on the namespace object expected property symbol "Symbol(Symbol.toStringTag)" missing
Harness: the test ran to completion.
This is a testharness.js-based test.
Found 435 tests; 378 PASS, 57 FAIL, 0 TIMEOUT, 0 NOTRUN.
Found 435 tests; 380 PASS, 55 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS idl_test setup
PASS idl_test validation
PASS Partial interface CSSStyleSheet: original interface defined
......@@ -417,8 +417,8 @@ PASS CSSStyleDeclaration interface: getComputedStyle(svg_element) must inherit p
PASS CSS namespace: extended attributes
PASS CSS namespace: property descriptor
PASS CSS namespace: [[Extensible]] is true
FAIL CSS namespace: [[Prototype]] is Object.prototype assert_equals: expected (object) object "[object Object]" but got (function) function "function () { [native code] }"
FAIL CSS namespace: typeof is "object" assert_equals: expected "object" but got "function"
PASS CSS namespace: [[Prototype]] is Object.prototype
PASS CSS namespace: typeof is "object"
PASS CSS namespace: operation escape(CSSOMString)
PASS SVGElement interface: attribute style
PASS SVGElement interface: svg_element must inherit property "style" with the proper type
......
This is a testharness.js-based test.
FAIL getComputedStyle() round-trips in presence of scrollbars assert_equals: width round-trips expected "85px" but got "70px"
Harness: the test ran to completion.
......@@ -378,42 +378,6 @@ interface ByteLengthQueuingStrategy
interface CDATASection : Text
attribute @@toStringTag
method constructor
interface CSS
static getter paintWorklet
static method Hz
static method Q
static method ch
static method cm
static method deg
static method dpcm
static method dpi
static method dppx
static method em
static method escape
static method ex
static method fr
static method grad
static method in
static method kHz
static method mm
static method ms
static method number
static method pc
static method percent
static method pt
static method px
static method rad
static method registerProperty
static method rem
static method s
static method supports
static method turn
static method vh
static method vmax
static method vmin
static method vw
attribute @@toStringTag
method constructor
interface CSSAnimation : Animation
attribute @@toStringTag
getter animationName
......@@ -9559,6 +9523,41 @@ interface webkitURL
setter search
setter username
[NAMESPACES]
namespace CSS
attribute @@toStringTag
getter paintWorklet
method Hz
method Q
method ch
method cm
method deg
method dpcm
method dpi
method dppx
method em
method escape
method ex
method fr
method grad
method in
method kHz
method mm
method ms
method number
method pc
method percent
method pt
method px
method rad
method registerProperty
method rem
method s
method supports
method turn
method vh
method vmax
method vmin
method vw
[GLOBAL OBJECT]
attribute GCController
attribute accessibilityController
......
......@@ -597,44 +597,6 @@ interface ByteLengthQueuingStrategy
interface CDATASection : Text
attribute @@toStringTag
method constructor
interface CSS
static getter animationWorklet
static getter layoutWorklet
static getter paintWorklet
static method Hz
static method Q
static method ch
static method cm
static method deg
static method dpcm
static method dpi
static method dppx
static method em
static method escape
static method ex
static method fr
static method grad
static method in
static method kHz
static method mm
static method ms
static method number
static method pc
static method percent
static method pt
static method px
static method rad
static method registerProperty
static method rem
static method s
static method supports
static method turn
static method vh
static method vmax
static method vmin
static method vw
attribute @@toStringTag
method constructor
interface CSSAnimation : Animation
attribute @@toStringTag
getter animationName
......@@ -11766,6 +11728,43 @@ interface webkitURL
setter search
setter username
[NAMESPACES]
namespace CSS
attribute @@toStringTag
getter animationWorklet
getter layoutWorklet
getter paintWorklet
method Hz
method Q
method ch
method cm
method deg
method dpcm
method dpi
method dppx
method em
method escape
method ex
method fr
method grad
method in
method kHz
method mm
method ms
method number
method pc
method percent
method pt
method px
method rad
method registerProperty
method rem
method s
method supports
method turn
method vh
method vmax
method vmin
method vw
[GLOBAL OBJECT]
attribute GCController
attribute accessibilityController
......
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