WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
a.diff (text/plain), 5.63 KB, created by
Fujii Hironori
on 2019-12-23 03:17:56 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Fujii Hironori
Created:
2019-12-23 03:17:56 PST
Size:
5.63 KB
patch
obsolete
>diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 1d9971b6047..ca8d1652514 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2019-12-23 Fujii Hironori <Hironori.Fujii@sony.com> >+ >+ ComplexTextController::offsetForPosition returns a wrong offset for a glyph boundary in a RTL text >+ https://bugs.webkit.org/show_bug.cgi?id=205486 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/dom/Document/CaretRangeFromPoint/rtl-expected.txt: Added. >+ * fast/dom/Document/CaretRangeFromPoint/rtl.html: Added. >+ * platform/gtk/TestExpectations: Unmarked imported/blink/editing/selection/offset-from-point-complex-scripts.html. >+ > 2019-12-19 Fujii Hironori <Hironori.Fujii@sony.com> > > [Win] Use ComplexTextController instead of UniscribeController >diff --git a/LayoutTests/fast/dom/Document/CaretRangeFromPoint/rtl-expected.txt b/LayoutTests/fast/dom/Document/CaretRangeFromPoint/rtl-expected.txt >new file mode 100644 >index 00000000000..7e52629aaa4 >--- /dev/null >+++ b/LayoutTests/fast/dom/Document/CaretRangeFromPoint/rtl-expected.txt >@@ -0,0 +1 @@ >+6 5 4 3 2 1 0 >diff --git a/LayoutTests/fast/dom/Document/CaretRangeFromPoint/rtl.html b/LayoutTests/fast/dom/Document/CaretRangeFromPoint/rtl.html >new file mode 100644 >index 00000000000..de90cb92636 >--- /dev/null >+++ b/LayoutTests/fast/dom/Document/CaretRangeFromPoint/rtl.html >@@ -0,0 +1,42 @@ >+<!DOCTYPE html> >+<head> >+ <meta charset="utf-8"> >+ <style> >+ p { >+ font-family: "Ahem"; >+ direction: rtl; >+ unicode-bidi: bidi-override; >+ } >+ </style> >+</head> >+<div id="container"> >+ <p>ABCDEF</p> >+</div> >+<div id=log></div> >+<script> >+testOffsetFromPoint(container.firstElementChild); >+ >+function testOffsetFromPoint(element) { >+ var y = element.offsetTop + element.offsetHeight / 2; >+ var xmin = element.offsetLeft; >+ var xmax = xmin + element.offsetWidth; >+ var lastCharacterOffset = null; >+ var results = []; >+ for (var x = xmin - 1; x <= xmax + 1; ++x) { >+ var result = document.caretRangeFromPoint(x, y); >+ var characterOffset = result ? result.startOffset : null; >+ if (characterOffset === lastCharacterOffset) >+ continue; >+ results.push(characterOffset); >+ lastCharacterOffset = characterOffset; >+ } >+ var div = document.createElement("div"); >+ div.innerText = results.join(" "); >+ log.appendChild(div); >+} >+ >+if (window.testRunner) { >+ container.style.display = "none"; >+ testRunner.dumpAsText(); >+} >+</script> >diff --git a/LayoutTests/platform/gtk/TestExpectations b/LayoutTests/platform/gtk/TestExpectations >index af1c7f40e62..408c703efda 100644 >--- a/LayoutTests/platform/gtk/TestExpectations >+++ b/LayoutTests/platform/gtk/TestExpectations >@@ -3403,7 +3403,6 @@ webkit.org/b/177934 http/tests/preconnect/link-header-rel-preconnect-http.html [ > webkit.org/b/177936 fast/text/all-small-caps-whitespace.html [ ImageOnlyFailure ] > webkit.org/b/177936 fast/text/regional-indicator-symobls.html [ Failure ] > webkit.org/b/177936 fast/text/selection-in-initial-advance-region.html [ Failure ] >-webkit.org/b/177936 imported/blink/editing/selection/offset-from-point-complex-scripts.html [ Failure ] > > webkit.org/b/177937 fast/text/soft-hyphen-min-preferred-width.html [ ImageOnlyFailure ] > webkit.org/b/177937 fast/text/unknown-char-notdef.html [ ImageOnlyFailure ] >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 76f19dd28d6..c31dd5c18a1 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2019-12-23 Fujii Hironori <Hironori.Fujii@sony.com> >+ >+ ComplexTextController::offsetForPosition returns a wrong offset for a glyph boundary in a RTL text >+ https://bugs.webkit.org/show_bug.cgi?id=205486 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ If m_run.ltr() was true and x == 0, hitIndex would become hitGlyphEnd. >+ This is not expected. It expects hitIndex < hitGlyphEnd if hitGlyphStart â hitGlyphEnd. >+ >+ Test: fast/dom/Document/CaretRangeFromPoint/rtl.html >+ >+ * platform/graphics/ComplexTextController.cpp: >+ (WebCore::ComplexTextController::offsetForPosition): Compute correct hitGlyphEnd for RTL. >+ > 2019-12-19 Fujii Hironori <Hironori.Fujii@sony.com> > > [Win] Use ComplexTextController instead of UniscribeController >diff --git a/Source/WebCore/platform/graphics/ComplexTextController.cpp b/Source/WebCore/platform/graphics/ComplexTextController.cpp >index 48e8d951b8c..756e210d297 100644 >--- a/Source/WebCore/platform/graphics/ComplexTextController.cpp >+++ b/Source/WebCore/platform/graphics/ComplexTextController.cpp >@@ -189,7 +189,11 @@ unsigned ComplexTextController::offsetForPosition(float h, bool includePartialGl > > // FIXME: Instead of dividing the glyph's advance equally between the characters, this > // could use the glyph's "ligature carets". This is available in CoreText via CTFontGetLigatureCaretPositions(). >- unsigned hitIndex = hitGlyphStart + (hitGlyphEnd - hitGlyphStart) * (m_run.ltr() ? x / adjustedAdvance : 1 - x / adjustedAdvance); >+ unsigned hitIndex; >+ if (m_run.ltr()) >+ hitIndex = hitGlyphStart + (hitGlyphEnd - hitGlyphStart) * (x / adjustedAdvance); >+ else >+ hitIndex = hitGlyphEnd - (hitGlyphEnd - hitGlyphStart) * (1 - x / adjustedAdvance); > unsigned stringLength = complexTextRun.stringLength(); > CachedTextBreakIterator cursorPositionIterator(StringView(complexTextRun.characters(), stringLength), TextBreakIterator::Mode::Caret, nullAtom()); > unsigned clusterStart;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 205486
:
386327
|
386328
|
386331
|
386332
|
386334
|
386335
|
386338
|
386339
|
386371
|
386372
|
386385
|
386935