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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 ASSERT(!m_horizontalScrollbar); | 49 ASSERT(!m_horizontalScrollbar); |
50 ASSERT(!m_verticalScrollbar); | 50 ASSERT(!m_verticalScrollbar); |
51 } | 51 } |
52 | 52 |
53 void ScrollbarGroup::scrollbarCreated(WebPluginScrollbarImpl* scrollbar) | 53 void ScrollbarGroup::scrollbarCreated(WebPluginScrollbarImpl* scrollbar) |
54 { | 54 { |
55 bool hadScrollbars = m_horizontalScrollbar || m_verticalScrollbar; | 55 bool hadScrollbars = m_horizontalScrollbar || m_verticalScrollbar; |
56 if (scrollbar->scrollbar()->orientation() == HorizontalScrollbar) { | 56 if (scrollbar->scrollbar()->orientation() == HorizontalScrollbar) { |
57 ASSERT(!m_horizontalScrollbar); | 57 ASSERT(!m_horizontalScrollbar); |
58 m_horizontalScrollbar = scrollbar; | 58 m_horizontalScrollbar = scrollbar; |
59 didAddHorizontalScrollbar(scrollbar->scrollbar()); | 59 didAddScrollbar(scrollbar->scrollbar(), HorizontalScrollbar); |
60 } else { | 60 } else { |
61 ASSERT(!m_verticalScrollbar); | 61 ASSERT(!m_verticalScrollbar); |
62 m_verticalScrollbar = scrollbar; | 62 m_verticalScrollbar = scrollbar; |
63 didAddVerticalScrollbar(scrollbar->scrollbar()); | 63 didAddScrollbar(scrollbar->scrollbar(), VerticalScrollbar); |
64 } | 64 } |
65 | 65 |
66 if (!hadScrollbars) { | 66 if (!hadScrollbars) { |
67 m_frameView->addScrollableArea(this); | 67 m_frameView->addScrollableArea(this); |
68 m_frameView->setNeedsLayout(); | 68 m_frameView->setNeedsLayout(); |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
72 void ScrollbarGroup::scrollbarDestroyed(WebPluginScrollbarImpl* scrollbar) | 72 void ScrollbarGroup::scrollbarDestroyed(WebPluginScrollbarImpl* scrollbar) |
73 { | 73 { |
74 if (scrollbar == m_horizontalScrollbar) { | 74 if (scrollbar == m_horizontalScrollbar) { |
75 willRemoveHorizontalScrollbar(scrollbar->scrollbar()); | 75 willRemoveScrollbar(scrollbar->scrollbar(), HorizontalScrollbar); |
76 m_horizontalScrollbar = 0; | 76 m_horizontalScrollbar = 0; |
77 } else { | 77 } else { |
78 ASSERT(scrollbar == m_verticalScrollbar); | 78 ASSERT(scrollbar == m_verticalScrollbar); |
79 willRemoveVerticalScrollbar(scrollbar->scrollbar()); | 79 willRemoveScrollbar(scrollbar->scrollbar(), VerticalScrollbar); |
80 m_verticalScrollbar = 0; | 80 m_verticalScrollbar = 0; |
81 } | 81 } |
82 | 82 |
83 if (!m_horizontalScrollbar && !m_verticalScrollbar) { | 83 if (!m_horizontalScrollbar && !m_verticalScrollbar) { |
84 m_frameView->removeScrollableArea(this); | 84 m_frameView->removeScrollableArea(this); |
85 m_frameView->setNeedsLayout(); | 85 m_frameView->setNeedsLayout(); |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
89 void ScrollbarGroup::setLastMousePosition(const IntPoint& point) | 89 void ScrollbarGroup::setLastMousePosition(const IntPoint& point) |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 } | 286 } |
287 | 287 |
288 int pageStep = std::max( | 288 int pageStep = std::max( |
289 static_cast<int>(static_cast<float>(length) * ScrollableArea::minFractio
nToStepWhenPaging()), | 289 static_cast<int>(static_cast<float>(length) * ScrollableArea::minFractio
nToStepWhenPaging()), |
290 length - ScrollableArea::maxOverlapBetweenPages()); | 290 length - ScrollableArea::maxOverlapBetweenPages()); |
291 | 291 |
292 return std::max(pageStep, 1); | 292 return std::max(pageStep, 1); |
293 } | 293 } |
294 | 294 |
295 } // namespace blink | 295 } // namespace blink |
OLD | NEW |