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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/Scrollbar.cpp

Issue 1603253003: Add dedicated windowToViewport method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months 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) 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 , m_trackNeedsRepaint(true) 74 , m_trackNeedsRepaint(true)
75 , m_thumbNeedsRepaint(true) 75 , m_thumbNeedsRepaint(true)
76 { 76 {
77 m_theme.registerScrollbar(*this); 77 m_theme.registerScrollbar(*this);
78 78
79 // FIXME: This is ugly and would not be necessary if we fix cross-platform c ode to actually query for 79 // FIXME: This is ugly and would not be necessary if we fix cross-platform c ode to actually query for
80 // scrollbar thickness and use it when sizing scrollbars (rather than leavin g one dimension of the scrollbar 80 // scrollbar thickness and use it when sizing scrollbars (rather than leavin g one dimension of the scrollbar
81 // alone when sizing). 81 // alone when sizing).
82 int thickness = m_theme.scrollbarThickness(controlSize); 82 int thickness = m_theme.scrollbarThickness(controlSize);
83 if (m_hostWindow) 83 if (m_hostWindow)
84 thickness = m_hostWindow->screenToViewport(thickness); 84 thickness = m_hostWindow->windowToViewport(thickness);
85 Widget::setFrameRect(IntRect(0, 0, thickness, thickness)); 85 Widget::setFrameRect(IntRect(0, 0, thickness, thickness));
86 86
87 m_currentPos = scrollableAreaCurrentPos(); 87 m_currentPos = scrollableAreaCurrentPos();
88 } 88 }
89 89
90 Scrollbar::~Scrollbar() 90 Scrollbar::~Scrollbar()
91 { 91 {
92 m_theme.unregisterScrollbar(*this); 92 m_theme.unregisterScrollbar(*this);
93 } 93 }
94 94
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 m_enabled = e; 475 m_enabled = e;
476 theme().updateEnabledState(*this); 476 theme().updateEnabledState(*this);
477 setNeedsPaintInvalidation(AllParts); 477 setNeedsPaintInvalidation(AllParts);
478 } 478 }
479 479
480 int Scrollbar::scrollbarThickness() const 480 int Scrollbar::scrollbarThickness() const
481 { 481 {
482 int thickness = orientation() == HorizontalScrollbar ? height() : width(); 482 int thickness = orientation() == HorizontalScrollbar ? height() : width();
483 if (!thickness || !m_hostWindow) 483 if (!thickness || !m_hostWindow)
484 return thickness; 484 return thickness;
485 return m_hostWindow->screenToViewport(m_theme.scrollbarThickness(controlSize ())); 485 return m_hostWindow->windowToViewport(m_theme.scrollbarThickness(controlSize ()));
486 } 486 }
487 487
488 488
489 bool Scrollbar::isOverlayScrollbar() const 489 bool Scrollbar::isOverlayScrollbar() const
490 { 490 {
491 return m_theme.usesOverlayScrollbars(); 491 return m_theme.usesOverlayScrollbars();
492 } 492 }
493 493
494 bool Scrollbar::shouldParticipateInHitTesting() 494 bool Scrollbar::shouldParticipateInHitTesting()
495 { 495 {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 invalidParts = AllParts; 579 invalidParts = AllParts;
580 if (invalidParts & ~ThumbPart) 580 if (invalidParts & ~ThumbPart)
581 m_trackNeedsRepaint = true; 581 m_trackNeedsRepaint = true;
582 if (invalidParts & ThumbPart) 582 if (invalidParts & ThumbPart)
583 m_thumbNeedsRepaint = true; 583 m_thumbNeedsRepaint = true;
584 if (m_scrollableArea) 584 if (m_scrollableArea)
585 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation()); 585 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation());
586 } 586 }
587 587
588 } // namespace blink 588 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698