Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: Source/core/frame/SmartClip.cpp

Issue 259263003: Fix to remove customised String over IPC for SmartClip (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: changed according to review comments by eseidel Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 String SmartClipData::clipData() const
Inactive 2014/06/09 14:00:51 Could return a const String&.
AviD 2014/06/13 11:52:48 Done.
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698