about summary refs log tree commit diff stats
path: root/src/css
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-01-01 03:47:36 +0100
committerbptato <nincsnevem662@gmail.com>2023-01-01 03:47:36 +0100
commit2f8ab98958d17677298e285cffd2c72d5c42eaf7 (patch)
tree3325080f9f5039f159221388212618e72b937ec4 /src/css
parent004966d06322c942fd641bef2579c67e40737435 (diff)
downloadchawan-2f8ab98958d17677298e285cffd2c72d5c42eaf7.tar.gz
css/values: apply presentational hints after UA style
So that e.g. table valign overrides the user-agent vertical-align
value, but still respects user/author style.
Diffstat (limited to 'src/css')
-rw-r--r--src/css/values.nim9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/css/values.nim b/src/css/values.nim
index 249db7db..58e00d74 100644
--- a/src/css/values.nim
+++ b/src/css/values.nim
@@ -1258,6 +1258,11 @@ func buildComputedValues*(builder: CSSComputedValuesBuilder): CSSComputedValues
     for build in builder.normalProperties[origin]:
       result.applyValue(build.val, build.global, builder.parent, nil)
     previousOrigins[origin] = result.copyProperties()
+  # Presentational hints override user agent style, but respect user/author style.
+  if builder.preshints != nil:
+    for prop in CSSPropertyType:
+      if builder.preshints[prop] != nil:
+        result[prop] = builder.preshints[prop]
   block:
     let origin = ORIGIN_USER
     let prevOrigin = ORIGIN_USER_AGENT
@@ -1288,10 +1293,6 @@ func buildComputedValues*(builder: CSSComputedValuesBuilder): CSSComputedValues
       result.applyValue(build.val, build.global, builder.parent, nil)
     # important, so no need to save origins
   # set defaults
-  if builder.preshints != nil:
-    for prop in CSSPropertyType:
-      if result[prop] == nil:
-        result[prop] = builder.preshints[prop]
   for prop in CSSPropertyType:
     if result[prop] == nil:
       if inherited(prop) and builder.parent != nil and builder.parent[prop] != nil: