Last Comment Bug 698291 - [dir=auto] changing window size doesn't re-renders textarea with dynamic widths
: [dir=auto] changing window size doesn't re-renders textarea with dynamic widths
Status: RESOLVED FIXED
: rtl
Product: Core
Classification: Components
Component: Layout: Form Controls (show other bugs)
: 10 Branch
: All All
: -- normal (vote)
: mozilla11
Assigned To: Simon Montagu :smontagu
:
Mentors:
data:text/html,<meta%20charset="utf-8...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-30 10:14 PDT by Tomer Cohen :tomer
Modified: 2011-12-07 12:25 PST (History)
3 users (show)
smontagu: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch (1.35 KB, patch)
2011-10-30 21:50 PDT, Simon Montagu :smontagu
no flags Details | Diff | Review
Reftest (2.07 KB, patch)
2011-10-30 21:51 PDT, Simon Montagu :smontagu
no flags Details | Diff | Review
Patch v.2 (1.36 KB, patch)
2011-10-30 22:41 PDT, Simon Montagu :smontagu
dbaron: review+
Details | Diff | Review
Reftest v.2 (2.20 KB, patch)
2011-10-31 01:22 PDT, Simon Montagu :smontagu
roc: review+
Details | Diff | Review

Description Tomer Cohen :tomer 2011-10-30 10:14:37 PDT
Steps to reproduce:
a. Unmaximize window. 
b. Load a page with dir=auto[1]
c. Maximize browser window.


Expected result:
The textarea content should be at the right side of the textarea but instead is at the center. 



[1] data:text/html,<meta%20charset="utf-8"/><textarea%20dir="auto"%20style="width:100%;font-size:200%;">%D7%91%D7%93%D7%99%D7%A7%D7%94</textarea></div>

Note that it doesn't reproduce if we emit the dynamic width from the style, as it needs less recalculations.
Comment 1 Tomer Cohen :tomer 2011-10-30 10:35:56 PDT
Tested with: Mozilla/5.0 (X11; Linux i686; rv:10.0a1) Gecko/20111030 Firefox/10.0a1
Comment 2 Tomer Cohen :tomer 2011-10-30 10:53:49 PDT
This doesn't reproduce if setting dir=rtl outside of the textarea element.

data:text/html,<html%20dir="ltr"><meta%20charset="utf-8"/><textarea%20dir="auto"%20style="width:100%;font-size:200%;">%D7%91%D7%93%D7%99%D7%A7%D7%94</textarea></html>


Please note that I had a small typo in the previous testcase. There should be not </div> at the end.
Comment 3 Simon Montagu :smontagu 2011-10-30 12:46:50 PDT
I bet this happens because there is an optimization somewhere which only realigns the text to the right edge of the textarea when dir=rtl or align=right, and therefore not when dir=auto. I haven't found where that is, though.
Comment 4 Simon Montagu :smontagu 2011-10-30 21:50:43 PDT
Created attachment 570603 [details] [diff] [review]
Patch
Comment 5 Simon Montagu :smontagu 2011-10-30 21:51:57 PDT
Created attachment 570605 [details] [diff] [review]
Reftest
Comment 6 David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) 2011-10-30 21:52:57 PDT
Comment on attachment 570603 [details] [diff] [review]
Patch

Shouldn't this be a bitmask check on nsStyleTextReset::mUnicodeBidi?

Otherwise looks right.
Comment 7 Simon Montagu :smontagu 2011-10-30 21:57:06 PDT
Comment on attachment 570603 [details] [diff] [review]
Patch

(In reply to David Baron [:dbaron] from comment #6)
> Comment on attachment 570603 [details] [diff] [review] [diff] [details] [review]
> Patch
> 
> Shouldn't this be a bitmask check on nsStyleTextReset::mUnicodeBidi?

Yes it should.
Comment 8 Simon Montagu :smontagu 2011-10-30 22:41:53 PDT
Created attachment 570610 [details] [diff] [review]
Patch v.2
Comment 9 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2011-10-31 00:29:09 PDT
Comment on attachment 570605 [details] [diff] [review]
Reftest

Review of attachment 570605 [details] [diff] [review]:
-----------------------------------------------------------------

::: layout/reftests/bidi/698291-1.html
@@ +9,5 @@
> +  document.getElementById("f").style.width="100%";
> +}
> +    </script>
> +  </head>
> +  <body onload="boom()">

This should be a MozReftestInvalidate handler, I think.
Comment 10 Simon Montagu :smontagu 2011-10-31 01:22:01 PDT
Created attachment 570626 [details] [diff] [review]
Reftest v.2
Comment 11 Simon Montagu :smontagu 2011-11-02 14:48:48 PDT
Comment on attachment 570610 [details] [diff] [review]
Patch v.2

dbaron, I moved the review request over to you because I thought from comment 6 that you had already looked over the patch and it would be trivial for you to review it. If that was wrong, please feel free to transfer the request back to roc.
Comment 12 David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) 2011-12-06 17:23:02 PST
Comment on attachment 570610 [details] [diff] [review]
Patch v.2

r=dbaron

(This makes me wonder whether 'plaintext' should be a value for 'direction' rather than 'unicode-bidi'...)

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