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 std; | |
45 using namespace WebCore; | 44 using namespace WebCore; |
46 | 45 |
47 namespace blink { | 46 namespace blink { |
48 | 47 |
49 WebPluginScrollbar* WebPluginScrollbar::createForPlugin(Orientation orientation, | 48 WebPluginScrollbar* WebPluginScrollbar::createForPlugin(Orientation orientation, |
50 WebPluginContainer* plug
inContainer, | 49 WebPluginContainer* plug
inContainer, |
51 WebPluginScrollbarClient
* client) | 50 WebPluginScrollbarClient
* client) |
52 { | 51 { |
53 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(pluginContainer); | 52 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(pluginContainer); |
54 return new WebPluginScrollbarImpl(orientation, plugin->scrollbarGroup(), cli
ent); | 53 return new WebPluginScrollbarImpl(orientation, plugin->scrollbarGroup(), cli
ent); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 webrect.x += m_scrollbar->x(); | 89 webrect.x += m_scrollbar->x(); |
91 webrect.y += m_scrollbar->y(); | 90 webrect.y += m_scrollbar->y(); |
92 m_client->invalidateScrollbarRect(this, webrect); | 91 m_client->invalidateScrollbarRect(this, webrect); |
93 } | 92 } |
94 | 93 |
95 void WebPluginScrollbarImpl::getTickmarks(Vector<IntRect>& tickmarks) const | 94 void WebPluginScrollbarImpl::getTickmarks(Vector<IntRect>& tickmarks) const |
96 { | 95 { |
97 WebVector<WebRect> ticks; | 96 WebVector<WebRect> ticks; |
98 m_client->getTickmarks(const_cast<WebPluginScrollbarImpl*>(this), &ticks); | 97 m_client->getTickmarks(const_cast<WebPluginScrollbarImpl*>(this), &ticks); |
99 tickmarks.resize(ticks.size()); | 98 tickmarks.resize(ticks.size()); |
100 for (size_t i = 0; i < ticks.size(); ++i) | 99 for (std::size_t i = 0; i < ticks.size(); ++i) |
101 tickmarks[i] = ticks[i]; | 100 tickmarks[i] = ticks[i]; |
102 } | 101 } |
103 | 102 |
104 IntPoint WebPluginScrollbarImpl::convertFromContainingViewToScrollbar(const IntP
oint& parentPoint) const | 103 IntPoint WebPluginScrollbarImpl::convertFromContainingViewToScrollbar(const IntP
oint& parentPoint) const |
105 { | 104 { |
106 IntPoint offset(parentPoint.x() - m_scrollbar->x(), parentPoint.y() - m_scro
llbar->y()); | 105 IntPoint offset(parentPoint.x() - m_scrollbar->x(), parentPoint.y() - m_scro
llbar->y()); |
107 return m_scrollbar->Widget::convertFromContainingView(offset); | 106 return m_scrollbar->Widget::convertFromContainingView(offset); |
108 } | 107 } |
109 | 108 |
110 void WebPluginScrollbarImpl::scrollbarStyleChanged() | 109 void WebPluginScrollbarImpl::scrollbarStyleChanged() |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 WebCore::ScrollDirection scrollDirection; | 364 WebCore::ScrollDirection scrollDirection; |
366 WebCore::ScrollGranularity scrollGranularity; | 365 WebCore::ScrollGranularity scrollGranularity; |
367 if (WebViewImpl::mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranu
larity)) { | 366 if (WebViewImpl::mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranu
larity)) { |
368 // Will return false if scroll direction wasn't compatible with this scr
ollbar. | 367 // Will return false if scroll direction wasn't compatible with this scr
ollbar. |
369 return m_group->scroll(scrollDirection, scrollGranularity); | 368 return m_group->scroll(scrollDirection, scrollGranularity); |
370 } | 369 } |
371 return false; | 370 return false; |
372 } | 371 } |
373 | 372 |
374 } // namespace blink | 373 } // namespace blink |
OLD | NEW |