OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 21 matching lines...) Expand all Loading... |
32 #define SmartClip_h | 32 #define SmartClip_h |
33 | 33 |
34 #include "core/dom/Node.h" | 34 #include "core/dom/Node.h" |
35 #include "core/frame/LocalFrame.h" | 35 #include "core/frame/LocalFrame.h" |
36 | 36 |
37 namespace WebCore { | 37 namespace WebCore { |
38 | 38 |
39 class SmartClipData { | 39 class SmartClipData { |
40 public: | 40 public: |
41 SmartClipData() | 41 SmartClipData() |
| 42 : m_isEmpty(true) |
42 { | 43 { |
43 } | 44 } |
44 | 45 |
45 SmartClipData(Node* node, IntRect rect, String string) | 46 SmartClipData(Node* node, IntRect rect, String string) |
46 : m_node(node) | 47 : m_isEmpty(!node) |
47 , m_rect(rect) | 48 , m_rect(rect) |
48 , m_string(string) | 49 , m_string(string) |
49 { | 50 { |
50 } | 51 } |
51 | 52 |
52 String toString(); | 53 String toString(); |
53 | 54 |
54 private: | 55 private: |
55 RefPtr<Node> m_node; | 56 bool m_isEmpty; |
56 IntRect m_rect; | 57 IntRect m_rect; |
57 String m_string; | 58 String m_string; |
58 }; | 59 }; |
59 | 60 |
60 // SmartClip implements support for the copy operation | 61 // SmartClip implements support for the copy operation |
61 // with an S-Pen on Samsung devices. The behavior of this | 62 // with an S-Pen on Samsung devices. The behavior of this |
62 // class is quirky and poorly tested. It's approximately | 63 // class is quirky and poorly tested. It's approximately |
63 // trying to do a poor-mans implementation of columnar | 64 // trying to do a poor-mans implementation of columnar |
64 // selection followed by a copy operation. | 65 // selection followed by a copy operation. |
65 class SmartClip { | 66 class SmartClip { |
66 public: | 67 public: |
67 explicit SmartClip(PassRefPtr<LocalFrame>); | 68 explicit SmartClip(PassRefPtr<LocalFrame>); |
68 | 69 |
69 SmartClipData dataForRect(const IntRect&); | 70 SmartClipData dataForRect(const IntRect&); |
70 | 71 |
71 private: | 72 private: |
72 float pageScaleFactor(); | 73 float pageScaleFactor(); |
73 | 74 |
74 Node* minNodeContainsNodes(Node* minNode, Node* newNode); | 75 Node* minNodeContainsNodes(Node* minNode, Node* newNode); |
75 Node* findBestOverlappingNode(Node*, const IntRect& cropRect); | 76 Node* findBestOverlappingNode(Node*, const IntRect& cropRect); |
76 bool shouldSkipBackgroundImage(Node*); | 77 bool shouldSkipBackgroundImage(Node*); |
77 void collectOverlappingChildNodes(Node* parentNode, const IntRect& cropRect,
Vector<Node*>& overlappingNodeInfoTable); | 78 void collectOverlappingChildNodes(Node* parentNode, const IntRect& cropRect,
WillBeHeapVector<RawPtrWillBeMember<Node> >& overlappingNodeInfoTable); |
78 IntRect convertRectToWindow(const IntRect& nodeRect); | 79 IntRect convertRectToWindow(const IntRect& nodeRect); |
79 String extractTextFromNode(Node*); | 80 String extractTextFromNode(Node*); |
80 | 81 |
81 RefPtr<LocalFrame> m_frame; | 82 RefPtr<LocalFrame> m_frame; |
82 }; | 83 }; |
83 | 84 |
84 } // namespace WebCore | 85 } // namespace WebCore |
85 | 86 |
86 #endif // SmartClip_h | 87 #endif // SmartClip_h |
OLD | NEW |