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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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<RenderStyle> RenderScrollbar::getScrollbarPseudoStyle(ScrollbarPart p
artType, PseudoId pseudoId) | 148 PassRefPtr<RenderStyle> RenderScrollbar::getScrollbarPseudoStyle(ScrollbarPart p
artType, PseudoId pseudoId) |
149 { | 149 { |
150 if (!owningRenderer()) | 150 if (!owningRenderer()) |
151 return 0; | 151 return nullptr; |
152 | 152 |
153 RefPtr<RenderStyle> result = owningRenderer()->getUncachedPseudoStyle(Pseudo
StyleRequest(pseudoId, this, partType), owningRenderer()->style()); | 153 RefPtr<RenderStyle> result = owningRenderer()->getUncachedPseudoStyle(Pseudo
StyleRequest(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-repainted dirty region. | 157 // causes visual artifact like non-repainted 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; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 } | 216 } |
217 ASSERT_NOT_REACHED(); | 217 ASSERT_NOT_REACHED(); |
218 return SCROLLBAR; | 218 return SCROLLBAR; |
219 } | 219 } |
220 | 220 |
221 void RenderScrollbar::updateScrollbarPart(ScrollbarPart partType, bool destroy) | 221 void RenderScrollbar::updateScrollbarPart(ScrollbarPart partType, bool destroy) |
222 { | 222 { |
223 if (partType == NoPart) | 223 if (partType == NoPart) |
224 return; | 224 return; |
225 | 225 |
226 RefPtr<RenderStyle> partStyle = !destroy ? getScrollbarPseudoStyle(partType,
pseudoForScrollbarPart(partType)) : PassRefPtr<RenderStyle>(0); | 226 RefPtr<RenderStyle> partStyle = !destroy ? getScrollbarPseudoStyle(partType,
pseudoForScrollbarPart(partType)) : PassRefPtr<RenderStyle>(nullptr); |
227 | 227 |
228 bool needRenderer = !destroy && partStyle && partStyle->display() != NONE &&
partStyle->visibility() == VISIBLE; | 228 bool needRenderer = !destroy && partStyle && partStyle->display() != NONE &&
partStyle->visibility() == VISIBLE; |
229 | 229 |
230 if (needRenderer && partStyle->display() != BLOCK) { | 230 if (needRenderer && partStyle->display() != BLOCK) { |
231 // See if we are a button that should not be visible according to OS set
tings. | 231 // See if we are a button that should not be visible according to OS set
tings. |
232 ScrollbarButtonsPlacement buttonsPlacement = theme()->buttonsPlacement()
; | 232 ScrollbarButtonsPlacement buttonsPlacement = theme()->buttonsPlacement()
; |
233 switch (partType) { | 233 switch (partType) { |
234 case BackButtonStartPart: | 234 case BackButtonStartPart: |
235 needRenderer = (buttonsPlacement == ScrollbarButtonsSingle || bu
ttonsPlacement == ScrollbarButtonsDoubleStart || | 235 needRenderer = (buttonsPlacement == ScrollbarButtonsSingle || bu
ttonsPlacement == ScrollbarButtonsDoubleStart || |
236 buttonsPlacement == ScrollbarButtonsDoubleBoth); | 236 buttonsPlacement == ScrollbarButtonsDoubleBoth); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 int RenderScrollbar::minimumThumbLength() | 350 int RenderScrollbar::minimumThumbLength() |
351 { | 351 { |
352 RenderScrollbarPart* partRenderer = m_parts.get(ThumbPart); | 352 RenderScrollbarPart* partRenderer = m_parts.get(ThumbPart); |
353 if (!partRenderer) | 353 if (!partRenderer) |
354 return 0; | 354 return 0; |
355 partRenderer->layout(); | 355 partRenderer->layout(); |
356 return orientation() == HorizontalScrollbar ? partRenderer->width() : partRe
nderer->height(); | 356 return orientation() == HorizontalScrollbar ? partRenderer->width() : partRe
nderer->height(); |
357 } | 357 } |
358 | 358 |
359 } | 359 } |
OLD | NEW |