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_view_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
651 void RenderWidgetHostViewAndroid::SetTooltipText( | 651 void RenderWidgetHostViewAndroid::SetTooltipText( |
652 const base::string16& tooltip_text) { | 652 const base::string16& tooltip_text) { |
653 // Tooltips don't makes sense on Android. | 653 // Tooltips don't makes sense on Android. |
654 } | 654 } |
655 | 655 |
656 void RenderWidgetHostViewAndroid::SelectionChanged(const base::string16& text, | 656 void RenderWidgetHostViewAndroid::SelectionChanged(const base::string16& text, |
657 size_t offset, | 657 size_t offset, |
658 const gfx::Range& range) { | 658 const gfx::Range& range) { |
659 RenderWidgetHostViewBase::SelectionChanged(text, offset, range); | 659 RenderWidgetHostViewBase::SelectionChanged(text, offset, range); |
660 | 660 |
661 if (text.empty() || range.is_empty() || !content_view_core_) | 661 if(!content_view_core_) |
662 return; | |
663 | |
664 if(range.is_empty()) { | |
jdduke (slow)
2014/07/31 14:53:57
There should always be a space between if and the
| |
665 content_view_core_->OnSelectionChanged(""); | |
666 return; | |
667 } | |
668 | |
669 if (text.empty()) | |
jdduke (slow)
2014/07/31 14:53:57
This should be DCHECK(!text.empty()), as the text
| |
662 return; | 670 return; |
663 size_t pos = range.GetMin() - offset; | 671 size_t pos = range.GetMin() - offset; |
664 size_t n = range.length(); | 672 size_t n = range.length(); |
665 | 673 |
666 DCHECK(pos + n <= text.length()) << "The text can not fully cover range."; | 674 DCHECK(pos + n <= text.length()) << "The text can not fully cover range."; |
667 if (pos >= text.length()) { | 675 if (pos >= text.length()) { |
668 NOTREACHED() << "The text can not cover range."; | 676 NOTREACHED() << "The text can not cover range."; |
669 return; | 677 return; |
670 } | 678 } |
671 | 679 |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1641 results->orientationAngle = display.RotationAsDegree(); | 1649 results->orientationAngle = display.RotationAsDegree(); |
1642 results->orientationType = | 1650 results->orientationType = |
1643 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1651 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
1644 gfx::DeviceDisplayInfo info; | 1652 gfx::DeviceDisplayInfo info; |
1645 results->depth = info.GetBitsPerPixel(); | 1653 results->depth = info.GetBitsPerPixel(); |
1646 results->depthPerComponent = info.GetBitsPerComponent(); | 1654 results->depthPerComponent = info.GetBitsPerComponent(); |
1647 results->isMonochrome = (results->depthPerComponent == 0); | 1655 results->isMonochrome = (results->depthPerComponent == 0); |
1648 } | 1656 } |
1649 | 1657 |
1650 } // namespace content | 1658 } // namespace content |
OLD | NEW |