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

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

Issue 2257203003: Merge 2832: Revert of [Editing][CSS] Drag from a -webkit-user-select:none element should not start … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2832
Patch Set: Created 4 years, 4 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/select_user_select_in_shadow.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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 // FIXME: Shouldn't these functions be in the editing code? Code that asks ques tions about HTML in the core DOM class 931 // FIXME: Shouldn't these functions be in the editing code? Code that asks ques tions about HTML in the core DOM class
932 // is obviously misplaced. 932 // is obviously misplaced.
933 bool Node::canStartSelection() const 933 bool Node::canStartSelection() const
934 { 934 {
935 if (isDisabledFormControl(this)) 935 if (isDisabledFormControl(this))
936 return false; 936 return false;
937 937
938 if (hasEditableStyle(*this)) 938 if (hasEditableStyle(*this))
939 return true; 939 return true;
940 940
941 // We don't allow selections to begin within an element that has 941 if (layoutObject()) {
942 // -webkit-user-select: none set, 942 const ComputedStyle& style = layoutObject()->styleRef();
943 // https://drafts.csswg.org/css-ui-4/#valdef-user-select-none 943 // We allow selections to begin within an element that has -webkit-user- select: none set,
944 if (usedValueOfUserSelect(*this) == SELECT_NONE) 944 // but if the element is draggable then dragging should take priority ov er selection.
945 return false; 945 if (style.userDrag() == DRAG_ELEMENT && style.userSelect() == SELECT_NON E)
946
947 if (isHTMLElement() && toHTMLElement(this)->draggable())
948 return false;
949
950 // TODO(yoichio): Implement FlatTreeTraversal::ancestorsOf() and use it.
951 for (const Node* parent = FlatTreeTraversal::parent(*this); parent; parent = FlatTreeTraversal::parent(*parent)) {
952 if (!parent->canStartSelection() && usedValueOfUserSelect(*parent) != SE LECT_NONE)
953 return false; 946 return false;
954 } 947 }
955 return true; 948 ContainerNode* parent = FlatTreeTraversal::parent(*this);
949 return parent ? parent->canStartSelection() : true;
956 } 950 }
957 951
958 // StyledElements allow inline style (style="border: 1px"), presentational attri butes (ex. color), 952 // StyledElements allow inline style (style="border: 1px"), presentational attri butes (ex. color),
959 // class names (ex. class="foo bar") and other non-basic styling features. They also control 953 // class names (ex. class="foo bar") and other non-basic styling features. They also control
960 // if this element can participate in style sharing. 954 // if this element can participate in style sharing.
961 // 955 //
962 // FIXME: The only things that ever go through StyleResolver that aren't StyledE lements are 956 // FIXME: The only things that ever go through StyleResolver that aren't StyledE lements are
963 // PseudoElements and VTTElements. It's possible we can just eliminate all the c hecks 957 // PseudoElements and VTTElements. It's possible we can just eliminate all the c hecks
964 // since those elements will never have class names, inline style, or other thin gs that 958 // since those elements will never have class names, inline style, or other thin gs that
965 // this apparently guards against. 959 // this apparently guards against.
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
2429 2423
2430 void showNodePath(const blink::Node* node) 2424 void showNodePath(const blink::Node* node)
2431 { 2425 {
2432 if (node) 2426 if (node)
2433 node->showNodePathForThis(); 2427 node->showNodePathForThis();
2434 else 2428 else
2435 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2429 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2436 } 2430 }
2437 2431
2438 #endif 2432 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/selection/mouse/select_user_select_in_shadow.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698