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
Родитель 86da6932d3
Коммит 986b94d168
3 изменённых файлов: 35 добавлений и 0 удалений

Просмотреть файл

@ -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>

Просмотреть файл

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

Просмотреть файл

@ -3553,6 +3553,9 @@ nsTreeBodyFrame::PaintText(PRInt32 aRowIndex,
// out and to paint.
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
// amount. The text is assumed to be contained within the deflated rect.
nsRect textRect(aTextRect);
@ -3619,8 +3622,19 @@ nsTreeBodyFrame::PaintText(PRInt32 aRowIndex,
PRUint8 direction = aTextRTL ? NS_STYLE_DIRECTION_RTL :
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(),
textRect.TopLeft() + nsPoint(0, baseline), direction);
if (opacity != 1.0f) {
ctx->PopGroupToSource();
ctx->Paint(opacity);
}
#ifdef MOZ_TIMELINE
NS_TIMELINE_STOP_TIMER("Render Outline Text");
NS_TIMELINE_MARK_TIMER("Render Outline Text");