| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "web/ScrollbarGroup.h" | 27 #include "web/ScrollbarGroup.h" |
| 28 | 28 |
| 29 #include "core/frame/FrameView.h" | 29 #include "core/frame/FrameView.h" |
| 30 #include "platform/scroll/Scrollbar.h" | 30 #include "platform/scroll/Scrollbar.h" |
| 31 #include "platform/scroll/ScrollbarTheme.h" | 31 #include "platform/scroll/ScrollbarTheme.h" |
| 32 #include "public/platform/WebRect.h" | 32 #include "public/platform/WebRect.h" |
| 33 #include "web/WebPluginScrollbarImpl.h" | 33 #include "web/WebPluginScrollbarImpl.h" |
| 34 | 34 |
| 35 using namespace blink; | |
| 36 | |
| 37 namespace blink { | 35 namespace blink { |
| 38 | 36 |
| 39 ScrollbarGroup::ScrollbarGroup(FrameView* frameView, const IntRect& frameRect) | 37 ScrollbarGroup::ScrollbarGroup(FrameView* frameView, const IntRect& frameRect) |
| 40 : m_frameView(frameView) | 38 : m_frameView(frameView) |
| 41 , m_frameRect(frameRect) | 39 , m_frameRect(frameRect) |
| 42 , m_horizontalScrollbar(0) | 40 , m_horizontalScrollbar(0) |
| 43 , m_verticalScrollbar(0) | 41 , m_verticalScrollbar(0) |
| 44 { | 42 { |
| 45 } | 43 } |
| 46 | 44 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 m_frameView->removeScrollableArea(this); | 82 m_frameView->removeScrollableArea(this); |
| 85 m_frameView->setNeedsLayout(); | 83 m_frameView->setNeedsLayout(); |
| 86 } | 84 } |
| 87 } | 85 } |
| 88 | 86 |
| 89 void ScrollbarGroup::setLastMousePosition(const IntPoint& point) | 87 void ScrollbarGroup::setLastMousePosition(const IntPoint& point) |
| 90 { | 88 { |
| 91 m_lastMousePosition = point; | 89 m_lastMousePosition = point; |
| 92 } | 90 } |
| 93 | 91 |
| 94 int ScrollbarGroup::scrollSize(blink::ScrollbarOrientation orientation) const | 92 int ScrollbarGroup::scrollSize(ScrollbarOrientation orientation) const |
| 95 { | 93 { |
| 96 WebPluginScrollbarImpl* webScrollbar = orientation == HorizontalScrollbar ?
m_horizontalScrollbar : m_verticalScrollbar; | 94 WebPluginScrollbarImpl* webScrollbar = orientation == HorizontalScrollbar ?
m_horizontalScrollbar : m_verticalScrollbar; |
| 97 if (!webScrollbar) | 95 if (!webScrollbar) |
| 98 return 0; | 96 return 0; |
| 99 Scrollbar* scrollbar = webScrollbar->scrollbar(); | 97 Scrollbar* scrollbar = webScrollbar->scrollbar(); |
| 100 return scrollbar->totalSize() - scrollbar->visibleSize(); | 98 return scrollbar->totalSize() - scrollbar->visibleSize(); |
| 101 } | 99 } |
| 102 | 100 |
| 103 void ScrollbarGroup::setScrollOffset(const IntPoint& offset) | 101 void ScrollbarGroup::setScrollOffset(const IntPoint& offset) |
| 104 { | 102 { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 } | 275 } |
| 278 | 276 |
| 279 int pageStep = std::max( | 277 int pageStep = std::max( |
| 280 static_cast<int>(static_cast<float>(length) * ScrollableArea::minFractio
nToStepWhenPaging()), | 278 static_cast<int>(static_cast<float>(length) * ScrollableArea::minFractio
nToStepWhenPaging()), |
| 281 length - ScrollableArea::maxOverlapBetweenPages()); | 279 length - ScrollableArea::maxOverlapBetweenPages()); |
| 282 | 280 |
| 283 return std::max(pageStep, 1); | 281 return std::max(pageStep, 1); |
| 284 } | 282 } |
| 285 | 283 |
| 286 } // namespace blink | 284 } // namespace blink |
| OLD | NEW |