| 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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 if (Settings* settings = m_frame->settings()) { | 483 if (Settings* settings = m_frame->settings()) { |
| 484 if (!settings->allowCustomScrollbarInMainFrame() && m_frame->isMainFrame
()) | 484 if (!settings->allowCustomScrollbarInMainFrame() && m_frame->isMainFrame
()) |
| 485 return false; | 485 return false; |
| 486 } | 486 } |
| 487 | 487 |
| 488 // FIXME: We need to update the scrollbar dynamically as documents change (o
r as doc elements and bodies get discovered that have custom styles). | 488 // FIXME: We need to update the scrollbar dynamically as documents change (o
r as doc elements and bodies get discovered that have custom styles). |
| 489 Document* doc = m_frame->document(); | 489 Document* doc = m_frame->document(); |
| 490 | 490 |
| 491 // Try the <body> element first as a scrollbar source. | 491 // Try the <body> element first as a scrollbar source. |
| 492 Element* body = doc ? doc->body() : 0; | 492 Element* body = doc ? doc->body() : 0; |
| 493 if (body && body->renderer() && body->renderer()->style()->hasPseudoStyle(SC
ROLLBAR)) { | 493 if (body && body->layoutObject() && body->layoutObject()->style()->hasPseudo
Style(SCROLLBAR)) { |
| 494 customScrollbarElement = body; | 494 customScrollbarElement = body; |
| 495 return true; | 495 return true; |
| 496 } | 496 } |
| 497 | 497 |
| 498 // If the <body> didn't have a custom style, then the root element might. | 498 // If the <body> didn't have a custom style, then the root element might. |
| 499 Element* docElement = doc ? doc->documentElement() : 0; | 499 Element* docElement = doc ? doc->documentElement() : 0; |
| 500 if (docElement && docElement->renderer() && docElement->renderer()->style()-
>hasPseudoStyle(SCROLLBAR)) { | 500 if (docElement && docElement->layoutObject() && docElement->layoutObject()->
style()->hasPseudoStyle(SCROLLBAR)) { |
| 501 customScrollbarElement = docElement; | 501 customScrollbarElement = docElement; |
| 502 return true; | 502 return true; |
| 503 } | 503 } |
| 504 | 504 |
| 505 // If we have an owning ipage/LocalFrame element, then it can set the custom
scrollbar also. | 505 // If we have an owning ipage/LocalFrame element, then it can set the custom
scrollbar also. |
| 506 LayoutPart* frameLayoutObject = m_frame->ownerLayoutObject(); | 506 LayoutPart* frameLayoutObject = m_frame->ownerLayoutObject(); |
| 507 if (frameLayoutObject && frameLayoutObject->style()->hasPseudoStyle(SCROLLBA
R)) { | 507 if (frameLayoutObject && frameLayoutObject->style()->hasPseudoStyle(SCROLLBA
R)) { |
| 508 customScrollbarFrame = m_frame.get(); | 508 customScrollbarFrame = m_frame.get(); |
| 509 return true; | 509 return true; |
| 510 } | 510 } |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 hMode = ScrollbarAuto; | 645 hMode = ScrollbarAuto; |
| 646 vMode = ScrollbarAuto; | 646 vMode = ScrollbarAuto; |
| 647 } else { | 647 } else { |
| 648 hMode = ScrollbarAlwaysOff; | 648 hMode = ScrollbarAlwaysOff; |
| 649 vMode = ScrollbarAlwaysOff; | 649 vMode = ScrollbarAlwaysOff; |
| 650 } | 650 } |
| 651 | 651 |
| 652 if (!isSubtreeLayout()) { | 652 if (!isSubtreeLayout()) { |
| 653 Document* document = m_frame->document(); | 653 Document* document = m_frame->document(); |
| 654 Node* body = document->body(); | 654 Node* body = document->body(); |
| 655 if (isHTMLFrameSetElement(body) && body->renderer()) { | 655 if (isHTMLFrameSetElement(body) && body->layoutObject()) { |
| 656 vMode = ScrollbarAlwaysOff; | 656 vMode = ScrollbarAlwaysOff; |
| 657 hMode = ScrollbarAlwaysOff; | 657 hMode = ScrollbarAlwaysOff; |
| 658 } else if (Element* viewportElement = document->viewportDefiningElement(
)) { | 658 } else if (Element* viewportElement = document->viewportDefiningElement(
)) { |
| 659 if (LayoutObject* viewportRenderer = viewportElement->renderer()) { | 659 if (LayoutObject* viewportRenderer = viewportElement->layoutObject()
) { |
| 660 if (viewportRenderer->style()) | 660 if (viewportRenderer->style()) |
| 661 applyOverflowToViewportAndSetRenderer(viewportRenderer, hMod
e, vMode); | 661 applyOverflowToViewportAndSetRenderer(viewportRenderer, hMod
e, vMode); |
| 662 } | 662 } |
| 663 } | 663 } |
| 664 } | 664 } |
| 665 } | 665 } |
| 666 | 666 |
| 667 void FrameView::updateAcceleratedCompositingSettings() | 667 void FrameView::updateAcceleratedCompositingSettings() |
| 668 { | 668 { |
| 669 if (LayoutView* layoutView = this->layoutView()) | 669 if (LayoutView* layoutView = this->layoutView()) |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 } | 1003 } |
| 1004 | 1004 |
| 1005 FontCachePurgePreventer fontCachePurgePreventer; | 1005 FontCachePurgePreventer fontCachePurgePreventer; |
| 1006 { | 1006 { |
| 1007 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled,
false); | 1007 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled,
false); |
| 1008 | 1008 |
| 1009 m_nestedLayoutCount++; | 1009 m_nestedLayoutCount++; |
| 1010 if (!inSubtreeLayout) { | 1010 if (!inSubtreeLayout) { |
| 1011 clearLayoutSubtreeRootsAndMarkContainingBlocks(); | 1011 clearLayoutSubtreeRootsAndMarkContainingBlocks(); |
| 1012 Node* body = document->body(); | 1012 Node* body = document->body(); |
| 1013 if (body && body->renderer()) { | 1013 if (body && body->layoutObject()) { |
| 1014 if (isHTMLFrameSetElement(*body)) { | 1014 if (isHTMLFrameSetElement(*body)) { |
| 1015 body->renderer()->setChildNeedsLayout(); | 1015 body->layoutObject()->setChildNeedsLayout(); |
| 1016 } else if (isHTMLBodyElement(*body)) { | 1016 } else if (isHTMLBodyElement(*body)) { |
| 1017 if (!m_firstLayout && m_size.height() != layoutSize().height
() && body->renderer()->enclosingBox()->stretchesToViewport()) | 1017 if (!m_firstLayout && m_size.height() != layoutSize().height
() && body->layoutObject()->enclosingBox()->stretchesToViewport()) |
| 1018 body->renderer()->setChildNeedsLayout(); | 1018 body->layoutObject()->setChildNeedsLayout(); |
| 1019 } | 1019 } |
| 1020 } | 1020 } |
| 1021 } | 1021 } |
| 1022 updateCounters(); | 1022 updateCounters(); |
| 1023 | 1023 |
| 1024 ScrollbarMode hMode; | 1024 ScrollbarMode hMode; |
| 1025 ScrollbarMode vMode; | 1025 ScrollbarMode vMode; |
| 1026 calculateScrollbarModesForLayoutAndSetViewportRenderer(hMode, vMode); | 1026 calculateScrollbarModesForLayoutAndSetViewportRenderer(hMode, vMode); |
| 1027 | 1027 |
| 1028 if (!inSubtreeLayout) { | 1028 if (!inSubtreeLayout) { |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 if (!child->isLocalFrame()) | 1366 if (!child->isLocalFrame()) |
| 1367 continue; | 1367 continue; |
| 1368 if (FrameView* view = toLocalFrame(child)->view()) | 1368 if (FrameView* view = toLocalFrame(child)->view()) |
| 1369 view->scrollContentsIfNeededRecursive(); | 1369 view->scrollContentsIfNeededRecursive(); |
| 1370 } | 1370 } |
| 1371 } | 1371 } |
| 1372 | 1372 |
| 1373 // FIXME: If we had a flag to force invalidations in a whole subtree, we could g
et rid of this function (crbug.com/410097). | 1373 // FIXME: If we had a flag to force invalidations in a whole subtree, we could g
et rid of this function (crbug.com/410097). |
| 1374 static void setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(c
onst Layer* layer) | 1374 static void setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(c
onst Layer* layer) |
| 1375 { | 1375 { |
| 1376 layer->renderer()->setShouldDoFullPaintInvalidation(); | 1376 layer->layoutObject()->setShouldDoFullPaintInvalidation(); |
| 1377 | 1377 |
| 1378 for (Layer* child = layer->firstChild(); child; child = child->nextSibling()
) { | 1378 for (Layer* child = layer->firstChild(); child; child = child->nextSibling()
) { |
| 1379 // Don't include paint invalidation rects for composited child layers; t
hey will paint themselves and have a different origin. | 1379 // Don't include paint invalidation rects for composited child layers; t
hey will paint themselves and have a different origin. |
| 1380 if (child->isPaintInvalidationContainer()) | 1380 if (child->isPaintInvalidationContainer()) |
| 1381 continue; | 1381 continue; |
| 1382 | 1382 |
| 1383 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(child
); | 1383 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(child
); |
| 1384 } | 1384 } |
| 1385 } | 1385 } |
| 1386 | 1386 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 cancelProgrammaticScrollAnimation(); | 1579 cancelProgrammaticScrollAnimation(); |
| 1580 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); | 1580 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); |
| 1581 m_maintainScrollPositionAnchor = nullptr; | 1581 m_maintainScrollPositionAnchor = nullptr; |
| 1582 | 1582 |
| 1583 DoublePoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint)
; | 1583 DoublePoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint)
; |
| 1584 if (newScrollPosition == scrollPositionDouble()) | 1584 if (newScrollPosition == scrollPositionDouble()) |
| 1585 return; | 1585 return; |
| 1586 | 1586 |
| 1587 if (scrollBehavior == ScrollBehaviorAuto) { | 1587 if (scrollBehavior == ScrollBehaviorAuto) { |
| 1588 Element* scrollElement = RuntimeEnabledFeatures::scrollTopLeftInteropEna
bled() ? m_frame->document()->documentElement() : m_frame->document()->body(); | 1588 Element* scrollElement = RuntimeEnabledFeatures::scrollTopLeftInteropEna
bled() ? m_frame->document()->documentElement() : m_frame->document()->body(); |
| 1589 LayoutObject* renderer = scrollElement ? scrollElement->renderer() : nul
lptr; | 1589 LayoutObject* renderer = scrollElement ? scrollElement->layoutObject() :
nullptr; |
| 1590 if (renderer && renderer->style()->scrollBehavior() == ScrollBehaviorSmo
oth) | 1590 if (renderer && renderer->style()->scrollBehavior() == ScrollBehaviorSmo
oth) |
| 1591 scrollBehavior = ScrollBehaviorSmooth; | 1591 scrollBehavior = ScrollBehaviorSmooth; |
| 1592 else | 1592 else |
| 1593 scrollBehavior = ScrollBehaviorInstant; | 1593 scrollBehavior = ScrollBehaviorInstant; |
| 1594 } | 1594 } |
| 1595 | 1595 |
| 1596 if (scrollBehavior == ScrollBehaviorInstant) { | 1596 if (scrollBehavior == ScrollBehaviorInstant) { |
| 1597 DoubleSize newOffset(newScrollPosition.x(), newScrollPosition.y()); | 1597 DoubleSize newOffset(newScrollPosition.x(), newScrollPosition.y()); |
| 1598 updateScrollbars(newOffset); | 1598 updateScrollbars(newOffset); |
| 1599 } else { | 1599 } else { |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1982 } | 1982 } |
| 1983 } | 1983 } |
| 1984 } | 1984 } |
| 1985 | 1985 |
| 1986 void FrameView::scrollToAnchor() | 1986 void FrameView::scrollToAnchor() |
| 1987 { | 1987 { |
| 1988 RefPtrWillBeRawPtr<Node> anchorNode = m_maintainScrollPositionAnchor; | 1988 RefPtrWillBeRawPtr<Node> anchorNode = m_maintainScrollPositionAnchor; |
| 1989 if (!anchorNode) | 1989 if (!anchorNode) |
| 1990 return; | 1990 return; |
| 1991 | 1991 |
| 1992 if (!anchorNode->renderer()) | 1992 if (!anchorNode->layoutObject()) |
| 1993 return; | 1993 return; |
| 1994 | 1994 |
| 1995 LayoutRect rect; | 1995 LayoutRect rect; |
| 1996 if (anchorNode != m_frame->document()) | 1996 if (anchorNode != m_frame->document()) |
| 1997 rect = anchorNode->boundingBox(); | 1997 rect = anchorNode->boundingBox(); |
| 1998 | 1998 |
| 1999 RefPtrWillBeRawPtr<Frame> boundaryFrame = m_frame->findUnsafeParentScrollPro
pagationBoundary(); | 1999 RefPtrWillBeRawPtr<Frame> boundaryFrame = m_frame->findUnsafeParentScrollPro
pagationBoundary(); |
| 2000 | 2000 |
| 2001 // FIXME: Handle RemoteFrames | 2001 // FIXME: Handle RemoteFrames |
| 2002 if (boundaryFrame && boundaryFrame->isLocalFrame()) | 2002 if (boundaryFrame && boundaryFrame->isLocalFrame()) |
| 2003 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollToPar
ent(false); | 2003 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollToPar
ent(false); |
| 2004 | 2004 |
| 2005 // Scroll nested layers and frames to reveal the anchor. | 2005 // Scroll nested layers and frames to reveal the anchor. |
| 2006 // Align to the top and to the closest side (this matches other browsers). | 2006 // Align to the top and to the closest side (this matches other browsers). |
| 2007 anchorNode->renderer()->scrollRectToVisible(rect, ScrollAlignment::alignToEd
geIfNeeded, ScrollAlignment::alignTopAlways); | 2007 anchorNode->layoutObject()->scrollRectToVisible(rect, ScrollAlignment::align
ToEdgeIfNeeded, ScrollAlignment::alignTopAlways); |
| 2008 | 2008 |
| 2009 if (boundaryFrame && boundaryFrame->isLocalFrame()) | 2009 if (boundaryFrame && boundaryFrame->isLocalFrame()) |
| 2010 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollToPar
ent(true); | 2010 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollToPar
ent(true); |
| 2011 | 2011 |
| 2012 if (AXObjectCache* cache = m_frame->document()->existingAXObjectCache()) | 2012 if (AXObjectCache* cache = m_frame->document()->existingAXObjectCache()) |
| 2013 cache->handleScrolledToAnchor(anchorNode.get()); | 2013 cache->handleScrolledToAnchor(anchorNode.get()); |
| 2014 | 2014 |
| 2015 // scrollRectToVisible can call into setScrollPosition(), which resets m_mai
ntainScrollPositionAnchor. | 2015 // scrollRectToVisible can call into setScrollPosition(), which resets m_mai
ntainScrollPositionAnchor. |
| 2016 m_maintainScrollPositionAnchor = anchorNode; | 2016 m_maintainScrollPositionAnchor = anchorNode; |
| 2017 } | 2017 } |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2225 FrameView* parentView = ownerElement->document().view(); | 2225 FrameView* parentView = ownerElement->document().view(); |
| 2226 if (parentView) | 2226 if (parentView) |
| 2227 clipRect.intersect(parentView->windowClipRectForFrameOwner(ownerElement)
); | 2227 clipRect.intersect(parentView->windowClipRectForFrameOwner(ownerElement)
); |
| 2228 return clipRect; | 2228 return clipRect; |
| 2229 } | 2229 } |
| 2230 | 2230 |
| 2231 IntRect FrameView::windowClipRectForFrameOwner(const HTMLFrameOwnerElement* owne
rElement) const | 2231 IntRect FrameView::windowClipRectForFrameOwner(const HTMLFrameOwnerElement* owne
rElement) const |
| 2232 { | 2232 { |
| 2233 // The renderer can sometimes be null when style="display:none" interacts | 2233 // The renderer can sometimes be null when style="display:none" interacts |
| 2234 // with external content and plugins. | 2234 // with external content and plugins. |
| 2235 if (!ownerElement->renderer()) | 2235 if (!ownerElement->layoutObject()) |
| 2236 return windowClipRect(); | 2236 return windowClipRect(); |
| 2237 | 2237 |
| 2238 // If we have no layer, just return our window clip rect. | 2238 // If we have no layer, just return our window clip rect. |
| 2239 const Layer* enclosingLayer = ownerElement->renderer()->enclosingLayer(); | 2239 const Layer* enclosingLayer = ownerElement->layoutObject()->enclosingLayer()
; |
| 2240 if (!enclosingLayer) | 2240 if (!enclosingLayer) |
| 2241 return windowClipRect(); | 2241 return windowClipRect(); |
| 2242 | 2242 |
| 2243 // FIXME: childrenClipRect relies on compositingState, which is not necessar
ily up to date. | 2243 // FIXME: childrenClipRect relies on compositingState, which is not necessar
ily up to date. |
| 2244 // https://code.google.com/p/chromium/issues/detail?id=343769 | 2244 // https://code.google.com/p/chromium/issues/detail?id=343769 |
| 2245 DisableCompositingQueryAsserts disabler; | 2245 DisableCompositingQueryAsserts disabler; |
| 2246 | 2246 |
| 2247 // Apply the clip from the layer. | 2247 // Apply the clip from the layer. |
| 2248 IntRect clipRect = contentsToWindow(pixelSnappedIntRect(enclosingLayer->clip
per().childrenClipRect())); | 2248 IntRect clipRect = contentsToWindow(pixelSnappedIntRect(enclosingLayer->clip
per().childrenClipRect())); |
| 2249 return intersection(clipRect, windowClipRect()); | 2249 return intersection(clipRect, windowClipRect()); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2373 | 2373 |
| 2374 // Covers #1 | 2374 // Covers #1 |
| 2375 IntSize contentsSize = this->contentsSize(); | 2375 IntSize contentsSize = this->contentsSize(); |
| 2376 IntSize visibleContentSize = visibleContentRect().size(); | 2376 IntSize visibleContentSize = visibleContentRect().size(); |
| 2377 if ((contentsSize.height() <= visibleContentSize.height() && contentsSize.wi
dth() <= visibleContentSize.width())) | 2377 if ((contentsSize.height() <= visibleContentSize.height() && contentsSize.wi
dth() <= visibleContentSize.width())) |
| 2378 return NotScrollableNoOverflow; | 2378 return NotScrollableNoOverflow; |
| 2379 | 2379 |
| 2380 // Covers #2. | 2380 // Covers #2. |
| 2381 // FIXME: Do we need to fix this for OOPI? | 2381 // FIXME: Do we need to fix this for OOPI? |
| 2382 HTMLFrameOwnerElement* owner = m_frame->deprecatedLocalOwner(); | 2382 HTMLFrameOwnerElement* owner = m_frame->deprecatedLocalOwner(); |
| 2383 if (owner && (!owner->renderer() || !owner->renderer()->visibleToHitTesting(
))) | 2383 if (owner && (!owner->layoutObject() || !owner->layoutObject()->visibleToHit
Testing())) |
| 2384 return NotScrollableNotVisible; | 2384 return NotScrollableNotVisible; |
| 2385 | 2385 |
| 2386 // Cover #3 and #4. | 2386 // Cover #3 and #4. |
| 2387 ScrollbarMode horizontalMode; | 2387 ScrollbarMode horizontalMode; |
| 2388 ScrollbarMode verticalMode; | 2388 ScrollbarMode verticalMode; |
| 2389 calculateScrollbarModesForLayoutAndSetViewportRenderer(horizontalMode, verti
calMode, RulesFromWebContentOnly); | 2389 calculateScrollbarModesForLayoutAndSetViewportRenderer(horizontalMode, verti
calMode, RulesFromWebContentOnly); |
| 2390 if (horizontalMode == ScrollbarAlwaysOff && verticalMode == ScrollbarAlwaysO
ff) | 2390 if (horizontalMode == ScrollbarAlwaysOff && verticalMode == ScrollbarAlwaysO
ff) |
| 2391 return NotScrollableExplicitlyDisabled; | 2391 return NotScrollableExplicitlyDisabled; |
| 2392 | 2392 |
| 2393 return Scrollable; | 2393 return Scrollable; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2464 | 2464 |
| 2465 void FrameView::updateScrollCorner() | 2465 void FrameView::updateScrollCorner() |
| 2466 { | 2466 { |
| 2467 RefPtr<LayoutStyle> cornerStyle; | 2467 RefPtr<LayoutStyle> cornerStyle; |
| 2468 IntRect cornerRect = scrollCornerRect(); | 2468 IntRect cornerRect = scrollCornerRect(); |
| 2469 Document* doc = m_frame->document(); | 2469 Document* doc = m_frame->document(); |
| 2470 | 2470 |
| 2471 if (doc && !cornerRect.isEmpty()) { | 2471 if (doc && !cornerRect.isEmpty()) { |
| 2472 // Try the <body> element first as a scroll corner source. | 2472 // Try the <body> element first as a scroll corner source. |
| 2473 if (Element* body = doc->body()) { | 2473 if (Element* body = doc->body()) { |
| 2474 if (LayoutObject* renderer = body->renderer()) | 2474 if (LayoutObject* renderer = body->layoutObject()) |
| 2475 cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleReques
t(SCROLLBAR_CORNER), renderer->style()); | 2475 cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleReques
t(SCROLLBAR_CORNER), renderer->style()); |
| 2476 } | 2476 } |
| 2477 | 2477 |
| 2478 if (!cornerStyle) { | 2478 if (!cornerStyle) { |
| 2479 // If the <body> didn't have a custom style, then the root element m
ight. | 2479 // If the <body> didn't have a custom style, then the root element m
ight. |
| 2480 if (Element* docElement = doc->documentElement()) { | 2480 if (Element* docElement = doc->documentElement()) { |
| 2481 if (LayoutObject* renderer = docElement->renderer()) | 2481 if (LayoutObject* renderer = docElement->layoutObject()) |
| 2482 cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleRe
quest(SCROLLBAR_CORNER), renderer->style()); | 2482 cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleRe
quest(SCROLLBAR_CORNER), renderer->style()); |
| 2483 } | 2483 } |
| 2484 } | 2484 } |
| 2485 | 2485 |
| 2486 if (!cornerStyle) { | 2486 if (!cornerStyle) { |
| 2487 // If we have an owning ipage/LocalFrame element, then it can set th
e custom scrollbar also. | 2487 // If we have an owning ipage/LocalFrame element, then it can set th
e custom scrollbar also. |
| 2488 if (LayoutPart* layoutObject = m_frame->ownerLayoutObject()) | 2488 if (LayoutPart* layoutObject = m_frame->ownerLayoutObject()) |
| 2489 cornerStyle = layoutObject->getUncachedPseudoStyle(PseudoStyleRe
quest(SCROLLBAR_CORNER), layoutObject->style()); | 2489 cornerStyle = layoutObject->getUncachedPseudoStyle(PseudoStyleRe
quest(SCROLLBAR_CORNER), layoutObject->style()); |
| 2490 } | 2490 } |
| 2491 } | 2491 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2514 Element* htmlElement = frame().document()->documentElement(); | 2514 Element* htmlElement = frame().document()->documentElement(); |
| 2515 Element* bodyElement = frame().document()->body(); | 2515 Element* bodyElement = frame().document()->body(); |
| 2516 | 2516 |
| 2517 // We take the aggregate of the base background color | 2517 // We take the aggregate of the base background color |
| 2518 // the <html> background color, and the <body> | 2518 // the <html> background color, and the <body> |
| 2519 // background color to find the document color. The | 2519 // background color to find the document color. The |
| 2520 // addition of the base background color is not | 2520 // addition of the base background color is not |
| 2521 // technically part of the document background, but it | 2521 // technically part of the document background, but it |
| 2522 // otherwise poses problems when the aggregate is not | 2522 // otherwise poses problems when the aggregate is not |
| 2523 // fully opaque. | 2523 // fully opaque. |
| 2524 if (htmlElement && htmlElement->renderer()) | 2524 if (htmlElement && htmlElement->layoutObject()) |
| 2525 result = result.blend(htmlElement->renderer()->resolveColor(CSSPropertyB
ackgroundColor)); | 2525 result = result.blend(htmlElement->layoutObject()->resolveColor(CSSPrope
rtyBackgroundColor)); |
| 2526 if (bodyElement && bodyElement->renderer()) | 2526 if (bodyElement && bodyElement->layoutObject()) |
| 2527 result = result.blend(bodyElement->renderer()->resolveColor(CSSPropertyB
ackgroundColor)); | 2527 result = result.blend(bodyElement->layoutObject()->resolveColor(CSSPrope
rtyBackgroundColor)); |
| 2528 | 2528 |
| 2529 return result; | 2529 return result; |
| 2530 } | 2530 } |
| 2531 | 2531 |
| 2532 FrameView* FrameView::parentFrameView() const | 2532 FrameView* FrameView::parentFrameView() const |
| 2533 { | 2533 { |
| 2534 if (!parent()) | 2534 if (!parent()) |
| 2535 return nullptr; | 2535 return nullptr; |
| 2536 | 2536 |
| 2537 Frame* parentFrame = m_frame->tree().parent(); | 2537 Frame* parentFrame = m_frame->tree().parent(); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2701 | 2701 |
| 2702 // Since autosize mode forces the scrollbar mode, change them to being auto. | 2702 // Since autosize mode forces the scrollbar mode, change them to being auto. |
| 2703 setVerticalScrollbarLock(false); | 2703 setVerticalScrollbarLock(false); |
| 2704 setHorizontalScrollbarLock(false); | 2704 setHorizontalScrollbarLock(false); |
| 2705 setScrollbarModes(ScrollbarAuto, ScrollbarAuto); | 2705 setScrollbarModes(ScrollbarAuto, ScrollbarAuto); |
| 2706 m_autoSizeInfo.clear(); | 2706 m_autoSizeInfo.clear(); |
| 2707 } | 2707 } |
| 2708 | 2708 |
| 2709 void FrameView::forceLayoutForPagination(const FloatSize& pageSize, const FloatS
ize& originalPageSize, float maximumShrinkFactor) | 2709 void FrameView::forceLayoutForPagination(const FloatSize& pageSize, const FloatS
ize& originalPageSize, float maximumShrinkFactor) |
| 2710 { | 2710 { |
| 2711 // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good tri
ck to see | 2711 // Dumping externalRepresentation(m_frame->layoutObject()).ascii() is a good
trick to see |
| 2712 // the state of things before and after the layout | 2712 // the state of things before and after the layout |
| 2713 if (LayoutView* layoutView = this->layoutView()) { | 2713 if (LayoutView* layoutView = this->layoutView()) { |
| 2714 float pageLogicalWidth = layoutView->style()->isHorizontalWritingMode()
? pageSize.width() : pageSize.height(); | 2714 float pageLogicalWidth = layoutView->style()->isHorizontalWritingMode()
? pageSize.width() : pageSize.height(); |
| 2715 float pageLogicalHeight = layoutView->style()->isHorizontalWritingMode()
? pageSize.height() : pageSize.width(); | 2715 float pageLogicalHeight = layoutView->style()->isHorizontalWritingMode()
? pageSize.height() : pageSize.width(); |
| 2716 | 2716 |
| 2717 LayoutUnit flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogical
Width); | 2717 LayoutUnit flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogical
Width); |
| 2718 LayoutUnit flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogica
lHeight); | 2718 LayoutUnit flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogica
lHeight); |
| 2719 layoutView->setLogicalWidth(flooredPageLogicalWidth); | 2719 layoutView->setLogicalWidth(flooredPageLogicalWidth); |
| 2720 layoutView->setPageLogicalHeight(flooredPageLogicalHeight); | 2720 layoutView->setPageLogicalHeight(flooredPageLogicalHeight); |
| 2721 layoutView->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 2721 layoutView->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
| (...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4099 { | 4099 { |
| 4100 Settings* settings = frame().settings(); | 4100 Settings* settings = frame().settings(); |
| 4101 if (!settings || !settings->rootLayerScrolls()) | 4101 if (!settings || !settings->rootLayerScrolls()) |
| 4102 return this; | 4102 return this; |
| 4103 | 4103 |
| 4104 LayoutView* layoutView = this->layoutView(); | 4104 LayoutView* layoutView = this->layoutView(); |
| 4105 return layoutView ? layoutView->scrollableArea() : nullptr; | 4105 return layoutView ? layoutView->scrollableArea() : nullptr; |
| 4106 } | 4106 } |
| 4107 | 4107 |
| 4108 } // namespace blink | 4108 } // namespace blink |
| OLD | NEW |