Skip to content

Commit af7005e

Browse files
committed
Update to Chromium 58.0.3029.81 (cztomczak#354).
CEF: 3.3029.1604.g364cd86 Update issue251 patch, expose DragData.GetImageHotspot() (cztomczak#251).
1 parent 7790b85 commit af7005e

File tree

6 files changed

+99
-74
lines changed

6 files changed

+99
-74
lines changed

patches/issue251.patch

Lines changed: 83 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git include/capi/cef_drag_data_capi.h include/capi/cef_drag_data_capi.h
2-
index e1fcfd8c..fc388247 100644
2+
index e1fcfd8c..084fea20 100644
33
--- include/capi/cef_drag_data_capi.h
44
+++ include/capi/cef_drag_data_capi.h
55
@@ -39,6 +39,7 @@
@@ -10,21 +10,20 @@ index e1fcfd8c..fc388247 100644
1010
#include "include/capi/cef_stream_capi.h"
1111

1212
#ifdef __cplusplus
13-
@@ -195,6 +196,22 @@ typedef struct _cef_drag_data_t {
13+
@@ -195,6 +196,21 @@ typedef struct _cef_drag_data_t {
1414
///
1515
void (CEF_CALLBACK *add_file)(struct _cef_drag_data_t* self,
1616
const cef_string_t* path, const cef_string_t* display_name);
1717
+
1818
+ ///
19-
+ // Set image representation of drag data.
19+
+ // Get image representation of drag data (may be NULL).
2020
+ ///
21-
+ void (CEF_CALLBACK *set_image)(struct _cef_drag_data_t* self,
22-
+ struct _cef_image_t* image);
21+
+ struct _cef_image_t* (CEF_CALLBACK *get_image)(struct _cef_drag_data_t* self);
2322
+
2423
+ ///
25-
+ // Get image representation of drag data (may be NULL).
24+
+ // Get image hotspot (drag start location relative to image dimensions).
2625
+ ///
27-
+ struct _cef_image_t* (CEF_CALLBACK *get_image)(struct _cef_drag_data_t* self);
26+
+ cef_point_t (CEF_CALLBACK *get_image_hotspot)(struct _cef_drag_data_t* self);
2827
+
2928
+ ///
3029
+ // Whether image representation of drag data is available.
@@ -34,7 +33,7 @@ index e1fcfd8c..fc388247 100644
3433

3534

3635
diff --git include/cef_drag_data.h include/cef_drag_data.h
37-
index 29b85e84..e3c9c2df 100644
36+
index 29b85e84..de37ecc4 100644
3837
--- include/cef_drag_data.h
3938
+++ include/cef_drag_data.h
4039
@@ -39,6 +39,7 @@
@@ -51,16 +50,16 @@ index 29b85e84..e3c9c2df 100644
5150
virtual void AddFile(const CefString& path, const CefString& display_name) =0;
5251
+
5352
+ ///
54-
+ // Set image representation of drag data.
53+
+ // Get image representation of drag data (may be NULL).
5554
+ ///
5655
+ /*--cef()--*/
57-
+ virtual void SetImage(CefRefPtr<CefImage> image) =0;
56+
+ virtual CefRefPtr<CefImage> GetImage() =0;
5857
+
5958
+ ///
60-
+ // Get image representation of drag data (may be NULL).
59+
+ // Get image hotspot (drag start location relative to image dimensions).
6160
+ ///
6261
+ /*--cef()--*/
63-
+ virtual CefRefPtr<CefImage> GetImage() =0;
62+
+ virtual CefPoint GetImageHotspot() =0;
6463
+
6564
+ ///
6665
+ // Whether image representation of drag data is available.
@@ -71,7 +70,7 @@ index 29b85e84..e3c9c2df 100644
7170

7271
#endif // CEF_INCLUDE_CEF_DRAG_DATA_H_
7372
diff --git libcef/browser/osr/browser_platform_delegate_osr.cc libcef/browser/osr/browser_platform_delegate_osr.cc
74-
index 148ef49c..59cfae97 100644
73+
index 148ef49c..bfec55b7 100644
7574
--- libcef/browser/osr/browser_platform_delegate_osr.cc
7675
+++ libcef/browser/osr/browser_platform_delegate_osr.cc
7776
@@ -7,6 +7,7 @@
@@ -82,45 +81,49 @@ index 148ef49c..59cfae97 100644
8281
#include "libcef/browser/osr/render_widget_host_view_osr.h"
8382
#include "libcef/browser/osr/web_contents_view_osr.h"
8483
#include "libcef/common/drag_data_impl.h"
85-
@@ -432,7 +433,9 @@ void CefBrowserPlatformDelegateOsr::StartDragging(
84+
@@ -432,7 +433,11 @@ void CefBrowserPlatformDelegateOsr::StartDragging(
8685
CefRefPtr<CefRenderHandler> handler =
8786
browser_->GetClient()->GetRenderHandler();
8887
if (handler.get()) {
8988
- CefRefPtr<CefDragDataImpl> drag_data(new CefDragDataImpl(drop_data));
9089
+ CefRefPtr<CefImage> cef_image(new CefImageImpl(image));
90+
+ CefPoint cef_image_pos(CefPoint(image_offset.x(), image_offset.y()));
9191
+ CefRefPtr<CefDragDataImpl> drag_data(new CefDragDataImpl(drop_data,
92-
+ cef_image));
92+
+ cef_image,
93+
+ cef_image_pos));
9394
drag_data->SetReadOnly(true);
9495
base::MessageLoop::ScopedNestableTaskAllower allow(
9596
base::MessageLoop::current());
9697
diff --git libcef/common/drag_data_impl.cc libcef/common/drag_data_impl.cc
97-
index a8e2c8e1..b0c47e8e 100644
98+
index a8e2c8e1..a5c8940c 100644
9899
--- libcef/common/drag_data_impl.cc
99100
+++ libcef/common/drag_data_impl.cc
100-
@@ -19,6 +19,13 @@ CefDragDataImpl::CefDragDataImpl(const content::DropData& data)
101+
@@ -19,6 +19,15 @@ CefDragDataImpl::CefDragDataImpl(const content::DropData& data)
101102
read_only_(false) {
102103
}
103104

104105
+CefDragDataImpl::CefDragDataImpl(const content::DropData& data,
105-
+ CefRefPtr<CefImage> image)
106+
+ CefRefPtr<CefImage> image,
107+
+ const CefPoint& image_hotspot)
106108
+ : data_(data),
107109
+ image_(image),
110+
+ image_hotspot_(image_hotspot),
108111
+ read_only_(false) {
109112
+}
110113
+
111114
CefDragDataImpl::CefDragDataImpl()
112115
: read_only_(false) {
113116
}
114-
@@ -31,7 +38,7 @@ CefRefPtr<CefDragData> CefDragDataImpl::Clone() {
117+
@@ -31,7 +40,7 @@ CefRefPtr<CefDragData> CefDragDataImpl::Clone() {
115118
CefDragDataImpl* drag_data = NULL;
116119
{
117120
base::AutoLock lock_scope(lock_);
118121
- drag_data = new CefDragDataImpl(data_);
119-
+ drag_data = new CefDragDataImpl(data_, image_);
122+
+ drag_data = new CefDragDataImpl(data_, image_, image_hotspot_);
120123
}
121124
return drag_data;
122125
}
123-
@@ -187,3 +194,20 @@ void CefDragDataImpl::SetReadOnly(bool read_only) {
126+
@@ -187,3 +196,31 @@ void CefDragDataImpl::SetReadOnly(bool read_only) {
124127

125128
read_only_ = read_only;
126129
}
@@ -131,18 +134,29 @@ index a8e2c8e1..b0c47e8e 100644
131134
+ image_ = image;
132135
+}
133136
+
137+
+void CefDragDataImpl::SetImageHotspot(const CefPoint& point) {
138+
+ base::AutoLock lock_scope(lock_);
139+
+ CHECK_READONLY_RETURN_VOID();
140+
+ image_hotspot_.Set(point.x, point.y);
141+
+}
142+
+
134143
+CefRefPtr<CefImage> CefDragDataImpl::GetImage() {
135144
+ base::AutoLock lock_scope(lock_);
136145
+ return image_;
137146
+}
138147
+
148+
+CefPoint CefDragDataImpl::GetImageHotspot() {
149+
+ base::AutoLock lock_scope(lock_);
150+
+ return image_hotspot_;
151+
+}
152+
+
139153
+bool CefDragDataImpl::HasImage() {
140154
+ base::AutoLock lock_scope(lock_);
141155
+ if (image_) return true;
142156
+ else return false;
143157
+}
144158
diff --git libcef/common/drag_data_impl.h libcef/common/drag_data_impl.h
145-
index 64f29ed3..98707262 100644
159+
index 64f29ed3..68cb3875 100644
146160
--- libcef/common/drag_data_impl.h
147161
+++ libcef/common/drag_data_impl.h
148162
@@ -7,6 +7,7 @@
@@ -153,35 +167,44 @@ index 64f29ed3..98707262 100644
153167

154168
#include <vector>
155169

156-
@@ -18,6 +19,8 @@ class CefDragDataImpl : public CefDragData {
170+
@@ -18,6 +19,9 @@ class CefDragDataImpl : public CefDragData {
157171
public:
158172
CefDragDataImpl();
159173
explicit CefDragDataImpl(const content::DropData& data);
160174
+ explicit CefDragDataImpl(const content::DropData& data,
161-
+ CefRefPtr<CefImage> image);
175+
+ CefRefPtr<CefImage> image,
176+
+ const CefPoint& image_hotspot);
162177

163178
CefRefPtr<CefDragData> Clone() override;
164179
bool IsReadOnly() override;
165-
@@ -41,6 +44,9 @@ class CefDragDataImpl : public CefDragData {
180+
@@ -41,6 +45,9 @@ class CefDragDataImpl : public CefDragData {
166181
void SetFragmentBaseURL(const CefString& fragment) override;
167182
void ResetFileContents() override;
168183
void AddFile(const CefString& path, const CefString& display_name) override;
169-
+ void SetImage(CefRefPtr<CefImage> image) override;
170184
+ CefRefPtr<CefImage> GetImage() override;
185+
+ CefPoint GetImageHotspot() override;
171186
+ bool HasImage() override;
172187

173188
// This method is not safe. Use Lock/Unlock to get mutually exclusive access.
174189
content::DropData* drop_data() {
175-
@@ -53,6 +59,7 @@ class CefDragDataImpl : public CefDragData {
190+
@@ -49,10 +56,15 @@ class CefDragDataImpl : public CefDragData {
191+
192+
void SetReadOnly(bool read_only);
193+
194+
+ void SetImage(CefRefPtr<CefImage> image);
195+
+ void SetImageHotspot(const CefPoint& point);
196+
+
197+
base::Lock& lock() { return lock_; }
176198

177199
private:
178200
content::DropData data_;
179201
+ CefRefPtr<CefImage> image_;
202+
+ CefPoint image_hotspot_;
180203

181204
// True if this object is read-only.
182205
bool read_only_;
183206
diff --git libcef_dll/cpptoc/drag_data_cpptoc.cc libcef_dll/cpptoc/drag_data_cpptoc.cc
184-
index 381b88b9..6f4925a0 100644
207+
index 381b88b9..01a39793 100644
185208
--- libcef_dll/cpptoc/drag_data_cpptoc.cc
186209
+++ libcef_dll/cpptoc/drag_data_cpptoc.cc
187210
@@ -11,6 +11,7 @@
@@ -192,40 +215,38 @@ index 381b88b9..6f4925a0 100644
192215
#include "libcef_dll/cpptoc/stream_writer_cpptoc.h"
193216
#include "libcef_dll/transfer_util.h"
194217

195-
@@ -367,6 +368,52 @@ void CEF_CALLBACK drag_data_add_file(struct _cef_drag_data_t* self,
218+
@@ -367,6 +368,50 @@ void CEF_CALLBACK drag_data_add_file(struct _cef_drag_data_t* self,
196219
CefString(display_name));
197220
}
198221

199-
+void CEF_CALLBACK drag_data_set_image(struct _cef_drag_data_t* self,
200-
+ struct _cef_image_t* image) {
222+
+struct _cef_image_t* CEF_CALLBACK drag_data_get_image(
223+
+ struct _cef_drag_data_t* self) {
201224
+ // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
202225
+
203226
+ DCHECK(self);
204227
+ if (!self)
205-
+ return;
206-
+ // Verify param: image; type: refptr_same
207-
+ DCHECK(image);
208-
+ if (!image)
209-
+ return;
228+
+ return NULL;
210229
+
211230
+ // Execute
212-
+ CefDragDataCppToC::Get(self)->SetImage(
213-
+ CefImageCppToC::Unwrap(image));
231+
+ CefRefPtr<CefImage> _retval = CefDragDataCppToC::Get(self)->GetImage();
232+
+
233+
+ // Return type: refptr_same
234+
+ return CefImageCppToC::Wrap(_retval);
214235
+}
215236
+
216-
+struct _cef_image_t* CEF_CALLBACK drag_data_get_image(
237+
+cef_point_t CEF_CALLBACK drag_data_get_image_hotspot(
217238
+ struct _cef_drag_data_t* self) {
218239
+ // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
219240
+
220241
+ DCHECK(self);
221242
+ if (!self)
222-
+ return NULL;
243+
+ return CefPoint();
223244
+
224245
+ // Execute
225-
+ CefRefPtr<CefImage> _retval = CefDragDataCppToC::Get(self)->GetImage();
246+
+ cef_point_t _retval = CefDragDataCppToC::Get(self)->GetImageHotspot();
226247
+
227-
+ // Return type: refptr_same
228-
+ return CefImageCppToC::Wrap(_retval);
248+
+ // Return type: simple
249+
+ return _retval;
229250
+}
230251
+
231252
+int CEF_CALLBACK drag_data_has_image(struct _cef_drag_data_t* self) {
@@ -245,18 +266,18 @@ index 381b88b9..6f4925a0 100644
245266
} // namespace
246267

247268

248-
@@ -395,6 +442,9 @@ CefDragDataCppToC::CefDragDataCppToC() {
269+
@@ -395,6 +440,9 @@ CefDragDataCppToC::CefDragDataCppToC() {
249270
GetStruct()->set_fragment_base_url = drag_data_set_fragment_base_url;
250271
GetStruct()->reset_file_contents = drag_data_reset_file_contents;
251272
GetStruct()->add_file = drag_data_add_file;
252-
+ GetStruct()->set_image = drag_data_set_image;
253273
+ GetStruct()->get_image = drag_data_get_image;
274+
+ GetStruct()->get_image_hotspot = drag_data_get_image_hotspot;
254275
+ GetStruct()->has_image = drag_data_has_image;
255276
}
256277

257278
template<> CefRefPtr<CefDragData> CefCppToCRefCounted<CefDragDataCppToC,
258279
diff --git libcef_dll/ctocpp/drag_data_ctocpp.cc libcef_dll/ctocpp/drag_data_ctocpp.cc
259-
index db1a2f71..5e94aff8 100644
280+
index db1a2f71..e6714562 100644
260281
--- libcef_dll/ctocpp/drag_data_ctocpp.cc
261282
+++ libcef_dll/ctocpp/drag_data_ctocpp.cc
262283
@@ -11,6 +11,7 @@
@@ -267,39 +288,36 @@ index db1a2f71..5e94aff8 100644
267288
#include "libcef_dll/ctocpp/stream_writer_ctocpp.h"
268289
#include "libcef_dll/transfer_util.h"
269290

270-
@@ -372,6 +373,51 @@ void CefDragDataCToCpp::AddFile(const CefString& path,
291+
@@ -372,6 +373,48 @@ void CefDragDataCToCpp::AddFile(const CefString& path,
271292
display_name.GetStruct());
272293
}
273294

274-
+void CefDragDataCToCpp::SetImage(CefRefPtr<CefImage> image) {
295+
+CefRefPtr<CefImage> CefDragDataCToCpp::GetImage() {
275296
+ cef_drag_data_t* _struct = GetStruct();
276-
+ if (CEF_MEMBER_MISSING(_struct, set_image))
277-
+ return;
297+
+ if (CEF_MEMBER_MISSING(_struct, get_image))
298+
+ return NULL;
278299
+
279300
+ // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
280301
+
281-
+ // Verify param: image; type: refptr_same
282-
+ DCHECK(image.get());
283-
+ if (!image.get())
284-
+ return;
285-
+
286302
+ // Execute
287-
+ _struct->set_image(_struct,
288-
+ CefImageCToCpp::Unwrap(image));
303+
+ cef_image_t* _retval = _struct->get_image(_struct);
304+
+
305+
+ // Return type: refptr_same
306+
+ return CefImageCToCpp::Wrap(_retval);
289307
+}
290308
+
291-
+CefRefPtr<CefImage> CefDragDataCToCpp::GetImage() {
309+
+CefPoint CefDragDataCToCpp::GetImageHotspot() {
292310
+ cef_drag_data_t* _struct = GetStruct();
293-
+ if (CEF_MEMBER_MISSING(_struct, get_image))
294-
+ return NULL;
311+
+ if (CEF_MEMBER_MISSING(_struct, get_image_hotspot))
312+
+ return CefPoint();
295313
+
296314
+ // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
297315
+
298316
+ // Execute
299-
+ cef_image_t* _retval = _struct->get_image(_struct);
317+
+ cef_point_t _retval = _struct->get_image_hotspot(_struct);
300318
+
301-
+ // Return type: refptr_same
302-
+ return CefImageCToCpp::Wrap(_retval);
319+
+ // Return type: simple
320+
+ return _retval;
303321
+}
304322
+
305323
+bool CefDragDataCToCpp::HasImage() {
@@ -320,15 +338,15 @@ index db1a2f71..5e94aff8 100644
320338
// CONSTRUCTOR - Do not edit by hand.
321339

322340
diff --git libcef_dll/ctocpp/drag_data_ctocpp.h libcef_dll/ctocpp/drag_data_ctocpp.h
323-
index 5b202710..a2e3774f 100644
341+
index 5b202710..20262388 100644
324342
--- libcef_dll/ctocpp/drag_data_ctocpp.h
325343
+++ libcef_dll/ctocpp/drag_data_ctocpp.h
326344
@@ -54,6 +54,9 @@ class CefDragDataCToCpp
327345
void SetFragmentBaseURL(const CefString& base_url) OVERRIDE;
328346
void ResetFileContents() OVERRIDE;
329347
void AddFile(const CefString& path, const CefString& display_name) OVERRIDE;
330-
+ void SetImage(CefRefPtr<CefImage> image) OVERRIDE;
331348
+ CefRefPtr<CefImage> GetImage() OVERRIDE;
349+
+ CefPoint GetImageHotspot() OVERRIDE;
332350
+ bool HasImage() OVERRIDE;
333351
};
334352

src/drag_data.pyx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ cdef class DragData:
4545
raise Exception("Image is not available")
4646
return PyImage_Init(cef_image)
4747

48+
cpdef tuple GetImageHotspot(self):
49+
cdef CefPoint point = self.cef_drag_data.get().GetImageHotspot()
50+
return (point.x, point.y)
51+
4852
cpdef py_bool HasImage(self):
4953
return self.cef_drag_data.get().HasImage()
5054

src/extern/cef/cef_drag_data.pxd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ from libcpp cimport bool as cpp_bool
66
from cef_string cimport CefString
77
from cef_ptr cimport CefRefPtr
88
from cef_image cimport CefImage
9+
from cef_types cimport CefPoint
910

1011
cdef extern from "include/cef_drag_data.h":
1112
cdef cppclass CefDragData:
@@ -20,6 +21,7 @@ cdef extern from "include/cef_drag_data.h":
2021
void SetFragmentBaseURL(const CefString& base_url)
2122
cpp_bool HasImage()
2223
CefRefPtr[CefImage] GetImage()
24+
CefPoint GetImageHotspot()
2325

2426

2527
cdef CefRefPtr[CefDragData] CefDragData_Create "CefDragData::Create"()

src/extern/cef/cef_types.pxd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ cdef extern from "include/internal/cef_types.h":
107107
CefSize(int width, int height)
108108

109109
cdef cppclass CefPoint:
110-
pass
110+
int x
111+
int y
111112

112113
ctypedef struct CefRequestContextSettings:
113114
pass

0 commit comments

Comments
 (0)