OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008, 2009 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 ScrollbarPart oldPart = m_pressedPart; | 138 ScrollbarPart oldPart = m_pressedPart; |
139 Scrollbar::setPressedPart(part); | 139 Scrollbar::setPressedPart(part); |
140 | 140 |
141 updateScrollbarPart(oldPart); | 141 updateScrollbarPart(oldPart); |
142 updateScrollbarPart(part); | 142 updateScrollbarPart(part); |
143 | 143 |
144 updateScrollbarPart(ScrollbarBGPart); | 144 updateScrollbarPart(ScrollbarBGPart); |
145 updateScrollbarPart(TrackBGPart); | 145 updateScrollbarPart(TrackBGPart); |
146 } | 146 } |
147 | 147 |
148 PassRefPtr<LayoutStyle> LayoutScrollbar::getScrollbarPseudoStyle(ScrollbarPart p
artType, PseudoId pseudoId) | 148 PassRefPtr<ComputedStyle> LayoutScrollbar::getScrollbarPseudoStyle(ScrollbarPart
partType, PseudoId pseudoId) |
149 { | 149 { |
150 if (!owningRenderer()) | 150 if (!owningRenderer()) |
151 return nullptr; | 151 return nullptr; |
152 | 152 |
153 RefPtr<LayoutStyle> result = owningRenderer()->getUncachedPseudoStyle(Pseudo
StyleRequest(pseudoId, this, partType), owningRenderer()->style()); | 153 RefPtr<ComputedStyle> result = owningRenderer()->getUncachedPseudoStyle(Pseu
doStyleRequest(pseudoId, this, partType), owningRenderer()->style()); |
154 // Scrollbars for root frames should always have background color | 154 // Scrollbars for root frames should always have background color |
155 // unless explicitly specified as transparent. So we force it. | 155 // unless explicitly specified as transparent. So we force it. |
156 // This is because WebKit assumes scrollbar to be always painted and missing
background | 156 // This is because WebKit assumes scrollbar to be always painted and missing
background |
157 // causes visual artifact like non-paint invalidated dirty region. | 157 // causes visual artifact like non-paint invalidated dirty region. |
158 if (result && m_owningFrame && m_owningFrame->view() && !m_owningFrame->view
()->isTransparent() && !result->hasBackground()) | 158 if (result && m_owningFrame && m_owningFrame->view() && !m_owningFrame->view
()->isTransparent() && !result->hasBackground()) |
159 result->setBackgroundColor(StyleColor(Color::white)); | 159 result->setBackgroundColor(StyleColor(Color::white)); |
160 | 160 |
161 return result; | 161 return result; |
162 } | 162 } |
163 | 163 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 219 } |
220 ASSERT_NOT_REACHED(); | 220 ASSERT_NOT_REACHED(); |
221 return SCROLLBAR; | 221 return SCROLLBAR; |
222 } | 222 } |
223 | 223 |
224 void LayoutScrollbar::updateScrollbarPart(ScrollbarPart partType, bool destroy) | 224 void LayoutScrollbar::updateScrollbarPart(ScrollbarPart partType, bool destroy) |
225 { | 225 { |
226 if (partType == NoPart) | 226 if (partType == NoPart) |
227 return; | 227 return; |
228 | 228 |
229 RefPtr<LayoutStyle> partStyle = !destroy ? getScrollbarPseudoStyle(partType,
pseudoForScrollbarPart(partType)) : PassRefPtr<LayoutStyle>(nullptr); | 229 RefPtr<ComputedStyle> partStyle = !destroy ? getScrollbarPseudoStyle(partTyp
e, pseudoForScrollbarPart(partType)) : PassRefPtr<ComputedStyle>(nullptr); |
230 | 230 |
231 bool needRenderer = !destroy && partStyle && partStyle->display() != NONE; | 231 bool needRenderer = !destroy && partStyle && partStyle->display() != NONE; |
232 | 232 |
233 if (needRenderer && partStyle->display() != BLOCK) { | 233 if (needRenderer && partStyle->display() != BLOCK) { |
234 // See if we are a button that should not be visible according to OS set
tings. | 234 // See if we are a button that should not be visible according to OS set
tings. |
235 ScrollbarButtonsPlacement buttonsPlacement = theme()->buttonsPlacement()
; | 235 ScrollbarButtonsPlacement buttonsPlacement = theme()->buttonsPlacement()
; |
236 switch (partType) { | 236 switch (partType) { |
237 case BackButtonStartPart: | 237 case BackButtonStartPart: |
238 needRenderer = (buttonsPlacement == ScrollbarButtonsSingle || button
sPlacement == ScrollbarButtonsDoubleStart | 238 needRenderer = (buttonsPlacement == ScrollbarButtonsSingle || button
sPlacement == ScrollbarButtonsDoubleStart |
239 || buttonsPlacement == ScrollbarButtonsDoubleBoth); | 239 || buttonsPlacement == ScrollbarButtonsDoubleBoth); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 int LayoutScrollbar::minimumThumbLength() | 346 int LayoutScrollbar::minimumThumbLength() |
347 { | 347 { |
348 LayoutScrollbarPart* partRenderer = m_parts.get(ThumbPart); | 348 LayoutScrollbarPart* partRenderer = m_parts.get(ThumbPart); |
349 if (!partRenderer) | 349 if (!partRenderer) |
350 return 0; | 350 return 0; |
351 partRenderer->layout(); | 351 partRenderer->layout(); |
352 return orientation() == HorizontalScrollbar ? partRenderer->size().width() :
partRenderer->size().height(); | 352 return orientation() == HorizontalScrollbar ? partRenderer->size().width() :
partRenderer->size().height(); |
353 } | 353 } |
354 | 354 |
355 } | 355 } |
OLD | NEW |