зеркало из https://github.com/mozilla/gecko-dev.git
Changes to actually print checkbox's and radiobuttons under Windows.
No longer need special offset's during printing. nsFormControlFrame now detects when to gfx render the widgets.
This commit is contained in:
Родитель
4408592081
Коммит
2c74221f9c
|
@ -230,11 +230,23 @@ nsFormControlFrame::Reflow(nsIPresContext& aPresContext,
|
|||
//XXX:PRINTING Temporary to force GFX rendered widgets to appear on the display. This
|
||||
//Will be used to debug GFX rendered widgets for printing. This should be removed when
|
||||
//Printing is completely working.
|
||||
PRBool renderToScreen = PR_FALSE;
|
||||
if (PR_TRUE == renderToScreen) {
|
||||
PRBool renderToScreen = PR_FALSE;
|
||||
|
||||
nsIDeviceContext* dx = nsnull;
|
||||
dx = aPresContext.GetDeviceContext();
|
||||
PRBool supportsWidgets = PR_FALSE;
|
||||
if (nsnull != dx) {
|
||||
PRBool native = PR_FALSE;
|
||||
dx->SupportsNativeWidgets(supportsWidgets);
|
||||
|
||||
NS_RELEASE(dx);
|
||||
}
|
||||
|
||||
if ((PR_TRUE == renderToScreen) || (PR_FALSE == supportsWidgets)) {
|
||||
return(ReflowWithNoWidget(aPresContext, aDesiredSize, aReflowState, aStatus));
|
||||
}
|
||||
|
||||
|
||||
GetDesiredSize(&aPresContext, aReflowState, aDesiredSize, mWidgetSize);
|
||||
|
||||
if (!mDidInit) {
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#ifdef XP_PC
|
||||
#define NS_PC_DESIRED_CHECKBOX_SIZE 20
|
||||
#define NS_PC_ABSOLUTE_CHECKBOX_SIZE 12
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -413,14 +414,11 @@ nsCheckboxControlFrame::PaintCheckBox(nsIPresContext& aPresContext,
|
|||
float p2t;
|
||||
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||
|
||||
//XXX:??? Offset for rendering, Not sure why we need this??? When rendering the
|
||||
//checkbox to the screen this is not needed. But it is needed when Printing. Looks
|
||||
// Like it offsets from the middle of the control during Printing, but not when rendered
|
||||
// to the screen?
|
||||
const int printOffsetX = (NS_PC_DESIRED_CHECKBOX_SIZE / 2);
|
||||
const int printOffsetY = (NS_PC_DESIRED_CHECKBOX_SIZE / 2);
|
||||
aRenderingContext.Translate(NSIntPixelsToTwips(printOffsetX, p2t),
|
||||
NSIntPixelsToTwips(printOffsetY, p2t));
|
||||
//Offset fixed size checkbox in to the middle of the area reserved for the checkbox
|
||||
const int printOffsetX = (NS_PC_DESIRED_CHECKBOX_SIZE - NS_PC_ABSOLUTE_CHECKBOX_SIZE);
|
||||
const int printOffsetY = (NS_PC_DESIRED_CHECKBOX_SIZE - NS_PC_ABSOLUTE_CHECKBOX_SIZE);
|
||||
aRenderingContext.Translate(NSIntPixelsToTwips(printOffsetX, p2t),
|
||||
NSIntPixelsToTwips(printOffsetY, p2t));
|
||||
|
||||
// Draw's background + border
|
||||
PaintFixedSizeCheckMarkBorder(aRenderingContext, p2t);
|
||||
|
|
|
@ -230,11 +230,23 @@ nsFormControlFrame::Reflow(nsIPresContext& aPresContext,
|
|||
//XXX:PRINTING Temporary to force GFX rendered widgets to appear on the display. This
|
||||
//Will be used to debug GFX rendered widgets for printing. This should be removed when
|
||||
//Printing is completely working.
|
||||
PRBool renderToScreen = PR_FALSE;
|
||||
if (PR_TRUE == renderToScreen) {
|
||||
PRBool renderToScreen = PR_FALSE;
|
||||
|
||||
nsIDeviceContext* dx = nsnull;
|
||||
dx = aPresContext.GetDeviceContext();
|
||||
PRBool supportsWidgets = PR_FALSE;
|
||||
if (nsnull != dx) {
|
||||
PRBool native = PR_FALSE;
|
||||
dx->SupportsNativeWidgets(supportsWidgets);
|
||||
|
||||
NS_RELEASE(dx);
|
||||
}
|
||||
|
||||
if ((PR_TRUE == renderToScreen) || (PR_FALSE == supportsWidgets)) {
|
||||
return(ReflowWithNoWidget(aPresContext, aDesiredSize, aReflowState, aStatus));
|
||||
}
|
||||
|
||||
|
||||
GetDesiredSize(&aPresContext, aReflowState, aDesiredSize, mWidgetSize);
|
||||
|
||||
if (!mDidInit) {
|
||||
|
|
|
@ -323,15 +323,6 @@ nsRadioControlFrame::PaintRadioButton(nsIPresContext& aPresContext,
|
|||
float p2t;
|
||||
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||
|
||||
//XXX:??? Offset for rendering, Not sure why we need this??? When rendering the
|
||||
//radiobox to the screen this is not needed. But it is needed when Printing. Looks
|
||||
// Like it offsets from the middle of the control during Printing, but not when rendered
|
||||
// to the screen?
|
||||
const int printOffsetX = (NS_DESIRED_RADIOBOX_SIZE / 2);
|
||||
const int printOffsetY = (NS_DESIRED_RADIOBOX_SIZE / 2);
|
||||
aRenderingContext.Translate(NSIntPixelsToTwips(printOffsetX, p2t),
|
||||
NSIntPixelsToTwips(printOffsetY, p2t));
|
||||
|
||||
nsFormControlFrame::Paint(aPresContext, aRenderingContext, aDirtyRect);
|
||||
|
||||
const nsStyleSpacing* spacing = (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||
|
|
Загрузка…
Ссылка в новой задаче