Title: [162486] trunk/Source/WebCore
- Revision
- 162486
- Author
- [email protected]
- Date
- 2014-01-21 17:34:12 -0800 (Tue, 21 Jan 2014)
Log Message
REGRESSION (r161580): Some PDFs render outside their <img>
https://bugs.webkit.org/show_bug.cgi?id=127381
<rdar://problem/15872168>
Reviewed by Simon Fraser.
* platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::transformContextForPainting):
Only try to make the scale uniform if it isn't already, and use the minimum
of the two original scales when doing so, so that it is absolutely certain
to fit inside space allocated for the image during layout.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (162485 => 162486)
--- trunk/Source/WebCore/ChangeLog 2014-01-22 01:18:07 UTC (rev 162485)
+++ trunk/Source/WebCore/ChangeLog 2014-01-22 01:34:12 UTC (rev 162486)
@@ -1,3 +1,17 @@
+2014-01-21 Tim Horton <[email protected]>
+
+ REGRESSION (r161580): Some PDFs render outside their <img>
+ https://bugs.webkit.org/show_bug.cgi?id=127381
+ <rdar://problem/15872168>
+
+ Reviewed by Simon Fraser.
+
+ * platform/graphics/cg/PDFDocumentImage.cpp:
+ (WebCore::transformContextForPainting):
+ Only try to make the scale uniform if it isn't already, and use the minimum
+ of the two original scales when doing so, so that it is absolutely certain
+ to fit inside space allocated for the image during layout.
+
2014-01-21 Roger Fong <[email protected]>
Unreviewed. WebGLLoadPolicy::WebGLAsk is an unnecessary value.
Modified: trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp (162485 => 162486)
--- trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp 2014-01-22 01:18:07 UTC (rev 162485)
+++ trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp 2014-01-22 01:34:12 UTC (rev 162486)
@@ -123,14 +123,17 @@
float hScale = dstRect.width() / srcRect.width();
float vScale = dstRect.height() / srcRect.height();
- float minimumScale = std::max((dstRect.width() - 0.5) / srcRect.width(), (dstRect.height() - 0.5) / srcRect.height());
- float maximumScale = std::min((dstRect.width() + 0.5) / srcRect.width(), (dstRect.height() + 0.5) / srcRect.height());
+ if (hScale != vScale) {
+ float minimumScale = std::max((dstRect.width() - 0.5) / srcRect.width(), (dstRect.height() - 0.5) / srcRect.height());
+ float maximumScale = std::min((dstRect.width() + 0.5) / srcRect.width(), (dstRect.height() + 0.5) / srcRect.height());
- // If the difference between the two scales is due to integer rounding of image sizes,
- // use the average scale for both axes.
- if (minimumScale <= maximumScale) {
- hScale = (maximumScale + minimumScale) / 2;
- vScale = hScale;
+ // If the difference between the two scales is due to integer rounding of image sizes,
+ // use the smaller of the two original scales to ensure that the image fits inside the
+ // space originally allocated for it.
+ if (minimumScale <= maximumScale) {
+ hScale = std::min(hScale, vScale);
+ vScale = hScale;
+ }
}
context->translate(srcRect.x() * hScale, srcRect.y() * vScale);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes