Closed
Bug 307532
Opened 19 years ago
Closed 19 years ago
Selection colors should be saved in nsTextFrame::TextPaintStyle, not DrawSelectionIterator
Categories
(Core :: Layout: Text and Fonts, defect, P1)
Core
Layout: Text and Fonts
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha1
People
(Reporter: masayuki, Assigned: masayuki)
References
Details
Attachments
(2 files, 6 obsolete files)
56.01 KB,
patch
|
Details | Diff | Splinter Review | |
1.12 KB,
patch
|
bzbarsky
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
I'm working on bug 113161 and bug 170951. In this work, I need selection colors in nsTextFrame::PaintTextDecorations. But this function isn't using DrawSelectionIterator, but it has TextPaintStyle. I think that DrawSelectionIterator should not have colors. It should refer TextPaintStyle. And DrawSelectionIterator::GetSelectionColors should be moved to TextPaintStyle. I think TextPaintStyle should be class, not struct.(struct can have methods, but it is not beautiful. And I hate that the nsTextFrame definition becomes long.) I will create the patch tomorrow.
Assignee | ||
Updated•19 years ago
|
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → mozilla1.9alpha
Assignee | ||
Comment 1•19 years ago
|
||
Attachment #196357 -
Flags: superreview?(roc)
Attachment #196357 -
Flags: review?(roc)
Assignee | ||
Comment 2•19 years ago
|
||
Assignee | ||
Comment 3•19 years ago
|
||
diff: changing name; TextStyle -> nsTextStyle, TextPaintStyle -> nsTextPaintStyle. removing color related members from DrawSelectionIterator. removing some parameter from constructor of DrawSelectionIterator. moving EnsureDifferentColors to previous in the code. This patch solves the selection colors only once at first time of getting color by GetSelectionColors. If GetSelectionColors is called by two or more times, GetSelectionColors returns cached colors. Therefore, memory usage and performance are better than current code.
Assignee | ||
Comment 4•19 years ago
|
||
Comment on attachment 196357 [details] [diff] [review] Patch rv1.0 nsTextFrame.cpp is updated by bug 306895. I will create new patch.
Attachment #196357 -
Flags: superreview?(roc)
Attachment #196357 -
Flags: review?(roc)
Assignee | ||
Comment 5•19 years ago
|
||
Attachment #196357 -
Attachment is obsolete: true
Attachment #196358 -
Attachment is obsolete: true
Attachment #196645 -
Flags: superreview?(roc)
Attachment #196645 -
Flags: review?(roc)
Assignee | ||
Comment 6•19 years ago
|
||
Assignee | ||
Updated•19 years ago
|
Attachment #196645 -
Flags: superreview?(roc)
Attachment #196645 -
Flags: review?(roc)
Assignee | ||
Comment 7•19 years ago
|
||
Update to latest code.
Attachment #196645 -
Attachment is obsolete: true
Attachment #200212 -
Flags: superreview?(roc)
Attachment #200212 -
Flags: review?(roc)
Assignee | ||
Comment 8•19 years ago
|
||
Attachment #196646 -
Attachment is obsolete: true
Comment on attachment 200212 [details] [diff] [review] Patch rv2.1 + PRBool GetTextColor(nscolor* aTextColor); + PRBool GetSelectionColors(nscolor* foreColor, + nscolor* backColor, + PRBool* aBackIsTransparent); These don't need to return PRBool; it's a programming error if they ever fail (right?). So just put the assertions inside these functions and don't check in the caller. Then GetTextColor should return the color directly. + PRBool ShouldExchangeColors(nscolor *aForeColor, nscolor *aBackColor); ShouldExchangeColors is not a good name, since it actually does the exchange if necessary. "Should" suggests that the function just tests whether the exchange is necessary. Call it something else like "EnsureSufficientContrast".
Attachment #200212 -
Flags: superreview?(roc)
Attachment #200212 -
Flags: superreview+
Attachment #200212 -
Flags: review?(roc)
Attachment #200212 -
Flags: review+
Assignee | ||
Comment 10•19 years ago
|
||
Attachment #200212 -
Attachment is obsolete: true
Attachment #200213 -
Attachment is obsolete: true
Assignee | ||
Comment 11•19 years ago
|
||
checked-in. Thanks.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment 12•19 years ago
|
||
Was this expected to affect Tp? It improved by 2-4% or more on btek, luna, monkey (seamonkey tinderboxen, linux and mac), and got worse by about 20% on beast (Firefox tinderbox, windows, though there this patch is not the only one in the window).
Assignee | ||
Comment 13•19 years ago
|
||
Yeah, if so, this may improve. Because this patch doesn't process the "getting selection colors" if it's not needed.
Comment 14•19 years ago
|
||
Also, this caused the orange on balsa. This patch is managing to leak enough stuff that we're asserting on shutdown, and asserts are fatal on balsa.
Comment 15•19 years ago
|
||
Ah, ok. We used to get the selection colors on every textframe paint? And now we only get them if it's selected?
Comment 16•19 years ago
|
||
this leaks the selection controller In +nsTextFrame::GetSelectionStatus: + nsISelectionController* selectionController; + nsresult rv = GetSelectionController(aPresContext, &selectionController); This addrefs, and never releases. fix is probably to make that an nsCOMPtr. reopening. this causes the orange on balsa and probably enormous leaks.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 17•19 years ago
|
||
this should fix things, though I didn't test it.
Attachment #201265 -
Flags: superreview?(bzbarsky)
Attachment #201265 -
Flags: review?(bzbarsky)
Comment 18•19 years ago
|
||
Comment on attachment 201265 [details] [diff] [review] leak patch Looks good.
Attachment #201265 -
Flags: superreview?(bzbarsky)
Attachment #201265 -
Flags: superreview+
Attachment #201265 -
Flags: review?(bzbarsky)
Attachment #201265 -
Flags: review+
Assignee | ||
Comment 19•19 years ago
|
||
(In reply to comment #15) > Ah, ok. We used to get the selection colors on every textframe paint? And now > we only get them if it's selected? > If there are useless DrawSelectionIterator(s), you're right. Biesi: Thanks, and Sorry.
Assignee | ||
Comment 20•19 years ago
|
||
Tinderbox is green, now. -> FIXED. Thanks!
Status: REOPENED → RESOLVED
Closed: 19 years ago → 19 years ago
Resolution: --- → FIXED
Comment 21•19 years ago
|
||
Ah, good. Tp is also back where it should be with the leak fixed.
You need to log in
before you can comment on or make changes to this bug.
Description
•