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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 } | 393 } |
394 | 394 |
395 void FrameView::setFrameRect(const IntRect& newRect) | 395 void FrameView::setFrameRect(const IntRect& newRect) |
396 { | 396 { |
397 IntRect oldRect = frameRect(); | 397 IntRect oldRect = frameRect(); |
398 if (newRect == oldRect) | 398 if (newRect == oldRect) |
399 return; | 399 return; |
400 | 400 |
401 Widget::setFrameRect(newRect); | 401 Widget::setFrameRect(newRect); |
402 | 402 |
403 updateScrollbars(scrollOffsetDouble()); | 403 updateScrollbars(); |
404 frameRectsChanged(); | 404 frameRectsChanged(); |
405 | 405 |
406 updateScrollableAreaSet(); | 406 updateScrollableAreaSet(); |
407 | 407 |
408 if (LayoutView* layoutView = this->layoutView()) { | 408 if (LayoutView* layoutView = this->layoutView()) { |
409 if (layoutView->usesCompositing()) | 409 if (layoutView->usesCompositing()) |
410 layoutView->compositor()->frameViewDidChangeSize(); | 410 layoutView->compositor()->frameViewDidChangeSize(); |
411 } | 411 } |
412 | 412 |
413 viewportSizeChanged(newRect.width() != oldRect.width(), newRect.height() !=
oldRect.height()); | 413 viewportSizeChanged(newRect.width() != oldRect.width(), newRect.height() !=
oldRect.height()); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 // Nobody set a custom style, so we just use a native scrollbar. | 501 // Nobody set a custom style, so we just use a native scrollbar. |
502 return Scrollbar::create(this, orientation, RegularScrollbar, &frame().page(
)->chromeClient()); | 502 return Scrollbar::create(this, orientation, RegularScrollbar, &frame().page(
)->chromeClient()); |
503 } | 503 } |
504 | 504 |
505 void FrameView::setContentsSize(const IntSize& size) | 505 void FrameView::setContentsSize(const IntSize& size) |
506 { | 506 { |
507 if (size == contentsSize()) | 507 if (size == contentsSize()) |
508 return; | 508 return; |
509 | 509 |
510 m_contentsSize = size; | 510 m_contentsSize = size; |
511 updateScrollbars(scrollOffsetDouble()); | 511 updateScrollbars(); |
512 ScrollableArea::contentsResized(); | 512 ScrollableArea::contentsResized(); |
513 | 513 |
514 Page* page = frame().page(); | 514 Page* page = frame().page(); |
515 if (!page) | 515 if (!page) |
516 return; | 516 return; |
517 | 517 |
518 updateScrollableAreaSet(); | 518 updateScrollableAreaSet(); |
519 | 519 |
520 page->chromeClient().contentsSizeChanged(m_frame.get(), size); | 520 page->chromeClient().contentsSizeChanged(m_frame.get(), size); |
521 frame().loader().restoreScrollPositionAndViewState(); | 521 frame().loader().restoreScrollPositionAndViewState(); |
(...skipping 10 matching lines...) Expand all Loading... |
532 const IntRect rect = layoutView->documentRect(); | 532 const IntRect rect = layoutView->documentRect(); |
533 const IntSize& size = rect.size(); | 533 const IntSize& size = rect.size(); |
534 | 534 |
535 const IntPoint origin(-rect.x(), -rect.y()); | 535 const IntPoint origin(-rect.x(), -rect.y()); |
536 if (scrollOrigin() != origin) { | 536 if (scrollOrigin() != origin) { |
537 ScrollableArea::setScrollOrigin(origin); | 537 ScrollableArea::setScrollOrigin(origin); |
538 // setContentSize (below) also calls updateScrollbars so we can avoid | 538 // setContentSize (below) also calls updateScrollbars so we can avoid |
539 // updating scrollbars twice by skipping the call here when the content | 539 // updating scrollbars twice by skipping the call here when the content |
540 // size does not change. | 540 // size does not change. |
541 if (!m_frame->document()->printing() && size == contentsSize()) | 541 if (!m_frame->document()->printing() && size == contentsSize()) |
542 updateScrollbars(scrollOffsetDouble()); | 542 updateScrollbars(); |
543 } | 543 } |
544 | 544 |
545 setContentsSize(size); | 545 setContentsSize(size); |
546 } | 546 } |
547 | 547 |
548 void FrameView::calculateScrollbarModesFromOverflowStyle(const ComputedStyle* st
yle, ScrollbarMode& hMode, ScrollbarMode& vMode) | 548 void FrameView::calculateScrollbarModesFromOverflowStyle(const ComputedStyle* st
yle, ScrollbarMode& hMode, ScrollbarMode& vMode) |
549 { | 549 { |
550 hMode = vMode = ScrollbarAuto; | 550 hMode = vMode = ScrollbarAuto; |
551 | 551 |
552 EOverflow overflowX = style->overflowX(); | 552 EOverflow overflowX = style->overflowX(); |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 if (hMode == ScrollbarAuto) | 1004 if (hMode == ScrollbarAuto) |
1005 setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This caus
es a horizontal scrollbar to disappear. | 1005 setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This caus
es a horizontal scrollbar to disappear. |
1006 | 1006 |
1007 setScrollbarModes(hMode, vMode); | 1007 setScrollbarModes(hMode, vMode); |
1008 setScrollbarsSuppressed(false); | 1008 setScrollbarsSuppressed(false); |
1009 } else if (hMode != currentHMode || vMode != currentVMode) { | 1009 } else if (hMode != currentHMode || vMode != currentVMode) { |
1010 setScrollbarModes(hMode, vMode); | 1010 setScrollbarModes(hMode, vMode); |
1011 } | 1011 } |
1012 | 1012 |
1013 if (needsScrollbarReconstruction() || scrollOriginChanged()) | 1013 if (needsScrollbarReconstruction() || scrollOriginChanged()) |
1014 updateScrollbars(scrollOffsetDouble()); | 1014 updateScrollbars(); |
1015 | 1015 |
1016 LayoutSize oldSize = m_size; | 1016 LayoutSize oldSize = m_size; |
1017 | 1017 |
1018 m_size = LayoutSize(layoutSize()); | 1018 m_size = LayoutSize(layoutSize()); |
1019 | 1019 |
1020 if (oldSize != m_size && !m_firstLayout) { | 1020 if (oldSize != m_size && !m_firstLayout) { |
1021 LayoutBox* rootLayoutObject = document->documentElement() ? docu
ment->documentElement()->layoutBox() : 0; | 1021 LayoutBox* rootLayoutObject = document->documentElement() ? docu
ment->documentElement()->layoutBox() : 0; |
1022 LayoutBox* bodyLayoutObject = rootLayoutObject && document->body
() ? document->body()->layoutBox() : 0; | 1022 LayoutBox* bodyLayoutObject = rootLayoutObject && document->body
() ? document->body()->layoutBox() : 0; |
1023 if (bodyLayoutObject && bodyLayoutObject->stretchesToViewport()) | 1023 if (bodyLayoutObject && bodyLayoutObject->stretchesToViewport()) |
1024 bodyLayoutObject->setChildNeedsLayout(); | 1024 bodyLayoutObject->setChildNeedsLayout(); |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2253 return !m_frame->document()->loadEventFinished(); | 2253 return !m_frame->document()->loadEventFinished(); |
2254 } | 2254 } |
2255 | 2255 |
2256 void FrameView::scrollbarStyleChanged() | 2256 void FrameView::scrollbarStyleChanged() |
2257 { | 2257 { |
2258 // FIXME: Why does this only apply to the main frame? | 2258 // FIXME: Why does this only apply to the main frame? |
2259 if (!m_frame->isMainFrame()) | 2259 if (!m_frame->isMainFrame()) |
2260 return; | 2260 return; |
2261 adjustScrollbarOpacity(); | 2261 adjustScrollbarOpacity(); |
2262 contentsResized(); | 2262 contentsResized(); |
2263 updateScrollbars(scrollOffsetDouble()); | 2263 updateScrollbars(); |
2264 positionScrollbarLayers(); | 2264 positionScrollbarLayers(); |
2265 } | 2265 } |
2266 | 2266 |
2267 void FrameView::notifyPageThatContentAreaWillPaint() const | 2267 void FrameView::notifyPageThatContentAreaWillPaint() const |
2268 { | 2268 { |
2269 Page* page = m_frame->page(); | 2269 Page* page = m_frame->page(); |
2270 if (!page) | 2270 if (!page) |
2271 return; | 2271 return; |
2272 | 2272 |
2273 contentAreaWillPaint(); | 2273 contentAreaWillPaint(); |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3156 | 3156 |
3157 if (horizontalLock) | 3157 if (horizontalLock) |
3158 setHorizontalScrollbarLock(); | 3158 setHorizontalScrollbarLock(); |
3159 | 3159 |
3160 if (verticalLock) | 3160 if (verticalLock) |
3161 setVerticalScrollbarLock(); | 3161 setVerticalScrollbarLock(); |
3162 | 3162 |
3163 if (!needsUpdate) | 3163 if (!needsUpdate) |
3164 return; | 3164 return; |
3165 | 3165 |
3166 updateScrollbars(scrollOffsetDouble()); | 3166 updateScrollbars(); |
3167 | 3167 |
3168 if (!layerForScrolling()) | 3168 if (!layerForScrolling()) |
3169 return; | 3169 return; |
3170 WebLayer* layer = layerForScrolling()->platformLayer(); | 3170 WebLayer* layer = layerForScrolling()->platformLayer(); |
3171 if (!layer) | 3171 if (!layer) |
3172 return; | 3172 return; |
3173 layer->setUserScrollable(userInputScrollable(HorizontalScrollbar), userInput
Scrollable(VerticalScrollbar)); | 3173 layer->setUserScrollable(userInputScrollable(HorizontalScrollbar), userInput
Scrollable(VerticalScrollbar)); |
3174 } | 3174 } |
3175 | 3175 |
3176 IntSize FrameView::visibleContentSize(IncludeScrollbarsInRect scrollbarInclusion
) const | 3176 IntSize FrameView::visibleContentSize(IncludeScrollbarsInRect scrollbarInclusion
) const |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3263 if (AXObjectCache* cache = m_frame->document()->existingAXObjectCache()) | 3263 if (AXObjectCache* cache = m_frame->document()->existingAXObjectCache()) |
3264 cache->handleScrollPositionChanged(this); | 3264 cache->handleScrollPositionChanged(this); |
3265 | 3265 |
3266 layoutView()->clearHitTestCache(); | 3266 layoutView()->clearHitTestCache(); |
3267 frame().loader().saveScrollState(); | 3267 frame().loader().saveScrollState(); |
3268 frame().loader().client()->didChangeScrollOffset(); | 3268 frame().loader().client()->didChangeScrollOffset(); |
3269 } | 3269 } |
3270 | 3270 |
3271 void FrameView::windowResizerRectChanged() | 3271 void FrameView::windowResizerRectChanged() |
3272 { | 3272 { |
3273 updateScrollbars(scrollOffsetDouble()); | 3273 updateScrollbars(); |
3274 } | 3274 } |
3275 | 3275 |
3276 bool FrameView::hasOverlayScrollbars() const | 3276 bool FrameView::hasOverlayScrollbars() const |
3277 { | 3277 { |
3278 | 3278 |
3279 return (m_horizontalScrollbar && m_horizontalScrollbar->isOverlayScrollbar()
) | 3279 return (m_horizontalScrollbar && m_horizontalScrollbar->isOverlayScrollbar()
) |
3280 || (m_verticalScrollbar && m_verticalScrollbar->isOverlayScrollbar()); | 3280 || (m_verticalScrollbar && m_verticalScrollbar->isOverlayScrollbar()); |
3281 } | 3281 } |
3282 | 3282 |
3283 void FrameView::computeScrollbarExistence(bool& newHasHorizontalScrollbar, bool&
newHasVerticalScrollbar, const IntSize& docSize, ComputeScrollbarExistenceOptio
n option) const | 3283 void FrameView::computeScrollbarExistence(bool& newHasHorizontalScrollbar, bool&
newHasVerticalScrollbar, const IntSize& docSize, ComputeScrollbarExistenceOptio
n option) const |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3434 || (m_verticalScrollbar && m_verticalScrollbar->isCustomScrollbar()); | 3434 || (m_verticalScrollbar && m_verticalScrollbar->isCustomScrollbar()); |
3435 | 3435 |
3436 return hasAnyScrollbar && (shouldUseCustom != hasCustom); | 3436 return hasAnyScrollbar && (shouldUseCustom != hasCustom); |
3437 } | 3437 } |
3438 | 3438 |
3439 bool FrameView::shouldIgnoreOverflowHidden() const | 3439 bool FrameView::shouldIgnoreOverflowHidden() const |
3440 { | 3440 { |
3441 return m_frame->settings()->ignoreMainFrameOverflowHiddenQuirk() && m_frame-
>isMainFrame(); | 3441 return m_frame->settings()->ignoreMainFrameOverflowHiddenQuirk() && m_frame-
>isMainFrame(); |
3442 } | 3442 } |
3443 | 3443 |
3444 void FrameView::updateScrollbars(const DoubleSize& desiredOffset) | 3444 void FrameView::updateScrollbars() |
3445 { | 3445 { |
3446 if (m_frame->settings() && m_frame->settings()->rootLayerScrolls()) | 3446 if (m_frame->settings() && m_frame->settings()->rootLayerScrolls()) |
3447 return; | 3447 return; |
3448 | 3448 |
3449 // Avoid drawing two sets of scrollbars when visual viewport is enabled. | 3449 // Avoid drawing two sets of scrollbars when visual viewport is enabled. |
3450 if (visualViewportSuppliesScrollbars()) { | 3450 if (visualViewportSuppliesScrollbars()) { |
3451 setHasHorizontalScrollbar(false); | 3451 setHasHorizontalScrollbar(false); |
3452 setHasVerticalScrollbar(false); | 3452 setHasVerticalScrollbar(false); |
3453 setScrollOffsetFromUpdateScrollbars(desiredOffset); | 3453 setScrollOffsetFromUpdateScrollbars(scrollOffsetDouble()); |
3454 return; | 3454 return; |
3455 } | 3455 } |
3456 | 3456 |
3457 if (m_inUpdateScrollbars) | 3457 if (m_inUpdateScrollbars) |
3458 return; | 3458 return; |
3459 InUpdateScrollbarsScope inUpdateScrollbarsScope(this); | 3459 InUpdateScrollbarsScope inUpdateScrollbarsScope(this); |
3460 | 3460 |
3461 bool scrollbarExistenceChanged = false; | 3461 bool scrollbarExistenceChanged = false; |
3462 | 3462 |
3463 if (needsScrollbarReconstruction()) { | 3463 if (needsScrollbarReconstruction()) { |
(...skipping 11 matching lines...) Expand all Loading... |
3475 | 3475 |
3476 updateScrollbarGeometry(); | 3476 updateScrollbarGeometry(); |
3477 | 3477 |
3478 if (scrollbarExistenceChanged) { | 3478 if (scrollbarExistenceChanged) { |
3479 // FIXME: Is frameRectsChanged really necessary here? Have any frame rec
ts changed? | 3479 // FIXME: Is frameRectsChanged really necessary here? Have any frame rec
ts changed? |
3480 frameRectsChanged(); | 3480 frameRectsChanged(); |
3481 positionScrollbarLayers(); | 3481 positionScrollbarLayers(); |
3482 updateScrollCorner(); | 3482 updateScrollCorner(); |
3483 } | 3483 } |
3484 | 3484 |
3485 setScrollOffsetFromUpdateScrollbars(desiredOffset); | 3485 setScrollOffsetFromUpdateScrollbars(scrollOffsetDouble()); |
3486 } | 3486 } |
3487 | 3487 |
3488 void FrameView::setScrollOffsetFromUpdateScrollbars(const DoubleSize& offset) | 3488 void FrameView::setScrollOffsetFromUpdateScrollbars(const DoubleSize& offset) |
3489 { | 3489 { |
3490 DoublePoint adjustedScrollPosition = clampScrollPosition(DoublePoint(offset)
); | 3490 DoublePoint adjustedScrollPosition = clampScrollPosition(DoublePoint(offset)
); |
3491 | 3491 |
3492 if (adjustedScrollPosition != scrollPositionDouble() || scrollOriginChanged(
)) { | 3492 if (adjustedScrollPosition != scrollPositionDouble() || scrollOriginChanged(
)) { |
3493 ScrollableArea::setScrollPosition(adjustedScrollPosition, ProgrammaticSc
roll); | 3493 ScrollableArea::setScrollPosition(adjustedScrollPosition, ProgrammaticSc
roll); |
3494 resetScrollOriginChanged(); | 3494 resetScrollOriginChanged(); |
3495 } | 3495 } |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4112 return m_hiddenForThrottling && m_crossOriginForThrottling; | 4112 return m_hiddenForThrottling && m_crossOriginForThrottling; |
4113 } | 4113 } |
4114 | 4114 |
4115 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const | 4115 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const |
4116 { | 4116 { |
4117 ASSERT(layoutView()); | 4117 ASSERT(layoutView()); |
4118 return *layoutView(); | 4118 return *layoutView(); |
4119 } | 4119 } |
4120 | 4120 |
4121 } // namespace blink | 4121 } // namespace blink |
OLD | NEW |