summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkomatsu@chromium.org <komatsu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-21 10:52:03 +0000
committerkomatsu@chromium.org <komatsu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-21 10:52:03 +0000
commit0e69e955a6d364ee96c18068395052cfbc27fdfc (patch)
treea424188c2d13168e340517a12b615d7b63cc34bd
parente56f261b227e7963bb40369ee3c3ca25e20f074f (diff)
downloadchromium_src-0e69e955a6d364ee96c18068395052cfbc27fdfc.zip
chromium_src-0e69e955a6d364ee96c18068395052cfbc27fdfc.tar.gz
chromium_src-0e69e955a6d364ee96c18068395052cfbc27fdfc.tar.bz2
Rename objects refering gfx::Rect from 'location' to 'bounds'
BUG=N/A Review URL: https://codereview.chromium.org/80233002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236488 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc28
-rw-r--r--chrome/browser/chromeos/input_method/candidate_window_controller_impl.h4
-rw-r--r--chrome/browser/chromeos/input_method/candidate_window_view.cc16
-rw-r--r--chrome/browser/chromeos/input_method/candidate_window_view.h24
-rw-r--r--chrome/browser/chromeos/input_method/mode_indicator_controller.cc6
-rw-r--r--chrome/browser/chromeos/input_method/mode_indicator_controller.h4
-rw-r--r--chrome/browser/chromeos/input_method/mode_indicator_widget.cc10
-rw-r--r--chrome/browser/chromeos/input_method/mode_indicator_widget.h7
-rw-r--r--chromeos/ime/ibus_bridge.h6
-rw-r--r--chromeos/ime/mock_ime_candidate_window_handler.cc10
-rw-r--r--chromeos/ime/mock_ime_candidate_window_handler.h10
-rw-r--r--ui/base/ime/input_method_ibus.cc2
-rw-r--r--ui/base/ime/input_method_ibus_unittest.cc10
13 files changed, 67 insertions, 70 deletions
diff --git a/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc b/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc
index 9f49d2a..13564e0 100644
--- a/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc
+++ b/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc
@@ -111,32 +111,32 @@ void CandidateWindowControllerImpl::HidePreeditText() {
candidate_window_view_->HidePreeditText();
}
-void CandidateWindowControllerImpl::SetCursorLocation(
- const ibus::Rect& cursor_location,
+void CandidateWindowControllerImpl::SetCursorBounds(
+ const ibus::Rect& cursor_bounds,
const ibus::Rect& composition_head) {
// A workaround for http://crosbug.com/6460. We should ignore very short Y
// move to prevent the window from shaking up and down.
const int kKeepPositionThreshold = 2; // px
- const gfx::Rect& last_location =
- candidate_window_view_->cursor_location();
- const int delta_y = abs(last_location.y() - cursor_location.y);
- if ((last_location.x() == cursor_location.x) &&
+ const gfx::Rect& last_bounds =
+ candidate_window_view_->cursor_bounds();
+ const int delta_y = abs(last_bounds.y() - cursor_bounds.y);
+ if ((last_bounds.x() == cursor_bounds.x) &&
(delta_y <= kKeepPositionThreshold)) {
- DVLOG(1) << "Ignored set_cursor_location signal to prevent window shake";
+ DVLOG(1) << "Ignored set_cursor_bounds signal to prevent window shake";
return;
}
- const gfx::Rect gfx_cursor_location = IBusRectToGfxRect(cursor_location);
- // Remember the cursor location.
- candidate_window_view_->set_cursor_location(gfx_cursor_location);
- candidate_window_view_->set_composition_head_location(
+ const gfx::Rect gfx_cursor_bounds = IBusRectToGfxRect(cursor_bounds);
+ // Remember the cursor bounds.
+ candidate_window_view_->set_cursor_bounds(gfx_cursor_bounds);
+ candidate_window_view_->set_composition_head_bounds(
IBusRectToGfxRect(composition_head));
- // Move the window per the cursor location.
+ // Move the window per the cursor bounds.
candidate_window_view_->ResizeAndMoveParentFrame();
UpdateInfolistBounds();
- // Mode indicator controller also needs the cursor location.
- mode_indicator_controller_->SetCursorLocation(gfx_cursor_location);
+ // Mode indicator controller also needs the cursor bounds.
+ mode_indicator_controller_->SetCursorBounds(gfx_cursor_bounds);
}
void CandidateWindowControllerImpl::UpdateAuxiliaryText(
diff --git a/chrome/browser/chromeos/input_method/candidate_window_controller_impl.h b/chrome/browser/chromeos/input_method/candidate_window_controller_impl.h
index 70deb44..b918ce2 100644
--- a/chrome/browser/chromeos/input_method/candidate_window_controller_impl.h
+++ b/chrome/browser/chromeos/input_method/candidate_window_controller_impl.h
@@ -83,8 +83,8 @@ class CandidateWindowControllerImpl
virtual void HideAuxiliaryText() OVERRIDE;
virtual void HideLookupTable() OVERRIDE;
virtual void HidePreeditText() OVERRIDE;
- virtual void SetCursorLocation(const ibus::Rect& cursor_position,
- const ibus::Rect& composition_head) OVERRIDE;
+ virtual void SetCursorBounds(const ibus::Rect& cursor_bounds,
+ const ibus::Rect& composition_head) OVERRIDE;
virtual void UpdateAuxiliaryText(const std::string& utf8_text,
bool visible) OVERRIDE;
virtual void UpdateLookupTable(const CandidateWindow& candidate_window,
diff --git a/chrome/browser/chromeos/input_method/candidate_window_view.cc b/chrome/browser/chromeos/input_method/candidate_window_view.cc
index 57db5f2..2fee31e 100644
--- a/chrome/browser/chromeos/input_method/candidate_window_view.cc
+++ b/chrome/browser/chromeos/input_method/candidate_window_view.cc
@@ -965,22 +965,22 @@ void CandidateWindowView::CommitCandidate() {
}
void CandidateWindowView::ResizeAndMoveParentFrame() {
- // If rendering operation comes from mozc-engine, uses mozc specific location,
+ // If rendering operation comes from mozc-engine, uses mozc specific bounds,
// otherwise candidate window is shown under the cursor.
const int x = should_show_at_composition_head_?
- composition_head_location_.x() : cursor_location_.x();
+ composition_head_bounds_.x() : cursor_bounds_.x();
// To avoid candidate-window overlapping, uses maximum y-position of mozc
- // specific location and cursor location, because mozc-engine does not
+ // specific bounds and cursor bounds, because mozc-engine does not
// consider about multi-line composition.
const int y = should_show_at_composition_head_?
- std::max(composition_head_location_.y(), cursor_location_.y()) :
- cursor_location_.y();
- const int height = cursor_location_.height();
+ std::max(composition_head_bounds_.y(), cursor_bounds_.y()) :
+ cursor_bounds_.y();
+ const int height = cursor_bounds_.height();
const int horizontal_offset = GetHorizontalOffset();
gfx::Rect old_bounds = parent_frame_->GetClientAreaBoundsInScreen();
gfx::Rect screen_bounds = ash::Shell::GetScreen()->GetDisplayMatching(
- cursor_location_).work_area();
+ cursor_bounds_).work_area();
// The size.
gfx::Rect frame_bounds = old_bounds;
frame_bounds.set_size(GetPreferredSize());
@@ -1011,7 +1011,7 @@ void CandidateWindowView::ResizeAndMoveParentFrame() {
// TODO(nona): check top_overflow here.
- // Move the window per the cursor location.
+ // Move the window per the cursor bounds.
// SetBounds() is not cheap. Only call this when it is really changed.
if (frame_bounds != old_bounds)
parent_frame_->SetBounds(frame_bounds);
diff --git a/chrome/browser/chromeos/input_method/candidate_window_view.h b/chrome/browser/chromeos/input_method/candidate_window_view.h
index 274cac8..ccd989e 100644
--- a/chrome/browser/chromeos/input_method/candidate_window_view.h
+++ b/chrome/browser/chromeos/input_method/candidate_window_view.h
@@ -126,18 +126,18 @@ class CandidateWindowView : public views::View {
// Returns 0 if no candidate is present.
int GetHorizontalOffset();
- void set_cursor_location(const gfx::Rect& cursor_location) {
- cursor_location_ = cursor_location;
+ void set_cursor_bounds(const gfx::Rect& cursor_bounds) {
+ cursor_bounds_ = cursor_bounds;
}
- void set_composition_head_location(
- const gfx::Rect& composition_head_location) {
- composition_head_location_ = composition_head_location;
+ void set_composition_head_bounds(
+ const gfx::Rect& composition_head_bounds) {
+ composition_head_bounds_ = composition_head_bounds;
}
- const gfx::Rect& cursor_location() const { return cursor_location_; }
- const gfx::Rect& composition_head_location() const {
- return composition_head_location_;
+ const gfx::Rect& cursor_bounds() const { return cursor_bounds_; }
+ const gfx::Rect& composition_head_bounds() const {
+ return composition_head_bounds_;
}
protected:
@@ -205,11 +205,11 @@ class CandidateWindowView : public views::View {
gfx::Size previous_candidate_column_size_;
gfx::Size previous_annotation_column_size_;
- // The last cursor location.
- gfx::Rect cursor_location_;
+ // The last cursor bounds.
+ gfx::Rect cursor_bounds_;
- // The last compostion head location.
- gfx::Rect composition_head_location_;
+ // The last compostion head bounds.
+ gfx::Rect composition_head_bounds_;
// True if the candidate window should be shown with aligning with composition
// text as opposed to the cursor.
diff --git a/chrome/browser/chromeos/input_method/mode_indicator_controller.cc b/chrome/browser/chromeos/input_method/mode_indicator_controller.cc
index b84bcb3..aabb5ab 100644
--- a/chrome/browser/chromeos/input_method/mode_indicator_controller.cc
+++ b/chrome/browser/chromeos/input_method/mode_indicator_controller.cc
@@ -29,9 +29,9 @@ ModeIndicatorController::~ModeIndicatorController() {
imm->RemoveObserver(this);
}
-void ModeIndicatorController::SetCursorLocation(
- const gfx::Rect& cursor_location) {
- mi_widget_->SetCursorLocation(cursor_location);
+void ModeIndicatorController::SetCursorBounds(
+ const gfx::Rect& cursor_bounds) {
+ mi_widget_->SetCursorBounds(cursor_bounds);
}
void ModeIndicatorController::FocusStateChanged(bool is_focused) {
diff --git a/chrome/browser/chromeos/input_method/mode_indicator_controller.h b/chrome/browser/chromeos/input_method/mode_indicator_controller.h
index 4e3420d..0f1e303 100644
--- a/chrome/browser/chromeos/input_method/mode_indicator_controller.h
+++ b/chrome/browser/chromeos/input_method/mode_indicator_controller.h
@@ -26,9 +26,9 @@ class ModeIndicatorController
explicit ModeIndicatorController(ModeIndicatorWidget* mi_widget);
virtual ~ModeIndicatorController();
- // Set cursor location, which is the base point to display this indicator.
+ // Set cursor bounds, which is the base point to display this indicator.
// Bacisally this indicator is displayed underneath the cursor.
- void SetCursorLocation(const gfx::Rect& cursor_location);
+ void SetCursorBounds(const gfx::Rect& cursor_location);
// Notify the focus state to the mode indicator.
void FocusStateChanged(bool is_focused);
diff --git a/chrome/browser/chromeos/input_method/mode_indicator_widget.cc b/chrome/browser/chromeos/input_method/mode_indicator_widget.cc
index 2af9b41..48539f6 100644
--- a/chrome/browser/chromeos/input_method/mode_indicator_widget.cc
+++ b/chrome/browser/chromeos/input_method/mode_indicator_widget.cc
@@ -40,11 +40,11 @@ ModeIndicatorWidget::ModeIndicatorWidget()
ModeIndicatorWidget::~ModeIndicatorWidget() {
}
-void ModeIndicatorWidget::SetCursorLocation(const gfx::Rect& cursor_location) {
- cursor_location_ = cursor_location;
+void ModeIndicatorWidget::SetCursorBounds(const gfx::Rect& cursor_bounds) {
+ cursor_bounds_ = cursor_bounds;
gfx::Rect bound(GetClientAreaBoundsInScreen());
- bound.set_x(cursor_location.x() - bound.width() / 2);
- bound.set_y(cursor_location.bottom());
+ bound.set_x(cursor_bounds.x() - bound.width() / 2);
+ bound.set_y(cursor_bounds.bottom());
SetBounds(bound);
}
@@ -53,7 +53,7 @@ void ModeIndicatorWidget::SetLabelTextUtf8(const std::string& text_utf8) {
mode_view_->SetLabelTextUtf8(text_utf8);
SetSize(mode_view_->size());
- SetCursorLocation(cursor_location_);
+ SetCursorBounds(cursor_bounds_);
}
} // namespace input_method
diff --git a/chrome/browser/chromeos/input_method/mode_indicator_widget.h b/chrome/browser/chromeos/input_method/mode_indicator_widget.h
index 1aeb52f..3fe5418 100644
--- a/chrome/browser/chromeos/input_method/mode_indicator_widget.h
+++ b/chrome/browser/chromeos/input_method/mode_indicator_widget.h
@@ -24,15 +24,12 @@ class ModeIndicatorWidget : public DelayableWidget {
// Set cursor location, which is the base point to display this indicator.
// Bacisally this indicator is displayed underneath the cursor.
- //
- // TODO(komatsu): Rename it to SetCursorBounds.
- void SetCursorLocation(const gfx::Rect& corsor_location);
+ void SetCursorBounds(const gfx::Rect& corsor_bounds);
void SetLabelTextUtf8(const std::string& text_utf8);
private:
ModeIndicatorView* mode_view_;
- // TODO(komatsu): Rename it to cursor_bounds_.
- gfx::Rect cursor_location_;
+ gfx::Rect cursor_bounds_;
DISALLOW_COPY_AND_ASSIGN(ModeIndicatorWidget);
};
diff --git a/chromeos/ime/ibus_bridge.h b/chromeos/ime/ibus_bridge.h
index fc193ea..07439c4 100644
--- a/chromeos/ime/ibus_bridge.h
+++ b/chromeos/ime/ibus_bridge.h
@@ -143,9 +143,9 @@ class CHROMEOS_EXPORT IBusPanelCandidateWindowHandlerInterface {
// Called when the IME hides the preedit text.
virtual void HidePreeditText() = 0;
- // Called when the application changes its caret location.
- virtual void SetCursorLocation(const ibus::Rect& cursor_location,
- const ibus::Rect& composition_head) = 0;
+ // Called when the application changes its caret bounds.
+ virtual void SetCursorBounds(const ibus::Rect& cursor_bounds,
+ const ibus::Rect& composition_head) = 0;
// Called when the text field's focus state is changed.
// |is_focused| is true when the text field gains the focus.
diff --git a/chromeos/ime/mock_ime_candidate_window_handler.cc b/chromeos/ime/mock_ime_candidate_window_handler.cc
index 0e45b01..c2476dd 100644
--- a/chromeos/ime/mock_ime_candidate_window_handler.cc
+++ b/chromeos/ime/mock_ime_candidate_window_handler.cc
@@ -7,7 +7,7 @@
namespace chromeos {
MockIMECandidateWindowHandler::MockIMECandidateWindowHandler()
- : set_cursor_location_call_count_(0),
+ : set_cursor_bounds_call_count_(0),
update_lookup_table_call_count_(0),
update_auxiliary_text_call_count_(0) {
}
@@ -45,14 +45,14 @@ void MockIMECandidateWindowHandler::UpdatePreeditText(const std::string& text,
void MockIMECandidateWindowHandler::HidePreeditText() {
}
-void MockIMECandidateWindowHandler::SetCursorLocation(
- const ibus::Rect& cursor_location,
+void MockIMECandidateWindowHandler::SetCursorBounds(
+ const ibus::Rect& cursor_bounds,
const ibus::Rect& composition_head) {
- ++set_cursor_location_call_count_;
+ ++set_cursor_bounds_call_count_;
}
void MockIMECandidateWindowHandler::Reset() {
- set_cursor_location_call_count_ = 0;
+ set_cursor_bounds_call_count_ = 0;
update_lookup_table_call_count_ = 0;
update_auxiliary_text_call_count_ = 0;
}
diff --git a/chromeos/ime/mock_ime_candidate_window_handler.h b/chromeos/ime/mock_ime_candidate_window_handler.h
index 6ade3bb..9a5ba64 100644
--- a/chromeos/ime/mock_ime_candidate_window_handler.h
+++ b/chromeos/ime/mock_ime_candidate_window_handler.h
@@ -37,11 +37,11 @@ class MockIMECandidateWindowHandler
virtual void UpdatePreeditText(const std::string& text, uint32 cursor_pos,
bool visible) OVERRIDE;
virtual void HidePreeditText() OVERRIDE;
- virtual void SetCursorLocation(const ibus::Rect& cursor_location,
- const ibus::Rect& composition_head) OVERRIDE;
+ virtual void SetCursorBounds(const ibus::Rect& cursor_bounds,
+ const ibus::Rect& composition_head) OVERRIDE;
- int set_cursor_location_call_count() const {
- return set_cursor_location_call_count_;
+ int set_cursor_bounds_call_count() const {
+ return set_cursor_bounds_call_count_;
}
int update_lookup_table_call_count() const {
@@ -64,7 +64,7 @@ class MockIMECandidateWindowHandler
void Reset();
private:
- int set_cursor_location_call_count_;
+ int set_cursor_bounds_call_count_;
int update_lookup_table_call_count_;
int update_auxiliary_text_call_count_;
UpdateLookupTableArg last_update_lookup_table_arg_;
diff --git a/ui/base/ime/input_method_ibus.cc b/ui/base/ime/input_method_ibus.cc
index 9a3a0e8..960f663 100644
--- a/ui/base/ime/input_method_ibus.cc
+++ b/ui/base/ime/input_method_ibus.cc
@@ -846,7 +846,7 @@ void InputMethodIBus::OnCaretBoundsChangedInternal(
chromeos::IBusBridge::Get()->GetCandidateWindowHandler();
if (!candidate_window)
return;
- candidate_window->SetCursorLocation(
+ candidate_window->SetCursorBounds(
GfxRectToIBusRect(rect),
GfxRectToIBusRect(composition_head));
diff --git a/ui/base/ime/input_method_ibus_unittest.cc b/ui/base/ime/input_method_ibus_unittest.cc
index 22722cd..b7c68a7 100644
--- a/ui/base/ime/input_method_ibus_unittest.cc
+++ b/ui/base/ime/input_method_ibus_unittest.cc
@@ -484,7 +484,7 @@ TEST_F(InputMethodIBusTest, FocusIn_Text) {
EXPECT_EQ(1, mock_ime_engine_handler_->focus_in_call_count());
EXPECT_EQ(
1,
- mock_ime_candidate_window_handler_->set_cursor_location_call_count());
+ mock_ime_candidate_window_handler_->set_cursor_bounds_call_count());
// ui::TextInputClient::OnInputMethodChanged() should be called when
// ui::InputMethodIBus connects/disconnects to/from ibus-daemon and the
// current text input type is not NONE.
@@ -567,24 +567,24 @@ TEST_F(InputMethodIBusTest, OnCaretBoundsChanged) {
ime_->Init(true);
EXPECT_EQ(
1,
- mock_ime_candidate_window_handler_->set_cursor_location_call_count());
+ mock_ime_candidate_window_handler_->set_cursor_bounds_call_count());
caret_bounds_ = gfx::Rect(1, 2, 3, 4);
ime_->OnCaretBoundsChanged(this);
EXPECT_EQ(
2,
- mock_ime_candidate_window_handler_->set_cursor_location_call_count());
+ mock_ime_candidate_window_handler_->set_cursor_bounds_call_count());
caret_bounds_ = gfx::Rect(0, 2, 3, 4);
ime_->OnCaretBoundsChanged(this);
EXPECT_EQ(
3,
- mock_ime_candidate_window_handler_->set_cursor_location_call_count());
+ mock_ime_candidate_window_handler_->set_cursor_bounds_call_count());
caret_bounds_ = gfx::Rect(0, 2, 3, 4); // unchanged
ime_->OnCaretBoundsChanged(this);
// Current InputMethodIBus implementation performs the IPC regardless of the
// bounds are changed or not.
EXPECT_EQ(
4,
- mock_ime_candidate_window_handler_->set_cursor_location_call_count());
+ mock_ime_candidate_window_handler_->set_cursor_bounds_call_count());
}
TEST_F(InputMethodIBusTest, ExtractCompositionTextTest_NoAttribute) {