Closed
Bug 392785
Opened 17 years ago
Closed 17 years ago
overflowed underline sometimes is not repainted at scrolling
Categories
(Core :: Layout: Block and Inline, defect, P4)
Tracking
()
RESOLVED
FIXED
People
(Reporter: masayuki, Assigned: masayuki)
References
(Blocks 1 open bug)
Details
(Whiteboard: [dbaron-1.9:Rw])
Attachments
(2 files, 15 obsolete files)
(deleted),
text/html
|
Details | |
(deleted),
patch
|
Details | Diff | Splinter Review |
This is remaining bug of bug 365414.
At scrolling, the bug still be reproduced, but I don't find the cause yet...
# when you drag the scrollbar on the attached testcase, you can see this bug.
Assignee | ||
Updated•17 years ago
|
Flags: blocking1.9?
Assignee | ||
Comment 1•17 years ago
|
||
er, the testcase is for windows.
Assignee | ||
Comment 2•17 years ago
|
||
I can reproduce this bug on the result of search of Google :-(
Comment 3•17 years ago
|
||
Is this a regression?
Assignee | ||
Comment 4•17 years ago
|
||
maybe, but I'm not sure.
I cannot reproduce this bug on Fx2 with the testcase.
Updated•17 years ago
|
Flags: blocking1.9? → blocking1.9+
Comment 5•17 years ago
|
||
I see on both Windows XP and Windows Vista.
Specifically, I'm seeing a few lines that are missing the underline below both "parent" strings, towards the end of the document when I scroll to the end.
Updated•17 years ago
|
Whiteboard: [dbaron-1.9:Rw]
Priority: -- → P2
Comment 6•17 years ago
|
||
I think we should fix this by making text decorations part of the overflow area. Does that seem reasonable?
Yeah. I thought masayuki had a patch for that somewhere
Assignee | ||
Comment 8•17 years ago
|
||
(In reply to comment #7)
> Yeah. I thought masayuki had a patch for that somewhere
No, I was not working on this... I'm not sure why this can be reproduced at scrolling...
Assignee | ||
Comment 9•17 years ago
|
||
This bug is only reproduced at quirks mode.
Assignee | ||
Comment 10•17 years ago
|
||
This patch works fine on most sites, but I can reproduce this bug on google-ja...
Google-ja is using "font-family: arial,sans-serif;". The font fallback is a cause??
Assignee | ||
Comment 11•17 years ago
|
||
er, I see what is a cause, please wait.
Comment 12•17 years ago
|
||
I'd actually started working on this yesterday, but it looks like you've gotten farther.
We should do the same for nsHTMLContainerFrame as well, which requires figuring out which Reflow methods to touch, since it has a BuildDisplayList method that may not be overridden by frames that do override Reflow. (And there, the aPresContext arguments to GetTextDecorations, HasTextFrameDescendant, and HasTextFrameDescendantOrInFlow could be removed.)
I'd note that in the code you moved into HasTextDecorations, you can remove the |hasDecorations| variable and just use context->HasTextDecorations().
Assignee | ||
Comment 13•17 years ago
|
||
o.k. this patch fixes this bug.
Assignee: nobody → masayuki
Attachment #289010 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #289024 -
Flags: superreview?(roc)
Attachment #289024 -
Flags: review?(roc)
Assignee | ||
Comment 14•17 years ago
|
||
er, if we can check whether the textframe is in editor,
I can improve |nsTextFrame::UnionTextDecorationOverflow|...
Comment 15•17 years ago
|
||
(And for what it's worth, I found the code in nsCSSRendering::PaintDecorationLine rather complicated -- so you need to be careful to match exactly the area that it draws.)
Assignee | ||
Comment 16•17 years ago
|
||
Comment on attachment 289024 [details] [diff] [review]
Patch rv1.0
oops, I don't check the dbaron's comment...
Attachment #289024 -
Flags: superreview?(roc)
Attachment #289024 -
Flags: review?(roc)
Assignee | ||
Comment 17•17 years ago
|
||
(In reply to comment #15)
> (And for what it's worth, I found the code in
> nsCSSRendering::PaintDecorationLine rather complicated -- so you need to be
> careful to match exactly the area that it draws.)
Yes. I wrote it...
Assignee | ||
Comment 18•17 years ago
|
||
Thank you, dbaron. I'm reading the code of nsHTMLContainerFrame now. This patch that is for quirks mode doesn't obstruct it, so we can land this first.
Attachment #289024 -
Attachment is obsolete: true
Attachment #289031 -
Flags: superreview?(roc)
Attachment #289031 -
Flags: review?(roc)
Assignee | ||
Updated•17 years ago
|
Attachment #289031 -
Attachment description: Patch rv1.1 → Patch rv1.1 (for quirks mode)
Assignee | ||
Comment 19•17 years ago
|
||
sorry for the spam.
Attachment #289031 -
Attachment is obsolete: true
Attachment #289032 -
Flags: superreview?(roc)
Attachment #289032 -
Flags: review?(roc)
Attachment #289031 -
Flags: superreview?(roc)
Attachment #289031 -
Flags: review?(roc)
Don't pass aPresContext to RecomputeOverflowRect. The frame can always just call PresContext(). It's OK to pass it to UnionTextDecorationOverflow and HasTextDecorations because these are private methods so adding parameters to them is not such a big deal. It's important to keep exposed interfaces as simple as
possible.
I think UnionTextDecorationOverflow should get the fontgroup from mTextRun. Then we don't need that comment in PropertyProvider.
+ PRBool HasTextDecorations(nsPresContext* aPresContext,
+ PRUint8* aDecorations,
+ nscolor* aOverColor = nsnull,
+ nscolor* aUnderColor = nsnull,
+ nscolor* aStrikeColor = nsnull);
Call this GetTextDecorations. Also, create a struct to return the three colors and the mask as a direct result. Instead of returning false, you can just return NS_STYLE_TEXT_DECORATION_NONE in the mask.
+ if (aOverflowRect->width == 0)
+ return;
+
Why are you doing this? Speed? I don't think it's worth optimizing for.
Do we reflow on text-decoration changes? It looks like we should, with this patch.
Should we move some of UnionTextDecorationOverflow to nsCSSRendering so that it can be next to the painting code it needs to mirror? Seems to me we want a function that takes similar parameters to PaintDecorationLine but returns the vertical extent of what's drawn.
Assignee | ||
Comment 21•17 years ago
|
||
This is better. |nsCSSRendering::PaintDecorationLine| is using the computing of overflow area. This makes simple code and bug-less code.
Attachment #289032 -
Attachment is obsolete: true
Attachment #289410 -
Flags: superreview?(roc)
Attachment #289410 -
Flags: review?(roc)
Attachment #289032 -
Flags: superreview?(roc)
Attachment #289032 -
Flags: review?(roc)
Assignee | ||
Comment 22•17 years ago
|
||
And I removed |aPreferredHeight| from |nsCSSRendering::PaintDecorationLine|. Because authors cannot control the decoration line height with CSS3 in latest draft. And it is used only at overline and strikeout-line. Their line height is not controlled by us too. So, we don't need it now.
Assignee | ||
Comment 23•17 years ago
|
||
It seems that I need to change |nsInlineFrame::ReflowFrames| for the overflow inline elements in standard mode:
> 588 // For now our overflow area is zero. The real value will be
> 589 // computed during vertical alignment of the line we are on.
> 590 aMetrics.mOverflowArea.SetRect(0, 0, 0, 0);
But roc, you have changed the overflow rect to this in bug 252771, so, it looks like that you don't want to change here... I think that there are two ways:
1. changing here, and if it's necessary, we recompute the overflow rect in nsLineLayout.
2. not changing here, we only compute overflow rect in nsLineLayout after the frame width is fixed. (But I don't found which is best point in nsLineLayout)
# And note that looks like that the testcase of bug 252771 is not works fine on latest trunk...
You want to do this in nsLineLayout::RelativePositionFrames where it does "// Compute a new combined area for the child span".
Assignee | ||
Comment 25•17 years ago
|
||
This patch fixes this bug completely (both quirks mode and standards mode).
I have a question, nsDisplayTextDecoration::GetBounds is not uses actual decoration rect, is it o.k.?
Attachment #289410 -
Attachment is obsolete: true
Attachment #290380 -
Flags: superreview?(roc)
Attachment #290380 -
Flags: review?(roc)
Attachment #289410 -
Flags: superreview?(roc)
Attachment #289410 -
Flags: review?(roc)
Assignee | ||
Comment 26•17 years ago
|
||
Oops, I forgot to change nsTextFrameThebes, it should also check the line-through area for very small font size.
Attachment #290380 -
Attachment is obsolete: true
Attachment #290381 -
Flags: superreview?(roc)
Attachment #290381 -
Flags: review?(roc)
Attachment #290380 -
Flags: superreview?(roc)
Attachment #290380 -
Flags: review?(roc)
Assignee | ||
Comment 27•17 years ago
|
||
Sorry for the spam...
Attachment #290381 -
Attachment is obsolete: true
Attachment #290382 -
Flags: superreview?(roc)
Attachment #290382 -
Flags: review?(roc)
Attachment #290381 -
Flags: superreview?(roc)
Attachment #290381 -
Flags: review?(roc)
Assignee | ||
Comment 28•17 years ago
|
||
oops, I forgot to change the IID of nsIDeviceContext, it will be changed next patch (after review).
Assignee | ||
Comment 29•17 years ago
|
||
roc:
Would you review this?
This is going to cause reflows on hovering links in pages that style links to not have an underline but be underlined on hover --- something I think is quite common. But I think those reflows will be fast enough (and asynchronous) so this won't be a significant problem.
ComputeTightBounds needs to call UnionTextDecorationOverflow.
+nsTextFrame::UnionTextDecorationOverflow(
+ nsPresContext* aPresContext,
+ const gfxTextRun::Metrics& aTextMetrics,
+ nsRect* aOverflowRect)
+{
+ EnsureTextRun();
I think it makes more sense to require callers to have called EnsureTextRun before we get here. So just add an assertion that mTextRun is not null.
+ // XXX the members of gfxTextRun::Metrics are in nscoord but the type is
+ // gfxFloat...
"appunits" not "nscoord". I actually don't think this needs an XXX comment.
If we always add the IME underline size to every frame, and that underline overflows the regular frame bounds, then this is going to hurt performance *very* badly because almost every frame in the tree will have to have an overflow area property. We can't allow that, we have to find another way.
Spellcheck changes will call nsTextFrame::SetSelected, do IME underline changes also call SetSelected? If so then UnionTextDecorationOverflow could check NS_FRAME_SELECTED_CONTENT, we'd also have to arrange to have selection changes reflow but I think that might be OK.
GetTextDecorationRect and GetTextDecorationRectInternal should just return a gfxRect directly.
Do we really need to round the decoration x and width? I don't think so. If so then GetTextDecorationRect doesn't really need to deal with width values, it only needs to work in the vertical direction, so it can take a height instead of a size and return two gfxFloats instead of a gfxRect.
Can we share code between nsLineLayout::CombineTextDecorations and UnionTextDecorationOverflow?
Maybe the way to deal with the IME underline problem is to add the text decoration size to the ascent and descent of the text frame instead of the overflow area. That wouldn't create a performance problem. It might change line spacing in a visible way though, not sure how serious that would be. How much do the IME underlines extend outside the font-box, usually?
Assignee | ||
Comment 32•17 years ago
|
||
(In reply to comment #31)
> Do we really need to round the decoration x and width? I don't think so. If so
> then GetTextDecorationRect doesn't really need to deal with width values, it
> only needs to work in the vertical direction, so it can take a height instead
> of a size and return two gfxFloats instead of a gfxRect.
I think yes. We need to do. Because line start/end might be AAed or lacked.
> How much do the IME underlines extend outside the font-box, usually?
On Mac, the ratio is 2. So, it is double size of the default underline size... It's too large height.
I have a question, do we need reflow for overflow computing? So, it seems that the DisplayList always refer the latest information of the frame. So, cannot include the IME/spellchecking underline height at directly?
Yes, we do need to reflow to recompute overflow, unfortunately.
Assignee | ||
Comment 34•17 years ago
|
||
This patch checking the nsIFrame::mState for IME/spellchecking.
I'm not sure that the params of FrameNeedsReflow is correct, please check it.
Attachment #290382 -
Attachment is obsolete: true
Attachment #290843 -
Flags: superreview?(roc)
Attachment #290843 -
Flags: review?(roc)
Attachment #290382 -
Flags: superreview?(roc)
Attachment #290382 -
Flags: review?(roc)
Hmm, I think this approach should work. Good!
+ if (needReflow) {
+ PresContext()->PresShell()->FrameNeedsReflow(this,
+ nsIPresShell::eStyleChange,
+ NS_FRAME_IS_DIRTY);
+ } else {
+ // Selection might change anything. Invalidate the overflow area.
+ Invalidate(GetOverflowRect(), PR_FALSE);
+ }
We should always invalidate, because a reflow is not guaranteed to repaint the entire frame.
The definitions of GfxUnitsToAppUnits in comments should say that the coordinates are rounded to the nearest appunit.
+ PRBool needReflow = oldState != mState;
+ if (needReflow) {
+ // However, if the non-selected text already has underline, we don't need
+ // to reflow.
+ TextDecorations decorations = GetTextDecorations(aPresContext);
+ needReflow =
+ !(decorations.mDecorations & NS_STYLE_TEXT_DECORATION_UNDERLINE);
+ if (!needReflow) {
+ // However, if the IME underline is thicker than normal underline,
+ // we need to reflow.
+ nsILookAndFeel* look = aPresContext->LookAndFeel();
+ float ratio;
+ look->GetMetric(nsILookAndFeel::eMetricFloat_IMEUnderlineRelativeSize,
+ ratio);
+ needReflow = ratio > 1.0;
+ }
This would be clearer if it was written as a big boolean expression.
I'll have another look through this tomorrow.
Assignee | ||
Comment 36•17 years ago
|
||
updating for comment 35.
Attachment #290843 -
Attachment is obsolete: true
Attachment #290868 -
Flags: superreview?(roc)
Attachment #290868 -
Flags: review?(roc)
Attachment #290843 -
Flags: superreview?(roc)
Attachment #290843 -
Flags: review?(roc)
+ r.x = aPresContext->GfxUnitsToAppUnits(rect.X());
+ r.y = aPresContext->GfxUnitsToAppUnits(rect.Y());
+ r.width = aPresContext->GfxUnitsToAppUnits(rect.Width());
+ r.height = aPresContext->GfxUnitsToAppUnits(rect.Height());
Should probably use ScaleRoundOut here somehow.
Assignee | ||
Comment 38•17 years ago
|
||
(In reply to comment #37)
> + r.x = aPresContext->GfxUnitsToAppUnits(rect.X());
> + r.y = aPresContext->GfxUnitsToAppUnits(rect.Y());
> + r.width = aPresContext->GfxUnitsToAppUnits(rect.Width());
> + r.height = aPresContext->GfxUnitsToAppUnits(rect.Height());
>
> Should probably use ScaleRoundOut here somehow.
I don't think so, because the rect is already rounded by nsCSSRendering::GetTextDecorationRectInternal.
Comment on attachment 290868 [details] [diff] [review]
Patch rv4.1
OK add a comment explaining why no rounding is needed.
Attachment #290868 -
Flags: superreview?(roc)
Attachment #290868 -
Flags: superreview+
Attachment #290868 -
Flags: review?(roc)
Attachment #290868 -
Flags: review+
Assignee | ||
Comment 40•17 years ago
|
||
checked-in.
-> FIXED
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 41•17 years ago
|
||
Attachment #290868 -
Attachment is obsolete: true
Comment 42•17 years ago
|
||
Could this have regressed bug 406729?
Comment 43•17 years ago
|
||
Backed out at the request of roc & mconnor; reopening.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 44•17 years ago
|
||
The cause of bug 406642 is that FAYT uses nsTextFrame::GetPointFromOffset during dirty via Scroll. This issue should be fixed in FAYT? or nsTextFrame?
Assignee | ||
Comment 45•17 years ago
|
||
This patch fixes bug 406642. But this patch might need the patch of bug 402524.
Attachment #291219 -
Attachment is obsolete: true
Attachment #291844 -
Flags: superreview?(roc)
Attachment #291844 -
Flags: review?(roc)
Assignee | ||
Comment 46•17 years ago
|
||
Comment on attachment 291844 [details] [diff] [review]
Patch rv4.2
Umm.... The some other points need the same change...
Attachment #291844 -
Flags: superreview?(roc)
Attachment #291844 -
Flags: review?(roc)
Attachment #291844 -
Flags: review-
Assignee | ||
Comment 47•17 years ago
|
||
This is only additional part after rv4.1.1. These points are changing the selection range before ScrollSelectionIntoView.
Attachment #291844 -
Attachment is obsolete: true
Attachment #291847 -
Flags: superreview?(roc)
Attachment #291847 -
Flags: review?(roc)
Assignee | ||
Updated•17 years ago
|
Attachment #291219 -
Attachment is obsolete: false
Assignee | ||
Comment 48•17 years ago
|
||
I confirmed that the patch of bug 402524 fixes bug 406729, so, we can reland the patch of this bug after bug 402524.
Attachment #291847 -
Flags: superreview?(roc)
Attachment #291847 -
Flags: superreview+
Attachment #291847 -
Flags: review?(roc)
Attachment #291847 -
Flags: review+
Updated•17 years ago
|
Priority: P2 → P4
Assignee | ||
Comment 49•17 years ago
|
||
updating for latest trunk and merged the additional patch.
Attachment #291219 -
Attachment is obsolete: true
Attachment #291847 -
Attachment is obsolete: true
Assignee | ||
Comment 50•17 years ago
|
||
oops, this is correct, sorry for the spam.
Attachment #302827 -
Attachment is obsolete: true
Assignee | ||
Comment 51•17 years ago
|
||
gfx part was forgotten in previous patch...
Attachment #302828 -
Attachment is obsolete: true
Assignee | ||
Comment 52•17 years ago
|
||
roc:
I want to land this. Is it OK? That makes to reopen bug 406729, because bug 402524 is still under reviewing.
But I can work for bug 417014 and bug 412251.
And this patch is risky. I want to land ASAP.
It would really be better if we don't regress anything even for a short time. We should be able to get Stuart to review bug 402524 tomorrow.
Assignee | ||
Comment 54•17 years ago
|
||
bug 402524 is fixed now, I'll land this after some hours if there are no problem in bug 402524.
Assignee | ||
Comment 55•17 years ago
|
||
checked-in.
Status: REOPENED → RESOLVED
Closed: 17 years ago → 17 years ago
Resolution: --- → FIXED
Comment 56•17 years ago
|
||
This was a ~4ms Ts regression on Linux at least.
Assignee | ||
Comment 57•17 years ago
|
||
(In reply to comment #56)
> This was a ~4ms Ts regression on Linux at least.
It's strange. I guessed that if the patch has performance regression, it is tp damage. At starting-up, we need/run such many text reflow/rendering??
Comment 58•17 years ago
|
||
I believe this has caused bug 419531
Comment 59•17 years ago
|
||
Has this caused bug 421782? Looking into bonsai and ftp it looks it was landed before firefox trunk build but after seamonkey trunk build on 20080216. And that are exactly the builds that first show and last don't show the slowdown respectively.
You need to log in
before you can comment on or make changes to this bug.
Description
•