| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 117     if (!parent()) | 117     if (!parent()) | 
| 118         return; | 118         return; | 
| 119 | 119 | 
| 120     // Don't paint anything if the plugin doesn't intersect the damage rect. | 120     // Don't paint anything if the plugin doesn't intersect the damage rect. | 
| 121     if (!frameRect().intersects(damageRect)) | 121     if (!frameRect().intersects(damageRect)) | 
| 122         return; | 122         return; | 
| 123 | 123 | 
| 124     gc->save(); | 124     gc->save(); | 
| 125 | 125 | 
| 126     ASSERT(parent()->isFrameView()); | 126     ASSERT(parent()->isFrameView()); | 
| 127     ScrollView* view = parent(); | 127     ScrollView* view =  toScrollView(parent()); | 
| 128 | 128 | 
| 129     // The plugin is positioned in window coordinates, so it needs to be painted | 129     // The plugin is positioned in window coordinates, so it needs to be painted | 
| 130     // in window coordinates. | 130     // in window coordinates. | 
| 131     IntPoint origin = view->contentsToWindow(IntPoint(0, 0)); | 131     IntPoint origin = view->contentsToWindow(IntPoint(0, 0)); | 
| 132     gc->translate(static_cast<float>(-origin.x()), static_cast<float>(-origin.y(
     ))); | 132     gc->translate(static_cast<float>(-origin.x()), static_cast<float>(-origin.y(
     ))); | 
| 133 | 133 | 
| 134     WebCanvas* canvas = gc->canvas(); | 134     WebCanvas* canvas = gc->canvas(); | 
| 135 | 135 | 
| 136     IntRect windowRect = view->contentsToWindow(damageRect); | 136     IntRect windowRect = view->contentsToWindow(damageRect); | 
| 137     m_webPlugin->paint(canvas, windowRect); | 137     m_webPlugin->paint(canvas, windowRect); | 
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 239     if (isParentVisible() == parentVisible) | 239     if (isParentVisible() == parentVisible) | 
| 240         return;  // No change. | 240         return;  // No change. | 
| 241 | 241 | 
| 242     Widget::setParentVisible(parentVisible); | 242     Widget::setParentVisible(parentVisible); | 
| 243     if (!isSelfVisible()) | 243     if (!isSelfVisible()) | 
| 244         return;  // This widget has explicitely been marked as not visible. | 244         return;  // This widget has explicitely been marked as not visible. | 
| 245 | 245 | 
| 246     m_webPlugin->updateVisibility(isVisible()); | 246     m_webPlugin->updateVisibility(isVisible()); | 
| 247 } | 247 } | 
| 248 | 248 | 
| 249 void WebPluginContainerImpl::setParent(ScrollView* view) | 249 void WebPluginContainerImpl::setParent(Widget* widget) | 
| 250 { | 250 { | 
| 251     // We override this function so that if the plugin is windowed, we can call | 251     // We override this function so that if the plugin is windowed, we can call | 
| 252     // NPP_SetWindow at the first possible moment.  This ensures that | 252     // NPP_SetWindow at the first possible moment.  This ensures that | 
| 253     // NPP_SetWindow is called before the manual load data is sent to a plugin. | 253     // NPP_SetWindow is called before the manual load data is sent to a plugin. | 
| 254     // If this order is reversed, Flash won't load videos. | 254     // If this order is reversed, Flash won't load videos. | 
| 255 | 255 | 
| 256     Widget::setParent(view); | 256     Widget::setParent(widget); | 
| 257     if (view) | 257     if (widget) | 
| 258         reportGeometry(); | 258         reportGeometry(); | 
| 259 } | 259 } | 
| 260 | 260 | 
| 261 void WebPluginContainerImpl::setPlugin(WebPlugin* plugin) | 261 void WebPluginContainerImpl::setPlugin(WebPlugin* plugin) | 
| 262 { | 262 { | 
| 263     if (plugin != m_webPlugin) { | 263     if (plugin != m_webPlugin) { | 
| 264         m_element->resetInstance(); | 264         m_element->resetInstance(); | 
| 265         m_webPlugin = plugin; | 265         m_webPlugin = plugin; | 
| 266     } | 266     } | 
| 267 } | 267 } | 
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 516     if (Page* page = m_element->document().page()) { | 516     if (Page* page = m_element->document().page()) { | 
| 517         if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
     tor()) { | 517         if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
     tor()) { | 
| 518             if (parent() && parent()->isFrameView()) | 518             if (parent() && parent()->isFrameView()) | 
| 519                 scrollingCoordinator->frameViewLayoutUpdated(toFrameView(parent(
     ))); | 519                 scrollingCoordinator->frameViewLayoutUpdated(toFrameView(parent(
     ))); | 
| 520         } | 520         } | 
| 521     } | 521     } | 
| 522 } | 522 } | 
| 523 | 523 | 
| 524 WebPoint WebPluginContainerImpl::windowToLocalPoint(const WebPoint& point) | 524 WebPoint WebPluginContainerImpl::windowToLocalPoint(const WebPoint& point) | 
| 525 { | 525 { | 
| 526     ScrollView* view = parent(); | 526     ScrollView* view = toScrollView(parent()); | 
| 527     if (!view) | 527     if (!view) | 
| 528         return point; | 528         return point; | 
| 529     WebPoint windowPoint = view->windowToContents(point); | 529     WebPoint windowPoint = view->windowToContents(point); | 
| 530     return roundedIntPoint(m_element->renderer()->absoluteToLocal(LayoutPoint(wi
     ndowPoint), UseTransforms)); | 530     return roundedIntPoint(m_element->renderer()->absoluteToLocal(LayoutPoint(wi
     ndowPoint), UseTransforms)); | 
| 531 } | 531 } | 
| 532 | 532 | 
| 533 WebPoint WebPluginContainerImpl::localToWindowPoint(const WebPoint& point) | 533 WebPoint WebPluginContainerImpl::localToWindowPoint(const WebPoint& point) | 
| 534 { | 534 { | 
| 535     ScrollView* view = parent(); | 535     ScrollView* view = toScrollView(parent()); | 
| 536     if (!view) | 536     if (!view) | 
| 537         return point; | 537         return point; | 
| 538     IntPoint absolutePoint = roundedIntPoint(m_element->renderer()->localToAbsol
     ute(LayoutPoint(point), UseTransforms)); | 538     IntPoint absolutePoint = roundedIntPoint(m_element->renderer()->localToAbsol
     ute(LayoutPoint(point), UseTransforms)); | 
| 539     return view->contentsToWindow(absolutePoint); | 539     return view->contentsToWindow(absolutePoint); | 
| 540 } | 540 } | 
| 541 | 541 | 
| 542 void WebPluginContainerImpl::didReceiveResponse(const ResourceResponse& response
     ) | 542 void WebPluginContainerImpl::didReceiveResponse(const ResourceResponse& response
     ) | 
| 543 { | 543 { | 
| 544     // Make sure that the plugin receives window geometry before data, or else | 544     // Make sure that the plugin receives window geometry before data, or else | 
| 545     // plugins misbehave. | 545     // plugins misbehave. | 
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 859         currentPage->focusController().setFocusedElement(m_element, &containingF
     rame); | 859         currentPage->focusController().setFocusedElement(m_element, &containingF
     rame); | 
| 860     else | 860     else | 
| 861         containingFrame.document()->setFocusedElement(m_element); | 861         containingFrame.document()->setFocusedElement(m_element); | 
| 862 } | 862 } | 
| 863 | 863 | 
| 864 void WebPluginContainerImpl::calculateGeometry(const IntRect& frameRect, | 864 void WebPluginContainerImpl::calculateGeometry(const IntRect& frameRect, | 
| 865                                                IntRect& windowRect, | 865                                                IntRect& windowRect, | 
| 866                                                IntRect& clipRect, | 866                                                IntRect& clipRect, | 
| 867                                                Vector<IntRect>& cutOutRects) | 867                                                Vector<IntRect>& cutOutRects) | 
| 868 { | 868 { | 
| 869     windowRect = parent()->contentsToWindow(frameRect); | 869     windowRect = toScrollView(parent())->contentsToWindow(frameRect); | 
| 870 | 870 | 
| 871     // Calculate a clip-rect so that we don't overlap the scrollbars, etc. | 871     // Calculate a clip-rect so that we don't overlap the scrollbars, etc. | 
| 872     clipRect = windowClipRect(); | 872     clipRect = windowClipRect(); | 
| 873     clipRect.move(-windowRect.x(), -windowRect.y()); | 873     clipRect.move(-windowRect.x(), -windowRect.y()); | 
| 874 | 874 | 
| 875     getPluginOcclusions(m_element, this->parent(), frameRect, cutOutRects); | 875     getPluginOcclusions(m_element, this->parent(), frameRect, cutOutRects); | 
| 876     // Convert to the plugin position. | 876     // Convert to the plugin position. | 
| 877     for (size_t i = 0; i < cutOutRects.size(); i++) | 877     for (size_t i = 0; i < cutOutRects.size(); i++) | 
| 878         cutOutRects[i].move(-frameRect.x(), -frameRect.y()); | 878         cutOutRects[i].move(-frameRect.x(), -frameRect.y()); | 
| 879 } | 879 } | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 891         // Take our element and get the clip rect from the enclosing layer and | 891         // Take our element and get the clip rect from the enclosing layer and | 
| 892         // frame view. | 892         // frame view. | 
| 893         clipRect.intersect( | 893         clipRect.intersect( | 
| 894             m_element->document().view()->windowClipRectForFrameOwner(m_element,
      true)); | 894             m_element->document().view()->windowClipRectForFrameOwner(m_element,
      true)); | 
| 895     } | 895     } | 
| 896 | 896 | 
| 897     return clipRect; | 897     return clipRect; | 
| 898 } | 898 } | 
| 899 | 899 | 
| 900 } // namespace WebKit | 900 } // namespace WebKit | 
| OLD | NEW | 
|---|