diff options
| author | bptato <nincsnevem662@gmail.com> | 2025-01-03 22:55:59 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2025-01-03 23:46:13 +0100 |
| commit | e548f28c298abf5122d3f3af117b39f08e916d88 (patch) | |
| tree | 989135c2b826349dab0b5a510ecad2fef8c2ed55 /src/html | |
| parent | 8fb8f3547e122359d0315884c1ff46476f6e4ef3 (diff) | |
| download | chawan-e548f28c298abf5122d3f3af117b39f08e916d88.tar.gz | |
env, buffer: restyle on getComputedStyle
style/layout invalidation is a mess :(
Fixes acid3 test00
Diffstat (limited to 'src/html')
| -rw-r--r-- | src/html/dom.nim | 4 | ||||
| -rw-r--r-- | src/html/env.nim | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim index 105e1937..22e66480 100644 --- a/src/html/dom.nim +++ b/src/html/dom.nim @@ -111,6 +111,7 @@ type imageTypes*: Table[string, string] userAgent*: string autofocus*: bool + maybeRestyle*: proc() # Navigator stuff Navigator* = object @@ -2735,6 +2736,7 @@ proc setFocus*(document: Document; element: Element) = if document.focus != nil: document.focus.invalidDeps.incl(dtFocus) document.internalFocus = element + document.invalid = true if element != nil: element.invalidDeps.incl(dtFocus) @@ -2762,6 +2764,8 @@ func hover*(element: Element): bool = proc setHover*(element: Element; hover: bool) = element.invalidDeps.incl(dtHover) element.internalHover = hover + if element.document != nil: + element.document.invalid = true func findAutoFocus*(document: Document): Element = for child in document.elements: diff --git a/src/html/env.nim b/src/html/env.nim index 91e82f30..65126d07 100644 --- a/src/html/env.nim +++ b/src/html/env.nim @@ -285,6 +285,7 @@ callback(new Event("").timeStamp); proc getComputedStyle(window: Window; element: Element; pseudoElt = none(string)): CSSStyleDeclaration {.jsfunc.} = if window.settings.scripting == smApp: + window.maybeRestyle() return element.getComputedStyle() # Maybe it works. return element.style |