Title: [123294] trunk
- Revision
- 123294
- Author
- [email protected]
- Date
- 2012-07-21 14:54:31 -0700 (Sat, 21 Jul 2012)
Log Message
<rdar://problem/11928576> SVG-as-image (constrained) intrinsic size calculation is wrong in vertical writing modes
https://bugs.webkit.org/show_bug.cgi?id=91918
Reviewed by Anders Carlsson.
Source/WebCore:
Test: svg/as-image/svg-intrinsic-size-rectangular-vertical.html
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeAspectRatioInformationForRenderBox): When there is a content
renderer, it returns a physical intrinsic size and aspect ratio. The code was already
accounting for this by taking the reciprocal of the aspect ratio in the vertical case. Made
it also transpose the size itself, turning it from physical to logical. Moved this code
after setting m_intrinsicSize, since that member variable is always physical.
LayoutTests:
* svg/as-image/svg-intrinsic-size-rectangular-vertical-expected.html: Added.
* svg/as-image/svg-intrinsic-size-rectangular-vertical.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (123293 => 123294)
--- trunk/LayoutTests/ChangeLog 2012-07-21 21:22:28 UTC (rev 123293)
+++ trunk/LayoutTests/ChangeLog 2012-07-21 21:54:31 UTC (rev 123294)
@@ -1,3 +1,13 @@
+2012-07-21 Dan Bernstein <[email protected]>
+
+ <rdar://problem/11928576> SVG-as-image (constrained) intrinsic size calculation is wrong in vertical writing modes
+ https://bugs.webkit.org/show_bug.cgi?id=91918
+
+ Reviewed by Anders Carlsson.
+
+ * svg/as-image/svg-intrinsic-size-rectangular-vertical-expected.html: Added.
+ * svg/as-image/svg-intrinsic-size-rectangular-vertical.html: Added.
+
2012-07-20 Tony Chang <[email protected]>
[chromium] Mark anther test as needing a rebaseline due to r123285.
Added: trunk/LayoutTests/svg/as-image/svg-intrinsic-size-rectangular-vertical-expected.html (0 => 123294)
--- trunk/LayoutTests/svg/as-image/svg-intrinsic-size-rectangular-vertical-expected.html (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-intrinsic-size-rectangular-vertical-expected.html 2012-07-21 21:54:31 UTC (rev 123294)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<style>
+ div.container {
+ -webkit-writing-mode: vertical-rl;
+ -webkit-logical-width: 80px;
+ -webkit-logical-height: 200px;
+ outline: solid blue;
+ }
+</style>
+<div class="container">
+ <div style="width: 40px; background-color: green;"></div>
+</div>
+<div style="height: 25px;"></div>
+<div class="container">
+ <div style="width: 60px; background-color: green;"></div>
+</div>
Added: trunk/LayoutTests/svg/as-image/svg-intrinsic-size-rectangular-vertical.html (0 => 123294)
--- trunk/LayoutTests/svg/as-image/svg-intrinsic-size-rectangular-vertical.html (rev 0)
+++ trunk/LayoutTests/svg/as-image/svg-intrinsic-size-rectangular-vertical.html 2012-07-21 21:54:31 UTC (rev 123294)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<style>
+ div.container {
+ -webkit-writing-mode: vertical-rl;
+ -webkit-logical-width: 80px;
+ -webkit-logical-height: 200px;
+ outline: solid blue;
+ }
+
+ img {
+ background-color: red;
+ width: auto;
+ height: auto;
+ max-width: 100%;
+ max-height: 100%;
+ }
+</style>
+<div class="container">
+ <img src="" width='120' height='240' xmlns='http://www.w3.org/2000/svg'><rect x='0' y='0' fill='green' width='120' height='240'></rect></svg>">
+</div>
+<div style="height: 25px;"></div>
+<div class="container">
+ <img src="" width='60' height='80' xmlns='http://www.w3.org/2000/svg'><rect x='0' y='0' fill='green' width='60' height='80'></rect></svg>">
+</div>
Modified: trunk/Source/WebCore/ChangeLog (123293 => 123294)
--- trunk/Source/WebCore/ChangeLog 2012-07-21 21:22:28 UTC (rev 123293)
+++ trunk/Source/WebCore/ChangeLog 2012-07-21 21:54:31 UTC (rev 123294)
@@ -1,3 +1,19 @@
+2012-07-21 Dan Bernstein <[email protected]>
+
+ <rdar://problem/11928576> SVG-as-image (constrained) intrinsic size calculation is wrong in vertical writing modes
+ https://bugs.webkit.org/show_bug.cgi?id=91918
+
+ Reviewed by Anders Carlsson.
+
+ Test: svg/as-image/svg-intrinsic-size-rectangular-vertical.html
+
+ * rendering/RenderReplaced.cpp:
+ (WebCore::RenderReplaced::computeAspectRatioInformationForRenderBox): When there is a content
+ renderer, it returns a physical intrinsic size and aspect ratio. The code was already
+ accounting for this by taking the reciprocal of the aspect ratio in the vertical case. Made
+ it also transpose the size itself, turning it from physical to logical. Moved this code
+ after setting m_intrinsicSize, since that member variable is always physical.
+
2012-07-21 Patrick Gansterer <[email protected]>
Cleanup TextEncoding USE(XXX_UNICODE) macros
Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (123293 => 123294)
--- trunk/Source/WebCore/rendering/RenderReplaced.cpp 2012-07-21 21:22:28 UTC (rev 123293)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp 2012-07-21 21:54:31 UTC (rev 123294)
@@ -281,9 +281,6 @@
if (!isPercentageIntrinsicSize)
intrinsicSize.scale(style()->effectiveZoom());
- if (intrinsicRatio && !isHorizontalWritingMode())
- intrinsicRatio = 1 / intrinsicRatio;
-
if (rendererHasAspectRatio(this) && isPercentageIntrinsicSize)
intrinsicRatio = 1;
@@ -292,6 +289,12 @@
// min and max widths.
if (intrinsicRatio && !isPercentageIntrinsicSize && !intrinsicSize.isEmpty())
m_intrinsicSize = flooredIntSize(intrinsicSize); // FIXME: This introduces precision errors. We should convert m_intrinsicSize to be a float.
+
+ if (!isHorizontalWritingMode()) {
+ if (intrinsicRatio)
+ intrinsicRatio = 1 / intrinsicRatio;
+ intrinsicSize = intrinsicSize.transposedSize();
+ }
} else {
computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio, isPercentageIntrinsicSize);
if (intrinsicRatio)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes