Bug 668319 - Allow to set opacity on ::-moz-tree-cell-text.

r=roc
This commit is contained in:
Marco Bonardo 2011-06-30 15:33:58 +02:00
parent 68be621524
commit b9b2ded530
3 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="data:text/css,
tree { height: 100px; -moz-appearance: none; border: none; }
treecol, treecolpicker { visibility: hidden; }
treechildren::-moz-tree-cell-text { opacity: 0; }
"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<tree>
<treecols>
<treecol flex="1"/>
</treecols>
<treechildren>
<treeitem>
<treerow>
<treecell label="test"/>
</treerow>
</treeitem>
</treechildren>
</tree>
</window>

View File

@ -1646,3 +1646,4 @@ fails-if(layersGPUAccelerated&&cocoaWidget) == 654950-1.html 654950-1-ref.html #
== 658952.html 658952-ref.html == 658952.html 658952-ref.html
== 664127-1.xul 664127-1-ref.xul == 664127-1.xul 664127-1-ref.xul
== 660682-1.html 660682-1-ref.html == 660682-1.html 660682-1-ref.html
== 668319-1.xul about:blank

View File

@ -3553,6 +3553,9 @@ nsTreeBodyFrame::PaintText(PRInt32 aRowIndex,
// out and to paint. // out and to paint.
nsStyleContext* textContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreecelltext); nsStyleContext* textContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreecelltext);
// Obtain opacity value for the image.
float opacity = textContext->GetStyleDisplay()->mOpacity;
// Obtain the margins for the text and then deflate our rect by that // Obtain the margins for the text and then deflate our rect by that
// amount. The text is assumed to be contained within the deflated rect. // amount. The text is assumed to be contained within the deflated rect.
nsRect textRect(aTextRect); nsRect textRect(aTextRect);
@ -3619,8 +3622,19 @@ nsTreeBodyFrame::PaintText(PRInt32 aRowIndex,
PRUint8 direction = aTextRTL ? NS_STYLE_DIRECTION_RTL : PRUint8 direction = aTextRTL ? NS_STYLE_DIRECTION_RTL :
NS_STYLE_DIRECTION_LTR; NS_STYLE_DIRECTION_LTR;
gfxContext* ctx = aRenderingContext.ThebesContext();
if (opacity != 1.0f) {
ctx->PushGroup(gfxASurface::CONTENT_COLOR_ALPHA);
}
nsLayoutUtils::DrawString(this, &aRenderingContext, text.get(), text.Length(), nsLayoutUtils::DrawString(this, &aRenderingContext, text.get(), text.Length(),
textRect.TopLeft() + nsPoint(0, baseline), direction); textRect.TopLeft() + nsPoint(0, baseline), direction);
if (opacity != 1.0f) {
ctx->PopGroupToSource();
ctx->Paint(opacity);
}
#ifdef MOZ_TIMELINE #ifdef MOZ_TIMELINE
NS_TIMELINE_STOP_TIMER("Render Outline Text"); NS_TIMELINE_STOP_TIMER("Render Outline Text");
NS_TIMELINE_MARK_TIMER("Render Outline Text"); NS_TIMELINE_MARK_TIMER("Render Outline Text");