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 IntRect SmartClipData::getRect() const | 64 // FIXME: SmartClipData is eventually returned via |
| 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() |
65 { | 72 { |
66 return m_rect; | 73 if (!m_node) |
67 } | 74 return emptyString(); |
68 | 75 |
69 String SmartClipData::getClipData() const | 76 const UChar fieldSeparator = 0xFFFE; |
70 { | 77 const UChar rowSeparator = 0xFFFF; |
71 return m_string; | 78 |
| 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(); |
72 } | 91 } |
73 | 92 |
74 SmartClip::SmartClip(PassRefPtr<LocalFrame> frame) | 93 SmartClip::SmartClip(PassRefPtr<LocalFrame> frame) |
75 : m_frame(frame) | 94 : m_frame(frame) |
76 { | 95 { |
77 } | 96 } |
78 | 97 |
79 SmartClipData SmartClip::dataForRect(const IntRect& cropRect) | 98 SmartClipData SmartClip::dataForRect(const IntRect& cropRect) |
80 { | 99 { |
81 IntRect resizedCropRect = applyScaleWithoutCollapsingToZero(cropRect, 1 / pa
geScaleFactor()); | 100 IntRect resizedCropRect = applyScaleWithoutCollapsingToZero(cropRect, 1 / pa
geScaleFactor()); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 287 |
269 result.append(nodeValue); | 288 result.append(nodeValue); |
270 } | 289 } |
271 } | 290 } |
272 } | 291 } |
273 | 292 |
274 return result.toString(); | 293 return result.toString(); |
275 } | 294 } |
276 | 295 |
277 } // namespace WebCore | 296 } // namespace WebCore |
OLD | NEW |