Update OSR code

This commit is contained in:
Heilig Benedek 2018-05-15 03:59:22 +02:00 committed by Samuel Attard
parent 91d16c9b3a
commit 65b8dd48d8
12 changed files with 187 additions and 182 deletions

View file

@ -209,9 +209,13 @@ void AutofillPopup::UpdatePopupBounds() {
popup_bounds_ =
gfx::Rect(popup_x_and_width.first, popup_y_and_height.first,
popup_x_and_width.second, popup_y_and_height.second);
popup_bounds_in_view_ =
gfx::Rect(popup_bounds_in_view_.origin(),
gfx::Size(popup_x_and_width.second, popup_y_and_height.second));
}
gfx::Rect AutofillPopup::popup_bounds_in_view() {
gfx::Point origin(popup_bounds_.origin());
views::View::ConvertPointFromScreen(parent_, &origin);
return gfx::Rect(origin, popup_bounds_.size());
}
void AutofillPopup::OnViewBoundsChanged(views::View* view) {

View file

@ -34,6 +34,8 @@ class AutofillPopup : public views::ViewObserver {
const std::vector<base::string16>& labels);
void UpdatePopupBounds();
gfx::Rect popup_bounds_in_view();
private:
friend class AutofillPopupView;
@ -59,7 +61,6 @@ class AutofillPopup : public views::ViewObserver {
// Popup location
gfx::Rect popup_bounds_;
gfx::Rect popup_bounds_in_view_;
// Bounds of the autofilled element
gfx::Rect element_bounds_;

View file

@ -223,6 +223,11 @@ void AutofillPopupView::DoUpdateBoundsAndRedrawPopup() {
return;
GetWidget()->SetBounds(popup_->popup_bounds_);
#if defined(ENABLE_OSR)
if (view_proxy_.get()) {
view_proxy_->SetBounds(popup_->popup_bounds_in_view());
}
#endif
SchedulePaint();
}
@ -235,8 +240,8 @@ void AutofillPopupView::OnPaint(gfx::Canvas* canvas) {
#if defined(ENABLE_OSR)
std::unique_ptr<cc::SkiaPaintCanvas> paint_canvas;
if (view_proxy_.get()) {
bitmap.allocN32Pixels(popup_->popup_bounds_in_view_.width(),
popup_->popup_bounds_in_view_.height(), true);
bitmap.allocN32Pixels(popup_->popup_bounds_in_view().width(),
popup_->popup_bounds_in_view().height(), true);
paint_canvas.reset(new cc::SkiaPaintCanvas(bitmap));
draw_canvas = new gfx::Canvas(paint_canvas.get(), 1.0);
}
@ -254,7 +259,7 @@ void AutofillPopupView::OnPaint(gfx::Canvas* canvas) {
#if defined(ENABLE_OSR)
if (view_proxy_.get()) {
view_proxy_->SetBounds(popup_->popup_bounds_in_view_);
view_proxy_->SetBounds(popup_->popup_bounds_in_view());
view_proxy_->SetBitmap(bitmap);
}
#endif