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