Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 m_elasticOverscroll(0), | 62 m_elasticOverscroll(0), |
| 63 m_trackNeedsRepaint(true), | 63 m_trackNeedsRepaint(true), |
| 64 m_thumbNeedsRepaint(true) { | 64 m_thumbNeedsRepaint(true) { |
| 65 m_theme.registerScrollbar(*this); | 65 m_theme.registerScrollbar(*this); |
| 66 | 66 |
| 67 // FIXME: This is ugly and would not be necessary if we fix cross-platform | 67 // FIXME: This is ugly and would not be necessary if we fix cross-platform |
| 68 // code to actually query for scrollbar thickness and use it when sizing | 68 // code to actually query for scrollbar thickness and use it when sizing |
| 69 // scrollbars (rather than leaving one dimension of the scrollbar alone when | 69 // scrollbars (rather than leaving one dimension of the scrollbar alone when |
| 70 // sizing). | 70 // sizing). |
| 71 int thickness = m_theme.scrollbarThickness(controlSize); | 71 int thickness = m_theme.scrollbarThickness(controlSize); |
| 72 m_themeScrollbarThickness = thickness; | |
|
oshima
2016/10/14 23:17:30
don't you have to cache for each controlSize?
malaykeshav
2016/10/14 23:18:54
For a given scrollbar instance the ControlSize doe
| |
| 72 if (m_hostWindow) | 73 if (m_hostWindow) |
| 73 thickness = m_hostWindow->windowToViewportScalar(thickness); | 74 thickness = m_hostWindow->windowToViewportScalar(thickness); |
| 74 Widget::setFrameRect(IntRect(0, 0, thickness, thickness)); | 75 Widget::setFrameRect(IntRect(0, 0, thickness, thickness)); |
| 75 | 76 |
| 76 m_currentPos = scrollableAreaCurrentPos(); | 77 m_currentPos = scrollableAreaCurrentPos(); |
| 77 } | 78 } |
| 78 | 79 |
| 79 Scrollbar::~Scrollbar() { | 80 Scrollbar::~Scrollbar() { |
| 80 m_theme.unregisterScrollbar(*this); | 81 m_theme.unregisterScrollbar(*this); |
| 81 } | 82 } |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 519 return; | 520 return; |
| 520 m_enabled = e; | 521 m_enabled = e; |
| 521 theme().updateEnabledState(*this); | 522 theme().updateEnabledState(*this); |
| 522 setNeedsPaintInvalidation(AllParts); | 523 setNeedsPaintInvalidation(AllParts); |
| 523 } | 524 } |
| 524 | 525 |
| 525 int Scrollbar::scrollbarThickness() const { | 526 int Scrollbar::scrollbarThickness() const { |
| 526 int thickness = orientation() == HorizontalScrollbar ? height() : width(); | 527 int thickness = orientation() == HorizontalScrollbar ? height() : width(); |
| 527 if (!thickness || !m_hostWindow) | 528 if (!thickness || !m_hostWindow) |
| 528 return thickness; | 529 return thickness; |
| 529 return m_hostWindow->windowToViewportScalar( | 530 return m_hostWindow->windowToViewportScalar(m_themeScrollbarThickness); |
| 530 m_theme.scrollbarThickness(controlSize())); | |
| 531 } | 531 } |
| 532 | 532 |
| 533 bool Scrollbar::isOverlayScrollbar() const { | 533 bool Scrollbar::isOverlayScrollbar() const { |
| 534 return m_theme.usesOverlayScrollbars(); | 534 return m_theme.usesOverlayScrollbars(); |
| 535 } | 535 } |
| 536 | 536 |
| 537 bool Scrollbar::shouldParticipateInHitTesting() { | 537 bool Scrollbar::shouldParticipateInHitTesting() { |
| 538 // Non-overlay scrollbars should always participate in hit testing. | 538 // Non-overlay scrollbars should always participate in hit testing. |
| 539 if (!isOverlayScrollbar()) | 539 if (!isOverlayScrollbar()) |
| 540 return true; | 540 return true; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 617 invalidParts = AllParts; | 617 invalidParts = AllParts; |
| 618 if (invalidParts & ~ThumbPart) | 618 if (invalidParts & ~ThumbPart) |
| 619 m_trackNeedsRepaint = true; | 619 m_trackNeedsRepaint = true; |
| 620 if (invalidParts & ThumbPart) | 620 if (invalidParts & ThumbPart) |
| 621 m_thumbNeedsRepaint = true; | 621 m_thumbNeedsRepaint = true; |
| 622 if (m_scrollableArea) | 622 if (m_scrollableArea) |
| 623 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation()); | 623 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation()); |
| 624 } | 624 } |
| 625 | 625 |
| 626 } // namespace blink | 626 } // namespace blink |
| OLD | NEW |