|
Lines 715-754
GetOutlineInnerRect(nsIFrame* aFrame)
|
Link Here
|
---|
|
715 |
} |
715 |
} |
716 |
|
716 |
|
717 |
void |
717 |
void |
718 |
nsCSSRendering::PaintOutline(nsPresContext* aPresContext, |
718 |
nsCSSRendering::PaintOutline(nsPresContext* aPresContext, |
719 |
nsIRenderingContext& aRenderingContext, |
719 |
nsIRenderingContext& aRenderingContext, |
720 |
nsIFrame* aForFrame, |
720 |
nsIFrame* aForFrame, |
721 |
const nsRect& aDirtyRect, |
721 |
const nsRect& aDirtyRect, |
722 |
const nsRect& aBorderArea, |
722 |
const nsRect& aBorderArea, |
723 |
const nsStyleBorder& aStyleBorder, |
|
|
724 |
const nsStyleOutline& aOutlineStyle, |
725 |
nsStyleContext* aStyleContext) |
723 |
nsStyleContext* aStyleContext) |
726 |
{ |
724 |
{ |
727 |
nscoord twipsRadii[8]; |
725 |
nscoord twipsRadii[8]; |
728 |
|
726 |
|
729 |
// Get our style context's color struct. |
727 |
// Get our style context's color struct. |
730 |
const nsStyleColor* ourColor = aStyleContext->GetStyleColor(); |
728 |
const nsStyleColor* ourColor = aStyleContext->GetStyleColor(); |
|
|
729 |
const nsStyleOutline* ourOutline = aStyleContext->GetStyleOutline(); |
731 |
|
730 |
|
732 |
nscoord width; |
731 |
nscoord width; |
733 |
aOutlineStyle.GetOutlineWidth(width); |
732 |
ourOutline->GetOutlineWidth(width); |
734 |
|
733 |
|
735 |
if (width == 0) { |
734 |
if (width == 0) { |
736 |
// Empty outline |
735 |
// Empty outline |
737 |
return; |
736 |
return; |
738 |
} |
737 |
} |
739 |
|
738 |
|
740 |
nsStyleContext* bgContext = nsCSSRendering::FindNonTransparentBackground |
739 |
nsStyleContext* bgContext = nsCSSRendering::FindNonTransparentBackground |
741 |
(aStyleContext, PR_FALSE); |
740 |
(aStyleContext, PR_FALSE); |
742 |
nscolor bgColor = |
741 |
nscolor bgColor = |
743 |
bgContext->GetVisitedDependentColor(eCSSProperty_background_color); |
742 |
bgContext->GetVisitedDependentColor(eCSSProperty_background_color); |
744 |
|
743 |
|
745 |
// get the radius for our outline |
744 |
// get the radius for our outline |
746 |
GetBorderRadiusTwips(aOutlineStyle.mOutlineRadius, aBorderArea.width, |
745 |
GetBorderRadiusTwips(ourOutline->mOutlineRadius, aBorderArea.width, |
747 |
twipsRadii); |
746 |
twipsRadii); |
748 |
|
747 |
|
749 |
// When the outline property is set on :-moz-anonymous-block or |
748 |
// When the outline property is set on :-moz-anonymous-block or |
750 |
// :-moz-anonyomus-positioned-block pseudo-elements, it inherited that |
749 |
// :-moz-anonyomus-positioned-block pseudo-elements, it inherited that |
751 |
// outline from the inline that was broken because it contained a |
750 |
// outline from the inline that was broken because it contained a |
752 |
// block. In that case, we don't want a really wide outline if the |
751 |
// block. In that case, we don't want a really wide outline if the |
753 |
// block inside the inline is narrow, so union the actual contents of |
752 |
// block inside the inline is narrow, so union the actual contents of |
754 |
// the anonymous blocks. |
753 |
// the anonymous blocks. |
Lines 773-789
nsCSSRendering::PaintOutline(nsPresConte
|
Link Here
|
---|
|
773 |
// the border. |
772 |
// the border. |
774 |
nsRect r(GetOutlineInnerRect(frameForArea) + |
773 |
nsRect r(GetOutlineInnerRect(frameForArea) + |
775 |
frameForArea->GetOffsetTo(aForFrame)); |
774 |
frameForArea->GetOffsetTo(aForFrame)); |
776 |
innerRect.UnionRect(innerRect, r); |
775 |
innerRect.UnionRect(innerRect, r); |
777 |
} |
776 |
} |
778 |
} |
777 |
} |
779 |
|
778 |
|
780 |
innerRect += aBorderArea.TopLeft(); |
779 |
innerRect += aBorderArea.TopLeft(); |
781 |
nscoord offset = aOutlineStyle.mOutlineOffset; |
780 |
nscoord offset = ourOutline->mOutlineOffset; |
782 |
innerRect.Inflate(offset, offset); |
781 |
innerRect.Inflate(offset, offset); |
783 |
// If the dirty rect is completely inside the border area (e.g., only the |
782 |
// If the dirty rect is completely inside the border area (e.g., only the |
784 |
// content is being painted), then we can skip out now |
783 |
// content is being painted), then we can skip out now |
785 |
// XXX this isn't exactly true for rounded borders, where the inside curves may |
784 |
// XXX this isn't exactly true for rounded borders, where the inside curves may |
786 |
// encroach into the content area. A safer calculation would be to |
785 |
// encroach into the content area. A safer calculation would be to |
787 |
// shorten insideRect by the radius one each side before performing this test. |
786 |
// shorten insideRect by the radius one each side before performing this test. |
788 |
if (innerRect.Contains(aDirtyRect)) |
787 |
if (innerRect.Contains(aDirtyRect)) |
789 |
return; |
788 |
return; |
Lines 798-824
nsCSSRendering::PaintOutline(nsPresConte
|
Link Here
|
---|
|
798 |
gfxRect oRect(RectToGfxRect(outerRect, twipsPerPixel)); |
797 |
gfxRect oRect(RectToGfxRect(outerRect, twipsPerPixel)); |
799 |
|
798 |
|
800 |
// convert the radii |
799 |
// convert the radii |
801 |
nsMargin outlineMargin(width, width, width, width); |
800 |
nsMargin outlineMargin(width, width, width, width); |
802 |
gfxCornerSizes outlineRadii; |
801 |
gfxCornerSizes outlineRadii; |
803 |
ComputePixelRadii(twipsRadii, outerRect, 0, twipsPerPixel, |
802 |
ComputePixelRadii(twipsRadii, outerRect, 0, twipsPerPixel, |
804 |
&outlineRadii); |
803 |
&outlineRadii); |
805 |
|
804 |
|
806 |
PRUint8 outlineStyle = aOutlineStyle.GetOutlineStyle(); |
805 |
PRUint8 outlineStyle = ourOutline->GetOutlineStyle(); |
807 |
PRUint8 outlineStyles[4] = { outlineStyle, |
806 |
PRUint8 outlineStyles[4] = { outlineStyle, |
808 |
outlineStyle, |
807 |
outlineStyle, |
809 |
outlineStyle, |
808 |
outlineStyle, |
810 |
outlineStyle }; |
809 |
outlineStyle }; |
811 |
|
810 |
|
812 |
nscolor outlineColor; |
811 |
// This handles treating the initial color as 'currentColor'; if we |
813 |
// PR_FALSE means use the initial color; PR_TRUE means a color was |
812 |
// ever want 'invert' back we'll need to do a bit of work here too. |
814 |
// set. |
813 |
nscolor outlineColor = |
815 |
if (!aOutlineStyle.GetOutlineColor(outlineColor)) |
814 |
aStyleContext->GetVisitedDependentColor(eCSSProperty_outline_color); |
816 |
outlineColor = ourColor->mColor; |
|
|
817 |
nscolor outlineColors[4] = { outlineColor, |
815 |
nscolor outlineColors[4] = { outlineColor, |
818 |
outlineColor, |
816 |
outlineColor, |
819 |
outlineColor, |
817 |
outlineColor, |
820 |
outlineColor }; |
818 |
outlineColor }; |
821 |
|
819 |
|
822 |
// convert the border widths |
820 |
// convert the border widths |
823 |
gfxFloat outlineWidths[4] = { width / twipsPerPixel, |
821 |
gfxFloat outlineWidths[4] = { width / twipsPerPixel, |
824 |
width / twipsPerPixel, |
822 |
width / twipsPerPixel, |