diff options
author | Andras Becsi <andras.becsi@digia.com> | 2013-12-11 21:33:03 +0100 |
---|---|---|
committer | Andras Becsi <andras.becsi@digia.com> | 2013-12-13 12:34:07 +0100 |
commit | f2a33ff9cbc6d19943f1c7fbddd1f23d23975577 (patch) | |
tree | 0586a32aa390ade8557dfd6b4897f43a07449578 /chromium/ui/views/view.cc | |
parent | 5362912cdb5eea702b68ebe23702468d17c3017a (diff) | |
download | qtwebengine-chromium-f2a33ff9cbc6d19943f1c7fbddd1f23d23975577.tar.gz |
Update Chromium to branch 1650 (31.0.1650.63)
Change-Id: I57d8c832eaec1eb2364e0a8e7352a6dd354db99f
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'chromium/ui/views/view.cc')
-rw-r--r-- | chromium/ui/views/view.cc | 65 |
1 files changed, 27 insertions, 38 deletions
diff --git a/chromium/ui/views/view.cc b/chromium/ui/views/view.cc index 080df12881d..d816a0a16d0 100644 --- a/chromium/ui/views/view.cc +++ b/chromium/ui/views/view.cc @@ -43,6 +43,10 @@ #include "ui/views/widget/tooltip_manager.h" #include "ui/views/widget/widget.h" +#if defined(USE_AURA) +#include "ui/base/cursor/cursor.h" +#endif + #if defined(OS_WIN) #include "base/win/scoped_gdi_object.h" #endif @@ -176,7 +180,6 @@ View::View() focus_border_(FocusBorder::CreateDashedFocusBorder()), flip_canvas_on_paint_for_rtl_ui_(false), paint_to_layer_(false), - accelerator_registration_delayed_(false), accelerator_focus_manager_(NULL), registered_accelerator_count_(0), next_focusable_view_(NULL), @@ -1299,21 +1302,13 @@ void View::ViewHierarchyChanged(const ViewHierarchyChangedDetails& details) { void View::VisibilityChanged(View* starting_from, bool is_visible) { } -void View::NativeViewHierarchyChanged(bool attached, - gfx::NativeView native_view, - internal::RootView* root_view) { +void View::NativeViewHierarchyChanged() { FocusManager* focus_manager = GetFocusManager(); - if (!accelerator_registration_delayed_ && - accelerator_focus_manager_ && - accelerator_focus_manager_ != focus_manager) { + if (accelerator_focus_manager_ != focus_manager) { UnregisterAccelerators(true); - accelerator_registration_delayed_ = true; - } - if (accelerator_registration_delayed_ && attached) { - if (focus_manager) { + + if (focus_manager) RegisterPendingAccelerators(); - accelerator_registration_delayed_ = false; - } } } @@ -1815,14 +1810,10 @@ void View::PropagateAddNotifications( ViewHierarchyChangedImpl(true, details); } -void View::PropagateNativeViewHierarchyChanged(bool attached, - gfx::NativeView native_view, - internal::RootView* root_view) { +void View::PropagateNativeViewHierarchyChanged() { for (int i = 0, count = child_count(); i < count; ++i) - child_at(i)->PropagateNativeViewHierarchyChanged(attached, - native_view, - root_view); - NativeViewHierarchyChanged(attached, native_view, root_view); + child_at(i)->PropagateNativeViewHierarchyChanged(); + NativeViewHierarchyChanged(); } void View::ViewHierarchyChangedImpl( @@ -1832,13 +1823,8 @@ void View::ViewHierarchyChangedImpl( if (details.is_add) { // If you get this registration, you are part of a subtree that has been // added to the view hierarchy. - if (GetFocusManager()) { + if (GetFocusManager()) RegisterPendingAccelerators(); - } else { - // Delay accelerator registration until visible as we do not have - // focus manager until then. - accelerator_registration_delayed_ = true; - } } else { if (details.child == this) UnregisterAccelerators(true); @@ -1851,7 +1837,7 @@ void View::ViewHierarchyChangedImpl( if (widget) widget->UpdateRootLayers(); } else if (!details.is_add && details.child == this) { - // Make sure the layers beloning to the subtree rooted at |child| get + // Make sure the layers belonging to the subtree rooted at |child| get // removed from layers that do not belong in the same subtree. OrphanLayers(); if (use_acceleration_when_possible) { @@ -2017,7 +2003,7 @@ bool View::ConvertPointForAncestor(const View* ancestor, // TODO(sad): Have some way of caching the transformation results. bool result = GetTransformRelativeTo(ancestor, &trans); gfx::Point3F p(*point); - trans.TransformPoint(p); + trans.TransformPoint(&p); *point = gfx::ToFlooredPoint(p.AsPointF()); return result; } @@ -2027,7 +2013,7 @@ bool View::ConvertPointFromAncestor(const View* ancestor, gfx::Transform trans; bool result = GetTransformRelativeTo(ancestor, &trans); gfx::Point3F p(*point); - trans.TransformPointReverse(p); + trans.TransformPointReverse(&p); *point = gfx::ToFlooredPoint(p.AsPointF()); return result; } @@ -2229,9 +2215,6 @@ void View::UnregisterAccelerators(bool leave_data_intact) { if (GetWidget()) { if (accelerator_focus_manager_) { - // We may not have a FocusManager if the window containing us is being - // closed, in which case the FocusManager is being deleted so there is - // nothing to unregister. accelerator_focus_manager_->UnregisterAccelerators(this); accelerator_focus_manager_ = NULL; } @@ -2317,11 +2300,20 @@ void View::UpdateTooltip() { bool View::DoDrag(const ui::LocatedEvent& event, const gfx::Point& press_pt, ui::DragDropTypes::DragEventSource source) { -#if !defined(OS_MACOSX) int drag_operations = GetDragOperations(press_pt); if (drag_operations == ui::DragDropTypes::DRAG_NONE) return false; + Widget* widget = GetWidget(); + // We should only start a drag from an event, implying we have a widget. + DCHECK(widget); + + // Don't attempt to start a drag while in the process of dragging. This is + // especially important on X where we can get multiple mouse move events when + // we start the drag. + if (widget->dragged_view()) + return false; + OSExchangeData data; WriteDragData(press_pt, &data); @@ -2329,12 +2321,9 @@ bool View::DoDrag(const ui::LocatedEvent& event, // the RootView can detect it and avoid calling us back. gfx::Point widget_location(event.location()); ConvertPointToWidget(this, &widget_location); - GetWidget()->RunShellDrag(this, data, widget_location, drag_operations, - source); + widget->RunShellDrag(this, data, widget_location, drag_operations, source); + // WARNING: we may have been deleted. return true; -#else - return false; -#endif // !defined(OS_MACOSX) } } // namespace views |