diff --git a/webf/lib/src/css/computed_style_declaration.dart b/webf/lib/src/css/computed_style_declaration.dart index e15e60ef1c..821683bd21 100644 --- a/webf/lib/src/css/computed_style_declaration.dart +++ b/webf/lib/src/css/computed_style_declaration.dart @@ -564,6 +564,11 @@ class ComputedCSSStyleDeclaration extends CSSStyleDeclaration { final afterValue = afterSlashSeparator.map((e) => _valueForPropertyInStyle(e)).join(' '); return backgroundColor + ' ' + beforeValue + ' / ' + afterValue; } + + @override + String toString() { + return 'ComputedCSSStyleDeclaration($_element)'; + } } List? _compressSlidesValue(List values) { diff --git a/webf/lib/src/css/render_style.dart b/webf/lib/src/css/render_style.dart index 2014185058..474ed4d6c5 100644 --- a/webf/lib/src/css/render_style.dart +++ b/webf/lib/src/css/render_style.dart @@ -441,6 +441,10 @@ class CSSRenderStyle extends RenderStyle dynamic resolveValue(String propertyName, String propertyValue, { String? baseHref }) { RenderStyle renderStyle = this; + if (propertyValue == INITIAL) { + propertyValue = CSSInitialValues[propertyName] ?? propertyValue; + } + // Process CSSVariable. dynamic value = CSSVariable.tryParse(renderStyle, propertyValue); if (value != null) { diff --git a/webf/lib/src/css/style_declaration.dart b/webf/lib/src/css/style_declaration.dart index 172d567ccf..6bb30a08fd 100644 --- a/webf/lib/src/css/style_declaration.dart +++ b/webf/lib/src/css/style_declaration.dart @@ -322,6 +322,8 @@ class CSSStyleDeclaration extends BindingObject { // Eg. var(--x), calc(1 + 1) if (CSSFunction.isFunction(normalizedValue)) return true; + if (CSSLength.isInitial(normalizedValue)) return true; + // Validate value. switch (propertyName) { case WIDTH: diff --git a/webf/lib/src/css/values/length.dart b/webf/lib/src/css/values/length.dart index 63323a1369..3cae420507 100644 --- a/webf/lib/src/css/values/length.dart +++ b/webf/lib/src/css/values/length.dart @@ -522,6 +522,10 @@ class CSSLength { return value == AUTO; } + static bool isInitial(String? value) { + return value == INITIAL; + } + static bool isLength(String? value) { return value != null && (value == ZERO || _lengthRegExp.hasMatch(value)); } diff --git a/webf/lib/src/css/values/variable.dart b/webf/lib/src/css/values/variable.dart index 1bc0e800b3..4679d76605 100644 --- a/webf/lib/src/css/values/variable.dart +++ b/webf/lib/src/css/values/variable.dart @@ -47,7 +47,11 @@ class CSSVariable { // Get the lazy calculated CSS resolved value. dynamic computedValue(String propertyName) { - dynamic value = _renderStyle.getCSSVariable(identifier, propertyName) ?? defaultValue; + dynamic value = _renderStyle.getCSSVariable(identifier, propertyName); + if (value == null || value == INITIAL) { + value = defaultValue; + } + if (value == null) { return null; } diff --git a/webf/lib/src/devtools/modules/dom.dart b/webf/lib/src/devtools/modules/dom.dart index 8698775c9f..48b695fc25 100644 --- a/webf/lib/src/devtools/modules/dom.dart +++ b/webf/lib/src/devtools/modules/dom.dart @@ -262,7 +262,9 @@ class InspectorNode extends JSONEncodable { 'childNodeCount': childNodeCount, 'attributes': attributes, if (childNodeCount > 0) - 'children': referencedNode.childNodes.map((Node node) => InspectorNode(node).toJson()).toList(), + 'children': referencedNode.childNodes.where((node) { + return node is Element || (node is TextNode && node.data.isNotEmpty); + }).map((Node node) => InspectorNode(node).toJson()).toList(), }; } }