OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 3432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3443 // If we ever turn one scrollbar off, always turn the other one off too. | 3443 // If we ever turn one scrollbar off, always turn the other one off too. |
3444 // Never ever try to both gain/lose a scrollbar in the same pass. | 3444 // Never ever try to both gain/lose a scrollbar in the same pass. |
3445 if (!newHasHorizontalScrollbar && hasHorizontalScrollbar && vScroll != Scrol lbarAlwaysOn) | 3445 if (!newHasHorizontalScrollbar && hasHorizontalScrollbar && vScroll != Scrol lbarAlwaysOn) |
3446 newHasVerticalScrollbar = false; | 3446 newHasVerticalScrollbar = false; |
3447 if (!newHasVerticalScrollbar && hasVerticalScrollbar && hScroll != Scrollbar AlwaysOn) | 3447 if (!newHasVerticalScrollbar && hasVerticalScrollbar && hScroll != Scrollbar AlwaysOn) |
3448 newHasHorizontalScrollbar = false; | 3448 newHasHorizontalScrollbar = false; |
3449 } | 3449 } |
3450 | 3450 |
3451 void FrameView::updateScrollbarGeometry() | 3451 void FrameView::updateScrollbarGeometry() |
3452 { | 3452 { |
3453 bool scrollbarExistenceChanged = false; | |
pdr.
2014/10/14 22:02:21
Is the scrollbar existence changing, or just the s
| |
3453 if (m_horizontalScrollbar) { | 3454 if (m_horizontalScrollbar) { |
3454 int clientWidth = visibleWidth(); | 3455 int clientWidth = visibleWidth(); |
3455 IntRect oldRect(m_horizontalScrollbar->frameRect()); | 3456 IntRect oldRect(m_horizontalScrollbar->frameRect()); |
3456 IntRect hBarRect((shouldPlaceVerticalScrollbarOnLeft() && m_verticalScro llbar) ? m_verticalScrollbar->width() : 0, | 3457 IntRect hBarRect((shouldPlaceVerticalScrollbarOnLeft() && m_verticalScro llbar) ? m_verticalScrollbar->width() : 0, |
3457 height() - m_horizontalScrollbar->height(), | 3458 height() - m_horizontalScrollbar->height(), |
3458 width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0), | 3459 width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0), |
3459 m_horizontalScrollbar->height()); | 3460 m_horizontalScrollbar->height()); |
3460 m_horizontalScrollbar->setFrameRect(adjustScrollbarRectForResizer(hBarRe ct, m_horizontalScrollbar.get())); | 3461 m_horizontalScrollbar->setFrameRect(adjustScrollbarRectForResizer(hBarRe ct, m_horizontalScrollbar.get())); |
3461 if (!m_scrollbarsSuppressed && oldRect != m_horizontalScrollbar->frameRe ct()) | 3462 if (!m_scrollbarsSuppressed && oldRect != m_horizontalScrollbar->frameRe ct()) |
3462 m_horizontalScrollbar->invalidate(); | 3463 m_horizontalScrollbar->invalidate(); |
3463 | 3464 |
3465 oldRect = m_horizontalScrollbar->frameRect(); | |
pdr.
2014/10/14 22:02:21
Why do you need to store the oldRect here instead
| |
3464 if (m_scrollbarsSuppressed) | 3466 if (m_scrollbarsSuppressed) |
3465 m_horizontalScrollbar->setSuppressInvalidation(true); | 3467 m_horizontalScrollbar->setSuppressInvalidation(true); |
3466 m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth); | 3468 m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth); |
3467 m_horizontalScrollbar->setProportion(clientWidth, contentsWidth()); | 3469 m_horizontalScrollbar->setProportion(clientWidth, contentsWidth()); |
3468 m_horizontalScrollbar->offsetDidChange(); | 3470 m_horizontalScrollbar->offsetDidChange(); |
3469 if (m_scrollbarsSuppressed) | 3471 if (m_scrollbarsSuppressed) |
3470 m_horizontalScrollbar->setSuppressInvalidation(false); | 3472 m_horizontalScrollbar->setSuppressInvalidation(false); |
3473 if (oldRect != m_horizontalScrollbar->frameRect()) | |
3474 scrollbarExistenceChanged = true; | |
3471 } | 3475 } |
3472 | 3476 |
3473 if (m_verticalScrollbar) { | 3477 if (m_verticalScrollbar) { |
3474 int clientHeight = visibleHeight(); | 3478 int clientHeight = visibleHeight(); |
3475 IntRect oldRect(m_verticalScrollbar->frameRect()); | 3479 IntRect oldRect(m_verticalScrollbar->frameRect()); |
3476 IntRect vBarRect(shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - m _verticalScrollbar->width()), | 3480 IntRect vBarRect(shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - m _verticalScrollbar->width()), |
3477 0, | 3481 0, |
3478 m_verticalScrollbar->width(), | 3482 m_verticalScrollbar->width(), |
3479 height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0)); | 3483 height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0)); |
3480 m_verticalScrollbar->setFrameRect(adjustScrollbarRectForResizer(vBarRect , m_verticalScrollbar.get())); | 3484 m_verticalScrollbar->setFrameRect(adjustScrollbarRectForResizer(vBarRect , m_verticalScrollbar.get())); |
3481 if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect ()) | 3485 if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect ()) |
3482 m_verticalScrollbar->invalidate(); | 3486 m_verticalScrollbar->invalidate(); |
3483 | 3487 |
3488 oldRect = m_verticalScrollbar->frameRect(); | |
3484 if (m_scrollbarsSuppressed) | 3489 if (m_scrollbarsSuppressed) |
3485 m_verticalScrollbar->setSuppressInvalidation(true); | 3490 m_verticalScrollbar->setSuppressInvalidation(true); |
3486 m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight); | 3491 m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight); |
3487 m_verticalScrollbar->setProportion(clientHeight, contentsHeight()); | 3492 m_verticalScrollbar->setProportion(clientHeight, contentsHeight()); |
3488 m_verticalScrollbar->offsetDidChange(); | 3493 m_verticalScrollbar->offsetDidChange(); |
3489 if (m_scrollbarsSuppressed) | 3494 if (m_scrollbarsSuppressed) |
3490 m_verticalScrollbar->setSuppressInvalidation(false); | 3495 m_verticalScrollbar->setSuppressInvalidation(false); |
3496 if (oldRect != m_verticalScrollbar->frameRect()) | |
pdr.
2014/10/14 22:02:21
I don't understand the values we're seeing here. O
| |
3497 scrollbarExistenceChanged = true; | |
3491 } | 3498 } |
3499 | |
3500 if (scrollbarExistenceChanged) | |
3501 scrollbarExistenceDidChange(); | |
3492 } | 3502 } |
3493 | 3503 |
3494 IntRect FrameView::adjustScrollbarRectForResizer(const IntRect& rect, Scrollbar* scrollbar) | 3504 IntRect FrameView::adjustScrollbarRectForResizer(const IntRect& rect, Scrollbar* scrollbar) |
3495 { | 3505 { |
3496 // Get our window resizer rect and see if we overlap. Adjust to avoid the ov erlap | 3506 // Get our window resizer rect and see if we overlap. Adjust to avoid the ov erlap |
3497 // if necessary. | 3507 // if necessary. |
3498 IntRect adjustedRect(rect); | 3508 IntRect adjustedRect(rect); |
3499 bool overlapsResizer = false; | 3509 bool overlapsResizer = false; |
3500 if (!rect.isEmpty() && !windowResizerRect().isEmpty()) { | 3510 if (!rect.isEmpty() && !windowResizerRect().isEmpty()) { |
3501 IntRect resizerRect = convertFromContainingWindow(windowResizerRect()); | 3511 IntRect resizerRect = convertFromContainingWindow(windowResizerRect()); |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4223 return; | 4233 return; |
4224 | 4234 |
4225 ScrollableArea::setScrollOrigin(origin); | 4235 ScrollableArea::setScrollOrigin(origin); |
4226 | 4236 |
4227 // Update if the scroll origin changes, since our position will be different if the content size did not change. | 4237 // Update if the scroll origin changes, since our position will be different if the content size did not change. |
4228 if (updatePositionAtAll && updatePositionSynchronously) | 4238 if (updatePositionAtAll && updatePositionSynchronously) |
4229 updateScrollbars(scrollOffsetDouble()); | 4239 updateScrollbars(scrollOffsetDouble()); |
4230 } | 4240 } |
4231 | 4241 |
4232 } // namespace blink | 4242 } // namespace blink |
OLD | NEW |