Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(748)

Unified Diff: Source/core/editing/CompositionUnderlineRangeFilter.cpp

Issue 313233002: Adding backgroundColor to WebCompositionUnderline and using it for InlineTextBox drawing. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Renaming to CompositionUnderlineRangeFilter and using .begin(), .end(); adding unit test. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/editing/CompositionUnderlineRangeFilter.cpp
diff --git a/Source/core/editing/CompositionUnderlineRangeFilter.cpp b/Source/core/editing/CompositionUnderlineRangeFilter.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..cb532ba45f1e2ecd5cb1874bc75c5d250c31fbfa
--- /dev/null
+++ b/Source/core/editing/CompositionUnderlineRangeFilter.cpp
@@ -0,0 +1,35 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/editing/CompositionUnderlineRangeFilter.h"
+
+namespace WebCore {
+
+int CompositionUnderlineRangeFilter::seekValidIndex(int index)
+{
+ if (index < 0)
+ return ConstIterator::END;
+
+ size_t numUnderlines = m_underlines.size();
+ while (static_cast<size_t>(index) < numUnderlines) {
+ const CompositionUnderline& underline = m_underlines[index];
+
+ if (underline.endOffset <= m_indexLo) {
+ // underline is completely before interval. This may be an underline that appear
huangs 2014/06/06 23:38:32 Remove comments about "runs".
huangs 2014/06/09 06:07:13 Done.
+ // before the first run, or may be a underline within current run that got
+ // skipped due to truncation.
+ ++index;
+ } else if (underline.startOffset <= m_indexHi) {
+ // underline intersects range. Process it.
+ return index;
+ } else {
+ // underline is completely after this run, bail.
+ break;
+ }
+ }
+ return ConstIterator::END;
+}
+
+} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698