Note: There are a few cases of duplicates in user autocompletion which are being worked on.

Table's "rules" should be implemented with CSS equivalent

RESOLVED FIXED in mozilla1.9.3a1

Status

()

Core
Layout: Tables
P3
normal
RESOLVED FIXED
17 years ago
3 years ago

People

(Reporter: fantasai, Assigned: fantasai)

Tracking

(Depends on: 4 bugs, {testcase})

Trunk
mozilla1.9.3a1
testcase
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [awd:tbl])

Attachments

(12 attachments, 15 obsolete attachments)

4.95 KB, text/html
Details
21.81 KB, patch
Details | Diff | Splinter Review
19.49 KB, patch
Details | Diff | Splinter Review
26.35 KB, patch
Details | Diff | Splinter Review
928 bytes, text/html
Details
55.50 KB, application/x-zip-compressed
Details
5.72 KB, text/css
Details
82.91 KB, patch
Details | Diff | Splinter Review
63.31 KB, patch
Details | Diff | Splinter Review
118.14 KB, patch
Details | Diff | Splinter Review
57.21 KB, patch
Details | Diff | Splinter Review
6.62 KB, patch
Details | Diff | Splinter Review
(Assignee)

Description

17 years ago
Overview:

 Currently, "rules" is hard-coded into Mozilla (see bug 41411), which
 places restrictions on CSS properties. "rules" should be implemented
 with style sheets or their equivalent and participate in the cascade.

Some problems that can be solved by this:

 Bug 21076 - rules don't display without border attribute
 Bug 41411 - rules attribute overrides CSS
 Bug 25228 - border=0 overrides CSS

Other bugs that will be affected:

 Bug 2068 - HTML4 example table not rendered correctly
 Bug 24113 - rules=groups does not function properly

What this requires:

 - the CSS2 collapsing border model in working order (bug 41262)

 - HTML4 row & column groups with border capabilities (bug 2436, bug 915)

 - Table's "frame" attribute implemented with a style-sheet
   equivalent (already done) and *all non-visible frame borders mapped
   to '0 hidden', not 'none'.* (see "emulating rules with CSS" - bug 41411)
       http://bugzilla.mozilla.org/showattachment.cgi?attach_id=10217
        (view source - comments in stylesheet)
(Assignee)

Updated

17 years ago
Blocks: 21076, 25228, 41411
Depends on: 915, 2436, 41262

Comment 1

17 years ago
Confirming the bug. fantasai@escape.com you should ask for some bugzilla 
permissions.
Status: UNCONFIRMED → NEW
Ever confirmed: true

Updated

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

Updated

17 years ago
Keywords: donttest

Updated

17 years ago
QA Contact: desale → chrisd

Updated

17 years ago
Target Milestone: M18 → ---

Comment 2

17 years ago
Moving to m1.0
Target Milestone: --- → mozilla1.0

Comment 3

17 years ago
QA contact update
QA Contact: chrisd → amar
Keywords: donttest

Updated

16 years ago
Whiteboard: [awd:tbl]

Updated

16 years ago
Target Milestone: mozilla1.0 → mozilla0.9.8

Comment 4

16 years ago
->m099
Target Milestone: mozilla0.9.8 → mozilla0.9.9
Marking nsbeta1+
Keywords: nsbeta1+

Comment 6

16 years ago
Fixed by meta bug 41262.
Status: ASSIGNED → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → FIXED

Comment 7

16 years ago
 Rules with style sheets are fixed and checked in. 

Tested with Build ID: 2002031303

Status: RESOLVED → VERIFIED
No longer depends on: 915
(Assignee)

Comment 8

14 years ago
Reopening, because it really never did get fixed.

Comment 9

14 years ago
if one could make the colgroup case in
http://bugzilla.mozilla.org/attachment.cgi?id=10217&action=view make working I
think thats definetely a thing we want.
Status: VERIFIED → REOPENED
Resolution: FIXED → ---

Updated

14 years ago
Assignee: karnaze → nobody
Status: REOPENED → NEW
QA Contact: amar → core.layout.tables

Comment 10

14 years ago
Created attachment 140924 [details]
Attempt to make rules=groups work

Comment 11

14 years ago
Created attachment 140929 [details]
Slightly updated to handle interaction of rules and border better.

Updated

14 years ago
Attachment #140924 - Attachment is obsolete: true

Comment 12

14 years ago
Created attachment 140930 [details]
no outer borders on rules=all

Updated

14 years ago
Attachment #140929 - Attachment is obsolete: true

Comment 13

14 years ago
there is a quite complete testcase at
http://bugzilla.mozilla.org/attachment.cgi?id=41726&action=view

Comment 14

14 years ago
Created attachment 140979 [details]
Fix CSS error caught by that testcase

With these styles (well, I renamed "frame" to" myframe" to test), I get
identical rendering on that exhaustive testcase (I was comparing these style
rules to what mozilla does right now).

Updated

14 years ago
Attachment #140930 - Attachment is obsolete: true

Updated

14 years ago
Blocks: 167496

Updated

14 years ago
Blocks: 144899

Comment 15

13 years ago
Created attachment 153685 [details] [diff] [review]
first scetch

Comment 16

13 years ago
Comment on attachment 153685 [details] [diff] [review]
first scetch 

>Index: layout/html/document/src/Makefile.in
> 	quirk.css \
>+        tablerules.css \
> 	viewsource.css \

Fix indent?

>Index: layout/html/document/src/html.css

Random whitespace changes in here...

>Index: layout/html/document/src/tablerules.css

This needs an @namespace rule.

Can we remove the code that maps "rules" in MapAttributesIntoRule in
nsHTMLTableElement.cpp?  Or is that still used somewhere?

Updated

13 years ago
Keywords: nsbeta1+ → testcase
(Assignee)

Comment 17

13 years ago
Just comments on the CSS for now:

- The rules setting border-collapse: collapse; on table should be removed; this
  is covered in html.css already. (Do not move this rule from html.css)

- All rules dealing with td are missing equivalent selectors for th

- The rules setting border: 0 hidden; on the table should be collapsed into just
    table[rules] {
      border-style: hidden;
    }

- Change the table[border] td rule to
    table[border] > tr > td,
    table[border] > tr > th,
    table[border] > * > tr > td,
    table[border] > * > tr > th {
      border: thin inset;
    }
  and shift it up before the [rules] rules.

- Add a rule to handle [border="0"] : 
    table[border="0"],
    table[border="0"] > tr > td,
    table[border="0"] > tr > th,
    table[border="0"] > * > tr > td,
    table[border="0"] > * > tr > th {
      border-style: none;
    }
  The attribute-mapping code should now only be setting border-width and no
  other property.

- The [rules] rules should all be given with the border shorthand.
      border: none solid;
  or  border: solid none;

- You forgot thead in the rules=groups rule.

- Rename tablerules.css to preshint.css. bz, we need to load this into the
  preshint level. How do we do that?

Comment 18

13 years ago
>- Rename tablerules.css to preshint.css. bz, we need to load this into the
>  preshint level. How do we do that?

Why is it any more preshint than most of ua.css?

There are no reasonable APIs to load things into the preshint level at the
moment; further, there are asserts that the preshint level contains no CSS rules.

Those could be removed, of course.... and said APIs could be added.
(Assignee)

Comment 19

13 years ago
It's preshint because that's the level it belongs in, and was in (more or less),
and therefore should be in.
And CSS2.1 says so, so no arguing about it! :)

http://www.w3.org/TR/CSS21/cascade.html#q13

> Those could be removed, of course.... and said APIs could be added.

That should be a separate bug. I can file it tomorrow.
(Assignee)

Comment 20

13 years ago
filed bug 252530 for adding preshint API
No dependency, because we can just @import the table rules sheet into ua.css for
now.

Updated

13 years ago
Assignee: nobody → bernd_mozilla

Updated

13 years ago
Blocks: 188715

Comment 21

13 years ago
Created attachment 161847 [details] [diff] [review]
first scetch updated to tip

Comment 22

13 years ago
from bug 272341

We propagate table's 'frame' and 'rules' attributes through the style system,
but nobody gets them out the other end.  There's no need for this.

maybee the removal will help for the patch which spoiled up whith the css.
Bug 272341 contains a patch showing more code that could be removed (but skip
the addition of GetAttributeChangeHint that it contains).

Updated

13 years ago
Blocks: 276244

Updated

12 years ago
Blocks: 155507

Updated

12 years ago
Blocks: 320979

Comment 24

11 years ago
Created attachment 236538 [details] [diff] [review]
first scetch updated to tip again
Attachment #161847 - Attachment is obsolete: true

Comment 25

11 years ago
I don't get the style rules matching on the td. My guess is that this is a consequence of bug 211636. My knowledge of the style system did not increase over the past years (bug 87663). I simply have no idea what needs to be done here. Giving the bug back.
Assignee: bernd_mozilla → nobody

Comment 26

11 years ago
Created attachment 236617 [details] [diff] [review]
patch with fix from bug 272341

This patch does include the fix from bug 272341. However the selector do again not work for rows and cell. And I have neither an idea why this is so nor how to debug such a thing.
:-(

Comment 27

11 years ago
the selector cannot match if the CSS comment closure looks like:
***   /
 Thanks to Boris for spotting it.
(Assignee)

Comment 28

11 years ago
Created attachment 238398 [details]
New tablerules.css (draft)

Sorry for disappearing on you, Bernd. I'll be around more often now. :)

I reorganized the rules in tablerules.css to address some problems with the interaction of 'border' and 'frame'. Note that border-collapsing and cascading are independent. :) Also added rules to match <th> elements and fixed a couple other things iirc. With this style sheet the only attribute mapping that is necessary is mapping the value of 'border' to 'border-width'.

I haven't tested the code yet; I'm going to make some test cases next, then
attach an updated version.

There's a couple open interpretation/compatibility issues:
  1. Border collapsing for rules="" and rules="none"
       - The current code collapses for rules="", but not for rules="none"
            - It also does stupid things like assume rules="" means rules="all"
              when the 'frame' attribute is present.
       - The proposed code collapses for neither rules="" and rules="none"
       - Opera collapses for rules="none" but not for rules=""; it basically
         ignores rules=""
  2. Border style for table
       - The current code uses the outset style for the table borders.
       - The proposed code uses outset for 'border' borders and solid for
         'frame' borders and when both are sest.
       - Opera uses outset whenever 'border' is present, but solid if only
         'frame' is there.

The spec doesn't say what to do here. I suggest we copy what Opera is doing,
because it makes sense and will make at least the two of us compatible. (Safari
doesn't support 'frame' or 'rules', and IE doesn't do border-collapsing for
them.) If that's ok, I'll make those changes in the next revision.

Comment 29

11 years ago
I usually take https://bugzilla.mozilla.org/attachment.cgi?id=41726&action=view for testing
(Assignee)

Comment 30

11 years ago
Extended test suite:
http://fantasai.inkedblade.net/markup/tests/table-frame-rules/
(Assignee)

Comment 31

11 years ago
Created attachment 242471 [details]
New tablerules.css
Attachment #238398 - Attachment is obsolete: true
(Assignee)

Comment 32

11 years ago
Created attachment 242474 [details] [diff] [review]
updated patch

C++ patch, brought up-to-date. Aside from that, the only thing that's changed is that I removed the MapTableFrameInto function, since it's no longer needed.

This fix introduces a lot of very messy CSS rules to make the quirks mode border coloring work properly. We might want to fix bug 84307 first...
Attachment #236617 - Attachment is obsolete: true
(Assignee)

Comment 33

11 years ago
Oh, the patch also includes diff against quirk.css
(Assignee)

Comment 34

11 years ago
Created attachment 242475 [details] [diff] [review]
updated patch
Attachment #242474 - Attachment is obsolete: true

Comment 35

11 years ago
>This fix introduces a lot of very messy CSS rules to make the quirks mode
>border coloring work properly.

We got a green to remove the quirk at all:
http://groups.google.com/group/mozilla.dev.tech.layout/browse_frm/thread/a09888064bc1eaf1/0f6cb460af73c8bf#0f6cb460af73c8bf

So I think we should remove the quirk first (bug 84307). Fantasai could you (would you like to) do this?
(Assignee)

Updated

11 years ago
Blocks: 229591

Comment 36

10 years ago
Fantasai could you please update the patch now that bug 84307 is fixed.
(Assignee)

Comment 37

10 years ago
Created attachment 272740 [details] [diff] [review]
updated patch

same patch, less bitrot
Attachment #242475 - Attachment is obsolete: true
(Assignee)

Comment 38

10 years ago
Created attachment 272741 [details]
Color Weirdness Testcase

For some reason, even with that patch applied (and tablerules.css turned off), a table with 'rules' has a gray border. The grayness disappears with border-collapse: separate or explicit author CSS border-color. Bernd, any idea why this is happening?
(Assignee)

Comment 39

10 years ago
Found the problem. There's still a lot more C++ to remove.

Updated

10 years ago
Blocks: 367576
(Assignee)

Updated

10 years ago
Assignee: nobody → fantasai.bugs

Comment 40

10 years ago
Any progress here?

Comment 41

10 years ago
I will work on this post 1.9

Comment 42

9 years ago
Fantasai: post 1.9 is coming ...., could you add some information about comment 39. Do you plan to work on this or should I steal the bug and the patch?
(Assignee)

Comment 43

9 years ago
I don't have any concrete plans to work on it, no. If you want to steal it, though, give me a heads up right before you start working on it. FWIW I'm happy to do the CSS part for you.

Wrt C++ that needs to be removed: in addition to your patch above, there seems to be a lot of code in nsTableFrame.cpp that hard-codes rules attribute handling. That needs to be removed as well.
(Assignee)

Updated

9 years ago
Attachment #242471 - Attachment is obsolete: true

Comment 44

9 years ago
I converted https://bugzilla.mozilla.org/attachment.cgi?id=41726&action=view into a set of reftests, I will land them once the 3.0 is out.

Comment 45

9 years ago
Created attachment 321374 [details] [diff] [review]
next rev.

Comment 46

9 years ago
Created attachment 321375 [details]
updated table rules

Comment 47

9 years ago
Created attachment 321380 [details]
reftests archive

Comment 48

9 years ago
Created attachment 321402 [details]
revised to keep quirks mode gray

Updated

9 years ago
Attachment #321375 - Attachment is obsolete: true

Comment 49

9 years ago
I am happy with how the current patch works. I am very satisfied with the code removal from nsHTMLTableElement.cpp and nsHTMLStyleSheet.cpp

Comment 50

9 years ago
Comment on attachment 321374 [details] [diff] [review]
next rev.

David could you please review this, its post 1.9 stuff, so no time pressure.
Attachment 321402 [details] is the CSS file that does the work.
I know there is the headache prone border collapse stuff at the end of the patch, but its only a removal of the style marker for rules.
Attachment #321374 - Flags: superreview?(dbaron)
Attachment #321374 - Flags: review?(dbaron)
Have you run any page-loading performance tests on this patch?  It seems like it could regress performance pretty easily.

Comment 52

9 years ago
No, I haven't. Do you have a recommendation what tests should be executed?
Probably the Talos pageload performance tests that show up on tinderbox.
(Assignee)

Comment 54

9 years ago
Bernd, for the CSS you should start with the New tablerules.css (draft) version, since we don't need to cascade in the quirks mode rules anymore. There's a typo on line 75, but other than that I think it's mostly correct.
Note that I think you can get performance numbers using http://wiki.mozilla.org/Build:TryServer

Comment 56

9 years ago
Created attachment 332062 [details] [diff] [review]
patch updated to tip

fantasai: I don't think we should change the gray shade in quirks mode. Why do you think we should change this.

Comment 57

9 years ago
I did the test with attachment 332062 [details] [diff] [review] at the TryServer.
The builds are at: 
https://build.mozilla.org/tryserver-builds/2008-08-02_12:19-bmlk@gmx.de-table_rules_css/

The tp timing does not change across platforms within the noise of the data:
        Old      New     Diff
Linux: 461.74    444.02  -17
Mac:   313.04    315.51  +2
Win:   447.52    443.86  -4

I am not sure how good is the reference point. 
(Assignee)

Comment 58

9 years ago
I don't think we should change the gray shade in quirks mode. I'm just saying the selectors in the (draft) version of tablerules.css are much simpler and we should use that as the basis for this patch, not the later version. The later version was trying to cascade in the quirky-colored border *styles* from quirk.css, which is why it has so much negation and overriding mess in it.

Comment 59

9 years ago
Created attachment 334146 [details] [diff] [review]
revised patch

This patch starts now with the tablerules draft as fantasai requested. Trimming the file with the presence of the reftests was a nobrainer.
Attachment #321374 - Attachment is obsolete: true
Attachment #332062 - Attachment is obsolete: true
Attachment #334146 - Flags: superreview?(dbaron)
Attachment #334146 - Flags: review?(dbaron)
Attachment #321374 - Flags: superreview?(dbaron)
Attachment #321374 - Flags: review?(dbaron)

Updated

9 years ago
Attachment #334146 - Attachment is patch: true

Comment 60

9 years ago
Created attachment 338432 [details] [diff] [review]
slightly updated

while the parser will not allow <table><td> constructs a DOM manipulation can achieve this, So I added two table> *> td rules.
Blocks: 114100
Here are my comments so far.  I still want to look a bit more, especially at the removed code.


I don't see why tablerules.css should be a separate file.  Please just
put it in html.css.

You should be changing nsHTMLTableElement::IsAttributeMapped to remove
attributes that are no longer mapped attributes (which I think are frame
and rules, although you should double-check that there aren't any
aAttributes->GetAttr() calls for them).  (I'm not sure whether you also
want to modify nsHTMLTableElement::ParseAttribute so that we no longer
longer store them as enumerated... I should probably ask sicking what we
should do here.)


I'm going to make a bunch of comments on the style rules.  I might be
missing things that you were considering when you wrote them (including
compatibility with our old behavior or other browsers), so don't rush to
fix these if there are good reasons for them to be the way they are:

+  /* 'border' before 'frame' so 'frame' overrides
+      A border with a given value should, of course, pass that value
+      as the border-width in pixels -> attr mapping */
+table[border] {
+       border: thin outset;
+}
+  /* 'border="0"' suppresses the border */
+table[border="0"] {
+       border: 0 hidden;
+}

Is there a reason that [border="0"] should not only set border-width to
0 but also border-style to hidden?  Why not just make this a single
rule:

table[border]:not([border="0"]) { border: thin outset; }

+table[frame] {
+       border: thin hidden;
+}
+table[frame="above"] {
+       border-top-style: solid;
+}
+table[frame="below"] {
+       border-bottom-style: solid;
+}
+table[frame="lhs"] {
+       border-left-style: solid;
+}
+table[frame="rhs"] {
+       border-right-style: solid;
+}
+table[frame="hsides"] {
+       border-style: solid hidden;
+}
+table[frame="vsides"] {
+       border-style: hidden solid;
+}
+table[frame="box"],
+table[frame="border"] {
+       border-style: solid;
+}

I'm not crazy about the handling of unknown values of frame here.  Why
not skip the table[frame] rule and specify all four styles for each
known value of frame, i.e.,:
  table[frame="above"] { border-style: solid hidden hidden hidden; }
etc.

+  /* 'border' cell borders first */
+table[border] > tr > td,
+table[border] > * > tr > td,
+table[border] > tr > th,
+table[border] > * > tr > th,
+table[border] > td,
+table[border] > th,
+table[border] > * > td,
+table[border] > * > th {
+  border: thin inset;
+}
+table[border="0"] > tr > td,
+table[border="0"] > * > tr > td,
+table[border="0"] > tr > th,
+table[border="0"] > * > tr > th,
+table[border="0"] > td,
+table[border="0"] > th,
+table[border="0"] > * > td,
+table[border="0"] > * > th {
+  border-style: none;
+}

You can simply this by:

(1) beginning each selector with table[border]:not([border="0"]) and
eliminating the second rule

(2) removing "table > tr > td" etc. given that you have "table > * >
td".

That said, do you really need all these options for tree structure?  Did
we support this for all of these combinations in the old code?



In general, I'm a little concerned about handling of unknown values
being inconsistent.  Have you tested those cases?  Are we changing our
behavior?  Is it becoming more or less compatible with other browsers?
(I doubt specs say anything, but if they do... with specs?)
(In reply to comment #61)
> I don't see why tablerules.css should be a separate file.  Please just
> put it in html.css.

Er, actually, we should really get the preshint.css thing sorted out.

> (I'm not sure whether you also
> want to modify nsHTMLTableElement::ParseAttribute so that we no longer
> longer store them as enumerated... I should probably ask sicking what we
> should do here.)

I think this should stay untouched.
That said, one of the reasons I've been hesitant to put a lot of energy into reviewing this is that I'm still somewhat skeptical that it's not going to make our performance numbers worse...

Comment 64

9 years ago
Tryserver runs talos.  Can we just bounce this patch on there and see how that goes?
See comment 57, in which the noise seems like about the size of the changes I might expect.

Comment 66

9 years ago
Hmm...  I guess so, for non-mac...

Updated

9 years ago
Duplicate of this bug: 472327

Comment 68

9 years ago
David, this looks like a dead lock, you are reluctant to review this for reasons that I perfectly understand, I am reluctant to spend more time on this if it does not have a chance to get reviewed.

Mean while we have the nasty code in nsHTMLStyleSheet.cpp which is wrong for years now and blocks the refactoring of the border collapse computing as the rules code currently creates a position dependency for the border collapse computation.

I have no problem to trash the patch entirely and start from scratch as long as the mess from nsHTMLStyleSheet.cpp and nsHTMLTableElement.cpp gets removed.

The reftests that I wrote will be anyway there and will make a revision much more easy for me.

Could you please propose a way that has a chance to get reviewed.

Comment 69

9 years ago
Created attachment 366160 [details] [diff] [review]
patch

this patch addresses the review comments.

I pushed it to the try server:

1. run
             Linux      Mac      Win
after        232.91     -        195.62
this         234.59     -        195.78
before       233.62     -        195.70

* the mac talos did not test this.

2. run

             Linux      Mac      Win
after        234.69     315.86   196.02
this         235.83     306.77   196.01
before       232.91     306.74   195.58

so it looks like this is slightly adding 

Linux: 1 ms  (0.5%)
Mac  : too noisy
win  : < 0.5 ms 

What I need here is a decision will this go into the tree. And it would be cool to get this decision not after months of waiting.

The arguments to take this despite the slight slow down are:
0. it fixes CSS problems that we have when running in combination with rules
1. It removes the obviously wrong code from nsHTMLStyleSheet.cpp
2. It removes a bad parameter that make table border collapse computation more complicated. 

If the decision is that the slow down is not worth it, I would appreciate a clear instruction what needs to be done to solve this, namely to achieve the same what arguments 0 and 1 are about.

Btw, the reftest archive (attachment 321380 [details]) got already pushed.
Attachment #334146 - Attachment is obsolete: true
Attachment #338432 - Attachment is obsolete: true
Attachment #366160 - Flags: superreview?(dbaron)
Attachment #366160 - Flags: review?(dbaron)
Attachment #334146 - Flags: superreview?(dbaron)
Attachment #334146 - Flags: review?(dbaron)
As a victim of one of the bugs dependant on this one, with only an extreeemely slow workaround based on JavaScript, I certainely vote for checking in the patch. :-)

Comment 71

9 years ago
The 3ms on linux (but barely any change on Mac / Win) looks out of place. Noise?

Assuming the patch passes review, I think the tiny Tp regressions are worth it.

Updated

8 years ago
Blocks: 484825
dbaron, any chance to look at this yet?
Comment on attachment 366160 [details] [diff] [review]
patch

Given that I've consistently failed to get to this, reassigning the review to bzbarsky.

bz... if you're not likely to be able to do this, I guess you should probably assign it back, though.
Attachment #366160 - Flags: superreview?(dbaron)
Attachment #366160 - Flags: superreview?(bzbarsky)
Attachment #366160 - Flags: review?(dbaron)
Attachment #366160 - Flags: review?(bzbarsky)
But what about comment 62 -- sorting out creating a preshint.css that is actually loaded at the preshint level?
Or maybe not, actually.  Maybe we should just decide that that part of the CSS spec is silly, and we should just start handling all presentational hints at the UA level.

I'd be interested if fantasai has an opinion there.
(In reply to comment #69)
> If the decision is that the slow down is not worth it, I would appreciate a
> clear instruction what needs to be done to solve this, namely to achieve the
> same what arguments 0 and 1 are about.

I suspect a substantial part of the slowdown could be fixed by implementing a :-moz-in-table() pseudo class that takes a sequence of simple selectors as an argument, so that you could replace things like:

table[border]:not([border="0"])> tr > td,
table[border]:not([border="0"])> * > tr > td,
table[border]:not([border="0"])> tr > th,
table[border]:not([border="0"])> * > tr > th,
table[border]:not([border="0"]) > td,
table[border]:not([border="0"])> th,
table[border]:not([border="0"])> * > td,
table[border]:not([border="0"]) > * > th {

with:

td:-moz-in-table(table[border]:not([border="0"])),
th:-moz-in-table(table[border]:not([border="0"])) {

That said, do we even know whether there is a slowdown?  Is try talos accurate enough?
(Assignee)

Comment 77

8 years ago
fantasai's opinion is that the preshint requirements of 2.1 don't go far enough and should have included things like b { font-weight: bold; }. But it is also her opinion that the loading of tablerules.css at preshint or not at preshint level should not block this bugfix.

Updated

8 years ago
No longer blocks: 188715

Comment 78

8 years ago
Created attachment 411362 [details] [diff] [review]
updated to tip

Updated

8 years ago
Attachment #411362 - Attachment is patch: true
Attachment #411362 - Attachment mime type: application/octet-stream → text/plain

Comment 79

8 years ago
Comment on attachment 366160 [details] [diff] [review]
patch

Reviewing the "updated to tip" patch, but marking here since that's where the request is.

>+++ b/layout/reftests/table-bordercollapse/reftest.list

Can you maybe add an == line comparing borderhandling-ref.html to a test that sets borders and maybe border-collapse purely through CSS?

>+++ b/layout/style/html.css

>+  /* 'border' before 'frame' so 'frame' overrides

I'm not quite following this... These two rules, for example:

>+table[border]:not([border="0"]) { border: thin outset; }
>+table[frame="above"]  { border-style: solid hidden hidden hidden;}

Mean that <table border="1" frame="above"> will have outset borders all around, won't it, since the first rule has higher specificity than the second rule.  That doesn't seem to be current behavior.

If we want to keep the current behavior, we probably need to change the frame rules here to something like:

  table[frame][frame="above] { border-style: solid hidden hidden hidden; }

to up the specificity, and add a comment explaining why we're doing that.

Can we add some regression tests for this?

Also, should the |table[frame]| rule also override the [border]-set style?  In that case it should be |table[frame][frame]|.  But I thought dbaron asked forthat to be removed in comment 61.  Is there a reason it's still present?

>+  /* Don't set hidden if there's no frame, no border, and rules=none */
>+table[rules="none"]:not([frame]):not([border]),
>+table[rules="none"]:not([frame])[border="0"] {
>+	border: none;
>+}

That rule could use more comment.  That's effectively overriding the default |table[rules]| styling with "border-style:none" and default border width, instead of border-style hidden, right?  Why do we need this override?

>+table[border]:not([border="0"])> tr > td,
>+table[border]:not([border="0"])> tr > th,
...
>+table[border]:not([border="0"])> * > td,
>+table[border]:not([border="0"]) > * > th {

As dbaron said in comment 61, those last two selectors match in all cases where the first two match, and more besides.  So no need for the first two.

On the other hand, as dbaron also asked, do we actually support all these combinations in the old code?  Do we need to keep supporting them?  Do we actually want to put borders on the <tr> in this XHTML:

  <table border="1">
    <div>
      <td></td>
    </div>
  </table>

or do we not care either way?  It seems a little odd to me to put borders on the <td> in that case, but does make the rules simpler (and fewer)....  
    
>+  /*'rules' overrides 'border' settings */

All the rules in this section have lower specificity than the table[border]:not([border]) rules in the previous section, so don't override them, as far as I can see.  That seems like a regression from addressing some of dbaron's comments, but we should have tests for this.... again, this can be fixed by repeating the [rules] selectors as needed.

>+table[rules] > tr > td,
>+table[rules] > * > tr > td,
>+table[rules] > tr > th,
>+table[rules] > * > tr > th {

This doesn't have the |table > td| and |table > * > td| selectors we have in the [border] section.  I personally think that's ok and we should remove those rules from that section too....

Why not just "border: thin none" for the actual declaration here?  Is there a reason to not set border props other than style/width here?

>+table[rules="cols"] > tr > td,
>+table[rules="cols"] > * > tr > td,
>+table[rules="cols"] > tr > th,
>+table[rules="cols"] > * > tr > th {
>+  border-style: none solid;
>+}

Why do you not need "border-width: thin" here, unlike in the rows case?

The rest of this looks fine, but I'd really like to see the additional tests exercising these selectors, then see the selectors fixed.

Sorry again for the lag here; now that I've sorted through the annoying (and not likely to change, since it's all code removal) parts of this patch, future reviews should be much faster!
Attachment #366160 - Flags: superreview?(bzbarsky)
Attachment #366160 - Flags: superreview-
Attachment #366160 - Flags: review?(bzbarsky)
Attachment #366160 - Flags: review-

Comment 80

8 years ago
Created attachment 419865 [details] [diff] [review]
revised patch

1) I revised the rules
2) There are now two test cases that test frame vs border in 50 different scenarios and rules vs border in 35 scenarios.
3) removed more code from nsHTMLTableElement.cpp as the border mapping to the TD is now done in CSS. The removal of code (including the previously done) opens the path to go for the table part of bug 211636
4) we need the more extensive border rules as otherwise dom manipulated tables will not draw borders around the TD. see http://mxr.mozilla.org/mozilla-central/source/layout/reftests/bugs/363370-1.html and http://mxr.mozilla.org/mozilla-central/source/layout/reftests/bugs/368651-1.html. They rely on pseudo frame creation. In the static case the offending tag would be pushed out, but in the dynamic case it will not.
Attachment #419865 - Flags: review?(bzbarsky)

Comment 81

8 years ago
Bernd, can you possibly post an interdiff between the two patches?  The bugzilla interdiff seems to be lying to me (and in particular is too small to account for the size difference between the two, I think).

Comment 82

8 years ago
Created attachment 420381 [details] [diff] [review]
Interdiff in question

Nevermind; I got hg to just cooperate.  Looks like bugzilla was missing a lot of test files.

Comment 83

8 years ago
change notices for the interdiff

nsHTMTableElement.cpp
thats 3) from comment 80

the changes for bordercol.css are intended to leave the color unchanged with respect to out current rendering

the change from &nbsp; to <div/> are to due to linux and macs doing strange things with pixel alignment (tryserver is great) 

then come the new test cases as required

and finally the revised rules.

Comment 84

8 years ago
I had a full green run try server run today at 00:26

Comment 85

8 years ago
Comment on attachment 419865 [details] [diff] [review]
revised patch

>+++ b/layout/style/html.css
>+  /* Put this first so 'border' and 'frame' rules can override it. */
>+table[rules] {border: thin hidden;}

Please put spaces after the '{' and before the '}' (and similar for the other rules here).  Newlines might be even better for this rule, but I can see how for some of the "frame" rules they aren't desirable.

>+/*increased specifity to compete with [border]:not([border="0"]) rule above*/

"specificity", not "specifity".  And spaces after "/*" and before "*/", please.  Similar for other comments here.

>+/*'rules' overrides 'border' settings  (increased specifity to achieve this)*/
>+table[rules]:not([rules=""]) > tr > td,

It's probably better to do:

  table[rules][rules] > tr > td

and the like.  Easier to read, and a bit faster to match.  Unless you really do want to be checking for nonempty rules="..." values here?  If so, why?  That could use a comment.

This is still missing the "table > td" and "table > th" selectors that the border rules have.  Either put those selectors in both places, or neither, right?  Need that here, for [rules="none"] and for [rules="all"].

With those issues fixed, looks good.
Attachment #419865 - Flags: review?(bzbarsky) → review+

Comment 86

8 years ago
I pushed http://hg.mozilla.org/mozilla-central/rev/ef065d84aaa4

I looked up 8 tp4 datasets on linux before the checkin and 8 after the checkin,

the tp4 times are with std dev.
after:    521.92 +- 2.21
before:   522.26 +- 1.86


on the mac.
after:    643.06 +- 11.01
before:   644.15 +- 18.44

on windows (with only 6 samples)
after:   600,58 +- 29.17
before:  631,46 +- 30.53

So in non of the cases I did observe a performance degradation that is measurable with tp4. One could claim a improvement on win tp4. But he numbers there oscillate so much that I would not rely on them.
Status: NEW → RESOLVED
Last Resolved: 16 years ago8 years ago
Resolution: --- → FIXED

Updated

8 years ago
No longer blocks: 367576

Comment 87

8 years ago
Created attachment 420962 [details] [diff] [review]
test cases for the dependent bugs that got fixed

I am pushing this over the try-server currently

Comment 88

8 years ago
Created attachment 420977 [details]
bundle for checkin

Updated

8 years ago
Attachment #420977 - Attachment is obsolete: true

Updated

8 years ago
Blocks: 539880

Comment 89

8 years ago
I pushed attachment 420962 [details] [diff] [review] http://hg.mozilla.org/mozilla-central/rev/e8350654c9bc

Comment 90

8 years ago
That doesn't look like the right changeset url.

Comment 91

8 years ago
http://hg.mozilla.org/mozilla-central/pushloghtml?changeset=4bb9868650a8

Comment 92

8 years ago
http://hg.mozilla.org/mozilla-central/rev/4bb9868650a8
(In reply to comment #92)
> http://hg.mozilla.org/mozilla-central/rev/4bb9868650a8

REFTEST TEST-UNEXPECTED-FAIL | file:///e:/builds/moz2_slave/mozilla-central-win32-debug-unittest-reftest/build/reftest/tests/layout/reftests/bugs/167496-1.html

http://tinderbox.mozilla.org/showlog.cgi?log=Firefox/1263664485.1263666317.725.gz
Depends on: 540228

Comment 94

8 years ago
Bug 540228 has been filed on that fairly-persistent orange.
Target Milestone: mozilla0.9.9 → mozilla1.9.3a1

Updated

8 years ago
Depends on: 540360
FWIW, I landed a followup to fix a compiler warning for a variable that became unused after this bug's patch landed. (with rs=bernd over IRC)
http://hg.mozilla.org/mozilla-central/rev/0b8ddbe14c06

Updated

7 years ago
Depends on: 573864
Depends on: 573960

Updated

7 years ago
Depends on: 577654

Updated

7 years ago
No longer blocks: 539880
Depends on: 539880
Depends on: 620648

Updated

6 years ago
Depends on: 646722

Updated

6 years ago
Depends on: 648531

Updated

6 years ago
Depends on: 665918
Blocks: 1045161
You need to log in before you can comment on or make changes to this bug.