Closed Bug 663375 Opened 13 years ago Closed 13 years ago

css media="print" text-decoration styles not being processed correctly

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla8

People

(Reporter: ronaa, Assigned: MatsPalmgren_bugz)

References

()

Details

(Keywords: testcase)

Attachments

(4 files, 2 obsolete files)

User-Agent:       Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Build Identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1

Not all properties of a style within a <style media="print"> tag are being processed, such as color, background-color and text-decoration.

Reproducible: Always

Steps to Reproduce:
1. Invoke http://www.armonkplayers.org/reservations/test.html
2. Observe page as displayed in browser.
3. Do a "Print Preview" or Print


Actual Results:  
The contents of the second table cell (BBB) is properly printed twice as large as the other cells, but the color, background-color and text-decoration properties are wrong.

Expected Results:  
The second cell should be white text on a black background and underlined.

The style sheets in question:

<style type="text/css">
.b {
  color: red;
  background-color: white;
  text-decoration: line-through;
}
</style>

<style type="text/css" media="print">
.b {
  color: white;
  background-color: black;
  text-decoration: underline;
  font-size: 200%
}
</style>
Works for me on
http://hg.mozilla.org/mozilla-central/rev/1619d8fc6416
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0a1) Gecko/20110610 Firefox/7.0a1 ID:20110610030736

Check "Print Background (colors & images)" in File – Page Setup… dialog.
WFM too against Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 ID:20110413222027 with "Print Background (colors & images)" checked.
Version: unspecified → 4.0 Branch
I am sorry to have "spun your wheels".  I suppose the folks at Mozilla figure that if you are not honoring 'background-color', then you really cannot honor 'color' either.  But what is the rationale for ignoring 'text-decoration'?

So all in all, this is a print option that goes a bit beyond what I would expect.  Anyway, thanks for your time.
Seems like a valid bug to me.  We should do the same color mangling
for the text-decoration lines as we do for the text.
Assignee: nobody → matspal
Severity: major → normal
Status: UNCONFIRMED → ASSIGNED
Component: General → Layout
Ever confirmed: true
Keywords: testcase
OS: Windows 7 → All
Product: Firefox → Core
QA Contact: general → layout
Hardware: x86 → All
Summary: css media="print" styles not being processed correctly → css media="print" text-decoration styles not being processed correctly
Version: 4.0 Branch → unspecified
Attached patch wip1 (obsolete) — Splinter Review
Something like this... should merge the nsLayoutUtils::GetColor with
part 2 in bug 312156 which does mostly the same thing.
Likely best to hold off on this until bug 403524 lands.
Attached patch wip2 (obsolete) — Splinter Review
Attachment #538802 - Attachment is obsolete: true
Depends on: 403524
Attached patch fixSplinter Review
updated to tip
Attachment #538804 - Attachment is obsolete: true
Attachment #551559 - Flags: review?(dbaron)
Comment on attachment 551559 [details] [diff] [review]
fix

>-    } while (context && hasDecorationLines && (0 != decorMask));
>+    } while (0 != decorMask &&
>+             NS_SUCCEEDED(f->GetParentStyleContextFrame(presContext, &f, &isChild)) &&
>+             f);

GetParentStyleContextFrame is intended for use only when reconstructing the style contexts.  You either want to continue walking up the style context tree as this code was, or you should use nsLayoutUtils::GetParentOrPlaceholderFor.  (Though, really, this code should be entirely rewritten... or we should just find a way to get rid of nsTextBoxFrame.  Not for this patch, though.)

r=dbaron with that
Attachment #551559 - Flags: review?(dbaron) → review+
Comment on attachment 551559 [details] [diff] [review]
fix

>-      const nscolor color = useOverride ? overrideColor
>-        : context->GetVisitedDependentColor(eCSSProperty_text_decoration_color);
>+      const nscolor color = useOverride ? overrideColor :
>+        nsLayoutUtils::GetColor(f, eCSSProperty_text_decoration_color);

And please leave the : on the following line.
http://hg.mozilla.org/integration/mozilla-inbound/rev/e9f6607a3990
Flags: in-testsuite?
Whiteboard: [inbound]
Target Milestone: --- → mozilla8
http://hg.mozilla.org/mozilla-central/rev/e9f6607a3990
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [inbound]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: