Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1266)

Side by Side Diff: third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm

Issue 1406133005: Calculate paint invalidation rect for scrollbars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2010, 2011 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 [_scrollbarPainter.get() setTrackAlpha:currentValue]; 432 [_scrollbarPainter.get() setTrackAlpha:currentValue];
433 break; 433 break;
434 case UIStateTransition: 434 case UIStateTransition:
435 [_scrollbarPainter.get() setUiStateTransitionProgress:currentValue]; 435 [_scrollbarPainter.get() setUiStateTransitionProgress:currentValue];
436 break; 436 break;
437 case ExpansionTransition: 437 case ExpansionTransition:
438 [_scrollbarPainter.get() setExpansionTransitionProgress:currentValue]; 438 [_scrollbarPainter.get() setExpansionTransitionProgress:currentValue];
439 break; 439 break;
440 } 440 }
441 441
442 _scrollbar->invalidate(); 442 _scrollbar->setNeedsPaintInvalidation();
443 } 443 }
444 444
445 - (void)invalidate 445 - (void)invalidate
446 { 446 {
447 BEGIN_BLOCK_OBJC_EXCEPTIONS; 447 BEGIN_BLOCK_OBJC_EXCEPTIONS;
448 [self stopAnimation]; 448 [self stopAnimation];
449 END_BLOCK_OBJC_EXCEPTIONS; 449 END_BLOCK_OBJC_EXCEPTIONS;
450 _scrollbar = 0; 450 _scrollbar = 0;
451 } 451 }
452 452
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 1070
1071 ScrollbarThemeMacOverlayAPI* macTheme = macOverlayScrollbarTheme(); 1071 ScrollbarThemeMacOverlayAPI* macTheme = macOverlayScrollbarTheme();
1072 if (!macTheme) { 1072 if (!macTheme) {
1073 m_needsScrollerStyleUpdate = false; 1073 m_needsScrollerStyleUpdate = false;
1074 return; 1074 return;
1075 } 1075 }
1076 1076
1077 NSScrollerStyle newStyle = [m_scrollbarPainterController.get() scrollerStyle ]; 1077 NSScrollerStyle newStyle = [m_scrollbarPainterController.get() scrollerStyle ];
1078 1078
1079 if (Scrollbar* verticalScrollbar = scrollableArea()->verticalScrollbar()) { 1079 if (Scrollbar* verticalScrollbar = scrollableArea()->verticalScrollbar()) {
1080 verticalScrollbar->invalidate(); 1080 verticalScrollbar->setNeedsPaintInvalidation();
1081 1081
1082 ScrollbarPainter oldVerticalPainter = [m_scrollbarPainterController.get( ) verticalScrollerImp]; 1082 ScrollbarPainter oldVerticalPainter = [m_scrollbarPainterController.get( ) verticalScrollerImp];
1083 ScrollbarPainter newVerticalPainter = [NSClassFromString(@"NSScrollerImp ") scrollerImpWithStyle:newStyle 1083 ScrollbarPainter newVerticalPainter = [NSClassFromString(@"NSScrollerImp ") scrollerImpWithStyle:newStyle
1084 controlSize:(NSControlSize)verticalScrollbar->controlSize() 1084 controlSize:(NSControlSize)verticalScrollbar->controlSize()
1085 horizontal:NO 1085 horizontal:NO
1086 replacingScrollerImp:oldVerticalPainter]; 1086 replacingScrollerImp:oldVerticalPainter];
1087 [m_scrollbarPainterController.get() setVerticalScrollerImp:newVerticalPa inter]; 1087 [m_scrollbarPainterController.get() setVerticalScrollerImp:newVerticalPa inter];
1088 macTheme->setNewPainterForScrollbar(verticalScrollbar, newVerticalPainte r); 1088 macTheme->setNewPainterForScrollbar(verticalScrollbar, newVerticalPainte r);
1089 1089
1090 // The different scrollbar styles have different thicknesses, so we must re-set the 1090 // The different scrollbar styles have different thicknesses, so we must re-set the
1091 // frameRect to the new thickness, and the re-layout below will ensure t he position 1091 // frameRect to the new thickness, and the re-layout below will ensure t he position
1092 // and length are properly updated. 1092 // and length are properly updated.
1093 int thickness = macTheme->scrollbarThickness(verticalScrollbar->controlS ize()); 1093 int thickness = macTheme->scrollbarThickness(verticalScrollbar->controlS ize());
1094 verticalScrollbar->setFrameRect(IntRect(0, 0, thickness, thickness)); 1094 verticalScrollbar->setFrameRect(IntRect(0, 0, thickness, thickness));
1095 } 1095 }
1096 1096
1097 if (Scrollbar* horizontalScrollbar = scrollableArea()->horizontalScrollbar() ) { 1097 if (Scrollbar* horizontalScrollbar = scrollableArea()->horizontalScrollbar() ) {
1098 horizontalScrollbar->invalidate(); 1098 horizontalScrollbar->setNeedsPaintInvalidation();
1099 1099
1100 ScrollbarPainter oldHorizontalPainter = [m_scrollbarPainterController.ge t() horizontalScrollerImp]; 1100 ScrollbarPainter oldHorizontalPainter = [m_scrollbarPainterController.ge t() horizontalScrollerImp];
1101 ScrollbarPainter newHorizontalPainter = [NSClassFromString(@"NSScrollerI mp") scrollerImpWithStyle:newStyle 1101 ScrollbarPainter newHorizontalPainter = [NSClassFromString(@"NSScrollerI mp") scrollerImpWithStyle:newStyle
1102 controlSize:(NSControlSize)horizontalScrollbar->controlSize() 1102 controlSize:(NSControlSize)horizontalScrollbar->controlSize()
1103 horizontal:YES 1103 horizontal:YES
1104 replacingScrollerImp:oldHorizontalPainter]; 1104 replacingScrollerImp:oldHorizontalPainter];
1105 [m_scrollbarPainterController.get() setHorizontalScrollerImp:newHorizont alPainter]; 1105 [m_scrollbarPainterController.get() setHorizontalScrollerImp:newHorizont alPainter];
1106 macTheme->setNewPainterForScrollbar(horizontalScrollbar, newHorizontalPa inter); 1106 macTheme->setNewPainterForScrollbar(horizontalScrollbar, newHorizontalPa inter);
1107 1107
1108 // The different scrollbar styles have different thicknesses, so we must re-set the 1108 // The different scrollbar styles have different thicknesses, so we must re-set the
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 return; 1172 return;
1173 1173
1174 m_visibleScrollerThumbRect = rectInViewCoordinates; 1174 m_visibleScrollerThumbRect = rectInViewCoordinates;
1175 } 1175 }
1176 1176
1177 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { 1177 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() {
1178 return ScrollbarThemeMacCommon::isOverlayAPIAvailable(); 1178 return ScrollbarThemeMacCommon::isOverlayAPIAvailable();
1179 } 1179 }
1180 1180
1181 } // namespace blink 1181 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698