(*** This bug was imported into bugs.kde.org ***) Package: kjs Version: KDE 2.1.1 Severity: wishlist Installed from: Debian Packages Compiler: Not Specified OS: Not Specified OS/Compiler notes: Not Specified I wish Konqueror would implement W3 DOM2's getComputedStyle call which can be performed on document views e.g.: element = document.getElementById('test'); style = document.defaultView.getComputedStyle(test ""); This call allows the develop to know the actual dimensions of elements after being rendered (e.g. actual height and position instead of relative ones). For example: style.getPropertyValue("height") would return me test's actual height. (Submitted via bugs.kde.org)
Just implemented those JS bindings (defaultView and getComputedStyle with all of DOM2). However AbstractViewImpl::getComputedStyle is still a stub. Reassigning to khtml. -- David FAURE david@mandrakesoft.com faure@kde.org http://perso.mandrakesoft.com/~david/ http://www.konqueror.org/ KDE 3.0: Konquering the Desktops
Full testcase: <script> function doit() { var element = document.getElementById('test'); var style = document.defaultView.getComputedStyle(element, ""); alert(style.getPropertyValue("height")); } </script> <body onload="doit()"> <div id='test' height=450>Hello world</div> </body> Gives "17px" in Mozilla. Ouch, the first issue is the defaultView method not found. I'll debug that one right now.
Ok, defaultView thing fixed. We're back to "getComputedStyle not implemented". Just one thing I wanted to mention: you can use element.offsetHeight to get the real height of the element in the render-tree, that works ok. With offsetTop, offsetLeft, offsetHeight and offsetWidth, you can get all info on position and size of the element. Of course getComputedStyle covers much more :)
This feature is important for KWord's HTML import filter. Otherwise CSS cannot be supported. Have a nice day/evening/night!
Another testcase from the Mozilla site: http://www.mozilla.org/docs/dom/domref/examples7.html This bug may be one of the causes of the broken menu in http://bugs.kde.org/show_bug.cgi?id=54598
CVS commit by zrusin: Implementing DOM2 getComputedStyle support. CCMAIL: 26311-done@bugs.kde.org M +10 -0 ChangeLog 1.206 M +4 -2 css/Makefile.am 1.20 M +2 -3 css/css_valueimpl.cpp 1.94 M +10 -10 css/css_valueimpl.h 1.55 M +21 -21 css/parser.cpp 1.42 M +0 -1 rendering/render_object.cpp 1.251 M +14 -2 xml/dom2_viewsimpl.cpp 1.7 M +1 -2 xml/dom_elementimpl.cpp 1.196