Closed Bug 803383 Opened 12 years ago Closed 12 years ago

xul:panels not always in HiDPI mode on HiDPI displays

Categories

(Core :: Widget: Cocoa, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla19
Tracking Status
firefox18 --- fixed
firefox19 --- fixed

People

(Reporter: Dolske, Assigned: jfkthame)

References

(Blocks 1 open bug)

Details

(Whiteboard: STR in comment #9 / comment #31)

Attachments

(4 files)

The flyout panels used by the SocialAPI sidebar sometimes, but not always, look bad on my HiDPI (Retina) display. Curiously, I've never seen this with the arrow panels used elsewhere in browser chrome (eg identity panel, bookmark-star panel). So not sure what's different that causes problems with Social's panels.
Note that this and the the last "bad" attachments illustrate the two different behaviors I've seen.

The text in #1 looks like how we drew text before hidpi support landed. It's fuzzy (being pixel-doubled), but otherwise kind of readable. The text in #2 just looks horrible, but I'm not sure what exactly is going on.
I'll additionally note that sometimes I can get a displayed panel to repaint parts correctly. EG by clicking in the "comment" box at the bottom and typing. But other times it stays broken, and even newly-typed text is rendered poorly.
Blocks: osx-hidpi
I assume what you mean by "looks bad" is that the resolution is too low.

Do you have multiple monitors?  If so please test with just one monitor (your HiDPI monitor) attached.

For the record, please tell us how to use the "SocialAPI sidebar":  How to install it (if that's needed), where it is in the menus, whether you need an account, and so forth.
The screenshots above were taken with only 1 monitor attached.

Not sure how to get the social sidebar up and running for testing... Gavin/Jared?
(In reply to Steven Michaud from comment #4)
> For the record, please tell us how to use the "SocialAPI sidebar":  How to
> install it (if that's needed), where it is in the menus, whether you need an
> account, and so forth.

Log in to Facebook, and go to about:config and set social.active=true and social.enabled=true. The sidebar will be shown by default.
I don't use Facebook -- all I have is a testing account that I use to deal with bugs like this one.  It has exactly one "friend".

Following the instructions in comment #6, I've now got the Social API sidebar to show up, which displays my testing account's one "friend".  But I can't figure out how to display a balloon (as per this bug's screenshots).  Just hovering the mouse won't do it.
Hovering should work, though sometimes it can take a few seconds for the flyout panel to appear. Oh, there are two parts to the Facebook sidebar, though. The top is for status messages (with flyouts), the bottom has a friend list (for chat). Try having your "friend" post something on their wall? Or friend me, I don't bite. :-)
I'm also seeing this with the arrow panels that appear using the tos;dr add-on:
https://addons.mozilla.org/en-US/firefox/addon/terms-of-service-didnt-read/

Install the add-on, visit github.com, then click on the "B" icon in the location bar.
Thanks, Margaret.  Your STR works for me 100% of the time -- I always see a flyout that's not in HiDPI mode.

So I'm going to forget about Facebook and the SocialAPI, at least for the time being.
Summary: SocialAPI panels sometimes look terrible on HiDPI displays → Extension flyouts not always in HiDPI mode on HiDPI displays
Whiteboard: STR in comment #9
Summary: Extension flyouts not always in HiDPI mode on HiDPI displays → xul:panels not always in HiDPI mode on HiDPI displays
It's interesting to note that the text in the tos;dr panel snaps into HiDPI rendering if I select it, or (usually) if I click in the scrollbar; it doesn't generally do so if I scroll by two-finger swipe, or by dragging the scroll indicator, though.

See also bug 806059, which might turn out to be related in some way.
I find that I can make the text change to HiDPI mode by scrolling quickly (using either the scrollbar or the two-finger swipe), but not by scrolling slowly.

Yes, this bug is weird :-)

I wonder if it's some kind of timing problem.

Note that (in current code) no popup windows use hardware acceleration (i.e. OpenGL).  This bug goes away if you make them do so, but other problems occur.
I suspect the explanation for this bug is buried somewhere in the OS.  So I've been playing with undocumented features of NSViews and CGContextRefs, to see which of them changes when text is displayed correctly (in HiDPI mode) and incorrectly (not in HiDPI mode).  So far I haven't found anything, but I'll keep trying (next week).
What I'm struggling to figure out at the moment is how the CGContextGetUserSpaceToDeviceSpaceTransform gets determined or changed. I'm seeing it change between when a CGContextRef is created (e.g. in one of the gfxQuartzSurface constructors) and when it's subsequently used (e.g. in nsNativeThemeCocoa::Draw<something>), but I'm not clear how/when/why this happens.
BTW, if you have a (non-HiDPI) secondary display attached, and drag the Nightly window over there, then open the tos;dr panel, you'll see a far more glaring issue: all the text in the panel is hugely oversized, as though the font size is being set as if it were a hidpi context.

(Social flyouts don't seem to suffer from this problem, however.)
I'm getting the impression this issue is associated with the animation or transition that's being used to bring the panel on-screen. It doesn't seem to happen when a panel's contents snap instantly into view, but it does happen when the panel "fades in" (tos;dr) or "slides in" from the sidebar (social).

So I suspect we may be going through a non-HiDPI buffer somewhere while handling the animation/transition. But I don't really know anything about that code (yet)...
(In reply to comment #16)

Jonathan, I think you're onto something.

I can make the bug go away by replacing the original binding for "arrowpanel" (in toolkit/content/widgets/popup.xml) for one that's a copy of the "panel" binding.

The real problem is (of course) at a much lower level.  But at least now I have something to play with.
I've found I can "fix" this bug by deleting the following line:
http://hg.mozilla.org/mozilla-central/annotate/c6ccd1d30c15/toolkit/content/widgets/popup.xml#l328

Which presumably means that the terms-of-service-didnt-read extension adds something there (to the <children/> element) that (indirectly) makes this bug happen.  But I haven't been able to figure out what gets added.  The built-in Inspector won't "inspect" the extension's arrowpanel.

Anyone have any ideas?
Note that starting from the 2012-10-30 nightly build (from mozilla-central), the tos;dr panel is appearing entirely blank for me. It worked (subject to the low-dpi issue here) until 2012-10-29.

SocialAPI panels are still working, however.
tos;dr was broken by bug 803068; filed bug 807623 about that. For testing, using a mozilla-central tree from before 803068 landed is probably the simplest solution.

I've confirmed that the text for the tos;dr panel is being shaped for HiDPI rendering (gfxFont::GetShapedWord is called withaAppUnitsPerDevUnit = 30, which is characteristic of HiDPI mode, and the text is being shaped with a font size of 24, although it's going to appear at at nominal size of 12px).

However, look at the callstack when this happens:
#0  gfxFont::ShapeWord (this=0x10eee6700, aContext=0x120530480, aShapedWord=0x11e9d4680, aText=0x7fff5fbeaba8, aPreferPlatformShaping=true) at /Users/jkew/mozdev/mozilla-central/gfx/thebes/gfxFont.cpp:2428
#1  0x00000001038d1a0a in gfxMacFont::ShapeWord (this=0x10eee6700, aContext=0x120530480, aShapedWord=0x11e9d4680, aText=0x7fff5fbeaba8, aPreferPlatformShaping=false) at /Users/jkew/mozdev/mozilla-central/gfx/thebes/gfxMacFont.cpp:135
#2  0x0000000103896c2e in gfxFont::GetShapedWord<unsigned char> (this=0x10eee6700, aContext=0x120530480, aText=0x7fff5fbec945 "happen any time, sometimes without notice ", aLength=6, aHash=115766846, aRunScript=25, aAppUnitsPerDevUnit=30, aFlags=32) at /Users/jkew/mozdev/mozilla-central/gfx/thebes/gfxFont.cpp:2367
#3  0x000000010389b567 in gfxFont::SplitAndInitTextRun<unsigned char> (this=0x10eee6700, aContext=0x120530480, aTextRun=0x1251c6560, aString=0x7fff5fbec938 " Changes can happen any time, sometimes without notice ", aRunStart=0, aRunLength=55, aRunScript=25) at /Users/jkew/mozdev/mozilla-central/gfx/thebes/gfxFont.cpp:2555
#4  0x000000010389aec0 in gfxFontGroup::InitScriptRun<unsigned char> (this=0x1117fa6b0, aContext=0x120530480, aTextRun=0x1251c6560, aString=0x7fff5fbec938 " Changes can happen any time, sometimes without notice ", aScriptRunStart=0, aScriptRunEnd=55, aRunScript=25) at /Users/jkew/mozdev/mozilla-central/gfx/thebes/gfxFont.cpp:3717
#5  0x0000000103894de7 in gfxFontGroup::InitTextRun<unsigned char> (this=0x1117fa6b0, aContext=0x120530480, aTextRun=0x1251c6560, aString=0x7fff5fbec938 " Changes can happen any time, sometimes without notice ", aLength=55) at /Users/jkew/mozdev/mozilla-central/gfx/thebes/gfxFont.cpp:3615
#6  0x000000010388abe8 in gfxFontGroup::MakeTextRun (this=0x1117fa6b0, aString=0x7fff5fbec938 " Changes can happen any time, sometimes without notice ", aLength=55, aParams=0x7fff5fbeb430, aFlags=22020192) at /Users/jkew/mozdev/mozilla-central/gfx/thebes/gfxFont.cpp:3537
#7  0x000000010197ad8a in MakeTextRun<unsigned char> (aText=0x7fff5fbec938 " Changes can happen any time, sometimes without notice ", aLength=55, aFontGroup=0x1117fa6b0, aParams=0x7fff5fbeb430, aFlags=22020192) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsTextFrameThebes.cpp:552
#8  0x0000000101962258 in BuildTextRunsScanner::BuildTextRunForFrames (this=0x7fff5fbedc58, aTextBuffer=0x7fff5fbec96f) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsTextFrameThebes.cpp:2049
#9  0x0000000101960655 in BuildTextRunsScanner::FlushFrames (this=0x7fff5fbedc58, aFlushLineBreaks=false, aSuppressTrailingBreak=false) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsTextFrameThebes.cpp:1408
#10 0x0000000101962b28 in BuildTextRunsScanner::ScanFrame (this=0x7fff5fbedc58, aFrame=0x1215aab38) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsTextFrameThebes.cpp:1600
#11 0x0000000101962cc3 in BuildTextRunsScanner::ScanFrame (this=0x7fff5fbedc58, aFrame=0x1215aa928) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsTextFrameThebes.cpp:1640
#12 0x0000000101964d32 in BuildTextRuns (aContext=0x120530480, aForFrame=0x1215aa338, aLineContainer=0x1243eba38, aForFrameLine=0x7fff5fbef000, aWhichTextRun=nsTextFrame::eInflated) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsTextFrameThebes.cpp:1311
#13 0x00000001019640eb in nsTextFrame::EnsureTextRun (this=0x1215aa338, aWhichTextRun=nsTextFrame::eInflated, aReferenceContext=0x120530480, aLineContainer=0x1243eba38, aLine=0x7fff5fbef000, aFlowEndInTextRun=0x7fff5fbee720) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsTextFrameThebes.cpp:2465
#14 0x0000000101976055 in nsTextFrame::ReflowText (this=0x1215aa338, aLineLayout=@0x7fff5fbeefc8, aAvailableWidth=28260, aRenderingContext=0x11e9d40c0, aShouldBlink=false, aMetrics=@0x7fff5fbee900, aStatus=@0x7fff5fbeebec) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsTextFrameThebes.cpp:7768
#15 0x000000010192aa78 in nsLineLayout::ReflowFrame (this=0x7fff5fbeefc8, aFrame=0x1215aa338, aReflowStatus=@0x7fff5fbeebec, aMetrics=0x0, aPushedFrame=@0x7fff5fbeebeb) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsLineLayout.cpp:849
#16 0x000000010189d226 in nsBlockFrame::ReflowInlineFrame (this=0x1243eba38, aState=@0x7fff5fbefbb0, aLineLayout=@0x7fff5fbeefc8, aLine={mCurrent = 0x1215aaba8, mListLink = 0x1243ebab0}, aFrame=0x1215aa338, aLineReflowStatus=0x7fff5fbeeeb8) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:3707
#17 0x000000010189c5c3 in nsBlockFrame::DoReflowInlineFrames (this=0x1243eba38, aState=@0x7fff5fbefbb0, aLineLayout=@0x7fff5fbeefc8, aLine={mCurrent = 0x1215aaba8, mListLink = 0x1243ebab0}, aFloatAvailableSpace=@0x7fff5fbef0f0, aAvailableSpaceHeight=@0x7fff5fbef0e8, aFloatStateBeforeLine=0x7fff5fbef0c0, aKeepReflowGoing=0x7fff5fbef723, aLineReflowStatus=0x7fff5fbef0ec, aAllowPullUp=true) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:3503
#18 0x000000010189a841 in nsBlockFrame::ReflowInlineFrames (this=0x1243eba38, aState=@0x7fff5fbefbb0, aLine={mCurrent = 0x1215aaba8, mListLink = 0x1243ebab0}, aKeepReflowGoing=0x7fff5fbef723) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:3355
#19 0x0000000101897b37 in nsBlockFrame::ReflowLine (this=0x1243eba38, aState=@0x7fff5fbefbb0, aLine={mCurrent = 0x1215aaba8, mListLink = 0x1243ebab0}, aKeepReflowGoing=0x7fff5fbef723) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:2473
#20 0x000000010189410e in nsBlockFrame::ReflowDirtyLines (this=0x1243eba38, aState=@0x7fff5fbefbb0) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:1990
#21 0x0000000101891888 in nsBlockFrame::Reflow (this=0x1243eba38, aPresContext=0x1215aa400, aMetrics=@0x7fff5fbf03e0, aReflowState=@0x7fff5fbf0148, aStatus=@0x7fff5fbf012c) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:1042
#22 0x00000001018aac41 in nsBlockReflowContext::ReflowBlock (this=0x7fff5fbf03b0, aSpace=@0x7fff5fbf0240, aApplyTopMargin=false, aPrevMargin=@0x7fff5fbf0fa0, aClearance=0, aIsAdjacentWithTop=true, aLine=0x1215bfe08, aFrameRS=@0x7fff5fbf0148, aFrameReflowStatus=@0x7fff5fbf012c, aState=@0x7fff5fbf0ee0) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockReflowContext.cpp:268
#23 0x0000000101899823 in nsBlockFrame::ReflowBlockFrame (this=0x1243eb6c8, aState=@0x7fff5fbf0ee0, aLine={mCurrent = 0x1215bfe08, mListLink = 0x1243eb740}, aKeepReflowGoing=0x7fff5fbf0a53) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:3087
#24 0x0000000101897af0 in nsBlockFrame::ReflowLine (this=0x1243eb6c8, aState=@0x7fff5fbf0ee0, aLine={mCurrent = 0x1215bfe08, mListLink = 0x1243eb740}, aKeepReflowGoing=0x7fff5fbf0a53) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:2470
#25 0x000000010189410e in nsBlockFrame::ReflowDirtyLines (this=0x1243eb6c8, aState=@0x7fff5fbf0ee0) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:1990
#26 0x0000000101891888 in nsBlockFrame::Reflow (this=0x1243eb6c8, aPresContext=0x1215aa400, aMetrics=@0x7fff5fbf1710, aReflowState=@0x7fff5fbf1478, aStatus=@0x7fff5fbf145c) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:1042
#27 0x00000001018aac41 in nsBlockReflowContext::ReflowBlock (this=0x7fff5fbf16e0, aSpace=@0x7fff5fbf1570, aApplyTopMargin=false, aPrevMargin=@0x7fff5fbf22d0, aClearance=0, aIsAdjacentWithTop=true, aLine=0x1215bfe88, aFrameRS=@0x7fff5fbf1478, aFrameReflowStatus=@0x7fff5fbf145c, aState=@0x7fff5fbf2210) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockReflowContext.cpp:268
#28 0x0000000101899823 in nsBlockFrame::ReflowBlockFrame (this=0x1217dab88, aState=@0x7fff5fbf2210, aLine={mCurrent = 0x1215bfe88, mListLink = 0x1217dac00}, aKeepReflowGoing=0x7fff5fbf1d83) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:3087
#29 0x0000000101897af0 in nsBlockFrame::ReflowLine (this=0x1217dab88, aState=@0x7fff5fbf2210, aLine={mCurrent = 0x1215bfe88, mListLink = 0x1217dac00}, aKeepReflowGoing=0x7fff5fbf1d83) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:2470
#30 0x000000010189410e in nsBlockFrame::ReflowDirtyLines (this=0x1217dab88, aState=@0x7fff5fbf2210) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:1990
#31 0x0000000101891888 in nsBlockFrame::Reflow (this=0x1217dab88, aPresContext=0x1215aa400, aMetrics=@0x7fff5fbf2a40, aReflowState=@0x7fff5fbf27a8, aStatus=@0x7fff5fbf278c) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:1042
#32 0x00000001018aac41 in nsBlockReflowContext::ReflowBlock (this=0x7fff5fbf2a10, aSpace=@0x7fff5fbf28a0, aApplyTopMargin=false, aPrevMargin=@0x7fff5fbf3600, aClearance=0, aIsAdjacentWithTop=true, aLine=0x1217dafa8, aFrameRS=@0x7fff5fbf27a8, aFrameReflowStatus=@0x7fff5fbf278c, aState=@0x7fff5fbf3540) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockReflowContext.cpp:268
#33 0x0000000101899823 in nsBlockFrame::ReflowBlockFrame (this=0x1217dac20, aState=@0x7fff5fbf3540, aLine={mCurrent = 0x1217dafa8, mListLink = 0x1217dac98}, aKeepReflowGoing=0x7fff5fbf30b3) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:3087
#34 0x0000000101897af0 in nsBlockFrame::ReflowLine (this=0x1217dac20, aState=@0x7fff5fbf3540, aLine={mCurrent = 0x1217dafa8, mListLink = 0x1217dac98}, aKeepReflowGoing=0x7fff5fbf30b3) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:2470
#35 0x000000010189410e in nsBlockFrame::ReflowDirtyLines (this=0x1217dac20, aState=@0x7fff5fbf3540) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:1990
#36 0x0000000101891888 in nsBlockFrame::Reflow (this=0x1217dac20, aPresContext=0x1215aa400, aMetrics=@0x7fff5fbf3d70, aReflowState=@0x7fff5fbf3ad8, aStatus=@0x7fff5fbf3abc) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:1042
#37 0x00000001018aac41 in nsBlockReflowContext::ReflowBlock (this=0x7fff5fbf3d40, aSpace=@0x7fff5fbf3bd0, aApplyTopMargin=true, aPrevMargin=@0x7fff5fbf4930, aClearance=0, aIsAdjacentWithTop=true, aLine=0x1243ea5e8, aFrameRS=@0x7fff5fbf3ad8, aFrameReflowStatus=@0x7fff5fbf3abc, aState=@0x7fff5fbf4870) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockReflowContext.cpp:268
#38 0x0000000101899823 in nsBlockFrame::ReflowBlockFrame (this=0x1217dacb8, aState=@0x7fff5fbf4870, aLine={mCurrent = 0x1243ea5e8, mListLink = 0x1217dad30}, aKeepReflowGoing=0x7fff5fbf43e3) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:3087
#39 0x0000000101897af0 in nsBlockFrame::ReflowLine (this=0x1217dacb8, aState=@0x7fff5fbf4870, aLine={mCurrent = 0x1243ea5e8, mListLink = 0x1217dad30}, aKeepReflowGoing=0x7fff5fbf43e3) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:2470
#40 0x000000010189410e in nsBlockFrame::ReflowDirtyLines (this=0x1217dacb8, aState=@0x7fff5fbf4870) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:1990
#41 0x0000000101891888 in nsBlockFrame::Reflow (this=0x1217dacb8, aPresContext=0x1215aa400, aMetrics=@0x7fff5fbf50a0, aReflowState=@0x7fff5fbf4e08, aStatus=@0x7fff5fbf4dec) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:1042
#42 0x00000001018aac41 in nsBlockReflowContext::ReflowBlock (this=0x7fff5fbf5070, aSpace=@0x7fff5fbf4f00, aApplyTopMargin=true, aPrevMargin=@0x7fff5fbf5c60, aClearance=0, aIsAdjacentWithTop=false, aLine=0x120596aa8, aFrameRS=@0x7fff5fbf4e08, aFrameReflowStatus=@0x7fff5fbf4dec, aState=@0x7fff5fbf5ba0) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockReflowContext.cpp:268
#43 0x0000000101899823 in nsBlockFrame::ReflowBlockFrame (this=0x12357f510, aState=@0x7fff5fbf5ba0, aLine={mCurrent = 0x120596aa8, mListLink = 0x12357f588}, aKeepReflowGoing=0x7fff5fbf5713) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:3087
#44 0x0000000101897af0 in nsBlockFrame::ReflowLine (this=0x12357f510, aState=@0x7fff5fbf5ba0, aLine={mCurrent = 0x120596aa8, mListLink = 0x12357f588}, aKeepReflowGoing=0x7fff5fbf5713) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:2470
#45 0x000000010189410e in nsBlockFrame::ReflowDirtyLines (this=0x12357f510, aState=@0x7fff5fbf5ba0) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:1990
#46 0x0000000101891888 in nsBlockFrame::Reflow (this=0x12357f510, aPresContext=0x1215aa400, aMetrics=@0x7fff5fbf6150, aReflowState=@0x7fff5fbf5ee0, aStatus=@0x7fff5fbf5ed0) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:1042
#47 0x00000001018b8c72 in nsContainerFrame::ReflowChild (this=0x1217e95d0, aKidFrame=0x12357f510, aPresContext=0x1215aa400, aDesiredSize=@0x7fff5fbf6150, aReflowState=@0x7fff5fbf5ee0, aX=0, aY=0, aFlags=3, aStatus=@0x7fff5fbf5ed0, aTracker=0x0) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsContainerFrame.cpp:941
#48 0x00000001018f458e in nsHTMLScrollFrame::ReflowScrolledFrame (this=0x1217e95d0, aState=0x7fff5fbf62e0, aAssumeHScroll=false, aAssumeVScroll=false, aMetrics=0x7fff5fbf6150, aFirstPass=true) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsGfxScrollFrame.cpp:433
#49 0x00000001018f4da2 in nsHTMLScrollFrame::ReflowContents (this=0x1217e95d0, aState=0x7fff5fbf62e0, aDesiredSize=@0x7fff5fbf6a00) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsGfxScrollFrame.cpp:533
#50 0x00000001018f5bdd in nsHTMLScrollFrame::Reflow (this=0x1217e95d0, aPresContext=0x1215aa400, aDesiredSize=@0x7fff5fbf6a00, aReflowState=@0x7fff5fbf6768, aStatus=@0x7fff5fbf674c) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsGfxScrollFrame.cpp:774
#51 0x00000001018aac41 in nsBlockReflowContext::ReflowBlock (this=0x7fff5fbf69d0, aSpace=@0x7fff5fbf6860, aApplyTopMargin=true, aPrevMargin=@0x7fff5fbf75c0, aClearance=0, aIsAdjacentWithTop=false, aLine=0x1243eb438, aFrameRS=@0x7fff5fbf6768, aFrameReflowStatus=@0x7fff5fbf674c, aState=@0x7fff5fbf7500) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockReflowContext.cpp:268
#52 0x0000000101899823 in nsBlockFrame::ReflowBlockFrame (this=0x121df5450, aState=@0x7fff5fbf7500, aLine={mCurrent = 0x1243eb438, mListLink = 0x121df54c8}, aKeepReflowGoing=0x7fff5fbf7073) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:3087
#53 0x0000000101897af0 in nsBlockFrame::ReflowLine (this=0x121df5450, aState=@0x7fff5fbf7500, aLine={mCurrent = 0x1243eb438, mListLink = 0x121df54c8}, aKeepReflowGoing=0x7fff5fbf7073) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:2470
#54 0x000000010189410e in nsBlockFrame::ReflowDirtyLines (this=0x121df5450, aState=@0x7fff5fbf7500) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:1990
#55 0x0000000101891888 in nsBlockFrame::Reflow (this=0x121df5450, aPresContext=0x1215aa400, aMetrics=@0x7fff5fbf7d30, aReflowState=@0x7fff5fbf7a98, aStatus=@0x7fff5fbf7a7c) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:1042
#56 0x00000001018aac41 in nsBlockReflowContext::ReflowBlock (this=0x7fff5fbf7d00, aSpace=@0x7fff5fbf7b90, aApplyTopMargin=false, aPrevMargin=@0x7fff5fbf88f0, aClearance=0, aIsAdjacentWithTop=true, aLine=0x121df54e8, aFrameRS=@0x7fff5fbf7a98, aFrameReflowStatus=@0x7fff5fbf7a7c, aState=@0x7fff5fbf8830) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockReflowContext.cpp:268
#57 0x0000000101899823 in nsBlockFrame::ReflowBlockFrame (this=0x121df52c0, aState=@0x7fff5fbf8830, aLine={mCurrent = 0x121df54e8, mListLink = 0x121df5338}, aKeepReflowGoing=0x7fff5fbf83a3) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:3087
#58 0x0000000101897af0 in nsBlockFrame::ReflowLine (this=0x121df52c0, aState=@0x7fff5fbf8830, aLine={mCurrent = 0x121df54e8, mListLink = 0x121df5338}, aKeepReflowGoing=0x7fff5fbf83a3) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:2470
#59 0x000000010189410e in nsBlockFrame::ReflowDirtyLines (this=0x121df52c0, aState=@0x7fff5fbf8830) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:1990
#60 0x0000000101891888 in nsBlockFrame::Reflow (this=0x121df52c0, aPresContext=0x1215aa400, aMetrics=@0x7fff5fbf9060, aReflowState=@0x7fff5fbf8dc8, aStatus=@0x7fff5fbf8dac) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:1042
#61 0x00000001018aac41 in nsBlockReflowContext::ReflowBlock (this=0x7fff5fbf9030, aSpace=@0x7fff5fbf8ec0, aApplyTopMargin=true, aPrevMargin=@0x7fff5fbf9c20, aClearance=0, aIsAdjacentWithTop=true, aLine=0x121df5528, aFrameRS=@0x7fff5fbf8dc8, aFrameReflowStatus=@0x7fff5fbf8dac, aState=@0x7fff5fbf9b60) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockReflowContext.cpp:268
#62 0x0000000101899823 in nsBlockFrame::ReflowBlockFrame (this=0x121df28d8, aState=@0x7fff5fbf9b60, aLine={mCurrent = 0x121df5528, mListLink = 0x121df2950}, aKeepReflowGoing=0x7fff5fbf96d3) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:3087
#63 0x0000000101897af0 in nsBlockFrame::ReflowLine (this=0x121df28d8, aState=@0x7fff5fbf9b60, aLine={mCurrent = 0x121df5528, mListLink = 0x121df2950}, aKeepReflowGoing=0x7fff5fbf96d3) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:2470
#64 0x000000010189410e in nsBlockFrame::ReflowDirtyLines (this=0x121df28d8, aState=@0x7fff5fbf9b60) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:1990
#65 0x0000000101891888 in nsBlockFrame::Reflow (this=0x121df28d8, aPresContext=0x1215aa400, aMetrics=@0x7fff5fbfa0b0, aReflowState=@0x7fff5fbf9fb8, aStatus=@0x7fff5fbfa2f0) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsBlockFrame.cpp:1042
#66 0x00000001018b8c72 in nsContainerFrame::ReflowChild (this=0x121ab8798, aKidFrame=0x121df28d8, aPresContext=0x1215aa400, aDesiredSize=@0x7fff5fbfa0b0, aReflowState=@0x7fff5fbf9fb8, aX=0, aY=0, aFlags=0, aStatus=@0x7fff5fbfa2f0, aTracker=0x0) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsContainerFrame.cpp:941
#67 0x000000010190910e in nsCanvasFrame::Reflow (this=0x121ab8798, aPresContext=0x1215aa400, aDesiredSize=@0x7fff5fbfa570, aReflowState=@0x7fff5fbfa300, aStatus=@0x7fff5fbfa2f0) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsCanvasFrame.cpp:465
#68 0x00000001018b8c72 in nsContainerFrame::ReflowChild (this=0x121ab8a60, aKidFrame=0x121ab8798, aPresContext=0x1215aa400, aDesiredSize=@0x7fff5fbfa570, aReflowState=@0x7fff5fbfa300, aX=0, aY=0, aFlags=3, aStatus=@0x7fff5fbfa2f0, aTracker=0x0) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsContainerFrame.cpp:941
#69 0x00000001018f458e in nsHTMLScrollFrame::ReflowScrolledFrame (this=0x121ab8a60, aState=0x7fff5fbfa700, aAssumeHScroll=false, aAssumeVScroll=false, aMetrics=0x7fff5fbfa570, aFirstPass=true) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsGfxScrollFrame.cpp:433
#70 0x00000001018f4da2 in nsHTMLScrollFrame::ReflowContents (this=0x121ab8a60, aState=0x7fff5fbfa700, aDesiredSize=@0x7fff5fbfab28) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsGfxScrollFrame.cpp:533
#71 0x00000001018f5bdd in nsHTMLScrollFrame::Reflow (this=0x121ab8a60, aPresContext=0x1215aa400, aDesiredSize=@0x7fff5fbfab28, aReflowState=@0x7fff5fbfaa38, aStatus=@0x7fff5fbfad4c) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsGfxScrollFrame.cpp:774
#72 0x00000001018b8c72 in nsContainerFrame::ReflowChild (this=0x121309c58, aKidFrame=0x121ab8a60, aPresContext=0x1215aa400, aDesiredSize=@0x7fff5fbfab28, aReflowState=@0x7fff5fbfaa38, aX=0, aY=0, aFlags=0, aStatus=@0x7fff5fbfad4c, aTracker=0x0) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsContainerFrame.cpp:941
#73 0x0000000101990153 in ViewportFrame::Reflow (this=0x121309c58, aPresContext=0x1215aa400, aDesiredSize=@0x7fff5fbfad00, aReflowState=@0x7fff5fbfad70, aStatus=@0x7fff5fbfad4c) at /Users/jkew/mozdev/mozilla-central/layout/generic/nsViewportFrame.cpp:209
#74 0x000000010181fada in PresShell::DoReflow (this=0x112315c40, target=0x121309c58, aInterruptible=true) at /Users/jkew/mozdev/mozilla-central/layout/base/nsPresShell.cpp:7450
#75 0x0000000101826ec9 in PresShell::ProcessReflowCommands (this=0x112315c40, aInterruptible=true) at /Users/jkew/mozdev/mozilla-central/layout/base/nsPresShell.cpp:7591
#76 0x0000000101826b4f in PresShell::FlushPendingNotifications (this=0x112315c40, aType=Flush_InterruptibleLayout) at /Users/jkew/mozdev/mozilla-central/layout/base/nsPresShell.cpp:3895
#77 0x00000001018477ff in nsRefreshDriver::Notify (this=0x1215ab000, aTimer=0x1216bbc40) at /Users/jkew/mozdev/mozilla-central/layout/base/nsRefreshDriver.cpp:403
#78 0x00000001037599f9 in nsTimerImpl::Fire (this=0x1216bbc40) at /Users/jkew/mozdev/mozilla-central/xpcom/threads/nsTimerImpl.cpp:475
#79 0x0000000103759d66 in nsTimerEvent::Run (this=0x10b403728) at /Users/jkew/mozdev/mozilla-central/xpcom/threads/nsTimerImpl.cpp:555
#80 0x000000010374f658 in nsThread::ProcessNextEvent (this=0x10046f9d0, mayWait=false, result=0x7fff5fbfb743) at /Users/jkew/mozdev/mozilla-central/xpcom/threads/nsThread.cpp:620
#81 0x00000001036b9532 in NS_ProcessPendingEvents_P (thread=0x10046f9d0, timeout=20) at nsThreadUtils.cpp:170
#82 0x000000010311cfcf in nsBaseAppShell::NativeEventCallback (this=0x100410e20) at /Users/jkew/mozdev/mozilla-central/widget/xpwidgets/nsBaseAppShell.cpp:97
#83 0x00000001030ae2ac in nsAppShell::ProcessGeckoEvents (aInfo=0x100410e20) at /Users/jkew/mozdev/mozilla-central/widget/cocoa/nsAppShell.mm:398

In particular, note frame 67, nsCanvasFrame::Reflow. Looks like the display of the tos;dr panel, when it "fades in" on initial display, involves a <canvas>. That's a problem, as we know (bug 780362) that <canvas> is currently not HiDPI-aware, and will use a lo-DPI surface to render its content.

Given that once the tos;dr panel is displayed, its content can be coaxed into HiDPI mode by selection or scrolling, I wonder if the nsCanvasFrame here may be an artifact of the fade-in transition that it's using.
> Looks like the display of the tos;dr panel, when it "fades in" on
> initial display, involves a <canvas>.

As best I can tell this isn't true (though I'm not very confident
dealing with such high-level code):

http://hg.mozilla.org/mozilla-central/annotate/c6ccd1d30c15/toolkit/content/widgets/popup.xml#l328

The bug (and fadein) don't happen when I change this to:

<children includes="canvas"/>

Which I *think* means either that the tos;dr extension doesn't add a
canvas element here, or that it doesn't trigger the bug (at least not
by itself).  My source for this hunch is
https://developer.mozilla.org/en-US/docs/XUL_Tutorial/Anonymous_Content#includes_Attribute.
(Someone please correct me if I'm wrong.)

I still haven't found a way to observe what the tos;dr actually does
add to its arrowpanel, and I doubt that I'll be able to.  The only
appropriate tool I can find is Chromebug, which is a Firebug
extension.  But I can't get it to work properly (and yes, I tested
with copies of Chromebug and Firebug whose versions match).

I'll keep digging.
(In reply to Jonathan Kew (:jfkthame) from comment #20)
> In particular, note frame 67, nsCanvasFrame::Reflow. Looks like the display

nsCanvasFrame is not for <canvas> elements. nsHTMLCanvasFrame is for <canvas> elements.
(In reply to Steven Michaud from comment #21)
> Which I *think* means either that the tos;dr extension doesn't add a
> canvas element here, or that it doesn't trigger the bug (at least not
> by itself).  My source for this hunch is
> https://developer.mozilla.org/en-US/docs/XUL_Tutorial/
> Anonymous_Content#includes_Attribute.
> (Someone please correct me if I'm wrong.)

You should just be looking at the regular children of the <panel>:

<panel>
  <you-want-the-elements-added-here/>
</panel>

and not concern yourself over the binding or the anonymous content. (although it may be that the other anonymous content affects this bug)

I'm not sure what you're using to debug this, but from script you can display the panel content with (new XMLSerializer()).serializeToString(panelElement)
After many false leads and a bit of luck, I've finally found where the tos;dr extensions arrowpanel's animation is performed (presumably in layout/style/nsTransitionManager.cpp).  I've also found one way to turn off this animation, by a one-line change to toolkit/themes/pinstripe/global/popup.css -- just delete the following line:

http://hg.mozilla.org/mozilla-central/annotate/c5fbfc1b1a94/toolkit/themes/pinstripe/global/popup.css#l32

Doing this also "fixes" this bug.

Tomorrow I'll start digging into nsTransitionManager.cpp, trying to get closer to the true cause of this bug.
I get the impression that the problem here is happening somewhere in Layers (as a result of how layer compositing happens during the transition that's displaying the panel). cc-ing Roc, in hopes that maybe he has some ideas here...

One observation: if I disable the use of groups in BasicLayerManager::PaintLayer, by adding this hack:

--- a/gfx/layers/basic/BasicLayerManager.cpp
+++ b/gfx/layers/basic/BasicLayerManager.cpp
@@ -880,16 +880,18 @@ BasicLayerManager::PaintLayer(gfxContext
   RenderTraceScope trace("BasicLayerManager::PaintLayer", "707070");
 
   const nsIntRect* clipRect = aLayer->GetEffectiveClipRect();
   // aLayer might not be a container layer, but if so we take care not to use
   // the container variable
   BasicContainerLayer* container = static_cast<BasicContainerLayer*>(aLayer);
   bool needsGroup = aLayer->GetFirstChild() &&
                     container->UseIntermediateSurface();
+  // XXX override needsGroup to hack around xul panel HiDPI bug
+  needsGroup = false;
   BasicImplData* data = ToData(aLayer);
   bool needsClipToVisibleRegion =
     data->GetClipToVisibleRegion() && !aLayer->AsThebesLayer();
   NS_ASSERTION(needsGroup || !aLayer->GetFirstChild() ||
                container->GetOperator() == gfxContext::OPERATOR_OVER,
                "non-OVER operator should have forced UseIntermediateSurface");
   NS_ASSERTION(!aLayer->GetFirstChild() || !aLayer->GetMaskLayer() ||
                container->UseIntermediateSurface(),
 
then I no longer see the problem, either with SocialAPI panels or with the Mozilla Reps Companion add-on (which provides a handy way to reproduce the issue: its panel appears blurry when first displayed, and text subsequently "sharpens" when it is selected/highlighted).

Obviously, this isn't a solution - presumably it'll result in poor rendering in certain cases - but it does seem to point to the underlying problem being related to compositing of layers.
I see this, too.  And I've tracked the problem from here into cairo, I think.

I hope this lead will either play out or peter out in the next couple of days.
I think the root of the issue may be a gfxQuartzSurface being created without the proper backing scale within cocoa widget code, when non-accelerated drawing is happening (which applies to xul panels). The attached patch aims to address this, and with this I'm seeing consistently sharp socialapi/add-on panels. Further testing ongoing...
Jonathan, your patch works for me (in code from before bug 803068 landed, testing with Margaret's STR from comment #9).  Furthermore, it just "sounds right".

I'll still keep following my trail, though, to see how it connects up with your solution.
> I'll still keep following my trail, though, to see how it connects
> up with your solution.

My hunch why your patch isn't required in all cases (why our
non-accelerated code sometimes works in HiDPI mode as it stands)
involves CGLayers, and the OS-level magic they may perform.
(In reply to Steven Michaud from comment #29)
> Jonathan, your patch works for me (in code from before bug 803068 landed,
> testing with Margaret's STR from comment #9). 

BTW, to test this with current trunk code (given that the tos;dr addon is broken by 803068), a simple approach is to install the "Mozilla Reps Companion 1.1" add-on, ensure the Add-on Bar is displayed, and then click the little red icon to display the Reps Companion panel. It suffers the same blurry rendering when initially displayed, due to the "fade-in" transition used.
Comment on attachment 678307 [details] [diff] [review]
ensure full-resolution backing store is used when compositing xul:panels. try: -b do -p macosx64 -u all

I think we should go ahead with this fix, which seems clearly necessary to get adequate-resolution surfaces in some cases.

There are still a couple of further issues related to xul panels (bug 808802) and to non-HWA rendering (bug 800948), but those appear to be separate problems.
Attachment #678307 - Flags: review?(smichaud)
Comment on attachment 678307 [details] [diff] [review]
ensure full-resolution backing store is used when compositing xul:panels. try: -b do -p macosx64 -u all

Looks good to me, and also works fine in my (limited) tests.
Attachment #678307 - Flags: review?(smichaud) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/8f01a8b3b9e5
Assignee: nobody → jfkthame
Whiteboard: STR in comment #9 → STR in comment #9 / comment #31
Target Milestone: --- → mozilla19
https://hg.mozilla.org/mozilla-central/rev/8f01a8b3b9e5
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Jonathan, would this be too risky to uplift to 18 so it can appear with the other HiDPI support?
Comment on attachment 678307 [details] [diff] [review]
ensure full-resolution backing store is used when compositing xul:panels. try: -b do -p macosx64 -u all

[Approval Request Comment]
Bug caused by (feature/regressing bug #): HiDPI support
User impact if declined: poor (blurry/ragged) rendering of some panels from addons and SocialAPI on retina display
Testing completed (on m-c, etc.): landed on m-c and confirmed to fix the poor rendering
Risk to taking this patch (and alternatives if risky): minimal risk - Mac-only code, only affects HiDPI mode
String or UUID changes made by this patch: none
Attachment #678307 - Flags: approval-mozilla-aurora?
Comment on attachment 678307 [details] [diff] [review]
ensure full-resolution backing store is used when compositing xul:panels. try: -b do -p macosx64 -u all

Approving on Aurora as we support HiDPI in FF18. Helps in better rendering of some panels from addons and SocialAPI on retina display
Attachment #678307 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: