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

Unified Diff: Source/web/tests/WebViewTest.cpp

Issue 1325563002: Avoid style clobbering in setCompositionFromExistingText. (2nd land) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Delete CompositionUnderlinesRangeFilter (it's now dead code) Created 5 years, 3 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/web/tests/WebViewTest.cpp
diff --git a/Source/web/tests/WebViewTest.cpp b/Source/web/tests/WebViewTest.cpp
index ea64a12c23f7a46f91be07b99d073bc78023291c..ced7a554ae8dca0330f1ba611f3fbd2ef2e4da45 100644
--- a/Source/web/tests/WebViewTest.cpp
+++ b/Source/web/tests/WebViewTest.cpp
@@ -34,6 +34,7 @@
#include "core/dom/Document.h"
#include "core/dom/Element.h"
#include "core/editing/FrameSelection.h"
+#include "core/editing/markers/DocumentMarkerController.h"
#include "core/frame/EventHandlerRegistry.h"
#include "core/frame/FrameHost.h"
#include "core/frame/FrameView.h"
@@ -991,9 +992,6 @@ TEST_F(WebViewTest, SetCompositionFromExistingText)
WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame());
frame->setEditableSelectionOffsets(4, 10);
frame->setCompositionFromExistingText(8, 12, underlines);
- WebVector<WebCompositionUnderline> underlineResults = toWebViewImpl(webView)->compositionUnderlines();
- EXPECT_EQ(8u, underlineResults[0].startOffset);
- EXPECT_EQ(12u, underlineResults[0].endOffset);
WebTextInputInfo info = webView->textInputInfo();
EXPECT_EQ(4, info.selectionStart);
EXPECT_EQ(10, info.selectionEnd);
@@ -1024,9 +1022,6 @@ TEST_F(WebViewTest, SetCompositionFromExistingTextInTextArea)
frame->setEditableSelectionOffsets(31, 31);
frame->setCompositionFromExistingText(30, 34, underlines);
- WebVector<WebCompositionUnderline> underlineResults = toWebViewImpl(webView)->compositionUnderlines();
- EXPECT_EQ(2u, underlineResults[0].startOffset);
- EXPECT_EQ(6u, underlineResults[0].endOffset);
info = webView->textInputInfo();
EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", std::string(info.value.utf8().data()));
EXPECT_EQ(31, info.selectionStart);
@@ -1044,6 +1039,21 @@ TEST_F(WebViewTest, SetCompositionFromExistingTextInTextArea)
EXPECT_EQ(-1, info.compositionEnd);
}
+TEST_F(WebViewTest, SetCompositionFromExistingTextInRichText)
+{
+ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("content_editable_rich_text.html"));
+ WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "content_editable_rich_text.html");
+ webView->setInitialFocus(false);
+ WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1));
+ underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0);
+ WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame());
+ frame->setEditableSelectionOffsets(1, 1);
+ WebDocument document = webView->mainFrame()->document();
+ EXPECT_FALSE(document.getElementById("bold").isNull());
+ frame->setCompositionFromExistingText(0, 4, underlines);
+ EXPECT_FALSE(document.getElementById("bold").isNull());
+}
+
TEST_F(WebViewTest, SetEditableSelectionOffsetsKeepsComposition)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html"));
@@ -1672,7 +1682,6 @@ TEST_F(WebViewTest, LosingFocusDoesNotTriggerAutofillTextChange)
// text changed notification for autofill.
client.clearChangeCounts();
webView->setFocus(false);
- EXPECT_EQ(1, client.textChangesWhileIgnored());
EXPECT_EQ(0, client.textChangesWhileNotIgnored());
frame->setAutofillClient(0);

Powered by Google App Engine
This is Rietveld 408576698