| 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 17 matching lines...) Expand all Loading... |
| 28 #include "core/frame/FrameView.h" | 28 #include "core/frame/FrameView.h" |
| 29 #include "core/frame/UseCounter.h" | 29 #include "core/frame/UseCounter.h" |
| 30 #include "core/layout/LayoutScrollbar.h" | 30 #include "core/layout/LayoutScrollbar.h" |
| 31 #include "core/layout/LayoutScrollbarTheme.h" | 31 #include "core/layout/LayoutScrollbarTheme.h" |
| 32 #include "core/layout/LayoutView.h" | 32 #include "core/layout/LayoutView.h" |
| 33 #include "core/paint/PaintLayerScrollableArea.h" | 33 #include "core/paint/PaintLayerScrollableArea.h" |
| 34 #include "platform/LengthFunctions.h" | 34 #include "platform/LengthFunctions.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 LayoutScrollbarPart::LayoutScrollbarPart(LayoutScrollbar* scrollbar, ScrollbarPa
rt part) | 38 LayoutScrollbarPart::LayoutScrollbarPart(ScrollableArea* scrollableArea, LayoutS
crollbar* scrollbar, ScrollbarPart part) |
| 39 : LayoutBlock(nullptr) | 39 : LayoutBlock(nullptr) |
| 40 , m_scrollableArea(scrollableArea) |
| 40 , m_scrollbar(scrollbar) | 41 , m_scrollbar(scrollbar) |
| 41 , m_part(part) | 42 , m_part(part) |
| 42 { | 43 { |
| 44 ASSERT(m_scrollableArea); |
| 43 } | 45 } |
| 44 | 46 |
| 45 LayoutScrollbarPart::~LayoutScrollbarPart() | 47 LayoutScrollbarPart::~LayoutScrollbarPart() |
| 46 { | 48 { |
| 47 } | 49 } |
| 48 | 50 |
| 49 static void recordScrollbarPartStats(Document& document, ScrollbarPart part) | 51 static void recordScrollbarPartStats(Document& document, ScrollbarPart part) |
| 50 { | 52 { |
| 51 switch (part) { | 53 switch (part) { |
| 52 case BackButtonStartPart: | 54 case BackButtonStartPart: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 67 break; | 69 break; |
| 68 case ScrollbarBGPart: | 70 case ScrollbarBGPart: |
| 69 UseCounter::count(document, UseCounter::CSSSelectorPseudoScrollbar); | 71 UseCounter::count(document, UseCounter::CSSSelectorPseudoScrollbar); |
| 70 break; | 72 break; |
| 71 case NoPart: | 73 case NoPart: |
| 72 case AllParts: | 74 case AllParts: |
| 73 break; | 75 break; |
| 74 } | 76 } |
| 75 } | 77 } |
| 76 | 78 |
| 77 LayoutScrollbarPart* LayoutScrollbarPart::createAnonymous(Document* document, La
youtScrollbar* scrollbar, ScrollbarPart part) | 79 LayoutScrollbarPart* LayoutScrollbarPart::createAnonymous(Document* document, Sc
rollableArea* scrollableArea, |
| 80 LayoutScrollbar* scrollbar, ScrollbarPart part) |
| 78 { | 81 { |
| 79 LayoutScrollbarPart* layoutObject = new LayoutScrollbarPart(scrollbar, part)
; | 82 LayoutScrollbarPart* layoutObject = new LayoutScrollbarPart(scrollableArea,
scrollbar, part); |
| 80 recordScrollbarPartStats(*document, part); | 83 recordScrollbarPartStats(*document, part); |
| 81 layoutObject->setDocumentForAnonymous(document); | 84 layoutObject->setDocumentForAnonymous(document); |
| 82 return layoutObject; | 85 return layoutObject; |
| 83 } | 86 } |
| 84 | 87 |
| 85 void LayoutScrollbarPart::layout() | 88 void LayoutScrollbarPart::layout() |
| 86 { | 89 { |
| 87 setLocation(LayoutPoint()); // We don't worry about positioning ourselves. W
e're just determining our minimum width/height. | 90 setLocation(LayoutPoint()); // We don't worry about positioning ourselves. W
e're just determining our minimum width/height. |
| 88 if (m_scrollbar->orientation() == HorizontalScrollbar) | 91 if (m_scrollbar->orientation() == HorizontalScrollbar) |
| 89 layoutHorizontalPart(); | 92 layoutHorizontalPart(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 207 |
| 205 // This LayoutScrollbarPart is a scroll corner or a resizer. | 208 // This LayoutScrollbarPart is a scroll corner or a resizer. |
| 206 ASSERT(m_part == NoPart); | 209 ASSERT(m_part == NoPart); |
| 207 if (FrameView* frameView = view()->frameView()) { | 210 if (FrameView* frameView = view()->frameView()) { |
| 208 if (frameView->isFrameViewScrollCorner(this)) { | 211 if (frameView->isFrameViewScrollCorner(this)) { |
| 209 frameView->setScrollCornerNeedsPaintInvalidation(); | 212 frameView->setScrollCornerNeedsPaintInvalidation(); |
| 210 return; | 213 return; |
| 211 } | 214 } |
| 212 } | 215 } |
| 213 | 216 |
| 214 // This LayoutScrollbarPart belongs to a PaintLayerScrollableArea. | 217 m_scrollableArea->setScrollCornerNeedsPaintInvalidation(); |
| 215 toLayoutBox(parent())->getScrollableArea()->setScrollCornerNeedsPaintInvalid
ation(); | |
| 216 } | 218 } |
| 217 | 219 |
| 218 LayoutRect LayoutScrollbarPart::visualRect() const | 220 LayoutRect LayoutScrollbarPart::visualRect() const |
| 219 { | 221 { |
| 220 // This returns the combined bounds of all scrollbar parts, which is suffici
ent for correctness | 222 // This returns the combined bounds of all scrollbar parts, which is suffici
ent for correctness |
| 221 // but not as tight as it could be. | 223 // but not as tight as it could be. |
| 222 return m_scrollbar ? m_scrollbar->visualRect() : LayoutRect(); | 224 return m_scrollableArea->visualRectForScrollbarParts(); |
| 223 } | 225 } |
| 224 | 226 |
| 225 } // namespace blink | 227 } // namespace blink |
| OLD | NEW |