Index: components/autofill/content/browser/content_autofill_driver.cc |
diff --git a/components/autofill/content/browser/content_autofill_driver.cc b/components/autofill/content/browser/content_autofill_driver.cc |
index 2449d6c69d0911e6e357dbeaad10f209b1347bc9..8eb8de071aecbdb8444f5b52908e1f4cdf69cacb 100644 |
--- a/components/autofill/content/browser/content_autofill_driver.cc |
+++ b/components/autofill/content/browser/content_autofill_driver.cc |
@@ -159,15 +159,15 @@ void ContentAutofillDriver::PopupHidden() { |
gfx::RectF ContentAutofillDriver::TransformBoundingBoxToViewportCoordinates( |
const gfx::RectF& bounding_box) { |
+ content::RenderWidgetHostView* view = render_frame_host_->GetView(); |
+ if (!view) |
+ return bounding_box; |
+ |
gfx::Point orig_point(bounding_box.x(), bounding_box.y()); |
- gfx::Point transformed_point; |
- transformed_point = |
- render_frame_host_->GetView()->TransformPointToRootCoordSpace(orig_point); |
- |
- gfx::RectF new_box; |
- new_box.SetRect(transformed_point.x(), transformed_point.y(), |
- bounding_box.width(), bounding_box.height()); |
- return new_box; |
+ gfx::Point transformed_point = |
+ view->TransformPointToRootCoordSpace(orig_point); |
+ return gfx::RectF(transformed_point.x(), transformed_point.y(), |
+ bounding_box.width(), bounding_box.height()); |
} |
void ContentAutofillDriver::DidInteractWithCreditCardForm() { |