| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google 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 23 matching lines...) Expand all Loading... |
| 34 #include "public/platform/WebCanvas.h" | 34 #include "public/platform/WebCanvas.h" |
| 35 #include "public/platform/WebRect.h" | 35 #include "public/platform/WebRect.h" |
| 36 #include "public/platform/WebVector.h" | 36 #include "public/platform/WebVector.h" |
| 37 #include "public/web/WebInputEvent.h" | 37 #include "public/web/WebInputEvent.h" |
| 38 #include "public/web/WebPluginScrollbarClient.h" | 38 #include "public/web/WebPluginScrollbarClient.h" |
| 39 #include "web/ScrollbarGroup.h" | 39 #include "web/ScrollbarGroup.h" |
| 40 #include "web/WebInputEventConversion.h" | 40 #include "web/WebInputEventConversion.h" |
| 41 #include "web/WebPluginContainerImpl.h" | 41 #include "web/WebPluginContainerImpl.h" |
| 42 #include "web/WebViewImpl.h" | 42 #include "web/WebViewImpl.h" |
| 43 | 43 |
| 44 using namespace blink; | |
| 45 | |
| 46 namespace blink { | 44 namespace blink { |
| 47 | 45 |
| 48 WebPluginScrollbar* WebPluginScrollbar::createForPlugin(Orientation orientation, | 46 WebPluginScrollbar* WebPluginScrollbar::createForPlugin(Orientation orientation, |
| 49 WebPluginContainer* plug
inContainer, | 47 WebPluginContainer* plug
inContainer, |
| 50 WebPluginScrollbarClient
* client) | 48 WebPluginScrollbarClient
* client) |
| 51 { | 49 { |
| 52 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(pluginContainer); | 50 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(pluginContainer); |
| 53 return new WebPluginScrollbarImpl(orientation, plugin->scrollbarGroup(), cli
ent); | 51 return new WebPluginScrollbarImpl(orientation, plugin->scrollbarGroup(), cli
ent); |
| 54 } | 52 } |
| 55 | 53 |
| 56 int WebPluginScrollbar::defaultThickness() | 54 int WebPluginScrollbar::defaultThickness() |
| 57 { | 55 { |
| 58 return ScrollbarTheme::theme()->scrollbarThickness(); | 56 return ScrollbarTheme::theme()->scrollbarThickness(); |
| 59 } | 57 } |
| 60 | 58 |
| 61 WebPluginScrollbarImpl::WebPluginScrollbarImpl(Orientation orientation, | 59 WebPluginScrollbarImpl::WebPluginScrollbarImpl(Orientation orientation, |
| 62 ScrollbarGroup* group, | 60 ScrollbarGroup* group, |
| 63 WebPluginScrollbarClient* client) | 61 WebPluginScrollbarClient* client) |
| 64 : m_group(group) | 62 : m_group(group) |
| 65 , m_client(client) | 63 , m_client(client) |
| 66 , m_scrollOffset(0) | 64 , m_scrollOffset(0) |
| 67 { | 65 { |
| 68 m_scrollbar = Scrollbar::create( | 66 m_scrollbar = Scrollbar::create( |
| 69 static_cast<ScrollableArea*>(m_group), | 67 static_cast<ScrollableArea*>(m_group), |
| 70 static_cast<blink::ScrollbarOrientation>(orientation), | 68 static_cast<ScrollbarOrientation>(orientation), |
| 71 blink::RegularScrollbar); | 69 blink::RegularScrollbar); |
| 72 m_group->scrollbarCreated(this); | 70 m_group->scrollbarCreated(this); |
| 73 } | 71 } |
| 74 | 72 |
| 75 WebPluginScrollbarImpl::~WebPluginScrollbarImpl() | 73 WebPluginScrollbarImpl::~WebPluginScrollbarImpl() |
| 76 { | 74 { |
| 77 m_group->scrollbarDestroyed(this); | 75 m_group->scrollbarDestroyed(this); |
| 78 } | 76 } |
| 79 | 77 |
| 80 void WebPluginScrollbarImpl::setScrollOffset(int scrollOffset) | 78 void WebPluginScrollbarImpl::setScrollOffset(int scrollOffset) |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 return static_cast<WebScrollbar::ScrollbarPart>(m_scrollbar->hoveredPart()); | 174 return static_cast<WebScrollbar::ScrollbarPart>(m_scrollbar->hoveredPart()); |
| 177 } | 175 } |
| 178 | 176 |
| 179 WebScrollbar::ScrollbarOverlayStyle WebPluginScrollbarImpl::scrollbarOverlayStyl
e() const | 177 WebScrollbar::ScrollbarOverlayStyle WebPluginScrollbarImpl::scrollbarOverlayStyl
e() const |
| 180 { | 178 { |
| 181 return static_cast<WebScrollbar::ScrollbarOverlayStyle>(m_scrollbar->scrollb
arOverlayStyle()); | 179 return static_cast<WebScrollbar::ScrollbarOverlayStyle>(m_scrollbar->scrollb
arOverlayStyle()); |
| 182 } | 180 } |
| 183 | 181 |
| 184 WebScrollbar::Orientation WebPluginScrollbarImpl::orientation() const | 182 WebScrollbar::Orientation WebPluginScrollbarImpl::orientation() const |
| 185 { | 183 { |
| 186 if (m_scrollbar->orientation() == blink::HorizontalScrollbar) | 184 if (m_scrollbar->orientation() == HorizontalScrollbar) |
| 187 return WebScrollbar::Horizontal; | 185 return WebScrollbar::Horizontal; |
| 188 return WebScrollbar::Vertical; | 186 return WebScrollbar::Vertical; |
| 189 } | 187 } |
| 190 | 188 |
| 191 bool WebPluginScrollbarImpl::isLeftSideVerticalScrollbar() const | 189 bool WebPluginScrollbarImpl::isLeftSideVerticalScrollbar() const |
| 192 { | 190 { |
| 193 return false; | 191 return false; |
| 194 } | 192 } |
| 195 | 193 |
| 196 bool WebPluginScrollbarImpl::isCustomScrollbar() const | 194 bool WebPluginScrollbarImpl::isCustomScrollbar() const |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 blink::ScrollDirection scrollDirection; | 362 blink::ScrollDirection scrollDirection; |
| 365 blink::ScrollGranularity scrollGranularity; | 363 blink::ScrollGranularity scrollGranularity; |
| 366 if (WebViewImpl::mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranu
larity)) { | 364 if (WebViewImpl::mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranu
larity)) { |
| 367 // Will return false if scroll direction wasn't compatible with this scr
ollbar. | 365 // Will return false if scroll direction wasn't compatible with this scr
ollbar. |
| 368 return m_group->scroll(scrollDirection, scrollGranularity); | 366 return m_group->scroll(scrollDirection, scrollGranularity); |
| 369 } | 367 } |
| 370 return false; | 368 return false; |
| 371 } | 369 } |
| 372 | 370 |
| 373 } // namespace blink | 371 } // namespace blink |
| OLD | NEW |