CSSStyleDeclaration.cpp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. /*
  2. * Copyright (c) 2018-2024, Andreas Kling <andreas@ladybird.org>
  3. * Copyright (c) 2023-2024, Sam Atkins <sam@ladybird.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #include <LibWeb/Bindings/CSSStyleDeclarationPrototype.h>
  8. #include <LibWeb/Bindings/ExceptionOrUtils.h>
  9. #include <LibWeb/Bindings/Intrinsics.h>
  10. #include <LibWeb/CSS/CSSStyleDeclaration.h>
  11. #include <LibWeb/CSS/Parser/Parser.h>
  12. #include <LibWeb/CSS/StyleComputer.h>
  13. #include <LibWeb/CSS/StyleValues/ImageStyleValue.h>
  14. #include <LibWeb/CSS/StyleValues/ShorthandStyleValue.h>
  15. #include <LibWeb/DOM/Document.h>
  16. #include <LibWeb/DOM/Element.h>
  17. #include <LibWeb/Infra/Strings.h>
  18. namespace Web::CSS {
  19. GC_DEFINE_ALLOCATOR(CSSStyleDeclaration);
  20. GC_DEFINE_ALLOCATOR(PropertyOwningCSSStyleDeclaration);
  21. GC_DEFINE_ALLOCATOR(ElementInlineCSSStyleDeclaration);
  22. CSSStyleDeclaration::CSSStyleDeclaration(JS::Realm& realm)
  23. : PlatformObject(realm)
  24. {
  25. m_legacy_platform_object_flags = LegacyPlatformObjectFlags {
  26. .supports_indexed_properties = true,
  27. };
  28. }
  29. void CSSStyleDeclaration::initialize(JS::Realm& realm)
  30. {
  31. Base::initialize(realm);
  32. WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSStyleDeclaration);
  33. }
  34. GC::Ptr<CSSRule> CSSStyleDeclaration::parent_rule() const
  35. {
  36. return nullptr;
  37. }
  38. GC::Ref<PropertyOwningCSSStyleDeclaration> PropertyOwningCSSStyleDeclaration::create(JS::Realm& realm, Vector<StyleProperty> properties, HashMap<FlyString, StyleProperty> custom_properties)
  39. {
  40. return realm.create<PropertyOwningCSSStyleDeclaration>(realm, move(properties), move(custom_properties));
  41. }
  42. PropertyOwningCSSStyleDeclaration::PropertyOwningCSSStyleDeclaration(JS::Realm& realm, Vector<StyleProperty> properties, HashMap<FlyString, StyleProperty> custom_properties)
  43. : CSSStyleDeclaration(realm)
  44. , m_properties(move(properties))
  45. , m_custom_properties(move(custom_properties))
  46. {
  47. }
  48. void PropertyOwningCSSStyleDeclaration::visit_edges(Cell::Visitor& visitor)
  49. {
  50. Base::visit_edges(visitor);
  51. visitor.visit(m_parent_rule);
  52. for (auto& property : m_properties) {
  53. if (property.value->is_image())
  54. property.value->as_image().visit_edges(visitor);
  55. }
  56. }
  57. String PropertyOwningCSSStyleDeclaration::item(size_t index) const
  58. {
  59. if (index >= m_properties.size())
  60. return {};
  61. return CSS::string_from_property_id(m_properties[index].property_id).to_string();
  62. }
  63. GC::Ref<ElementInlineCSSStyleDeclaration> ElementInlineCSSStyleDeclaration::create(DOM::Element& element, Vector<StyleProperty> properties, HashMap<FlyString, StyleProperty> custom_properties)
  64. {
  65. auto& realm = element.realm();
  66. return realm.create<ElementInlineCSSStyleDeclaration>(element, move(properties), move(custom_properties));
  67. }
  68. ElementInlineCSSStyleDeclaration::ElementInlineCSSStyleDeclaration(DOM::Element& element, Vector<StyleProperty> properties, HashMap<FlyString, StyleProperty> custom_properties)
  69. : PropertyOwningCSSStyleDeclaration(element.realm(), move(properties), move(custom_properties))
  70. , m_element(element.make_weak_ptr<DOM::Element>())
  71. {
  72. }
  73. void ElementInlineCSSStyleDeclaration::visit_edges(Cell::Visitor& visitor)
  74. {
  75. Base::visit_edges(visitor);
  76. visitor.visit(m_element);
  77. }
  78. size_t PropertyOwningCSSStyleDeclaration::length() const
  79. {
  80. return m_properties.size();
  81. }
  82. Optional<StyleProperty> PropertyOwningCSSStyleDeclaration::property(PropertyID property_id) const
  83. {
  84. for (auto& property : m_properties) {
  85. if (property.property_id == property_id)
  86. return property;
  87. }
  88. return {};
  89. }
  90. // https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-setproperty
  91. WebIDL::ExceptionOr<void> PropertyOwningCSSStyleDeclaration::set_property(StringView property_name, StringView value, StringView priority)
  92. {
  93. auto maybe_property_id = property_id_from_string(property_name);
  94. if (!maybe_property_id.has_value())
  95. return {};
  96. auto property_id = maybe_property_id.value();
  97. // 1. If the computed flag is set, then throw a NoModificationAllowedError exception.
  98. // NOTE: This is handled by the virtual override in ResolvedCSSStyleDeclaration.
  99. // FIXME: 2. If property is not a custom property, follow these substeps:
  100. // FIXME: 1. Let property be property converted to ASCII lowercase.
  101. // FIXME: 2. If property is not a case-sensitive match for a supported CSS property, then return.
  102. // NOTE: This must be handled before we've turned the property string into a PropertyID.
  103. // 3. If value is the empty string, invoke removeProperty() with property as argument and return.
  104. if (value.is_empty()) {
  105. MUST(remove_property(property_name));
  106. return {};
  107. }
  108. // 4. If priority is not the empty string and is not an ASCII case-insensitive match for the string "important", then return.
  109. if (!priority.is_empty() && !Infra::is_ascii_case_insensitive_match(priority, "important"sv))
  110. return {};
  111. // 5. Let component value list be the result of parsing value for property property.
  112. auto component_value_list = is<ElementInlineCSSStyleDeclaration>(this)
  113. ? parse_css_value(CSS::Parser::ParsingContext { static_cast<ElementInlineCSSStyleDeclaration&>(*this).element()->document() }, value, property_id)
  114. : parse_css_value(CSS::Parser::ParsingContext { realm() }, value, property_id);
  115. // 6. If component value list is null, then return.
  116. if (!component_value_list)
  117. return {};
  118. // 7. Let updated be false.
  119. bool updated = false;
  120. // 8. If property is a shorthand property,
  121. if (property_is_shorthand(property_id)) {
  122. // then for each longhand property longhand that property maps to, in canonical order, follow these substeps:
  123. StyleComputer::for_each_property_expanding_shorthands(property_id, *component_value_list, StyleComputer::AllowUnresolved::Yes, [this, &updated, priority](PropertyID longhand_property_id, CSSStyleValue const& longhand_value) {
  124. // 1. Let longhand result be the result of set the CSS declaration longhand with the appropriate value(s) from component value list,
  125. // with the important flag set if priority is not the empty string, and unset otherwise, and with the list of declarations being the declarations.
  126. // 2. If longhand result is true, let updated be true.
  127. updated |= set_a_css_declaration(longhand_property_id, longhand_value, !priority.is_empty() ? Important::Yes : Important::No);
  128. });
  129. }
  130. // 9. Otherwise,
  131. else {
  132. if (property_id == PropertyID::Custom) {
  133. auto custom_name = FlyString::from_utf8_without_validation(property_name.bytes());
  134. StyleProperty style_property {
  135. .important = !priority.is_empty() ? Important::Yes : Important::No,
  136. .property_id = property_id,
  137. .value = component_value_list.release_nonnull(),
  138. .custom_name = custom_name,
  139. };
  140. m_custom_properties.set(custom_name, style_property);
  141. updated = true;
  142. } else {
  143. // let updated be the result of set the CSS declaration property with value component value list,
  144. // with the important flag set if priority is not the empty string, and unset otherwise,
  145. // and with the list of declarations being the declarations.
  146. updated = set_a_css_declaration(property_id, *component_value_list, !priority.is_empty() ? Important::Yes : Important::No);
  147. }
  148. }
  149. // 10. If updated is true, update style attribute for the CSS declaration block.
  150. if (updated)
  151. update_style_attribute();
  152. return {};
  153. }
  154. // https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-removeproperty
  155. WebIDL::ExceptionOr<String> PropertyOwningCSSStyleDeclaration::remove_property(StringView property_name)
  156. {
  157. auto property_id = property_id_from_string(property_name);
  158. if (!property_id.has_value())
  159. return String {};
  160. // 1. If the computed flag is set, then throw a NoModificationAllowedError exception.
  161. // NOTE: This is handled by the virtual override in ResolvedCSSStyleDeclaration.
  162. // 2. If property is not a custom property, let property be property converted to ASCII lowercase.
  163. // NOTE: We've already converted it to a PropertyID enum value.
  164. // 3. Let value be the return value of invoking getPropertyValue() with property as argument.
  165. auto value = get_property_value(property_name);
  166. // 4. Let removed be false.
  167. bool removed = false;
  168. // FIXME: 5. If property is a shorthand property, for each longhand property longhand that property maps to:
  169. // 1. If longhand is not a property name of a CSS declaration in the declarations, continue.
  170. // 2. Remove that CSS declaration and let removed be true.
  171. // 6. Otherwise, if property is a case-sensitive match for a property name of a CSS declaration in the declarations, remove that CSS declaration and let removed be true.
  172. if (property_id == PropertyID::Custom) {
  173. auto custom_name = FlyString::from_utf8_without_validation(property_name.bytes());
  174. removed = m_custom_properties.remove(custom_name);
  175. } else {
  176. removed = m_properties.remove_first_matching([&](auto& entry) { return entry.property_id == property_id; });
  177. }
  178. // 7. If removed is true, Update style attribute for the CSS declaration block.
  179. if (removed)
  180. update_style_attribute();
  181. // 8. Return value.
  182. return value;
  183. }
  184. // https://drafts.csswg.org/cssom/#update-style-attribute-for
  185. void ElementInlineCSSStyleDeclaration::update_style_attribute()
  186. {
  187. // 1. Assert: declaration block’s computed flag is unset.
  188. // NOTE: Unnecessary, only relevant for ResolvedCSSStyleDeclaration.
  189. // 2. Let owner node be declaration block’s owner node.
  190. // 3. If owner node is null, then return.
  191. if (!m_element)
  192. return;
  193. // 4. Set declaration block’s updating flag.
  194. m_updating = true;
  195. // 5. Set an attribute value for owner node using "style" and the result of serializing declaration block.
  196. MUST(m_element->set_attribute(HTML::AttributeNames::style, serialized()));
  197. // 6. Unset declaration block’s updating flag.
  198. m_updating = false;
  199. }
  200. // https://drafts.csswg.org/cssom/#set-a-css-declaration
  201. bool PropertyOwningCSSStyleDeclaration::set_a_css_declaration(PropertyID property_id, NonnullRefPtr<CSSStyleValue const> value, Important important)
  202. {
  203. // FIXME: Handle logical property groups.
  204. for (auto& property : m_properties) {
  205. if (property.property_id == property_id) {
  206. if (property.important == important && *property.value == *value)
  207. return false;
  208. property.value = move(value);
  209. property.important = important;
  210. return true;
  211. }
  212. }
  213. m_properties.append(CSS::StyleProperty {
  214. .important = important,
  215. .property_id = property_id,
  216. .value = move(value),
  217. });
  218. return true;
  219. }
  220. // https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertyvalue
  221. String CSSStyleDeclaration::get_property_value(StringView property_name) const
  222. {
  223. auto property_id = property_id_from_string(property_name);
  224. if (!property_id.has_value())
  225. return {};
  226. if (property_id.value() == PropertyID::Custom) {
  227. auto maybe_custom_property = custom_property(FlyString::from_utf8_without_validation(property_name.bytes()));
  228. if (maybe_custom_property.has_value()) {
  229. return maybe_custom_property.value().value->to_string();
  230. }
  231. return {};
  232. }
  233. // 2. If property is a shorthand property, then follow these substeps:
  234. if (property_is_shorthand(property_id.value())) {
  235. // 1. Let list be a new empty array.
  236. Vector<ValueComparingNonnullRefPtr<CSSStyleValue const>> list;
  237. Optional<Important> last_important_flag;
  238. // 2. For each longhand property longhand that property maps to, in canonical order, follow these substeps:
  239. Vector<PropertyID> longhand_ids = longhands_for_shorthand(property_id.value());
  240. for (auto longhand_property_id : longhand_ids) {
  241. // 1. If longhand is a case-sensitive match for a property name of a CSS declaration in the declarations, let declaration be that CSS declaration, or null otherwise.
  242. auto declaration = property(longhand_property_id);
  243. // 2. If declaration is null, then return the empty string.
  244. if (!declaration.has_value())
  245. return {};
  246. // 3. Append the declaration to list.
  247. list.append(declaration->value);
  248. if (last_important_flag.has_value() && declaration->important != *last_important_flag)
  249. return {};
  250. last_important_flag = declaration->important;
  251. }
  252. // 3. If important flags of all declarations in list are same, then return the serialization of list.
  253. // NOTE: Currently we implement property-specific shorthand serialization in ShorthandStyleValue::to_string().
  254. return ShorthandStyleValue::create(property_id.value(), longhand_ids, list)->to_string();
  255. // 4. Return the empty string.
  256. // NOTE: This is handled by the loop.
  257. }
  258. auto maybe_property = property(property_id.value());
  259. if (!maybe_property.has_value())
  260. return {};
  261. return maybe_property->value->to_string();
  262. }
  263. // https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertypriority
  264. StringView CSSStyleDeclaration::get_property_priority(StringView property_name) const
  265. {
  266. auto property_id = property_id_from_string(property_name);
  267. if (!property_id.has_value())
  268. return {};
  269. if (property_id.value() == PropertyID::Custom) {
  270. auto maybe_custom_property = custom_property(FlyString::from_utf8_without_validation(property_name.bytes()));
  271. if (!maybe_custom_property.has_value())
  272. return {};
  273. return maybe_custom_property.value().important == Important::Yes ? "important"sv : ""sv;
  274. }
  275. auto maybe_property = property(property_id.value());
  276. if (!maybe_property.has_value())
  277. return {};
  278. return maybe_property->important == Important::Yes ? "important"sv : ""sv;
  279. }
  280. WebIDL::ExceptionOr<void> CSSStyleDeclaration::set_property(PropertyID property_id, StringView css_text, StringView priority)
  281. {
  282. return set_property(string_from_property_id(property_id), css_text, priority);
  283. }
  284. WebIDL::ExceptionOr<String> CSSStyleDeclaration::remove_property(PropertyID property_name)
  285. {
  286. return remove_property(string_from_property_id(property_name));
  287. }
  288. // https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-csstext
  289. String CSSStyleDeclaration::css_text() const
  290. {
  291. // 1. If the computed flag is set, then return the empty string.
  292. // NOTE: See ResolvedCSSStyleDeclaration::serialized()
  293. // 2. Return the result of serializing the declarations.
  294. return serialized();
  295. }
  296. // https://drafts.csswg.org/cssom/#dom-cssstyleproperties-cssfloat
  297. String CSSStyleDeclaration::css_float() const
  298. {
  299. // The cssFloat attribute, on getting, must return the result of invoking getPropertyValue() with float as argument.
  300. return get_property_value("float"sv);
  301. }
  302. WebIDL::ExceptionOr<void> CSSStyleDeclaration::set_css_float(StringView value)
  303. {
  304. // On setting, the attribute must invoke setProperty() with float as first argument, as second argument the given value,
  305. // and no third argument. Any exceptions thrown must be re-thrown.
  306. return set_property("float"sv, value, ""sv);
  307. }
  308. Optional<JS::Value> CSSStyleDeclaration::item_value(size_t index) const
  309. {
  310. auto value = item(index);
  311. if (value.is_empty())
  312. return {};
  313. return JS::PrimitiveString::create(vm(), value);
  314. }
  315. // https://www.w3.org/TR/cssom/#serialize-a-css-declaration
  316. static String serialize_a_css_declaration(CSS::PropertyID property, StringView value, Important important)
  317. {
  318. StringBuilder builder;
  319. // 1. Let s be the empty string.
  320. // 2. Append property to s.
  321. builder.append(string_from_property_id(property));
  322. // 3. Append ": " (U+003A U+0020) to s.
  323. builder.append(": "sv);
  324. // 4. Append value to s.
  325. builder.append(value);
  326. // 5. If the important flag is set, append " !important" (U+0020 U+0021 U+0069 U+006D U+0070 U+006F U+0072 U+0074 U+0061 U+006E U+0074) to s.
  327. if (important == Important::Yes)
  328. builder.append(" !important"sv);
  329. // 6. Append ";" (U+003B) to s.
  330. builder.append(';');
  331. // 7. Return s.
  332. return MUST(builder.to_string());
  333. }
  334. // https://www.w3.org/TR/cssom/#serialize-a-css-declaration-block
  335. String PropertyOwningCSSStyleDeclaration::serialized() const
  336. {
  337. // 1. Let list be an empty array.
  338. Vector<String> list;
  339. // 2. Let already serialized be an empty array.
  340. HashTable<PropertyID> already_serialized;
  341. // NOTE: The spec treats custom properties the same as any other property, and expects the above loop to handle them.
  342. // However, our implementation separates them from regular properties, so we need to handle them separately here.
  343. // FIXME: Is the relative order of custom properties and regular properties supposed to be preserved?
  344. for (auto& declaration : m_custom_properties) {
  345. // 1. Let property be declaration’s property name.
  346. auto const& property = declaration.key;
  347. // 2. If property is in already serialized, continue with the steps labeled declaration loop.
  348. // NOTE: It is never in already serialized, as there are no shorthands for custom properties.
  349. // 3. If property maps to one or more shorthand properties, let shorthands be an array of those shorthand properties, in preferred order.
  350. // NOTE: There are no shorthands for custom properties.
  351. // 4. Shorthand loop: For each shorthand in shorthands, follow these substeps: ...
  352. // NOTE: There are no shorthands for custom properties.
  353. // 5. Let value be the result of invoking serialize a CSS value of declaration.
  354. auto value = declaration.value.value->to_string();
  355. // 6. Let serialized declaration be the result of invoking serialize a CSS declaration with property name property, value value,
  356. // and the important flag set if declaration has its important flag set.
  357. // NOTE: We have to inline this here as the actual implementation does not accept custom properties.
  358. String serialized_declaration = [&] {
  359. // https://www.w3.org/TR/cssom/#serialize-a-css-declaration
  360. StringBuilder builder;
  361. // 1. Let s be the empty string.
  362. // 2. Append property to s.
  363. builder.append(property);
  364. // 3. Append ": " (U+003A U+0020) to s.
  365. builder.append(": "sv);
  366. // 4. Append value to s.
  367. builder.append(value);
  368. // 5. If the important flag is set, append " !important" (U+0020 U+0021 U+0069 U+006D U+0070 U+006F U+0072 U+0074 U+0061 U+006E U+0074) to s.
  369. if (declaration.value.important == Important::Yes)
  370. builder.append(" !important"sv);
  371. // 6. Append ";" (U+003B) to s.
  372. builder.append(';');
  373. // 7. Return s.
  374. return MUST(builder.to_string());
  375. }();
  376. // 7. Append serialized declaration to list.
  377. list.append(move(serialized_declaration));
  378. // 8. Append property to already serialized.
  379. // NOTE: We don't need to do this, as we don't have shorthands for custom properties.
  380. }
  381. // 3. Declaration loop: For each CSS declaration declaration in declaration block’s declarations, follow these substeps:
  382. for (auto& declaration : m_properties) {
  383. // 1. Let property be declaration’s property name.
  384. auto property = declaration.property_id;
  385. // 2. If property is in already serialized, continue with the steps labeled declaration loop.
  386. if (already_serialized.contains(property))
  387. continue;
  388. // FIXME: 3. If property maps to one or more shorthand properties, let shorthands be an array of those shorthand properties, in preferred order.
  389. // FIXME: 4. Shorthand loop: For each shorthand in shorthands, follow these substeps: ...
  390. // 5. Let value be the result of invoking serialize a CSS value of declaration.
  391. auto value = declaration.value->to_string();
  392. // 6. Let serialized declaration be the result of invoking serialize a CSS declaration with property name property, value value,
  393. // and the important flag set if declaration has its important flag set.
  394. auto serialized_declaration = serialize_a_css_declaration(property, move(value), declaration.important);
  395. // 7. Append serialized declaration to list.
  396. list.append(move(serialized_declaration));
  397. // 8. Append property to already serialized.
  398. already_serialized.set(property);
  399. }
  400. // 4. Return list joined with " " (U+0020).
  401. StringBuilder builder;
  402. builder.join(' ', list);
  403. return MUST(builder.to_string());
  404. }
  405. WebIDL::ExceptionOr<void> PropertyOwningCSSStyleDeclaration::set_css_text(StringView css_text)
  406. {
  407. dbgln("(STUBBED) PropertyOwningCSSStyleDeclaration::set_css_text(css_text='{}')", css_text);
  408. return {};
  409. }
  410. void PropertyOwningCSSStyleDeclaration::empty_the_declarations()
  411. {
  412. m_properties.clear();
  413. m_custom_properties.clear();
  414. }
  415. void PropertyOwningCSSStyleDeclaration::set_the_declarations(Vector<StyleProperty> properties, HashMap<FlyString, StyleProperty> custom_properties)
  416. {
  417. m_properties = move(properties);
  418. m_custom_properties = move(custom_properties);
  419. }
  420. void ElementInlineCSSStyleDeclaration::set_declarations_from_text(StringView css_text)
  421. {
  422. // FIXME: What do we do if the element is null?
  423. if (!m_element) {
  424. dbgln("FIXME: Returning from ElementInlineCSSStyleDeclaration::declarations_from_text as m_element is null.");
  425. return;
  426. }
  427. empty_the_declarations();
  428. auto style = parse_css_style_attribute(CSS::Parser::ParsingContext(m_element->document()), css_text, *m_element.ptr());
  429. set_the_declarations(style->properties(), style->custom_properties());
  430. }
  431. // https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-csstext
  432. WebIDL::ExceptionOr<void> ElementInlineCSSStyleDeclaration::set_css_text(StringView css_text)
  433. {
  434. // FIXME: What do we do if the element is null?
  435. if (!m_element) {
  436. dbgln("FIXME: Returning from ElementInlineCSSStyleDeclaration::set_css_text as m_element is null.");
  437. return {};
  438. }
  439. // 1. If the computed flag is set, then throw a NoModificationAllowedError exception.
  440. // NOTE: See ResolvedCSSStyleDeclaration.
  441. // 2. Empty the declarations.
  442. // 3. Parse the given value and, if the return value is not the empty list, insert the items in the list into the declarations, in specified order.
  443. set_declarations_from_text(css_text);
  444. // 4. Update style attribute for the CSS declaration block.
  445. update_style_attribute();
  446. return {};
  447. }
  448. GC::Ptr<CSSRule> PropertyOwningCSSStyleDeclaration::parent_rule() const
  449. {
  450. return m_parent_rule;
  451. }
  452. void PropertyOwningCSSStyleDeclaration::set_parent_rule(GC::Ref<CSSRule> rule)
  453. {
  454. m_parent_rule = rule;
  455. }
  456. }