Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2008 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 | 73 |
| 74 m_theme->registerScrollbar(this); | 74 m_theme->registerScrollbar(this); |
| 75 | 75 |
| 76 // FIXME: This is ugly and would not be necessary if we fix cross-platform c ode to actually query for | 76 // FIXME: This is ugly and would not be necessary if we fix cross-platform c ode to actually query for |
| 77 // scrollbar thickness and use it when sizing scrollbars (rather than leavin g one dimension of the scrollbar | 77 // scrollbar thickness and use it when sizing scrollbars (rather than leavin g one dimension of the scrollbar |
| 78 // alone when sizing). | 78 // alone when sizing). |
| 79 int thickness = m_theme->scrollbarThickness(controlSize); | 79 int thickness = m_theme->scrollbarThickness(controlSize); |
| 80 Widget::setFrameRect(IntRect(0, 0, thickness, thickness)); | 80 Widget::setFrameRect(IntRect(0, 0, thickness, thickness)); |
| 81 | 81 |
| 82 m_currentPos = scrollableAreaCurrentPos(); | 82 m_currentPos = scrollableAreaCurrentPos(); |
| 83 | |
| 84 #if ENABLE(OILPAN) | |
| 85 if (m_scrollableArea) | |
| 86 m_animator = m_scrollableArea->scrollAnimator(); | |
| 87 #endif | |
| 88 } | 83 } |
| 89 | 84 |
| 90 Scrollbar::~Scrollbar() | 85 Scrollbar::~Scrollbar() |
| 91 { | 86 { |
| 92 stopTimerIfNeeded(); | 87 m_theme->unregisterScrollbar(this); |
| 88 } | |
| 93 | 89 |
| 94 m_theme->unregisterScrollbar(this); | 90 DEFINE_TRACE(Scrollbar) |
| 95 | 91 { |
| 96 #if ENABLE(OILPAN) | 92 visitor->trace(m_scrollableArea); |
| 97 if (!m_animator) | 93 Widget::trace(visitor); |
| 98 return; | |
| 99 | |
| 100 ASSERT(m_scrollableArea); | |
| 101 if (m_orientation == VerticalScrollbar) | |
| 102 m_animator->willRemoveVerticalScrollbar(this); | |
| 103 else | |
| 104 m_animator->willRemoveHorizontalScrollbar(this); | |
| 105 #endif | |
| 106 } | 94 } |
| 107 | 95 |
| 108 void Scrollbar::setFrameRect(const IntRect& frameRect) | 96 void Scrollbar::setFrameRect(const IntRect& frameRect) |
| 109 { | 97 { |
| 110 if (frameRect == this->frameRect()) | 98 if (frameRect == this->frameRect()) |
| 111 return; | 99 return; |
| 112 | 100 |
| 113 invalidate(); | 101 invalidate(); |
| 114 Widget::setFrameRect(frameRect); | 102 Widget::setFrameRect(frameRect); |
| 115 invalidate(); | 103 invalidate(); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 146 if (position == m_currentPos) | 134 if (position == m_currentPos) |
| 147 return; | 135 return; |
| 148 | 136 |
| 149 int oldThumbPosition = theme()->thumbPosition(this); | 137 int oldThumbPosition = theme()->thumbPosition(this); |
| 150 m_currentPos = position; | 138 m_currentPos = position; |
| 151 updateThumbPosition(); | 139 updateThumbPosition(); |
| 152 if (m_pressedPart == ThumbPart) | 140 if (m_pressedPart == ThumbPart) |
| 153 setPressedPos(m_pressedPos + theme()->thumbPosition(this) - oldThumbPosi tion); | 141 setPressedPos(m_pressedPos + theme()->thumbPosition(this) - oldThumbPosi tion); |
| 154 } | 142 } |
| 155 | 143 |
| 156 void Scrollbar::disconnectFromScrollableArea() | 144 void Scrollbar::disconnectFromScrollableArea() |
|
haraken
2015/06/30 10:30:36
I'd add #if !ENABLE(OILPAN).
| |
| 157 { | 145 { |
| 158 m_scrollableArea = nullptr; | 146 m_scrollableArea = nullptr; |
| 159 #if ENABLE(OILPAN) | |
| 160 m_animator = nullptr; | |
| 161 #endif | |
| 162 } | 147 } |
| 163 | 148 |
| 164 void Scrollbar::setProportion(int visibleSize, int totalSize) | 149 void Scrollbar::setProportion(int visibleSize, int totalSize) |
| 165 { | 150 { |
| 166 if (visibleSize == m_visibleSize && totalSize == m_totalSize) | 151 if (visibleSize == m_visibleSize && totalSize == m_totalSize) |
| 167 return; | 152 return; |
| 168 | 153 |
| 169 m_visibleSize = visibleSize; | 154 m_visibleSize = visibleSize; |
| 170 m_totalSize = totalSize; | 155 m_totalSize = totalSize; |
| 171 | 156 |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 565 if (!m_scrollableArea) | 550 if (!m_scrollableArea) |
| 566 return 0; | 551 return 0; |
| 567 | 552 |
| 568 if (m_orientation == HorizontalScrollbar) | 553 if (m_orientation == HorizontalScrollbar) |
| 569 return m_scrollableArea->scrollPosition().x() - m_scrollableArea->minimu mScrollPosition().x(); | 554 return m_scrollableArea->scrollPosition().x() - m_scrollableArea->minimu mScrollPosition().x(); |
| 570 | 555 |
| 571 return m_scrollableArea->scrollPosition().y() - m_scrollableArea->minimumScr ollPosition().y(); | 556 return m_scrollableArea->scrollPosition().y() - m_scrollableArea->minimumScr ollPosition().y(); |
| 572 } | 557 } |
| 573 | 558 |
| 574 } // namespace blink | 559 } // namespace blink |
| OLD | NEW |