<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[213095] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/213095">213095</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2017-02-27 14:44:19 -0800 (Mon, 27 Feb 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>Rename ICU cursor iterator to caret iterator
https://bugs.webkit.org/show_bug.cgi?id=168206
Reviewed by Simon Fraser.
Source/WebCore:
Mechanical find/replace.
No new tests because there is no behavior change.
* platform/graphics/ComplexTextController.cpp:
(WebCore::ComplexTextController::offsetForPosition):
* rendering/RenderText.cpp:
(WebCore::RenderText::previousOffset):
(WebCore::RenderText::nextOffset):
Source/WTF:
* wtf/text/TextBreakIterator.cpp:
(WTF::mapModeToBackingIterator):
* wtf/text/TextBreakIterator.h:
* wtf/text/cf/TextBreakIteratorCF.h:
(WTF::TextBreakIteratorCF::TextBreakIteratorCF):
* wtf/text/icu/TextBreakIteratorICU.h:
(WTF::caretRules):
(WTF::TextBreakIteratorICU::TextBreakIteratorICU):
(WTF::cursorRules): Deleted.
* wtf/text/mac/TextBreakIteratorInternalICUMac.mm:
(WTF::mapModeToBackingIterator):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtftextTextBreakIteratorcpp">trunk/Source/WTF/wtf/text/TextBreakIterator.cpp</a></li>
<li><a href="#trunkSourceWTFwtftextTextBreakIteratorh">trunk/Source/WTF/wtf/text/TextBreakIterator.h</a></li>
<li><a href="#trunkSourceWTFwtftextcfTextBreakIteratorCFh">trunk/Source/WTF/wtf/text/cf/TextBreakIteratorCF.h</a></li>
<li><a href="#trunkSourceWTFwtftexticuTextBreakIteratorICUh">trunk/Source/WTF/wtf/text/icu/TextBreakIteratorICU.h</a></li>
<li><a href="#trunkSourceWTFwtftextmacTextBreakIteratorInternalICUMacmm">trunk/Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsComplexTextControllercpp">trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTextcpp">trunk/Source/WebCore/rendering/RenderText.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (213094 => 213095)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2017-02-27 22:41:08 UTC (rev 213094)
+++ trunk/Source/WTF/ChangeLog        2017-02-27 22:44:19 UTC (rev 213095)
</span><span class="lines">@@ -1,5 +1,24 @@
</span><span class="cx"> 2017-02-27 Myles C. Maxfield <mmaxfield@apple.com>
</span><span class="cx">
</span><ins>+ Rename ICU cursor iterator to caret iterator
+ https://bugs.webkit.org/show_bug.cgi?id=168206
+
+ Reviewed by Simon Fraser.
+
+ * wtf/text/TextBreakIterator.cpp:
+ (WTF::mapModeToBackingIterator):
+ * wtf/text/TextBreakIterator.h:
+ * wtf/text/cf/TextBreakIteratorCF.h:
+ (WTF::TextBreakIteratorCF::TextBreakIteratorCF):
+ * wtf/text/icu/TextBreakIteratorICU.h:
+ (WTF::caretRules):
+ (WTF::TextBreakIteratorICU::TextBreakIteratorICU):
+ (WTF::cursorRules): Deleted.
+ * wtf/text/mac/TextBreakIteratorInternalICUMac.mm:
+ (WTF::mapModeToBackingIterator):
+
+2017-02-27 Myles C. Maxfield <mmaxfield@apple.com>
+
</ins><span class="cx"> Use RAII for ICU breaking iterators
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=168203
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWTFwtftextTextBreakIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/TextBreakIterator.cpp (213094 => 213095)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/TextBreakIterator.cpp        2017-02-27 22:41:08 UTC (rev 213094)
+++ trunk/Source/WTF/wtf/text/TextBreakIterator.cpp        2017-02-27 22:44:19 UTC (rev 213095)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx"> switch (mode) {
</span><span class="cx"> case TextBreakIterator::Mode::Line:
</span><span class="cx"> return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Line, locale.string().utf8().data());
</span><del>- case TextBreakIterator::Mode::Cursor:
</del><ins>+ case TextBreakIterator::Mode::Caret:
</ins><span class="cx"> return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Character, locale.string().utf8().data());
</span><span class="cx"> case TextBreakIterator::Mode::Delete:
</span><span class="cx"> return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Character, locale.string().utf8().data());
</span></span></pre></div>
<a id="trunkSourceWTFwtftextTextBreakIteratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/TextBreakIterator.h (213094 => 213095)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/TextBreakIterator.h        2017-02-27 22:41:08 UTC (rev 213094)
+++ trunk/Source/WTF/wtf/text/TextBreakIterator.h        2017-02-27 22:44:19 UTC (rev 213095)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> public:
</span><span class="cx"> enum class Mode {
</span><span class="cx"> Line,
</span><del>- Cursor,
</del><ins>+ Caret,
</ins><span class="cx"> Delete
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWTFwtftextcfTextBreakIteratorCFh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/cf/TextBreakIteratorCF.h (213094 => 213095)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/cf/TextBreakIteratorCF.h        2017-02-27 22:41:08 UTC (rev 213094)
+++ trunk/Source/WTF/wtf/text/cf/TextBreakIteratorCF.h        2017-02-27 22:44:19 UTC (rev 213095)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx"> class TextBreakIteratorCF {
</span><span class="cx"> public:
</span><span class="cx"> enum class Mode {
</span><del>- Cursor,
</del><ins>+ Caret,
</ins><span class="cx"> Delete
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -36,7 +36,7 @@
</span><span class="cx"> : m_string(string.createCFStringWithoutCopying())
</span><span class="cx"> {
</span><span class="cx"> switch (mode) {
</span><del>- case Mode::Cursor:
</del><ins>+ case Mode::Caret:
</ins><span class="cx"> m_type = kCFStringComposedCharacterCluster;
</span><span class="cx"> break;
</span><span class="cx"> case Mode::Delete:
</span></span></pre></div>
<a id="trunkSourceWTFwtftexticuTextBreakIteratorICUh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/icu/TextBreakIteratorICU.h (213094 => 213095)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/icu/TextBreakIteratorICU.h        2017-02-27 22:41:08 UTC (rev 213094)
+++ trunk/Source/WTF/wtf/text/icu/TextBreakIteratorICU.h        2017-02-27 22:44:19 UTC (rev 213095)
</span><span class="lines">@@ -24,12 +24,12 @@
</span><span class="cx"> #include <wtf/Optional.h>
</span><span class="cx"> #include <wtf/text/icu/UTextProviderLatin1.h>
</span><span class="cx">
</span><del>-#define USE_ICU_CURSOR_ITERATOR (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
</del><ins>+#define USE_ICU_CARET_ITERATOR (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
</ins><span class="cx">
</span><span class="cx"> namespace WTF {
</span><span class="cx">
</span><del>-#if USE_ICU_CURSOR_ITERATOR
-static String cursorRules()
</del><ins>+#if USE_ICU_CARET_ITERATOR
+static String caretRules()
</ins><span class="cx"> {
</span><span class="cx"> return ASCIILiteral(
</span><span class="cx"> // This rule set is based on character-break iterator rules of ICU 57
</span><span class="lines">@@ -36,9 +36,9 @@
</span><span class="cx"> // <http://source.icu-project.org/repos/icu/icu/tags/release-57-1/source/data/brkitr/>.
</span><span class="cx"> // The major differences from the original ones are listed below:
</span><span class="cx"> // * Replaced '[\p{Grapheme_Cluster_Break = SpacingMark}]' with '[\p{General_Category = Spacing Mark} - $Extend]' for ICU 3.8 or earlier;
</span><del>- // * Removed rules that prevent a cursor from moving after prepend characters (Bug 24342);
- // * Added rules that prevent a cursor from moving after virama signs of Indic languages except Tamil (Bug 15790), and;
- // * Added rules that prevent a cursor from moving before Japanese half-width katakara voiced marks.
</del><ins>+ // * Removed rules that prevent a caret from moving after prepend characters (Bug 24342);
+ // * Added rules that prevent a caret from moving after virama signs of Indic languages except Tamil (Bug 15790), and;
+ // * Added rules that prevent a caret from moving before Japanese half-width katakara voiced marks.
</ins><span class="cx"> // * Added rules for regional indicator symbols.
</span><span class="cx"> "$CR = [\\p{Grapheme_Cluster_Break = CR}];"
</span><span class="cx"> "$LF = [\\p{Grapheme_Cluster_Break = LF}];"
</span><span class="lines">@@ -136,8 +136,8 @@
</span><span class="cx"> enum class Mode {
</span><span class="cx"> Line,
</span><span class="cx"> Character,
</span><del>-#if USE_ICU_CURSOR_ITERATOR
- Cursor,
</del><ins>+#if USE_ICU_CARET_ITERATOR
+ Caret,
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -169,8 +169,8 @@
</span><span class="cx"> case Mode::Character:
</span><span class="cx"> type = UBRK_CHARACTER;
</span><span class="cx"> break;
</span><del>-#if USE_ICU_CURSOR_ITERATOR
- case Mode::Cursor:
</del><ins>+#if USE_ICU_CARET_ITERATOR
+ case Mode::Caret:
</ins><span class="cx"> type = UBRK_CHARACTER;
</span><span class="cx"> break;
</span><span class="cx"> #endif
</span><span class="lines">@@ -187,12 +187,12 @@
</span><span class="cx">
</span><span class="cx"> // FIXME: Handle weak / normal / strict line breaking.
</span><span class="cx"> UErrorCode status = U_ZERO_ERROR;
</span><del>-#if USE_ICU_CURSOR_ITERATOR
- if (mode == Mode::Cursor) {
- static NeverDestroyed<String> cursorRules = WTF::cursorRules();
- static NeverDestroyed<StringView::UpconvertedCharacters> upconvertedRules = StringView(cursorRules).upconvertedCharacters();
</del><ins>+#if USE_ICU_CARET_ITERATOR
+ if (mode == Mode::Caret) {
+ static NeverDestroyed<String> caretRules = WTF::caretRules();
+ static NeverDestroyed<StringView::UpconvertedCharacters> upconvertedRules = StringView(caretRules).upconvertedCharacters();
</ins><span class="cx"> UParseError parseError;
</span><del>- m_iterator = ubrk_openRules(upconvertedRules.get(), cursorRules.get().length(), text, textLength, &parseError, &status);
</del><ins>+ m_iterator = ubrk_openRules(upconvertedRules.get(), caretRules.get().length(), text, textLength, &parseError, &status);
</ins><span class="cx"> } else
</span><span class="cx"> #endif
</span><span class="cx"> m_iterator = ubrk_open(type, locale, text, textLength, &status);
</span></span></pre></div>
<a id="trunkSourceWTFwtftextmacTextBreakIteratorInternalICUMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm (213094 => 213095)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm        2017-02-27 22:41:08 UTC (rev 213094)
+++ trunk/Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm        2017-02-27 22:44:19 UTC (rev 213095)
</span><span class="lines">@@ -31,11 +31,11 @@
</span><span class="cx"> switch (mode) {
</span><span class="cx"> case TextBreakIterator::Mode::Line:
</span><span class="cx"> return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Line, locale.string().utf8().data());
</span><del>- case TextBreakIterator::Mode::Cursor:
-#if USE_ICU_CURSOR_ITERATOR
- return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Cursor, locale.string().utf8().data());
</del><ins>+ case TextBreakIterator::Mode::Caret:
+#if USE_ICU_CARET_ITERATOR
+ return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Caret, locale.string().utf8().data());
</ins><span class="cx"> #else
</span><del>- return TextBreakIteratorCF(string, TextBreakIteratorCF::Mode::Cursor);
</del><ins>+ return TextBreakIteratorCF(string, TextBreakIteratorCF::Mode::Caret);
</ins><span class="cx"> #endif
</span><span class="cx"> case TextBreakIterator::Mode::Delete:
</span><span class="cx"> return TextBreakIteratorCF(string, TextBreakIteratorCF::Mode::Delete);
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (213094 => 213095)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-02-27 22:41:08 UTC (rev 213094)
+++ trunk/Source/WebCore/ChangeLog        2017-02-27 22:44:19 UTC (rev 213095)
</span><span class="lines">@@ -1,5 +1,22 @@
</span><span class="cx"> 2017-02-27 Myles C. Maxfield <mmaxfield@apple.com>
</span><span class="cx">
</span><ins>+ Rename ICU cursor iterator to caret iterator
+ https://bugs.webkit.org/show_bug.cgi?id=168206
+
+ Reviewed by Simon Fraser.
+
+ Mechanical find/replace.
+
+ No new tests because there is no behavior change.
+
+ * platform/graphics/ComplexTextController.cpp:
+ (WebCore::ComplexTextController::offsetForPosition):
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::previousOffset):
+ (WebCore::RenderText::nextOffset):
+
+2017-02-27 Myles C. Maxfield <mmaxfield@apple.com>
+
</ins><span class="cx"> Unprefix -webkit-line-break
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=168213
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsComplexTextControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp (213094 => 213095)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp        2017-02-27 22:41:08 UTC (rev 213094)
+++ trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp        2017-02-27 22:44:19 UTC (rev 213095)
</span><span class="lines">@@ -217,7 +217,7 @@
</span><span class="cx"> // could use the glyph's "ligature carets". This is available in CoreText via CTFontGetLigatureCaretPositions().
</span><span class="cx"> unsigned hitIndex = hitGlyphStart + (hitGlyphEnd - hitGlyphStart) * (m_run.ltr() ? x / adjustedAdvance : 1 - x / adjustedAdvance);
</span><span class="cx"> unsigned stringLength = complexTextRun.stringLength();
</span><del>- CachedTextBreakIterator cursorPositionIterator(StringView(complexTextRun.characters(), stringLength), TextBreakIterator::Mode::Cursor, nullAtom);
</del><ins>+ CachedTextBreakIterator cursorPositionIterator(StringView(complexTextRun.characters(), stringLength), TextBreakIterator::Mode::Caret, nullAtom);
</ins><span class="cx"> unsigned clusterStart;
</span><span class="cx"> if (cursorPositionIterator.isBoundary(hitIndex))
</span><span class="cx"> clusterStart = hitIndex;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderText.cpp (213094 => 213095)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderText.cpp        2017-02-27 22:41:08 UTC (rev 213094)
+++ trunk/Source/WebCore/rendering/RenderText.cpp        2017-02-27 22:44:19 UTC (rev 213095)
</span><span class="lines">@@ -1505,7 +1505,7 @@
</span><span class="cx"> return current - 1;
</span><span class="cx">
</span><span class="cx"> StringImpl* textImpl = m_text.impl();
</span><del>- CachedTextBreakIterator iterator(StringView(textImpl->characters16(), textImpl->length()), TextBreakIterator::Mode::Cursor, nullAtom);
</del><ins>+ CachedTextBreakIterator iterator(StringView(textImpl->characters16(), textImpl->length()), TextBreakIterator::Mode::Caret, nullAtom);
</ins><span class="cx"> auto result = iterator.preceding(current).value_or(current - 1);
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="lines">@@ -1678,7 +1678,7 @@
</span><span class="cx"> return current + 1;
</span><span class="cx">
</span><span class="cx"> StringImpl* textImpl = m_text.impl();
</span><del>- CachedTextBreakIterator iterator(StringView(textImpl->characters16(), textImpl->length()), TextBreakIterator::Mode::Cursor, nullAtom);
</del><ins>+ CachedTextBreakIterator iterator(StringView(textImpl->characters16(), textImpl->length()), TextBreakIterator::Mode::Caret, nullAtom);
</ins><span class="cx"> auto result = iterator.following(current).value_or(current + 1);
</span><span class="cx"> return result;
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>