Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: components/autofill/content/renderer/autofill_agent.cc

Issue 1463723003: Return VisualViewport coords in boundsInViewportSpace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/autofill/content/renderer/autofill_agent.h" 5 #include "components/autofill/content/renderer/autofill_agent.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/case_conversion.h" 10 #include "base/i18n/case_conversion.h"
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 FormFieldData field; 722 FormFieldData field;
723 if (!form_util::FindFormAndFieldForFormControlElement(element, &form, 723 if (!form_util::FindFormAndFieldForFormControlElement(element, &form,
724 &field)) { 724 &field)) {
725 // If we didn't find the cached form, at least let autocomplete have a shot 725 // If we didn't find the cached form, at least let autocomplete have a shot
726 // at providing suggestions. 726 // at providing suggestions.
727 WebFormControlElementToFormField(element, form_util::EXTRACT_VALUE, &field); 727 WebFormControlElementToFormField(element, form_util::EXTRACT_VALUE, &field);
728 } 728 }
729 if (datalist_only) 729 if (datalist_only)
730 field.should_autocomplete = false; 730 field.should_autocomplete = false;
731 731
732 gfx::RectF bounding_box_scaled = form_util::GetScaledBoundingBox(
733 render_frame()->GetRenderView()->GetWebView()->pageScaleFactor(),
734 &element_);
735
736 std::vector<base::string16> data_list_values; 732 std::vector<base::string16> data_list_values;
737 std::vector<base::string16> data_list_labels; 733 std::vector<base::string16> data_list_labels;
738 const WebInputElement* input_element = toWebInputElement(&element); 734 const WebInputElement* input_element = toWebInputElement(&element);
739 if (input_element) { 735 if (input_element) {
740 // Find the datalist values and send them to the browser process. 736 // Find the datalist values and send them to the browser process.
741 GetDataListSuggestions(*input_element, 737 GetDataListSuggestions(*input_element,
742 datalist_only, 738 datalist_only,
743 &data_list_values, 739 &data_list_values,
744 &data_list_labels); 740 &data_list_labels);
745 TrimStringVectorForIPC(&data_list_values); 741 TrimStringVectorForIPC(&data_list_values);
746 TrimStringVectorForIPC(&data_list_labels); 742 TrimStringVectorForIPC(&data_list_labels);
747 } 743 }
748 744
749 is_popup_possibly_visible_ = true; 745 is_popup_possibly_visible_ = true;
750 Send(new AutofillHostMsg_SetDataList(routing_id(), 746 Send(new AutofillHostMsg_SetDataList(routing_id(),
751 data_list_values, 747 data_list_values,
752 data_list_labels)); 748 data_list_labels));
753 749
750 blink::WebRect bounding_box_in_viewport = element_.boundsInViewport();
vabr (Chromium) 2015/11/24 09:12:27 nit: Why not just inline it below?
oshima 2015/11/24 23:42:10 Done.
751
754 Send(new AutofillHostMsg_QueryFormFieldAutofill( 752 Send(new AutofillHostMsg_QueryFormFieldAutofill(
755 routing_id(), autofill_query_id_, form, field, bounding_box_scaled)); 753 routing_id(), autofill_query_id_, form, field,
754 gfx::RectF(bounding_box_in_viewport)));
756 } 755 }
757 756
758 void AutofillAgent::FillFieldWithValue(const base::string16& value, 757 void AutofillAgent::FillFieldWithValue(const base::string16& value,
759 WebInputElement* node) { 758 WebInputElement* node) {
760 base::AutoReset<bool> auto_reset(&ignore_text_changes_, true); 759 base::AutoReset<bool> auto_reset(&ignore_text_changes_, true);
761 node->setEditingValue(value.substr(0, node->maxLength())); 760 node->setEditingValue(value.substr(0, node->maxLength()));
762 } 761 }
763 762
764 void AutofillAgent::PreviewFieldWithValue(const base::string16& value, 763 void AutofillAgent::PreviewFieldWithValue(const base::string16& value,
765 WebInputElement* node) { 764 WebInputElement* node) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 830
832 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { 831 void AutofillAgent::LegacyAutofillAgent::OnDestruct() {
833 // No-op. Don't delete |this|. 832 // No-op. Don't delete |this|.
834 } 833 }
835 834
836 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { 835 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() {
837 agent_->FocusChangeComplete(); 836 agent_->FocusChangeComplete();
838 } 837 }
839 838
840 } // namespace autofill 839 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698