Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 425 // Set up the range, but only do this if we're not in a nested call (to avoi d | 425 // Set up the range, but only do this if we're not in a nested call (to avoi d |
| 426 // doing it multiple times). | 426 // doing it multiple times). |
| 427 if (m_updateScrollbarsPass) | 427 if (m_updateScrollbarsPass) |
| 428 return; | 428 return; |
| 429 | 429 |
| 430 m_inUpdateScrollbars = true; | 430 m_inUpdateScrollbars = true; |
| 431 | 431 |
| 432 if (m_horizontalScrollbar) { | 432 if (m_horizontalScrollbar) { |
| 433 int clientWidth = visibleWidth(); | 433 int clientWidth = visibleWidth(); |
| 434 IntRect oldRect(m_horizontalScrollbar->frameRect()); | 434 IntRect oldRect(m_horizontalScrollbar->frameRect()); |
| 435 IntRect hBarRect(0, | 435 IntRect hBarRect((shouldPlaceVerticalScrollbarOnLeft() && m_verticalScro llbar) ? m_verticalScrollbar->width() : 0, |
| 436 height() - m_horizontalScrollbar->height(), | 436 height() - m_horizontalScrollbar->height(), |
| 437 width() - (m_verticalScrollbar ? m_verticalScrollbar->wi dth() : 0), | 437 width() - (m_verticalScrollbar ? m_verticalScrollbar->wi dth() : 0), |
| 438 m_horizontalScrollbar->height()); | 438 m_horizontalScrollbar->height()); |
| 439 m_horizontalScrollbar->setFrameRect(hBarRect); | 439 m_horizontalScrollbar->setFrameRect(hBarRect); |
| 440 if (!m_scrollbarsSuppressed && oldRect != m_horizontalScrollbar->frameRe ct()) | 440 if (!m_scrollbarsSuppressed && oldRect != m_horizontalScrollbar->frameRe ct()) |
| 441 m_horizontalScrollbar->invalidate(); | 441 m_horizontalScrollbar->invalidate(); |
| 442 | 442 |
| 443 if (m_scrollbarsSuppressed) | 443 if (m_scrollbarsSuppressed) |
| 444 m_horizontalScrollbar->setSuppressInvalidation(true); | 444 m_horizontalScrollbar->setSuppressInvalidation(true); |
| 445 m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth); | 445 m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth); |
| 446 m_horizontalScrollbar->setProportion(clientWidth, contentsWidth()); | 446 m_horizontalScrollbar->setProportion(clientWidth, contentsWidth()); |
| 447 if (m_scrollbarsSuppressed) | 447 if (m_scrollbarsSuppressed) |
| 448 m_horizontalScrollbar->setSuppressInvalidation(false); | 448 m_horizontalScrollbar->setSuppressInvalidation(false); |
| 449 } | 449 } |
| 450 | 450 |
| 451 if (m_verticalScrollbar) { | 451 if (m_verticalScrollbar) { |
| 452 int clientHeight = visibleHeight(); | 452 int clientHeight = visibleHeight(); |
| 453 IntRect oldRect(m_verticalScrollbar->frameRect()); | 453 IntRect oldRect(m_verticalScrollbar->frameRect()); |
| 454 IntRect vBarRect(width() - m_verticalScrollbar->width(), | 454 IntRect vBarRect(shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - m _verticalScrollbar->width()), |
|
eseidel
2013/11/13 18:00:53
ScrollView is also a parent of FrameView. I'm cur
| |
| 455 0, | 455 0, |
| 456 m_verticalScrollbar->width(), | 456 m_verticalScrollbar->width(), |
| 457 height() - (m_horizontalScrollbar ? m_horizontalScrollb ar->height() : 0)); | 457 height() - (m_horizontalScrollbar ? m_horizontalScrollb ar->height() : 0)); |
| 458 m_verticalScrollbar->setFrameRect(vBarRect); | 458 m_verticalScrollbar->setFrameRect(vBarRect); |
| 459 if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect ()) | 459 if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect ()) |
| 460 m_verticalScrollbar->invalidate(); | 460 m_verticalScrollbar->invalidate(); |
| 461 | 461 |
| 462 if (m_scrollbarsSuppressed) | 462 if (m_scrollbarsSuppressed) |
| 463 m_verticalScrollbar->setSuppressInvalidation(true); | 463 m_verticalScrollbar->setSuppressInvalidation(true); |
| 464 m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight); | 464 m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 491 if (m_verticalScrollbar) | 491 if (m_verticalScrollbar) |
| 492 m_verticalScrollbar->offsetDidChange(); | 492 m_verticalScrollbar->offsetDidChange(); |
| 493 | 493 |
| 494 m_inUpdateScrollbars = false; | 494 m_inUpdateScrollbars = false; |
| 495 } | 495 } |
| 496 | 496 |
| 497 const int panIconSizeLength = 16; | 497 const int panIconSizeLength = 16; |
| 498 | 498 |
| 499 IntRect ScrollView::rectToCopyOnScroll() const | 499 IntRect ScrollView::rectToCopyOnScroll() const |
| 500 { | 500 { |
| 501 IntRect scrollViewRect = convertToRootView(IntRect(0, 0, visibleWidth(), vis ibleHeight())); | 501 IntRect scrollViewRect = convertToRootView(IntRect((shouldPlaceVerticalScrol lbarOnLeft() && verticalScrollbar()) ? verticalScrollbar()->width() : 0, 0, visi bleWidth(), visibleHeight())); |
| 502 if (hasOverlayScrollbars()) { | 502 if (hasOverlayScrollbars()) { |
| 503 int verticalScrollbarWidth = (verticalScrollbar() && !hasLayerForVertica lScrollbar()) ? verticalScrollbar()->width() : 0; | 503 int verticalScrollbarWidth = (verticalScrollbar() && !hasLayerForVertica lScrollbar()) ? verticalScrollbar()->width() : 0; |
| 504 int horizontalScrollbarHeight = (horizontalScrollbar() && !hasLayerForHo rizontalScrollbar()) ? horizontalScrollbar()->height() : 0; | 504 int horizontalScrollbarHeight = (horizontalScrollbar() && !hasLayerForHo rizontalScrollbar()) ? horizontalScrollbar()->height() : 0; |
| 505 | 505 |
| 506 scrollViewRect.setWidth(scrollViewRect.width() - verticalScrollbarWidth) ; | 506 scrollViewRect.setWidth(scrollViewRect.width() - verticalScrollbarWidth) ; |
| 507 scrollViewRect.setHeight(scrollViewRect.height() - horizontalScrollbarHe ight); | 507 scrollViewRect.setHeight(scrollViewRect.height() - horizontalScrollbarHe ight); |
| 508 } | 508 } |
| 509 return scrollViewRect; | 509 return scrollViewRect; |
| 510 } | 510 } |
| 511 | 511 |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 785 } | 785 } |
| 786 | 786 |
| 787 IntRect ScrollView::scrollCornerRect() const | 787 IntRect ScrollView::scrollCornerRect() const |
| 788 { | 788 { |
| 789 IntRect cornerRect; | 789 IntRect cornerRect; |
| 790 | 790 |
| 791 if (hasOverlayScrollbars()) | 791 if (hasOverlayScrollbars()) |
| 792 return cornerRect; | 792 return cornerRect; |
| 793 | 793 |
| 794 if (m_horizontalScrollbar && width() - m_horizontalScrollbar->width() > 0) { | 794 if (m_horizontalScrollbar && width() - m_horizontalScrollbar->width() > 0) { |
| 795 cornerRect.unite(IntRect(m_horizontalScrollbar->width(), | 795 cornerRect.unite(IntRect(shouldPlaceVerticalScrollbarOnLeft() ? 0 : m_ho rizontalScrollbar->width(), |
| 796 height() - m_horizontalScrollbar->height(), | 796 height() - m_horizontalScrollbar->height(), |
| 797 width() - m_horizontalScrollbar->width(), | 797 width() - m_horizontalScrollbar->width(), |
| 798 m_horizontalScrollbar->height())); | 798 m_horizontalScrollbar->height())); |
| 799 } | 799 } |
| 800 | 800 |
| 801 if (m_verticalScrollbar && height() - m_verticalScrollbar->height() > 0) { | 801 if (m_verticalScrollbar && height() - m_verticalScrollbar->height() > 0) { |
| 802 cornerRect.unite(IntRect(width() - m_verticalScrollbar->width(), | 802 cornerRect.unite(IntRect(shouldPlaceVerticalScrollbarOnLeft() ? 0 : (wid th() - m_verticalScrollbar->width()), |
| 803 m_verticalScrollbar->height(), | 803 m_verticalScrollbar->height(), |
| 804 m_verticalScrollbar->width(), | 804 m_verticalScrollbar->width(), |
| 805 height() - m_verticalScrollbar->height())); | 805 height() - m_verticalScrollbar->height())); |
| 806 } | 806 } |
| 807 | 807 |
| 808 return cornerRect; | 808 return cornerRect; |
| 809 } | 809 } |
| 810 | 810 |
| 811 bool ScrollView::isScrollCornerVisible() const | 811 bool ScrollView::isScrollCornerVisible() const |
| 812 { | 812 { |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1137 int ScrollView::pageStep(ScrollbarOrientation orientation) const | 1137 int ScrollView::pageStep(ScrollbarOrientation orientation) const |
| 1138 { | 1138 { |
| 1139 int length = (orientation == HorizontalScrollbar) ? visibleWidth() : visible Height(); | 1139 int length = (orientation == HorizontalScrollbar) ? visibleWidth() : visible Height(); |
| 1140 int minPageStep = static_cast<float>(length) * minFractionToStepWhenPaging() ; | 1140 int minPageStep = static_cast<float>(length) * minFractionToStepWhenPaging() ; |
| 1141 int pageStep = std::max(minPageStep, length - maxOverlapBetweenPages()); | 1141 int pageStep = std::max(minPageStep, length - maxOverlapBetweenPages()); |
| 1142 | 1142 |
| 1143 return std::max(pageStep, 1); | 1143 return std::max(pageStep, 1); |
| 1144 } | 1144 } |
| 1145 | 1145 |
| 1146 } // namespace WebCore | 1146 } // namespace WebCore |
| OLD | NEW |