OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 EXPECT_EQ(6, info.selectionStart); | 1320 EXPECT_EQ(6, info.selectionStart); |
1321 EXPECT_EQ(11, info.selectionEnd); | 1321 EXPECT_EQ(11, info.selectionEnd); |
1322 EXPECT_EQ(6, info.compositionStart); | 1322 EXPECT_EQ(6, info.compositionStart); |
1323 EXPECT_EQ(11, info.compositionEnd); | 1323 EXPECT_EQ(11, info.compositionEnd); |
1324 | 1324 |
1325 frame->setEditableSelectionOffsets(2, 2); | 1325 frame->setEditableSelectionOffsets(2, 2); |
1326 info = webView->textInputInfo(); | 1326 info = webView->textInputInfo(); |
1327 EXPECT_EQ("hello world", std::string(info.value.utf8().data())); | 1327 EXPECT_EQ("hello world", std::string(info.value.utf8().data())); |
1328 EXPECT_EQ(2, info.selectionStart); | 1328 EXPECT_EQ(2, info.selectionStart); |
1329 EXPECT_EQ(2, info.selectionEnd); | 1329 EXPECT_EQ(2, info.selectionEnd); |
1330 EXPECT_EQ(-1, info.compositionStart); | 1330 // Composition range should be reset by browser process or keyboard apps. |
1331 EXPECT_EQ(-1, info.compositionEnd); | 1331 EXPECT_EQ(6, info.compositionStart); |
| 1332 EXPECT_EQ(11, info.compositionEnd); |
1332 } | 1333 } |
1333 | 1334 |
1334 TEST_F(WebViewTest, IsSelectionAnchorFirst) | 1335 TEST_F(WebViewTest, IsSelectionAnchorFirst) |
1335 { | 1336 { |
1336 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); | 1337 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); |
1337 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_
field_populated.html"); | 1338 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_
field_populated.html"); |
1338 WebLocalFrame* frame = webView->mainFrameImpl(); | 1339 WebLocalFrame* frame = webView->mainFrameImpl(); |
1339 | 1340 |
1340 webView->setInitialFocus(false); | 1341 webView->setInitialFocus(false); |
1341 frame->setEditableSelectionOffsets(4, 10); | 1342 frame->setEditableSelectionOffsets(4, 10); |
(...skipping 2374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3716 | 3717 |
3717 // Transform adapts to page scale changes. | 3718 // Transform adapts to page scale changes. |
3718 webViewImpl->setPageScaleFactor(2.f); | 3719 webViewImpl->setPageScaleFactor(2.f); |
3719 expectedMatrix.makeIdentity().scale(2.f).translate(-50, -55).translate(50, 5
5).scale(1. / 2.f); | 3720 expectedMatrix.makeIdentity().scale(2.f).translate(-50, -55).translate(50, 5
5).scale(1. / 2.f); |
3720 EXPECT_EQ(expectedMatrix, webViewImpl->getRootLayerTransformForTesting()); | 3721 EXPECT_EQ(expectedMatrix, webViewImpl->getRootLayerTransformForTesting()); |
3721 // visibleContentRect doesn't change. | 3722 // visibleContentRect doesn't change. |
3722 EXPECT_EQ(IntRect(50, 55, 50, 75), *devToolsEmulator->visibleContentRectForP
ainting()); | 3723 EXPECT_EQ(IntRect(50, 55, 50, 75), *devToolsEmulator->visibleContentRectForP
ainting()); |
3723 } | 3724 } |
3724 | 3725 |
3725 } // namespace blink | 3726 } // namespace blink |
OLD | NEW |