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

Side by Side Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 2001993002: [Editing][CSS] Drag from a -webkit-user-select:none element should not start selection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/selection/mouse/drag_user_select_none.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 966
967 // FIXME: Shouldn't these functions be in the editing code? Code that asks ques tions about HTML in the core DOM class 967 // FIXME: Shouldn't these functions be in the editing code? Code that asks ques tions about HTML in the core DOM class
968 // is obviously misplaced. 968 // is obviously misplaced.
969 bool Node::canStartSelection() const 969 bool Node::canStartSelection() const
970 { 970 {
971 if (hasEditableStyle()) 971 if (hasEditableStyle())
972 return true; 972 return true;
973 973
974 if (layoutObject()) { 974 if (layoutObject()) {
975 const ComputedStyle& style = layoutObject()->styleRef(); 975 const ComputedStyle& style = layoutObject()->styleRef();
976 // We allow selections to begin within an element that has -webkit-user- select: none set, 976 // We don't allow selections to begin within an element that has
977 // but if the element is draggable then dragging should take priority ov er selection. 977 // -webkit-user-select: none set,
978 if (style.userDrag() == DRAG_ELEMENT && style.userSelect() == SELECT_NON E) 978 // https://drafts.csswg.org/css-ui-4/#valdef-user-select-none
979 if (style.userSelect() == SELECT_NONE)
979 return false; 980 return false;
980 } 981 }
981 ContainerNode* parent = FlatTreeTraversal::parent(*this); 982 ContainerNode* parent = FlatTreeTraversal::parent(*this);
982 return parent ? parent->canStartSelection() : true; 983 return parent ? parent->canStartSelection() : true;
983 } 984 }
984 985
985 bool Node::canParticipateInFlatTree() const 986 bool Node::canParticipateInFlatTree() const
986 { 987 {
987 return !isShadowRoot() && !isSlotOrActiveInsertionPoint(); 988 return !isShadowRoot() && !isSlotOrActiveInsertionPoint();
988 } 989 }
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
2474 2475
2475 void showNodePath(const blink::Node* node) 2476 void showNodePath(const blink::Node* node)
2476 { 2477 {
2477 if (node) 2478 if (node)
2478 node->showNodePathForThis(); 2479 node->showNodePathForThis();
2479 else 2480 else
2480 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2481 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2481 } 2482 }
2482 2483
2483 #endif 2484 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/selection/mouse/drag_user_select_none.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698