| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2011, 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 ASSERT(m_pendingClickEventFromSnapshot); | 485 ASSERT(m_pendingClickEventFromSnapshot); |
| 486 | 486 |
| 487 dispatchSimulatedClick(m_pendingClickEventFromSnapshot.get(), SendMouseOverU
pDownEvents, DoNotShowPressedLook); | 487 dispatchSimulatedClick(m_pendingClickEventFromSnapshot.get(), SendMouseOverU
pDownEvents, DoNotShowPressedLook); |
| 488 | 488 |
| 489 setDisplayState(Playing); | 489 setDisplayState(Playing); |
| 490 m_pendingClickEventFromSnapshot = nullptr; | 490 m_pendingClickEventFromSnapshot = nullptr; |
| 491 } | 491 } |
| 492 | 492 |
| 493 void HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn(const KURL& url) | 493 void HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn(const KURL& url) |
| 494 { | 494 { |
| 495 LOG(Plugins, "%p Plug-in URL: %s", this, m_url.utf8().data()); | 495 LOG_INFO(Plugins, "%p Plug-in URL: %s", this, m_url.utf8().data()); |
| 496 LOG(Plugins, " Loaded URL: %s", url.string().utf8().data()); | 496 LOG_INFO(Plugins, " Loaded URL: %s", url.string().utf8().data()); |
| 497 | 497 |
| 498 m_loadedUrl = url; | 498 m_loadedUrl = url; |
| 499 | 499 |
| 500 if (!document()->page() | 500 if (!document()->page() |
| 501 || !document()->page()->settings()->plugInSnapshottingEnabled()) | 501 || !document()->page()->settings()->plugInSnapshottingEnabled()) |
| 502 return; | 502 return; |
| 503 | 503 |
| 504 if (displayState() == Restarting) { | 504 if (displayState() == Restarting) { |
| 505 setDisplayState(Playing); | 505 setDisplayState(Playing); |
| 506 LOG(Plugins, "%p Plug-in is explicitly restarting", this); | 506 LOG_INFO(Plugins, "%p Plug-in is explicitly restarting", this); |
| 507 return; | 507 return; |
| 508 } | 508 } |
| 509 | 509 |
| 510 if (displayState() == RestartingWithPendingMouseClick) { | 510 if (displayState() == RestartingWithPendingMouseClick) { |
| 511 LOG(Plugins, "%p Plug-in is explicitly restarting but also waiting for a
click", this); | 511 LOG_INFO(Plugins, "%p Plug-in is explicitly restarting but also waiting
for a click", this); |
| 512 return; | 512 return; |
| 513 } | 513 } |
| 514 | 514 |
| 515 bool inMainFrame = document()->frame() == document()->page()->mainFrame(); | 515 bool inMainFrame = document()->frame() == document()->page()->mainFrame(); |
| 516 | 516 |
| 517 if (document()->isPluginDocument() && inMainFrame) { | 517 if (document()->isPluginDocument() && inMainFrame) { |
| 518 LOG(Plugins, "%p Plug-in document in main frame", this); | 518 LOG_INFO(Plugins, "%p Plug-in document in main frame", this); |
| 519 return; | 519 return; |
| 520 } | 520 } |
| 521 | 521 |
| 522 if (ScriptController::processingUserGesture()) { | 522 if (ScriptController::processingUserGesture()) { |
| 523 LOG(Plugins, "%p Script is currently processing user gesture, set to pla
y", this); | 523 LOG_INFO(Plugins, "%p Script is currently processing user gesture, set t
o play", this); |
| 524 return; | 524 return; |
| 525 } | 525 } |
| 526 | 526 |
| 527 if (m_createdDuringUserGesture) { | 527 if (m_createdDuringUserGesture) { |
| 528 LOG(Plugins, "%p Plug-in was created when processing user gesture, set t
o play", this); | 528 LOG_INFO(Plugins, "%p Plug-in was created when processing user gesture,
set to play", this); |
| 529 return; | 529 return; |
| 530 } | 530 } |
| 531 | 531 |
| 532 double lastKnownUserGestureTimestamp = document()->lastHandledUserGestureTim
estamp(); | 532 double lastKnownUserGestureTimestamp = document()->lastHandledUserGestureTim
estamp(); |
| 533 if (!inMainFrame && document()->page()->mainFrame() && document()->page()->m
ainFrame()->document()) | 533 if (!inMainFrame && document()->page()->mainFrame() && document()->page()->m
ainFrame()->document()) |
| 534 lastKnownUserGestureTimestamp = std::max(lastKnownUserGestureTimestamp,
document()->page()->mainFrame()->document()->lastHandledUserGestureTimestamp()); | 534 lastKnownUserGestureTimestamp = std::max(lastKnownUserGestureTimestamp,
document()->page()->mainFrame()->document()->lastHandledUserGestureTimestamp()); |
| 535 if (currentTime() - lastKnownUserGestureTimestamp < autostartSoonAfterUserGe
stureThreshold) { | 535 if (currentTime() - lastKnownUserGestureTimestamp < autostartSoonAfterUserGe
stureThreshold) { |
| 536 LOG(Plugins, "%p Plug-in was created shortly after a user gesture, set t
o play", this); | 536 LOG_INFO(Plugins, "%p Plug-in was created shortly after a user gesture,
set to play", this); |
| 537 return; | 537 return; |
| 538 } | 538 } |
| 539 | 539 |
| 540 RenderBox* renderEmbeddedObject = toRenderBox(renderer()); | 540 RenderBox* renderEmbeddedObject = toRenderBox(renderer()); |
| 541 Length styleWidth = renderEmbeddedObject->style()->width(); | 541 Length styleWidth = renderEmbeddedObject->style()->width(); |
| 542 Length styleHeight = renderEmbeddedObject->style()->height(); | 542 Length styleHeight = renderEmbeddedObject->style()->height(); |
| 543 LayoutRect contentBoxRect = renderEmbeddedObject->contentBoxRect(); | 543 LayoutRect contentBoxRect = renderEmbeddedObject->contentBoxRect(); |
| 544 int contentWidth = contentBoxRect.width(); | 544 int contentWidth = contentBoxRect.width(); |
| 545 int contentHeight = contentBoxRect.height(); | 545 int contentHeight = contentBoxRect.height(); |
| 546 int contentArea = contentWidth * contentHeight; | 546 int contentArea = contentWidth * contentHeight; |
| 547 IntSize visibleViewSize = document()->frame()->view()->visibleSize(); | 547 IntSize visibleViewSize = document()->frame()->view()->visibleSize(); |
| 548 int visibleArea = visibleViewSize.width() * visibleViewSize.height(); | 548 int visibleArea = visibleViewSize.width() * visibleViewSize.height(); |
| 549 | 549 |
| 550 if (inMainFrame && styleWidth.isPercent() && (styleWidth.percent() == 100) | 550 if (inMainFrame && styleWidth.isPercent() && (styleWidth.percent() == 100) |
| 551 && styleHeight.isPercent() && (styleHeight.percent() == 100) | 551 && styleHeight.isPercent() && (styleHeight.percent() == 100) |
| 552 && (static_cast<float>(contentArea) / visibleArea > sizingFullPageAreaRa
tioThreshold)) { | 552 && (static_cast<float>(contentArea) / visibleArea > sizingFullPageAreaRa
tioThreshold)) { |
| 553 LOG(Plugins, "%p Plug-in is top level full page, set to play", this); | 553 LOG_INFO(Plugins, "%p Plug-in is top level full page, set to play", this
); |
| 554 return; | 554 return; |
| 555 } | 555 } |
| 556 | 556 |
| 557 if (contentWidth <= sizingTinyDimensionThreshold || contentHeight <= sizingT
inyDimensionThreshold) { | 557 if (contentWidth <= sizingTinyDimensionThreshold || contentHeight <= sizingT
inyDimensionThreshold) { |
| 558 LOG(Plugins, "%p Plug-in is very small %dx%d, set to play", this, conten
tWidth, contentHeight); | 558 LOG_INFO(Plugins, "%p Plug-in is very small %dx%d, set to play", this, c
ontentWidth, contentHeight); |
| 559 return; | 559 return; |
| 560 } | 560 } |
| 561 | 561 |
| 562 if (!document()->page()->plugInClient()) { | 562 if (!document()->page()->plugInClient()) { |
| 563 setDisplayState(WaitingForSnapshot); | 563 setDisplayState(WaitingForSnapshot); |
| 564 return; | 564 return; |
| 565 } | 565 } |
| 566 | 566 |
| 567 if (document()->page()->plugInClient()->shouldAutoStartFromOrigin(document()
->page()->mainFrame()->document()->baseURL().host(), url.host(), loadedMimeType(
))) { | 567 if (document()->page()->plugInClient()->shouldAutoStartFromOrigin(document()
->page()->mainFrame()->document()->baseURL().host(), url.host(), loadedMimeType(
))) { |
| 568 LOG(Plugins, "%p Plug-in from (%s, %s) is marked to auto-start, set to p
lay", this, document()->page()->mainFrame()->document()->baseURL().host().utf8()
.data(), url.host().utf8().data()); | 568 LOG_INFO(Plugins, "%p Plug-in from (%s, %s) is marked to auto-start, set
to play", this, document()->page()->mainFrame()->document()->baseURL().host().u
tf8().data(), url.host().utf8().data()); |
| 569 return; | 569 return; |
| 570 } | 570 } |
| 571 | 571 |
| 572 LOG(Plugins, "%p Plug-in from (%s, %s) is not auto-start, sized at %dx%d, se
t to wait for snapshot", this, document()->page()->mainFrame()->document()->base
URL().host().utf8().data(), url.host().utf8().data(), contentWidth, contentHeigh
t); | 572 LOG_INFO(Plugins, "%p Plug-in from (%s, %s) is not auto-start, sized at %dx%
d, set to wait for snapshot", this, document()->page()->mainFrame()->document()-
>baseURL().host().utf8().data(), url.host().utf8().data(), contentWidth, content
Height); |
| 573 setDisplayState(WaitingForSnapshot); | 573 setDisplayState(WaitingForSnapshot); |
| 574 } | 574 } |
| 575 | 575 |
| 576 void HTMLPlugInImageElement::subframeLoaderDidCreatePlugIn(const Widget* widget) | 576 void HTMLPlugInImageElement::subframeLoaderDidCreatePlugIn(const Widget* widget) |
| 577 { | 577 { |
| 578 if (!widget->isPluginViewBase() | 578 if (!widget->isPluginViewBase() |
| 579 || !static_cast<const PluginViewBase*>(widget)->shouldAlwaysAutoStart()) | 579 || !static_cast<const PluginViewBase*>(widget)->shouldAlwaysAutoStart()) |
| 580 return; | 580 return; |
| 581 | 581 |
| 582 LOG(Plugins, "%p Plug-in should auto-start, set to play", this); | 582 LOG_INFO(Plugins, "%p Plug-in should auto-start, set to play", this); |
| 583 setDisplayState(Playing); | 583 setDisplayState(Playing); |
| 584 } | 584 } |
| 585 | 585 |
| 586 } // namespace WebCore | 586 } // namespace WebCore |
| OLD | NEW |