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

Side by Side Diff: Tools/DumpRenderTree/chromium/TestRunner/src/WebTestPlugin.cpp

Issue 12088115: Merge 141357 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 7 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 unified diff | Download patch
« no previous file with comments | « Source/WebKit/chromium/src/WebPluginContainerImpl.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 WebPluginContainer* m_container; 228 WebPluginContainer* m_container;
229 229
230 WebRect m_rect; 230 WebRect m_rect;
231 WebGraphicsContext3D* m_context; 231 WebGraphicsContext3D* m_context;
232 unsigned m_colorTexture; 232 unsigned m_colorTexture;
233 unsigned m_framebuffer; 233 unsigned m_framebuffer;
234 Scene m_scene; 234 Scene m_scene;
235 OwnPtr<WebExternalTextureLayer> m_layer; 235 OwnPtr<WebExternalTextureLayer> m_layer;
236 236
237 WebPluginContainer::TouchEventRequestType m_touchEventRequest; 237 WebPluginContainer::TouchEventRequestType m_touchEventRequest;
238 // Requests touch events from the WebPluginContainerImpl multiple times to t ickle webkit.org/b/108381
239 bool m_reRequestTouchEvents;
238 bool m_printEventDetails; 240 bool m_printEventDetails;
239 bool m_printUserGestureStatus; 241 bool m_printUserGestureStatus;
240 bool m_canProcessDrag; 242 bool m_canProcessDrag;
241 }; 243 };
242 244
243 WebTestPluginImpl::WebTestPluginImpl(WebFrame* frame, const WebPluginParams& par ams, WebTestDelegate* delegate) 245 WebTestPluginImpl::WebTestPluginImpl(WebFrame* frame, const WebPluginParams& par ams, WebTestDelegate* delegate)
244 : m_frame(frame) 246 : m_frame(frame)
245 , m_delegate(delegate) 247 , m_delegate(delegate)
246 , m_container(0) 248 , m_container(0)
247 , m_context(0) 249 , m_context(0)
248 , m_touchEventRequest(WebPluginContainer::TouchEventRequestTypeNone) 250 , m_touchEventRequest(WebPluginContainer::TouchEventRequestTypeNone)
251 , m_reRequestTouchEvents(false)
249 , m_printEventDetails(false) 252 , m_printEventDetails(false)
250 , m_printUserGestureStatus(false) 253 , m_printUserGestureStatus(false)
251 , m_canProcessDrag(false) 254 , m_canProcessDrag(false)
252 { 255 {
253 static const WebString kAttributePrimitive = WebString::fromUTF8("primitive" ); 256 static const WebString kAttributePrimitive = WebString::fromUTF8("primitive" );
254 static const WebString kAttributeBackgroundColor = WebString::fromUTF8("back ground-color"); 257 static const WebString kAttributeBackgroundColor = WebString::fromUTF8("back ground-color");
255 static const WebString kAttributePrimitiveColor = WebString::fromUTF8("primi tive-color"); 258 static const WebString kAttributePrimitiveColor = WebString::fromUTF8("primi tive-color");
256 static const WebString kAttributeOpacity = WebString::fromUTF8("opacity"); 259 static const WebString kAttributeOpacity = WebString::fromUTF8("opacity");
257 static const WebString kAttributeAcceptsTouch = WebString::fromUTF8("accepts -touch"); 260 static const WebString kAttributeAcceptsTouch = WebString::fromUTF8("accepts -touch");
261 static const WebString kAttributeReRequestTouchEvents = WebString::fromUTF8( "re-request-touch");
258 static const WebString kAttributePrintEventDetails = WebString::fromUTF8("pr int-event-details"); 262 static const WebString kAttributePrintEventDetails = WebString::fromUTF8("pr int-event-details");
259 static const WebString kAttributeCanProcessDrag = WebString::fromUTF8("can-p rocess-drag"); 263 static const WebString kAttributeCanProcessDrag = WebString::fromUTF8("can-p rocess-drag");
260 static const WebString kAttributePrintUserGestureStatus = WebString::fromUTF 8("print-user-gesture-status"); 264 static const WebString kAttributePrintUserGestureStatus = WebString::fromUTF 8("print-user-gesture-status");
261 265
262 ASSERT(params.attributeNames.size() == params.attributeValues.size()); 266 ASSERT(params.attributeNames.size() == params.attributeValues.size());
263 size_t size = params.attributeNames.size(); 267 size_t size = params.attributeNames.size();
264 for (size_t i = 0; i < size; ++i) { 268 for (size_t i = 0; i < size; ++i) {
265 const WebString& attributeName = params.attributeNames[i]; 269 const WebString& attributeName = params.attributeNames[i];
266 const WebString& attributeValue = params.attributeValues[i]; 270 const WebString& attributeValue = params.attributeValues[i];
267 271
268 if (attributeName == kAttributePrimitive) 272 if (attributeName == kAttributePrimitive)
269 m_scene.primitive = parsePrimitive(attributeValue); 273 m_scene.primitive = parsePrimitive(attributeValue);
270 else if (attributeName == kAttributeBackgroundColor) 274 else if (attributeName == kAttributeBackgroundColor)
271 parseColor(attributeValue, m_scene.backgroundColor); 275 parseColor(attributeValue, m_scene.backgroundColor);
272 else if (attributeName == kAttributePrimitiveColor) 276 else if (attributeName == kAttributePrimitiveColor)
273 parseColor(attributeValue, m_scene.primitiveColor); 277 parseColor(attributeValue, m_scene.primitiveColor);
274 else if (attributeName == kAttributeOpacity) 278 else if (attributeName == kAttributeOpacity)
275 m_scene.opacity = parseOpacity(attributeValue); 279 m_scene.opacity = parseOpacity(attributeValue);
276 else if (attributeName == kAttributeAcceptsTouch) 280 else if (attributeName == kAttributeAcceptsTouch)
277 m_touchEventRequest = parseTouchEventRequestType(attributeValue); 281 m_touchEventRequest = parseTouchEventRequestType(attributeValue);
282 else if (attributeName == kAttributeReRequestTouchEvents)
283 m_reRequestTouchEvents = parseBoolean(attributeValue);
278 else if (attributeName == kAttributePrintEventDetails) 284 else if (attributeName == kAttributePrintEventDetails)
279 m_printEventDetails = parseBoolean(attributeValue); 285 m_printEventDetails = parseBoolean(attributeValue);
280 else if (attributeName == kAttributeCanProcessDrag) 286 else if (attributeName == kAttributeCanProcessDrag)
281 m_canProcessDrag = parseBoolean(attributeValue); 287 m_canProcessDrag = parseBoolean(attributeValue);
282 else if (attributeName == kAttributePrintUserGestureStatus) 288 else if (attributeName == kAttributePrintUserGestureStatus)
283 m_printUserGestureStatus = parseBoolean(attributeValue); 289 m_printUserGestureStatus = parseBoolean(attributeValue);
284 } 290 }
285 } 291 }
286 292
287 WebTestPluginImpl::~WebTestPluginImpl() 293 WebTestPluginImpl::~WebTestPluginImpl()
288 { 294 {
289 } 295 }
290 296
291 bool WebTestPluginImpl::initialize(WebPluginContainer* container) 297 bool WebTestPluginImpl::initialize(WebPluginContainer* container)
292 { 298 {
293 WebGraphicsContext3D::Attributes attrs; 299 WebGraphicsContext3D::Attributes attrs;
294 m_context = Platform::current()->createOffscreenGraphicsContext3D(attrs); 300 m_context = Platform::current()->createOffscreenGraphicsContext3D(attrs);
295 if (!m_context) 301 if (!m_context)
296 return false; 302 return false;
297 303
298 if (!m_context->makeContextCurrent()) 304 if (!m_context->makeContextCurrent())
299 return false; 305 return false;
300 306
301 if (!initScene()) 307 if (!initScene())
302 return false; 308 return false;
303 309
304 m_layer = adoptPtr(Platform::current()->compositorSupport()->createExternalT extureLayer(this)); 310 m_layer = adoptPtr(Platform::current()->compositorSupport()->createExternalT extureLayer(this));
305 m_container = container; 311 m_container = container;
306 m_container->setWebLayer(m_layer->layer()); 312 m_container->setWebLayer(m_layer->layer());
313 if (m_reRequestTouchEvents) {
314 m_container->requestTouchEventType(WebPluginContainer::TouchEventRequest TypeSynthesizedMouse);
315 m_container->requestTouchEventType(WebPluginContainer::TouchEventRequest TypeRaw);
316 }
307 m_container->requestTouchEventType(m_touchEventRequest); 317 m_container->requestTouchEventType(m_touchEventRequest);
308 m_container->setWantsWheelEvents(true); 318 m_container->setWantsWheelEvents(true);
309 return true; 319 return true;
310 } 320 }
311 321
312 void WebTestPluginImpl::destroy() 322 void WebTestPluginImpl::destroy()
313 { 323 {
314 if (m_container) 324 if (m_container)
315 m_container->setWebLayer(0); 325 m_container->setWebLayer(0);
316 m_layer.clear(); 326 m_layer.clear();
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 { 648 {
639 } 649 }
640 650
641 const WebString& WebTestPlugin::mimeType() 651 const WebString& WebTestPlugin::mimeType()
642 { 652 {
643 static const WebString kMimeType = WebString::fromUTF8("application/x-webkit -test-webplugin"); 653 static const WebString kMimeType = WebString::fromUTF8("application/x-webkit -test-webplugin");
644 return kMimeType; 654 return kMimeType;
645 } 655 }
646 656
647 } 657 }
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/WebPluginContainerImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698