Bug 1266997 - fix test browser_rules_completion-new-property_multiline.js on winXP;r=pbro draft
authorJulian Descottes <jdescottes@mozilla.com>
Mon, 25 Apr 2016 10:10:25 +0200
changeset 355895 e09afad472c24fa112615383f57b3e176cda5a42
parent 355891 0225961ad7adbef25e670abf314ec67f5e6c224d
child 519283 2549795c8aab210b491e0da1cdc61f996806e6d3
push id16383
push userjdescottes@mozilla.com
push dateMon, 25 Apr 2016 09:03:59 +0000
reviewerspbro
bugs1266997
milestone48.0a1
Bug 1266997 - fix test browser_rules_completion-new-property_multiline.js on winXP;r=pbro MozReview-Commit-ID: FEpmTAPxb0a
devtools/client/inspector/rules/test/browser_rules_completion-new-property_multiline.js
--- a/devtools/client/inspector/rules/test/browser_rules_completion-new-property_multiline.js
+++ b/devtools/client/inspector/rules/test/browser_rules_completion-new-property_multiline.js
@@ -33,20 +33,29 @@ add_task(function* () {
 
   info("Selecting the test node");
   yield selectNode("h1", inspector);
 
   info("Focusing the property editable field");
   let rule = getRuleViewRuleEditor(view, 1).rule;
   let prop = rule.textProps[0];
 
-  info("Focusing the css property editable value");
+  // Calculate offsets to click in the middle of the first box quad.
   let rect = prop.editor.valueSpan.getBoundingClientRect();
-  let editor = yield focusEditableField(view, prop.editor.valueSpan,
-    rect.width / 2, rect.height / 2);
+  let firstQuad = prop.editor.valueSpan.getBoxQuads()[0];
+  // For a multiline value, the first quad left edge is not aligned with the
+  // bounding rect left edge. The offsets expected by focusEditableField are
+  // relative to the bouding rectangle, so we need to translate the x-offset.
+  let x = firstQuad.bounds.left - rect.left + firstQuad.bounds.width / 2;
+  // The first quad top edge is aligned with the bounding top edge, no
+  // translation needed here.
+  let y = firstQuad.bounds.height / 2;
+
+  info("Focusing the css property editable value");
+  let editor = yield focusEditableField(view, prop.editor.valueSpan, x, y);
 
   info("Moving the caret next to a number");
   let pos = editor.input.value.indexOf("0deg") + 1;
   editor.input.setSelectionRange(pos, pos);
   is(editor.input.value[editor.input.selectionStart - 1], "0",
     "Input caret is after a 0");
 
   info("Check that UP/DOWN navigates in the input, even when next to a number");