<!DOCTYPE html>
<style>
body{margin:0px}
.narrow_block{width:100px}
.narrow_block>div{background:lime;width:200px;height:20px;border:1px solid black}
</style>
<script src="../../resources/js-test.js"></script>
<!-- Wider blocks inside the LTR block should be left-aligned regardless of align attribute -->
<div align="left" class="narrow_block">
<div dir="rtl" id="rtl_in_ltr_left"></div>
<div dir="ltr" id="ltr_in_ltr_left"></div>
</div>
<div align="right" class="narrow_block">
<div dir="rtl" id="rtl_in_ltr_right"></div>
<div dir="ltr" id="ltr_in_ltr_right"></div>
</div>
<div align="center" class="narrow_block">
<div dir="rtl" id="rtl_in_ltr_center"></div>
<div dir="ltr" id="ltr_in_ltr_center"></div>
</div>
<!-- Wider blocks inside the RTL block should be right-aligned regardless of align attribute -->
<div dir="rtl" align="right" class="narrow_block">
<div dir="rtl" id="rtl_in_rtl_right"></div>
<div dir="ltr" id="ltr_in_rtl_right"></div>
</div>
<div dir="rtl" align="left" class="narrow_block">
<div dir="rtl" id="rtl_in_rtl_left"></div>
<div dir="ltr" id="ltr_in_rtl_left"></div>
</div>
<div dir="rtl" align="center" class="narrow_block">
<div dir="rtl" id="rtl_in_rtl_center"></div>
<div dir="ltr" id="ltr_in_rtl_center"></div>
</div>
<script>
rtl_in_ltr_left = document.getElementById("rtl_in_ltr_left");
ltr_in_ltr_left = document.getElementById("ltr_in_ltr_left");
shouldBe("rtl_in_ltr_left.getBoundingClientRect().left","0");
shouldBe("ltr_in_ltr_left.getBoundingClientRect().left","0");
rtl_in_ltr_right = document.getElementById("rtl_in_ltr_right");
ltr_in_ltr_right = document.getElementById("ltr_in_ltr_right");
shouldBe("rtl_in_ltr_right.getBoundingClientRect().left","0");
shouldBe("ltr_in_ltr_right.getBoundingClientRect().left","0");
rtl_in_ltr_center = document.getElementById("rtl_in_ltr_center");
ltr_in_ltr_center = document.getElementById("ltr_in_ltr_center");
shouldBe("rtl_in_ltr_center.getBoundingClientRect().left","0");
shouldBe("ltr_in_ltr_center.getBoundingClientRect().left","0");
rtl_in_rtl_right = document.getElementById("rtl_in_rtl_right");
ltr_in_rtl_right = document.getElementById("ltr_in_rtl_right");
shouldBe("rtl_in_rtl_right.getBoundingClientRect().right","100");
shouldBe("ltr_in_rtl_right.getBoundingClientRect().right","100");
rtl_in_rtl_left = document.getElementById("rtl_in_rtl_left");
ltr_in_rtl_left = document.getElementById("ltr_in_rtl_left");
shouldBe("rtl_in_rtl_left.getBoundingClientRect().right","100");
shouldBe("ltr_in_rtl_left.getBoundingClientRect().right","100");
rtl_in_rtl_center = document.getElementById("rtl_in_rtl_center");
ltr_in_rtl_center = document.getElementById("ltr_in_rtl_center");
shouldBe("rtl_in_rtl_center.getBoundingClientRect().right","100");
shouldBe("ltr_in_rtl_center.getBoundingClientRect().right","100");
</script>