Closed
Bug 39210
Opened 25 years ago
Closed 22 years ago
document.bgcolor reported as white instead of #ffffff
Categories
(Core :: DOM: Core & HTML, defect, P3)
Core
DOM: Core & HTML
Tracking
()
VERIFIED
FIXED
Future
People
(Reporter: jruderman, Assigned: caillon)
References
()
Details
(Keywords: dom0, testcase)
Attachments
(3 files)
(deleted),
text/html
|
Details | |
(deleted),
text/html
|
Details | |
(deleted),
patch
|
sicking
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
if you have <body bgcolor="white">, mozilla tells javascript that the bgcolor
is "white" instead of "#ffffff". i don't know which is more correct, but ie
and ns4x both say "#ffffff".
note: the url given doesn't work at all unless you replace document.all.ds with
document.getElementById('ds'). i'll attach a readable, working, and partially
simplified version of the page, and then i'll attach a testcase.
Reporter | ||
Comment 1•25 years ago
|
||
Reporter | ||
Comment 2•25 years ago
|
||
Reporter | ||
Comment 3•25 years ago
|
||
several other bugs have been reported with the same url. another known bug,
bug 38296, shows up by showing some style information at the top of the
original page (but not the "slightly simpified" version).
Reporter | ||
Updated•25 years ago
|
OS: other → Windows 98
Hardware: Other → PC
Comment 4•24 years ago
|
||
This bug has been marked "future" because the original netscape engineer
working on this is over-burdened. If you feel this is an error, that you or
another known resource will be working on this bug,or if it blocks your work
in some way -- please attach your concern to the bug for reconsideration.
OS: Windows 98 → All
Hardware: PC → All
Target Milestone: --- → Future
Updated•24 years ago
|
Status: NEW → ASSIGNED
Comment 5•24 years ago
|
||
I don't see any function to translate between a color string and hex.
There is
string->rgb
hex->rgb
but not string->hex
nor rgb->hex.
Relevant code :
nsHTMLValue value(styleColor->mBackgroundColor);
ColorToString(value, aBgColor);
This code apparently just takes the attribute value in the body tag and returns
it. I'm a little stuck here...
Comment 6•23 years ago
|
||
Fabian, if you're programming in Mozilla you could use NS_ColorNameToRGB which
returns a PRBool if it succeeds.
succeeded = NS_ColorNameToRGB(colorStr, &color)
Assignee | ||
Comment 7•22 years ago
|
||
So assuming this bug is valid, this patch fixes it.
Comment on attachment 90398 [details] [diff] [review]
Fix 1.0
>Index: content/html/content/src/nsHTMLBodyElement.cpp
>===================================================================
>RCS file: /cvsroot/mozilla/content/html/content/src/nsHTMLBodyElement.cpp,v
>retrieving revision 1.95
>diff -u -r1.95 nsHTMLBodyElement.cpp
>--- content/html/content/src/nsHTMLBodyElement.cpp 22 May 2002 23:59:43 -0000 1.95
>+++ content/html/content/src/nsHTMLBodyElement.cpp 7 Jul 2002 00:28:23 -0000
>@@ -559,7 +559,11 @@
> NS_IMETHODIMP
> nsHTMLBodyElement::GetBgColor(nsAString& aBgColor)
> {
>- nsresult rv = GetAttr(kNameSpaceID_None, nsHTMLAtoms::bgcolor, aBgColor);
>+ aBgColor.Truncate();
>+
>+ nsAutoString attr;
>+ nscolor bgcolor;
>+ nsresult rv = GetAttr(kNameSpaceID_None, nsHTMLAtoms::bgcolor, attr);
I would just assign directly into aBgColor since you are guarenteed to get an
empty string back if the function returns NS_CONTENT_ATTR_NOT_THERE.
Either way, r=sicking
Attachment #90398 -
Flags: review+
Assignee | ||
Comment 9•22 years ago
|
||
I guess that would work too. The reason I didn't assign directly to the out
parameter though, is that the value we get right there is not necessarily the
value we want to use for the out parameter, though it may well be so. In fact,
we only want the value we get from the attribute in 1 out of 3 cases...
I'll switch if Johnny wants me to do so, but I still think the way I have it
done is more readable.
Taking this bug...
Assignee: jst → caillon
Status: ASSIGNED → NEW
Comment 10•22 years ago
|
||
Comment on attachment 90398 [details] [diff] [review]
Fix 1.0
sr=jst
Attachment #90398 -
Flags: superreview+
Assignee | ||
Comment 11•22 years ago
|
||
Checked in
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 12•22 years ago
|
||
Verifying this based on stummala's comments in bug 168346.
Status: RESOLVED → VERIFIED
Comment 13•22 years ago
|
||
*** Bug 187744 has been marked as a duplicate of this bug. ***
Comment 14•22 years ago
|
||
reopening per recent dup, resetting milestones, etc.
Status: VERIFIED → REOPENED
Keywords: regression
Priority: P3 → --
Resolution: FIXED → ---
Target Milestone: Future → ---
Comment 15•22 years ago
|
||
That bug has nothing to do with this one, and even if it did this one should not
have been reopened.
Status: REOPENED → RESOLVED
Closed: 22 years ago → 22 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 17•22 years ago
|
||
Unless you own the bug, don't touch priorities or milestones. Undoing damage.
You need to log in
before you can comment on or make changes to this bug.
Description
•