| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. | 3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #include "sky/engine/public/platform/WebString.h" | 40 #include "sky/engine/public/platform/WebString.h" |
| 41 #include "sky/engine/wtf/PassOwnPtr.h" | 41 #include "sky/engine/wtf/PassOwnPtr.h" |
| 42 | 42 |
| 43 static const int kPixelsPerLineStep = 40; | 43 static const int kPixelsPerLineStep = 40; |
| 44 static const float kMinFractionToStepWhenPaging = 0.875f; | 44 static const float kMinFractionToStepWhenPaging = 0.875f; |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 47 | 47 |
| 48 struct SameSizeAsScrollableArea { | 48 struct SameSizeAsScrollableArea { |
| 49 virtual ~SameSizeAsScrollableArea(); | 49 virtual ~SameSizeAsScrollableArea(); |
| 50 IntRect scrollbarDamage[2]; | |
| 51 void* pointer; | 50 void* pointer; |
| 52 unsigned bitfields : 16; | 51 unsigned bitfields : 16; |
| 53 IntPoint origin; | 52 IntPoint origin; |
| 54 }; | 53 }; |
| 55 | 54 |
| 56 COMPILE_ASSERT(sizeof(ScrollableArea) == sizeof(SameSizeAsScrollableArea), Scrol
lableArea_should_stay_small); | 55 COMPILE_ASSERT(sizeof(ScrollableArea) == sizeof(SameSizeAsScrollableArea), Scrol
lableArea_should_stay_small); |
| 57 | 56 |
| 58 int ScrollableArea::pixelsPerLineStep() | 57 int ScrollableArea::pixelsPerLineStep() |
| 59 { | 58 { |
| 60 return kPixelsPerLineStep; | 59 return kPixelsPerLineStep; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 setScrollOffset(position); | 165 setScrollOffset(position); |
| 167 | 166 |
| 168 Scrollbar* verticalScrollbar = this->verticalScrollbar(); | 167 Scrollbar* verticalScrollbar = this->verticalScrollbar(); |
| 169 | 168 |
| 170 // Tell the scrollbars to update their thumb postions. | 169 // Tell the scrollbars to update their thumb postions. |
| 171 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { | 170 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { |
| 172 horizontalScrollbar->offsetDidChange(); | 171 horizontalScrollbar->offsetDidChange(); |
| 173 if (horizontalScrollbar->isOverlayScrollbar()) { | 172 if (horizontalScrollbar->isOverlayScrollbar()) { |
| 174 if (!verticalScrollbar) | 173 if (!verticalScrollbar) |
| 175 horizontalScrollbar->invalidate(); | 174 horizontalScrollbar->invalidate(); |
| 176 else { | |
| 177 // If there is both a horizontalScrollbar and a verticalScrollba
r, | |
| 178 // then we must also invalidate the corner between them. | |
| 179 IntRect boundsAndCorner = horizontalScrollbar->boundsRect(); | |
| 180 boundsAndCorner.setWidth(boundsAndCorner.width() + verticalScrol
lbar->width()); | |
| 181 horizontalScrollbar->invalidateRect(boundsAndCorner); | |
| 182 } | |
| 183 } | 175 } |
| 184 } | 176 } |
| 185 if (verticalScrollbar) { | 177 if (verticalScrollbar) { |
| 186 verticalScrollbar->offsetDidChange(); | 178 verticalScrollbar->offsetDidChange(); |
| 187 if (verticalScrollbar->isOverlayScrollbar()) | 179 if (verticalScrollbar->isOverlayScrollbar()) |
| 188 verticalScrollbar->invalidate(); | 180 verticalScrollbar->invalidate(); |
| 189 } | 181 } |
| 190 | 182 |
| 191 if (scrollPosition() != oldPosition) | 183 if (scrollPosition() != oldPosition) |
| 192 scrollAnimator()->notifyContentAreaScrolled(scrollPosition() - oldPositi
on); | 184 scrollAnimator()->notifyContentAreaScrolled(scrollPosition() - oldPositi
on); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 | 304 |
| 313 if (Scrollbar* scrollbar = horizontalScrollbar()) { | 305 if (Scrollbar* scrollbar = horizontalScrollbar()) { |
| 314 scrollbar->invalidate(); | 306 scrollbar->invalidate(); |
| 315 } | 307 } |
| 316 | 308 |
| 317 if (Scrollbar* scrollbar = verticalScrollbar()) { | 309 if (Scrollbar* scrollbar = verticalScrollbar()) { |
| 318 scrollbar->invalidate(); | 310 scrollbar->invalidate(); |
| 319 } | 311 } |
| 320 } | 312 } |
| 321 | 313 |
| 322 void ScrollableArea::invalidateScrollbar(Scrollbar* scrollbar, const IntRect& re
ct) | |
| 323 { | |
| 324 invalidateScrollbarRect(scrollbar, rect); | |
| 325 } | |
| 326 | |
| 327 bool ScrollableArea::scheduleAnimation() | 314 bool ScrollableArea::scheduleAnimation() |
| 328 { | 315 { |
| 329 WTF_LOG(ScriptedAnimationController, "ScrollableArea::scheduleAnimation: win
dow = %d", | 316 WTF_LOG(ScriptedAnimationController, "ScrollableArea::scheduleAnimation: win
dow = %d", |
| 330 hostWindow() ? 1 : 0); | 317 hostWindow() ? 1 : 0); |
| 331 if (HostWindow* window = hostWindow()) { | 318 if (HostWindow* window = hostWindow()) { |
| 332 window->scheduleAnimation(); | 319 window->scheduleAnimation(); |
| 333 return true; | 320 return true; |
| 334 } | 321 } |
| 335 return false; | 322 return false; |
| 336 } | 323 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 355 { | 342 { |
| 356 return scrollSize(orientation); | 343 return scrollSize(orientation); |
| 357 } | 344 } |
| 358 | 345 |
| 359 float ScrollableArea::pixelStep(ScrollbarOrientation) const | 346 float ScrollableArea::pixelStep(ScrollbarOrientation) const |
| 360 { | 347 { |
| 361 return 1; | 348 return 1; |
| 362 } | 349 } |
| 363 | 350 |
| 364 } // namespace blink | 351 } // namespace blink |
| OLD | NEW |