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

Side by Side Diff: Source/WebKit/chromium/src/WebPluginContainerImpl.cpp

Issue 10656025: Merge 120881 - Perform hit-test from correct frame in isRectTopmost() (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 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
« no previous file with comments | « no previous file | 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 if (!m_textureLayer.isNull()) 454 if (!m_textureLayer.isNull())
455 m_textureLayer.setOpaque(opaque); 455 m_textureLayer.setOpaque(opaque);
456 456
457 if (!m_ioSurfaceLayer.isNull()) 457 if (!m_ioSurfaceLayer.isNull())
458 m_ioSurfaceLayer.setOpaque(opaque); 458 m_ioSurfaceLayer.setOpaque(opaque);
459 #endif 459 #endif
460 } 460 }
461 461
462 bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect) 462 bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect)
463 { 463 {
464 Page* page = m_element->document()->page(); 464 Frame* frame = m_element->document()->frame();
465 if (!page) 465 if (!frame)
466 return false; 466 return false;
467 467
468 // hitTestResultAtPoint() takes a padding rectangle. 468 // hitTestResultAtPoint() takes a padding rectangle.
469 // FIXME: We'll be off by 1 when the width or height is even. 469 // FIXME: We'll be off by 1 when the width or height is even.
470 IntRect documentRect(x() + rect.x, y() + rect.y, rect.width, rect.height); 470 IntRect documentRect(x() + rect.x, y() + rect.y, rect.width, rect.height);
471 LayoutPoint center = documentRect.center(); 471 LayoutPoint center = documentRect.center();
472 // Make the rect we're checking (the point surrounded by padding rects) cont ained inside the requested rect. (Note that -1/2 is 0.) 472 // Make the rect we're checking (the point surrounded by padding rects) cont ained inside the requested rect. (Note that -1/2 is 0.)
473 LayoutSize padding((documentRect.width() - 1) / 2, (documentRect.height() - 1) / 2); 473 LayoutSize padding((documentRect.width() - 1) / 2, (documentRect.height() - 1) / 2);
474 HitTestResult result = 474 HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(center, f alse, false, DontHitTestScrollbars, HitTestRequest::ReadOnly | HitTestRequest::A ctive, padding);
475 page->mainFrame()->eventHandler()->hitTestResultAtPoint(center, false, f alse, DontHitTestScrollbars, HitTestRequest::ReadOnly | HitTestRequest::Active, padding);
476 const HitTestResult::NodeSet& nodes = result.rectBasedTestResult(); 475 const HitTestResult::NodeSet& nodes = result.rectBasedTestResult();
477 if (nodes.size() != 1) 476 if (nodes.size() != 1)
478 return false; 477 return false;
479 return (nodes.first().get() == m_element); 478 return (nodes.first().get() == m_element);
480 } 479 }
481 480
482 void WebPluginContainerImpl::didReceiveResponse(const ResourceResponse& response ) 481 void WebPluginContainerImpl::didReceiveResponse(const ResourceResponse& response )
483 { 482 {
484 // Make sure that the plugin receives window geometry before data, or else 483 // Make sure that the plugin receives window geometry before data, or else
485 // plugins misbehave. 484 // plugins misbehave.
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 // Take our element and get the clip rect from the enclosing layer and 712 // Take our element and get the clip rect from the enclosing layer and
714 // frame view. 713 // frame view.
715 clipRect.intersect( 714 clipRect.intersect(
716 m_element->document()->view()->windowClipRectForFrameOwner(m_element , true)); 715 m_element->document()->view()->windowClipRectForFrameOwner(m_element , true));
717 } 716 }
718 717
719 return clipRect; 718 return clipRect;
720 } 719 }
721 720
722 } // namespace WebKit 721 } // namespace WebKit
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698