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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 return result; | 54 return result; |
55 } | 55 } |
56 | 56 |
57 static Node* nodeInsideFrame(Node* node) | 57 static Node* nodeInsideFrame(Node* node) |
58 { | 58 { |
59 if (node->isFrameOwnerElement()) | 59 if (node->isFrameOwnerElement()) |
60 return toHTMLFrameOwnerElement(node)->contentDocument(); | 60 return toHTMLFrameOwnerElement(node)->contentDocument(); |
61 return 0; | 61 return 0; |
62 } | 62 } |
63 | 63 |
64 // FIXME: SmartClipData is eventually returned via | 64 IntRect SmartClipData::rect() const |
65 // SLookSmartClip.DataExtractionListener: | |
66 // http://img-developer.samsung.com/onlinedocs/sms/com/samsung/android/sdk/look/
... | |
67 // however the original author of this change chose to use a string-serializatio
n | |
68 // format (presumably to make IPC easy?). | |
69 // If we're going to use this as a Pickle format, we should at least have the | |
70 // read/write code in one place! | |
71 String SmartClipData::toString() | |
72 { | 65 { |
73 if (!m_node) | 66 return m_rect; |
74 return emptyString(); | 67 } |
75 | 68 |
76 const UChar fieldSeparator = 0xFFFE; | 69 const String& SmartClipData::clipData() const |
77 const UChar rowSeparator = 0xFFFF; | 70 { |
78 | 71 return m_string; |
79 StringBuilder result; | |
80 result.append(String::number(m_rect.x())); | |
81 result.append(fieldSeparator); | |
82 result.append(String::number(m_rect.y())); | |
83 result.append(fieldSeparator); | |
84 result.append(String::number(m_rect.width())); | |
85 result.append(fieldSeparator); | |
86 result.append(String::number(m_rect.height())); | |
87 result.append(fieldSeparator); | |
88 result.append(m_string); | |
89 result.append(rowSeparator); | |
90 return result.toString(); | |
91 } | 72 } |
92 | 73 |
93 SmartClip::SmartClip(PassRefPtr<LocalFrame> frame) | 74 SmartClip::SmartClip(PassRefPtr<LocalFrame> frame) |
94 : m_frame(frame) | 75 : m_frame(frame) |
95 { | 76 { |
96 } | 77 } |
97 | 78 |
98 SmartClipData SmartClip::dataForRect(const IntRect& cropRect) | 79 SmartClipData SmartClip::dataForRect(const IntRect& cropRect) |
99 { | 80 { |
100 IntRect resizedCropRect = applyScaleWithoutCollapsingToZero(cropRect, 1 / pa
geScaleFactor()); | 81 IntRect resizedCropRect = applyScaleWithoutCollapsingToZero(cropRect, 1 / pa
geScaleFactor()); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 268 |
288 result.append(nodeValue); | 269 result.append(nodeValue); |
289 } | 270 } |
290 } | 271 } |
291 } | 272 } |
292 | 273 |
293 return result.toString(); | 274 return result.toString(); |
294 } | 275 } |
295 | 276 |
296 } // namespace WebCore | 277 } // namespace WebCore |
OLD | NEW |