| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "IntRect.h" | 36 #include "IntRect.h" |
| 37 #include "NotImplemented.h" | 37 #include "NotImplemented.h" |
| 38 #include "Page.h" | 38 #include "Page.h" |
| 39 #include "PlatformScrollBar.h" | 39 #include "PlatformScrollBar.h" |
| 40 #include "PlatformMouseEvent.h" | 40 #include "PlatformMouseEvent.h" |
| 41 #include "PlatformWheelEvent.h" | 41 #include "PlatformWheelEvent.h" |
| 42 #include "Range.h" | 42 #include "Range.h" |
| 43 #include "RenderTheme.h" | 43 #include "RenderTheme.h" |
| 44 #include "ScrollBar.h" | 44 #include "ScrollBar.h" |
| 45 #include "SkiaUtils.h" | 45 #include "SkiaUtils.h" |
| 46 #include "WidgetClientWin.h" | 46 #include "WidgetClientChromium.h" |
| 47 #include <algorithm> | 47 #include <algorithm> |
| 48 #include <wtf/Assertions.h> | 48 #include <wtf/Assertions.h> |
| 49 #include <wtf/HashSet.h> | 49 #include <wtf/HashSet.h> |
| 50 | 50 |
| 51 #undef LOG | 51 #undef LOG |
| 52 #include "base/gfx/platform_canvas_win.h" | 52 #include "base/gfx/platform_canvas_win.h" |
| 53 #include "webkit/glue/webframe_impl.h" | 53 #include "webkit/glue/webframe_impl.h" |
| 54 #include "webkit/glue/webview_impl.h" | 54 #include "webkit/glue/webview_impl.h" |
| 55 | 55 |
| 56 using namespace std; | 56 using namespace std; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 if (m_scrollbarsSuppressed) | 178 if (m_scrollbarsSuppressed) |
| 179 return; | 179 return; |
| 180 | 180 |
| 181 scrollBackingStore(scrollDelta); | 181 scrollBackingStore(scrollDelta); |
| 182 | 182 |
| 183 if (Frame* frame = static_cast<FrameView*>(m_view)->frame()) { | 183 if (Frame* frame = static_cast<FrameView*>(m_view)->frame()) { |
| 184 frame->sendScrollEvent(); | 184 frame->sendScrollEvent(); |
| 185 | 185 |
| 186 // Inform the delegate that the scroll position has changed. | 186 // Inform the delegate that the scroll position has changed. |
| 187 WidgetClientWin* client = | 187 WidgetClientChromium* client = |
| 188 static_cast<WidgetClientWin*>(m_view->client()); | 188 static_cast<WidgetClientChromium*>(m_view->client()); |
| 189 if (client) | 189 if (client) |
| 190 client->onScrollPositionChanged(m_view); | 190 client->onScrollPositionChanged(m_view); |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 | 193 |
| 194 void ScrollView::ScrollViewPrivate::scrollBackingStore(const IntSize& scrollDelt
a) | 194 void ScrollView::ScrollViewPrivate::scrollBackingStore(const IntSize& scrollDelt
a) |
| 195 { | 195 { |
| 196 // Since scrolling is double buffered, we will be blitting the scroll view's
intersection | 196 // Since scrolling is double buffered, we will be blitting the scroll view's
intersection |
| 197 // with the clip rect every time to keep it smooth. | 197 // with the clip rect every time to keep it smooth. |
| 198 | 198 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 266 |
| 267 const Vector<RefPtr<Range> >* ScrollView::ScrollViewPrivate::getTickmarks() cons
t | 267 const Vector<RefPtr<Range> >* ScrollView::ScrollViewPrivate::getTickmarks() cons
t |
| 268 { | 268 { |
| 269 FrameView* view = static_cast<FrameView*>(m_view); | 269 FrameView* view = static_cast<FrameView*>(m_view); |
| 270 ASSERT(view); | 270 ASSERT(view); |
| 271 Frame* frame = view->frame(); | 271 Frame* frame = view->frame(); |
| 272 | 272 |
| 273 if (!frame) | 273 if (!frame) |
| 274 return NULL; // NOTE: Frame can be null for dropdown boxes. | 274 return NULL; // NOTE: Frame can be null for dropdown boxes. |
| 275 | 275 |
| 276 WidgetClientWin* c = static_cast<WidgetClientWin*>(m_view->client()); | 276 WidgetClientChromium* c = |
| 277 static_cast<WidgetClientChromium*>(m_view->client()); |
| 277 ASSERT(c); | 278 ASSERT(c); |
| 278 return c->getTickmarks(view->frame()); | 279 return c->getTickmarks(view->frame()); |
| 279 } | 280 } |
| 280 | 281 |
| 281 size_t ScrollView::ScrollViewPrivate::getActiveTickmarkIndex() const | 282 size_t ScrollView::ScrollViewPrivate::getActiveTickmarkIndex() const |
| 282 { | 283 { |
| 283 FrameView* view = static_cast<FrameView*>(m_view); | 284 FrameView* view = static_cast<FrameView*>(m_view); |
| 284 ASSERT(view); | 285 ASSERT(view); |
| 285 Frame* frame = view->frame(); | 286 Frame* frame = view->frame(); |
| 286 | 287 |
| 287 // NOTE: Frame can be null for dropdown boxes. | 288 // NOTE: Frame can be null for dropdown boxes. |
| 288 if (!frame) | 289 if (!frame) |
| 289 return WidgetClientWin::kNoTickmark; | 290 return WidgetClientChromium::kNoTickmark; |
| 290 | 291 |
| 291 WidgetClientWin* c = static_cast<WidgetClientWin*>(m_view->client()); | 292 WidgetClientChromium* c = |
| 293 static_cast<WidgetClientChromium*>(m_view->client()); |
| 292 ASSERT(c); | 294 ASSERT(c); |
| 293 return c->getActiveTickmarkIndex(view->frame()); | 295 return c->getActiveTickmarkIndex(view->frame()); |
| 294 } | 296 } |
| 295 | 297 |
| 296 const SkBitmap* ScrollView::ScrollViewPrivate::GetPreloadedBitmapFromRenderer( | 298 const SkBitmap* ScrollView::ScrollViewPrivate::GetPreloadedBitmapFromRenderer( |
| 297 int resource_id) const | 299 int resource_id) const |
| 298 { | 300 { |
| 299 WidgetClientWin* c = static_cast<WidgetClientWin*>(m_view->client()); | 301 WidgetClientChromium* c = |
| 302 static_cast<WidgetClientChromium*>(m_view->client()); |
| 300 if (!c) | 303 if (!c) |
| 301 return NULL; | 304 return NULL; |
| 302 | 305 |
| 303 return c->getPreloadedResourceBitmap(resource_id); | 306 return c->getPreloadedResourceBitmap(resource_id); |
| 304 } | 307 } |
| 305 | 308 |
| 306 void ScrollView::ScrollViewPrivate::highlightMatches( | 309 void ScrollView::ScrollViewPrivate::highlightMatches( |
| 307 GraphicsContext* context) const | 310 GraphicsContext* context) const |
| 308 { | 311 { |
| 309 if (context->paintingDisabled()) | 312 if (context->paintingDisabled()) |
| 310 return; | 313 return; |
| 311 | 314 |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 // See if our offset has changed in a situation where we might not have scro
llbars. | 900 // See if our offset has changed in a situation where we might not have scro
llbars. |
| 898 // This can happen when editing a body with overflow:hidden and scrolling to
reveal selection. | 901 // This can happen when editing a body with overflow:hidden and scrolling to
reveal selection. |
| 899 // It can also happen when maximizing a window that has scrollbars (but the
new maximized result | 902 // It can also happen when maximizing a window that has scrollbars (but the
new maximized result |
| 900 // does not). | 903 // does not). |
| 901 IntSize scrollDelta = scroll - m_data->m_scrollOffset; | 904 IntSize scrollDelta = scroll - m_data->m_scrollOffset; |
| 902 if (scrollDelta != IntSize()) { | 905 if (scrollDelta != IntSize()) { |
| 903 m_data->m_scrollOffset = scroll; | 906 m_data->m_scrollOffset = scroll; |
| 904 m_data->scrollBackingStore(scrollDelta); | 907 m_data->scrollBackingStore(scrollDelta); |
| 905 | 908 |
| 906 // Inform the delegate that the scroll position has changed. | 909 // Inform the delegate that the scroll position has changed. |
| 907 WidgetClientWin* c = static_cast<WidgetClientWin*>(client()); | 910 WidgetClientChromium* c = static_cast<WidgetClientChromium*>(client()); |
| 908 if (c) | 911 if (c) |
| 909 c->onScrollPositionChanged(this); | 912 c->onScrollPositionChanged(this); |
| 910 } | 913 } |
| 911 | 914 |
| 912 m_data->m_inUpdateScrollbars = false; | 915 m_data->m_inUpdateScrollbars = false; |
| 913 | 916 |
| 914 ASSERT(visibleWidth() >= 0); | 917 ASSERT(visibleWidth() >= 0); |
| 915 ASSERT(visibleHeight() >= 0); | 918 ASSERT(visibleHeight() >= 0); |
| 916 } | 919 } |
| 917 | 920 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 | 1091 |
| 1089 void ScrollView::setParent(ScrollView* parentView) | 1092 void ScrollView::setParent(ScrollView* parentView) |
| 1090 { | 1093 { |
| 1091 if (!parentView && m_data->m_scrollbarsAvoidingResizer && parent() && parent
()->isFrameView()) | 1094 if (!parentView && m_data->m_scrollbarsAvoidingResizer && parent() && parent
()->isFrameView()) |
| 1092 static_cast<FrameView*>(parent())->adjustOverlappingScrollbarCount(false
); | 1095 static_cast<FrameView*>(parent())->adjustOverlappingScrollbarCount(false
); |
| 1093 Widget::setParent(parentView); | 1096 Widget::setParent(parentView); |
| 1094 } | 1097 } |
| 1095 | 1098 |
| 1096 void ScrollView::addToDirtyRegion(const IntRect& containingWindowRect) | 1099 void ScrollView::addToDirtyRegion(const IntRect& containingWindowRect) |
| 1097 { | 1100 { |
| 1098 WidgetClientWin* c = static_cast<WidgetClientWin*>(client()); | 1101 WidgetClientChromium* c = static_cast<WidgetClientChromium*>(client()); |
| 1099 if (c) | 1102 if (c) |
| 1100 c->invalidateRect(containingWindowRect); | 1103 c->invalidateRect(containingWindowRect); |
| 1101 } | 1104 } |
| 1102 | 1105 |
| 1103 void ScrollView::scrollBackingStore(int dx, int dy, const IntRect& scrollViewRec
t, const IntRect& clipRect) | 1106 void ScrollView::scrollBackingStore(int dx, int dy, const IntRect& scrollViewRec
t, const IntRect& clipRect) |
| 1104 { | 1107 { |
| 1105 // We don't know how to scroll in two directions at once. | 1108 // We don't know how to scroll in two directions at once. |
| 1106 if (dx && dy) { | 1109 if (dx && dy) { |
| 1107 IntRect updateRect = clipRect; | 1110 IntRect updateRect = clipRect; |
| 1108 updateRect.intersect(scrollViewRect); | 1111 updateRect.intersect(scrollViewRect); |
| 1109 addToDirtyRegion(updateRect); | 1112 addToDirtyRegion(updateRect); |
| 1110 return; | 1113 return; |
| 1111 } | 1114 } |
| 1112 | 1115 |
| 1113 WidgetClientWin* c = static_cast<WidgetClientWin*>(client()); | 1116 WidgetClientChromium* c = static_cast<WidgetClientChromium*>(client()); |
| 1114 if (c) { | 1117 if (c) { |
| 1115 // TODO(ericroman): would be better to pass both the scroll rect | 1118 // TODO(ericroman): would be better to pass both the scroll rect |
| 1116 // and clip rect up to the client and let them decide how best to | 1119 // and clip rect up to the client and let them decide how best to |
| 1117 // scroll the backing store. | 1120 // scroll the backing store. |
| 1118 IntRect clippedScrollRect = scrollViewRect; | 1121 IntRect clippedScrollRect = scrollViewRect; |
| 1119 clippedScrollRect.intersect(clipRect); | 1122 clippedScrollRect.intersect(clipRect); |
| 1120 c->scrollRect(dx, dy, clippedScrollRect); | 1123 c->scrollRect(dx, dy, clippedScrollRect); |
| 1121 } | 1124 } |
| 1122 } | 1125 } |
| 1123 | 1126 |
| 1124 void ScrollView::updateBackingStore() | 1127 void ScrollView::updateBackingStore() |
| 1125 { | 1128 { |
| 1126 // nothing to do. painting happens asynchronously. | 1129 // nothing to do. painting happens asynchronously. |
| 1127 } | 1130 } |
| 1128 | 1131 |
| 1129 bool ScrollView::inWindow() const | 1132 bool ScrollView::inWindow() const |
| 1130 { | 1133 { |
| 1131 WidgetClientWin* c = static_cast<WidgetClientWin*>(client()); | 1134 WidgetClientChromium* c = static_cast<WidgetClientChromium*>(client()); |
| 1132 if (!c) | 1135 if (!c) |
| 1133 return false; | 1136 return false; |
| 1134 | 1137 |
| 1135 return !c->isHidden(); | 1138 return !c->isHidden(); |
| 1136 } | 1139 } |
| 1137 | 1140 |
| 1138 void ScrollView::attachToWindow() | 1141 void ScrollView::attachToWindow() |
| 1139 { | 1142 { |
| 1140 if (m_data->m_attachedToWindow) | 1143 if (m_data->m_attachedToWindow) |
| 1141 return; | 1144 return; |
| 1142 | 1145 |
| 1143 m_data->m_attachedToWindow = true; | 1146 m_data->m_attachedToWindow = true; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 | 1223 |
| 1221 updateWindowRect(IntRect(m_data->m_panScrollIconPoint, IntSize(panIconSizeLe
ngth, panIconSizeLength)), true); | 1224 updateWindowRect(IntRect(m_data->m_panScrollIconPoint, IntSize(panIconSizeLe
ngth, panIconSizeLength)), true); |
| 1222 } | 1225 } |
| 1223 | 1226 |
| 1224 bool ScrollView::isScrollable() | 1227 bool ScrollView::isScrollable() |
| 1225 { | 1228 { |
| 1226 return m_data->m_vBar != 0 || m_data->m_hBar != 0; | 1229 return m_data->m_vBar != 0 || m_data->m_hBar != 0; |
| 1227 } | 1230 } |
| 1228 | 1231 |
| 1229 } // namespace WebCore | 1232 } // namespace WebCore |
| OLD | NEW |