Closed Bug 556694 Opened 14 years ago Closed 14 years ago

Selection color isn't reverted when input field is specified only background-color

Categories

(Core :: Layout: Text and Fonts, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.3a5

People

(Reporter: masayuki, Assigned: masayuki)

References

(Depends on 1 open bug, )

Details

(Keywords: regression)

Attachments

(1 file, 3 obsolete files)

This is regression of bug 472410. See bug 472410 comment 5 and later.

I'll post the patch.
Summary: Selection color isn't reverted when input field only specified background-color → Selection color isn't reverted when input field is specified only background-color
Attached patch Patch v1.0 (obsolete) — Splinter Review
Attached patch Patch v1.1 (obsolete) — Splinter Review
Should check nsIFrame::IsThemed().
Attachment #437507 - Attachment is obsolete: true
Attachment #437620 - Flags: review?(dbaron)
Why do you check mAppearance on one element, and then IsThemed on it and all its ancestors?

I'm a bit concerned about the ancestor check too; something that's a container for arbitrary content can be themed (e.g., toolbox, toolbar, window, dialog, the various vista toolboxes).  Behaving differently if an arbitrary ancestor is themed seems wrong.


Also, I don't understand from the summary what the bug that you're fixing is.  Could you explain?
(In reply to comment #3)
> Why do you check mAppearance on one element, and then IsThemed on it and all
> its ancestors?
> 
> I'm a bit concerned about the ancestor check too; something that's a container
> for arbitrary content can be themed (e.g., toolbox, toolbar, window, dialog,
> the various vista toolboxes).  Behaving differently if an arbitrary ancestor is
> themed seems wrong.

Er, sorry, never mind this part; I see what the code is doing now.
Instead of this, I think the changes in bug 472410 to FindNonTransparentBackground are the wrong approach:  FindNonTransparentBackground should take a frame as an argument, walk up the frame tree (using nsLayoutUtils::GetParentOrPlaceholderFor), and return a frame.  This allows FindNonTransparentBackground to also check IsThemed() rather than just mAppearance.  And then you don't need the weird loop to redo the work that FindNonTransparentBackground already did.
(In reply to comment #5)
> frame tree (using nsLayoutUtils::GetParentOrPlaceholderFor), and return a

Actually, it should just use nsIFrame::GetParent.  The current behavior of walking the style context tree rather than the frame tree is incorrect for what FindNonTransparentBackground is doing.  That changes what the function does, but for the better.
Attached patch Patch v2.0 (obsolete) — Splinter Review
Thank you. Seems it's better to use nsLayoutUtils::GetParentOrPlaceholderFor().
Attachment #437620 - Attachment is obsolete: true
Attachment #437743 - Flags: review?(dbaron)
Comment on attachment 437743 [details] [diff] [review]
Patch v2.0

>diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp
>+    const nsStyleBackground* bg =
>+      frame->GetStyleContext()->GetStyleBackground();

This can be simplified to frame->GetStyleBackground().
>diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp
>+    bgFrame->GetStyleContext()->
>+      GetVisitedDependentColor(eCSSProperty_background_color);

This can just be bgFrame->GetVisitedDependentColor(...).

>diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp
>+  mTableBgColor = bgFrame->GetStyleContext()->GetStyleBackground();

And this can just be bgFrame->GetStyleBackground().

r=dbaron with that
Attached patch Patch v2.1Splinter Review
thank you, dbaron!
Attachment #437743 - Attachment is obsolete: true
http://hg.mozilla.org/mozilla-central/rev/5a79877003e8
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a5
Depends on: 1232125
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: