Changeset 281920 in webkit
- Timestamp:
- Sep 2, 2021 5:45:25 AM (11 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/accessibility/mac/range-for-line-index-expected.txt (added)
-
LayoutTests/accessibility/mac/range-for-line-index.html (added)
-
LayoutTests/platform/mac/accessibility/content-editable-as-textarea-expected.txt (modified) (1 diff)
-
LayoutTests/platform/win/accessibility/content-editable-as-textarea-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/accessibility/AccessibilityRenderObject.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r281918 r281920 1 2021-09-02 Andres Gonzalez <andresg_22@apple.com> 2 3 Braille display is blank in contenteditable elements when the field is followed by another element. 4 https://bugs.webkit.org/show_bug.cgi?id=229713 5 rdar://82095237 6 7 Reviewed by Chris Fleizach. 8 9 * accessibility/mac/range-for-line-index-expected.txt: Added. 10 * accessibility/mac/range-for-line-index.html: Added. 11 * platform/mac/accessibility/content-editable-as-textarea-expected.txt: 12 * platform/win/accessibility/content-editable-as-textarea-expected.txt: 13 1 14 2021-09-02 Philippe Normand <pnormand@igalia.com> 2 15 -
trunk/LayoutTests/platform/mac/accessibility/content-editable-as-textarea-expected.txt
r230064 r281920 36 36 Line for index(7): 1 37 37 Range for line(0): {0, 6} 38 Range for line(1): {6, 6}38 Range for line(1): {6, 5} 39 39 Bounds for range: {{-1.000000, -1.000000}, {32.000000, 36.000000}} 40 40 Selected text range: {0, 3} -
trunk/LayoutTests/platform/win/accessibility/content-editable-as-textarea-expected.txt
r180176 r281920 35 35 Line for index(7): 1 36 36 Range for line(0): {0, 6} 37 Range for line(1): {6, 6}37 Range for line(1): {6, 5} 38 38 Bounds for range: {{-1.000000, -1.000000}, {31.000000, 36.000000}} 39 39 Selected text range: {0, 3} -
trunk/Source/WebCore/ChangeLog
r281913 r281920 1 2021-09-02 Andres Gonzalez <andresg_22@apple.com> 2 3 Braille display is blank in contenteditable elements when the field is followed by another element. 4 https://bugs.webkit.org/show_bug.cgi?id=229713 5 rdar://82095237 6 7 Reviewed by Chris Fleizach. 8 9 Test: accessibility/mac/range-for-line-index.html 10 11 We were making the length of line ranges in text fields 1 more than the 12 number of characters in the line even when no line break character 13 existed, like in the case of a single line text field. 14 Clients like VoiceOver expect the length of the line ranges in text 15 fields to match the number of charaters in the line including the line 16 break if one exists. 17 18 * accessibility/AccessibilityRenderObject.cpp: 19 (WebCore::isHardLineBreak): Helper function used in doAXRangeForLine. 20 Determines whether the given VisiblePosition corresponds to a hard line 21 break. 22 (WebCore::AccessibilityRenderObject::doAXRangeForLine const): 23 Returns a PlainTextRange whose length matches the number of characters 24 in the given line, accounting for line break characters. 25 1 26 2021-09-02 Rob Buis <rbuis@igalia.com> 2 27 -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r281691 r281920 52 52 #include "HTMLAreaElement.h" 53 53 #include "HTMLAudioElement.h" 54 #include "HTMLBRElement.h" 54 55 #include "HTMLDetailsElement.h" 55 56 #include "HTMLFormElement.h" … … 2444 2445 } 2445 2446 2447 static bool isHardLineBreak(const VisiblePosition& position) 2448 { 2449 if (!isEndOfLine(position)) 2450 return false; 2451 2452 auto next = position.next(); 2453 2454 auto lineBreakRange = makeSimpleRange(position, next); 2455 if (!lineBreakRange) 2456 return false; 2457 2458 TextIterator it(*lineBreakRange); 2459 if (it.atEnd()) 2460 return false; 2461 2462 if (is<HTMLBRElement>(it.node())) 2463 return true; 2464 2465 if (it.node() != position.deepEquivalent().anchorNode()) 2466 return false; 2467 2468 return it.text().length() == 1 && it.text()[0] == '\n'; 2469 } 2470 2446 2471 // Given a line number, the range of characters of the text associated with this accessibility 2447 2472 // object that contains the line number. … … 2449 2474 { 2450 2475 if (!isTextControl()) 2451 return PlainTextRange(); 2452 2453 // iterate to the specified line 2454 VisiblePosition visiblePos = visiblePositionForIndex(0); 2455 VisiblePosition savedVisiblePos; 2456 for (unsigned lineCount = lineNumber; lineCount; lineCount -= 1) { 2457 savedVisiblePos = visiblePos; 2458 visiblePos = nextLinePosition(visiblePos, 0); 2459 if (visiblePos.isNull() || visiblePos == savedVisiblePos) 2460 return PlainTextRange(); 2476 return { }; 2477 2478 // Iterate to the specified line. 2479 auto lineStart = visiblePositionForIndex(0); 2480 for (unsigned lineCount = lineNumber; lineCount; --lineCount) { 2481 auto nextLineStart = nextLinePosition(lineStart, 0); 2482 if (nextLineStart.isNull() || nextLineStart == lineStart) 2483 return { }; 2484 lineStart = nextLineStart; 2461 2485 } 2462 2486 2463 2487 // Get the end of the line based on the starting position. 2464 VisiblePosition endPosition = endOfLine(visiblePos); 2465 2466 int index1 = indexForVisiblePosition(visiblePos); 2467 int index2 = indexForVisiblePosition(endPosition); 2468 2469 // add one to the end index for a line break not caused by soft line wrap (to match AppKit) 2470 if (endPosition.affinity() == Affinity::Downstream && endPosition.next().isNotNull()) 2471 index2 += 1; 2472 2473 // return nil rather than an zero-length range (to match AppKit) 2474 if (index1 == index2) 2475 return PlainTextRange(); 2476 2477 return PlainTextRange(index1, index2 - index1); 2488 auto lineEnd = endOfLine(lineStart); 2489 2490 int index1 = indexForVisiblePosition(lineStart); 2491 int index2 = indexForVisiblePosition(lineEnd); 2492 2493 if (isHardLineBreak(lineEnd)) 2494 ++index2; 2495 2496 if (index1 < 0 || index2 < 0 || index2 <= index1) 2497 return { }; 2498 2499 return { static_cast<unsigned>(index1), static_cast<unsigned>(index2 - index1) }; 2478 2500 } 2479 2501
Note: See TracChangeset
for help on using the changeset viewer.