mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 01:54:47 +02:00
8181659: Create an alternative fix for JDK-8167102, whose fix was backed out
Reviewed-by: prr, serb
This commit is contained in:
parent
d8efdbc4a2
commit
0b2a269330
2 changed files with 38 additions and 6 deletions
|
@ -886,12 +886,45 @@ public abstract class RasterPrinterJob extends PrinterJob {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PageFormat getPageFormatFromAttributes() {
|
protected PageFormat getPageFormatFromAttributes() {
|
||||||
if (attributes == null || attributes.isEmpty()) {
|
if (attributes == null || attributes.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return attributeToPageFormat(getPrintService(), this.attributes);
|
|
||||||
}
|
PageFormat newPf = attributeToPageFormat(
|
||||||
|
getPrintService(), attributes);
|
||||||
|
PageFormat oldPf = null;
|
||||||
|
Pageable pageable = getPageable();
|
||||||
|
if ((pageable != null) &&
|
||||||
|
(pageable instanceof OpenBook) &&
|
||||||
|
((oldPf = pageable.getPageFormat(0)) != null)) {
|
||||||
|
// If orientation, media, imageable area attributes are not in
|
||||||
|
// "attributes" set, then use respective values of the existing
|
||||||
|
// page format "oldPf".
|
||||||
|
if (attributes.get(OrientationRequested.class) == null) {
|
||||||
|
newPf.setOrientation(oldPf.getOrientation());
|
||||||
|
}
|
||||||
|
|
||||||
|
Paper newPaper = newPf.getPaper();
|
||||||
|
Paper oldPaper = oldPf.getPaper();
|
||||||
|
boolean oldPaperValWasSet = false;
|
||||||
|
if (attributes.get(MediaSizeName.class) == null) {
|
||||||
|
newPaper.setSize(oldPaper.getWidth(), oldPaper.getHeight());
|
||||||
|
oldPaperValWasSet = true;
|
||||||
|
}
|
||||||
|
if (attributes.get(MediaPrintableArea.class) == null) {
|
||||||
|
newPaper.setImageableArea(
|
||||||
|
oldPaper.getImageableX(), oldPaper.getImageableY(),
|
||||||
|
oldPaper.getImageableWidth(),
|
||||||
|
oldPaper.getImageableHeight());
|
||||||
|
oldPaperValWasSet = true;
|
||||||
|
}
|
||||||
|
if (oldPaperValWasSet) {
|
||||||
|
newPf.setPaper(newPaper);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newPf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,9 +22,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* @test
|
/* @test
|
||||||
@bug 8167102
|
@bug 8167102 8181659
|
||||||
@summary PrintRequestAttributeSet breaks page size set using PageFormat
|
@summary PrintRequestAttributeSet breaks page size set using PageFormat
|
||||||
@ignore Exclude the test until 8167102 is resolved by a new reassessed fix
|
|
||||||
@run main/manual WrongPaperPrintingTest
|
@run main/manual WrongPaperPrintingTest
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue