| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 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 13 matching lines...) Expand all Loading... |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "core/layout/LayoutScrollbarPart.h" | 27 #include "core/layout/LayoutScrollbarPart.h" |
| 28 | 28 |
| 29 #include "core/frame/FrameView.h" | 29 #include "core/frame/FrameView.h" |
| 30 #include "core/frame/UseCounter.h" | 30 #include "core/frame/UseCounter.h" |
| 31 #include "core/layout/LayoutScrollbar.h" | 31 #include "core/layout/LayoutScrollbar.h" |
| 32 #include "core/layout/LayoutScrollbarTheme.h" | 32 #include "core/layout/LayoutScrollbarTheme.h" |
| 33 #include "core/layout/LayoutView.h" | 33 #include "core/layout/LayoutView.h" |
| 34 #include "core/paint/PaintLayerScrollableArea.h" | |
| 35 #include "platform/LengthFunctions.h" | 34 #include "platform/LengthFunctions.h" |
| 36 | 35 |
| 37 namespace blink { | 36 namespace blink { |
| 38 | 37 |
| 39 LayoutScrollbarPart::LayoutScrollbarPart(LayoutScrollbar* scrollbar, ScrollbarPa
rt part) | 38 LayoutScrollbarPart::LayoutScrollbarPart(LayoutScrollbar* scrollbar, ScrollbarPa
rt part) |
| 40 : LayoutBlock(nullptr) | 39 : LayoutBlock(nullptr) |
| 41 , m_scrollbar(scrollbar) | 40 , m_scrollbar(scrollbar) |
| 42 , m_part(part) | 41 , m_part(part) |
| 43 { | 42 { |
| 44 } | 43 } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 setInline(false); | 172 setInline(false); |
| 174 } | 173 } |
| 175 | 174 |
| 176 void LayoutScrollbarPart::styleDidChange(StyleDifference diff, const ComputedSty
le* oldStyle) | 175 void LayoutScrollbarPart::styleDidChange(StyleDifference diff, const ComputedSty
le* oldStyle) |
| 177 { | 176 { |
| 178 LayoutBlock::styleDidChange(diff, oldStyle); | 177 LayoutBlock::styleDidChange(diff, oldStyle); |
| 179 setInline(false); | 178 setInline(false); |
| 180 clearPositionedState(); | 179 clearPositionedState(); |
| 181 setFloating(false); | 180 setFloating(false); |
| 182 setHasOverflowClip(false); | 181 setHasOverflowClip(false); |
| 183 if (oldStyle && (diff.needsPaintInvalidation() || diff.needsLayout())) | 182 if (oldStyle && m_scrollbar && m_part != NoPart && (diff.needsPaintInvalidat
ion() || diff.needsLayout())) |
| 184 setNeedsPaintInvalidation(); | 183 m_scrollbar->theme()->invalidatePart(m_scrollbar, m_part); |
| 185 } | 184 } |
| 186 | 185 |
| 187 void LayoutScrollbarPart::imageChanged(WrappedImagePtr image, const IntRect* rec
t) | 186 void LayoutScrollbarPart::imageChanged(WrappedImagePtr image, const IntRect* rec
t) |
| 188 { | 187 { |
| 189 setNeedsPaintInvalidation(); | 188 if (m_scrollbar && m_part != NoPart) { |
| 190 LayoutBlock::imageChanged(image, rect); | 189 m_scrollbar->theme()->invalidatePart(m_scrollbar, m_part); |
| 190 } else { |
| 191 if (FrameView* frameView = view()->frameView()) { |
| 192 if (frameView->isFrameViewScrollCorner(this)) { |
| 193 frameView->invalidateScrollCorner(frameView->scrollCornerRect())
; |
| 194 return; |
| 195 } |
| 196 } |
| 197 |
| 198 LayoutBlock::imageChanged(image, rect); |
| 199 } |
| 191 } | 200 } |
| 192 | 201 |
| 193 LayoutObject* LayoutScrollbarPart::layoutObjectOwningScrollbar() const | 202 LayoutObject* LayoutScrollbarPart::layoutObjectOwningScrollbar() const |
| 194 { | 203 { |
| 195 return (!m_scrollbar) ? nullptr : m_scrollbar->owningLayoutObject(); | 204 return (!m_scrollbar) ? nullptr : m_scrollbar->owningLayoutObject(); |
| 196 } | 205 } |
| 197 | 206 |
| 198 void LayoutScrollbarPart::setNeedsPaintInvalidation() | |
| 199 { | |
| 200 if (m_scrollbar) { | |
| 201 m_scrollbar->setNeedsPaintInvalidation(); | |
| 202 return; | |
| 203 } | |
| 204 | |
| 205 // This LayoutScrollbarPart is a scroll corner or a resizer. | |
| 206 ASSERT(m_part == NoPart); | |
| 207 if (FrameView* frameView = view()->frameView()) { | |
| 208 if (frameView->isFrameViewScrollCorner(this)) { | |
| 209 frameView->setScrollCornerNeedsPaintInvalidation(); | |
| 210 return; | |
| 211 } | |
| 212 } | |
| 213 | |
| 214 // This LayoutScrollbarPart belongs to a PaintLayerScrollableArea. | |
| 215 toLayoutBox(parent())->scrollableArea()->setScrollCornerNeedsPaintInvalidati
on(); | |
| 216 } | 207 } |
| 217 | |
| 218 } | |
| OLD | NEW |