OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2009 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009 Google 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 | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 context->translate(scrollbar->frameRect().x(), scrollbar->frameRect().y(
)); | 484 context->translate(scrollbar->frameRect().x(), scrollbar->frameRect().y(
)); |
485 LocalCurrentGraphicsContext localContext(context); | 485 LocalCurrentGraphicsContext localContext(context); |
486 WKScrollbarPainterRef scrollbarPainter = scrollbarMap()->get(scrollbar).
get(); | 486 WKScrollbarPainterRef scrollbarPainter = scrollbarMap()->get(scrollbar).
get(); |
487 wkScrollbarPainterPaintTrack(scrollbarPainter, | 487 wkScrollbarPainterPaintTrack(scrollbarPainter, |
488 scrollbar->enabled(), | 488 scrollbar->enabled(), |
489 value, | 489 value, |
490 (static_cast<CGFloat>(scrollbar->visibleSiz
e()) - overhang) / scrollbar->totalSize(), | 490 (static_cast<CGFloat>(scrollbar->visibleSiz
e()) - overhang) / scrollbar->totalSize(), |
491 scrollbar->frameRect()); | 491 scrollbar->frameRect()); |
492 | 492 |
493 IntRect tickmarkTrackRect(IntPoint(), trackRect(scrollbar, false).size()
); | 493 IntRect tickmarkTrackRect(IntPoint(), trackRect(scrollbar, false).size()
); |
494 // Inset by 2 on the left and 3 on the right. | 494 if (tickmarkTrackRect.width() <= 10) { |
495 tickmarkTrackRect.setX(tickmarkTrackRect.x() + 2); | 495 // For narrow scrollbars inset by 1 on the left and 3 on the right. |
496 tickmarkTrackRect.setWidth(tickmarkTrackRect.width() - 3); | 496 tickmarkTrackRect.setX(tickmarkTrackRect.x() + 1); |
| 497 tickmarkTrackRect.setWidth(tickmarkTrackRect.width() - 4); |
| 498 } else { |
| 499 // For wide scrollbars inset by 2 on the left and 3 on the right. |
| 500 tickmarkTrackRect.setX(tickmarkTrackRect.x() + 2); |
| 501 tickmarkTrackRect.setWidth(tickmarkTrackRect.width() - 5); |
| 502 } |
497 paintTickmarks(context, scrollbar, tickmarkTrackRect); | 503 paintTickmarks(context, scrollbar, tickmarkTrackRect); |
498 | 504 |
499 wkScrollbarPainterPaintKnob(scrollbarPainter); | 505 wkScrollbarPainterPaintKnob(scrollbarPainter); |
500 | 506 |
501 scrollAnimator->setIsDrawingIntoLayer(false); | 507 scrollAnimator->setIsDrawingIntoLayer(false); |
502 return true; | 508 return true; |
503 } | 509 } |
504 | 510 |
505 HIThemeTrackDrawInfo trackInfo; | 511 HIThemeTrackDrawInfo trackInfo; |
506 trackInfo.version = 0; | 512 trackInfo.version = 0; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 | 565 |
560 IntRect tickmarkTrackRect = trackRect(scrollbar, false); | 566 IntRect tickmarkTrackRect = trackRect(scrollbar, false); |
561 if (!canDrawDirectly) { | 567 if (!canDrawDirectly) { |
562 tickmarkTrackRect.setX(0); | 568 tickmarkTrackRect.setX(0); |
563 tickmarkTrackRect.setY(0); | 569 tickmarkTrackRect.setY(0); |
564 } | 570 } |
565 // The ends are rounded and the thumb doesn't go there. | 571 // The ends are rounded and the thumb doesn't go there. |
566 tickmarkTrackRect.inflateY(-tickmarkTrackRect.width()); | 572 tickmarkTrackRect.inflateY(-tickmarkTrackRect.width()); |
567 // Inset by 2 on the left and 3 on the right. | 573 // Inset by 2 on the left and 3 on the right. |
568 tickmarkTrackRect.setX(tickmarkTrackRect.x() + 2); | 574 tickmarkTrackRect.setX(tickmarkTrackRect.x() + 2); |
569 tickmarkTrackRect.setWidth(tickmarkTrackRect.width() - 3); | 575 tickmarkTrackRect.setWidth(tickmarkTrackRect.width() - 5); |
570 paintTickmarks(drawingContext, scrollbar, tickmarkTrackRect); | 576 paintTickmarks(drawingContext, scrollbar, tickmarkTrackRect); |
571 | 577 |
572 if (hasThumb(scrollbar)) { | 578 if (hasThumb(scrollbar)) { |
573 PlatformBridge::ThemePaintScrollbarInfo scrollbarInfo; | 579 PlatformBridge::ThemePaintScrollbarInfo scrollbarInfo; |
574 scrollbarInfo.orientation = scrollbar->orientation() == HorizontalScroll
bar ? PlatformBridge::ScrollbarOrientationHorizontal : PlatformBridge::Scrollbar
OrientationVertical; | 580 scrollbarInfo.orientation = scrollbar->orientation() == HorizontalScroll
bar ? PlatformBridge::ScrollbarOrientationHorizontal : PlatformBridge::Scrollbar
OrientationVertical; |
575 scrollbarInfo.parent = scrollbar->parent() && scrollbar->parent()->isFra
meView() && static_cast<FrameView*>(scrollbar->parent())->isScrollViewScrollbar(
scrollbar) ? PlatformBridge::ScrollbarParentScrollView : PlatformBridge::Scrollb
arParentRenderLayer; | 581 scrollbarInfo.parent = scrollbar->parent() && scrollbar->parent()->isFra
meView() && static_cast<FrameView*>(scrollbar->parent())->isScrollViewScrollbar(
scrollbar) ? PlatformBridge::ScrollbarParentScrollView : PlatformBridge::Scrollb
arParentRenderLayer; |
576 scrollbarInfo.maxValue = scrollbar->maximum(); | 582 scrollbarInfo.maxValue = scrollbar->maximum(); |
577 scrollbarInfo.currentValue = scrollbar->currentPos(); | 583 scrollbarInfo.currentValue = scrollbar->currentPos(); |
578 scrollbarInfo.visibleSize = scrollbar->visibleSize(); | 584 scrollbarInfo.visibleSize = scrollbar->visibleSize(); |
579 scrollbarInfo.totalSize = scrollbar->totalSize(); | 585 scrollbarInfo.totalSize = scrollbar->totalSize(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 // Paint. | 637 // Paint. |
632 FloatRect tickRect(rect.x(), yPos, rect.width(), 2); | 638 FloatRect tickRect(rect.x(), yPos, rect.width(), 2); |
633 context->fillRect(tickRect); | 639 context->fillRect(tickRect); |
634 context->strokeRect(tickRect, 1); | 640 context->strokeRect(tickRect, 1); |
635 } | 641 } |
636 | 642 |
637 context->restore(); | 643 context->restore(); |
638 } | 644 } |
639 | 645 |
640 } | 646 } |
OLD | NEW |