diff options
author | Andy <webmaster@RealityRipple.com> | 2020-08-01 20:54:54 -0700 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-08-07 21:27:54 +0000 |
commit | c237a54f23ec968feffc6e86870abd512414829a (patch) | |
tree | 44fd8fa82a746423addcb88b3cc27f1f0cadfe5c | |
parent | 8f72a673ca9c6c85f36467720fa201a2caaa6038 (diff) | |
download | UXP-c237a54f23ec968feffc6e86870abd512414829a.tar UXP-c237a54f23ec968feffc6e86870abd512414829a.tar.gz UXP-c237a54f23ec968feffc6e86870abd512414829a.tar.lz UXP-c237a54f23ec968feffc6e86870abd512414829a.tar.xz UXP-c237a54f23ec968feffc6e86870abd512414829a.zip |
Issue #1619 - Add Vertical Writing Testcase
Ensures aspect ratio numerator and denominator aren't swapped in vertical writing modes.
https://bugzilla.mozilla.org/show_bug.cgi?id=1548768
-rw-r--r-- | layout/generic/nsFrame.cpp | 20 | ||||
-rw-r--r-- | testing/web-platform/tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/object_intrinsic_size_vertical.html | 57 |
2 files changed, 57 insertions, 20 deletions
diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 49eea547e..cb70f8b1e 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -5199,26 +5199,6 @@ nsFrame::ComputeSizeWithIntrinsicDimensions(nsRenderingContext* aRenderingConte if (hasIntrinsicISize) { tentISize = intrinsicISize; } else if (hasIntrinsicBSize && logicalRatio) { - // (dholbert) <https://phabricator.services.mozilla.com - // /D29244#change-5faEkbsohV7O> - // This is wrong -- this ApplyTo call (and probably every ApplyTo call - // in this function) would only be valid if we're in a horizontal - // writing mode. It's not valid in a vertical writing mode. If this - // doesn't break tests, that's a bit concerning, and I think it means - // we're missing some test coverage. (That, or I'm misreading things.) - // - // aIntrinsicRatio is stored in terms of physical axes (width/height), - // either of which could be I vs. B axis. So any sort of - // aIntrinsicRatio.ApplyTo(someBSize) operation will be - // potentially-bogus. - // - // You probably want to bring back a logicalRatio variable - // (like the one we used to have here), but now with type AspectRatio. - // It would be equal to either aIntrinsicRatio or - // aIntrinsicRatio.Invert() depending on whether aWM is horizontal or - // vertical. (And hopefully having logical in its name would be a - // reminder that it's in terms of Inline/Block and can be used for - // these sorts of ApplyTo(intrinsicBSize) operations. tentISize = logicalRatio.ApplyTo(intrinsicBSize); } else if (logicalRatio) { tentISize = aCBSize.ISize(aWM) - boxSizingToMarginEdgeISize; // XXX scrollbar? diff --git a/testing/web-platform/tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/object_intrinsic_size_vertical.html b/testing/web-platform/tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/object_intrinsic_size_vertical.html new file mode 100644 index 000000000..0dca4c377 --- /dev/null +++ b/testing/web-platform/tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/object_intrinsic_size_vertical.html @@ -0,0 +1,57 @@ +<!doctype html>
+<title>Frame width and height attributes as they apply in a vertical writing mode</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+ #horiz
+ {
+ writing-mode: horizontal-tb;
+ display: inline-block;
+ }
+ #vert
+ {
+ writing-mode: vertical-rl;
+ display: inline-block;
+ }
+ object
+ {
+ border: 1px solid red;
+ margin: 5px;
+ }
+</style>
+<div id="horiz">
+<object data="/images/green.png" width=300></object>
+<object data="/images/green.png" height=50></object>
+</div>
+<div id="vert">
+<object data="/images/green.png" width=300></object>
+<object data="/images/green.png" height=50></object>
+</div>
+<script>
+let t = async_test("Frame width and height attributes as they apply in a vertical writing mode");
+function assert_dimensions(obj, expectedX, expectedY) {
+ assert_equals(getComputedStyle(obj).width, expectedX);
+ assert_equals(getComputedStyle(obj).height, expectedY);
+}
+t.step(function() {
+ var obj = document.createElement('object');
+ obj.width = 133;
+ obj.data = '/images/blue.png';
+ document.getElementById('horiz').appendChild(obj);
+
+ obj = document.createElement('object');
+ obj.width = 133;
+ obj.data = '/images/blue.png';
+ document.getElementById('vert').appendChild(obj);
+});
+
+onload = t.step_func_done(function() {
+ let objects = document.querySelectorAll("object");
+ assert_dimensions(objects[0], '300px', '150px');
+ assert_dimensions(objects[1], '100px', '50px');
+ assert_dimensions(objects[2], '133px', '106px');
+ assert_dimensions(objects[3], '300px', '150px');
+ assert_dimensions(objects[4], '100px', '50px');
+ assert_dimensions(objects[5], '133px', '106px');
+});
+</script>
|