| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 | 521 |
| 522 bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect) | 522 bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect) |
| 523 { | 523 { |
| 524 if (!m_element) | 524 if (!m_element) |
| 525 return false; | 525 return false; |
| 526 | 526 |
| 527 LocalFrame* frame = m_element->document().frame(); | 527 LocalFrame* frame = m_element->document().frame(); |
| 528 if (!frame) | 528 if (!frame) |
| 529 return false; | 529 return false; |
| 530 | 530 |
| 531 IntRect documentRect(x() + rect.x, y() + rect.y, rect.width, rect.height); |
| 532 // Clip to the frame's visible area. |
| 533 documentRect.intersect(frame->view()->frameRect()); |
| 534 if (documentRect.isEmpty()) |
| 535 return false; |
| 531 // hitTestResultAtPoint() takes a padding rectangle. | 536 // hitTestResultAtPoint() takes a padding rectangle. |
| 532 // FIXME: We'll be off by 1 when the width or height is even. | 537 // FIXME: We'll be off by 1 when the width or height is even. |
| 533 IntRect documentRect(x() + rect.x, y() + rect.y, rect.width, rect.height); | |
| 534 LayoutPoint center = documentRect.center(); | 538 LayoutPoint center = documentRect.center(); |
| 535 // Make the rect we're checking (the point surrounded by padding rects) cont
ained inside the requested rect. (Note that -1/2 is 0.) | 539 // Make the rect we're checking (the point surrounded by padding rects) cont
ained inside the requested rect. (Note that -1/2 is 0.) |
| 536 LayoutSize padding((documentRect.width() - 1) / 2, (documentRect.height() -
1) / 2); | 540 LayoutSize padding((documentRect.width() - 1) / 2, (documentRect.height() -
1) / 2); |
| 537 HitTestResult result = frame->eventHandler().hitTestResultAtPoint(center, Hi
tTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, pad
ding); | 541 HitTestResult result = frame->eventHandler().hitTestResultAtPoint(center, Hi
tTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, pad
ding); |
| 538 const HitTestResult::NodeSet& nodes = result.listBasedTestResult(); | 542 const HitTestResult::NodeSet& nodes = result.listBasedTestResult(); |
| 539 if (nodes.size() != 1) | 543 if (nodes.size() != 1) |
| 540 return false; | 544 return false; |
| 541 return nodes.first().get() == m_element; | 545 return nodes.first().get() == m_element; |
| 542 } | 546 } |
| 543 | 547 |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 for (size_t i = 0; i < cutOutRects.size(); i++) | 973 for (size_t i = 0; i < cutOutRects.size(); i++) |
| 970 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 974 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
| 971 } | 975 } |
| 972 | 976 |
| 973 bool WebPluginContainerImpl::pluginShouldPersist() const | 977 bool WebPluginContainerImpl::pluginShouldPersist() const |
| 974 { | 978 { |
| 975 return m_webPlugin->shouldPersist(); | 979 return m_webPlugin->shouldPersist(); |
| 976 } | 980 } |
| 977 | 981 |
| 978 } // namespace blink | 982 } // namespace blink |
| OLD | NEW |