Supporting all CSS2 properties with getComputedStyle()

NEW
Unassigned

Status

()

Core
DOM: CSS Object Model
17 years ago
3 years ago

People

(Reporter: jst, Unassigned)

Tracking

(Depends on: 2 bugs, 4 keywords)

Trunk
dom2, helpwanted, meta, testcase
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [Hixie-PF] [ngdriver/domcss])

Attachments

(3 attachments)

(Reporter)

Description

17 years ago
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)
(Reporter)

Updated

17 years ago
Status: NEW → ASSIGNED
Target Milestone: --- → Future

Updated

17 years ago
Depends on: 47159

Comment 1

17 years ago
Adding that this bug depends on 63281
Depends on: 63281
Keywords: mozilla1.0
QA Contact: vidur → ian

Comment 2

17 years ago
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.
(Reporter)

Comment 3

17 years ago
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.
Assignee: jst → harishd
Status: ASSIGNED → NEW

Comment 4

17 years ago
Created attachment 25350 [details]
testcase (all CSS2 properties for a block level element)

Comment 5

17 years ago
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
Keywords: dom2
Component: DOM Level 2 → DOM Style
Taking QA Contact on all open or unverified DOM Style bugs...

Comment 7

17 years ago
Created attachment 26823 [details]
testcase (all block level elements, replaced null with "" per notes in bug 63281)

Comment 8

17 years ago
Created attachment 26828 [details]
testcase (correction: all block level elements, replaced null with "" per notes in bug 63281)

Comment 9

17 years ago
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.
Depends on: 73525
Nominating this bug for nsbeta1 on behalf of gerardok@netscape.com.
Keywords: nsbeta1
Keywords: mozilla1.0, nsbeta1 → mozilla1.2
Depends on: 83119
Keywords: meta, testcase
Whiteboard: [Hixie-PF] [ngdriver/domcss]
Updating the dependencies.  See also bug 73525 for the issue of null vs. "" wrt 
the testcases...
Depends on: 84599, 94080, 94855, 95062, 97052, 98052
Summary: Supporting all CSS2 propeties with getComputedStyle() → Supporting all CSS2 properties with getComputedStyle()

Comment 12

16 years ago
Handing over getComputedStyle to bzbarsky. Thanks Boris.
Assignee: harishd → bzbarsky
Depends on: 101925
Depends on: 102678
Depends on: 106154
Depends on: 109523
Status: NEW → ASSIGNED
Depends on: 116032, 116033
Blocks: 117500
Depends on: 125716
Depends on: 125778
Depends on: 126319

Comment 13

16 years ago
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>
> 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.
*** Bug 160619 has been marked as a duplicate of this bug. ***
Depends on: 173354
Depends on: 77882
Keywords: helpwanted
Priority: P3 → P5
Depends on: 200497
Depends on: 200499
No plans to work on this any time in the foreseeable future, so to default owner.
Assignee: bz-vacation → general
Status: ASSIGNED → NEW
Priority: P5 → --
Target Milestone: Future → ---

Updated

12 years ago
Depends on: 316981

Comment 17

12 years ago
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.
Assignee: general → nobody
QA Contact: ian → general
QA Contact: general → style-system
You need to log in before you can comment on or make changes to this bug.