24 #include "WebCursor.h" |
24 #include "WebCursor.h" |
25 #include "WebFrameBridge.h" |
25 #include "WebFrameBridge.h" |
26 #include "WebCoreGraphicsContext.h" |
26 #include "WebCoreGraphicsContext.h" |
27 #include "GraphicsContext.h" |
27 #include "GraphicsContext.h" |
28 #include "PlatformScrollbar.h" |
28 #include "PlatformScrollbar.h" |
29 #include "PageScaler.h" |
29 #include "pagescaler.h" |
30 #include "webkitlogger.h" |
30 #include "WebKitLogger.h" |
31 #include "BrCtl.h" |
31 #include "BrCtl.h" |
32 #include "SettingsContainer.h" |
32 #include "SettingsContainer.h" |
33 #include "StaticObjectsContainer.h" |
33 #include "StaticObjectsContainer.h" |
34 #include "WebTabbedNavigation.h" |
34 #include "WebTabbedNavigation.h" |
35 #include "WebPagePinchZoomHandler.h" |
|
36 #include "FocusController.h" |
|
37 #include "Frame.h" |
|
38 #include "page.h" |
|
39 |
35 |
40 using namespace WebCore; |
36 using namespace WebCore; |
41 |
37 |
42 WebFrameView::WebFrameView() : |
38 WebFrameView::WebFrameView() : |
43 m_parent(NULL), |
39 m_parent(NULL), |
73 return this; |
69 return this; |
74 } |
70 } |
75 |
71 |
76 void WebFrameView::draw(WebCoreGraphicsContext& gc, const TRect& r) |
72 void WebFrameView::draw(WebCoreGraphicsContext& gc, const TRect& r) |
77 { |
73 { |
78 if (m_topView->isPinchZoom()) { |
|
79 return; |
|
80 } |
|
81 |
|
82 TRect vr(visibleRect()); |
74 TRect vr(visibleRect()); |
83 TRect rect(r); |
75 TRect rect(r); |
84 |
76 if (isScaled() || m_frame->isFrameSet()) |
|
77 rect.Grow(1,1); // eliminate rounding errors |
85 TRect frameRect(m_frameRect); |
78 TRect frameRect(m_frameRect); |
86 |
79 |
87 rect.Move(-frameRect.iTl); |
80 rect.Move(-frameRect.iTl); |
88 rect.Move(m_contentPos); |
81 rect.Move(m_contentPos); |
89 if (vr.Intersects(rect)) { |
82 if (vr.Intersects(rect)) { |
106 clip.Intersection(t); |
99 clip.Intersection(t); |
107 } |
100 } |
108 |
101 |
109 gc.setClippingRect( clip ); |
102 gc.setClippingRect( clip ); |
110 |
103 |
111 //Converting To Doc and View co-ordinates calculation will loose 1 px |
|
112 //if the scalling is other than default level |
|
113 if (isScaled() || m_frame->isFrameSet()) |
|
114 rect.Grow(2,2); // eliminate rounding errors |
|
115 // draw frame content |
104 // draw frame content |
116 m_frame->paintRect(gc, rect); |
105 m_frame->paintRect(gc, rect); |
117 gc.cancelClipping(); |
106 gc.cancelClipping(); |
118 gc.setOrigin( gc.origin() + cpos); |
107 gc.setOrigin( gc.origin() + cpos); |
119 if (m_parent) { |
108 if (m_parent) { |
129 frameClip = TRect(viewCoordsInFrameCoords(frameClip.iTl), viewCoordsInFrameCoords(frameClip.iBr)); |
118 frameClip = TRect(viewCoordsInFrameCoords(frameClip.iTl), viewCoordsInFrameCoords(frameClip.iBr)); |
130 frameClip = TRect(toViewCoords(frameClip)); |
119 frameClip = TRect(toViewCoords(frameClip)); |
131 frameClip.Move(-cpos); |
120 frameClip.Move(-cpos); |
132 gc.setClippingRect( frameClip ); |
121 gc.setClippingRect( frameClip ); |
133 } |
122 } |
134 |
|
135 // draw frame border |
123 // draw frame border |
136 CFbsBitGc& realgc = gc.gc(); |
124 CFbsBitGc& realgc = gc.gc(); |
137 if (m_hasBorder && !m_frame->isFrameSet()) { |
125 if (m_hasBorder && !m_frame->isFrameSet()) { |
138 // already moved the origin |
126 // already moved the origin |
139 TRect borderRect(TPoint(-1,-1),toViewCoords(m_frameRect).Size()); |
127 TRect borderRect(TPoint(-1,-1),toViewCoords(m_frameRect).Size()); |
286 { |
274 { |
287 TSize s(m_frameRect.Size()); |
275 TSize s(m_frameRect.Size()); |
288 return TRect(m_contentPos, s ); |
276 return TRect(m_contentPos, s ); |
289 } |
277 } |
290 |
278 |
291 void WebFrameView::scrollTo(const TPoint& aPoint, TBool aPluginPause) |
279 void WebFrameView::scrollTo(const TPoint& aPoint) |
292 { |
280 { |
293 |
|
294 if(aPluginPause) |
|
295 m_topView->scrollStatus(ETrue); |
|
296 |
|
297 if (m_parent) { |
281 if (m_parent) { |
298 // tot:fixme frame scrolling when frame-flat is off |
282 // tot:fixme frame scrolling when frame-flat is off |
299 if (m_frame->isIframe()) { |
283 if (m_frame->isIframe()) { |
300 // iframe, support scrolling |
284 // iframe, support scrolling |
301 if (aPoint != m_contentPos) { |
285 if (aPoint != m_contentPos) { |
302 TPoint p(nearestPointInFrame(aPoint)); |
286 TPoint p(nearestPointInFrame(aPoint)); |
303 m_contentPos = p; |
287 m_contentPos = p; |
304 m_frame->notifyPluginsOfPositionChange(); |
288 m_frame->notifyPluginsOfScrolling(); |
305 m_topView->syncRepaint( TRect(0,0,KMaxTInt/2,KMaxTInt/2) ); |
289 m_topView->syncRepaint( TRect(0,0,KMaxTInt/2,KMaxTInt/2) ); |
306 } |
290 } |
307 } |
291 } |
308 else { |
292 else { |
309 if (aPoint.iX==0 && aPoint.iY==0) { |
293 if (aPoint.iX==0 && aPoint.iY==0) { |
334 |
318 |
335 m_topView->scrollBuffer(to, from, copyScroll); |
319 m_topView->scrollBuffer(to, from, copyScroll); |
336 m_contentPos = p; |
320 m_contentPos = p; |
337 |
321 |
338 |
322 |
339 m_frame->notifyPluginsOfPositionChange(); |
323 m_frame->notifyPluginsOfScrolling(); |
340 |
324 |
341 |
325 |
342 if( m_topView->pageScaler() && m_topView->pageScaler()->Visible()) |
326 if( m_topView->pageScaler() && m_topView->pageScaler()->Visible()) |
343 m_topView->pageScaler()->DocumentViewportMoved(); |
327 m_topView->pageScaler()->DocumentViewportMoved(); |
344 |
328 |
419 checkScrollbarVisibility(); |
403 checkScrollbarVisibility(); |
420 |
404 |
421 //maybe the content got smaller and we need to scroll back to view? |
405 //maybe the content got smaller and we need to scroll back to view? |
422 TPoint p( nearestPointInFrame(m_contentPos) ); |
406 TPoint p( nearestPointInFrame(m_contentPos) ); |
423 if (p!=m_contentPos) |
407 if (p!=m_contentPos) |
424 { |
|
425 // this will also update scrollbars is necessary |
408 // this will also update scrollbars is necessary |
426 scrollTo(p); |
409 scrollTo(p); |
427 } |
|
428 else if (!m_parent) { |
410 else if (!m_parent) { |
429 // top level |
411 // top level |
430 m_topView->updateScrollbars(m_contentSize.iHeight, m_contentPos.iY, m_contentSize.iWidth, m_contentPos.iX); |
412 m_topView->updateScrollbars(m_contentSize.iHeight, m_contentPos.iY, m_contentSize.iWidth, m_contentPos.iX); |
431 } |
413 } |
432 } |
414 } |
433 moveFocus(); |
|
434 } |
|
435 |
|
436 void WebFrameView::moveFocus() |
|
437 { |
|
438 // After resizing, move the focus to the correct node |
|
439 if (m_topView && m_topView->focusedElementType() == TBrCtlDefs::EElementAnchor && |
|
440 m_topView->brCtl()->settings()->getNavigationType() == SettingsContainer::NavigationTypeTabbed) { |
|
441 Frame* mainFrame = core(m_topView->mainFrame()); |
|
442 FocusController* focusController = m_topView->page()->focusController(); |
|
443 Frame* focusedFrame = focusController->focusedOrMainFrame(); |
|
444 if (focusedFrame == NULL) { |
|
445 focusedFrame = mainFrame; |
|
446 } |
|
447 Node* node = focusedFrame->document()->focusedNode(); |
|
448 if (node) { |
|
449 TRect rect = node->getRect().Rect(); |
|
450 TPoint viewPoint = kit(focusedFrame)->frameView()->frameCoordsInViewCoords(rect.iTl); |
|
451 WebCursor* cursor = StaticObjectsContainer::instance()->webCursor(); |
|
452 cursor->setPosition(viewPoint); |
|
453 } |
|
454 } |
|
455 } |
415 } |
456 |
416 |
457 void WebFrameView::setMayUseCopyScroll(TBool aCopy) |
417 void WebFrameView::setMayUseCopyScroll(TBool aCopy) |
458 { |
418 { |
459 m_mayUseCopyScroll = aCopy; |
419 m_mayUseCopyScroll = aCopy; |