mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Use the appropriate color based on visitedness for nsCSSRendering::PaintBorder users of the 'border-*-color' properties. (Bug 147777) r=zweinberg
This commit is contained in:
parent
f27c596c76
commit
712030c86e
@ -78,6 +78,7 @@
|
||||
#include "gfxImageSurface.h"
|
||||
#include "nsStyleStructInlines.h"
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsCSSProps.h"
|
||||
|
||||
#include "nsCSSRenderingBorders.h"
|
||||
|
||||
@ -542,9 +543,40 @@ nsCSSRendering::PaintBorder(nsPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
const nsStyleBorder& aStyleBorder,
|
||||
nsStyleContext* aStyleContext,
|
||||
PRIntn aSkipSides)
|
||||
{
|
||||
nsStyleContext *styleIfVisited = aStyleContext->GetStyleIfVisited();
|
||||
const nsStyleBorder *styleBorder = aStyleContext->GetStyleBorder();
|
||||
// Don't check RelevantLinkVisited here, since we want to take the
|
||||
// same amount of time whether or not it's true.
|
||||
if (!styleIfVisited) {
|
||||
PaintBorderWithStyleBorder(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, aBorderArea, *styleBorder,
|
||||
aStyleContext, aSkipSides);
|
||||
return;
|
||||
}
|
||||
|
||||
nsStyleBorder newStyleBorder(*styleBorder);
|
||||
NS_FOR_CSS_SIDES(side) {
|
||||
newStyleBorder.SetBorderColor(side,
|
||||
aStyleContext->GetVisitedDependentColor(
|
||||
nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_color)[side]));
|
||||
}
|
||||
PaintBorderWithStyleBorder(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, aBorderArea, newStyleBorder,
|
||||
aStyleContext, aSkipSides);
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSRendering::PaintBorderWithStyleBorder(nsPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
const nsStyleBorder& aStyleBorder,
|
||||
nsStyleContext* aStyleContext,
|
||||
PRIntn aSkipSides)
|
||||
{
|
||||
nsMargin border;
|
||||
nscoord twipsRadii[8];
|
||||
|
@ -95,10 +95,23 @@ struct nsCSSRendering {
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
const nsStyleBorder& aBorderStyle,
|
||||
nsStyleContext* aStyleContext,
|
||||
PRIntn aSkipSides = 0);
|
||||
|
||||
/**
|
||||
* Like PaintBorder, but taking an nsStyleBorder argument instead of
|
||||
* getting it from aStyleContext.
|
||||
*/
|
||||
static void PaintBorderWithStyleBorder(nsPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
const nsStyleBorder& aBorderStyle,
|
||||
nsStyleContext* aStyleContext,
|
||||
PRIntn aSkipSides = 0);
|
||||
|
||||
|
||||
/**
|
||||
* Render the outline for an element using css rendering rules
|
||||
* for borders. aSkipSides is a bitmask of the sides to skip
|
||||
|
@ -1253,7 +1253,6 @@ nsDisplayBorder::Paint(nsDisplayListBuilder* aBuilder,
|
||||
nsCSSRendering::PaintBorder(mFrame->PresContext(), *aCtx, mFrame,
|
||||
mVisibleRect,
|
||||
nsRect(offset, mFrame->GetSize()),
|
||||
*mFrame->GetStyleBorder(),
|
||||
mFrame->GetStyleContext(),
|
||||
mFrame->GetSkipSides());
|
||||
}
|
||||
|
@ -234,9 +234,8 @@ nsButtonFrameRenderer::PaintOutlineAndFocusBorders(nsPresContext* aPresContext,
|
||||
|
||||
GetButtonOuterFocusRect(aRect, rect);
|
||||
|
||||
const nsStyleBorder* border = mOuterFocusStyle->GetStyleBorder();
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
|
||||
aDirtyRect, rect, *border, mOuterFocusStyle);
|
||||
aDirtyRect, rect, mOuterFocusStyle);
|
||||
}
|
||||
|
||||
if (mInnerFocusStyle) {
|
||||
@ -244,9 +243,8 @@ nsButtonFrameRenderer::PaintOutlineAndFocusBorders(nsPresContext* aPresContext,
|
||||
|
||||
GetButtonInnerFocusRect(aRect, rect);
|
||||
|
||||
const nsStyleBorder* border = mInnerFocusStyle->GetStyleBorder();
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
|
||||
aDirtyRect, rect, *border, mInnerFocusStyle);
|
||||
aDirtyRect, rect, mInnerFocusStyle);
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,14 +263,12 @@ nsButtonFrameRenderer::PaintBorderAndBackground(nsPresContext* aPresContext,
|
||||
|
||||
nsStyleContext* context = mFrame->GetStyleContext();
|
||||
|
||||
const nsStyleBorder* border = context->GetStyleBorder();
|
||||
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, mFrame,
|
||||
aDirtyRect, buttonRect, aBGFlags);
|
||||
nsCSSRendering::PaintBoxShadowInner(aPresContext, aRenderingContext,
|
||||
mFrame, buttonRect, aDirtyRect);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
|
||||
aDirtyRect, buttonRect, *border, context);
|
||||
aDirtyRect, buttonRect, context);
|
||||
}
|
||||
|
||||
|
||||
|
@ -306,8 +306,7 @@ nsFieldSetFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *borderStyle, mStyleContext,
|
||||
skipSides);
|
||||
aDirtyRect, rect, mStyleContext, skipSides);
|
||||
|
||||
aRenderingContext.PopState();
|
||||
|
||||
@ -321,8 +320,7 @@ nsFieldSetFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *borderStyle, mStyleContext,
|
||||
skipSides);
|
||||
aDirtyRect, rect, mStyleContext, skipSides);
|
||||
|
||||
aRenderingContext.PopState();
|
||||
|
||||
@ -335,8 +333,7 @@ nsFieldSetFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *borderStyle, mStyleContext,
|
||||
skipSides);
|
||||
aDirtyRect, rect, mStyleContext, skipSides);
|
||||
|
||||
aRenderingContext.PopState();
|
||||
} else {
|
||||
@ -344,7 +341,7 @@ nsFieldSetFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
aDirtyRect,
|
||||
nsRect(aPt, mRect.Size()),
|
||||
*borderStyle, mStyleContext, skipSides);
|
||||
mStyleContext, skipSides);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,10 +279,10 @@ nsColumnSetFrame::PaintColumnRule(nsIRenderingContext* aCtx,
|
||||
contentRect.y);
|
||||
|
||||
nsRect lineRect(linePt, ruleSize);
|
||||
nsCSSRendering::PaintBorder(presContext, *aCtx, this, aDirtyRect,
|
||||
lineRect, border, GetStyleContext(),
|
||||
// Remember, we only have the "left" "border". Skip everything else
|
||||
(1 << NS_SIDE_TOP | 1 << NS_SIDE_RIGHT | 1 << NS_SIDE_BOTTOM));
|
||||
nsCSSRendering::PaintBorderWithStyleBorder(presContext, *aCtx, this,
|
||||
aDirtyRect, lineRect, border, GetStyleContext(),
|
||||
// Remember, we only have the "left" "border". Skip everything else
|
||||
(1 << NS_SIDE_TOP | 1 << NS_SIDE_RIGHT | 1 << NS_SIDE_BOTTOM));
|
||||
|
||||
child = nextSibling;
|
||||
nextSibling = nextSibling->GetNextSibling();
|
||||
|
@ -1009,8 +1009,9 @@ nsImageFrame::DisplayAltFeedback(nsIRenderingContext& aRenderingContext,
|
||||
|
||||
// Paint the border
|
||||
nsRecessedBorder recessedBorder(borderEdgeWidth, PresContext());
|
||||
nsCSSRendering::PaintBorder(PresContext(), aRenderingContext, this, inner,
|
||||
inner, recessedBorder, mStyleContext);
|
||||
nsCSSRendering::PaintBorderWithStyleBorder(PresContext(), aRenderingContext,
|
||||
this, inner, inner,
|
||||
recessedBorder, mStyleContext);
|
||||
|
||||
// Adjust the inner rect to account for the one pixel recessed border,
|
||||
// and a six pixel padding on each edge
|
||||
|
@ -2008,8 +2008,7 @@ void nsDisplayMathMLCharDebug::Paint(nsDisplayListBuilder* aBuilder,
|
||||
nsStyleContext* styleContext = mFrame->GetStyleContext();
|
||||
nsRect rect = mRect + aBuilder->ToReferenceFrame(mFrame);
|
||||
nsCSSRendering::PaintBorder(presContext, *aCtx, mFrame,
|
||||
mVisibleRect, rect, *border, styleContext,
|
||||
skipSides);
|
||||
mVisibleRect, rect, styleContext, skipSides);
|
||||
nsCSSRendering::PaintOutline(presContext, *aCtx, mFrame,
|
||||
mVisibleRect, rect, *border,
|
||||
*mFrame->GetStyleOutline(), styleContext);
|
||||
|
@ -1366,13 +1366,11 @@ nsTableFrame::PaintTableBorderBackground(nsIRenderingContext& aRenderingContext,
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
if (GetStyleVisibility()->IsVisible()) {
|
||||
const nsStyleBorder* border = GetStyleBorder();
|
||||
if (!IsBorderCollapse()) {
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
nsRect rect(aPt, mRect.Size());
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, mStyleContext,
|
||||
skipSides);
|
||||
aDirtyRect, rect, mStyleContext, skipSides);
|
||||
}
|
||||
else {
|
||||
// XXX we should probably get rid of this translation at some stage
|
||||
|
@ -195,8 +195,7 @@ nsGroupBoxFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *borderStyleData,
|
||||
mStyleContext, skipSides);
|
||||
aDirtyRect, rect, mStyleContext, skipSides);
|
||||
|
||||
aRenderingContext.PopState();
|
||||
|
||||
@ -210,8 +209,7 @@ nsGroupBoxFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *borderStyleData,
|
||||
mStyleContext, skipSides);
|
||||
aDirtyRect, rect, mStyleContext, skipSides);
|
||||
|
||||
aRenderingContext.PopState();
|
||||
|
||||
@ -226,15 +224,14 @@ nsGroupBoxFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
|
||||
aRenderingContext.PushState();
|
||||
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *borderStyleData,
|
||||
mStyleContext, skipSides);
|
||||
aDirtyRect, rect, mStyleContext, skipSides);
|
||||
|
||||
aRenderingContext.PopState();
|
||||
|
||||
} else {
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
aDirtyRect, nsRect(aPt, GetSize()),
|
||||
*borderStyleData, mStyleContext, skipSides);
|
||||
mStyleContext, skipSides);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3908,8 +3908,9 @@ nsTreeBodyFrame::PaintBackgroundLayer(nsStyleContext* aStyleContext,
|
||||
aStyleContext, *myBorder,
|
||||
nsCSSRendering::PAINTBG_SYNC_DECODE_IMAGES);
|
||||
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, aRect, *myBorder, mStyleContext);
|
||||
nsCSSRendering::PaintBorderWithStyleBorder(aPresContext, aRenderingContext,
|
||||
this, aDirtyRect, aRect,
|
||||
*myBorder, mStyleContext);
|
||||
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, aRect, *myBorder, *myOutline,
|
||||
|
Loading…
Reference in New Issue
Block a user