Closed
Bug 399531
Opened 17 years ago
Closed 17 years ago
Soft hyphen regressions and incorrect outline on spans containing line-breaks
Categories
(Core :: Layout: Text and Fonts, defect, P1)
Core
Layout: Text and Fonts
Tracking
()
RESOLVED
FIXED
People
(Reporter: roc, Assigned: roc)
References
Details
(Keywords: regression, testcase, Whiteboard: [dbaron-1.9:RwCt])
Attachments
(2 files, 1 obsolete file)
97 bytes,
text/html
|
Details | |
22.99 KB,
patch
|
dbaron
:
review+
dbaron
:
superreview+
|
Details | Diff | Splinter Review |
The first issue is that I stupidly forgot to include layout/reftests/text/reftest.list in the master reftest.list so those tests weren't being run, so they regressed. In particular the soft-hyphen tests are currently broken. The problem is that we need to have TrimTrailingWhiteSpace be able to set TEXT_HYPHEN_BREAK in the text frame, if the text frame couldn't tell that it was at the end of the line during its reflow. There's a secondary problem that the reference page should use U+2010 as its hyphen since that's what the textframe code prefers. Adding a hyphen in TrimTrailingWhitespace means we need to update our overflow area, so I added a hook for that to TrimTrailingWhiteSpace. And since I was changing that signature I took the opportunity to move it to nsTextFrame.h out of nsIFrame. This update to the overflow area also fixes an existing bug I noticed earlier where in some cases the outline for an inline element can include space for a trimmed-away space. I'll add a testcase that shows this on trunk.
Assignee | ||
Comment 1•17 years ago
|
||
This fixes it. I'll add the testcase in this bug as a reftest too.
Attachment #284567 -
Flags: superreview?(dbaron)
Attachment #284567 -
Flags: review?(dbaron)
Attachment #284567 -
Flags: approval1.9?
Updated•17 years ago
|
Keywords: regression,
testcase
Assignee | ||
Comment 2•17 years ago
|
||
Requesting blocking on the grounds that this is a bug in a new feature (and actually a regression that should have been picked up by reftests already).
Flags: blocking1.9?
Assignee | ||
Updated•17 years ago
|
Flags: blocking1.9? → blocking1.9+
Assignee | ||
Updated•17 years ago
|
Whiteboard: [needs review]
Comment 3•17 years ago
|
||
Comment on attachment 284567 [details] [diff] [review] fix (Please wait until after review before asking for approval)
Attachment #284567 -
Flags: approval1.9?
Whiteboard: [needs review] → [needs review][dbaron-1.9:RwCt]
Assignee | ||
Comment 4•17 years ago
|
||
This rotted...
Attachment #284567 -
Attachment is obsolete: true
Attachment #287522 -
Flags: superreview?(dbaron)
Attachment #287522 -
Flags: review?(dbaron)
Attachment #284567 -
Flags: superreview?(dbaron)
Attachment #284567 -
Flags: review?(dbaron)
Assignee | ||
Updated•17 years ago
|
Attachment #287522 -
Attachment is patch: true
Attachment #287522 -
Attachment mime type: application/text → text/plain
Comment on attachment 287522 [details] [diff] [review] updated to trunk >+ // Method that is called for a nonempty text frame that is logically ... but you're changing nsLineLayout so that it is called for empty text frames. (Why? When would such a text frame be trimmed?) >+ // an amount to *subtract* from the frame's width (zero if !mTrimmed) Not sure what !mTrimmed means, given that mTrimmed only exists as an nsTextFrame::TrimmedOffsets member of ClusterIterator. > if (!mTextRun) >- return NS_ERROR_FAILURE; >+ return result; How about an NS_ENSURE_TRUE so that there's some warning if this fails?
Ah, if you need to include empty text frames because those with only a soft hyphen show up as empty at that point, could you add a comment saying so?
> // aDeltaWidth is *subtracted* from our width.
> // If advanceDelta is positive then setting the line break made us longer,
> // so aDeltaWidth could go negative.
>- aDeltaWidth = NSToCoordFloor(delta - advanceDelta);
>+ result.mDeltaWidth = NSToCoordFloor(delta - advanceDelta);
What about delta being negative due to a soft-hyphen?
Assignee | ||
Comment 8•17 years ago
|
||
(In reply to comment #6) > (From update of attachment 287522 [details] [diff] [review]) > >+ // Method that is called for a nonempty text frame that is logically > > ... but you're changing nsLineLayout so that it is called for empty text > frames. Sorry, strike "nonempty" there. > (Why? When would such a text frame be trimmed?) Hello <span> </span> The single-space textframe will be trimmed and so will the "Hello " textframe. > >+ // an amount to *subtract* from the frame's width (zero if !mTrimmed) > > Not sure what !mTrimmed means, given that mTrimmed only exists as an > nsTextFrame::TrimmedOffsets member of ClusterIterator. I think I meant !mChanged there. > > if (!mTextRun) > >- return NS_ERROR_FAILURE; > >+ return result; > > How about an NS_ENSURE_TRUE so that there's some warning if this fails? OK. > Ah, if you need to include empty text frames because those with only a soft > hyphen show up as empty at that point, could you add a comment saying so? OK. > What about delta being negative due to a soft-hyphen? I should change the comment and the warning so they only apply when a soft hyphen is not present. Under normal circumstances, if we break at a soft hyphen, it's because we recorded a break opportunity there and at that time we will have correctly noted whether the hyphen fits in the available width or not, which will affect which potential break is recorded/chosen (see nsLineLayout::NotifyOptionalBreakPosition). So making the frame wider here should be OK. If we make the frame wider because shaping changed with the text at the end of the line, *then* we have a problem because that would not have been accounted for during reflow.
(In reply to comment #8) > Hello <span> </span> > > The single-space textframe will be trimmed and so will the "Hello " textframe. Ah, ok, so single-space text frames are counted as empty here. > > Ah, if you need to include empty text frames because those with only a soft > > hyphen show up as empty at that point, could you add a comment saying so? > > OK. I'm not sure if it's even true. Is it?
Assignee | ||
Comment 10•17 years ago
|
||
(In reply to comment #9) > (In reply to comment #8) > > Hello <span> </span> > > > > The single-space textframe will be trimmed and so will the "Hello " textframe. > > Ah, ok, so single-space text frames are counted as empty here. Yeah, it's a "logically empty" (collapsed-away) textframe. > > > Ah, if you need to include empty text frames because those with only a soft > > > hyphen show up as empty at that point, could you add a comment saying so? > > > > OK. > > I'm not sure if it's even true. Is it? It's true that that's why I had to start calling TrimTrailingWhiteSpace on "logically empty" textframes.
Comment on attachment 287522 [details] [diff] [review] updated to trunk ok, r+sr=dbaron with the above comments
Attachment #287522 -
Flags: superreview?(dbaron)
Attachment #287522 -
Flags: superreview+
Attachment #287522 -
Flags: review?(dbaron)
Attachment #287522 -
Flags: review+
Assignee | ||
Comment 12•17 years ago
|
||
Checked in.
Status: NEW → RESOLVED
Closed: 17 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Whiteboard: [needs review][dbaron-1.9:RwCt] → [dbaron-1.9:RwCt]
You need to log in
before you can comment on or make changes to this bug.
Description
•