| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 bool Position::nodeIsUserSelectNone(Node* node) | 845 bool Position::nodeIsUserSelectNone(Node* node) |
| 846 { | 846 { |
| 847 return node && node->renderer() && node->renderer()->style()->userSelect() =
= SELECT_NONE && node->renderer()->style()->userModify() == READ_ONLY; | 847 return node && node->renderer() && node->renderer()->style()->userSelect() =
= SELECT_NONE && node->renderer()->style()->userModify() == READ_ONLY; |
| 848 } | 848 } |
| 849 | 849 |
| 850 ContainerNode* Position::findParent(const Node* node) | 850 ContainerNode* Position::findParent(const Node* node) |
| 851 { | 851 { |
| 852 return node->parentNode(); | 852 return node->parentNode(); |
| 853 } | 853 } |
| 854 | 854 |
| 855 #if ENABLE(USERSELECT_ALL) | |
| 856 bool Position::nodeIsUserSelectAll(const Node* node) | 855 bool Position::nodeIsUserSelectAll(const Node* node) |
| 857 { | 856 { |
| 858 return node && node->renderer() && node->renderer()->style()->userSelect() =
= SELECT_ALL; | 857 return RuntimeEnabledFeatures::userSelectAllEnabled() && node && node->rende
rer() && node->renderer()->style()->userSelect() == SELECT_ALL; |
| 859 } | 858 } |
| 860 | 859 |
| 861 Node* Position::rootUserSelectAllForNode(Node* node) | 860 Node* Position::rootUserSelectAllForNode(Node* node) |
| 862 { | 861 { |
| 863 if (!node || !nodeIsUserSelectAll(node)) | 862 if (!node || !nodeIsUserSelectAll(node)) |
| 864 return 0; | 863 return 0; |
| 865 Node* parent = node->parentNode(); | 864 Node* parent = node->parentNode(); |
| 866 if (!parent) | 865 if (!parent) |
| 867 return node; | 866 return node; |
| 868 | 867 |
| 869 Node* candidateRoot = node; | 868 Node* candidateRoot = node; |
| 870 while (parent) { | 869 while (parent) { |
| 871 if (!parent->renderer()) { | 870 if (!parent->renderer()) { |
| 872 parent = parent->parentNode(); | 871 parent = parent->parentNode(); |
| 873 continue; | 872 continue; |
| 874 } | 873 } |
| 875 if (!nodeIsUserSelectAll(parent)) | 874 if (!nodeIsUserSelectAll(parent)) |
| 876 break; | 875 break; |
| 877 candidateRoot = parent; | 876 candidateRoot = parent; |
| 878 parent = candidateRoot->parentNode(); | 877 parent = candidateRoot->parentNode(); |
| 879 } | 878 } |
| 880 return candidateRoot; | 879 return candidateRoot; |
| 881 } | 880 } |
| 882 #endif | |
| 883 | 881 |
| 884 bool Position::isCandidate() const | 882 bool Position::isCandidate() const |
| 885 { | 883 { |
| 886 if (isNull()) | 884 if (isNull()) |
| 887 return false; | 885 return false; |
| 888 | 886 |
| 889 RenderObject* renderer = deprecatedNode()->renderer(); | 887 RenderObject* renderer = deprecatedNode()->renderer(); |
| 890 if (!renderer) | 888 if (!renderer) |
| 891 return false; | 889 return false; |
| 892 | 890 |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1392 pos.showTreeForThis(); | 1390 pos.showTreeForThis(); |
| 1393 } | 1391 } |
| 1394 | 1392 |
| 1395 void showTree(const WebCore::Position* pos) | 1393 void showTree(const WebCore::Position* pos) |
| 1396 { | 1394 { |
| 1397 if (pos) | 1395 if (pos) |
| 1398 pos->showTreeForThis(); | 1396 pos->showTreeForThis(); |
| 1399 } | 1397 } |
| 1400 | 1398 |
| 1401 #endif | 1399 #endif |
| OLD | NEW |