Closed Bug 306241 Opened 19 years ago Closed 19 years ago

calendarManagement not looking for contrasting color when null

Categories

(Calendar :: Sunbird Only, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: robin.edrenius, Assigned: mostafah)

Details

Attachments

(1 file, 2 obsolete files)

calendarManagement is not looking for contrasting textcolor if 'null'
Attached patch Patch v1 (obsolete) β€” β€” Splinter Review
This should fix the issue.
Attachment #194097 - Flags: first-review?(jminta)
Comment on attachment 194097 [details] [diff] [review]
Patch v1

+	 if (color || 'null')

The original point of this 'if' was to take out exactly the 'null' case.  If
you want it to work anyway, you should remove the 'if' entirely.

I thought I put the 'if' in originally because getContrastingTextColor choked
on 'null', but that seems to be working OK for me now.	You might want to
double-check this though.
Attachment #194097 - Flags: first-review?(jminta) → first-review-
Attached patch patch v2 β€” β€” Splinter Review
Another attempt.
I see no choke on 'null'.
Attachment #194097 - Attachment is obsolete: true
Attachment #194100 - Flags: first-review?(jminta)
Comment on attachment 194100 [details] [diff] [review]
patch v2

r=jminta
Attachment #194100 - Flags: first-review?(jminta) → first-review+
Patch checked in.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Are you sure getContrastingTextColor doesn't die on null? It might not die on
'null', but that's something different. That's a string. getContrastingTextColor
does bgColor.replace(), and that dies if bgColor is null.
(Also, again, how can a calendar have no color? The boxes always have some color)
(In reply to comment #6)
> Are you sure getContrastingTextColor doesn't die on null? It might not die on
> 'null', but that's something different. That's a string. getContrastingTextColor
> does bgColor.replace(), and that dies if bgColor is null.

I tested this by creating calendar with no color.  This should set the pref to
null (I think) and everything worked fine there.  In short, I found no way for a
user to perform and action that kills getContrastingTextColor.  If you can find
one, it's easy enough to fix with "if (!bgColor) return 'black';"

> (Also, again, how can a calendar have no color? The boxes always have some color)
The point is (especially if a different theme is being used), that
style.backgroundColor shouldn't be required to be set.  Setting white seems like
they have no color, but 'transparent'/'none' should be an option, which right
now it isn't.
OK, I did manage to finally kill getContrastingTextColor this morning.

Status:Re-open
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attached patch handle null (obsolete) β€” β€” Splinter Review
sigh...I knew there had to be a reason that 'if' was there.
Attachment #194186 - Flags: first-review?(mvl)
Comment on attachment 194186 [details] [diff] [review]
handle null

bad idea
Attachment #194186 - Attachment is obsolete: true
Attachment #194186 - Flags: first-review?(mvl)
(Apologies for all this bugspam.)

I only made getContrastingTextColor die this morning using my own custom
colorpicker.  Normal colorpickers assign "" if no color is chosen, which can be
handled.  Mine assigned null, which died.  So, this bug is actually fixed.
Status: REOPENED → RESOLVED
Closed: 19 years ago19 years ago
Resolution: --- → FIXED
Comment on attachment 194100 [details] [diff] [review]
patch v2

getCalendarPref can return null, so getContrastingTextColor can get called with
null.
Please back this patch out. It is wrong.
Attachment #194100 - Flags: second-review-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: