99 #include "WebScrollbarDrawer.h" |
99 #include "WebScrollbarDrawer.h" |
100 #include "EventNames.h" |
100 #include "EventNames.h" |
101 #include "Editor.h" |
101 #include "Editor.h" |
102 #include "ThumbnailGenerator.h" |
102 #include "ThumbnailGenerator.h" |
103 #include <kjs_window.h> |
103 #include <kjs_window.h> |
|
104 #include "PluginHandler.h" |
104 |
105 |
105 using namespace WebCore; |
106 using namespace WebCore; |
106 using namespace EventNames; |
107 using namespace EventNames; |
107 |
108 |
108 const int KRepaintDelayLoading = 500*1000; // dont do repaints more often than this during loading (0.5s) |
109 const int KRepaintDelayLoading = 500*1000; // dont do repaints more often than this during loading (0.5s) |
222 } |
223 } |
223 |
224 |
224 WebView::~WebView() |
225 WebView::~WebView() |
225 { |
226 { |
226 StaticObjectsContainer::instance()->webCursor()->stopTransparencyTimer(); |
227 StaticObjectsContainer::instance()->webCursor()->stopTransparencyTimer(); |
227 |
228 if ( StaticObjectsContainer::instance()->webCursor()->getCursorWebView() == this) |
|
229 StaticObjectsContainer::instance()->webCursor()->setCurrentView(NULL); |
228 // the zoom handler is a client of WebView (also owned by |
230 // the zoom handler is a client of WebView (also owned by |
229 // WebView--a circular dependency) so it must be deleted before |
231 // WebView--a circular dependency) so it must be deleted before |
230 // the WebView object is destroyed because in its destructor it |
232 // the WebView object is destroyed because in its destructor it |
231 // operates on the WebView object |
233 // operates on the WebView object |
232 delete m_pageZoomHandler; |
234 delete m_pageZoomHandler; |
240 m_page->setGroupName(String()); |
242 m_page->setGroupName(String()); |
241 |
243 |
242 if (m_fastScrollTimer) |
244 if (m_fastScrollTimer) |
243 m_fastScrollTimer->Cancel(); |
245 m_fastScrollTimer->Cancel(); |
244 delete m_fastScrollTimer; |
246 delete m_fastScrollTimer; |
245 |
247 delete m_webpointerEventHandler; |
246 delete m_pinchZoomHandler; |
248 delete m_pinchZoomHandler; |
247 delete m_repainttimer; |
249 delete m_repainttimer; |
248 delete m_webfeptexteditor; |
250 delete m_webfeptexteditor; |
249 delete m_webcorecontext; |
251 delete m_webcorecontext; |
250 delete m_bitmapdevice; |
252 delete m_bitmapdevice; |
256 delete m_pageView; |
258 delete m_pageView; |
257 delete m_webFormFill; |
259 delete m_webFormFill; |
258 delete m_toolbar; |
260 delete m_toolbar; |
259 delete m_toolbarinterface; |
261 delete m_toolbarinterface; |
260 delete m_widgetextension; |
262 delete m_widgetextension; |
261 delete m_webpointerEventHandler; |
263 |
262 delete m_pageScrollHandler; |
264 delete m_pageScrollHandler; |
263 delete m_pluginplayer; |
265 delete m_pluginplayer; |
264 delete m_fepTimer; |
266 delete m_fepTimer; |
265 delete m_waitTimer; |
267 delete m_waitTimer; |
266 delete m_waiter; |
268 delete m_waiter; |
531 m_webcorecontext->resized(); |
533 m_webcorecontext->resized(); |
532 } |
534 } |
533 WebCursor* cursor = StaticObjectsContainer::instance()->webCursor(); |
535 WebCursor* cursor = StaticObjectsContainer::instance()->webCursor(); |
534 if (cursor) { |
536 if (cursor) { |
535 if (visible) { |
537 if (visible) { |
536 cursor->setCurrentView(*this); |
538 cursor->setCurrentView(this); |
537 //Reset the iFocusedElementType to be the same as before the second window is opened. |
539 //Reset the iFocusedElementType to be the same as before the second window is opened. |
538 cursor->setPosition(m_savedCursorPosition); |
540 cursor->setPosition(m_savedCursorPosition); |
539 cursor->updatePositionAndElemType(m_savedCursorPosition); |
541 cursor->updatePositionAndElemType(m_savedCursorPosition); |
540 if ( m_widgetextension && m_focusedElementType == TBrCtlDefs::EElementSelectBox){ |
542 if ( m_widgetextension && m_focusedElementType == TBrCtlDefs::EElementSelectBox){ |
541 m_focusedElementType = TBrCtlDefs::EElementNone; |
543 m_focusedElementType = TBrCtlDefs::EElementNone; |
773 snapshot.Resize(m_brctl->Size()); |
775 snapshot.Resize(m_brctl->Size()); |
774 } |
776 } |
775 mainFrame()->frameView()->draw( *gc, mainFrame()->frameView()->visibleRect() ); |
777 mainFrame()->frameView()->draw( *gc, mainFrame()->frameView()->visibleRect() ); |
776 |
778 |
777 CleanupStack::PopAndDestroy(2); |
779 CleanupStack::PopAndDestroy(2); |
|
780 |
|
781 PluginHandler* pluginHandler = StaticObjectsContainer::instance()->pluginHandler(); |
|
782 if (!m_widgetextension->IsWidgetPublising() && pluginHandler && pluginHandler->getVisiblePlugins().Count() > 0) { |
|
783 (snapshot).Reset(); |
|
784 } |
778 |
785 |
779 } |
786 } |
780 |
787 |
781 //------------------------------------------------------------------------------- |
788 //------------------------------------------------------------------------------- |
782 // WebView::scheduleRepaint |
789 // WebView::scheduleRepaint |
783 // Schedule an asynchronous repaint |
790 // Schedule an asynchronous repaint |
784 //------------------------------------------------------------------------------- |
791 //------------------------------------------------------------------------------- |
785 void WebView::scheduleRepaint( |
792 void WebView::scheduleRepaint( |
786 const TRect& rect ) |
793 const TRect& rect ) |
787 { |
794 { |
|
795 // prevent frameViews to access members when topView is closing down. |
|
796 if( m_isClosing ) |
|
797 return; |
|
798 |
788 m_repaints.AddRect( rect ); |
799 m_repaints.AddRect( rect ); |
789 if( m_widgetextension && m_widgetextension->IsWidgetPublising()) |
800 if( m_widgetextension && m_widgetextension->IsWidgetPublising()) |
790 { |
801 { |
791 #ifdef BRDO_WRT_HS_FF |
802 #ifdef BRDO_WRT_HS_FF |
792 // Draw the miniview |
803 // Draw the miniview |
1933 return TSize((Rect().Size().iWidth-20),(Rect().Size().iHeight-20)); |
1944 return TSize((Rect().Size().iWidth-20),(Rect().Size().iHeight-20)); |
1934 } |
1945 } |
1935 |
1946 |
1936 void WebView::clearOffScreenBitmap() |
1947 void WebView::clearOffScreenBitmap() |
1937 { |
1948 { |
1938 if( !IsVisible() ) |
1949 if ( (!IsVisible()) || ( StaticObjectsContainer::instance()->webSurface()->topView() != this ) ) |
1939 return; |
1950 return; |
1940 |
1951 TSize bmSize = StaticObjectsContainer::instance()->webSurface()->offscreenBitmap()->SizeInPixels(); |
|
1952 if (bmSize.iWidth != Rect().Width() || bmSize.iHeight != Rect().Height()) { |
|
1953 return; |
|
1954 } |
1941 m_webcorecontext->gc().Reset(); |
1955 m_webcorecontext->gc().Reset(); |
1942 m_webcorecontext->gc().Clear(); |
1956 m_webcorecontext->gc().Clear(); |
1943 } |
1957 } |
1944 |
1958 |
1945 void WebView::scrollBuffer(TPoint to, TPoint from, TBool usecopyscroll) |
1959 void WebView::scrollBuffer(TPoint to, TPoint from, TBool usecopyscroll) |
2998 StaticObjectsContainer::instance()->webCursor()->setCursorVisible(showCursor); |
3012 StaticObjectsContainer::instance()->webCursor()->setCursorVisible(showCursor); |
2999 } |
3013 } |
3000 |
3014 |
3001 void WebView::focusedElementChanged(Element* element) |
3015 void WebView::focusedElementChanged(Element* element) |
3002 { |
3016 { |
|
3017 if (!element || !element->document() ||!element->renderer()) return; |
|
3018 |
3003 Frame* frame = element->document()->frame(); |
3019 Frame* frame = element->document()->frame(); |
|
3020 if(!frame || !kit(frame)) return; |
|
3021 |
3004 WebFrameView* fv = kit(frame)->frameView(); |
3022 WebFrameView* fv = kit(frame)->frameView(); |
|
3023 if(!fv) return; |
|
3024 |
3005 if (m_brctl->settings()->getNavigationType() == SettingsContainer::NavigationTypeTabbed || m_brctl->settings()->getNavigationType() == SettingsContainer::NavigationTypeNone) { |
3025 if (m_brctl->settings()->getNavigationType() == SettingsContainer::NavigationTypeTabbed || m_brctl->settings()->getNavigationType() == SettingsContainer::NavigationTypeNone) { |
3006 if (!element || !element->document() ||!element->renderer()) return; |
|
3007 if (element->hasTagName(textareaTag) || (element->hasTagName(inputTag) && (reinterpret_cast<HTMLInputElement*>(element))->isTextField())) { |
3026 if (element->hasTagName(textareaTag) || (element->hasTagName(inputTag) && (reinterpret_cast<HTMLInputElement*>(element))->isTextField())) { |
3008 TPoint point = TRect(element->getRect()).iTl; |
3027 TPoint point = TRect(element->getRect()).iTl; |
3009 point = fv->frameCoordsInViewCoords(point); |
3028 point = fv->frameCoordsInViewCoords(point); |
3010 StaticObjectsContainer::instance()->webCursor()->setPosition(point); |
3029 StaticObjectsContainer::instance()->webCursor()->setPosition(point); |
3011 TPointerEvent event; |
3030 TPointerEvent event; |