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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 537 if (scrollable_area_) | 537 if (scrollable_area_) |
| 538 scrollable_area_->SetScrollbarsHidden(hidden); | 538 scrollable_area_->SetScrollbarsHidden(hidden); |
| 539 } | 539 } |
| 540 | 540 |
| 541 void Scrollbar::SetEnabled(bool e) { | 541 void Scrollbar::SetEnabled(bool e) { |
| 542 if (enabled_ == e) | 542 if (enabled_ == e) |
| 543 return; | 543 return; |
| 544 enabled_ = e; | 544 enabled_ = e; |
| 545 GetTheme().UpdateEnabledState(*this); | 545 GetTheme().UpdateEnabledState(*this); |
| 546 | 546 |
| 547 ScrollbarPart invalid_parts = GetTheme().InvalidateOnEnabledChange(); | 547 // We can skip thumb/track repaint when hiding an overlay scrollbar, but not |
| 548 SetNeedsPaintInvalidation(invalid_parts); | 548 // when showing (since the proportions may have changed while hidden). |
| 549 bool skipPartsRepaint = IsOverlayScrollbar() && scrollable_area_ && | |
| 550 scrollable_area_->ScrollbarsHidden(); | |
| 551 SetNeedsPaintInvalidation(skipPartsRepaint ? kNoPart : kAllParts); | |
|
bokan
2017/04/25 23:21:17
On the CC side (for Aura anyway) we only need to p
skobes
2017/04/26 01:28:58
I think ideally we would not repurpose the enabled
bokan
2017/04/26 11:51:09
It's an unfortunate quirk of main-thread painting
| |
| 549 } | 552 } |
| 550 | 553 |
| 551 int Scrollbar::ScrollbarThickness() const { | 554 int Scrollbar::ScrollbarThickness() const { |
| 552 int thickness = Orientation() == kHorizontalScrollbar ? Height() : Width(); | 555 int thickness = Orientation() == kHorizontalScrollbar ? Height() : Width(); |
| 553 if (!thickness || !chrome_client_) | 556 if (!thickness || !chrome_client_) |
| 554 return thickness; | 557 return thickness; |
| 555 return chrome_client_->WindowToViewportScalar(theme_scrollbar_thickness_); | 558 return chrome_client_->WindowToViewportScalar(theme_scrollbar_thickness_); |
| 556 } | 559 } |
| 557 | 560 |
| 558 bool Scrollbar::IsOverlayScrollbar() const { | 561 bool Scrollbar::IsOverlayScrollbar() const { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 634 invalid_parts = kAllParts; | 637 invalid_parts = kAllParts; |
| 635 if (invalid_parts & ~kThumbPart) | 638 if (invalid_parts & ~kThumbPart) |
| 636 track_needs_repaint_ = true; | 639 track_needs_repaint_ = true; |
| 637 if (invalid_parts & kThumbPart) | 640 if (invalid_parts & kThumbPart) |
| 638 thumb_needs_repaint_ = true; | 641 thumb_needs_repaint_ = true; |
| 639 if (scrollable_area_) | 642 if (scrollable_area_) |
| 640 scrollable_area_->SetScrollbarNeedsPaintInvalidation(Orientation()); | 643 scrollable_area_->SetScrollbarNeedsPaintInvalidation(Orientation()); |
| 641 } | 644 } |
| 642 | 645 |
| 643 } // namespace blink | 646 } // namespace blink |
| OLD | NEW |