Closed Bug 1439891 Opened 6 years ago Closed 6 years ago

DOM Range.getClientRects() and getBoundingClientRect() methods are broken for text with vertical writing mode

Categories

(Core :: Layout: Text and Fonts, defect, P3)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1437509

People

(Reporter: jfkthame, Unassigned)

References

(Blocks 1 open bug)

Details

Simple testcase:

  data:text/html,<tt style="writing-mode:vertical-lr;">foobar

Then using the web console...

  var txt = document.getElementsByTagName("tt")[0].firstChild;
  var rng = document.createRange();
  rng.setStart(txt, 3);
  rng.setEnd(txt, 4);
  // now rng is the single character "b"
  rng.getBoundingClientRect();

>> result:
DOMRect { x: 8, y: 8, width: 0, height: 46.80000305175781, top: 8, right: 8, bottom: 54.80000305175781, left: 8 }

(Exact numbers will be font-dependent, but notice the width:0 which is clearly bad; also top/bottom/height are wrong for the single letter that was selected.)

  rng.setStart(txt, 1);
  rng.setEnd(txt, 5);
  // now rng is "ooba"
  rng.getBoundingClientRect();

>> result:
DOMRect { x: 8, y: 8, width: 0, height: 46.80000305175781, top: 8, right: 8, bottom: 54.80000305175781, left: 8 }

(Exactly the same as above!)
Priority: -- → P3
Looks like this was fixed in bug 1437509. :)
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.