Bug 26311 - DOM2 getComputedStyle support
Summary: DOM2 getComputedStyle support
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: unspecified
Platform: Debian testing Other
: NOR wishlist
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-05-28 19:18 UTC by Ilya Konstantinov
Modified: 2004-02-15 19:49 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ilya Konstantinov 2001-05-28 19:12:47 UTC
(*** 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)
Comment 1 David Faure 2001-11-29 19:40:09 UTC
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
Comment 2 David Faure 2002-10-31 19:21:43 UTC
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. 
Comment 3 David Faure 2002-11-02 14:39:19 UTC
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 :) 
Comment 4 Nicolas Goutte 2003-03-01 21:40:39 UTC
This feature is important for KWord's HTML import filter. Otherwise CSS cannot be 
supported. 
 
Have a nice day/evening/night! 
Comment 5 Andy Goossens 2004-01-11 21:16:30 UTC
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
Comment 6 Zack Rusin 2004-02-15 19:49:47 UTC
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