OLD | NEW |
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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 } | 446 } |
447 | 447 |
448 bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect) | 448 bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect) |
449 { | 449 { |
450 Page* page = m_element->document()->page(); | 450 Page* page = m_element->document()->page(); |
451 if (!page) | 451 if (!page) |
452 return false; | 452 return false; |
453 | 453 |
454 // hitTestResultAtPoint() takes a padding rectangle. | 454 // hitTestResultAtPoint() takes a padding rectangle. |
455 // FIXME: We'll be off by 1 when the width or height is even. | 455 // FIXME: We'll be off by 1 when the width or height is even. |
456 IntRect windowRect = convertToContainingWindow(static_cast<IntRect>(rect)); | 456 IntRect documentRect(x() + rect.x, y() + rect.y, rect.width, rect.height); |
457 LayoutPoint center = windowRect.center(); | 457 LayoutPoint center = documentRect.center(); |
458 // Make the rect we're checking (the point surrounded by padding rects) cont
ained inside the requested rect. (Note that -1/2 is 0.) | 458 // Make the rect we're checking (the point surrounded by padding rects) cont
ained inside the requested rect. (Note that -1/2 is 0.) |
459 LayoutSize padding((windowRect.width() - 1) / 2, (windowRect.height() - 1) /
2); | 459 LayoutSize padding((documentRect.width() - 1) / 2, (documentRect.height() -
1) / 2); |
460 HitTestResult result = | 460 HitTestResult result = |
461 page->mainFrame()->eventHandler()->hitTestResultAtPoint(center, false, f
alse, DontHitTestScrollbars, HitTestRequest::ReadOnly | HitTestRequest::Active,
padding); | 461 page->mainFrame()->eventHandler()->hitTestResultAtPoint(center, false, f
alse, DontHitTestScrollbars, HitTestRequest::ReadOnly | HitTestRequest::Active,
padding); |
462 const HitTestResult::NodeSet& nodes = result.rectBasedTestResult(); | 462 const HitTestResult::NodeSet& nodes = result.rectBasedTestResult(); |
463 if (nodes.size() != 1) | 463 if (nodes.size() != 1) |
464 return false; | 464 return false; |
465 return (nodes.first().get() == m_element); | 465 return (nodes.first().get() == m_element); |
466 } | 466 } |
467 | 467 |
468 void WebPluginContainerImpl::didReceiveResponse(const ResourceResponse& response
) | 468 void WebPluginContainerImpl::didReceiveResponse(const ResourceResponse& response
) |
469 { | 469 { |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 // frame view. | 695 // frame view. |
696 RenderLayer* layer = m_element->renderer()->enclosingLayer(); | 696 RenderLayer* layer = m_element->renderer()->enclosingLayer(); |
697 clipRect.intersect( | 697 clipRect.intersect( |
698 m_element->document()->view()->windowClipRectForLayer(layer, true)); | 698 m_element->document()->view()->windowClipRectForLayer(layer, true)); |
699 } | 699 } |
700 | 700 |
701 return clipRect; | 701 return clipRect; |
702 } | 702 } |
703 | 703 |
704 } // namespace WebKit | 704 } // namespace WebKit |
OLD | NEW |