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" | |
34 #include "platform/LengthFunctions.h" | 35 #include "platform/LengthFunctions.h" |
35 | 36 |
36 namespace blink { | 37 namespace blink { |
37 | 38 |
38 LayoutScrollbarPart::LayoutScrollbarPart(LayoutScrollbar* scrollbar, ScrollbarPa rt part) | 39 LayoutScrollbarPart::LayoutScrollbarPart(LayoutScrollbar* scrollbar, ScrollbarPa rt part) |
39 : LayoutBlock(nullptr) | 40 : LayoutBlock(nullptr) |
40 , m_scrollbar(scrollbar) | 41 , m_scrollbar(scrollbar) |
41 , m_part(part) | 42 , m_part(part) |
42 { | 43 { |
43 } | 44 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
172 setInline(false); | 173 setInline(false); |
173 } | 174 } |
174 | 175 |
175 void LayoutScrollbarPart::styleDidChange(StyleDifference diff, const ComputedSty le* oldStyle) | 176 void LayoutScrollbarPart::styleDidChange(StyleDifference diff, const ComputedSty le* oldStyle) |
176 { | 177 { |
177 LayoutBlock::styleDidChange(diff, oldStyle); | 178 LayoutBlock::styleDidChange(diff, oldStyle); |
178 setInline(false); | 179 setInline(false); |
179 clearPositionedState(); | 180 clearPositionedState(); |
180 setFloating(false); | 181 setFloating(false); |
181 setHasOverflowClip(false); | 182 setHasOverflowClip(false); |
182 if (oldStyle && m_scrollbar && m_part != NoPart && (diff.needsPaintInvalidat ion() || diff.needsLayout())) | 183 if (oldStyle && (diff.needsPaintInvalidation() || diff.needsLayout())) |
183 m_scrollbar->theme()->invalidatePart(m_scrollbar, m_part); | 184 setNeedsPaintInvalidation(); |
184 } | 185 } |
185 | 186 |
186 void LayoutScrollbarPart::imageChanged(WrappedImagePtr image, const IntRect* rec t) | 187 void LayoutScrollbarPart::imageChanged(WrappedImagePtr image, const IntRect* rec t) |
187 { | 188 { |
188 if (m_scrollbar && m_part != NoPart) { | 189 setNeedsPaintInvalidation(); |
189 m_scrollbar->theme()->invalidatePart(m_scrollbar, m_part); | 190 LayoutBlock::imageChanged(image, rect); |
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 } | |
200 } | 191 } |
201 | 192 |
202 LayoutObject* LayoutScrollbarPart::layoutObjectOwningScrollbar() const | 193 LayoutObject* LayoutScrollbarPart::layoutObjectOwningScrollbar() const |
203 { | 194 { |
204 return (!m_scrollbar) ? nullptr : m_scrollbar->owningLayoutObject(); | 195 return (!m_scrollbar) ? nullptr : m_scrollbar->owningLayoutObject(); |
205 } | 196 } |
206 | 197 |
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(); | |
chrishtr
2015/11/17 01:34:20
Why is the scroll corner special?
Xianzhu
2015/11/17 18:31:37
Though scroll corner is a LayoutScrollbarPart, its
| |
210 return; | |
211 } | |
212 } | |
213 | |
214 // This LayoutScrollbarPart belongs to a PaintLayerScrollableArea. | |
215 toLayoutBox(parent())->scrollableArea()->setScrollCornerNeedsPaintInvalidati on(); | |
207 } | 216 } |
217 | |
218 } | |
OLD | NEW |