| 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 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1691 { | 1691 { |
| 1692 if (m_frame->isMainFrame() && m_frame->document()) { | 1692 if (m_frame->isMainFrame() && m_frame->document()) { |
| 1693 if (TextAutosizer* textAutosizer = m_frame->document()->textAutosizer()) | 1693 if (TextAutosizer* textAutosizer = m_frame->document()->textAutosizer()) |
| 1694 textAutosizer->updatePageInfoInAllFrames(); | 1694 textAutosizer->updatePageInfoInAllFrames(); |
| 1695 } | 1695 } |
| 1696 | 1696 |
| 1697 ScrollableArea::contentsResized(); | 1697 ScrollableArea::contentsResized(); |
| 1698 setNeedsLayout(); | 1698 setNeedsLayout(); |
| 1699 } | 1699 } |
| 1700 | 1700 |
| 1701 void FrameView::scrollbarExistenceDidChange() | 1701 void FrameView::scrollbarNeedsLayout() |
| 1702 { | 1702 { |
| 1703 // We check to make sure the view is attached to a frame() as this method ca
n | 1703 // We check to make sure the view is attached to a frame() as this method ca
n |
| 1704 // be triggered before the view is attached by LocalFrame::createView(...) s
etting | 1704 // be triggered before the view is attached by LocalFrame::createView(...) s
etting |
| 1705 // various values such as setScrollBarModes(...) for example. An ASSERT is | 1705 // various values such as setScrollBarModes(...) for example. An ASSERT is |
| 1706 // triggered when a view is layout before being attached to a frame(). | 1706 // triggered when a view is layout before being attached to a frame(). |
| 1707 if (!frame().view()) | 1707 if (!frame().view()) |
| 1708 return; | 1708 return; |
| 1709 | 1709 |
| 1710 // Note that simply having overlay scrollbars is not sufficient to be | 1710 // Note that simply having overlay scrollbars is not sufficient to be |
| 1711 // certain that scrollbars' presence does not impact layout. This should | 1711 // certain that scrollbars' presence does not impact layout. This should |
| (...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3303 int clientWidth = visibleWidth(); | 3303 int clientWidth = visibleWidth(); |
| 3304 IntRect oldRect(m_horizontalScrollbar->frameRect()); | 3304 IntRect oldRect(m_horizontalScrollbar->frameRect()); |
| 3305 IntRect hBarRect((shouldPlaceVerticalScrollbarOnLeft() && m_verticalScro
llbar) ? m_verticalScrollbar->width() : 0, | 3305 IntRect hBarRect((shouldPlaceVerticalScrollbarOnLeft() && m_verticalScro
llbar) ? m_verticalScrollbar->width() : 0, |
| 3306 height() - m_horizontalScrollbar->height(), | 3306 height() - m_horizontalScrollbar->height(), |
| 3307 width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0), | 3307 width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0), |
| 3308 m_horizontalScrollbar->height()); | 3308 m_horizontalScrollbar->height()); |
| 3309 m_horizontalScrollbar->setFrameRect(adjustScrollbarRectForResizer(hBarRe
ct, m_horizontalScrollbar.get())); | 3309 m_horizontalScrollbar->setFrameRect(adjustScrollbarRectForResizer(hBarRe
ct, m_horizontalScrollbar.get())); |
| 3310 if (!m_scrollbarsSuppressed && oldRect != m_horizontalScrollbar->frameRe
ct()) | 3310 if (!m_scrollbarsSuppressed && oldRect != m_horizontalScrollbar->frameRe
ct()) |
| 3311 m_horizontalScrollbar->invalidate(); | 3311 m_horizontalScrollbar->invalidate(); |
| 3312 | 3312 |
| 3313 oldRect = m_horizontalScrollbar->frameRect(); |
| 3314 |
| 3313 if (m_scrollbarsSuppressed) | 3315 if (m_scrollbarsSuppressed) |
| 3314 m_horizontalScrollbar->setSuppressInvalidation(true); | 3316 m_horizontalScrollbar->setSuppressInvalidation(true); |
| 3315 m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth); | 3317 m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth); |
| 3316 m_horizontalScrollbar->setProportion(clientWidth, contentsWidth()); | 3318 m_horizontalScrollbar->setProportion(clientWidth, contentsWidth()); |
| 3317 m_horizontalScrollbar->offsetDidChange(); | 3319 m_horizontalScrollbar->offsetDidChange(); |
| 3318 if (m_scrollbarsSuppressed) | 3320 if (m_scrollbarsSuppressed) |
| 3319 m_horizontalScrollbar->setSuppressInvalidation(false); | 3321 m_horizontalScrollbar->setSuppressInvalidation(false); |
| 3322 |
| 3323 if (!m_scrollbarsSuppressed && oldRect != m_horizontalScrollbar->frameRe
ct() && m_horizontalScrollbar->isCustomScrollbar()) { |
| 3324 IntRect hBarRect((shouldPlaceVerticalScrollbarOnLeft() && m_vertical
Scrollbar) ? m_verticalScrollbar->width() : 0, |
| 3325 height() - m_horizontalScrollbar->height(), |
| 3326 width() - (m_verticalScrollbar ? m_verticalScrollbar->width() :
0), |
| 3327 m_horizontalScrollbar->height()); |
| 3328 m_horizontalScrollbar->setFrameRect(adjustScrollbarRectForResizer(hB
arRect, m_horizontalScrollbar.get())); |
| 3329 if (oldRect.height() != m_horizontalScrollbar->frameRect().height()) |
| 3330 scrollbarNeedsLayout(); |
| 3331 m_horizontalScrollbar->invalidate(); |
| 3332 } |
| 3320 } | 3333 } |
| 3321 | 3334 |
| 3322 if (m_verticalScrollbar) { | 3335 if (m_verticalScrollbar) { |
| 3323 int clientHeight = visibleHeight(); | 3336 int clientHeight = visibleHeight(); |
| 3324 IntRect oldRect(m_verticalScrollbar->frameRect()); | 3337 IntRect oldRect(m_verticalScrollbar->frameRect()); |
| 3325 IntRect vBarRect(shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - m
_verticalScrollbar->width()), | 3338 IntRect vBarRect(shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - m
_verticalScrollbar->width()), |
| 3326 0, | 3339 0, |
| 3327 m_verticalScrollbar->width(), | 3340 m_verticalScrollbar->width(), |
| 3328 height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height()
: 0)); | 3341 height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height()
: 0)); |
| 3329 m_verticalScrollbar->setFrameRect(adjustScrollbarRectForResizer(vBarRect
, m_verticalScrollbar.get())); | 3342 m_verticalScrollbar->setFrameRect(adjustScrollbarRectForResizer(vBarRect
, m_verticalScrollbar.get())); |
| 3330 if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect
()) | 3343 if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect
()) |
| 3331 m_verticalScrollbar->invalidate(); | 3344 m_verticalScrollbar->invalidate(); |
| 3332 | 3345 |
| 3346 oldRect = m_verticalScrollbar->frameRect(); |
| 3347 |
| 3333 if (m_scrollbarsSuppressed) | 3348 if (m_scrollbarsSuppressed) |
| 3334 m_verticalScrollbar->setSuppressInvalidation(true); | 3349 m_verticalScrollbar->setSuppressInvalidation(true); |
| 3335 m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight); | 3350 m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight); |
| 3336 m_verticalScrollbar->setProportion(clientHeight, contentsHeight()); | 3351 m_verticalScrollbar->setProportion(clientHeight, contentsHeight()); |
| 3337 m_verticalScrollbar->offsetDidChange(); | 3352 m_verticalScrollbar->offsetDidChange(); |
| 3338 if (m_scrollbarsSuppressed) | 3353 if (m_scrollbarsSuppressed) |
| 3339 m_verticalScrollbar->setSuppressInvalidation(false); | 3354 m_verticalScrollbar->setSuppressInvalidation(false); |
| 3355 |
| 3356 if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect
() && m_verticalScrollbar->isCustomScrollbar()) { |
| 3357 IntRect vBarRect(shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width()
- m_verticalScrollbar->width()), |
| 3358 0, |
| 3359 m_verticalScrollbar->width(), |
| 3360 height() - (m_horizontalScrollbar ? m_horizontalScrollbar->heigh
t() : 0)); |
| 3361 m_verticalScrollbar->setFrameRect(adjustScrollbarRectForResizer(vBar
Rect, m_verticalScrollbar.get())); |
| 3362 if (oldRect.width() != m_verticalScrollbar->frameRect().width()) |
| 3363 scrollbarNeedsLayout(); |
| 3364 m_verticalScrollbar->invalidate(); |
| 3365 } |
| 3340 } | 3366 } |
| 3341 } | 3367 } |
| 3342 | 3368 |
| 3343 IntRect FrameView::adjustScrollbarRectForResizer(const IntRect& rect, Scrollbar*
scrollbar) | 3369 IntRect FrameView::adjustScrollbarRectForResizer(const IntRect& rect, Scrollbar*
scrollbar) |
| 3344 { | 3370 { |
| 3345 // Get our window resizer rect and see if we overlap. Adjust to avoid the ov
erlap | 3371 // Get our window resizer rect and see if we overlap. Adjust to avoid the ov
erlap |
| 3346 // if necessary. | 3372 // if necessary. |
| 3347 IntRect adjustedRect(rect); | 3373 IntRect adjustedRect(rect); |
| 3348 bool overlapsResizer = false; | 3374 bool overlapsResizer = false; |
| 3349 if (!rect.isEmpty() && !windowResizerRect().isEmpty()) { | 3375 if (!rect.isEmpty() && !windowResizerRect().isEmpty()) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 3372 } | 3398 } |
| 3373 | 3399 |
| 3374 bool FrameView::adjustScrollbarExistence(ComputeScrollbarExistenceOption option) | 3400 bool FrameView::adjustScrollbarExistence(ComputeScrollbarExistenceOption option) |
| 3375 { | 3401 { |
| 3376 ASSERT(m_inUpdateScrollbars); | 3402 ASSERT(m_inUpdateScrollbars); |
| 3377 | 3403 |
| 3378 // If we came in here with the view already needing a layout, then go ahead
and do that | 3404 // If we came in here with the view already needing a layout, then go ahead
and do that |
| 3379 // first. (This will be the common case, e.g., when the page changes due to
window resizing for example). | 3405 // first. (This will be the common case, e.g., when the page changes due to
window resizing for example). |
| 3380 // This layout will not re-enter updateScrollbars and does not count towards
our max layout pass total. | 3406 // This layout will not re-enter updateScrollbars and does not count towards
our max layout pass total. |
| 3381 if (!m_scrollbarsSuppressed) | 3407 if (!m_scrollbarsSuppressed) |
| 3382 scrollbarExistenceDidChange(); | 3408 scrollbarNeedsLayout(); |
| 3383 | 3409 |
| 3384 bool hasHorizontalScrollbar = m_horizontalScrollbar; | 3410 bool hasHorizontalScrollbar = m_horizontalScrollbar; |
| 3385 bool hasVerticalScrollbar = m_verticalScrollbar; | 3411 bool hasVerticalScrollbar = m_verticalScrollbar; |
| 3386 | 3412 |
| 3387 bool newHasHorizontalScrollbar = false; | 3413 bool newHasHorizontalScrollbar = false; |
| 3388 bool newHasVerticalScrollbar = false; | 3414 bool newHasVerticalScrollbar = false; |
| 3389 computeScrollbarExistence(newHasHorizontalScrollbar, newHasVerticalScrollbar
, contentsSize(), option); | 3415 computeScrollbarExistence(newHasHorizontalScrollbar, newHasVerticalScrollbar
, contentsSize(), option); |
| 3390 | 3416 |
| 3391 bool scrollbarExistenceChanged = hasHorizontalScrollbar != newHasHorizontalS
crollbar || hasVerticalScrollbar != newHasVerticalScrollbar; | 3417 bool scrollbarExistenceChanged = hasHorizontalScrollbar != newHasHorizontalS
crollbar || hasVerticalScrollbar != newHasVerticalScrollbar; |
| 3392 if (!scrollbarExistenceChanged) | 3418 if (!scrollbarExistenceChanged) |
| 3393 return false; | 3419 return false; |
| 3394 | 3420 |
| 3395 setHasHorizontalScrollbar(newHasHorizontalScrollbar); | 3421 setHasHorizontalScrollbar(newHasHorizontalScrollbar); |
| 3396 setHasVerticalScrollbar(newHasVerticalScrollbar); | 3422 setHasVerticalScrollbar(newHasVerticalScrollbar); |
| 3397 | 3423 |
| 3398 if (m_scrollbarsSuppressed) | 3424 if (m_scrollbarsSuppressed) |
| 3399 return true; | 3425 return true; |
| 3400 | 3426 |
| 3401 if (!useOverlayScrollbars()) | 3427 if (!useOverlayScrollbars()) |
| 3402 contentsResized(); | 3428 contentsResized(); |
| 3403 scrollbarExistenceDidChange(); | 3429 scrollbarNeedsLayout(); |
| 3404 return true; | 3430 return true; |
| 3405 } | 3431 } |
| 3406 | 3432 |
| 3407 void FrameView::updateScrollbars(const DoubleSize& desiredOffset) | 3433 void FrameView::updateScrollbars(const DoubleSize& desiredOffset) |
| 3408 { | 3434 { |
| 3409 if (scrollbarsDisabled()) { | 3435 if (scrollbarsDisabled()) { |
| 3410 setScrollOffsetFromUpdateScrollbars(desiredOffset); | 3436 setScrollOffsetFromUpdateScrollbars(desiredOffset); |
| 3411 return; | 3437 return; |
| 3412 } | 3438 } |
| 3413 | 3439 |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3929 return; | 3955 return; |
| 3930 | 3956 |
| 3931 ScrollableArea::setScrollOrigin(origin); | 3957 ScrollableArea::setScrollOrigin(origin); |
| 3932 | 3958 |
| 3933 // Update if the scroll origin changes, since our position will be different
if the content size did not change. | 3959 // Update if the scroll origin changes, since our position will be different
if the content size did not change. |
| 3934 if (updatePositionAtAll && updatePositionSynchronously) | 3960 if (updatePositionAtAll && updatePositionSynchronously) |
| 3935 updateScrollbars(scrollOffsetDouble()); | 3961 updateScrollbars(scrollOffsetDouble()); |
| 3936 } | 3962 } |
| 3937 | 3963 |
| 3938 } // namespace blink | 3964 } // namespace blink |
| OLD | NEW |