OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) | 2 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 return node->layoutObject()->isBox(); | 109 return node->layoutObject()->isBox(); |
110 } | 110 } |
111 | 111 |
112 bool providesContextMenuItems(Node* node) | 112 bool providesContextMenuItems(Node* node) |
113 { | 113 { |
114 // This function tries to match the nodes that receive special context-menu
items in | 114 // This function tries to match the nodes that receive special context-menu
items in |
115 // ContextMenuController::populate(), and should be kept uptodate with those
. | 115 // ContextMenuController::populate(), and should be kept uptodate with those
. |
116 ASSERT(node->layoutObject() || node->isShadowRoot()); | 116 ASSERT(node->layoutObject() || node->isShadowRoot()); |
117 if (!node->layoutObject()) | 117 if (!node->layoutObject()) |
118 return false; | 118 return false; |
119 if (node->isContentEditable()) | 119 if (isContentEditable(*node)) |
120 return true; | 120 return true; |
121 if (node->isLink()) | 121 if (node->isLink()) |
122 return true; | 122 return true; |
123 if (node->layoutObject()->isImage()) | 123 if (node->layoutObject()->isImage()) |
124 return true; | 124 return true; |
125 if (node->layoutObject()->isMedia()) | 125 if (node->layoutObject()->isMedia()) |
126 return true; | 126 return true; |
127 if (node->layoutObject()->canBeSelectionLeaf()) { | 127 if (node->layoutObject()->canBeSelectionLeaf()) { |
128 // If the context menu gesture will trigger a selection all selectable n
odes are valid targets. | 128 // If the context menu gesture will trigger a selection all selectable n
odes are valid targets. |
129 if (node->layoutObject()->frame()->editor().behavior().shouldSelectOnCon
textualMenuClick()) | 129 if (node->layoutObject()->frame()->editor().behavior().shouldSelectOnCon
textualMenuClick()) |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 // Skip nodes who's responders are ancestors of other responders. This g
ives preference to | 291 // Skip nodes who's responders are ancestors of other responders. This g
ives preference to |
292 // the inner-most event-handlers. So that a link is always preferred eve
n when contained | 292 // the inner-most event-handlers. So that a link is always preferred eve
n when contained |
293 // in an element that monitors all click-events. | 293 // in an element that monitors all click-events. |
294 Node* respondingNode = responderMap.get(candidate); | 294 Node* respondingNode = responderMap.get(candidate); |
295 ASSERT(respondingNode); | 295 ASSERT(respondingNode); |
296 if (ancestorsToRespondersSet.contains(respondingNode)) | 296 if (ancestorsToRespondersSet.contains(respondingNode)) |
297 continue; | 297 continue; |
298 // Consolidate bounds for editable content. | 298 // Consolidate bounds for editable content. |
299 if (editableAncestors.contains(candidate)) | 299 if (editableAncestors.contains(candidate)) |
300 continue; | 300 continue; |
301 if (candidate->isContentEditable()) { | 301 if (isContentEditable(*candidate)) { |
302 Node* replacement = candidate; | 302 Node* replacement = candidate; |
303 Node* parent = candidate->parentOrShadowHostNode(); | 303 Node* parent = candidate->parentOrShadowHostNode(); |
304 while (parent && parent->isContentEditable()) { | 304 while (parent && isContentEditable(*parent)) { |
305 replacement = parent; | 305 replacement = parent; |
306 if (editableAncestors.contains(replacement)) { | 306 if (editableAncestors.contains(replacement)) { |
307 replacement = nullptr; | 307 replacement = nullptr; |
308 break; | 308 break; |
309 } | 309 } |
310 editableAncestors.add(replacement); | 310 editableAncestors.add(replacement); |
311 parent = parent->parentOrShadowHostNode(); | 311 parent = parent->parentOrShadowHostNode(); |
312 } | 312 } |
313 candidate = replacement; | 313 candidate = replacement; |
314 } | 314 } |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 | 497 |
498 bool findBestZoomableArea(Node*& targetNode, IntRect& targetArea, const IntPoint
& touchHotspot, const IntRect& touchArea, const HeapVector<Member<Node>>& nodes) | 498 bool findBestZoomableArea(Node*& targetNode, IntRect& targetArea, const IntPoint
& touchHotspot, const IntRect& touchArea, const HeapVector<Member<Node>>& nodes) |
499 { | 499 { |
500 IntPoint targetPoint; | 500 IntPoint targetPoint; |
501 TouchAdjustment::SubtargetGeometryList subtargets; | 501 TouchAdjustment::SubtargetGeometryList subtargets; |
502 TouchAdjustment::compileZoomableSubtargets(nodes, subtargets); | 502 TouchAdjustment::compileZoomableSubtargets(nodes, subtargets); |
503 return TouchAdjustment::findNodeWithLowestDistanceMetric(targetNode, targetP
oint, targetArea, touchHotspot, touchArea, subtargets, TouchAdjustment::zoomable
IntersectionQuotient); | 503 return TouchAdjustment::findNodeWithLowestDistanceMetric(targetNode, targetP
oint, targetArea, touchHotspot, touchArea, subtargets, TouchAdjustment::zoomable
IntersectionQuotient); |
504 } | 504 } |
505 | 505 |
506 } // namespace blink | 506 } // namespace blink |
OLD | NEW |