| 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 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1752 delegate_->GetInputEventRouter()->OnHittestData(params); | 1752 delegate_->GetInputEventRouter()->OnHittestData(params); |
| 1753 } | 1753 } |
| 1754 | 1754 |
| 1755 void RenderWidgetHostImpl::OnClose() { | 1755 void RenderWidgetHostImpl::OnClose() { |
| 1756 ShutdownAndDestroyWidget(true); | 1756 ShutdownAndDestroyWidget(true); |
| 1757 } | 1757 } |
| 1758 | 1758 |
| 1759 void RenderWidgetHostImpl::OnSetTooltipText( | 1759 void RenderWidgetHostImpl::OnSetTooltipText( |
| 1760 const base::string16& tooltip_text, | 1760 const base::string16& tooltip_text, |
| 1761 WebTextDirection text_direction_hint) { | 1761 WebTextDirection text_direction_hint) { |
| 1762 if (!GetView()) |
| 1763 return; |
| 1764 |
| 1762 // First, add directionality marks around tooltip text if necessary. | 1765 // First, add directionality marks around tooltip text if necessary. |
| 1763 // A naive solution would be to simply always wrap the text. However, on | 1766 // A naive solution would be to simply always wrap the text. However, on |
| 1764 // windows, Unicode directional embedding characters can't be displayed on | 1767 // windows, Unicode directional embedding characters can't be displayed on |
| 1765 // systems that lack RTL fonts and are instead displayed as empty squares. | 1768 // systems that lack RTL fonts and are instead displayed as empty squares. |
| 1766 // | 1769 // |
| 1767 // To get around this we only wrap the string when we deem it necessary i.e. | 1770 // To get around this we only wrap the string when we deem it necessary i.e. |
| 1768 // when the locale direction is different than the tooltip direction hint. | 1771 // when the locale direction is different than the tooltip direction hint. |
| 1769 // | 1772 // |
| 1770 // Currently, we use element's directionality as the tooltip direction hint. | 1773 // Currently, we use element's directionality as the tooltip direction hint. |
| 1771 // An alternate solution would be to set the overall directionality based on | 1774 // An alternate solution would be to set the overall directionality based on |
| 1772 // trying to detect the directionality from the tooltip text rather than the | 1775 // trying to detect the directionality from the tooltip text rather than the |
| 1773 // element direction. One could argue that would be a preferable solution | 1776 // element direction. One could argue that would be a preferable solution |
| 1774 // but we use the current approach to match Fx & IE's behavior. | 1777 // but we use the current approach to match Fx & IE's behavior. |
| 1775 base::string16 wrapped_tooltip_text = tooltip_text; | 1778 base::string16 wrapped_tooltip_text = tooltip_text; |
| 1776 if (!tooltip_text.empty()) { | 1779 if (!tooltip_text.empty()) { |
| 1777 if (text_direction_hint == blink::WebTextDirectionLeftToRight) { | 1780 if (text_direction_hint == blink::WebTextDirectionLeftToRight) { |
| 1778 // Force the tooltip to have LTR directionality. | 1781 // Force the tooltip to have LTR directionality. |
| 1779 wrapped_tooltip_text = | 1782 wrapped_tooltip_text = |
| 1780 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_tooltip_text); | 1783 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_tooltip_text); |
| 1781 } else if (text_direction_hint == blink::WebTextDirectionRightToLeft && | 1784 } else if (text_direction_hint == blink::WebTextDirectionRightToLeft && |
| 1782 !base::i18n::IsRTL()) { | 1785 !base::i18n::IsRTL()) { |
| 1783 // Force the tooltip to have RTL directionality. | 1786 // Force the tooltip to have RTL directionality. |
| 1784 base::i18n::WrapStringWithRTLFormatting(&wrapped_tooltip_text); | 1787 base::i18n::WrapStringWithRTLFormatting(&wrapped_tooltip_text); |
| 1785 } | 1788 } |
| 1786 } | 1789 } |
| 1787 if (GetView()) | 1790 view_->SetTooltipText(wrapped_tooltip_text); |
| 1788 view_->SetTooltipText(wrapped_tooltip_text); | |
| 1789 } | 1791 } |
| 1790 | 1792 |
| 1791 void RenderWidgetHostImpl::OnUpdateScreenRectsAck() { | 1793 void RenderWidgetHostImpl::OnUpdateScreenRectsAck() { |
| 1792 waiting_for_screen_rects_ack_ = false; | 1794 waiting_for_screen_rects_ack_ = false; |
| 1793 if (!view_) | 1795 if (!view_) |
| 1794 return; | 1796 return; |
| 1795 | 1797 |
| 1796 if (view_->GetViewBounds() == last_view_screen_rect_ && | 1798 if (view_->GetViewBounds() == last_view_screen_rect_ && |
| 1797 view_->GetBoundsInRootWindow() == last_window_screen_rect_) { | 1799 view_->GetBoundsInRootWindow() == last_window_screen_rect_) { |
| 1798 return; | 1800 return; |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2512 // different from the receiver's. | 2514 // different from the receiver's. |
| 2513 file_system_file.url = | 2515 file_system_file.url = |
| 2514 GURL(storage::GetIsolatedFileSystemRootURIString( | 2516 GURL(storage::GetIsolatedFileSystemRootURIString( |
| 2515 file_system_url.origin(), filesystem_id, std::string()) | 2517 file_system_url.origin(), filesystem_id, std::string()) |
| 2516 .append(register_name)); | 2518 .append(register_name)); |
| 2517 file_system_file.filesystem_id = filesystem_id; | 2519 file_system_file.filesystem_id = filesystem_id; |
| 2518 } | 2520 } |
| 2519 } | 2521 } |
| 2520 | 2522 |
| 2521 } // namespace content | 2523 } // namespace content |
| OLD | NEW |