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 "content/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 | 1314 |
1315 void RenderWidgetHostImpl::CandidateWindowUpdated() { | 1315 void RenderWidgetHostImpl::CandidateWindowUpdated() { |
1316 Send(new ViewMsg_CandidateWindowUpdated(GetRoutingID())); | 1316 Send(new ViewMsg_CandidateWindowUpdated(GetRoutingID())); |
1317 } | 1317 } |
1318 | 1318 |
1319 void RenderWidgetHostImpl::CandidateWindowHidden() { | 1319 void RenderWidgetHostImpl::CandidateWindowHidden() { |
1320 Send(new ViewMsg_CandidateWindowHidden(GetRoutingID())); | 1320 Send(new ViewMsg_CandidateWindowHidden(GetRoutingID())); |
1321 } | 1321 } |
1322 | 1322 |
1323 void RenderWidgetHostImpl::ImeSetComposition( | 1323 void RenderWidgetHostImpl::ImeSetComposition( |
1324 const string16& text, | 1324 const base::string16& text, |
1325 const std::vector<blink::WebCompositionUnderline>& underlines, | 1325 const std::vector<blink::WebCompositionUnderline>& underlines, |
1326 int selection_start, | 1326 int selection_start, |
1327 int selection_end) { | 1327 int selection_end) { |
1328 Send(new ViewMsg_ImeSetComposition( | 1328 Send(new ViewMsg_ImeSetComposition( |
1329 GetRoutingID(), text, underlines, selection_start, selection_end)); | 1329 GetRoutingID(), text, underlines, selection_start, selection_end)); |
1330 } | 1330 } |
1331 | 1331 |
1332 void RenderWidgetHostImpl::ImeConfirmComposition( | 1332 void RenderWidgetHostImpl::ImeConfirmComposition( |
1333 const string16& text, | 1333 const base::string16& text, |
1334 const gfx::Range& replacement_range, | 1334 const gfx::Range& replacement_range, |
1335 bool keep_selection) { | 1335 bool keep_selection) { |
1336 Send(new ViewMsg_ImeConfirmComposition( | 1336 Send(new ViewMsg_ImeConfirmComposition( |
1337 GetRoutingID(), text, replacement_range, keep_selection)); | 1337 GetRoutingID(), text, replacement_range, keep_selection)); |
1338 } | 1338 } |
1339 | 1339 |
1340 void RenderWidgetHostImpl::ImeCancelComposition() { | 1340 void RenderWidgetHostImpl::ImeCancelComposition() { |
1341 Send(new ViewMsg_ImeSetComposition(GetRoutingID(), string16(), | 1341 Send(new ViewMsg_ImeSetComposition(GetRoutingID(), base::string16(), |
1342 std::vector<blink::WebCompositionUnderline>(), 0, 0)); | 1342 std::vector<blink::WebCompositionUnderline>(), 0, 0)); |
1343 } | 1343 } |
1344 | 1344 |
1345 void RenderWidgetHostImpl::ExtendSelectionAndDelete( | 1345 void RenderWidgetHostImpl::ExtendSelectionAndDelete( |
1346 size_t before, | 1346 size_t before, |
1347 size_t after) { | 1347 size_t after) { |
1348 Send(new ViewMsg_ExtendSelectionAndDelete(GetRoutingID(), before, after)); | 1348 Send(new ViewMsg_ExtendSelectionAndDelete(GetRoutingID(), before, after)); |
1349 } | 1349 } |
1350 | 1350 |
1351 gfx::Rect RenderWidgetHostImpl::GetRootWindowResizerRect() const { | 1351 gfx::Rect RenderWidgetHostImpl::GetRootWindowResizerRect() const { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1435 // Is that really what we want in response to this message? I'm matching | 1435 // Is that really what we want in response to this message? I'm matching |
1436 // previous behavior of the code here. | 1436 // previous behavior of the code here. |
1437 Destroy(); | 1437 Destroy(); |
1438 } | 1438 } |
1439 | 1439 |
1440 void RenderWidgetHostImpl::OnClose() { | 1440 void RenderWidgetHostImpl::OnClose() { |
1441 Shutdown(); | 1441 Shutdown(); |
1442 } | 1442 } |
1443 | 1443 |
1444 void RenderWidgetHostImpl::OnSetTooltipText( | 1444 void RenderWidgetHostImpl::OnSetTooltipText( |
1445 const string16& tooltip_text, | 1445 const base::string16& tooltip_text, |
1446 WebTextDirection text_direction_hint) { | 1446 WebTextDirection text_direction_hint) { |
1447 // First, add directionality marks around tooltip text if necessary. | 1447 // First, add directionality marks around tooltip text if necessary. |
1448 // A naive solution would be to simply always wrap the text. However, on | 1448 // A naive solution would be to simply always wrap the text. However, on |
1449 // windows, Unicode directional embedding characters can't be displayed on | 1449 // windows, Unicode directional embedding characters can't be displayed on |
1450 // systems that lack RTL fonts and are instead displayed as empty squares. | 1450 // systems that lack RTL fonts and are instead displayed as empty squares. |
1451 // | 1451 // |
1452 // To get around this we only wrap the string when we deem it necessary i.e. | 1452 // To get around this we only wrap the string when we deem it necessary i.e. |
1453 // when the locale direction is different than the tooltip direction hint. | 1453 // when the locale direction is different than the tooltip direction hint. |
1454 // | 1454 // |
1455 // Currently, we use element's directionality as the tooltip direction hint. | 1455 // Currently, we use element's directionality as the tooltip direction hint. |
1456 // An alternate solution would be to set the overall directionality based on | 1456 // An alternate solution would be to set the overall directionality based on |
1457 // trying to detect the directionality from the tooltip text rather than the | 1457 // trying to detect the directionality from the tooltip text rather than the |
1458 // element direction. One could argue that would be a preferable solution | 1458 // element direction. One could argue that would be a preferable solution |
1459 // but we use the current approach to match Fx & IE's behavior. | 1459 // but we use the current approach to match Fx & IE's behavior. |
1460 string16 wrapped_tooltip_text = tooltip_text; | 1460 base::string16 wrapped_tooltip_text = tooltip_text; |
1461 if (!tooltip_text.empty()) { | 1461 if (!tooltip_text.empty()) { |
1462 if (text_direction_hint == blink::WebTextDirectionLeftToRight) { | 1462 if (text_direction_hint == blink::WebTextDirectionLeftToRight) { |
1463 // Force the tooltip to have LTR directionality. | 1463 // Force the tooltip to have LTR directionality. |
1464 wrapped_tooltip_text = | 1464 wrapped_tooltip_text = |
1465 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_tooltip_text); | 1465 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_tooltip_text); |
1466 } else if (text_direction_hint == blink::WebTextDirectionRightToLeft && | 1466 } else if (text_direction_hint == blink::WebTextDirectionRightToLeft && |
1467 !base::i18n::IsRTL()) { | 1467 !base::i18n::IsRTL()) { |
1468 // Force the tooltip to have RTL directionality. | 1468 // Force the tooltip to have RTL directionality. |
1469 base::i18n::WrapStringWithRTLFormatting(&wrapped_tooltip_text); | 1469 base::i18n::WrapStringWithRTLFormatting(&wrapped_tooltip_text); |
1470 } | 1470 } |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1928 | 1928 |
1929 // TODO(darin): do we need to do something else if our backing store is not | 1929 // TODO(darin): do we need to do something else if our backing store is not |
1930 // the same size as the advertised view? maybe we just assume there is a | 1930 // the same size as the advertised view? maybe we just assume there is a |
1931 // full paint on its way? | 1931 // full paint on its way? |
1932 BackingStore* backing_store = BackingStoreManager::Lookup(this); | 1932 BackingStore* backing_store = BackingStoreManager::Lookup(this); |
1933 if (!backing_store || (backing_store->size() != view_size)) | 1933 if (!backing_store || (backing_store->size() != view_size)) |
1934 return; | 1934 return; |
1935 backing_store->ScrollBackingStore(delta, clip_rect, view_size); | 1935 backing_store->ScrollBackingStore(delta, clip_rect, view_size); |
1936 } | 1936 } |
1937 | 1937 |
1938 void RenderWidgetHostImpl::Replace(const string16& word) { | 1938 void RenderWidgetHostImpl::Replace(const base::string16& word) { |
1939 Send(new InputMsg_Replace(routing_id_, word)); | 1939 Send(new InputMsg_Replace(routing_id_, word)); |
1940 } | 1940 } |
1941 | 1941 |
1942 void RenderWidgetHostImpl::ReplaceMisspelling(const string16& word) { | 1942 void RenderWidgetHostImpl::ReplaceMisspelling(const base::string16& word) { |
1943 Send(new InputMsg_ReplaceMisspelling(routing_id_, word)); | 1943 Send(new InputMsg_ReplaceMisspelling(routing_id_, word)); |
1944 } | 1944 } |
1945 | 1945 |
1946 void RenderWidgetHostImpl::SetIgnoreInputEvents(bool ignore_input_events) { | 1946 void RenderWidgetHostImpl::SetIgnoreInputEvents(bool ignore_input_events) { |
1947 ignore_input_events_ = ignore_input_events; | 1947 ignore_input_events_ = ignore_input_events; |
1948 } | 1948 } |
1949 | 1949 |
1950 bool RenderWidgetHostImpl::KeyPressListenersHandleEvent( | 1950 bool RenderWidgetHostImpl::KeyPressListenersHandleEvent( |
1951 const NativeWebKeyboardEvent& event) { | 1951 const NativeWebKeyboardEvent& event) { |
1952 if (event.skip_in_browser || event.type != WebKeyboardEvent::RawKeyDown) | 1952 if (event.skip_in_browser || event.type != WebKeyboardEvent::RawKeyDown) |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2494 continue; | 2494 continue; |
2495 } | 2495 } |
2496 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh); | 2496 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh); |
2497 if (rwhi_set.insert(rwhi).second) | 2497 if (rwhi_set.insert(rwhi).second) |
2498 rwhi->FrameSwapped(latency_info); | 2498 rwhi->FrameSwapped(latency_info); |
2499 } | 2499 } |
2500 } | 2500 } |
2501 } | 2501 } |
2502 | 2502 |
2503 } // namespace content | 2503 } // namespace content |
OLD | NEW |