| OLD | NEW | 
|     1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |     1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
|     2 // Use of this source code is governed by a BSD-style license that can be |     2 // Use of this source code is governed by a BSD-style license that can be | 
|     3 // found in the LICENSE file. |     3 // found in the LICENSE file. | 
|     4  |     4  | 
|     5 #include <stddef.h> |     5 #include <stddef.h> | 
|     6 #include <stdint.h> |     6 #include <stdint.h> | 
|     7 #include <tuple> |     7 #include <tuple> | 
|     8  |     8  | 
|     9 #include "base/bind.h" |     9 #include "base/bind.h" | 
|    10 #include "base/callback.h" |    10 #include "base/callback.h" | 
| (...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1308             base::WideToUTF16(ime_message->ime_string), |  1308             base::WideToUTF16(ime_message->ime_string), | 
|  1309             std::vector<blink::WebCompositionUnderline>(), |  1309             std::vector<blink::WebCompositionUnderline>(), | 
|  1310             gfx::Range::InvalidRange(), |  1310             gfx::Range::InvalidRange(), | 
|  1311             ime_message->selection_start, |  1311             ime_message->selection_start, | 
|  1312             ime_message->selection_end); |  1312             ime_message->selection_end); | 
|  1313         break; |  1313         break; | 
|  1314  |  1314  | 
|  1315       case IME_CONFIRMCOMPOSITION: |  1315       case IME_CONFIRMCOMPOSITION: | 
|  1316         view()->OnImeConfirmComposition( |  1316         view()->OnImeConfirmComposition( | 
|  1317             base::WideToUTF16(ime_message->ime_string), |  1317             base::WideToUTF16(ime_message->ime_string), | 
|  1318             gfx::Range::InvalidRange(), |  1318             gfx::Range::InvalidRange(), false, 1); | 
|  1319             false); |  | 
|  1320         break; |  1319         break; | 
|  1321  |  1320  | 
|  1322       case IME_CANCELCOMPOSITION: |  1321       case IME_CANCELCOMPOSITION: | 
|  1323         view()->OnImeSetComposition( |  1322         view()->OnImeSetComposition( | 
|  1324             base::string16(), |  1323             base::string16(), | 
|  1325             std::vector<blink::WebCompositionUnderline>(), |  1324             std::vector<blink::WebCompositionUnderline>(), | 
|  1326             gfx::Range::InvalidRange(), |  1325             gfx::Range::InvalidRange(), | 
|  1327             0, 0); |  1326             0, 0); | 
|  1328         break; |  1327         break; | 
|  1329     } |  1328     } | 
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1565  |  1564  | 
|  1566   // ASCII composition |  1565   // ASCII composition | 
|  1567   const base::string16 ascii_composition = base::UTF8ToUTF16("aiueo"); |  1566   const base::string16 ascii_composition = base::UTF8ToUTF16("aiueo"); | 
|  1568   view()->OnImeSetComposition(ascii_composition, empty_underline, |  1567   view()->OnImeSetComposition(ascii_composition, empty_underline, | 
|  1569                               gfx::Range::InvalidRange(), 0, 0); |  1568                               gfx::Range::InvalidRange(), 0, 0); | 
|  1570   view()->GetCompositionCharacterBounds(&bounds); |  1569   view()->GetCompositionCharacterBounds(&bounds); | 
|  1571   ASSERT_EQ(ascii_composition.size(), bounds.size()); |  1570   ASSERT_EQ(ascii_composition.size(), bounds.size()); | 
|  1572  |  1571  | 
|  1573   for (size_t i = 0; i < bounds.size(); ++i) |  1572   for (size_t i = 0; i < bounds.size(); ++i) | 
|  1574     EXPECT_LT(0, bounds[i].width()); |  1573     EXPECT_LT(0, bounds[i].width()); | 
|  1575   view()->OnImeConfirmComposition( |  1574   view()->OnImeConfirmComposition(empty_string, gfx::Range::InvalidRange(), | 
|  1576       empty_string, gfx::Range::InvalidRange(), false); |  1575                                   false, 1); | 
|  1577  |  1576  | 
|  1578   // Non surrogate pair unicode character. |  1577   // Non surrogate pair unicode character. | 
|  1579   const base::string16 unicode_composition = base::UTF8ToUTF16( |  1578   const base::string16 unicode_composition = base::UTF8ToUTF16( | 
|  1580       "\xE3\x81\x82\xE3\x81\x84\xE3\x81\x86\xE3\x81\x88\xE3\x81\x8A"); |  1579       "\xE3\x81\x82\xE3\x81\x84\xE3\x81\x86\xE3\x81\x88\xE3\x81\x8A"); | 
|  1581   view()->OnImeSetComposition(unicode_composition, empty_underline, |  1580   view()->OnImeSetComposition(unicode_composition, empty_underline, | 
|  1582                               gfx::Range::InvalidRange(), 0, 0); |  1581                               gfx::Range::InvalidRange(), 0, 0); | 
|  1583   view()->GetCompositionCharacterBounds(&bounds); |  1582   view()->GetCompositionCharacterBounds(&bounds); | 
|  1584   ASSERT_EQ(unicode_composition.size(), bounds.size()); |  1583   ASSERT_EQ(unicode_composition.size(), bounds.size()); | 
|  1585   for (size_t i = 0; i < bounds.size(); ++i) |  1584   for (size_t i = 0; i < bounds.size(); ++i) | 
|  1586     EXPECT_LT(0, bounds[i].width()); |  1585     EXPECT_LT(0, bounds[i].width()); | 
|  1587   view()->OnImeConfirmComposition( |  1586   view()->OnImeConfirmComposition(empty_string, gfx::Range::InvalidRange(), | 
|  1588       empty_string, gfx::Range::InvalidRange(), false); |  1587                                   false, 1); | 
|  1589  |  1588  | 
|  1590   // Surrogate pair character. |  1589   // Surrogate pair character. | 
|  1591   const base::string16 surrogate_pair_char = |  1590   const base::string16 surrogate_pair_char = | 
|  1592       base::UTF8ToUTF16("\xF0\xA0\xAE\x9F"); |  1591       base::UTF8ToUTF16("\xF0\xA0\xAE\x9F"); | 
|  1593   view()->OnImeSetComposition(surrogate_pair_char, |  1592   view()->OnImeSetComposition(surrogate_pair_char, | 
|  1594                               empty_underline, |  1593                               empty_underline, | 
|  1595                               gfx::Range::InvalidRange(), |  1594                               gfx::Range::InvalidRange(), | 
|  1596                               0, |  1595                               0, | 
|  1597                               0); |  1596                               0); | 
|  1598   view()->GetCompositionCharacterBounds(&bounds); |  1597   view()->GetCompositionCharacterBounds(&bounds); | 
|  1599   ASSERT_EQ(surrogate_pair_char.size(), bounds.size()); |  1598   ASSERT_EQ(surrogate_pair_char.size(), bounds.size()); | 
|  1600   EXPECT_LT(0, bounds[0].width()); |  1599   EXPECT_LT(0, bounds[0].width()); | 
|  1601   EXPECT_EQ(0, bounds[1].width()); |  1600   EXPECT_EQ(0, bounds[1].width()); | 
|  1602   view()->OnImeConfirmComposition( |  1601   view()->OnImeConfirmComposition(empty_string, gfx::Range::InvalidRange(), | 
|  1603       empty_string, gfx::Range::InvalidRange(), false); |  1602                                   false, 1); | 
|  1604  |  1603  | 
|  1605   // Mixed string. |  1604   // Mixed string. | 
|  1606   const base::string16 surrogate_pair_mixed_composition = |  1605   const base::string16 surrogate_pair_mixed_composition = | 
|  1607       surrogate_pair_char + base::UTF8ToUTF16("\xE3\x81\x82") + |  1606       surrogate_pair_char + base::UTF8ToUTF16("\xE3\x81\x82") + | 
|  1608       surrogate_pair_char + base::UTF8ToUTF16("b") + surrogate_pair_char; |  1607       surrogate_pair_char + base::UTF8ToUTF16("b") + surrogate_pair_char; | 
|  1609   const size_t utf16_length = 8UL; |  1608   const size_t utf16_length = 8UL; | 
|  1610   const bool is_surrogate_pair_empty_rect[8] = { |  1609   const bool is_surrogate_pair_empty_rect[8] = { | 
|  1611     false, true, false, false, true, false, false, true }; |  1610     false, true, false, false, true, false, false, true }; | 
|  1612   view()->OnImeSetComposition(surrogate_pair_mixed_composition, |  1611   view()->OnImeSetComposition(surrogate_pair_mixed_composition, | 
|  1613                               empty_underline, |  1612                               empty_underline, | 
|  1614                               gfx::Range::InvalidRange(), |  1613                               gfx::Range::InvalidRange(), | 
|  1615                               0, |  1614                               0, | 
|  1616                               0); |  1615                               0); | 
|  1617   view()->GetCompositionCharacterBounds(&bounds); |  1616   view()->GetCompositionCharacterBounds(&bounds); | 
|  1618   ASSERT_EQ(utf16_length, bounds.size()); |  1617   ASSERT_EQ(utf16_length, bounds.size()); | 
|  1619   for (size_t i = 0; i < utf16_length; ++i) { |  1618   for (size_t i = 0; i < utf16_length; ++i) { | 
|  1620     if (is_surrogate_pair_empty_rect[i]) { |  1619     if (is_surrogate_pair_empty_rect[i]) { | 
|  1621       EXPECT_EQ(0, bounds[i].width()); |  1620       EXPECT_EQ(0, bounds[i].width()); | 
|  1622     } else { |  1621     } else { | 
|  1623       EXPECT_LT(0, bounds[i].width()); |  1622       EXPECT_LT(0, bounds[i].width()); | 
|  1624     } |  1623     } | 
|  1625   } |  1624   } | 
|  1626   view()->OnImeConfirmComposition( |  1625   view()->OnImeConfirmComposition(empty_string, gfx::Range::InvalidRange(), | 
|  1627       empty_string, gfx::Range::InvalidRange(), false); |  1626                                   false, 1); | 
|  1628 } |  1627 } | 
|  1629 #endif |  1628 #endif | 
|  1630  |  1629  | 
|  1631 TEST_F(RenderViewImplTest, ZoomLimit) { |  1630 TEST_F(RenderViewImplTest, ZoomLimit) { | 
|  1632   const double kMinZoomLevel = ZoomFactorToZoomLevel(kMinimumZoomFactor); |  1631   const double kMinZoomLevel = ZoomFactorToZoomLevel(kMinimumZoomFactor); | 
|  1633   const double kMaxZoomLevel = ZoomFactorToZoomLevel(kMaximumZoomFactor); |  1632   const double kMaxZoomLevel = ZoomFactorToZoomLevel(kMaximumZoomFactor); | 
|  1634  |  1633  | 
|  1635   // Verifies navigation to a URL with preset zoom level indeed sets the level. |  1634   // Verifies navigation to a URL with preset zoom level indeed sets the level. | 
|  1636   // Regression test for http://crbug.com/139559, where the level was not |  1635   // Regression test for http://crbug.com/139559, where the level was not | 
|  1637   // properly set when it is out of the default zoom limits of WebView. |  1636   // properly set when it is out of the default zoom limits of WebView. | 
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2480   ExpectPauseAndResume(3); |  2479   ExpectPauseAndResume(3); | 
|  2481   blink::WebScriptSource source2( |  2480   blink::WebScriptSource source2( | 
|  2482       WebString::fromUTF8("function func2() { func1(); }; func2();")); |  2481       WebString::fromUTF8("function func2() { func1(); }; func2();")); | 
|  2483   frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1); |  2482   frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1); | 
|  2484  |  2483  | 
|  2485   EXPECT_FALSE(IsPaused()); |  2484   EXPECT_FALSE(IsPaused()); | 
|  2486   Detach(); |  2485   Detach(); | 
|  2487 } |  2486 } | 
|  2488  |  2487  | 
|  2489 }  // namespace content |  2488 }  // namespace content | 
| OLD | NEW |