| 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 28 matching lines...) Expand all Loading... |
| 39 #include "platform/text/TextBreakIterator.h" | 39 #include "platform/text/TextBreakIterator.h" |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 namespace TouchAdjustment { | 43 namespace TouchAdjustment { |
| 44 | 44 |
| 45 const float zeroTolerance = 1e-6f; | 45 const float zeroTolerance = 1e-6f; |
| 46 | 46 |
| 47 // Class for remembering absolute quads of a target node and what node they repr
esent. | 47 // Class for remembering absolute quads of a target node and what node they repr
esent. |
| 48 class SubtargetGeometry { | 48 class SubtargetGeometry { |
| 49 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 49 public: | 50 public: |
| 50 SubtargetGeometry(Node* node, const FloatQuad& quad) | 51 SubtargetGeometry(Node* node, const FloatQuad& quad) |
| 51 : m_node(node) | 52 : m_node(node) |
| 52 , m_quad(quad) | 53 , m_quad(quad) |
| 53 { } | 54 { } |
| 55 void trace(Visitor* visitor) { visitor->trace(m_node); } |
| 54 | 56 |
| 55 Node* node() const { return m_node; } | 57 Node* node() const { return m_node; } |
| 56 FloatQuad quad() const { return m_quad; } | 58 FloatQuad quad() const { return m_quad; } |
| 57 IntRect boundingBox() const { return m_quad.enclosingBoundingBox(); } | 59 IntRect boundingBox() const { return m_quad.enclosingBoundingBox(); } |
| 58 | 60 |
| 59 private: | 61 private: |
| 60 Node* m_node; | 62 RawPtrWillBeMember<Node> m_node; |
| 61 FloatQuad m_quad; | 63 FloatQuad m_quad; |
| 62 }; | 64 }; |
| 63 | 65 |
| 64 typedef Vector<SubtargetGeometry> SubtargetGeometryList; | 66 } |
| 67 |
| 68 } |
| 69 |
| 70 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(WebCore::TouchAdjustment::Sub
targetGeometry) |
| 71 |
| 72 namespace WebCore { |
| 73 |
| 74 namespace TouchAdjustment { |
| 75 |
| 76 typedef WillBeHeapVector<SubtargetGeometry> SubtargetGeometryList; |
| 65 typedef bool (*NodeFilter)(Node*); | 77 typedef bool (*NodeFilter)(Node*); |
| 66 typedef void (*AppendSubtargetsForNode)(Node*, SubtargetGeometryList&); | 78 typedef void (*AppendSubtargetsForNode)(Node*, SubtargetGeometryList&); |
| 67 typedef float (*DistanceFunction)(const IntPoint&, const IntRect&, const Subtarg
etGeometry&); | 79 typedef float (*DistanceFunction)(const IntPoint&, const IntRect&, const Subtarg
etGeometry&); |
| 68 | 80 |
| 69 // Takes non-const Node* because isContentEditable is a non-const function. | 81 // Takes non-const Node* because isContentEditable is a non-const function. |
| 70 bool nodeRespondsToTapGesture(Node* node) | 82 bool nodeRespondsToTapGesture(Node* node) |
| 71 { | 83 { |
| 72 if (node->willRespondToMouseClickEvents() || node->willRespondToMouseMoveEve
nts()) | 84 if (node->willRespondToMouseClickEvents() || node->willRespondToMouseMoveEve
nts()) |
| 73 return true; | 85 return true; |
| 74 if (node->isElementNode()) { | 86 if (node->isElementNode()) { |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 | 499 |
| 488 bool findBestZoomableArea(Node*& targetNode, IntRect& targetArea, const IntPoint
& touchHotspot, const IntRect& touchArea, const WillBeHeapVector<RefPtrWillBeMem
ber<Node> >& nodes) | 500 bool findBestZoomableArea(Node*& targetNode, IntRect& targetArea, const IntPoint
& touchHotspot, const IntRect& touchArea, const WillBeHeapVector<RefPtrWillBeMem
ber<Node> >& nodes) |
| 489 { | 501 { |
| 490 IntPoint targetPoint; | 502 IntPoint targetPoint; |
| 491 TouchAdjustment::SubtargetGeometryList subtargets; | 503 TouchAdjustment::SubtargetGeometryList subtargets; |
| 492 TouchAdjustment::compileZoomableSubtargets(nodes, subtargets); | 504 TouchAdjustment::compileZoomableSubtargets(nodes, subtargets); |
| 493 return TouchAdjustment::findNodeWithLowestDistanceMetric(targetNode, targetP
oint, targetArea, touchHotspot, touchArea, subtargets, TouchAdjustment::zoomable
IntersectionQuotient); | 505 return TouchAdjustment::findNodeWithLowestDistanceMetric(targetNode, targetP
oint, targetArea, touchHotspot, touchArea, subtargets, TouchAdjustment::zoomable
IntersectionQuotient); |
| 494 } | 506 } |
| 495 | 507 |
| 496 } // namespace WebCore | 508 } // namespace WebCore |
| OLD | NEW |