Skip to content

Commit f3221a0

Browse files
committed
Update issue251.patch (cztomczak#251).
Update patch commands in Build-instructions.md.
1 parent dcb1fe1 commit f3221a0

File tree

2 files changed

+46
-34
lines changed

2 files changed

+46
-34
lines changed

docs/Build-instructions.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,11 @@ cd chromium/src/cef/
452452
git diff --no-prefix --relative > issue251.patch
453453
```
454454

455+
To create a patch from last two commits:
456+
```
457+
git diff --no-prefix --relative HEAD~2..HEAD > issue251.patch
458+
```
459+
455460
Apply a patch in current directory and ignore git index:
456461
```
457462
patch -p0 < issue251.patch
@@ -462,9 +467,3 @@ Apply a patch in current directory and do not ignore git index:
462467
cd chromium/src/cef/
463468
git apply -v -p0 issue251.patch
464469
```
465-
466-
To create a patch from last two commits (no --relative flag available
467-
in this case, so must be in root CEF dir):
468-
```
469-
git format-patch --no-prefix -2 HEAD --stdout > issue251.patch
470-
```

patches/issue251.patch

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ index 148ef49c..bfec55b7 100644
9595
base::MessageLoop::ScopedNestableTaskAllower allow(
9696
base::MessageLoop::current());
9797
diff --git libcef/common/drag_data_impl.cc libcef/common/drag_data_impl.cc
98-
index a8e2c8e1..a5c8940c 100644
98+
index a8e2c8e1..6db3da39 100644
9999
--- libcef/common/drag_data_impl.cc
100100
+++ libcef/common/drag_data_impl.cc
101101
@@ -19,6 +19,15 @@ CefDragDataImpl::CefDragDataImpl(const content::DropData& data)
@@ -123,23 +123,11 @@ index a8e2c8e1..a5c8940c 100644
123123
}
124124
return drag_data;
125125
}
126-
@@ -187,3 +196,31 @@ void CefDragDataImpl::SetReadOnly(bool read_only) {
126+
@@ -187,3 +196,18 @@ void CefDragDataImpl::SetReadOnly(bool read_only) {
127127

128128
read_only_ = read_only;
129129
}
130130
+
131-
+void CefDragDataImpl::SetImage(CefRefPtr<CefImage> image) {
132-
+ base::AutoLock lock_scope(lock_);
133-
+ CHECK_READONLY_RETURN_VOID();
134-
+ image_ = image;
135-
+}
136-
+
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-
+
143131
+CefRefPtr<CefImage> CefDragDataImpl::GetImage() {
144132
+ base::AutoLock lock_scope(lock_);
145133
+ return image_;
@@ -152,11 +140,10 @@ index a8e2c8e1..a5c8940c 100644
152140
+
153141
+bool CefDragDataImpl::HasImage() {
154142
+ base::AutoLock lock_scope(lock_);
155-
+ if (image_) return true;
156-
+ else return false;
143+
+ return image_ ? true : false;
157144
+}
158145
diff --git libcef/common/drag_data_impl.h libcef/common/drag_data_impl.h
159-
index 64f29ed3..68cb3875 100644
146+
index 64f29ed3..37c398d2 100644
160147
--- libcef/common/drag_data_impl.h
161148
+++ libcef/common/drag_data_impl.h
162149
@@ -7,6 +7,7 @@
@@ -171,9 +158,9 @@ index 64f29ed3..68cb3875 100644
171158
public:
172159
CefDragDataImpl();
173160
explicit CefDragDataImpl(const content::DropData& data);
174-
+ explicit CefDragDataImpl(const content::DropData& data,
175-
+ CefRefPtr<CefImage> image,
176-
+ const CefPoint& image_hotspot);
161+
+ CefDragDataImpl(const content::DropData& data,
162+
+ CefRefPtr<CefImage> image,
163+
+ const CefPoint& image_hotspot);
177164

178165
CefRefPtr<CefDragData> Clone() override;
179166
bool IsReadOnly() override;
@@ -187,14 +174,7 @@ index 64f29ed3..68cb3875 100644
187174

188175
// This method is not safe. Use Lock/Unlock to get mutually exclusive access.
189176
content::DropData* drop_data() {
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_; }
177+
@@ -53,6 +60,8 @@ class CefDragDataImpl : public CefDragData {
198178

199179
private:
200180
content::DropData data_;
@@ -351,3 +331,36 @@ index 5b202710..20262388 100644
351331
};
352332

353333
#endif // CEF_LIBCEF_DLL_CTOCPP_DRAG_DATA_CTOCPP_H_
334+
diff --git tests/ceftests/os_rendering_unittest.cc tests/ceftests/os_rendering_unittest.cc
335+
index 8fa110fa..c8f49d9c 100644
336+
--- tests/ceftests/os_rendering_unittest.cc
337+
+++ tests/ceftests/os_rendering_unittest.cc
338+
@@ -1007,6 +1007,28 @@ class OSRTestHandler : public RoutingTestHandler,
339+
CefRenderHandler::DragOperationsMask allowed_ops,
340+
int x, int y) override {
341+
if (test_type_ == OSR_TEST_DRAG_DROP_START_DRAGGING && started()) {
342+
+ // Drag image representation
343+
+ EXPECT_TRUE(drag_data->HasImage());
344+
+ CefRefPtr<CefImage> image = drag_data->GetImage();
345+
+ EXPECT_TRUE(image.get() != NULL);
346+
+ if (image.get()) {
347+
+ // Drag image height seem to be always + 1px greater than
348+
+ // the drag rect on Linux. But whether this is true on all
349+
+ // platforms not sure, so to be safe lets allow it to be
350+
+ // +/- 1px.
351+
+ EXPECT_GE(image->GetWidth(), GetScaledInt(kDragDivRect.width));
352+
+ EXPECT_LE(image->GetWidth(), GetScaledInt(kDragDivRect.width) + 1);
353+
+ EXPECT_GE(image->GetHeight(), GetScaledInt(kDragDivRect.height));
354+
+ EXPECT_LE(image->GetHeight(), GetScaledInt(kDragDivRect.height) + 1);
355+
+ }
356+
+ // During testing hotspot was (15, 23) and with scale_factor 2x
357+
+ // it was (15, 18). I don't know how the algorithm works, so
358+
+ // testing only rect boundaries.
359+
+ CefPoint hotspot = drag_data->GetImageHotspot();
360+
+ EXPECT_GT(hotspot.x, 0);
361+
+ EXPECT_LT(hotspot.x, GetScaledInt(kDragDivRect.width));
362+
+ EXPECT_GT(hotspot.y, 0);
363+
+ EXPECT_LT(hotspot.y, GetScaledInt(kDragDivRect.height));
364+
DestroySucceededTestSoon();
365+
return false;
366+
} else if ((test_type_ == OSR_TEST_DRAG_DROP_UPDATE_CURSOR ||

0 commit comments

Comments
 (0)