39 |
39 |
40 #include "HTMLNames.h" |
40 #include "HTMLNames.h" |
41 #include "GraphicsContext.h" |
41 #include "GraphicsContext.h" |
42 #include "HTMLFormElement.h" |
42 #include "HTMLFormElement.h" |
43 #include "ResourceRequest.h" |
43 #include "ResourceRequest.h" |
44 #include "webkitlogger.h" |
44 #include "WebKitLogger.h" |
45 #include "webutil.h" |
45 #include "WebUtil.h" |
46 #include "PluginSkin.h" |
46 #include "PluginSkin.h" |
47 #include "PluginHandler.h" |
47 #include "PluginHandler.h" |
48 #include "kjs_proxy.h" |
48 #include "kjs_proxy.h" |
49 #if PLATFORM(SYMBIAN) |
49 #if PLATFORM(SYMBIAN) |
50 #include "oom.h" |
50 #include "oom.h" |
278 DocumentLoader* WebFrame::documentLoader() |
278 DocumentLoader* WebFrame::documentLoader() |
279 { |
279 { |
280 return frameLoader()->documentLoader(); |
280 return frameLoader()->documentLoader(); |
281 } |
281 } |
282 |
282 |
283 void WebFrame::notifyPluginsOfPositionChange() |
283 void WebFrame::notifyPluginsOfScrolling() |
284 { |
284 { |
285 PluginHandler* plghandler = StaticObjectsContainer::instance()->pluginHandler(); |
285 setpluginToScroll(true); |
286 WTF::HashSet<PluginSkin*> pluginObjs = plghandler->pluginObjects(); |
286 Frame* coreFrame = core(this); |
287 for(WTF::HashSet<PluginSkin*>::iterator it = pluginObjs.begin() ; it != pluginObjs.end() ; ++it ) { |
287 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) { |
288 PluginSkin* plg = static_cast<PluginSkin*> (*it); |
288 PassRefPtr<HTMLCollection> objects = frame->document()->objects(); |
289 WebFrame* plgWebFrame = plg->getWebFrame(); |
289 for (Node* n = objects->firstItem(); n; n = objects->nextItem()) |
290 CBrCtl* plbrCtl = control(plg->frame()); |
290 notifyPluginOfScrolling(n->renderer()); |
291 CBrCtl* pgbrCtl = control(this); |
291 |
292 |
292 PassRefPtr<HTMLCollection> embeds = frame->document()->embeds(); |
293 if(plbrCtl == pgbrCtl) |
293 for (Node* n = embeds->firstItem(); n; n = embeds->nextItem()) |
294 { |
294 notifyPluginOfScrolling(n->renderer()); |
295 notifyPluginOfPositionChange(static_cast<PluginSkin*> (*it)); |
295 |
296 } |
296 } |
297 } |
297 setpluginToScroll(false); |
298 } |
298 } |
299 |
299 |
300 void WebFrame::notifyPluginOfPositionChange(PluginSkin* plg) |
300 void WebFrame::notifyPluginOfScrolling(RenderObject* renderer) |
301 { |
301 { |
|
302 MWebCoreObjectWidget* view = widget(renderer); |
302 //Don't repaint the plugin objects if Browser is in PageView mode |
303 //Don't repaint the plugin objects if Browser is in PageView mode |
303 if (plg) { |
304 if (view) { |
304 plg->positionChanged(); |
305 view->positionChanged(); |
305 TRect r = m_view->toDocCoords(plg->getPluginWinRect()); |
306 TRect r = m_view->toDocCoords(static_cast<PluginSkin*>(view)->getPluginWinRect()); |
306 m_view->topView()->scheduleRepaint(r); |
307 m_view->topView()->scheduleRepaint(r); |
307 } |
308 } |
308 } |
309 } |
309 |
310 |
310 PluginSkin* WebFrame::focusedPlugin() |
311 PluginSkin* WebFrame::focusedPlugin() |
515 } |
514 } |
516 return result; |
515 return result; |
517 } |
516 } |
518 |
517 |
519 void WebFrame::makeVisiblePlugins(TBool visible) |
518 void WebFrame::makeVisiblePlugins(TBool visible) |
520 { |
519 { |
521 MWebCoreObjectWidget* view = NULL; |
520 MWebCoreObjectWidget* view = NULL; |
522 Frame* coreFrame = core(this); |
521 int pluginCount = 0; |
523 PluginSkin* plg = 0; |
522 Frame* coreFrame = core(this); |
524 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) { |
523 PluginSkin* ptr = 0; |
525 |
524 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) { |
526 PassRefPtr<HTMLCollection> objects = frame->document()->objects(); |
525 |
527 for (Node* n = objects->firstItem(); n; n = objects->nextItem()) { |
526 PassRefPtr<HTMLCollection> objects = frame->document()->objects(); |
528 view = widget(n); |
527 for (Node* n = objects->firstItem(); n; n = objects->nextItem()) { |
529 if (view) { |
|
530 plg = static_cast<PluginSkin*>(view); |
|
531 plg->makeVisible(visible); |
|
532 } |
|
533 } |
|
534 PassRefPtr<HTMLCollection> embeds = frame->document()->embeds(); |
|
535 for (Node* n = embeds->firstItem(); n; n = embeds->nextItem()) { |
|
536 view = widget(n); |
528 view = widget(n); |
537 if (view) { |
529 if (view) { |
538 plg = static_cast<PluginSkin*>(view); |
530 ptr = static_cast<PluginSkin*>(view); |
539 plg->makeVisible(visible); |
531 ptr->makeVisible(visible); |
540 } |
532 } |
|
533 } |
|
534 PassRefPtr<HTMLCollection> embeds = frame->document()->embeds(); |
|
535 for (Node* n = embeds->firstItem(); n; n = embeds->nextItem()) { |
|
536 view = widget(n); |
|
537 if (view) { |
|
538 ptr = static_cast<PluginSkin*>(view); |
|
539 ptr->makeVisible(visible); |
|
540 } |
541 } |
541 } |
542 } |
542 } |
543 } |
543 } |
544 |
544 |
545 |
545 |
557 { |
557 { |
558 IntPoint pt = m_view->viewCoordsInFrameCoords(viewPt); |
558 IntPoint pt = m_view->viewCoordsInFrameCoords(viewPt); |
559 |
559 |
560 Frame* coreFrame = core(this); |
560 Frame* coreFrame = core(this); |
561 |
561 |
562 unsigned int dist = 0xFFFFFFFF; |
562 int dist = 99999999; |
563 Node* result = 0; |
563 Node* result = 0; |
564 //for (Node* n=links->firstItem(); n; n=links->nextItem()) { |
564 //for (Node* n=links->firstItem(); n; n=links->nextItem()) { |
565 for(Node* n = coreFrame->document(); n != 0; n = n->traverseNextNode()) { |
565 for(Node* n = coreFrame->document(); n != 0; n = n->traverseNextNode()) { |
566 if(n->isFocusable() || n->hasTagName(areaTag)) { |
566 if(n->isFocusable() || n->hasTagName(areaTag)) { |
567 IntRect r = n->getRect(); |
567 IntRect r = n->getRect(); |
571 break; |
571 break; |
572 } |
572 } |
573 |
573 |
574 int x = xInRect(r, pt.x()); |
574 int x = xInRect(r, pt.x()); |
575 int y = yInRect(r, pt.y()); |
575 int y = yInRect(r, pt.y()); |
576 unsigned int d = (pt.x() - x) * (pt.x() - x) + (pt.y() - y) * (pt.y() - y); |
576 int d = (pt.x() - x) * (pt.x() - x) + (pt.y() - y) * (pt.y() - y); |
577 if (dist > d) { |
577 if (dist > d) { |
578 dist = d; |
578 dist = d; |
579 result = n; |
579 result = n; |
580 } |
580 } |
581 } |
581 } |
582 } |
582 } |
583 |
583 |
584 // check if we are close enough and calcualte with zoom factor. |
584 // check if we are close enough and calcualte with zoom factor. |
585 if (result && dist< (400/m_view->topView()->scalingFactor() * 100)) { |
585 if (dist< (400/m_view->topView()->scalingFactor() * 100)) { |
586 IntRect r = result->getRect(); |
586 IntRect r = result->getRect(); |
587 r.inflate(-2); |
587 r.inflate(-2); |
588 TPoint docPos(xInRect(r, pt.x()), yInRect(r, pt.y())); |
588 TPoint docPos(xInRect(r, pt.x()), yInRect(r, pt.y())); |
589 newPos = m_view->frameCoordsInViewCoords(docPos); |
589 newPos = m_view->frameCoordsInViewCoords(docPos); |
590 return result; |
590 return result; |
591 } |
591 } |
592 |
592 |
593 return 0; |
593 return 0; |
594 } |
594 } |
595 |
595 |
596 void WebFrame::ScrollOrPinchStatus(bool status) |
|
597 { |
|
598 PluginHandler* plghandler = StaticObjectsContainer::instance()->pluginHandler(); |
|
599 WTF::HashSet<PluginSkin*> pluginObjs = plghandler->pluginObjects(); |
|
600 for(WTF::HashSet<PluginSkin*>::iterator it = pluginObjs.begin() ; it != pluginObjs.end() ; ++it ) |
|
601 { |
|
602 PluginSkin* plg = static_cast<PluginSkin*> (*it); |
|
603 WebFrame* plgWebFrame = plg->getWebFrame(); |
|
604 CBrCtl* plbrCtl = control(plg->frame()); |
|
605 CBrCtl* pgbrCtl = control(this); |
|
606 |
|
607 if(plbrCtl == pgbrCtl) |
|
608 { |
|
609 plg->NotifyPluginsForScrollOrPinch(status); |
|
610 } |
|
611 } |
|
612 |
|
613 |
|
614 } |
|
615 |
|
616 void WebFrame::notifyPluginFocusChangeEvent(TBool visible) |
|
617 { |
|
618 MWebCoreObjectWidget* view = NULL; |
|
619 Frame* coreFrame = core(this); |
|
620 |
|
621 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) { |
|
622 |
|
623 PassRefPtr<HTMLCollection> objects = frame->document()->objects(); |
|
624 for (Node* n = objects->firstItem(); n; n = objects->nextItem()) { |
|
625 view = widget(n); |
|
626 if (view && static_cast<PluginSkin*>(view)->isFlashPlugin()) { |
|
627 if(visible) |
|
628 static_cast<PluginSkin*>(view)->HandleGainingForeground(); |
|
629 else |
|
630 static_cast<PluginSkin*>(view)->HandleLosingForeground(); |
|
631 } |
|
632 } |
|
633 |
|
634 PassRefPtr<HTMLCollection> embeds = frame->document()->embeds(); |
|
635 for (Node* n = embeds->firstItem(); n; n = embeds->nextItem()) { |
|
636 view = widget(n); |
|
637 if (view && static_cast<PluginSkin*>(view)->isFlashPlugin()) { |
|
638 if(visible) |
|
639 static_cast<PluginSkin*>(view)->HandleGainingForeground(); |
|
640 else |
|
641 static_cast<PluginSkin*>(view)->HandleLosingForeground(); |
|
642 } |
|
643 } |
|
644 } |
|
645 |
|
646 } |
|
647 |
|
648 void WebFrame::reCreatePlugins() |
|
649 { |
|
650 MWebCoreObjectWidget* view = NULL; |
|
651 Frame* coreFrame = core(this); |
|
652 PluginSkin* plg = 0; |
|
653 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) { |
|
654 |
|
655 PassRefPtr<HTMLCollection> objects = frame->document()->objects(); |
|
656 for (Node* n = objects->firstItem(); n; n = objects->nextItem()) { |
|
657 view = widget(n); |
|
658 if (view) { |
|
659 plg = static_cast<PluginSkin*>(view); |
|
660 plg->reCreatePlugin(); |
|
661 } |
|
662 } |
|
663 PassRefPtr<HTMLCollection> embeds = frame->document()->embeds(); |
|
664 for (Node* n = embeds->firstItem(); n; n = embeds->nextItem()) { |
|
665 view = widget(n); |
|
666 if (view) { |
|
667 plg = static_cast<PluginSkin*>(view); |
|
668 plg->reCreatePlugin(); |
|
669 } |
|
670 } |
|
671 } |
|
672 } |
|
673 |
|
674 // END OF FILE |
596 // END OF FILE |