Closed Bug 421436 Opened 17 years ago Closed 11 months ago

Remove br 1-appunit width hack

Categories

(Core :: Layout, defect)

defect

Tracking

()

RESOLVED FIXED
137 Branch
Tracking Status
firefox137 --- fixed

People

(Reporter: roc, Assigned: TYLin)

References

Details

Attachments

(4 files, 1 obsolete file)

BR frames make themselves 1 unit wide in standards mode or when they're at the start of a line: if ( ll->CanPlaceFloatNow() || aPresContext->CompatibilityMode() == eCompatibility_FullStandards ) { ... // XXX temporary until I figure out a better solution; see the // code in nsLineLayout::VerticalAlignFrames that zaps minY/maxY // if the width is zero. // XXX This also fixes bug 10036! // Warning: nsTextControlFrame::CalculateSizeStandard depends on // the following line, see bug 228752. aMetrics.width = 1; This hack was introduced because nsLineLayout used to treat zero-width lines as completely empty and collapse them away. nsLineLayout no longer does that, so this hack can be removed. Bug 10036 should not regress, because table cells containing a <br> will not have zero height. (Although the table cell emptiness check should be rewritten to not check the height, that is an unreliable approach.) The code added to nsTextControlFrame::CalculateSizeStandard in bug 228752 was to work around this hack, so it can be removed.
Flags: wanted-next+
Note, this hack can actually cause problems by making spans a tiny bit wider than they should be.
Attached patch fixSplinter Review
Remove the hack. Adds tests for bug 10036 to prove we don't regress it. Also adds a test we fail on trunk because of the hack.
Attachment #324915 - Flags: superreview?(dbaron)
Attachment #324915 - Flags: review?(dbaron)
Comment on attachment 324915 [details] [diff] [review] fix r+sr=dbaron, if you also add tests equating: <div>A<br>B</div> == <div>A</div><div>B</div> <div>A<br><br>B</div> == <div>A</div><div><span style="visibility:hidden">X</a></div><div>B</div> (probably for both quirks and standards modes) getBoundingClientRect returns fractional pixels, right? If not, you'd need to do the test for this bug inside a loop, adjusting the position across various subpixel positions.
Attachment #324915 - Flags: superreview?(dbaron)
Attachment #324915 - Flags: superreview+
Attachment #324915 - Flags: review?(dbaron)
Attachment #324915 - Flags: review+
Yeah, getBoundingClientRect returns fractional pixels. That's why the test fails on trunk. I'll add those other tests. Thanks.
checked in
Status: NEW → RESOLVED
Closed: 17 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Depends on: 439462
I backed this out to fix bug 439462. The tests are still in the tree, with one todo for the test that fails on trunk.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee: roc → nobody
So I tried to revisit this when I came across the code as something I would have to touch in bug 789096. Try run is at https://tbpl.mozilla.org/?tree=Try&rev=49732de28a1d The UNEXPECTED-PASS errors in M4 are easily removed; more worrying are the reftest failures. They are all the same error: a difference of 12-15 (depending on platform) in the corners of the textarea border. The tests are already marked fuzzy(11,4), so one could just turn up the fuzziness to 15 and everything would pass. I'm not sure if that's such a great idea, though. Bug 439462 doesn't seem to regress any more with the patch, and bug 465574 is fixed, so I should add testcases for both of those.
Assignee: nobody → smontagu
Depends on: 1012220
Attached patch Patch (obsolete) — Splinter Review
Try run with bug 1012220 and a test for bug 465574: https://tbpl.mozilla.org/?tree=Try&rev=d4ffa011bf0f. I haven't been able to make a test for bug 439462, because I can't reproduce the regression in any source tree as far back as I can still build the source on my system.
Attachment #8424451 - Flags: review?(roc)
Comment on attachment 8424451 [details] [diff] [review] Patch Review of attachment 8424451 [details] [diff] [review]: ----------------------------------------------------------------- Excellent!
Attachment #8424451 - Flags: review?(roc) → review+
sorry had to backout this change since it caused on android test failures like https://tbpl.mozilla.org/php/getParsedLog.php?id=39932940&tree=Mozilla-Inbound
I think we can just fuzz our way to victory here :-)
Yeah, but I would like to understand what causes the single pixel differences. Maybe there is still some code somewhere that was introduced to compensate for the extra 1 app unit and I didn't remove?
That said, I just saw that the failing test already has fuzzy-if(OSX==10.8,1,1)! I'll just extend that to Android and B2G
Attachment #8424451 - Attachment is obsolete: true
Attachment #8425503 - Flags: review?(roc)
Attachment #8425503 - Flags: review?(roc) → review+
Status: REOPENED → RESOLVED
Closed: 17 years ago11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
Depends on: 1014807
No longer depends on: 1014807
This most recent landing regressed bug 439462 (as described in now-duplicate bug 1014807). So, we should back this out for now (smontagu agrees per bug 1014807 comment 5). The tree's closed at the moment, so we can't backout yet -- I'm intending to back out when it reopens, but if I don't get to it, anyone else can feel free to do so.
Flags: in-testsuite+ → in-testsuite?
Target Milestone: mozilla32 → ---
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(In reply to Daniel Holbert [:dholbert] from comment #18) > This most recent landing regressed bug 439462 (as described in now-duplicate > bug 1014807). So, we should back this out for now (smontagu agrees per bug > 1014807 comment 5). The tree's closed at the moment, so we can't backout > yet -- I'm intending to back out when it reopens, but if I don't get to it, > anyone else can feel free to do so. This sounds similar to bug 465574 comment 6 -- which pointed to bug 439567 -- which I'm actually not sure is fixed. Does fixing that allow this to make progress?
Note that an attempt to reland this also needs to remove the code added in bug 1242781, i.e., https://hg.mozilla.org/mozilla-central/rev/9d85d87c1179 .

The bug assignee didn't login in Bugzilla in the last 7 months, so the assignee is being reset.

Assignee: smontagu → nobody
Severity: normal → S3

This patch is based on the previous attempt [1] in this bug, and removes the
code added in Bug 1242781.

The test_bug1216483.html change is worth an explanation. Each sub-test verifies
the blinking cursor (caret) position after pressing down arrow key in an
contenteditable container. The expected position is to the right of the letter
"a". Before this patch, the (anchorNode, anchorOffset) was
("element with '.second' style", 1). After this patch, it becomes
("a", 1), which is a valid representation of the caret position and
matches Google Chrome's behavior.

[1] https://hg.mozilla.org/mozilla-central/rev/c3f1ab75ea51

Assignee: nobody → aethanyc
Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/b58abcb2d3d7 Remove the hack that forces all <br> frames to be 1 app unit wide. r=emilio

Backed out for causing multiple failures.

Flags: needinfo?(aethanyc)

After apply the previous patch D238162, the return value of
getBoundingClientRect() can be different since the <br> do not have any
width.

This patch does not change any test expectation. It only fixed the y coordinate
passing to focusEditableField so that the call can be successful on the
grid-template-area value span, stored in gridRuleProperty.

Add a separate patch to fix the dt failures for a devtools test.

Flags: needinfo?(aethanyc)
Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/1d7a534b3e86 Remove the hack that forces all <br> frames to be 1 app unit wide. r=emilio https://hg.mozilla.org/integration/autoland/rev/202dc9cb8c22 Fix y coordinate when calling focusEditableField in browser_rules_grid-template-areas.js. r=devtools-reviewers,nchevobbe
Flags: needinfo?(aethanyc)
Depends on: 1948819

The patch causes a regression in AccessibleCaret. Luckily, test_accessiblecaret_cursor_mode.py detected it. Filed bug 1948819 to investigate.

Flags: needinfo?(aethanyc)
Blocks: 1948819
No longer depends on: 1948819
Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/6448e1fd65ee Remove the hack that forces all <br> frames to be 1 app unit wide. r=emilio https://hg.mozilla.org/integration/autoland/rev/a7b8caf56dfd Fix y coordinate when calling focusEditableField in browser_rules_grid-template-areas.js. r=devtools-reviewers,nchevobbe
Status: REOPENED → RESOLVED
Closed: 11 years ago11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 137 Branch
No longer blocks: 1663035
Duplicate of this bug: 1663035
No longer blocks: 465574, 1242781
See Also: → 465574, 1242781
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: