<!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>[174876] 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/174876">174876</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2014-10-19 22:17:06 -0700 (Sun, 19 Oct 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Kill toRenderedDocumentMarker() by using tighter typing
https://bugs.webkit.org/show_bug.cgi?id=137858
Reviewed by Darin Adler.
Source/WebCore:
Kill toRenderedDocumentMarker() by using tighter typing. This method
was doing no type validation, just a static_cast<>().
No new tests, no behavior change.
* dom/DocumentMarkerController.cpp:
(WebCore::DocumentMarkerController::addTextMatchMarker):
(WebCore::DocumentMarkerController::markersFor):
(WebCore::DocumentMarkerController::markersInRange):
(DocumentMarkerController::hasMarkers):
* dom/DocumentMarkerController.h:
* dom/RenderedDocumentMarker.h:
(WebCore::toRenderedDocumentMarker): Deleted.
* editing/AlternativeTextController.cpp:
(WebCore::markersHaveIdenticalDescription):
(WebCore::AlternativeTextController::respondToChangedSelection):
(WebCore::AlternativeTextController::recordSpellcheckerResponseForModifiedCorrection):
(WebCore::AlternativeTextController::processMarkersOnTextToBeReplacedByResult):
(WebCore::AlternativeTextController::applyDictationAlternative):
* editing/CompositeEditCommand.cpp:
(WebCore::copyMarkers):
(WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers):
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::originalStringForAutocorrectionAtBeginningOfSelection):
* editing/Editor.cpp:
(WebCore::Editor::updateMarkersForWordsAffectedByEditing):
(WebCore::Editor::selectionStartHasMarkerFor):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintDocumentMarker):
(WebCore::InlineTextBox::paintTextMatchMarker):
(WebCore::InlineTextBox::computeRectForReplacementMarker):
(WebCore::InlineTextBox::paintDocumentMarkers):
* rendering/InlineTextBox.h:
* rendering/svg/SVGInlineFlowBox.cpp:
(WebCore::SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer):
* testing/Internals.cpp:
(WebCore::Internals::markerAt):
(WebCore::Internals::markerRangeForNode):
(WebCore::Internals::markerDescriptionForNode):
* testing/Internals.h:
Source/WebKit:
Update symbol export for Windows due to argument type change.
* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomDocumentMarkerControllercpp">trunk/Source/WebCore/dom/DocumentMarkerController.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumentMarkerControllerh">trunk/Source/WebCore/dom/DocumentMarkerController.h</a></li>
<li><a href="#trunkSourceWebCoredomRenderedDocumentMarkerh">trunk/Source/WebCore/dom/RenderedDocumentMarker.h</a></li>
<li><a href="#trunkSourceWebCoreeditingAlternativeTextControllercpp">trunk/Source/WebCore/editing/AlternativeTextController.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingCompositeEditCommandcpp">trunk/Source/WebCore/editing/CompositeEditCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingDeleteSelectionCommandcpp">trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorcpp">trunk/Source/WebCore/editing/Editor.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineTextBoxcpp">trunk/Source/WebCore/rendering/InlineTextBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineTextBoxh">trunk/Source/WebCore/rendering/InlineTextBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGInlineFlowBoxcpp">trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsh">trunk/Source/WebCore/testing/Internals.h</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitWebKitvcxprojWebKitExportGeneratorWebKitExportsdefin">trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (174875 => 174876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-10-20 03:42:03 UTC (rev 174875)
+++ trunk/Source/WebCore/ChangeLog        2014-10-20 05:17:06 UTC (rev 174876)
</span><span class="lines">@@ -1,5 +1,53 @@
</span><span class="cx"> 2014-10-19 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><ins>+ Kill toRenderedDocumentMarker() by using tighter typing
+ https://bugs.webkit.org/show_bug.cgi?id=137858
+
+ Reviewed by Darin Adler.
+
+ Kill toRenderedDocumentMarker() by using tighter typing. This method
+ was doing no type validation, just a static_cast<>().
+
+ No new tests, no behavior change.
+
+ * dom/DocumentMarkerController.cpp:
+ (WebCore::DocumentMarkerController::addTextMatchMarker):
+ (WebCore::DocumentMarkerController::markersFor):
+ (WebCore::DocumentMarkerController::markersInRange):
+ (DocumentMarkerController::hasMarkers):
+ * dom/DocumentMarkerController.h:
+ * dom/RenderedDocumentMarker.h:
+ (WebCore::toRenderedDocumentMarker): Deleted.
+ * editing/AlternativeTextController.cpp:
+ (WebCore::markersHaveIdenticalDescription):
+ (WebCore::AlternativeTextController::respondToChangedSelection):
+ (WebCore::AlternativeTextController::recordSpellcheckerResponseForModifiedCorrection):
+ (WebCore::AlternativeTextController::processMarkersOnTextToBeReplacedByResult):
+ (WebCore::AlternativeTextController::applyDictationAlternative):
+ * editing/CompositeEditCommand.cpp:
+ (WebCore::copyMarkers):
+ (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers):
+ * editing/DeleteSelectionCommand.cpp:
+ (WebCore::DeleteSelectionCommand::originalStringForAutocorrectionAtBeginningOfSelection):
+ * editing/Editor.cpp:
+ (WebCore::Editor::updateMarkersForWordsAffectedByEditing):
+ (WebCore::Editor::selectionStartHasMarkerFor):
+ * rendering/InlineTextBox.cpp:
+ (WebCore::InlineTextBox::paintDocumentMarker):
+ (WebCore::InlineTextBox::paintTextMatchMarker):
+ (WebCore::InlineTextBox::computeRectForReplacementMarker):
+ (WebCore::InlineTextBox::paintDocumentMarkers):
+ * rendering/InlineTextBox.h:
+ * rendering/svg/SVGInlineFlowBox.cpp:
+ (WebCore::SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer):
+ * testing/Internals.cpp:
+ (WebCore::Internals::markerAt):
+ (WebCore::Internals::markerRangeForNode):
+ (WebCore::Internals::markerDescriptionForNode):
+ * testing/Internals.h:
+
+2014-10-19 Chris Dumez <cdumez@apple.com>
+
</ins><span class="cx"> Use is<>() / downcast<>() for all remaining RenderObject subclasses
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=137845
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentMarkerControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DocumentMarkerController.cpp (174875 => 174876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DocumentMarkerController.cpp        2014-10-20 03:42:03 UTC (rev 174875)
+++ trunk/Source/WebCore/dom/DocumentMarkerController.cpp        2014-10-20 05:17:06 UTC (rev 174876)
</span><span class="lines">@@ -101,8 +101,8 @@
</span><span class="cx"> // the whole purpose of tickmarks on the scrollbar is to show where
</span><span class="cx"> // matches off-screen are (that haven't been painted yet).
</span><span class="cx"> Node* node = textPiece->startContainer();
</span><del>- Vector<DocumentMarker*> markers = markersFor(node);
- static_cast<RenderedDocumentMarker*>(markers[markers.size() - 1])->setRenderedRect(range->boundingBox());
</del><ins>+ Vector<RenderedDocumentMarker*> markers = markersFor(node);
+ markers[markers.size() - 1]->setRenderedRect(range->boundingBox());
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -376,9 +376,9 @@
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Vector<DocumentMarker*> DocumentMarkerController::markersFor(Node* node, DocumentMarker::MarkerTypes markerTypes)
</del><ins>+Vector<RenderedDocumentMarker*> DocumentMarkerController::markersFor(Node* node, DocumentMarker::MarkerTypes markerTypes)
</ins><span class="cx"> {
</span><del>- Vector<DocumentMarker*> result;
</del><ins>+ Vector<RenderedDocumentMarker*> result;
</ins><span class="cx"> MarkerList* list = m_markers.get(node);
</span><span class="cx"> if (!list)
</span><span class="cx"> return result;
</span><span class="lines">@@ -391,12 +391,12 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Vector<DocumentMarker*> DocumentMarkerController::markersInRange(Range* range, DocumentMarker::MarkerTypes markerTypes)
</del><ins>+Vector<RenderedDocumentMarker*> DocumentMarkerController::markersInRange(Range* range, DocumentMarker::MarkerTypes markerTypes)
</ins><span class="cx"> {
</span><span class="cx"> if (!possiblyHasMarkers(markerTypes))
</span><del>- return Vector<DocumentMarker*>();
</del><ins>+ return Vector<RenderedDocumentMarker*>();
</ins><span class="cx">
</span><del>- Vector<DocumentMarker*> foundMarkers;
</del><ins>+ Vector<RenderedDocumentMarker*> foundMarkers;
</ins><span class="cx">
</span><span class="cx"> Node* startContainer = range->startContainer();
</span><span class="cx"> ASSERT(startContainer);
</span><span class="lines">@@ -405,10 +405,7 @@
</span><span class="cx">
</span><span class="cx"> Node* pastLastNode = range->pastLastNode();
</span><span class="cx"> for (Node* node = range->firstNode(); node != pastLastNode; node = NodeTraversal::next(node)) {
</span><del>- Vector<DocumentMarker*> markers = markersFor(node);
- Vector<DocumentMarker*>::const_iterator end = markers.end();
- for (Vector<DocumentMarker*>::const_iterator it = markers.begin(); it != end; ++it) {
- DocumentMarker* marker = *it;
</del><ins>+ for (auto* marker : markersFor(node)) {
</ins><span class="cx"> if (!markerTypes.contains(marker->type()))
</span><span class="cx"> continue;
</span><span class="cx"> if (node == startContainer && marker->endOffset() <= static_cast<unsigned>(range->startOffset()))
</span><span class="lines">@@ -679,10 +676,7 @@
</span><span class="cx">
</span><span class="cx"> Node* pastLastNode = range->pastLastNode();
</span><span class="cx"> for (Node* node = range->firstNode(); node != pastLastNode; node = NodeTraversal::next(node)) {
</span><del>- Vector<DocumentMarker*> markers = markersFor(node);
- Vector<DocumentMarker*>::const_iterator end = markers.end();
- for (Vector<DocumentMarker*>::const_iterator it = markers.begin(); it != end; ++it) {
- DocumentMarker* marker = *it;
</del><ins>+ for (auto* marker : markersFor(node)) {
</ins><span class="cx"> if (!markerTypes.contains(marker->type()))
</span><span class="cx"> continue;
</span><span class="cx"> if (node == startContainer && marker->endOffset() <= static_cast<unsigned>(range->startOffset()))
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentMarkerControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DocumentMarkerController.h (174875 => 174876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DocumentMarkerController.h        2014-10-20 03:42:03 UTC (rev 174875)
+++ trunk/Source/WebCore/dom/DocumentMarkerController.h        2014-10-20 05:17:06 UTC (rev 174876)
</span><span class="lines">@@ -84,8 +84,8 @@
</span><span class="cx"> void setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool);
</span><span class="cx">
</span><span class="cx"> DocumentMarker* markerContainingPoint(const LayoutPoint&, DocumentMarker::MarkerType);
</span><del>- WEBCORE_EXPORT Vector<DocumentMarker*> markersFor(Node*, DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers());
- WEBCORE_EXPORT Vector<DocumentMarker*> markersInRange(Range*, DocumentMarker::MarkerTypes);
</del><ins>+ WEBCORE_EXPORT Vector<RenderedDocumentMarker*> markersFor(Node*, DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers());
+ WEBCORE_EXPORT Vector<RenderedDocumentMarker*> markersInRange(Range*, DocumentMarker::MarkerTypes);
</ins><span class="cx"> WEBCORE_EXPORT Vector<IntRect> renderedRectsForMarkers(DocumentMarker::MarkerType);
</span><span class="cx"> void clearDescriptionOnMarkersIntersectingRange(Range*, DocumentMarker::MarkerTypes);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomRenderedDocumentMarkerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/RenderedDocumentMarker.h (174875 => 174876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/RenderedDocumentMarker.h        2014-10-20 03:42:03 UTC (rev 174875)
+++ trunk/Source/WebCore/dom/RenderedDocumentMarker.h        2014-10-20 05:17:06 UTC (rev 174876)
</span><span class="lines">@@ -62,11 +62,6 @@
</span><span class="cx"> invalidate();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-inline RenderedDocumentMarker* toRenderedDocumentMarker(DocumentMarker* marker)
-{
- return static_cast<RenderedDocumentMarker*>(marker);
-}
-
</del><span class="cx"> } // namespace
</span><span class="cx">
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingAlternativeTextControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/AlternativeTextController.cpp (174875 => 174876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/AlternativeTextController.cpp        2014-10-20 03:42:03 UTC (rev 174875)
+++ trunk/Source/WebCore/editing/AlternativeTextController.cpp        2014-10-20 05:17:06 UTC (rev 174876)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "FrameView.h"
</span><span class="cx"> #include "Page.h"
</span><ins>+#include "RenderedDocumentMarker.h"
</ins><span class="cx"> #include "SpellingCorrectionCommand.h"
</span><span class="cx"> #include "TextCheckerClient.h"
</span><span class="cx"> #include "TextCheckingHelper.h"
</span><span class="lines">@@ -114,7 +115,7 @@
</span><span class="cx"> return markerTypesForAppliedDictationAlternative;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static bool markersHaveIdenticalDescription(const Vector<DocumentMarker*>& markers)
</del><ins>+static bool markersHaveIdenticalDescription(const Vector<RenderedDocumentMarker*>& markers)
</ins><span class="cx"> {
</span><span class="cx"> if (markers.isEmpty())
</span><span class="cx"> return true;
</span><span class="lines">@@ -469,13 +470,8 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> Node* node = position.containerNode();
</span><del>- Vector<DocumentMarker*> markers = node->document().markers().markersFor(node);
- size_t markerCount = markers.size();
- for (size_t i = 0; i < markerCount; ++i) {
- const DocumentMarker* marker = markers[i];
- if (!marker)
- continue;
-
</del><ins>+ for (auto* marker : node->document().markers().markersFor(node)) {
+ ASSERT(marker);
</ins><span class="cx"> if (respondToMarkerAtEndOfWord(*marker, position))
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="lines">@@ -554,7 +550,7 @@
</span><span class="cx"> if (!rangeOfCorrection)
</span><span class="cx"> return;
</span><span class="cx"> DocumentMarkerController& markers = rangeOfCorrection->startContainer()->document().markers();
</span><del>- Vector<DocumentMarker*> correctedOnceMarkers = markers.markersInRange(rangeOfCorrection, DocumentMarker::Autocorrected);
</del><ins>+ Vector<RenderedDocumentMarker*> correctedOnceMarkers = markers.markersInRange(rangeOfCorrection, DocumentMarker::Autocorrected);
</ins><span class="cx"> if (correctedOnceMarkers.isEmpty())
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -613,10 +609,9 @@
</span><span class="cx"> Position precedingCharacterPosition = beginningOfRange.previous();
</span><span class="cx"> RefPtr<Range> precedingCharacterRange = Range::create(*m_frame.document(), precedingCharacterPosition, beginningOfRange);
</span><span class="cx">
</span><del>- Vector<DocumentMarker*> markers = markerController.markersInRange(precedingCharacterRange.get(), DocumentMarker::DeletedAutocorrection);
-
- for (size_t i = 0; i < markers.size(); ++i) {
- if (markers[i]->description() == stringToBeReplaced)
</del><ins>+ Vector<RenderedDocumentMarker*> markers = markerController.markersInRange(precedingCharacterRange.get(), DocumentMarker::DeletedAutocorrection);
+ for (const auto* marker : markers) {
+ if (marker->description() == stringToBeReplaced)
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -735,9 +730,9 @@
</span><span class="cx"> if (!selection || !editor.shouldInsertText(alternativeString, selection.get(), EditorInsertActionPasted))
</span><span class="cx"> return;
</span><span class="cx"> DocumentMarkerController& markers = selection->startContainer()->document().markers();
</span><del>- Vector<DocumentMarker*> dictationAlternativesMarkers = markers.markersInRange(selection.get(), DocumentMarker::DictationAlternatives);
- for (size_t i = 0; i < dictationAlternativesMarkers.size(); ++i)
- removeDictationAlternativesForMarker(dictationAlternativesMarkers[i]);
</del><ins>+ Vector<RenderedDocumentMarker*> dictationAlternativesMarkers = markers.markersInRange(selection.get(), DocumentMarker::DictationAlternatives);
+ for (auto* marker : dictationAlternativesMarkers)
+ removeDictationAlternativesForMarker(marker);
</ins><span class="cx">
</span><span class="cx"> applyAlternativeTextToRange(selection.get(), alternativeString, AlternativeTextTypeDictationAlternatives, markerTypesForAppliedDictationAlternative());
</span><span class="cx"> #else
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingCompositeEditCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/CompositeEditCommand.cpp (174875 => 174876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/CompositeEditCommand.cpp        2014-10-20 03:42:03 UTC (rev 174875)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.cpp        2014-10-20 05:17:06 UTC (rev 174876)
</span><span class="lines">@@ -57,6 +57,7 @@
</span><span class="cx"> #include "RemoveNodePreservingChildrenCommand.h"
</span><span class="cx"> #include "RenderBlockFlow.h"
</span><span class="cx"> #include "RenderText.h"
</span><ins>+#include "RenderedDocumentMarker.h"
</ins><span class="cx"> #include "ReplaceNodeWithSpanCommand.h"
</span><span class="cx"> #include "ReplaceSelectionCommand.h"
</span><span class="cx"> #include "ScopedEventQueue.h"
</span><span class="lines">@@ -574,7 +575,7 @@
</span><span class="cx"> return Position(textNode.release(), start.offsetInContainerNode() + text.length());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void copyMarkers(const Vector<DocumentMarker*>& markerPointers, Vector<DocumentMarker>& markers)
</del><ins>+static void copyMarkers(const Vector<RenderedDocumentMarker*>& markerPointers, Vector<RenderedDocumentMarker>& markers)
</ins><span class="cx"> {
</span><span class="cx"> size_t arraySize = markerPointers.size();
</span><span class="cx"> markers.reserveCapacity(arraySize);
</span><span class="lines">@@ -586,15 +587,15 @@
</span><span class="cx"> {
</span><span class="cx"> RefPtr<Text> node(prpNode);
</span><span class="cx"> DocumentMarkerController& markerController = document().markers();
</span><del>- Vector<DocumentMarker> markers;
</del><ins>+ Vector<RenderedDocumentMarker> markers;
</ins><span class="cx"> copyMarkers(markerController.markersInRange(Range::create(document(), node, offset, node, offset + count).get(), DocumentMarker::AllMarkers()), markers);
</span><span class="cx"> replaceTextInNode(node, offset, count, replacementText);
</span><span class="cx"> RefPtr<Range> newRange = Range::create(document(), node, offset, node, offset + replacementText.length());
</span><del>- for (size_t i = 0; i < markers.size(); ++i)
</del><ins>+ for (const auto& marker : markers)
</ins><span class="cx"> #if PLATFORM(IOS)
</span><del>- markerController.addMarker(newRange.get(), markers[i].type(), markers[i].description(), markers[i].alternatives(), markers[i].metadata());
</del><ins>+ markerController.addMarker(newRange.get(), marker.type(), marker.description(), marker.alternatives(), marker.metadata());
</ins><span class="cx"> #else
</span><del>- markerController.addMarker(newRange.get(), markers[i].type(), markers[i].description());
</del><ins>+ markerController.addMarker(newRange.get(), marker.type(), marker.description());
</ins><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingDeleteSelectionCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp (174875 => 174876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp        2014-10-20 03:42:03 UTC (rev 174875)
+++ trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp        2014-10-20 05:17:06 UTC (rev 174876)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx"> #include "NodeTraversal.h"
</span><span class="cx"> #include "RenderTableCell.h"
</span><span class="cx"> #include "RenderText.h"
</span><ins>+#include "RenderedDocumentMarker.h"
</ins><span class="cx"> #include "Text.h"
</span><span class="cx"> #include "VisibleUnits.h"
</span><span class="cx">
</span><span class="lines">@@ -765,9 +766,8 @@
</span><span class="cx"> return String();
</span><span class="cx">
</span><span class="cx"> RefPtr<Range> rangeOfFirstCharacter = Range::create(document(), startOfSelection.deepEquivalent(), nextPosition.deepEquivalent());
</span><del>- Vector<DocumentMarker*> markers = document().markers().markersInRange(rangeOfFirstCharacter.get(), DocumentMarker::Autocorrected);
- for (size_t i = 0; i < markers.size(); ++i) {
- const DocumentMarker* marker = markers[i];
</del><ins>+ Vector<RenderedDocumentMarker*> markers = document().markers().markersInRange(rangeOfFirstCharacter.get(), DocumentMarker::Autocorrected);
+ for (auto* marker : markers) {
</ins><span class="cx"> int startOffset = marker->startOffset();
</span><span class="cx"> if (startOffset == startOfSelection.deepEquivalent().offsetInContainerNode())
</span><span class="cx"> return marker->description();
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/Editor.cpp (174875 => 174876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/Editor.cpp        2014-10-20 03:42:03 UTC (rev 174875)
+++ trunk/Source/WebCore/editing/Editor.cpp        2014-10-20 05:17:06 UTC (rev 174876)
</span><span class="lines">@@ -71,6 +71,7 @@
</span><span class="cx"> #include "RemoveFormatCommand.h"
</span><span class="cx"> #include "RenderBlock.h"
</span><span class="cx"> #include "RenderTextControl.h"
</span><ins>+#include "RenderedDocumentMarker.h"
</ins><span class="cx"> #include "RenderedPosition.h"
</span><span class="cx"> #include "ReplaceSelectionCommand.h"
</span><span class="cx"> #include "Settings.h"
</span><span class="lines">@@ -2753,9 +2754,9 @@
</span><span class="cx"> // of marker that contains the word in question, and remove marker on that whole range.
</span><span class="cx"> RefPtr<Range> wordRange = Range::create(document(), startOfFirstWord.deepEquivalent(), endOfLastWord.deepEquivalent());
</span><span class="cx">
</span><del>- Vector<DocumentMarker*> markers = document().markers().markersInRange(wordRange.get(), DocumentMarker::DictationAlternatives);
- for (size_t i = 0; i < markers.size(); ++i)
- m_alternativeTextController->removeDictationAlternativesForMarker(markers[i]);
</del><ins>+ Vector<RenderedDocumentMarker*> markers = document().markers().markersInRange(wordRange.get(), DocumentMarker::DictationAlternatives);
+ for (auto* marker : markers)
+ m_alternativeTextController->removeDictationAlternativesForMarker(marker);
</ins><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> document().markers().removeMarkers(wordRange.get(), DocumentMarker::Spelling | DocumentMarker::CorrectionIndicator | DocumentMarker::SpellCheckingExemption | DocumentMarker::DictationAlternatives | DocumentMarker::DictationPhraseWithAlternatives, DocumentMarkerController::RemovePartiallyOverlappingMarker);
</span><span class="lines">@@ -3542,9 +3543,8 @@
</span><span class="cx">
</span><span class="cx"> unsigned int startOffset = static_cast<unsigned int>(from);
</span><span class="cx"> unsigned int endOffset = static_cast<unsigned int>(from + length);
</span><del>- Vector<DocumentMarker*> markers = document().markers().markersFor(node);
- for (size_t i = 0; i < markers.size(); ++i) {
- DocumentMarker* marker = markers[i];
</del><ins>+ Vector<RenderedDocumentMarker*> markers = document().markers().markersFor(node);
+ for (auto* marker : markers) {
</ins><span class="cx"> if (marker->startOffset() <= startOffset && endOffset <= marker->endOffset() && marker->type() == markerType)
</span><span class="cx"> return true;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineTextBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (174875 => 174876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineTextBox.cpp        2014-10-20 03:42:03 UTC (rev 174875)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp        2014-10-20 05:17:06 UTC (rev 174876)
</span><span class="lines">@@ -509,7 +509,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- GraphicsContext* context = paintInfo.context;
</del><ins>+ GraphicsContext& context = *paintInfo.context;
</ins><span class="cx">
</span><span class="cx"> const RenderStyle& lineStyle = this->lineStyle();
</span><span class="cx">
</span><span class="lines">@@ -523,7 +523,7 @@
</span><span class="cx">
</span><span class="cx"> bool shouldRotate = !isHorizontal() && !combinedText;
</span><span class="cx"> if (shouldRotate)
</span><del>- context->concatCTM(rotation(boxRect, Clockwise));
</del><ins>+ context.concatCTM(rotation(boxRect, Clockwise));
</ins><span class="cx">
</span><span class="cx"> // Determine whether or not we have composition underlines to draw.
</span><span class="cx"> bool containsComposition = renderer().textNode() && renderer().frame().editor().compositionNode() == renderer().textNode();
</span><span class="lines">@@ -616,18 +616,18 @@
</span><span class="cx"> else
</span><span class="cx"> textOrigin.setX(roundToDevicePixel(LayoutUnit(textOrigin.x()), renderer().document().deviceScaleFactor()));
</span><span class="cx">
</span><del>- TextPainter textPainter(*context, paintSelectedTextOnly, paintSelectedTextSeparately, font, sPos, ePos, length, emphasisMark, combinedText, textRun, boxRect, textOrigin, emphasisMarkOffset, textShadow, selectionShadow, isHorizontal(), textPaintStyle, selectionPaintStyle);
</del><ins>+ TextPainter textPainter(context, paintSelectedTextOnly, paintSelectedTextSeparately, font, sPos, ePos, length, emphasisMark, combinedText, textRun, boxRect, textOrigin, emphasisMarkOffset, textShadow, selectionShadow, isHorizontal(), textPaintStyle, selectionPaintStyle);
</ins><span class="cx"> textPainter.paintText();
</span><span class="cx">
</span><span class="cx"> // Paint decorations
</span><span class="cx"> TextDecoration textDecorations = lineStyle.textDecorationsInEffect();
</span><span class="cx"> if (textDecorations != TextDecorationNone && paintInfo.phase != PaintPhaseSelection) {
</span><del>- updateGraphicsContext(*context, textPaintStyle);
</del><ins>+ updateGraphicsContext(context, textPaintStyle);
</ins><span class="cx"> if (combinedText)
</span><del>- context->concatCTM(rotation(boxRect, Clockwise));
- paintDecoration(*context, boxOrigin, textDecorations, lineStyle.textDecorationStyle(), textShadow, textPainter);
</del><ins>+ context.concatCTM(rotation(boxRect, Clockwise));
+ paintDecoration(context, boxOrigin, textDecorations, lineStyle.textDecorationStyle(), textShadow, textPainter);
</ins><span class="cx"> if (combinedText)
</span><del>- context->concatCTM(rotation(boxRect, Counterclockwise));
</del><ins>+ context.concatCTM(rotation(boxRect, Counterclockwise));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (paintInfo.phase == PaintPhaseForeground) {
</span><span class="lines">@@ -660,7 +660,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (shouldRotate)
</span><del>- context->concatCTM(rotation(boxRect, Counterclockwise));
</del><ins>+ context.concatCTM(rotation(boxRect, Counterclockwise));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void InlineTextBox::selectionStartEnd(int& sPos, int& ePos)
</span><span class="lines">@@ -681,10 +681,10 @@
</span><span class="cx"> ePos = std::min(endPos - m_start, (int)m_len);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void InlineTextBox::paintSelection(GraphicsContext* context, const FloatPoint& boxOrigin, const RenderStyle& style, const Font& font, Color textColor)
</del><ins>+void InlineTextBox::paintSelection(GraphicsContext& context, const FloatPoint& boxOrigin, const RenderStyle& style, const Font& font, Color textColor)
</ins><span class="cx"> {
</span><span class="cx"> #if ENABLE(TEXT_SELECTION)
</span><del>- if (context->paintingDisabled())
</del><ins>+ if (context.paintingDisabled())
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> // See if we have a selection to paint at all.
</span><span class="lines">@@ -702,8 +702,8 @@
</span><span class="cx"> if (textColor == c)
</span><span class="cx"> c = Color(0xff - c.red(), 0xff - c.green(), 0xff - c.blue());
</span><span class="cx">
</span><del>- GraphicsContextStateSaver stateSaver(*context);
- updateGraphicsContext(*context, TextPaintStyle(c, style.colorSpace())); // Don't draw text at all!
</del><ins>+ GraphicsContextStateSaver stateSaver(context);
+ updateGraphicsContext(context, TextPaintStyle(c, style.colorSpace())); // Don't draw text at all!
</ins><span class="cx">
</span><span class="cx"> // If the text is truncated, let the thing being painted in the truncation
</span><span class="cx"> // draw its own highlight.
</span><span class="lines">@@ -730,7 +730,7 @@
</span><span class="cx">
</span><span class="cx"> LayoutRect selectionRect = LayoutRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_logicalWidth, selectionHeight);
</span><span class="cx"> font.adjustSelectionRectForText(textRun, selectionRect, sPos, ePos);
</span><del>- context->fillRect(snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), textRun.ltr()), c, style.colorSpace());
</del><ins>+ context.fillRect(snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), textRun.ltr()), c, style.colorSpace());
</ins><span class="cx"> #else
</span><span class="cx"> UNUSED_PARAM(context);
</span><span class="cx"> UNUSED_PARAM(boxOrigin);
</span><span class="lines">@@ -740,7 +740,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void InlineTextBox::paintCompositionBackground(GraphicsContext* context, const FloatPoint& boxOrigin, const RenderStyle& style, const Font& font, int startPos, int endPos)
</del><ins>+void InlineTextBox::paintCompositionBackground(GraphicsContext& context, const FloatPoint& boxOrigin, const RenderStyle& style, const Font& font, int startPos, int endPos)
</ins><span class="cx"> {
</span><span class="cx"> int offset = m_start;
</span><span class="cx"> int sPos = std::max(startPos - offset, 0);
</span><span class="lines">@@ -749,15 +749,15 @@
</span><span class="cx"> if (sPos >= ePos)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- GraphicsContextStateSaver stateSaver(*context);
</del><ins>+ GraphicsContextStateSaver stateSaver(context);
</ins><span class="cx"> Color compositionColor = Color::compositionFill;
</span><del>- updateGraphicsContext(*context, TextPaintStyle(compositionColor, style.colorSpace())); // Don't draw text at all!
</del><ins>+ updateGraphicsContext(context, TextPaintStyle(compositionColor, style.colorSpace())); // Don't draw text at all!
</ins><span class="cx">
</span><span class="cx"> LayoutUnit deltaY = renderer().style().isFlippedLinesWritingMode() ? selectionBottom() - logicalBottom() : logicalTop() - selectionTop();
</span><span class="cx"> LayoutRect selectionRect = LayoutRect(boxOrigin.x(), boxOrigin.y() - deltaY, 0, selectionHeight());
</span><span class="cx"> TextRun textRun = constructTextRun(style, font);
</span><span class="cx"> font.adjustSelectionRectForText(textRun, selectionRect, sPos, ePos);
</span><del>- context->fillRect(snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), textRun.ltr()), compositionColor, style.colorSpace());
</del><ins>+ context.fillRect(snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), textRun.ltr()), compositionColor, style.colorSpace());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static StrokeStyle textDecorationStyleToStrokeStyle(TextDecorationStyle decorationStyle)
</span><span class="lines">@@ -1061,7 +1061,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void InlineTextBox::paintDocumentMarker(GraphicsContext* pt, const FloatPoint& boxOrigin, DocumentMarker* marker, const RenderStyle& style, const Font& font, bool grammar)
</del><ins>+void InlineTextBox::paintDocumentMarker(GraphicsContext& context, const FloatPoint& boxOrigin, RenderedDocumentMarker& marker, const RenderStyle& style, const Font& font, bool grammar)
</ins><span class="cx"> {
</span><span class="cx"> // Never print spelling/grammar markers (5327887)
</span><span class="cx"> if (renderer().document().printing())
</span><span class="lines">@@ -1075,17 +1075,17 @@
</span><span class="cx">
</span><span class="cx"> // Determine whether we need to measure text
</span><span class="cx"> bool markerSpansWholeBox = true;
</span><del>- if (m_start <= (int)marker->startOffset())
</del><ins>+ if (m_start <= (int)marker.startOffset())
</ins><span class="cx"> markerSpansWholeBox = false;
</span><del>- if ((end() + 1) != marker->endOffset()) // end points at the last char, not past it
</del><ins>+ if ((end() + 1) != marker.endOffset()) // end points at the last char, not past it
</ins><span class="cx"> markerSpansWholeBox = false;
</span><span class="cx"> if (m_truncation != cNoTruncation)
</span><span class="cx"> markerSpansWholeBox = false;
</span><span class="cx">
</span><del>- bool isDictationMarker = marker->type() == DocumentMarker::DictationAlternatives;
</del><ins>+ bool isDictationMarker = marker.type() == DocumentMarker::DictationAlternatives;
</ins><span class="cx"> if (!markerSpansWholeBox || grammar || isDictationMarker) {
</span><del>- int startPosition = std::max<int>(marker->startOffset() - m_start, 0);
- int endPosition = std::min<int>(marker->endOffset() - m_start, m_len);
</del><ins>+ int startPosition = std::max<int>(marker.startOffset() - m_start, 0);
+ int endPosition = std::min<int>(marker.endOffset() - m_start, m_len);
</ins><span class="cx">
</span><span class="cx"> if (m_truncation != cNoTruncation)
</span><span class="cx"> endPosition = std::min<int>(endPosition, m_truncation);
</span><span class="lines">@@ -1107,7 +1107,7 @@
</span><span class="cx"> if (grammar || isDictationMarker) {
</span><span class="cx"> markerRect.move(-boxOrigin.x(), -boxOrigin.y());
</span><span class="cx"> markerRect = renderer().localToAbsoluteQuad(FloatRect(markerRect)).enclosingBoundingBox();
</span><del>- toRenderedDocumentMarker(marker)->setRenderedRect(markerRect);
</del><ins>+ marker.setRenderedRect(markerRect);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1128,15 +1128,15 @@
</span><span class="cx"> // In larger fonts, though, place the underline up near the baseline to prevent a big gap.
</span><span class="cx"> underlineOffset = baseline + 2;
</span><span class="cx"> }
</span><del>- pt->drawLineForDocumentMarker(FloatPoint(boxOrigin.x() + start, boxOrigin.y() + underlineOffset), width, lineStyleForMarkerType(marker->type()));
</del><ins>+ context.drawLineForDocumentMarker(FloatPoint(boxOrigin.x() + start, boxOrigin.y() + underlineOffset), width, lineStyleForMarkerType(marker.type()));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void InlineTextBox::paintTextMatchMarker(GraphicsContext* context, const FloatPoint& boxOrigin, DocumentMarker* marker, const RenderStyle& style, const Font& font)
</del><ins>+void InlineTextBox::paintTextMatchMarker(GraphicsContext& context, const FloatPoint& boxOrigin, RenderedDocumentMarker& marker, const RenderStyle& style, const Font& font)
</ins><span class="cx"> {
</span><span class="cx"> LayoutUnit selectionHeight = this->selectionHeight();
</span><span class="cx">
</span><del>- int sPos = std::max(marker->startOffset() - m_start, (unsigned)0);
- int ePos = std::min(marker->endOffset() - m_start, (unsigned)m_len);
</del><ins>+ int sPos = std::max(marker.startOffset() - m_start, (unsigned)0);
+ int ePos = std::min(marker.endOffset() - m_start, (unsigned)m_len);
</ins><span class="cx"> TextRun run = constructTextRun(style, font);
</span><span class="cx">
</span><span class="cx"> // Always compute and store the rect associated with this marker. The computed rect is in absolute coordinates.
</span><span class="lines">@@ -1145,31 +1145,31 @@
</span><span class="cx"> font.adjustSelectionRectForText(run, renderedRect, sPos, ePos);
</span><span class="cx"> IntRect markerRect = enclosingIntRect(renderedRect);
</span><span class="cx"> markerRect = renderer().localToAbsoluteQuad(FloatQuad(markerRect)).enclosingBoundingBox();
</span><del>- toRenderedDocumentMarker(marker)->setRenderedRect(markerRect);
</del><ins>+ marker.setRenderedRect(markerRect);
</ins><span class="cx">
</span><span class="cx"> // Optionally highlight the text
</span><span class="cx"> if (renderer().frame().editor().markedTextMatchesAreHighlighted()) {
</span><del>- Color color = marker->activeMatch() ? renderer().theme().platformActiveTextSearchHighlightColor() : renderer().theme().platformInactiveTextSearchHighlightColor();
- GraphicsContextStateSaver stateSaver(*context);
- updateGraphicsContext(*context, TextPaintStyle(color, style.colorSpace())); // Don't draw text at all!
</del><ins>+ Color color = marker.activeMatch() ? renderer().theme().platformActiveTextSearchHighlightColor() : renderer().theme().platformInactiveTextSearchHighlightColor();
+ GraphicsContextStateSaver stateSaver(context);
+ updateGraphicsContext(context, TextPaintStyle(color, style.colorSpace())); // Don't draw text at all!
</ins><span class="cx">
</span><span class="cx"> // Use same y positioning and height as for selection, so that when the selection and this highlight are on
</span><span class="cx"> // the same word there are no pieces sticking out.
</span><span class="cx"> LayoutUnit deltaY = renderer().style().isFlippedLinesWritingMode() ? selectionBottom() - logicalBottom() : logicalTop() - selectionTop();
</span><span class="cx"> LayoutRect selectionRect = LayoutRect(boxOrigin.x(), boxOrigin.y() - deltaY, 0, selectionHeight);
</span><span class="cx"> font.adjustSelectionRectForText(run, selectionRect, sPos, ePos);
</span><del>- context->fillRect(snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), run.ltr()), color, style.colorSpace());
</del><ins>+ context.fillRect(snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), run.ltr()), color, style.colorSpace());
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void InlineTextBox::computeRectForReplacementMarker(DocumentMarker* marker, const RenderStyle& style, const Font& font)
</del><ins>+void InlineTextBox::computeRectForReplacementMarker(RenderedDocumentMarker& marker, const RenderStyle& style, const Font& font)
</ins><span class="cx"> {
</span><span class="cx"> // Replacement markers are not actually drawn, but their rects need to be computed for hit testing.
</span><span class="cx"> LayoutUnit top = selectionTop();
</span><span class="cx"> LayoutUnit h = selectionHeight();
</span><span class="cx">
</span><del>- int sPos = std::max(marker->startOffset() - m_start, (unsigned)0);
- int ePos = std::min(marker->endOffset() - m_start, (unsigned)m_len);
</del><ins>+ int sPos = std::max(marker.startOffset() - m_start, (unsigned)0);
+ int ePos = std::min(marker.endOffset() - m_start, (unsigned)m_len);
</ins><span class="cx"> TextRun run = constructTextRun(style, font);
</span><span class="cx">
</span><span class="cx"> // Compute and store the rect associated with this marker.
</span><span class="lines">@@ -1177,22 +1177,19 @@
</span><span class="cx"> font.adjustSelectionRectForText(run, selectionRect, sPos, ePos);
</span><span class="cx"> IntRect markerRect = enclosingIntRect(selectionRect);
</span><span class="cx"> markerRect = renderer().localToAbsoluteQuad(FloatRect(markerRect)).enclosingBoundingBox();
</span><del>- toRenderedDocumentMarker(marker)->setRenderedRect(markerRect);
</del><ins>+ marker.setRenderedRect(markerRect);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void InlineTextBox::paintDocumentMarkers(GraphicsContext* pt, const FloatPoint& boxOrigin, const RenderStyle& style, const Font& font, bool background)
</del><ins>+void InlineTextBox::paintDocumentMarkers(GraphicsContext& context, const FloatPoint& boxOrigin, const RenderStyle& style, const Font& font, bool background)
</ins><span class="cx"> {
</span><span class="cx"> if (!renderer().textNode())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- Vector<DocumentMarker*> markers = renderer().document().markers().markersFor(renderer().textNode());
- Vector<DocumentMarker*>::const_iterator markerIt = markers.begin();
</del><ins>+ Vector<RenderedDocumentMarker*> markers = renderer().document().markers().markersFor(renderer().textNode());
</ins><span class="cx">
</span><span class="cx"> // Give any document markers that touch this run a chance to draw before the text has been drawn.
</span><span class="cx"> // Note end() points at the last char, not one past it like endOffset and ranges do.
</span><del>- for ( ; markerIt != markers.end(); ++markerIt) {
- DocumentMarker* marker = *markerIt;
-
</del><ins>+ for (auto* marker : markers) {
</ins><span class="cx"> // Paint either the background markers or the foreground markers, but not both
</span><span class="cx"> switch (marker->type()) {
</span><span class="cx"> case DocumentMarker::Grammar:
</span><span class="lines">@@ -1232,22 +1229,22 @@
</span><span class="cx"> case DocumentMarker::Spelling:
</span><span class="cx"> case DocumentMarker::CorrectionIndicator:
</span><span class="cx"> case DocumentMarker::DictationAlternatives:
</span><del>- paintDocumentMarker(pt, boxOrigin, marker, style, font, false);
</del><ins>+ paintDocumentMarker(context, boxOrigin, *marker, style, font, false);
</ins><span class="cx"> break;
</span><span class="cx"> case DocumentMarker::Grammar:
</span><del>- paintDocumentMarker(pt, boxOrigin, marker, style, font, true);
</del><ins>+ paintDocumentMarker(context, boxOrigin, *marker, style, font, true);
</ins><span class="cx"> break;
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> // FIXME: See <rdar://problem/8933352>. Also, remove the PLATFORM(IOS)-guard.
</span><span class="cx"> case DocumentMarker::DictationPhraseWithAlternatives:
</span><del>- paintDocumentMarker(pt, boxOrigin, marker, style, font, true);
</del><ins>+ paintDocumentMarker(context, boxOrigin, *marker, style, font, true);
</ins><span class="cx"> break;
</span><span class="cx"> #endif
</span><span class="cx"> case DocumentMarker::TextMatch:
</span><del>- paintTextMatchMarker(pt, boxOrigin, marker, style, font);
</del><ins>+ paintTextMatchMarker(context, boxOrigin, *marker, style, font);
</ins><span class="cx"> break;
</span><span class="cx"> case DocumentMarker::Replacement:
</span><del>- computeRectForReplacementMarker(marker, style, font);
</del><ins>+ computeRectForReplacementMarker(*marker, style, font);
</ins><span class="cx"> break;
</span><span class="cx"> #if ENABLE(TELEPHONE_NUMBER_DETECTION)
</span><span class="cx"> case DocumentMarker::TelephoneNumber:
</span><span class="lines">@@ -1260,7 +1257,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void InlineTextBox::paintCompositionUnderline(GraphicsContext* ctx, const FloatPoint& boxOrigin, const CompositionUnderline& underline)
</del><ins>+void InlineTextBox::paintCompositionUnderline(GraphicsContext& context, const FloatPoint& boxOrigin, const CompositionUnderline& underline)
</ins><span class="cx"> {
</span><span class="cx"> if (m_truncation == cFullTruncation)
</span><span class="cx"> return;
</span><span class="lines">@@ -1300,9 +1297,9 @@
</span><span class="cx"> start += 1;
</span><span class="cx"> width -= 2;
</span><span class="cx">
</span><del>- ctx->setStrokeColor(underline.color, renderer().style().colorSpace());
- ctx->setStrokeThickness(lineThickness);
- ctx->drawLineForText(FloatPoint(boxOrigin.x() + start, boxOrigin.y() + logicalHeight() - lineThickness), width, renderer().document().printing());
</del><ins>+ context.setStrokeColor(underline.color, renderer().style().colorSpace());
+ context.setStrokeThickness(lineThickness);
+ context.drawLineForText(FloatPoint(boxOrigin.x() + start, boxOrigin.y() + logicalHeight() - lineThickness), width, renderer().document().printing());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> int InlineTextBox::caretMinOffset() const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineTextBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineTextBox.h (174875 => 174876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineTextBox.h        2014-10-20 03:42:03 UTC (rev 174875)
+++ trunk/Source/WebCore/rendering/InlineTextBox.h        2014-10-20 05:17:06 UTC (rev 174876)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> struct CompositionUnderline;
</span><del>-class DocumentMarker;
</del><ins>+class RenderedDocumentMarker;
</ins><span class="cx"> class TextPainter;
</span><span class="cx">
</span><span class="cx"> const unsigned short cNoTruncation = USHRT_MAX;
</span><span class="lines">@@ -148,17 +148,17 @@
</span><span class="cx"> virtual float positionForOffset(int offset) const;
</span><span class="cx">
</span><span class="cx"> protected:
</span><del>- void paintCompositionBackground(GraphicsContext*, const FloatPoint& boxOrigin, const RenderStyle&, const Font&, int startPos, int endPos);
- void paintDocumentMarkers(GraphicsContext*, const FloatPoint& boxOrigin, const RenderStyle&, const Font&, bool background);
- void paintCompositionUnderline(GraphicsContext*, const FloatPoint& boxOrigin, const CompositionUnderline&);
</del><ins>+ void paintCompositionBackground(GraphicsContext&, const FloatPoint& boxOrigin, const RenderStyle&, const Font&, int startPos, int endPos);
+ void paintDocumentMarkers(GraphicsContext&, const FloatPoint& boxOrigin, const RenderStyle&, const Font&, bool background);
+ void paintCompositionUnderline(GraphicsContext&, const FloatPoint& boxOrigin, const CompositionUnderline&);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> void paintDecoration(GraphicsContext&, const FloatPoint& boxOrigin, TextDecoration, TextDecorationStyle, const ShadowData*, TextPainter&);
</span><del>- void paintSelection(GraphicsContext*, const FloatPoint& boxOrigin, const RenderStyle&, const Font&, Color textColor);
- void paintDocumentMarker(GraphicsContext*, const FloatPoint& boxOrigin, DocumentMarker*, const RenderStyle&, const Font&, bool grammar);
- void paintTextMatchMarker(GraphicsContext*, const FloatPoint& boxOrigin, DocumentMarker*, const RenderStyle&, const Font&);
</del><ins>+ void paintSelection(GraphicsContext&, const FloatPoint& boxOrigin, const RenderStyle&, const Font&, Color textColor);
+ void paintDocumentMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const Font&, bool grammar);
+ void paintTextMatchMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const Font&);
</ins><span class="cx">
</span><del>- void computeRectForReplacementMarker(DocumentMarker*, const RenderStyle&, const Font&);
</del><ins>+ void computeRectForReplacementMarker(RenderedDocumentMarker&, const RenderStyle&, const Font&);
</ins><span class="cx">
</span><span class="cx"> TextRun::ExpansionBehavior expansionBehavior() const
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGInlineFlowBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp (174875 => 174876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp        2014-10-20 03:42:03 UTC (rev 174875)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp        2014-10-20 05:17:06 UTC (rev 174876)
</span><span class="lines">@@ -83,12 +83,8 @@
</span><span class="cx"> RenderStyle& style = textRenderer->style();
</span><span class="cx">
</span><span class="cx"> AffineTransform fragmentTransform;
</span><del>- Vector<DocumentMarker*> markers = textRenderer->document().markers().markersFor(&textNode);
-
- Vector<DocumentMarker*>::iterator markerEnd = markers.end();
- for (Vector<DocumentMarker*>::iterator markerIt = markers.begin(); markerIt != markerEnd; ++markerIt) {
- DocumentMarker* marker = *markerIt;
-
</del><ins>+ Vector<RenderedDocumentMarker*> markers = textRenderer->document().markers().markersFor(&textNode);
+ for (auto* marker : markers) {
</ins><span class="cx"> // SVG is only interessted in the TextMatch marker, for now.
</span><span class="cx"> if (marker->type() != DocumentMarker::TextMatch)
</span><span class="cx"> continue;
</span><span class="lines">@@ -128,7 +124,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- toRenderedDocumentMarker(marker)->setRenderedRect(textRenderer->localToAbsoluteQuad(markerRect).enclosingBoundingBox());
</del><ins>+ marker->setRenderedRect(textRenderer->localToAbsoluteQuad(markerRect).enclosingBoundingBox());
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (174875 => 174876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2014-10-20 03:42:03 UTC (rev 174875)
+++ trunk/Source/WebCore/testing/Internals.cpp        2014-10-20 05:17:06 UTC (rev 174876)
</span><span class="lines">@@ -85,6 +85,7 @@
</span><span class="cx"> #include "RenderMenuList.h"
</span><span class="cx"> #include "RenderTreeAsText.h"
</span><span class="cx"> #include "RenderView.h"
</span><ins>+#include "RenderedDocumentMarker.h"
</ins><span class="cx"> #include "RuntimeEnabledFeatures.h"
</span><span class="cx"> #include "SchemeRegistry.h"
</span><span class="cx"> #include "ScrollingCoordinator.h"
</span><span class="lines">@@ -779,39 +780,39 @@
</span><span class="cx"> return node->document().markers().markersFor(node, markerTypes).size();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
</del><ins>+RenderedDocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
</ins><span class="cx"> {
</span><span class="cx"> node->document().updateLayoutIgnorePendingStylesheets();
</span><span class="cx"> if (!node) {
</span><span class="cx"> ec = INVALID_ACCESS_ERR;
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> DocumentMarker::MarkerTypes markerTypes = 0;
</span><span class="cx"> if (!markerTypesFrom(markerType, markerTypes)) {
</span><span class="cx"> ec = SYNTAX_ERR;
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> node->document().frame()->editor().updateEditorUINowIfScheduled();
</span><span class="cx">
</span><del>- Vector<DocumentMarker*> markers = node->document().markers().markersFor(node, markerTypes);
</del><ins>+ Vector<RenderedDocumentMarker*> markers = node->document().markers().markersFor(node, markerTypes);
</ins><span class="cx"> if (markers.size() <= index)
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx"> return markers[index];
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
</span><span class="cx"> {
</span><del>- DocumentMarker* marker = markerAt(node, markerType, index, ec);
</del><ins>+ RenderedDocumentMarker* marker = markerAt(node, markerType, index, ec);
</ins><span class="cx"> if (!marker)
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx"> return Range::create(node->document(), node, marker->startOffset(), node, marker->endOffset());
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> String Internals::markerDescriptionForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
</span><span class="cx"> {
</span><del>- DocumentMarker* marker = markerAt(node, markerType, index, ec);
</del><ins>+ RenderedDocumentMarker* marker = markerAt(node, markerType, index, ec);
</ins><span class="cx"> if (!marker)
</span><span class="cx"> return String();
</span><span class="cx"> return marker->description();
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.h (174875 => 174876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.h        2014-10-20 03:42:03 UTC (rev 174875)
+++ trunk/Source/WebCore/testing/Internals.h        2014-10-20 05:17:06 UTC (rev 174876)
</span><span class="lines">@@ -46,7 +46,6 @@
</span><span class="cx"> class DOMStringList;
</span><span class="cx"> class DOMWindow;
</span><span class="cx"> class Document;
</span><del>-class DocumentMarker;
</del><span class="cx"> class Element;
</span><span class="cx"> class Frame;
</span><span class="cx"> class InspectorFrontendChannelDummy;
</span><span class="lines">@@ -57,6 +56,7 @@
</span><span class="cx"> class Node;
</span><span class="cx"> class Page;
</span><span class="cx"> class Range;
</span><ins>+class RenderedDocumentMarker;
</ins><span class="cx"> class ScriptExecutionContext;
</span><span class="cx"> class SerializedScriptValue;
</span><span class="cx"> class SourceBuffer;
</span><span class="lines">@@ -351,7 +351,7 @@
</span><span class="cx"> Frame* frame() const;
</span><span class="cx"> Vector<String> iconURLs(Document*, int iconTypesMask) const;
</span><span class="cx">
</span><del>- DocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionCode&);
</del><ins>+ RenderedDocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionCode&);
</ins><span class="cx"> #if ENABLE(INSPECTOR)
</span><span class="cx"> RefPtr<DOMWindow> m_frontendWindow;
</span><span class="cx"> std::unique_ptr<InspectorFrontendClientDummy> m_frontendClient;
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (174875 => 174876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog        2014-10-20 03:42:03 UTC (rev 174875)
+++ trunk/Source/WebKit/ChangeLog        2014-10-20 05:17:06 UTC (rev 174876)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-10-19 Chris Dumez <cdumez@apple.com>
+
+ Kill toRenderedDocumentMarker() by using tighter typing
+ https://bugs.webkit.org/show_bug.cgi?id=137858
+
+ Reviewed by Darin Adler.
+
+ Update symbol export for Windows due to argument type change.
+
+ * WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:
+
</ins><span class="cx"> 2014-10-17 peavo@outlook.com <peavo@outlook.com>
</span><span class="cx">
</span><span class="cx"> [WinCairo] Accelerated compositing is not implemented.
</span></span></pre></div>
<a id="trunkSourceWebKitWebKitvcxprojWebKitExportGeneratorWebKitExportsdefin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in (174875 => 174876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in        2014-10-20 03:42:03 UTC (rev 174875)
+++ trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in        2014-10-20 05:17:06 UTC (rev 174876)
</span><span class="lines">@@ -427,7 +427,7 @@
</span><span class="cx"> symbolWithPointer(?setAutofilled@HTMLInputElement@WebCore@@QAEX_N@Z, ?setAutofilled@HTMLInputElement@WebCore@@QEAAX_N@Z)
</span><span class="cx"> symbolWithPointer(?setDocumentState@HistoryItem@WebCore@@QAEXABV?$Vector@VString@WTF@@$0A@VCrashOnOverflow@2@@WTF@@@Z, ?setDocumentState@HistoryItem@WebCore@@QEAAXAEBV?$Vector@VString@WTF@@$0A@VCrashOnOverflow@2@@WTF@@@Z)
</span><span class="cx"> symbolWithPointer(?overrideUserPreferredLanguages@WebCore@@YAXABV?$Vector@VString@WTF@@$0A@VCrashOnOverflow@2@@WTF@@@Z, ?overrideUserPreferredLanguages@WebCore@@YAXAEBV?$Vector@VString@WTF@@$0A@VCrashOnOverflow@2@@WTF@@@Z)
</span><del>- symbolWithPointer(?markersFor@DocumentMarkerController@WebCore@@QAE?AV?$Vector@PAVDocumentMarker@WebCore@@$0A@VCrashOnOverflow@WTF@@@WTF@@PAVNode@2@VMarkerTypes@DocumentMarker@2@@Z, ?markersFor@DocumentMarkerController@WebCore@@QEAA?AV?$Vector@PEAVDocumentMarker@WebCore@@$0A@VCrashOnOverflow@WTF@@@WTF@@PEAVNode@2@VMarkerTypes@DocumentMarker@2@@Z)
</del><ins>+ symbolWithPointer(?markersFor@DocumentMarkerController@WebCore@@QAE?AV?$Vector@PAVRenderedDocumentMarker@WebCore@@$0A@VCrashOnOverflow@WTF@@@WTF@@PAVNode@2@VMarkerTypes@DocumentMarker@2@@Z, ?markersFor@DocumentMarkerController@WebCore@@QEAA?AV?$Vector@PEAVRenderedDocumentMarker@WebCore@@$0A@VCrashOnOverflow@WTF@@@WTF@@PEAVNode@2@VMarkerTypes@DocumentMarker@2@@Z)
</ins><span class="cx"> symbolWithPointer(?getReferencedFilePaths@FormController@WebCore@@SA?AV?$Vector@VString@WTF@@$0A@VCrashOnOverflow@2@@WTF@@ABV34@@Z, ?getReferencedFilePaths@FormController@WebCore@@SA?AV?$Vector@VString@WTF@@$0A@VCrashOnOverflow@2@@WTF@@AEBV34@@Z)
</span><span class="cx"> symbolWithPointer(?iconURLs@Document@WebCore@@QAEABV?$Vector@UIconURL@WebCore@@$0A@VCrashOnOverflow@WTF@@@WTF@@H@Z, ?iconURLs@Document@WebCore@@QEAAAEBV?$Vector@UIconURL@WebCore@@$0A@VCrashOnOverflow@WTF@@@WTF@@H@Z)
</span><span class="cx"> ?userPreferredLanguages@WebCore@@YA?AV?$Vector@VString@WTF@@$0A@VCrashOnOverflow@2@@WTF@@XZ
</span></span></pre>
</div>
</div>
</body>
</html>