| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 part->layout(); | 57 part->layout(); |
| 58 rect.setSize(flooredIntSize(part->size())); | 58 rect.setSize(flooredIntSize(part->size())); |
| 59 } else if (this->orientation() == HorizontalScrollbar) { | 59 } else if (this->orientation() == HorizontalScrollbar) { |
| 60 rect.setWidth(this->width()); | 60 rect.setWidth(this->width()); |
| 61 } else { | 61 } else { |
| 62 rect.setHeight(this->height()); | 62 rect.setHeight(this->height()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 setFrameRect(rect); | 65 setFrameRect(rect); |
| 66 | 66 |
| 67 #if ENABLE(OILPAN) | |
| 68 ThreadState::current()->registerPreFinalizer(*this); | |
| 69 #endif | |
| 70 } | 67 } |
| 71 | 68 |
| 72 RenderScrollbar::~RenderScrollbar() | 69 RenderScrollbar::~RenderScrollbar() |
| 73 { | 70 { |
| 74 // Oilpan: to be able to access the hash map that's | |
| 75 // also on the heap, a pre-destruction finalizer is used. | |
| 76 #if !ENABLE(OILPAN) | |
| 77 destroyParts(); | |
| 78 #endif | |
| 79 } | |
| 80 | |
| 81 void RenderScrollbar::destroyParts() | |
| 82 { | |
| 83 if (m_parts.isEmpty()) | 71 if (m_parts.isEmpty()) |
| 84 return; | 72 return; |
| 85 | 73 |
| 86 // When a scrollbar is detached from its parent (causing all parts removal)
and | 74 // When a scrollbar is detached from its parent (causing all parts removal)
and |
| 87 // ready to be destroyed, its destruction can be delayed because of RefPtr | 75 // ready to be destroyed, its destruction can be delayed because of RefPtr |
| 88 // maintained in other classes such as EventHandler (m_lastScrollbarUnderMou
se). | 76 // maintained in other classes such as EventHandler (m_lastScrollbarUnderMou
se). |
| 89 // Meanwhile, we can have a call to updateScrollbarPart which recreates the | 77 // Meanwhile, we can have a call to updateScrollbarPart which recreates the |
| 90 // scrollbar part. So, we need to destroy these parts since we don't want th
em | 78 // scrollbar part. So, we need to destroy these parts since we don't want th
em |
| 91 // to call on a destroyed scrollbar. See webkit bug 68009. | 79 // to call on a destroyed scrollbar. See webkit bug 68009. |
| 92 updateScrollbarParts(true); | 80 updateScrollbarParts(true); |
| 93 } | 81 } |
| 94 | 82 |
| 95 void RenderScrollbar::trace(Visitor* visitor) | 83 void RenderScrollbar::trace(Visitor* visitor) |
| 96 { | 84 { |
| 97 #if ENABLE(OILPAN) | 85 #if ENABLE(OILPAN) |
| 98 visitor->trace(m_owner); | 86 visitor->trace(m_owner); |
| 99 visitor->trace(m_owningFrame); | 87 visitor->trace(m_owningFrame); |
| 100 visitor->trace(m_parts); | |
| 101 #endif | 88 #endif |
| 102 Scrollbar::trace(visitor); | 89 Scrollbar::trace(visitor); |
| 103 } | 90 } |
| 104 | 91 |
| 105 RenderBox* RenderScrollbar::owningRenderer() const | 92 RenderBox* RenderScrollbar::owningRenderer() const |
| 106 { | 93 { |
| 107 if (m_owningFrame) { | 94 if (m_owningFrame) { |
| 108 RenderBox* currentRenderer = m_owningFrame->ownerRenderer(); | 95 RenderBox* currentRenderer = m_owningFrame->ownerRenderer(); |
| 109 return currentRenderer; | 96 return currentRenderer; |
| 110 } | 97 } |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 int RenderScrollbar::minimumThumbLength() | 347 int RenderScrollbar::minimumThumbLength() |
| 361 { | 348 { |
| 362 RenderScrollbarPart* partRenderer = m_parts.get(ThumbPart); | 349 RenderScrollbarPart* partRenderer = m_parts.get(ThumbPart); |
| 363 if (!partRenderer) | 350 if (!partRenderer) |
| 364 return 0; | 351 return 0; |
| 365 partRenderer->layout(); | 352 partRenderer->layout(); |
| 366 return orientation() == HorizontalScrollbar ? partRenderer->size().width() :
partRenderer->size().height(); | 353 return orientation() == HorizontalScrollbar ? partRenderer->size().width() :
partRenderer->size().height(); |
| 367 } | 354 } |
| 368 | 355 |
| 369 } | 356 } |
| OLD | NEW |