Last Comment Bug 42417 - Supporting all CSS2 properties with getComputedStyle()
: Supporting all CSS2 properties with getComputedStyle()
Status: NEW
[Hixie-PF] [ngdriver/domcss]
: dom2, helpwanted, meta, testcase
Product: Core
Classification: Components
Component: DOM: CSS Object Model (show other bugs)
: Trunk
: All All
: -- normal with 24 votes (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
: 160619 (view as bug list)
Depends on: 47159 106154 63281 73525 77882 83119 84599 94080 94855 95062 97052 98052 101925 102678 109523 116032 116033 125716 125778 126319 173354 200497 200499 316981
Blocks: 117500
  Show dependency treegraph
 
Reported: 2000-06-13 17:01 PDT by Johnny Stenback (:jst, jst@mozilla.com)
Modified: 2014-05-20 06:04 PDT (History)
22 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
testcase (all CSS2 properties for a block level element) (26.71 KB, text/html)
2001-02-15 11:00 PST, Dylan Schiemann
no flags Details
testcase (all block level elements, replaced null with "" per notes in bug 63281) (26.71 KB, text/html)
2001-03-05 17:06 PST, Dylan Schiemann
no flags Details
testcase (correction: all block level elements, replaced null with "" per notes in bug 63281) (26.53 KB, text/html)
2001-03-05 17:32 PST, Dylan Schiemann
no flags Details

Description Johnny Stenback (:jst, jst@mozilla.com) 2000-06-13 17:01:34 PDT
getComputedStyle() is currently implemented in mozilla but so far only a very
small set of properties are computed and properly supported, this is a tracking
bug intended to track the implementation of the various CSS properties that can
be gequested from the computed style.

The currently implemented properties are:

  left, top, right, bottom, width, hieght and display.

The DOM Level 2 CSS spec defines about 125 different properties but most of them
should be trivial to implement, and some are not supposed to be supported, like
"margin", in stead "margin-left", "margin-top", ... should be used.

The DOM Level 2 CSS spec is at

  http://www.w3.org/TR/DOM-Level-2/css.html

And the CSS2 spec is at

  http://www.w3.org/TR/REC-CSS2/

If you have spcial interest in some spcific property or a spcific set of
properties please file them as separate bugs and mark that this bug depends on
the new bug you file.

(the bug for getting getComputedStyle() into mozilla was bug 32169, and this bug
was split out from bug 39892)
Comment 1 Dylan Schiemann 2001-01-12 10:26:33 PST
Adding that this bug depends on 63281
Comment 2 Dylan Schiemann 2001-02-14 14:58:45 PST
I'd really like to see this bug fixed to work with all css properties.  Is there
anything I can do that isn't C code to help with this one?  I could create a
testcase for all of the properties, and file a bug for each, but I don't want to
flood bugzilla with them.  Maybe a few large testcases/bugs for each category? 
Let me know.
Comment 3 Johnny Stenback (:jst, jst@mozilla.com) 2001-02-14 16:45:57 PST
Dylan, you could write testecases for this, that would be greatly appreciated, a
HTML page that usess all the CSS2 styles on some elements and some JS that
checks that getComputedStyle() returns the right thing and document.write()'s
out the result would be great! (please use Netscape 6.01 to do this since
mozilla builds crash if you try to use getComputedStyle(), the crash is well
known and will be fixed)

Harish is currently working on this so I'm handing this bug over to him.
Comment 4 Dylan Schiemann 2001-02-15 11:00:31 PST
Created attachment 25350 [details]
testcase (all CSS2 properties for a block level element)
Comment 5 Dylan Schiemann 2001-02-15 11:04:18 PST
I posted a testcase which shows the computedStyle for all CSS2 properties which
are applicable for a block level element. I will do the same for the other
display types as time permits.  All styles are default.  It may be more
appropriate to apply this type of testcase to a css test suite, with styles that
test proper cascading and inheritance
Comment 6 Hixie (not reading bugmail) 2001-02-22 22:55:49 PST
Taking QA Contact on all open or unverified DOM Style bugs...
Comment 7 Dylan Schiemann 2001-03-05 17:06:11 PST
Created attachment 26823 [details]
testcase (all block level elements, replaced null with "" per notes in bug 63281)
Comment 8 Dylan Schiemann 2001-03-05 17:32:03 PST
Created attachment 26828 [details]
testcase (correction: all block level elements, replaced null with "" per notes in bug 63281)
Comment 9 Dylan Schiemann 2001-03-05 17:35:18 PST
Note that color and background-color are now returning values with px units,
which is incorrect.  padding and border widths are now returning correct values
in the 2001030505 build.
Comment 10 Hixie (not reading bugmail) 2001-04-26 17:07:44 PDT
Nominating this bug for nsbeta1 on behalf of gerardok@netscape.com.
Comment 11 Christopher Hoess (gone) 2001-09-07 12:51:50 PDT
Updating the dependencies.  See also bug 73525 for the issue of null vs. "" wrt 
the testcases...
Comment 12 harishd 2001-09-26 12:08:04 PDT
Handing over getComputedStyle to bzbarsky. Thanks Boris.
Comment 13 nick 2002-04-16 10:18:38 PDT
At least in the following example getComputedStyle returns "auto" for the "left"
property. It should return the actual pixel value. I'm using nightly build
2002041521 and IIRC this has worked in previous builds.

<html>

<head>
<title>mozbug</title>
<script type="text/javascript">
function bug()
{
  var view = document.defaultView;
  var span = document.getElementById('span');
  var style = view.getComputedStyle(span, null);
  alert(style.getPropertyValue('left'));
}
</script>
</head>

<body onload="bug()">
<p>text <span id="span">span</span> text</p>
</body>

</html>
Comment 14 Boris Zbarsky [:bz] 2002-04-16 11:36:35 PDT
> It should return the actual pixel value.

It should absolutely not, since the element is not positioned and thus the
"left" property does not apply.  See bug 109523.

Furthermore, this is a tracking bug.... please raise issues with computed style
in new bugs that you file that block this one.
Comment 15 Boris Zbarsky [:bz] 2002-08-01 20:07:00 PDT
*** Bug 160619 has been marked as a duplicate of this bug. ***
Comment 16 Boris Zbarsky [:bz] 2004-01-06 16:23:31 PST
No plans to work on this any time in the foreseeable future, so to default owner.
Comment 17 clc4tts 2005-11-21 12:56:19 PST
This bug depends on 317340, but I do not have sufficient privilege to add it to the depends list.

https://bugzilla.mozilla.org/show_bug.cgi?id=317340

I have included a sample HTML file that demonstrates this problem.

getPropertyValue is broken for CSS2.

Note You need to log in before you can comment on or make changes to this bug.