| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 #include "public/web/WebPlugin.h" | 86 #include "public/web/WebPlugin.h" |
| 87 #include "public/web/WebPrintParams.h" | 87 #include "public/web/WebPrintParams.h" |
| 88 #include "public/web/WebViewClient.h" | 88 #include "public/web/WebViewClient.h" |
| 89 #include "web/ChromeClientImpl.h" | 89 #include "web/ChromeClientImpl.h" |
| 90 #include "web/ScrollbarGroup.h" | 90 #include "web/ScrollbarGroup.h" |
| 91 #include "web/WebDataSourceImpl.h" | 91 #include "web/WebDataSourceImpl.h" |
| 92 #include "web/WebInputEventConversion.h" | 92 #include "web/WebInputEventConversion.h" |
| 93 #include "web/WebViewImpl.h" | 93 #include "web/WebViewImpl.h" |
| 94 #include "wtf/Assertions.h" | 94 #include "wtf/Assertions.h" |
| 95 | 95 |
| 96 | |
| 97 using namespace blink; | |
| 98 | |
| 99 namespace blink { | 96 namespace blink { |
| 100 | 97 |
| 101 // Public methods -------------------------------------------------------------- | 98 // Public methods -------------------------------------------------------------- |
| 102 | 99 |
| 103 void WebPluginContainerImpl::setFrameRect(const IntRect& frameRect) | 100 void WebPluginContainerImpl::setFrameRect(const IntRect& frameRect) |
| 104 { | 101 { |
| 105 Widget::setFrameRect(frameRect); | 102 Widget::setFrameRect(frameRect); |
| 106 reportGeometry(); | 103 reportGeometry(); |
| 107 } | 104 } |
| 108 | 105 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 int WebPluginContainerImpl::getCopiesToPrint() const | 321 int WebPluginContainerImpl::getCopiesToPrint() const |
| 325 { | 322 { |
| 326 return m_webPlugin->getCopiesToPrint(); | 323 return m_webPlugin->getCopiesToPrint(); |
| 327 } | 324 } |
| 328 | 325 |
| 329 int WebPluginContainerImpl::printBegin(const WebPrintParams& printParams) const | 326 int WebPluginContainerImpl::printBegin(const WebPrintParams& printParams) const |
| 330 { | 327 { |
| 331 return m_webPlugin->printBegin(printParams); | 328 return m_webPlugin->printBegin(printParams); |
| 332 } | 329 } |
| 333 | 330 |
| 334 bool WebPluginContainerImpl::printPage(int pageNumber, | 331 bool WebPluginContainerImpl::printPage(int pageNumber, GraphicsContext* gc) |
| 335 blink::GraphicsContext* gc) | |
| 336 { | 332 { |
| 337 gc->save(); | 333 gc->save(); |
| 338 WebCanvas* canvas = gc->canvas(); | 334 WebCanvas* canvas = gc->canvas(); |
| 339 bool ret = m_webPlugin->printPage(pageNumber, canvas); | 335 bool ret = m_webPlugin->printPage(pageNumber, canvas); |
| 340 gc->restore(); | 336 gc->restore(); |
| 341 return ret; | 337 return ret; |
| 342 } | 338 } |
| 343 | 339 |
| 344 void WebPluginContainerImpl::printEnd() | 340 void WebPluginContainerImpl::printEnd() |
| 345 { | 341 { |
| 346 m_webPlugin->printEnd(); | 342 m_webPlugin->printEnd(); |
| 347 } | 343 } |
| 348 | 344 |
| 349 void WebPluginContainerImpl::copy() | 345 void WebPluginContainerImpl::copy() |
| 350 { | 346 { |
| 351 if (!m_webPlugin->hasSelection()) | 347 if (!m_webPlugin->hasSelection()) |
| 352 return; | 348 return; |
| 353 | 349 |
| 354 blink::Platform::current()->clipboard()->writeHTML(m_webPlugin->selectionAsM
arkup(), WebURL(), m_webPlugin->selectionAsText(), false); | 350 Platform::current()->clipboard()->writeHTML(m_webPlugin->selectionAsMarkup()
, WebURL(), m_webPlugin->selectionAsText(), false); |
| 355 } | 351 } |
| 356 | 352 |
| 357 bool WebPluginContainerImpl::executeEditCommand(const WebString& name) | 353 bool WebPluginContainerImpl::executeEditCommand(const WebString& name) |
| 358 { | 354 { |
| 359 if (m_webPlugin->executeEditCommand(name)) | 355 if (m_webPlugin->executeEditCommand(name)) |
| 360 return true; | 356 return true; |
| 361 | 357 |
| 362 if (name != "Copy") | 358 if (name != "Copy") |
| 363 return false; | 359 return false; |
| 364 | 360 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 | 578 |
| 583 WebLayer* WebPluginContainerImpl::platformLayer() const | 579 WebLayer* WebPluginContainerImpl::platformLayer() const |
| 584 { | 580 { |
| 585 return m_webLayer; | 581 return m_webLayer; |
| 586 } | 582 } |
| 587 | 583 |
| 588 v8::Local<v8::Object> WebPluginContainerImpl::scriptableObject(v8::Isolate* isol
ate) | 584 v8::Local<v8::Object> WebPluginContainerImpl::scriptableObject(v8::Isolate* isol
ate) |
| 589 { | 585 { |
| 590 v8::Local<v8::Object> object = m_webPlugin->v8ScriptableObject(isolate); | 586 v8::Local<v8::Object> object = m_webPlugin->v8ScriptableObject(isolate); |
| 591 if (!object.IsEmpty()) { | 587 if (!object.IsEmpty()) { |
| 592 // blink::WebPlugin implementation can't provide the obsolete NPObject a
t the same time: | 588 // WebPlugin implementation can't provide the obsolete NPObject at the s
ame time: |
| 593 ASSERT(!m_webPlugin->scriptableObject()); | 589 ASSERT(!m_webPlugin->scriptableObject()); |
| 594 return object; | 590 return object; |
| 595 } | 591 } |
| 596 | 592 |
| 597 NPObject* npObject = m_webPlugin->scriptableObject(); | 593 NPObject* npObject = m_webPlugin->scriptableObject(); |
| 598 if (npObject) | 594 if (npObject) |
| 599 return blink::createV8ObjectForNPObject(npObject, 0, isolate); | 595 return createV8ObjectForNPObject(npObject, 0, isolate); |
| 600 return v8::Local<v8::Object>(); | 596 return v8::Local<v8::Object>(); |
| 601 } | 597 } |
| 602 | 598 |
| 603 bool WebPluginContainerImpl::getFormValue(String& value) | 599 bool WebPluginContainerImpl::getFormValue(String& value) |
| 604 { | 600 { |
| 605 WebString webValue; | 601 WebString webValue; |
| 606 if (m_webPlugin->getFormValue(webValue)) { | 602 if (m_webPlugin->getFormValue(webValue)) { |
| 607 value = webValue; | 603 value = webValue; |
| 608 return true; | 604 return true; |
| 609 } | 605 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 context->save(); | 658 context->save(); |
| 663 context->setFillColor(Color(0xCC, 0xCC, 0xCC)); | 659 context->setFillColor(Color(0xCC, 0xCC, 0xCC)); |
| 664 context->fillRect(intersection(horizontalOverhangArea, dirtyRect)); | 660 context->fillRect(intersection(horizontalOverhangArea, dirtyRect)); |
| 665 context->fillRect(intersection(verticalOverhangArea, dirtyRect)); | 661 context->fillRect(intersection(verticalOverhangArea, dirtyRect)); |
| 666 context->restore(); | 662 context->restore(); |
| 667 return true; | 663 return true; |
| 668 } | 664 } |
| 669 | 665 |
| 670 // Private methods ------------------------------------------------------------- | 666 // Private methods ------------------------------------------------------------- |
| 671 | 667 |
| 672 WebPluginContainerImpl::WebPluginContainerImpl(blink::HTMLPlugInElement* element
, WebPlugin* webPlugin) | 668 WebPluginContainerImpl::WebPluginContainerImpl(HTMLPlugInElement* element, WebPl
ugin* webPlugin) |
| 673 : blink::FrameDestructionObserver(element->document().frame()) | 669 : FrameDestructionObserver(element->document().frame()) |
| 674 , m_element(element) | 670 , m_element(element) |
| 675 , m_webPlugin(webPlugin) | 671 , m_webPlugin(webPlugin) |
| 676 , m_webLayer(0) | 672 , m_webLayer(0) |
| 677 , m_touchEventRequestType(TouchEventRequestTypeNone) | 673 , m_touchEventRequestType(TouchEventRequestTypeNone) |
| 678 , m_wantsWheelEvents(false) | 674 , m_wantsWheelEvents(false) |
| 679 { | 675 { |
| 680 } | 676 } |
| 681 | 677 |
| 682 WebPluginContainerImpl::~WebPluginContainerImpl() | 678 WebPluginContainerImpl::~WebPluginContainerImpl() |
| 683 { | 679 { |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 // Calculate a clip-rect so that we don't overlap the scrollbars, etc. | 925 // Calculate a clip-rect so that we don't overlap the scrollbars, etc. |
| 930 clipRect = windowClipRect(); | 926 clipRect = windowClipRect(); |
| 931 clipRect.move(-windowRect.x(), -windowRect.y()); | 927 clipRect.move(-windowRect.x(), -windowRect.y()); |
| 932 | 928 |
| 933 getPluginOcclusions(m_element, this->parent(), frameRect, cutOutRects); | 929 getPluginOcclusions(m_element, this->parent(), frameRect, cutOutRects); |
| 934 // Convert to the plugin position. | 930 // Convert to the plugin position. |
| 935 for (size_t i = 0; i < cutOutRects.size(); i++) | 931 for (size_t i = 0; i < cutOutRects.size(); i++) |
| 936 cutOutRects[i].move(-frameRect.x(), -frameRect.y()); | 932 cutOutRects[i].move(-frameRect.x(), -frameRect.y()); |
| 937 } | 933 } |
| 938 | 934 |
| 939 blink::IntRect WebPluginContainerImpl::windowClipRect() const | 935 IntRect WebPluginContainerImpl::windowClipRect() const |
| 940 { | 936 { |
| 941 // Start by clipping to our bounds. | 937 // Start by clipping to our bounds. |
| 942 IntRect clipRect = | 938 IntRect clipRect = |
| 943 convertToContainingWindow(IntRect(0, 0, width(), height())); | 939 convertToContainingWindow(IntRect(0, 0, width(), height())); |
| 944 | 940 |
| 945 // document().renderView() can be 0 when we receive messages from the | 941 // document().renderView() can be 0 when we receive messages from the |
| 946 // plugins while we are destroying a frame. | 942 // plugins while we are destroying a frame. |
| 947 // FIXME: Can we just check m_element->document().isActive() ? | 943 // FIXME: Can we just check m_element->document().isActive() ? |
| 948 if (m_element->renderer()->document().renderView()) { | 944 if (m_element->renderer()->document().renderView()) { |
| 949 // Take our element and get the clip rect from the enclosing layer and | 945 // Take our element and get the clip rect from the enclosing layer and |
| 950 // frame view. | 946 // frame view. |
| 951 clipRect.intersect( | 947 clipRect.intersect( |
| 952 m_element->document().view()->windowClipRectForFrameOwner(m_element)
); | 948 m_element->document().view()->windowClipRectForFrameOwner(m_element)
); |
| 953 } | 949 } |
| 954 | 950 |
| 955 return clipRect; | 951 return clipRect; |
| 956 } | 952 } |
| 957 | 953 |
| 958 bool WebPluginContainerImpl::pluginShouldPersist() const | 954 bool WebPluginContainerImpl::pluginShouldPersist() const |
| 959 { | 955 { |
| 960 return m_webPlugin->shouldPersist(); | 956 return m_webPlugin->shouldPersist(); |
| 961 } | 957 } |
| 962 | 958 |
| 963 } // namespace blink | 959 } // namespace blink |
| OLD | NEW |