Last Comment Bug 722777 - Tables with 'transform' property set don't act as abs-pos/fixed-pos containers
: Tables with 'transform' property set don't act as abs-pos/fixed-pos containers
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Layout: Tables (show other bugs)
: Trunk
: x86 Linux
: -- minor (vote)
: mozilla13
Assigned To: Aryeh Gregor (:ayg) (next working March 28-April 26)
:
:
Mentors:
Depends on:
Blocks: 435293
  Show dependency treegraph
 
Reported: 2012-01-31 10:26 PST by Aryeh Gregor (:ayg) (next working March 28-April 26)
Modified: 2012-02-10 19:19 PST (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch v1 (7.62 KB, patch)
2012-02-09 08:53 PST, Aryeh Gregor (:ayg) (next working March 28-April 26)
roc: review+
Details | Diff | Splinter Review

Description Aryeh Gregor (:ayg) (next working March 28-April 26) 2012-01-31 10:26:38 PST
Simple test-case:

data:text/html,<!doctype html>
<div style="display:table;-moz-transform:scale(1);
width:100px;height:100px">
<div style="position:absolute;right:0">Hello
</div></div>

In Firefox 12.0a1 (2012-1-24), "Hello" is all the way at the right of the viewport.  In IE9, Chrome 17 dev, and Opera Next 12.00 alpha, it's at the right of the 100px-table.  The spec says anything with a transform other than 'none' has to be a container for absolute and fixed positioning.  This is mentioned in bug 435293 comment 34 but apparently was never fully fixed.

Bug 320865 and bug 391153 seem related.
Comment 1 Boris Zbarsky [:bz] (still a bit busy) 2012-01-31 10:32:38 PST
Hmm.  Is the transform on the inner table or something?

If you add a caption in there, does it get transformed in various UAs?
Comment 2 Aryeh Gregor (:ayg) (next working March 28-April 26) 2012-01-31 10:45:44 PST
data:text/html,<!doctype html>
<table style=-moz-transform:rotate(180deg)>
<caption>Hello</caption>
<tr><td>there
</table>

In Gecko, "there" is rotated but "Hello" is not.  In IE/Chrome/Opera, the whole table is rotated.  Likewise, percentages are relative to the height of the whole thing including caption.  It looks like the transforms spec doesn't say whether the transform is supposed to apply to the table wrapper box, or the table box.  Implementations make it the table wrapper box.  Should I file another bug?
Comment 3 Aryeh Gregor (:ayg) (next working March 28-April 26) 2012-01-31 10:48:19 PST
https://www.w3.org/Bugs/Public/show_bug.cgi?id=15815
Comment 4 Boris Zbarsky [:bz] (still a bit busy) 2012-01-31 10:52:30 PST
In our case it's basically the same bug.  The table wrapper box is what's used as a containing block for positioned stuff if the table is used at all, but since that's not transformed it's not actually a positioned containing block.

If we fix the transform to apply to the table wrapper box, the abs/fixed thing will automagically work, I suspect...
Comment 5 Robert O'Callahan (:roc) (email my personal email if necessary) 2012-01-31 12:54:41 PST
Yes. This is probably just a matter of adding to the :-moz-table-outer rule in ua.css and making nsTableFrame ignore its transform.
Comment 6 Aryeh Gregor (:ayg) (next working March 28-April 26) 2012-02-08 12:33:11 PST
So :-moz-table-outer should inherit -moz-transform/-moz-transform-origin/etc.?  How should we make nsTableFrame ignore its transform, return false from IsTransformable or something?
Comment 7 Robert O'Callahan (:roc) (email my personal email if necessary) 2012-02-08 14:06:38 PST
(In reply to Aryeh Gregor from comment #6)
> So :-moz-table-outer should inherit
> -moz-transform/-moz-transform-origin/etc.?

Yes.

> How should we make nsTableFrame
> ignore its transform, return false from IsTransformable or something?

Clearing NS_FRAME_MAY_BE_TRANSFORMED from mState in nsTableFrame::Init should do it. Then IsTransformed will return false for those frames.
Comment 8 Robert O'Callahan (:roc) (email my personal email if necessary) 2012-02-08 14:10:10 PST
I bet there are all sorts of interesting interactions with preserve-3d and anonymous frames here. E.g. does <div class="preserve-3d"><table class="preserve-3d"><td class="preserve-3d"> actually preserve-3d all the way down? I guess it shouldn't because the HTML parser inserts fake <tbody> and <tr> nodes into the DOM. But what if you do the same thing with CSS tables? Then preserve-3d should probably work all the way down. I wonder if any browser does that...
Comment 9 Aryeh Gregor (:ayg) (next working March 28-April 26) 2012-02-09 07:02:52 PST
I do know that this doesn't work:

  <div style="-moz-transform:perspective(200px);
  -moz-transform-style:preserve-3d">
  <div style="height:100px;width:100px;background:lime;
  -moz-transform:rotatey(45deg);display:table">

doesn't work in Gecko but does in WebKit.  I'll definitely test anonymous table frames some more; in my brief testing they seemed to work as I'd expect, i.e., not per spec.  :)  Perhaps the spec should say that UAs have to have "tbody, thead, tfoot { transform-style: inherit }" to make it more intuitive.  (Or maybe the property should have been inherited to start with, but I guess it's too late for that.)
Comment 10 Aryeh Gregor (:ayg) (next working March 28-April 26) 2012-02-09 08:53:39 PST
Created attachment 595770 [details] [diff] [review]
Patch v1

I don't know if this makes tables behave completely correctly, but it's an improvement.
Comment 11 Mozilla RelEng Bot 2012-02-09 08:57:46 PST
Autoland Patchset:
	Patches: 595770
	Branch: mozilla-central => try
	Destination: http://hg.mozilla.org/try/rev/880a068be984
Try run started, revision 880a068be984. To cancel or monitor the job, see: https://tbpl.mozilla.org/?tree=Try&rev=880a068be984
Comment 12 Aryeh Gregor (:ayg) (next working March 28-April 26) 2012-02-09 09:30:00 PST
I filed a spec bug on transform-style:

https://www.w3.org/Bugs/Public/show_bug.cgi?id=15943

WebKit treats it magically for tables, but the spec doesn't say this.
Comment 13 Mozilla RelEng Bot 2012-02-09 18:15:23 PST
Try run for 880a068be984 is complete.
Detailed breakdown of the results available here:
    https://tbpl.mozilla.org/?tree=Try&rev=880a068be984
Results (out of 210 total builds):
    success: 179
    warnings: 17
    failure: 14
Builds (or logs if builds failed) available at:
http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/autolanduser@mozilla.com-880a068be984
Comment 15 Ed Morley [:emorley] 2012-02-10 19:19:26 PST
https://hg.mozilla.org/mozilla-central/rev/d6c2ee4091e4

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