Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 929 // FIXME: Shouldn't these functions be in the editing code? Code that asks ques tions about HTML in the core DOM class | 929 // FIXME: Shouldn't these functions be in the editing code? Code that asks ques tions about HTML in the core DOM class |
| 930 // is obviously misplaced. | 930 // is obviously misplaced. |
| 931 bool Node::canStartSelection() const | 931 bool Node::canStartSelection() const |
| 932 { | 932 { |
| 933 if (isDisabledFormControl(this)) | 933 if (isDisabledFormControl(this)) |
| 934 return false; | 934 return false; |
| 935 | 935 |
| 936 if (hasEditableStyle(*this)) | 936 if (hasEditableStyle(*this)) |
| 937 return true; | 937 return true; |
| 938 | 938 |
| 939 if (layoutObject()) { | 939 // We don't allow selections to begin within an element that has |
| 940 const ComputedStyle& style = layoutObject()->styleRef(); | 940 // -webkit-user-select: none set, |
| 941 // We allow selections to begin within an element that has -webkit-user- select: none set, | 941 // https://drafts.csswg.org/css-ui-4/#valdef-user-select-none |
| 942 // but if the element is draggable then dragging should take priority ov er selection. | 942 if (usedValueOfUserSelect(*this) == SELECT_NONE) |
| 943 if (style.userDrag() == DRAG_ELEMENT && style.userSelect() == SELECT_NON E) | 943 return false; |
| 944 | |
| 945 if (isHTMLElement() && toHTMLElement(this)->draggable()) | |
| 946 return false; | |
| 947 | |
| 948 for (const Node* parent = FlatTreeTraversal::parent(*this); parent; parent = FlatTreeTraversal::parent(*parent)) { | |
|
yosin_UTC9
2016/08/16 06:34:42
Could you add TODO to use |FlatTreeTraversal::ance
yoichio
2016/08/16 08:25:46
Done.
| |
| 949 if (!parent->canStartSelection() && usedValueOfUserSelect(*parent) != SE LECT_NONE) | |
| 944 return false; | 950 return false; |
| 945 } | 951 } |
| 946 ContainerNode* parent = FlatTreeTraversal::parent(*this); | 952 return true; |
| 947 return parent ? parent->canStartSelection() : true; | |
| 948 } | 953 } |
| 949 | 954 |
| 950 // StyledElements allow inline style (style="border: 1px"), presentational attri butes (ex. color), | 955 // StyledElements allow inline style (style="border: 1px"), presentational attri butes (ex. color), |
| 951 // class names (ex. class="foo bar") and other non-basic styling features. They also control | 956 // class names (ex. class="foo bar") and other non-basic styling features. They also control |
| 952 // if this element can participate in style sharing. | 957 // if this element can participate in style sharing. |
| 953 // | 958 // |
| 954 // FIXME: The only things that ever go through StyleResolver that aren't StyledE lements are | 959 // FIXME: The only things that ever go through StyleResolver that aren't StyledE lements are |
| 955 // PseudoElements and VTTElements. It's possible we can just eliminate all the c hecks | 960 // PseudoElements and VTTElements. It's possible we can just eliminate all the c hecks |
| 956 // since those elements will never have class names, inline style, or other thin gs that | 961 // since those elements will never have class names, inline style, or other thin gs that |
| 957 // this apparently guards against. | 962 // this apparently guards against. |
| (...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2410 | 2415 |
| 2411 void showNodePath(const blink::Node* node) | 2416 void showNodePath(const blink::Node* node) |
| 2412 { | 2417 { |
| 2413 if (node) | 2418 if (node) |
| 2414 node->showNodePathForThis(); | 2419 node->showNodePathForThis(); |
| 2415 else | 2420 else |
| 2416 fprintf(stderr, "Cannot showNodePath for (nil)\n"); | 2421 fprintf(stderr, "Cannot showNodePath for (nil)\n"); |
| 2417 } | 2422 } |
| 2418 | 2423 |
| 2419 #endif | 2424 #endif |
| OLD | NEW |