зеркало из https://github.com/mozilla/gecko-dev.git
Reduce code size by using PaintSelf member function to paint background, border, and outline. b=184702 r+sr=roc
This commit is contained in:
Родитель
d13c53e98d
Коммит
28018a8db9
|
@ -49,7 +49,6 @@
|
|||
#include "nsLineLayout.h"
|
||||
#include "nsPlaceholderFrame.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsIFrameManager.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
@ -5652,7 +5651,7 @@ nsBlockFrame::Paint(nsIPresContext* aPresContext,
|
|||
#endif
|
||||
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect, aFlags);
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect);
|
||||
}
|
||||
|
||||
PRBool paintingSuppressed = PR_FALSE;
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include <stdarg.h>
|
||||
#include "nsISizeOfHandler.h"
|
||||
#include "nsIFrameManager.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIAccessible.h"
|
||||
|
@ -945,6 +946,44 @@ nsFrame::Paint(nsIPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsFrame::PaintSelf(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
PRIntn aSkipSides)
|
||||
{
|
||||
// The visibility check belongs here since child elements have the
|
||||
// opportunity to override the visibility property and display even if
|
||||
// their parent is hidden.
|
||||
|
||||
PRBool isVisible;
|
||||
if (mRect.height == 0 || mRect.width == 0 ||
|
||||
NS_FAILED(IsVisibleForPainting(aPresContext, aRenderingContext,
|
||||
PR_TRUE, &isVisible)) ||
|
||||
!isVisible) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Paint our background and border
|
||||
const nsStyleBorder* border;
|
||||
::GetStyleData(mStyleContext, &border);
|
||||
const nsStylePadding* padding;
|
||||
::GetStyleData(mStyleContext, &padding);
|
||||
const nsStyleOutline* outline;
|
||||
::GetStyleData(mStyleContext, &outline);
|
||||
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, *padding,
|
||||
0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, mStyleContext,
|
||||
aSkipSides);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, *outline,
|
||||
mStyleContext, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -469,6 +469,16 @@ protected:
|
|||
nsFrame();
|
||||
virtual ~nsFrame();
|
||||
|
||||
/**
|
||||
* To be called by |Paint| of this class or derived classes to paint
|
||||
* the background, border, and outline, when in the correct layer to
|
||||
* do so.
|
||||
*/
|
||||
void PaintSelf(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
PRIntn aSkipSides = 0);
|
||||
|
||||
PRInt16 DisplaySelection(nsIPresContext* aPresContext, PRBool isOkToTurnOn = PR_FALSE);
|
||||
|
||||
//this will modify aPos and return the next frame ect.
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "nsIView.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsGfxScrollFrame.h"
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "nsIPresShell.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsCSSAnonBoxes.h"
|
||||
|
@ -82,52 +81,13 @@ nsHTMLContainerFrame::Paint(nsIPresContext* aPresContext,
|
|||
// others in the background (bug 36710). (nsInlineFrame::Paint does
|
||||
// this differently.)
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect, aFlags);
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect);
|
||||
}
|
||||
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aFlags);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLContainerFrame::PaintSelf(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
// The visibility check belongs here since child elements have the
|
||||
// opportunity to override the visibility property and display even if
|
||||
// their parent is hidden.
|
||||
|
||||
PRBool isVisible;
|
||||
if (NS_FAILED(IsVisibleForPainting(aPresContext, aRenderingContext,
|
||||
PR_TRUE, &isVisible)) ||
|
||||
!isVisible ||
|
||||
mRect.width == 0 || mRect.height == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Paint our background and border
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleBorder* border;
|
||||
::GetStyleData(mStyleContext, &border);
|
||||
const nsStylePadding* padding;
|
||||
::GetStyleData(mStyleContext, &padding);
|
||||
const nsStyleOutline* outline;
|
||||
::GetStyleData(mStyleContext, &outline);
|
||||
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, *padding,
|
||||
0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, mStyleContext,
|
||||
skipSides);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, *outline,
|
||||
mStyleContext, 0);
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLContainerFrame::PaintDecorationsAndChildren(
|
||||
nsIPresContext* aPresContext,
|
||||
|
|
|
@ -123,15 +123,12 @@ public:
|
|||
protected:
|
||||
virtual PRIntn GetSkipSides() const = 0;
|
||||
|
||||
/**
|
||||
* To be called by |Paint| of this class or derived classes to paint
|
||||
* the background, border, and outline, when in the correct layer to
|
||||
* do so.
|
||||
*/
|
||||
void PaintSelf(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
PRUint32 aFlags);
|
||||
const nsRect& aDirtyRect) {
|
||||
nsContainerFrame::PaintSelf(aPresContext, aRenderingContext,
|
||||
aDirtyRect, GetSkipSides());
|
||||
}
|
||||
|
||||
/**
|
||||
* To be called *instead* of |PaintChildren| by frames that paint text
|
||||
|
|
|
@ -399,7 +399,7 @@ CanvasFrame::Paint(nsIPresContext* aPresContext,
|
|||
shell->IsPaintingSuppressed(&paintingSuppressed);
|
||||
if (paintingSuppressed) {
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect, aFlags);
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -1302,21 +1302,7 @@ nsImageFrame::Paint(nsIPresContext* aPresContext,
|
|||
? NS_FRAME_PAINT_LAYER_BACKGROUND
|
||||
: NS_FRAME_PAINT_LAYER_FOREGROUND;
|
||||
if (aWhichLayer == backgroundLayer) {
|
||||
const nsStyleVisibility* vis =
|
||||
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBorder* myBorder = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStylePadding* myPadding = (const nsStylePadding*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Padding);
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, *myPadding,
|
||||
0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder,
|
||||
mStyleContext, 0);
|
||||
}
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect);
|
||||
}
|
||||
|
||||
nsCOMPtr<imgIContainer> imgCon;
|
||||
|
|
|
@ -337,7 +337,7 @@ nsInlineFrame::Paint(nsIPresContext* aPresContext,
|
|||
|
||||
// Paint inline element backgrounds in the foreground layer (bug 36710).
|
||||
if (aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND) {
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect, aFlags);
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect);
|
||||
}
|
||||
|
||||
// The sole purpose of this is to trigger display of the selection
|
||||
|
|
|
@ -37,12 +37,10 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsLeafFrame.h"
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIStyleContext.h"
|
||||
|
||||
nsLeafFrame::~nsLeafFrame()
|
||||
{
|
||||
|
@ -56,33 +54,7 @@ nsLeafFrame::Paint(nsIPresContext* aPresContext,
|
|||
PRUint32 aFlags)
|
||||
{
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
||||
PRBool isVisible;
|
||||
if (NS_SUCCEEDED(IsVisibleForPainting(aPresContext, aRenderingContext, PR_FALSE, &isVisible)) &&
|
||||
!isVisible) {// just checks selection painting
|
||||
return NS_OK; // not visibility
|
||||
}
|
||||
|
||||
const nsStyleVisibility* vis =
|
||||
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
|
||||
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBorder* myBorder = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStylePadding* myPadding = (const nsStylePadding*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Padding);
|
||||
const nsStyleOutline* myOutline = (const nsStyleOutline*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Outline);
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, *myPadding,
|
||||
0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder,
|
||||
mStyleContext, 0);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder,
|
||||
*myOutline, mStyleContext, 0);
|
||||
}
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect);
|
||||
}
|
||||
DO_GLOBAL_REFLOW_COUNT_DSP("nsLeafFrame", &aRenderingContext);
|
||||
return NS_OK;
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "nsLineLayout.h"
|
||||
#include "nsPlaceholderFrame.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsIFrameManager.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
@ -5652,7 +5651,7 @@ nsBlockFrame::Paint(nsIPresContext* aPresContext,
|
|||
#endif
|
||||
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect, aFlags);
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect);
|
||||
}
|
||||
|
||||
PRBool paintingSuppressed = PR_FALSE;
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include <stdarg.h>
|
||||
#include "nsISizeOfHandler.h"
|
||||
#include "nsIFrameManager.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIAccessible.h"
|
||||
|
@ -945,6 +946,44 @@ nsFrame::Paint(nsIPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsFrame::PaintSelf(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
PRIntn aSkipSides)
|
||||
{
|
||||
// The visibility check belongs here since child elements have the
|
||||
// opportunity to override the visibility property and display even if
|
||||
// their parent is hidden.
|
||||
|
||||
PRBool isVisible;
|
||||
if (mRect.height == 0 || mRect.width == 0 ||
|
||||
NS_FAILED(IsVisibleForPainting(aPresContext, aRenderingContext,
|
||||
PR_TRUE, &isVisible)) ||
|
||||
!isVisible) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Paint our background and border
|
||||
const nsStyleBorder* border;
|
||||
::GetStyleData(mStyleContext, &border);
|
||||
const nsStylePadding* padding;
|
||||
::GetStyleData(mStyleContext, &padding);
|
||||
const nsStyleOutline* outline;
|
||||
::GetStyleData(mStyleContext, &outline);
|
||||
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, *padding,
|
||||
0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, mStyleContext,
|
||||
aSkipSides);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, *outline,
|
||||
mStyleContext, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -469,6 +469,16 @@ protected:
|
|||
nsFrame();
|
||||
virtual ~nsFrame();
|
||||
|
||||
/**
|
||||
* To be called by |Paint| of this class or derived classes to paint
|
||||
* the background, border, and outline, when in the correct layer to
|
||||
* do so.
|
||||
*/
|
||||
void PaintSelf(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
PRIntn aSkipSides = 0);
|
||||
|
||||
PRInt16 DisplaySelection(nsIPresContext* aPresContext, PRBool isOkToTurnOn = PR_FALSE);
|
||||
|
||||
//this will modify aPos and return the next frame ect.
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "nsIView.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsGfxScrollFrame.h"
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "nsIPresShell.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsCSSAnonBoxes.h"
|
||||
|
@ -82,52 +81,13 @@ nsHTMLContainerFrame::Paint(nsIPresContext* aPresContext,
|
|||
// others in the background (bug 36710). (nsInlineFrame::Paint does
|
||||
// this differently.)
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect, aFlags);
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect);
|
||||
}
|
||||
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aFlags);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLContainerFrame::PaintSelf(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
// The visibility check belongs here since child elements have the
|
||||
// opportunity to override the visibility property and display even if
|
||||
// their parent is hidden.
|
||||
|
||||
PRBool isVisible;
|
||||
if (NS_FAILED(IsVisibleForPainting(aPresContext, aRenderingContext,
|
||||
PR_TRUE, &isVisible)) ||
|
||||
!isVisible ||
|
||||
mRect.width == 0 || mRect.height == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Paint our background and border
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleBorder* border;
|
||||
::GetStyleData(mStyleContext, &border);
|
||||
const nsStylePadding* padding;
|
||||
::GetStyleData(mStyleContext, &padding);
|
||||
const nsStyleOutline* outline;
|
||||
::GetStyleData(mStyleContext, &outline);
|
||||
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, *padding,
|
||||
0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, mStyleContext,
|
||||
skipSides);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, *outline,
|
||||
mStyleContext, 0);
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLContainerFrame::PaintDecorationsAndChildren(
|
||||
nsIPresContext* aPresContext,
|
||||
|
|
|
@ -123,15 +123,12 @@ public:
|
|||
protected:
|
||||
virtual PRIntn GetSkipSides() const = 0;
|
||||
|
||||
/**
|
||||
* To be called by |Paint| of this class or derived classes to paint
|
||||
* the background, border, and outline, when in the correct layer to
|
||||
* do so.
|
||||
*/
|
||||
void PaintSelf(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
PRUint32 aFlags);
|
||||
const nsRect& aDirtyRect) {
|
||||
nsContainerFrame::PaintSelf(aPresContext, aRenderingContext,
|
||||
aDirtyRect, GetSkipSides());
|
||||
}
|
||||
|
||||
/**
|
||||
* To be called *instead* of |PaintChildren| by frames that paint text
|
||||
|
|
|
@ -399,7 +399,7 @@ CanvasFrame::Paint(nsIPresContext* aPresContext,
|
|||
shell->IsPaintingSuppressed(&paintingSuppressed);
|
||||
if (paintingSuppressed) {
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect, aFlags);
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -1302,21 +1302,7 @@ nsImageFrame::Paint(nsIPresContext* aPresContext,
|
|||
? NS_FRAME_PAINT_LAYER_BACKGROUND
|
||||
: NS_FRAME_PAINT_LAYER_FOREGROUND;
|
||||
if (aWhichLayer == backgroundLayer) {
|
||||
const nsStyleVisibility* vis =
|
||||
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBorder* myBorder = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStylePadding* myPadding = (const nsStylePadding*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Padding);
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, *myPadding,
|
||||
0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder,
|
||||
mStyleContext, 0);
|
||||
}
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect);
|
||||
}
|
||||
|
||||
nsCOMPtr<imgIContainer> imgCon;
|
||||
|
|
|
@ -337,7 +337,7 @@ nsInlineFrame::Paint(nsIPresContext* aPresContext,
|
|||
|
||||
// Paint inline element backgrounds in the foreground layer (bug 36710).
|
||||
if (aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND) {
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect, aFlags);
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect);
|
||||
}
|
||||
|
||||
// The sole purpose of this is to trigger display of the selection
|
||||
|
|
|
@ -37,12 +37,10 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsLeafFrame.h"
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIStyleContext.h"
|
||||
|
||||
nsLeafFrame::~nsLeafFrame()
|
||||
{
|
||||
|
@ -56,33 +54,7 @@ nsLeafFrame::Paint(nsIPresContext* aPresContext,
|
|||
PRUint32 aFlags)
|
||||
{
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
||||
PRBool isVisible;
|
||||
if (NS_SUCCEEDED(IsVisibleForPainting(aPresContext, aRenderingContext, PR_FALSE, &isVisible)) &&
|
||||
!isVisible) {// just checks selection painting
|
||||
return NS_OK; // not visibility
|
||||
}
|
||||
|
||||
const nsStyleVisibility* vis =
|
||||
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
|
||||
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBorder* myBorder = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStylePadding* myPadding = (const nsStylePadding*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Padding);
|
||||
const nsStyleOutline* myOutline = (const nsStyleOutline*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Outline);
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, *myPadding,
|
||||
0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder,
|
||||
mStyleContext, 0);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder,
|
||||
*myOutline, mStyleContext, 0);
|
||||
}
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect);
|
||||
}
|
||||
DO_GLOBAL_REFLOW_COUNT_DSP("nsLeafFrame", &aRenderingContext);
|
||||
return NS_OK;
|
||||
|
|
|
@ -261,27 +261,8 @@ nsMathMLmactionFrame::Paint(nsIPresContext* aPresContext,
|
|||
nsFramePaintLayer aWhichLayer,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
const nsStyleVisibility* visib = NS_STATIC_CAST(const nsStyleVisibility*,
|
||||
mStyleContext->GetStyleData(eStyleStruct_Visibility));
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
||||
if (visib->IsVisible() && mRect.width && mRect.height) {
|
||||
// Paint our background and border
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleBorder* border = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStylePadding* padding = (const nsStylePadding*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Padding);
|
||||
const nsStyleOutline* outline = (const nsStyleOutline*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Outline);
|
||||
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, *padding, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, mStyleContext, skipSides);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, *outline, mStyleContext, 0);
|
||||
}
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect);
|
||||
}
|
||||
|
||||
nsIFrame* childFrame = GetSelectedFrame();
|
||||
|
|
|
@ -1465,43 +1465,13 @@ nsBoxFrame::Paint(nsIPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
GetFrameType(getter_AddRefs(frameType));
|
||||
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
||||
if (vis->IsVisible() && mRect.width && mRect.height) {
|
||||
// Paint our background and border
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleBorder* border = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStylePadding* padding = (const nsStylePadding*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Padding);
|
||||
const nsStyleOutline* outline = (const nsStyleOutline*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Outline);
|
||||
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, *padding,
|
||||
0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, mStyleContext, skipSides);
|
||||
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, *outline, mStyleContext, 0);
|
||||
|
||||
// The sole purpose of this is to trigger display
|
||||
// of the selection window for Named Anchors,
|
||||
// which don't have any children and normally don't
|
||||
// have any size, but in Editor we use CSS to display
|
||||
// an image to represent this "hidden" element.
|
||||
if (!mFrames.FirstChild())
|
||||
{
|
||||
nsFrame::Paint(aPresContext,
|
||||
aRenderingContext, aDirtyRect, aWhichLayer);
|
||||
}
|
||||
}
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect);
|
||||
}
|
||||
|
||||
if (frameType.get() == nsLayoutAtoms::rootFrame) {
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
GetFrameType(getter_AddRefs(frameType));
|
||||
if (frameType == nsLayoutAtoms::rootFrame) {
|
||||
// We are wrapping the root frame of a XUL document. We
|
||||
// need to check the pres shell to find out if painting is locked
|
||||
// down (because we're still in the early stages of document
|
||||
|
|
|
@ -232,9 +232,6 @@ protected:
|
|||
nsFramePaintLayer aWhichLayer,
|
||||
PRUint32 aFlags = 0);
|
||||
|
||||
virtual PRIntn GetSkipSides() const { return 0; }
|
||||
|
||||
|
||||
virtual PRBool GetInitialEqualSize(PRBool& aEqualSize);
|
||||
virtual void GetInitialOrientation(PRBool& aIsHorizontal);
|
||||
virtual void GetInitialDirection(PRBool& aIsNormal);
|
||||
|
|
|
@ -322,21 +322,7 @@ nsDeckFrame::Paint(nsIPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
||||
if (vis->IsVisible() && mRect.width && mRect.height) {
|
||||
// Paint our background and border
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleBorder* border = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStylePadding* padding = (const nsStylePadding*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Padding);
|
||||
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, *padding,
|
||||
0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *border, mStyleContext, skipSides);
|
||||
}
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect);
|
||||
}
|
||||
|
||||
// only paint the seleced box
|
||||
|
|
|
@ -126,7 +126,7 @@ nsGroupBoxFrame::Paint(nsIPresContext* aPresContext,
|
|||
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
|
||||
|
||||
if (vis->IsVisible() && mRect.width && mRect.height) {
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
PRIntn skipSides = 0;
|
||||
const nsStyleBorder* borderStyleData =
|
||||
(const nsStyleBorder*)mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStylePadding* paddingStyleData =
|
||||
|
|
|
@ -634,12 +634,6 @@ nsScrollBoxFrame::Paint(nsIPresContext* aPresContext,
|
|||
return nsFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
||||
}
|
||||
|
||||
PRIntn
|
||||
nsScrollBoxFrame::GetSkipSides() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsScrollBoxFrame::GetContentOf(nsIContent** aContent)
|
||||
{
|
||||
|
|
|
@ -120,7 +120,6 @@ public:
|
|||
|
||||
protected:
|
||||
nsScrollBoxFrame(nsIPresShell* aShell);
|
||||
virtual PRIntn GetSkipSides() const;
|
||||
|
||||
// Creation of the widget for the scrolling view is factored into a virtual method so
|
||||
// that sub-classes may control widget creation.
|
||||
|
|
|
@ -308,20 +308,7 @@ nsSliderFrame::Paint(nsIPresContext* aPresContext,
|
|||
if (crect.width < thumbRect.width || crect.height < thumbRect.height)
|
||||
{
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
||||
const nsStyleVisibility* vis = (const nsStyleVisibility*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Visibility);
|
||||
if (vis->IsVisibleOrCollapsed()) {
|
||||
const nsStyleBorder* myBorder = (const nsStyleBorder*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Border);
|
||||
const nsStylePadding* myPadding = (const nsStylePadding*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Padding);
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, *myPadding,
|
||||
0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *myBorder, mStyleContext, 0);
|
||||
}
|
||||
PaintSelf(aPresContext, aRenderingContext, aDirtyRect);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -228,10 +228,6 @@ public:
|
|||
NS_IMETHOD_(void) Notify(nsITimer *timer);
|
||||
//friend nsSliderMediator;
|
||||
|
||||
protected:
|
||||
|
||||
virtual PRIntn GetSkipSides() const { return 0; }
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче