| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
| 9 | 9 |
| 10 #include "base/gfx/gtk_util.h" | 10 #include "base/gfx/gtk_util.h" |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 if (step == GTK_MOVEMENT_PAGES) | 451 if (step == GTK_MOVEMENT_PAGES) |
| 452 move_amount = model_->result().size() * ((count < 0) ? -1 : 1); | 452 move_amount = model_->result().size() * ((count < 0) ? -1 : 1); |
| 453 else if (step != GTK_MOVEMENT_DISPLAY_LINES) | 453 else if (step != GTK_MOVEMENT_DISPLAY_LINES) |
| 454 return; // Propagate into GtkTextView | 454 return; // Propagate into GtkTextView |
| 455 model_->OnUpOrDownKeyPressed(move_amount); | 455 model_->OnUpOrDownKeyPressed(move_amount); |
| 456 // move-cursor doesn't use a signal accumulaqtor on the return value (it | 456 // move-cursor doesn't use a signal accumulaqtor on the return value (it |
| 457 // just ignores then), so we have to stop the propagation. | 457 // just ignores then), so we have to stop the propagation. |
| 458 g_signal_stop_emission_by_name(text_view_, "move-cursor"); | 458 g_signal_stop_emission_by_name(text_view_, "move-cursor"); |
| 459 } | 459 } |
| 460 | 460 |
| 461 gboolean AutocompleteEditViewGtk::HandleViewSizeRequest(GtkRequisition* req) { | 461 void AutocompleteEditViewGtk::HandleViewSizeRequest(GtkRequisition* req) { |
| 462 // Don't force a minimum width, but use the font-relative height. | 462 // Don't force a minimum width, but use the font-relative height. This is a |
| 463 GTK_WIDGET_GET_CLASS(text_view_)->size_request(text_view_, req); | 463 // run-first handler, so the default handler was already called. |
| 464 req->width = 1; | 464 req->width = 1; |
| 465 return TRUE; // We already called the default handler. | |
| 466 } | 465 } |
| 467 | 466 |
| 468 AutocompleteEditViewGtk::CharRange AutocompleteEditViewGtk::GetSelection() { | 467 AutocompleteEditViewGtk::CharRange AutocompleteEditViewGtk::GetSelection() { |
| 469 // You can not just use get_selection_bounds here, since the order will be | 468 // You can not just use get_selection_bounds here, since the order will be |
| 470 // ascending, and you don't know where the user's start and end of the | 469 // ascending, and you don't know where the user's start and end of the |
| 471 // selection was (if the selection was forwards or backwards). Get the | 470 // selection was (if the selection was forwards or backwards). Get the |
| 472 // actual marks so that we can preserve the selection direction. | 471 // actual marks so that we can preserve the selection direction. |
| 473 GtkTextIter start, insert; | 472 GtkTextIter start, insert; |
| 474 GtkTextMark* mark; | 473 GtkTextMark* mark; |
| 475 | 474 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 gtk_text_buffer_apply_tag(text_buffer_, insecure_scheme_tag_, | 540 gtk_text_buffer_apply_tag(text_buffer_, insecure_scheme_tag_, |
| 542 &start, &end); | 541 &start, &end); |
| 543 } | 542 } |
| 544 } | 543 } |
| 545 } | 544 } |
| 546 | 545 |
| 547 void AutocompleteEditViewGtk::TextChanged() { | 546 void AutocompleteEditViewGtk::TextChanged() { |
| 548 EmphasizeURLComponents(); | 547 EmphasizeURLComponents(); |
| 549 controller_->OnChanged(); | 548 controller_->OnChanged(); |
| 550 } | 549 } |
| OLD | NEW |