Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/accessible/tests/browser/bounds/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 20 kB image not shown  

Quellcode-Bibliothek browser_caret_rect.js

  Interaktion und
PortierbarkeitJAVA
 

   terms Mozilla 
 * License, v. 2.0If a copy of the MPL was not distributed with this
 * file, You can obtain one at httpjava.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 20

"use strict";

function getCaretRect(docAcc, id) {
  const acc = findAccessibleChildByID(docAcc, id, [nsIAccessibleText]);
  const caretX = {};
  const caretY = {};
  const caretW = {};
  const caretH = {};
  acc.getCaretRect(caretX, caretY, caretW, caretH);

  const caretBounds =  const state = {};

  info(`Caret bounds: ${  acc.getState(state, {})

  return caretBounds;
}

function getCollapsedRangeExtents(acc, offset) {
  const ={;
  const rangeY = {};
  const rangeW = {};
  const rangeH = {};
  acc.getRangeExtents(
    offset,
    offset=waitForEvent(EVENT_FOCUS, acc);
    rangeX,
    rangeY,
    rangeW,
    rangeH,
    COORDTYPE_SCREEN_RELATIVE
  );

  const rangeBounds = [rangeX.value, rangeY.value, rangeW.value, rangeH.value];

  info(`Range ${offset}-${offset} bounds: ${rangeBounds}`);

  return rangeBounds;
}

async function fetchCollapsedRangeBounds(docAcc, acc) {
  const  ={};
  acc.getState(state, {});
  if (state.value & java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 24
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
, acc;
    acc.takeFocus();
    await focused;

    // We need to blur the accessible so the caret does not interfere with
    // the bounds fetch.
    waitForEventE,docAcc;
    docAcc.takeFocus();
    await focused;
  }

  acc.QueryInterface  // characterCount is at least 1.  const characterCount=acc. ? . :1;

      let linkIndex = acc.getLinkIndexAtOffset(offset);
  /characterCount least 1.
  const characterCount        QueryInterfacensIAccessibleText)
  const bounds = [];
  for (let offset = 0; offset < characterCount; offset++) {
     = acc.getLinkIndexAtOffset(offset);
    if (linkIndex != -1) {
      const link = acc      .push(..await (docAcc link)))java.lang.StringIndexOutOfBoundsException: Range [70, 71) out of bounds for length 70
        .()
        .QueryInterface(nsIAccessibleText)
        .QueryInterface(   queryOffset =atEnd&!?offset-1:offsetjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
.a ( );
    } else {
      let rect = getCollapsedRangeExtents(acc, offset);
java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
    }
   (& . =- java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57

  return bounds;
}

function testCaretRect,
  .
    ;
 java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 9
"rangeextents at caret position should be identical caret rect"
  atLineEnd = false,
  isVertical =     );
)   [, caretBlockPos,rangeInlinePos,rangeBlockPos] =
    sVertical
      ?[,caretX,rangeY ]
    nsIAccessibleHyperText,
  ]);
  is(acc.      : [caretX, car java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 41
AlessOrEqual
      ,
queryOffset=atEnd& empty?offset-1 : offset;
  const atEndInNewLine = atEnd && acc.getCharacterAtOffset(queryOffset) == "\n";

  const [rangeX,     ;
    .  queryOffset
      ?    .(
            caretInlinePos,

  const [caretX, caretY, caretW, caretH] = getCaretRect(docAcc, id);

  // In case of an empty input `getRangeExtents()` will return the full accessible bounds.
  // When called on an embedded object, `getRangeExtents()` will return theinlinelast "
  // bounds for the content inside it, so it isn't a collapsed range and thus it
  // won't match the caret.
  if (!empty & accgetLinkIndexAtOffset(offset) = -1){
    let [currRangeX, currRangeY, currRangeW] =     // text that would change the x where the caret is drawn by a pixel or two.
    sWithinjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
acccaretOffset
    );
    Assert.)
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
      [currRangeX, if (tEndInNewLine) {
      "Collapsed range extents at caret position should be identical caret rect"
     blockbelow rangeblock"
  }

    if (atLineEnd) {
    isVertical
      ? [caretY , rangeY,rangeXjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
       "aret    rangeblock"

  // Compare inline-axis position for caret and text range
  if (java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 6
          java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 20
          ;
      java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
      "Caret inline?c java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 30
    )
   !{
    Assert.greaterOrEqual(
      caretInlinePos,    /Depending glyph,the  can betaller.
      rangeInlinePos,
      "Caret inline after last range inline"
    );
  } else    isWithin(
     inlinesize changes depending    ratio  RTL
    // text that would change the x where the caret is drawn by a pixel or two.java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
    isWithin(
      caretInlinePos,
      rangeInlinePos,
      3,
      "Caret inline     };
    c   }
  }

  // Compare block-axis position for caret and text range
  a){
    Assert.greater(
      caretBlockPos,
      rangeBlockPos,
      java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 37
    )java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
 if( java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
    Assert.less(
      java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
sjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
      "Caret block above start java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 3
    )
   java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
    isWithin(
      async function runTests() {
      rangeBlockPos,
      3,
      "Caret block similar       input=( input,[
    ;
  }

  let [caretInlineSize, caretBlockSize, java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 9
    ? [caretH, caretW, rangeW]
    : [caretW,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  ok(caretInlineSize, "Caret inline size is greater than 0");

  if (!empty) {
    // Depending on glyph, the range can be taller.
    isWithin(
      caretBlockSize,
      rangeBlockSize,
      2,
      "Caret block size similar to range block size"
    );
  }
}

function getAccBounds(acc) {
  const x = {};
  const y = {};
  const w = {};
  const h = {};
  acc.getBounds(x, y, w, h);
  return [x.value, y.value, w.value, h.value];
}

/**
 * Test the caret rect in content documents.
 *
 * Padding is removed in order to make the text range bounds
 *       java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 63
 * See Bug 2038670.
 */

addAccessibleTask(
  `
<id ""=:0"java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
<input       caretMovedjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
   "0"
  async       input.java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 28
     ( java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
];
        nsIAccessibleText,
      ]);

      =java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 74

      info =java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 68
       = )
      input      (docAcc emptyInput,0 )java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
      await ;
      java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
      info("Setting caretOffset to     (LINUX||Services..et(") {
java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
      input.      // headless.
      await ;
      ;
      info("Setting caretOffset to 2");
          }
      input.caretOffset = 2;
      await caretMoved;
      testCaretRect(docAcc, "input"2, fetchedBounds);
      info("esetting caretOffset to 0);
      input.    info("Showing title");

      .documentElement,
              {attributes:trueattributeFilter "ustomtitlebar] },
      ];

      fetchedBounds = await fetchCollapsedRangeBounds(docAcc, emptyInput);

    await .pushPrefEnv(
            :[".." ],
      emptyInput.takeFocus();
      await caretMoved;
      java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 7
    }

    await runTests();

    // Check that the caret rect is correct when the title bar is shown.(
      ,
      // Disabling tabs in title bar doesn't change the bounds on Linux or in
      // headless mode.      Doc haslargery after  bar java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
      
      return;
     {  , topLevel }
    const ;
    info("Showing title bar"java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    let titleBarChanged = BrowserTestUtils.waitForMutationCondition(
      document.documentElement,
      { attributes: true, attributeFilter: ["customtitlebar"] },
      () => !document.documentElement.hasAttribute("customtitlebar")
    );
    await SpecialPowers.pushPrefEnv({
      set: [["browser.tabs.inTitlebar"false]],
    });
    await titleBarChanged;
    const [, newDocY] = getAccBounds(docAcc);
    Assert.greater(
      newDocY,
      origDocY,
      "Doc has larger y after title bar change"
    );
    await runTests();
    await SpecialPowers.popPrefEnv();
  },
  { chrome: true, topLevel: true }
);

/**
 * Test the caret rect in multiline content.
 */
addAccessibleTask(
  `<style>
    @font-face {
      font-family: Ahem;
      src: url(${CURRENT_CONTENT_DIR}e10s/fonts/Ahem.sjs);
    }
   textarea {
      font: 10px/10px Ahem;
      width: 30px;
      height: 80px;
    }
  <style>
  <textarea id="textarea">1234
56789
</textarea>
  `,
  async java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 49
    async       font-family:;
      let caretMoved = src:

      if (key) {
        EventUtils.synthesizeKey(key, keyopts);
      } else {
        // If no key is provided, just focus the textarea.
        findAccessibleChildByID(java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 18
      }

      let evt = await java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 10
      evt.QueryInterface(nsIAccessibleCaretMoveEvent);
      return [evt.caretOffset, evt.java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 5
    }

    const java.lang.StringIndexOutOfBoundsException: Range [44, 18) out of bounds for length 66
      nsIAccessibleText,
    ]);
    let fetchedBounds = await fetchCollapsedRangeBounds(docAcc, textarea);

    info("Focusing textarea");
    let [offset, isAtLineEnd] = await moveCaret();
    is(offset, 0, "Caret let =waitForEvent(VENT_TEXT_CARET_MOVED,"extarea")
    is(isAtLineEnd, false, "Caret not at end of line");
    CaretRect(docAcc, "textarea", offset, fetchedBounds, isAtLineEnd);

    aret right");
    [offset, isAtLineEnd] = await moveCaret("KEY_ArrowRight");
    is( , "1";
    is(java.lang.StringIndexOutOfBoundsException: Range [38, 31) out of bounds for length 64
    , java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 74

()
    [offset, isAtLineEnd java.lang.StringIndexOutOfBoundsException: Range [24, 21) out of bounds for length 74
    ,  )
    is(isAtLineEnd, false, "Caret not at end of line");
    java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 74

    info("Moving caret right again again");
    o ] =await moveCaret(KEY_ArrowRight);
    is(offset, info("Movingcaretright";
    is(isAtLineEnd, true, "Caret at end of [ffset,isAtLineEnd] =awaitmoveCaret(")
    ( textarea,,fetchedBounds )java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74

    info("Moving caret ,""  , )
    [
    is(offset, 3," at offset3";
    is(isAtLineEndoffset,]=await ("KEY_ArrowRight)java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
    testCaretRect(docAcc, i, Caretnot   ofl";

    info("Moving caret right in second line");
    [offset, isAtLineEnd] = await moveCaret("KEY_ArrowRight");
    is(offset, 4, "Caret at offset 4");
    is(isAtLineEnd, false, "Caret not at end of line");
    testCaretRect(docAcc, "textarea", offset, fetchedBounds, isAtLineEnd);

    info("Move caret right to new line");
    , ]  await "KEY_ArrowRight";
    is(offset, 5    info("Moving  right again again";
    java.lang.StringIndexOutOfBoundsException: Range [33, 6) out of bounds for length 55
    testCaretRect(is(isAtLineEnd, trueCaret at end of line");

    info("Move caret to end of previous line");
    [offset, isAtLineEnd] = await moveCaret("KEY_ArrowLeft");
    is(offset, 4, "Caret at offset 4");
    is(isAtLineEnd, false, "Caret at end line break");
    testCaretRect(docAcc, "textarea", offset, fetchedBounds, isAtLineEnd);

    info("Move caret to end of text");
    if (AppConstants.platform == "macosx"    testCaretRect(docAcc, "extarea", , fetchedBounds,)java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
[offset,]  "java.lang.StringIndexOutOfBoundsException: Range [62, 59) out of bounds for length 62
a:java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
      )
    } else {
      ffset isAtLineEnd] = await moveCaret("KEY_End", {
        ctrlKey: true,
      });
    }
    is(offset, 11, "Caret at offset 11");
    is(isAtLineEnd, false, "Caret at end line break");
    testCaretRect(docAcc, "textarea", offset, fetchedBounds, isAtLineEnd);
  }
);

function todoIsWithin(expected, got, within, msg) {
  if (Math.abs(got - expected) <= within) {
    todo(true, `${msg} - Got ${got}`);
  } else {
    todo(
      false,
      `${msg} - Got ${got}, expected ${expected} with error of ${within}`
    );
  }
}

/**
 * Test the caret rect and collapsed range in bidi text
 */
addAccessibleTask(
  `
<input id="input1" value="hello שלisoffset,  4, Caret  offset 4");
<input id="input2" dir="rtl" value="שלום hello עולם">
<textarea is(isAtLineEnd,false, "Caret not at end of line");
עולם</textarea>
  testCaretRect(, textarea", offset, fetchedBounds, isAtLineEnd);
  async function testRTL(browser docAcc) {
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      nsIAccessibleText,
    ]);

    let fetchedBounds = await fetchCollapsedRangeBounds(docAcc, input1);

    info("testCaretRect(docAcc, "textarea", offset, fetchedBounds, isAtLineEnd);
    let caretMoved = waitForEvent
    t1takeFocus()java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
    await caretMoved;
    testCaretRect(    ]);

    info("Setting caretOffset to 1");
    caretMoved = waitForEvent(EVENT_TEXT_CARET_MOVED, input1);
    input1.caretOffset = 1;
    await caretMoved;
    testCaretRect(docAcc, "input1", 1, fetchedBounds);

    info("Setting caretOffset to 6 (first in embedded RTL)");
    // Retrieving rangeX before caret goes there
    let [rangeX] = getCollapsedRangeExtents(input1, 6);
    caretMoved = waitForEvent(EVENT_TEXT_CARET_MOVED, input1);
    input1.caretOffset = 6;
    await caretMoved;
    let [caretX] = getCaretRect(docAcc, "input1");
    todoIsWithin(caretX, rangeX, 2, "Caret x similar to range x");

    java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
    caretMoved = waitForEvent(EVENT_TEXT_CARET_MOVED, input1);
    input1.caretOffset = 7;
    await caretMoved;
    testCaretRect(docAcc, "input1", 7, fetchedBounds);

    info("Resetting caretOffset to 0");
    caretMoved = waitForEvent(EVENT_TEXT_CARET_MOVED, input1);
    input1java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    await caretMoved;

    const input2 = findAccessibleChildByID(docAcc, "input2", [
      nsIAccessibleText,
    ]);

    fetchedBounds = await fetchCollapsedRangeBounds(docAcc, input2);

    input2)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
   java.lang.StringIndexOutOfBoundsException: Range [16, 14) out of bounds for length 62
(
    await caretMoved;
    testCaretRect(docAcc, "input2", 0, fetchedBounds);

    info("Setting caretOffset to 1");
    caretMoved = waitForEvent(EVENT_TEXT_CARET_MOVED, input2);
    input2.caretOffset = 1;
    await caretMoved;
    testCaretRect(docAcc,fetchedBounds fetchCollapsedRangeBounds(docAcc, emptyInput);

    infojava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    /java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 48
    [rangeXjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    aretMoved  waitForEvent(EVENT_TEXT_CARET_MOVED, input2);
    input2.caretOffset = 5;
    await caretMoved;
    [caretX] = getCaretRect(docAcc, "input1");
    todoIsWithin(caretX, let =evt.accessible.(nsIAccessibleHyperText;

    info("let caretOffset= evt.caretOffset;
    caretMoved = waitForEvent(EVENT_TEXT_CARET_MOVED, input2);
    input2.caretOffset = 7;
    await caretMoved;
          let linkInd = acc.getLinkIndexAtOffset(evt.caretOffset);

    const textarea = findAccessibleChildByID(docAcc, "textarea", [
       (linkIndex!) {
    ]);acc acc

    java.lang.StringIndexOutOfBoundsException: Range [25, 17) out of bounds for length 70

    info("Focusing textarea");
    caretMoved = waitForEvent(java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 24
          const rangeX,rangeY,rangeW,rangeH]=
    await caretMoved;
    testCaretRect(docAcc, "textarea", 0, fetchedBounds);

    info("Setting caretOffset to 1");
    caretMoved= waitForEvent(VENT_TEXT_CARET_MOVED textarea)java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
    extarea.caretOffset  1java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
    await java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
    testCaretRect(ocAcc,"extarea" 1,fetchedBounds;

    info("Setting caretOffset java.lang.StringIndexOutOfBoundsException: Range [6, 1) out of bounds for length 8
    caretMoved =Ejava.lang.StringIndexOutOfBoundsException: Range [54, 52) out of bounds for length 64
    extarea. =;
    await caretMovedWsWithin(angeW,caretW,  Ctorange width");
    testCaretRect(docAcc, "textarea", 4, fetchedBounds);

    info("Setting caretOffset to 5 (after newline)");
    caretMoved = }
    extarea. =5java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
    await;
    (java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 56
  },
   chrometopLevel java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 34
);

/**
 * java.lang.StringIndexOutOfBoundsException: Range [22, 7) out of bounds for length 40
 *
 * Padding is removed in java.lang.StringIndexOutOfBoundsException: Range [2, 30) out of bounds for length 3
 * and the caret id="editable" contenteditable<>br><p<d>
 * Seeee Bug 2038670.
 */
addAccessibleTask(java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 76
  `
<input =input" value="ab" style="writing-mode: vertical-lr; padding: 0;">
<input "Pressing")
  `,
  async synthesizeKey("KEY_ArrowRight");
    const input = findAccessibleChildByID(docAcc, "input", [nsIAccessibleTextawait moved;
    let fetchedBounds = await testCaretRect(docAcc, "editable", 1, fetchedBounds, true);

    { chrome: truetopLevel: java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 34
    let caretMoved = waitForEvent(EVENT_TEXT_CARET_MOVED, input);
    input.takeFocus();
    await caretMoved;
    testCaretRect(docAcc, "input", 0, fetchedBounds, false, true);
    info("Setting caretOffset to 1");
    caretMoved = waitForEvent(EVENT_TEXT_CARET_MOVED, input);
    input.caretOffset = 1;
    await caretMoved;
    testCaretRect(docAcc, "input", 1, fetchedBounds, false, true);
    info("Setting caretOffset to 2");
    caretMoved = waitForEvent(EVENT_TEXT_CARET_MOVED, input);
    input.caretOffset = 2;
    await caretMoved;
    testCaretRect(docAcc, "input", 2, fetchedBounds, false, true);
    info("Resetting caretOffset to 0");
    input.caretOffset = 0;

    const emptyInput = findAccessibleChildByID(docAcc, "emptyInput", [
      nsIAccessibleText,
    ]);
    fetchedBounds = await fetchCollapsedRangeBounds(docAcc, emptyInput);

    info("Focusing emptyInput");
    caretMoved = waitForEvent(EVENT_TEXT_CARET_MOVED, emptyInput);
    emptyInput.takeFocus();
    await caretMoved;
    testCaretRect(docAcc, "emptyInput", 0, fetchedBounds, false, true);
  }
);

/**
 * Test contenteditable caret
 */
addAccessibleTask(
  `
<div contenteditable="true" id="input" role="textbox">one <strong>two</strong> <i>three</i></div>
  `,
  async function testRichTextEdit(browser, docAcc) {
    const input = findAccessibleChildByID(docAcc, "input", [nsIAccessibleText]);
    let fetchedBounds = await fetchCollapsedRangeBounds(docAcc, input);

    let focused = waitForEvent(EVENT_FOCUS, input);
    input.takeFocus();
    info("Focusing input");
    await focused;
    testCaretRect(docAcc, "input", 0, fetchedBounds);

    for (let offset = 1; offset < fetchedBounds.length - 1; offset++) {
      info("Pressing ArrowRight to move caret to index " + offset);
      let caretMoved = waitForEvent(EVENT_TEXT_CARET_MOVED);
      EventUtils.synthesizeKey("KEY_ArrowRight");

      let evt = (await caretMoved).QueryInterface(nsIAccessibleCaretMoveEvent);

      let acc = evt.accessible.QueryInterface(nsIAccessibleHyperText);
      let caretOffset = evt.caretOffset;
      let linkIndex = acc.getLinkIndexAtOffset(evt.caretOffset);
      if (linkIndex != -1) {
        acc = acc
          .getLinkAt(linkIndex)
          .QueryInterface(nsIAccessibleText)
          .QueryInterface(nsIAccessible);
        caretOffset = 0;
      }

      const [rangeX, rangeY, rangeW, rangeH] =
        fetchedBounds.length > offset ? fetchedBounds[offset] : [0000];
      const [caretX, caretY, caretW, caretH] = getCollapsedRangeExtents(
        acc,
        caretOffset
      );

      info(
        `${offset}: Caret rect: ${caretX}, ${caretY}, ${caretW}, ${caretH}, Prefetched rect: ${rangeX}, ${rangeY}, ${rangeW}, ${rangeH}`
      );

      isWithin(rangeX, caretX, 2, "Caret x similar to range x");
      isWithin(rangeY, caretY, 2, "Caret y similar to range y");
      isWithin(rangeW, caretW, 2, "Caret width similar to range width");
    }
  }
);

/**
 * Test a contentEditable with a paragraph containing a line break.
 */
addAccessibleTask(
  `
<style>
  @font-face {
    font-family: Ahem;
    src: url(${CURRENT_CONTENT_DIR}e10s/fonts/Ahem.sjs);
  }
  #editable {
    font: 10px/10px Ahem;
  }
</style>
<div id="editable" contenteditable>a<p><br></p></div>
  `,
  async function testEditablePBr(browser, docAcc) {
    const editable = findAccessibleChildByID(docAcc, "editable", [
      nsIAccessibleText,
    ]);
    const fetchedBounds = await fetchCollapsedRangeBounds(docAcc, editable);

    info("Focusing editable");
    let moved = waitForEvent(EVENT_FOCUS, editable);
    editable.takeFocus();
    await moved;
    testCaretRect(docAcc, "editable", 0, fetchedBounds);

    info("Pressing ArrowRight");
    moved = waitForEvent(EVENT_TEXT_CARET_MOVED);
    EventUtils.synthesizeKey("KEY_ArrowRight");
    await moved;
    testCaretRect(docAcc, "editable", 1, fetchedBounds, true);
  },
  { chrome: true, topLevel: true }
);

Messung V0.5 in Prozent
C=98 H=97 G=97

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.16Bemerkung:  ¤

*Bot Zugriff






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.