<!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>[200744] trunk/Source/WebCore</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/200744">200744</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2016-05-11 23:47:34 -0700 (Wed, 11 May 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>TextIteratorStopsOnFormControls is never used
https://bugs.webkit.org/show_bug.cgi?id=157609
Reviewed by Alex Christensen.
Removed SurroundingText.cpp and TextIteratorStopsOnFormControls from TextIterator as they're no longer used.
* editing/SurroundingText.cpp: Removed.
* editing/TextIterator.cpp:
(WebCore::TextIterator::advance):
(WebCore::TextIterator::exitNode):
(WebCore::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
(WebCore::SimplifiedBackwardsTextIterator::advance):
(WebCore::characterSubrange):
(WebCore::BackwardsCharacterIterator::BackwardsCharacterIterator):
* editing/TextIterator.h:
(WebCore::SimplifiedBackwardsTextIterator::atEnd):
* editing/TextIteratorBehavior.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreeditingTextIteratorcpp">trunk/Source/WebCore/editing/TextIterator.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingTextIteratorh">trunk/Source/WebCore/editing/TextIterator.h</a></li>
<li><a href="#trunkSourceWebCoreeditingTextIteratorBehaviorh">trunk/Source/WebCore/editing/TextIteratorBehavior.h</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreeditingSurroundingTextcpp">trunk/Source/WebCore/editing/SurroundingText.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (200743 => 200744)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-12 06:34:41 UTC (rev 200743)
+++ trunk/Source/WebCore/ChangeLog        2016-05-12 06:47:34 UTC (rev 200744)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2016-05-11 Ryosuke Niwa <rniwa@webkit.org>
+
+ TextIteratorStopsOnFormControls is never used
+ https://bugs.webkit.org/show_bug.cgi?id=157609
+
+ Reviewed by Alex Christensen.
+
+ Removed SurroundingText.cpp and TextIteratorStopsOnFormControls from TextIterator as they're no longer used.
+
+ * editing/SurroundingText.cpp: Removed.
+ * editing/TextIterator.cpp:
+ (WebCore::TextIterator::advance):
+ (WebCore::TextIterator::exitNode):
+ (WebCore::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
+ (WebCore::SimplifiedBackwardsTextIterator::advance):
+ (WebCore::characterSubrange):
+ (WebCore::BackwardsCharacterIterator::BackwardsCharacterIterator):
+ * editing/TextIterator.h:
+ (WebCore::SimplifiedBackwardsTextIterator::atEnd):
+ * editing/TextIteratorBehavior.h:
+
</ins><span class="cx"> 2016-05-11 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Kill Node::ancestorElement()
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingSurroundingTextcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/editing/SurroundingText.cpp (200743 => 200744)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/SurroundingText.cpp        2016-05-12 06:34:41 UTC (rev 200743)
+++ trunk/Source/WebCore/editing/SurroundingText.cpp        2016-05-12 06:47:34 UTC (rev 200744)
</span><span class="lines">@@ -1,109 +0,0 @@
</span><del>-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "SurroundingText.h"
-
-#include "Document.h"
-#include "TextIterator.h"
-#include "VisibleSelection.h"
-#include "VisibleUnits.h"
-
-namespace WebCore {
-
-SurroundingText::SurroundingText(const VisiblePosition& visiblePosition, unsigned maxLength)
- : m_positionOffsetInContent(0)
-{
- if (visiblePosition.isNull())
- return;
-
- const unsigned halfMaxLength = maxLength / 2;
- CharacterIterator forwardIterator(makeRange(visiblePosition, endOfDocument(visiblePosition)).get(), TextIteratorStopsOnFormControls);
- if (!forwardIterator.atEnd())
- forwardIterator.advance(maxLength - halfMaxLength);
-
- Position position = visiblePosition.deepEquivalent().parentAnchoredEquivalent();
- Document* document = position.document();
- RefPtr<Range> forwardRange = forwardIterator.range();
- if (!forwardRange || !Range::create(document, position, forwardRange->startPosition())->text().length()) {
- ASSERT(forwardRange);
- return;
- }
-
- BackwardsCharacterIterator backwardsIterator(makeRange(startOfDocument(visiblePosition), visiblePosition).get(), TextIteratorStopsOnFormControls);
- if (!backwardsIterator.atEnd())
- backwardsIterator.advance(halfMaxLength);
-
- RefPtr<Range> backwardsRange = backwardsIterator.range();
- if (!backwardsRange) {
- ASSERT(backwardsRange);
- return;
- }
-
- m_positionOffsetInContent = Range::create(document, backwardsRange->endPosition(), position)->text().length();
- m_contentRange = Range::create(document, backwardsRange->endPosition(), forwardRange->startPosition());
- ASSERT(m_contentRange);
-}
-
-PassRefPtr<Range> SurroundingText::rangeFromContentOffsets(unsigned startOffsetInContent, unsigned endOffsetInContent)
-{
- if (startOffsetInContent >= endOffsetInContent || endOffsetInContent > content().length())
- return 0;
-
- CharacterIterator iterator(m_contentRange.get());
-
- ASSERT(!iterator.atEnd());
- iterator.advance(startOffsetInContent);
-
- ASSERT(iterator.range());
- Position start = iterator.range()->startPosition();
-
- ASSERT(!iterator.atEnd());
- iterator.advance(endOffsetInContent - startOffsetInContent);
-
- ASSERT(iterator.range());
- Position end = iterator.range()->startPosition();
-
- return Range::create(start.document(), start, end);
-}
-
-String SurroundingText::content() const
-{
- if (m_contentRange)
- return m_contentRange->text();
- return String();
-}
-
-unsigned SurroundingText::positionOffsetInContent() const
-{
- return m_positionOffsetInContent;
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCoreeditingTextIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/TextIterator.cpp (200743 => 200744)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/TextIterator.cpp        2016-05-12 06:34:41 UTC (rev 200743)
+++ trunk/Source/WebCore/editing/TextIterator.cpp        2016-05-12 06:47:34 UTC (rev 200744)
</span><span class="lines">@@ -414,9 +414,6 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> while (m_node && m_node != m_pastEndNode) {
</span><del>- if ((m_behavior & TextIteratorStopsOnFormControls) && HTMLFormControlElement::enclosingFormControlElement(m_node))
- return;
-
</del><span class="cx"> // if the range ends at offset 0 of an element, represent the
</span><span class="cx"> // position, but not the content, of that element e.g. if the
</span><span class="cx"> // node is a blockflow element, emit a newline that
</span><span class="lines">@@ -1188,26 +1185,8 @@
</span><span class="cx">
</span><span class="cx"> // --------
</span><span class="cx">
</span><del>-SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator(const Range& range, TextIteratorBehavior behavior)
- : m_behavior(behavior)
- , m_node(nullptr)
- , m_offset(0)
- , m_handledNode(false)
- , m_handledChildren(false)
- , m_startContainer(nullptr)
- , m_startOffset(0)
- , m_endContainer(nullptr)
- , m_endOffset(0)
- , m_positionNode(nullptr)
- , m_positionStartOffset(0)
- , m_positionEndOffset(0)
- , m_lastTextNode(nullptr)
- , m_lastCharacter(0)
- , m_havePassedStartContainer(false)
- , m_shouldHandleFirstLetter(false)
</del><ins>+SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator(const Range& range)
</ins><span class="cx"> {
</span><del>- ASSERT(behavior == TextIteratorDefaultBehavior || behavior == TextIteratorStopsOnFormControls);
-
</del><span class="cx"> range.ownerDocument().updateLayoutIgnorePendingStylesheets();
</span><span class="cx">
</span><span class="cx"> Node* startNode = &range.startContainer();
</span><span class="lines">@@ -1260,9 +1239,6 @@
</span><span class="cx"> m_copyableText.reset();
</span><span class="cx"> m_text = StringView();
</span><span class="cx">
</span><del>- if ((m_behavior & TextIteratorStopsOnFormControls) && HTMLFormControlElement::enclosingFormControlElement(m_node))
- return;
-
</del><span class="cx"> while (m_node && !m_havePassedStartContainer) {
</span><span class="cx"> // Don't handle node if we start iterating at [node, 0].
</span><span class="cx"> if (!m_handledNode && !(m_node == m_endContainer && !m_endOffset)) {
</span><span class="lines">@@ -1554,7 +1530,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> BackwardsCharacterIterator::BackwardsCharacterIterator(const Range& range)
</span><del>- : m_underlyingIterator(range, TextIteratorDefaultBehavior)
</del><ins>+ : m_underlyingIterator(range)
</ins><span class="cx"> , m_offset(0)
</span><span class="cx"> , m_runOffset(0)
</span><span class="cx"> , m_atBreak(true)
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingTextIteratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/TextIterator.h (200743 => 200744)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/TextIterator.h        2016-05-12 06:34:41 UTC (rev 200743)
+++ trunk/Source/WebCore/editing/TextIterator.h        2016-05-12 06:47:34 UTC (rev 200744)
</span><span class="lines">@@ -188,7 +188,7 @@
</span><span class="cx"> // chunks so as to optimize for performance of the iteration.
</span><span class="cx"> class SimplifiedBackwardsTextIterator {
</span><span class="cx"> public:
</span><del>- explicit SimplifiedBackwardsTextIterator(const Range&, TextIteratorBehavior = TextIteratorDefaultBehavior);
</del><ins>+ explicit SimplifiedBackwardsTextIterator(const Range&);
</ins><span class="cx">
</span><span class="cx"> bool atEnd() const { return !m_positionNode; }
</span><span class="cx"> void advance();
</span><span class="lines">@@ -206,37 +206,37 @@
</span><span class="cx"> void emitCharacter(UChar, Node&, int startOffset, int endOffset);
</span><span class="cx"> bool advanceRespectingRange(Node*);
</span><span class="cx">
</span><del>- const TextIteratorBehavior m_behavior;
</del><ins>+ const TextIteratorBehavior m_behavior { TextIteratorDefaultBehavior };
</ins><span class="cx">
</span><span class="cx"> // Current position, not necessarily of the text being returned, but position as we walk through the DOM tree.
</span><del>- Node* m_node;
- int m_offset;
- bool m_handledNode;
- bool m_handledChildren;
</del><ins>+ Node* m_node { nullptr };
+ int m_offset { 0 };
+ bool m_handledNode { false };
+ bool m_handledChildren { false };
</ins><span class="cx"> BitStack m_fullyClippedStack;
</span><span class="cx">
</span><span class="cx"> // The range.
</span><del>- Node* m_startContainer;
- int m_startOffset;
- Node* m_endContainer;
- int m_endOffset;
</del><ins>+ Node* m_startContainer { nullptr };
+ int m_startOffset { 0 };
+ Node* m_endContainer { nullptr };
+ int m_endOffset { 0 };
</ins><span class="cx">
</span><span class="cx"> // The current text and its position, in the form to be returned from the iterator.
</span><del>- Node* m_positionNode;
- int m_positionStartOffset;
- int m_positionEndOffset;
</del><ins>+ Node* m_positionNode { nullptr };
+ int m_positionStartOffset { 0 };
+ int m_positionEndOffset { 0 };
</ins><span class="cx"> TextIteratorCopyableText m_copyableText;
</span><span class="cx"> StringView m_text;
</span><span class="cx">
</span><span class="cx"> // Used to do the whitespace logic.
</span><del>- Text* m_lastTextNode;
- UChar m_lastCharacter;
</del><ins>+ Text* m_lastTextNode { nullptr };
+ UChar m_lastCharacter { 0 };
</ins><span class="cx">
</span><span class="cx"> // Whether m_node has advanced beyond the iteration range (i.e. m_startContainer).
</span><del>- bool m_havePassedStartContainer;
</del><ins>+ bool m_havePassedStartContainer { false };
</ins><span class="cx">
</span><span class="cx"> // Should handle first-letter renderer in the next call to handleTextNode.
</span><del>- bool m_shouldHandleFirstLetter;
</del><ins>+ bool m_shouldHandleFirstLetter { false };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> // Builds on the text iterator, adding a character position so we can walk one
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingTextIteratorBehaviorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/TextIteratorBehavior.h (200743 => 200744)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/TextIteratorBehavior.h        2016-05-12 06:34:41 UTC (rev 200743)
+++ trunk/Source/WebCore/editing/TextIteratorBehavior.h        2016-05-12 06:47:34 UTC (rev 200744)
</span><span class="lines">@@ -51,11 +51,9 @@
</span><span class="cx"> // Used when pasting inside password field.
</span><span class="cx"> TextIteratorEmitsOriginalText = 1 << 5,
</span><span class="cx">
</span><del>- TextIteratorStopsOnFormControls = 1 << 6,
</del><ins>+ TextIteratorEmitsImageAltText = 1 << 6,
</ins><span class="cx">
</span><del>- TextIteratorEmitsImageAltText = 1 << 7,
-
- TextIteratorBehavesAsIfNodesFollowing = 1 << 8,
</del><ins>+ TextIteratorBehavesAsIfNodesFollowing = 1 << 7,
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> typedef unsigned short TextIteratorBehavior;
</span></span></pre>
</div>
</div>
</body>
</html>