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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
400 { | 400 { |
401 invalidateRect(rect); | 401 invalidateRect(rect); |
402 } | 402 } |
403 | 403 |
404 void WebPluginContainerImpl::reportGeometry() | 404 void WebPluginContainerImpl::reportGeometry() |
405 { | 405 { |
406 // We cannot compute geometry without a parent or renderer. | 406 // We cannot compute geometry without a parent or renderer. |
407 if (!parent() || !m_element->layoutObject()) | 407 if (!parent() || !m_element->layoutObject()) |
408 return; | 408 return; |
409 | 409 |
410 IntRect windowRect, clipRect; | 410 IntRect windowRect, clipRect, unobscuredRect; |
411 Vector<IntRect> cutOutRects; | 411 Vector<IntRect> cutOutRects; |
412 calculateGeometry(frameRect(), windowRect, clipRect, cutOutRects); | 412 calculateGeometry(windowRect, clipRect, unobscuredRect, cutOutRects); |
413 | 413 |
414 m_webPlugin->updateGeometry(windowRect, clipRect, cutOutRects, isVisible()); | 414 m_webPlugin->updateGeometry(windowRect, clipRect, unobscuredRect, cutOutRect s, isVisible()); |
415 | 415 |
416 if (m_scrollbarGroup) { | 416 if (m_scrollbarGroup) { |
417 m_scrollbarGroup->scrollAnimator()->contentsResized(); | 417 m_scrollbarGroup->scrollAnimator()->contentsResized(); |
418 m_scrollbarGroup->setFrameRect(frameRect()); | 418 m_scrollbarGroup->setFrameRect(frameRect()); |
419 } | 419 } |
420 } | 420 } |
421 | 421 |
422 void WebPluginContainerImpl::allowScriptObjects() | 422 void WebPluginContainerImpl::allowScriptObjects() |
423 { | 423 { |
424 } | 424 } |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
958 | 958 |
959 void WebPluginContainerImpl::focusPlugin() | 959 void WebPluginContainerImpl::focusPlugin() |
960 { | 960 { |
961 LocalFrame& containingFrame = toFrameView(parent())->frame(); | 961 LocalFrame& containingFrame = toFrameView(parent())->frame(); |
962 if (Page* currentPage = containingFrame.page()) | 962 if (Page* currentPage = containingFrame.page()) |
963 currentPage->focusController().setFocusedElement(m_element, &containingF rame); | 963 currentPage->focusController().setFocusedElement(m_element, &containingF rame); |
964 else | 964 else |
965 containingFrame.document()->setFocusedElement(m_element); | 965 containingFrame.document()->setFocusedElement(m_element); |
966 } | 966 } |
967 | 967 |
968 void WebPluginContainerImpl::calculateGeometry(const IntRect& frameRect, | 968 void WebPluginContainerImpl::calculateGeometry(IntRect& windowRect, IntRect& cli pRect, IntRect& unobscuredRect, Vector<IntRect>& cutOutRects) |
969 IntRect& windowRect, | |
970 IntRect& clipRect, | |
971 Vector<IntRect>& cutOutRects) | |
972 { | 969 { |
973 windowRect = toFrameView(parent())->contentsToRootFrame(frameRect); | 970 windowRect = toFrameView(parent())->contentsToRootFrame(frameRect()); |
974 | 971 |
975 // Calculate a clip-rect so that we don't overlap the scrollbars, etc. | 972 // Calculate a clip-rect so that we don't overlap the scrollbars, etc. |
976 clipRect = windowClipRect(); | 973 IntRect rawClipRect = |
977 clipRect.move(-windowRect.x(), -windowRect.y()); | |
978 | |
979 getPluginOcclusions(m_element, this->parent(), frameRect, cutOutRects); | |
980 // Convert to the plugin position. | |
981 for (size_t i = 0; i < cutOutRects.size(); i++) | |
982 cutOutRects[i].move(-frameRect.x(), -frameRect.y()); | |
983 } | |
984 | |
985 IntRect WebPluginContainerImpl::windowClipRect() const | |
986 { | |
987 // Start by clipping to our bounds. | |
988 IntRect clipRect = | |
989 convertToContainingWindow(IntRect(0, 0, width(), height())); | 974 convertToContainingWindow(IntRect(0, 0, width(), height())); |
990 | 975 |
991 // document().layoutView() can be 0 when we receive messages from the | 976 // document().layoutView() can be 0 when we receive messages from the |
992 // plugins while we are destroying a frame. | 977 // plugins while we are destroying a frame. |
993 // FIXME: Can we just check m_element->document().isActive() ? | 978 // FIXME: Can we just check m_element->document().isActive() ? |
994 if (m_element->layoutObject()->document().layoutView()) { | 979 if (m_element->layoutObject()->document().layoutView()) { |
995 // Take our element and get the clip rect from the enclosing layer and | 980 // Take our element and get the clip rect from the enclosing layer and |
996 // frame view. | 981 // frame view. |
997 clipRect.intersect( | 982 clipRect = intersection(rawClipRect, m_element->document().view()->windo wClipRectForFrameOwner(m_element)); |
998 m_element->document().view()->windowClipRectForFrameOwner(m_element) ); | 983 unobscuredRect = intersection(rawClipRect, m_element->document().view()- >unobscuredRectForFrameOwner(m_element)); |
999 } | 984 } |
piman
2015/03/24 23:59:21
clipRect and unobscuredRect aren't initialized in
tommycli
2015/03/25 20:18:35
Done.
| |
1000 | 985 |
1001 return clipRect; | 986 clipRect.move(-windowRect.x(), -windowRect.y()); |
987 unobscuredRect.move(-windowRect.x(), -windowRect.y()); | |
988 | |
989 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); | |
990 // Convert to the plugin position. | |
991 for (size_t i = 0; i < cutOutRects.size(); i++) | |
992 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | |
1002 } | 993 } |
1003 | 994 |
1004 bool WebPluginContainerImpl::pluginShouldPersist() const | 995 bool WebPluginContainerImpl::pluginShouldPersist() const |
1005 { | 996 { |
1006 return m_webPlugin->shouldPersist(); | 997 return m_webPlugin->shouldPersist(); |
1007 } | 998 } |
1008 | 999 |
1009 } // namespace blink | 1000 } // namespace blink |
OLD | NEW |