Chromium Code Reviews| Index: third_party/WebKit/Source/core/input/EventHandler.cpp |
| diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp |
| index da142b18a6aa44c1b289c2f83f829018207d25e2..865ca44f9fc97dfc02edff1e74912f32e0fdd922 100644 |
| --- a/third_party/WebKit/Source/core/input/EventHandler.cpp |
| +++ b/third_party/WebKit/Source/core/input/EventHandler.cpp |
| @@ -118,6 +118,26 @@ bool ShouldRefetchEventTarget(const MouseEventWithHitTestResults& mev) { |
| isHTMLInputElement(ToShadowRoot(target_node)->host()); |
| } |
| +bool ShowIBeamForNode(const Node* node, const HitTestResult& result) { |
|
jbroman
2017/04/28 15:35:48
nit: not clear if this function shows it or is sim
dtapuska
2017/04/28 15:47:35
Done.
|
| + if (!node || result.GetScrollbar()) |
|
jbroman
2017/04/28 15:35:48
nit: the caller already checks for GetScrollbar, I
dtapuska
2017/04/28 15:47:35
Done.
|
| + return false; |
| + |
| + bool layout_object_selectable = false; |
| + if (LayoutObject* layout_object = node->GetLayoutObject()) { |
| + PaintLayer* layer = layout_object->EnclosingLayer(); |
| + if (layer->GetScrollableArea() && |
| + layer->GetScrollableArea()->IsPointInResizeControl( |
| + result.RoundedPointInMainFrame(), kResizerForPointer)) { |
| + return false; |
| + } |
| + |
| + layout_object_selectable = |
| + layout_object->IsText() && node->CanStartSelection(); |
| + } |
| + |
| + return HasEditableStyle(*node) || layout_object_selectable; |
| +} |
| + |
| } // namespace |
| using namespace HTMLNames; |
| @@ -537,23 +557,12 @@ OptionalCursor EventHandler::SelectAutoCursor(const HitTestResult& result, |
| return PointerCursor(); |
| } |
| - bool editable = (node && HasEditableStyle(*node)); |
| - |
| const bool is_over_link = |
| !GetSelectionController().MouseDownMayStartSelect() && |
| result.IsOverLink(); |
| if (UseHandCursor(node, is_over_link)) |
| return HandCursor(); |
| - bool in_resizer = false; |
| - LayoutObject* layout_object = node ? node->GetLayoutObject() : nullptr; |
| - if (layout_object && frame_->View()) { |
| - PaintLayer* layer = layout_object->EnclosingLayer(); |
| - in_resizer = layer->GetScrollableArea() && |
| - layer->GetScrollableArea()->IsPointInResizeControl( |
| - result.RoundedPointInMainFrame(), kResizerForPointer); |
| - } |
| - |
| // During selection, use an I-beam no matter what we're over. |
| // If a drag may be starting or we're capturing mouse events for a particular |
| // node, don't treat this as a selection. |
| @@ -567,9 +576,7 @@ OptionalCursor EventHandler::SelectAutoCursor(const HitTestResult& result, |
| return i_beam; |
| } |
| - if ((editable || (layout_object && layout_object->IsText() && |
| - node->CanStartSelection())) && |
| - !in_resizer && !result.GetScrollbar()) |
| + if (ShowIBeamForNode(node, result)) |
| return i_beam; |
| return PointerCursor(); |
| } |