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 16 matching lines...) Expand all Loading... |
27 #include "RenderScrollbar.h" | 27 #include "RenderScrollbar.h" |
28 | 28 |
29 #include "Frame.h" | 29 #include "Frame.h" |
30 #include "FrameView.h" | 30 #include "FrameView.h" |
31 #include "RenderPart.h" | 31 #include "RenderPart.h" |
32 #include "RenderScrollbarPart.h" | 32 #include "RenderScrollbarPart.h" |
33 #include "RenderScrollbarTheme.h" | 33 #include "RenderScrollbarTheme.h" |
34 | 34 |
35 namespace WebCore { | 35 namespace WebCore { |
36 | 36 |
37 PassRefPtr<Scrollbar> RenderScrollbar::createCustomScrollbar(ScrollableArea* scr
ollableArea, ScrollbarOrientation orientation, RenderBox* renderer, Frame* ownin
gFrame) | 37 PassRefPtr<Scrollbar> RenderScrollbar::createCustomScrollbar(ScrollableArea* scr
ollableArea, ScrollbarOrientation orientation, Node* ownerNode, Frame* owningFra
me) |
38 { | 38 { |
39 return adoptRef(new RenderScrollbar(scrollableArea, orientation, renderer, o
wningFrame)); | 39 return adoptRef(new RenderScrollbar(scrollableArea, orientation, ownerNode,
owningFrame)); |
40 } | 40 } |
41 | 41 |
42 RenderScrollbar::RenderScrollbar(ScrollableArea* scrollableArea, ScrollbarOrient
ation orientation, RenderBox* renderer, Frame* owningFrame) | 42 RenderScrollbar::RenderScrollbar(ScrollableArea* scrollableArea, ScrollbarOrient
ation orientation, Node* ownerNode, Frame* owningFrame) |
43 : Scrollbar(scrollableArea, orientation, RegularScrollbar, RenderScrollbarTh
eme::renderScrollbarTheme()) | 43 : Scrollbar(scrollableArea, orientation, RegularScrollbar, RenderScrollbarTh
eme::renderScrollbarTheme()) |
44 , m_owner(renderer) | 44 , m_owner(ownerNode) |
45 , m_owningFrame(owningFrame) | 45 , m_owningFrame(owningFrame) |
46 { | 46 { |
| 47 ASSERT(ownerNode || owningFrame); |
| 48 |
47 // FIXME: We need to do this because RenderScrollbar::styleChanged is called
as soon as the scrollbar is created. | 49 // FIXME: We need to do this because RenderScrollbar::styleChanged is called
as soon as the scrollbar is created. |
48 | 50 |
49 // Update the scrollbar size. | 51 // Update the scrollbar size. |
50 int width = 0; | 52 int width = 0; |
51 int height = 0; | 53 int height = 0; |
52 updateScrollbarPart(ScrollbarBGPart); | 54 updateScrollbarPart(ScrollbarBGPart); |
53 if (RenderScrollbarPart* part = m_parts.get(ScrollbarBGPart)) { | 55 if (RenderScrollbarPart* part = m_parts.get(ScrollbarBGPart)) { |
54 part->layout(); | 56 part->layout(); |
55 width = part->width(); | 57 width = part->width(); |
56 height = part->height(); | 58 height = part->height(); |
(...skipping 17 matching lines...) Expand all Loading... |
74 updateScrollbarParts(true); | 76 updateScrollbarParts(true); |
75 } | 77 } |
76 } | 78 } |
77 | 79 |
78 RenderBox* RenderScrollbar::owningRenderer() const | 80 RenderBox* RenderScrollbar::owningRenderer() const |
79 { | 81 { |
80 if (m_owningFrame) { | 82 if (m_owningFrame) { |
81 RenderBox* currentRenderer = m_owningFrame->ownerRenderer(); | 83 RenderBox* currentRenderer = m_owningFrame->ownerRenderer(); |
82 return currentRenderer; | 84 return currentRenderer; |
83 } | 85 } |
84 return m_owner; | 86 return m_owner && m_owner->renderer() ? m_owner->renderer()->enclosingBox()
: 0; |
85 } | 87 } |
86 | 88 |
87 void RenderScrollbar::setParent(ScrollView* parent) | 89 void RenderScrollbar::setParent(ScrollView* parent) |
88 { | 90 { |
89 Scrollbar::setParent(parent); | 91 Scrollbar::setParent(parent); |
90 if (!parent) { | 92 if (!parent) { |
91 // Destroy all of the scrollbar's RenderBoxes. | 93 // Destroy all of the scrollbar's RenderBoxes. |
92 updateScrollbarParts(true); | 94 updateScrollbarParts(true); |
93 } | 95 } |
94 } | 96 } |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 int RenderScrollbar::minimumThumbLength() | 367 int RenderScrollbar::minimumThumbLength() |
366 { | 368 { |
367 RenderScrollbarPart* partRenderer = m_parts.get(ThumbPart); | 369 RenderScrollbarPart* partRenderer = m_parts.get(ThumbPart); |
368 if (!partRenderer) | 370 if (!partRenderer) |
369 return 0; | 371 return 0; |
370 partRenderer->layout(); | 372 partRenderer->layout(); |
371 return orientation() == HorizontalScrollbar ? partRenderer->width() : partRe
nderer->height(); | 373 return orientation() == HorizontalScrollbar ? partRenderer->width() : partRe
nderer->height(); |
372 } | 374 } |
373 | 375 |
374 } | 376 } |
OLD | NEW |