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

Unified Diff: ui/events/blink/web_input_event_traits.cc

Issue 2683043004: Remove ui/events/blink dependency on blink_minimal. (Closed)
Patch Set: fix win debug Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/blink/web_input_event_traits.cc
diff --git a/ui/events/blink/web_input_event_traits.cc b/ui/events/blink/web_input_event_traits.cc
index 7ca0fac1253277dcbd4c46ec32ee190685b4c02b..9ddc7589419d3f427596beb53a2b044073fea836 100644
--- a/ui/events/blink/web_input_event_traits.cc
+++ b/ui/events/blink/web_input_event_traits.cc
@@ -108,6 +108,17 @@ void ApppendEventDetails(const WebTouchEvent& event, std::string* result) {
result->append(" ]\n}");
}
+struct WebInputEventDelete {
+ template <class EventType>
+ bool Execute(WebInputEvent* event, void*) const {
+ if (!event)
+ return false;
+ DCHECK_EQ(sizeof(EventType), event->size());
+ delete static_cast<EventType*>(event);
+ return true;
+ }
+};
+
struct WebInputEventToString {
template <class EventType>
bool Execute(const WebInputEvent& event, std::string* result) const {
@@ -131,9 +142,9 @@ struct WebInputEventSize {
struct WebInputEventClone {
template <class EventType>
bool Execute(const WebInputEvent& event,
- blink::WebScopedInputEvent* scoped_event) const {
+ WebScopedInputEvent* scoped_event) const {
DCHECK_EQ(sizeof(EventType), event.size());
- *scoped_event = blink::WebScopedInputEvent(
+ *scoped_event = WebScopedInputEvent(
new EventType(static_cast<const EventType&>(event)));
return true;
}
@@ -161,6 +172,13 @@ bool Apply(Operator op,
} // namespace
+void WebInputEventDeleter::operator()(WebInputEvent* event) const {
+ if (!event)
+ return;
+ void* temp = nullptr;
+ Apply(WebInputEventDelete(), event->type(), event, temp);
+}
+
std::string WebInputEventTraits::ToString(const WebInputEvent& event) {
std::string result;
Apply(WebInputEventToString(), event.type(), event, &result);
@@ -173,9 +191,8 @@ size_t WebInputEventTraits::GetSize(WebInputEvent::Type type) {
return size;
}
-blink::WebScopedInputEvent WebInputEventTraits::Clone(
- const WebInputEvent& event) {
- blink::WebScopedInputEvent scoped_event;
+WebScopedInputEvent WebInputEventTraits::Clone(const WebInputEvent& event) {
+ WebScopedInputEvent scoped_event;
Apply(WebInputEventClone(), event.type(), event, &scoped_event);
return scoped_event;
}

Powered by Google App Engine
This is Rietveld 408576698