Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(978)

Side by Side Diff: Source/core/page/FrameView.cpp

Issue 15820002: Page::chrome() should return a reference. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/page/Frame.cpp ('k') | Source/core/page/Page.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 533
534 ScrollView::setContentsSize(size); 534 ScrollView::setContentsSize(size);
535 ScrollView::contentsResized(); 535 ScrollView::contentsResized();
536 536
537 Page* page = frame() ? frame()->page() : 0; 537 Page* page = frame() ? frame()->page() : 0;
538 if (!page) 538 if (!page)
539 return; 539 return;
540 540
541 updateScrollableAreaSet(); 541 updateScrollableAreaSet();
542 542
543 page->chrome()->contentsSizeChanged(frame(), size); //notify only 543 page->chrome().contentsSizeChanged(frame(), size); // Notify only.
544 544
545 m_deferSetNeedsLayouts--; 545 m_deferSetNeedsLayouts--;
546 546
547 if (!m_deferSetNeedsLayouts) 547 if (!m_deferSetNeedsLayouts)
548 m_setNeedsLayoutWasDeferred = false; // FIXME: Find a way to make the de ferred layout actually happen. 548 m_setNeedsLayoutWasDeferred = false; // FIXME: Find a way to make the de ferred layout actually happen.
549 } 549 }
550 550
551 void FrameView::adjustViewSize() 551 void FrameView::adjustViewSize()
552 { 552 {
553 RenderView* renderView = this->renderView(); 553 RenderView* renderView = this->renderView();
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 InspectorInstrumentation::didLayout(cookie, root); 1116 InspectorInstrumentation::didLayout(cookie, root);
1117 1117
1118 m_nestedLayoutCount--; 1118 m_nestedLayoutCount--;
1119 if (m_nestedLayoutCount) 1119 if (m_nestedLayoutCount)
1120 return; 1120 return;
1121 1121
1122 Page* page = frame() ? frame()->page() : 0; 1122 Page* page = frame() ? frame()->page() : 0;
1123 if (!page) 1123 if (!page)
1124 return; 1124 return;
1125 1125
1126 page->chrome()->client()->layoutUpdated(frame()); 1126 page->chrome().client()->layoutUpdated(frame());
1127 } 1127 }
1128 1128
1129 void FrameView::layoutLazyBlocks() 1129 void FrameView::layoutLazyBlocks()
1130 { 1130 {
1131 // FIXME: This infinite recursion protection would seem to break plugins 1131 // FIXME: This infinite recursion protection would seem to break plugins
1132 // doing things that require lazy blocks to layout. 1132 // doing things that require lazy blocks to layout.
1133 if (m_nestedLayoutCount != 1) 1133 if (m_nestedLayoutCount != 1)
1134 return; 1134 return;
1135 1135
1136 if (!renderView()->firstLazyBlock()) 1136 if (!renderView()->firstLazyBlock())
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 { 1565 {
1566 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e); 1566 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e);
1567 m_maintainScrollPositionAnchor = 0; 1567 m_maintainScrollPositionAnchor = 0;
1568 1568
1569 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); 1569 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint);
1570 1570
1571 if (newScrollPosition == scrollPosition()) 1571 if (newScrollPosition == scrollPosition())
1572 return; 1572 return;
1573 1573
1574 if (Page* page = m_frame->page()) 1574 if (Page* page = m_frame->page())
1575 page->chrome()->client()->didProgrammaticallyScroll(m_frame.get(), newSc rollPosition); 1575 page->chrome().client()->didProgrammaticallyScroll(m_frame.get(), newScr ollPosition);
1576 1576
1577 if (requestScrollPositionUpdate(newScrollPosition)) 1577 if (requestScrollPositionUpdate(newScrollPosition))
1578 return; 1578 return;
1579 1579
1580 ScrollView::setScrollPosition(newScrollPosition); 1580 ScrollView::setScrollPosition(newScrollPosition);
1581 } 1581 }
1582 1582
1583 void FrameView::setViewportConstrainedObjectsNeedLayout() 1583 void FrameView::setViewportConstrainedObjectsNeedLayout()
1584 { 1584 {
1585 if (!hasViewportConstrainedObjects()) 1585 if (!hasViewportConstrainedObjects())
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 if (RenderView* renderView = this->renderView()) 1624 if (RenderView* renderView = this->renderView())
1625 renderView->compositor()->updateCompositingLayers(CompositingUpdateO nScroll); 1625 renderView->compositor()->updateCompositingLayers(CompositingUpdateO nScroll);
1626 } 1626 }
1627 } 1627 }
1628 1628
1629 bool FrameView::shouldRubberBandInDirection(ScrollDirection direction) const 1629 bool FrameView::shouldRubberBandInDirection(ScrollDirection direction) const
1630 { 1630 {
1631 Page* page = frame() ? frame()->page() : 0; 1631 Page* page = frame() ? frame()->page() : 0;
1632 if (!page) 1632 if (!page)
1633 return ScrollView::shouldRubberBandInDirection(direction); 1633 return ScrollView::shouldRubberBandInDirection(direction);
1634 return page->chrome()->client()->shouldRubberBandInDirection(direction); 1634 return page->chrome().client()->shouldRubberBandInDirection(direction);
1635 } 1635 }
1636 1636
1637 bool FrameView::isRubberBandInProgress() const 1637 bool FrameView::isRubberBandInProgress() const
1638 { 1638 {
1639 if (scrollbarsSuppressed()) 1639 if (scrollbarsSuppressed())
1640 return false; 1640 return false;
1641 1641
1642 // If the main thread updates the scroll position for this FrameView, we sho uld return 1642 // If the main thread updates the scroll position for this FrameView, we sho uld return
1643 // ScrollAnimator::isRubberBandInProgress(). 1643 // ScrollAnimator::isRubberBandInProgress().
1644 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) 1644 if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
1645 return scrollAnimator->isRubberBandInProgress(); 1645 return scrollAnimator->isRubberBandInProgress();
1646 1646
1647 return false; 1647 return false;
1648 } 1648 }
1649 1649
1650 bool FrameView::requestScrollPositionUpdate(const IntPoint& position) 1650 bool FrameView::requestScrollPositionUpdate(const IntPoint& position)
1651 { 1651 {
1652 return false; 1652 return false;
1653 } 1653 }
1654 1654
1655 HostWindow* FrameView::hostWindow() const 1655 HostWindow* FrameView::hostWindow() const
1656 { 1656 {
1657 Page* page = frame() ? frame()->page() : 0; 1657 Page* page = frame() ? frame()->page() : 0;
1658 if (!page) 1658 if (!page)
1659 return 0; 1659 return 0;
1660 return page->chrome(); 1660 return &page->chrome();
1661 } 1661 }
1662 1662
1663 const unsigned cRepaintRectUnionThreshold = 25; 1663 const unsigned cRepaintRectUnionThreshold = 25;
1664 1664
1665 void FrameView::repaintContentRectangle(const IntRect& r) 1665 void FrameView::repaintContentRectangle(const IntRect& r)
1666 { 1666 {
1667 ASSERT(!m_frame->ownerElement()); 1667 ASSERT(!m_frame->ownerElement());
1668 1668
1669 if (m_isTrackingRepaints) { 1669 if (m_isTrackingRepaints) {
1670 IntRect repaintRect = r; 1670 IntRect repaintRect = r;
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
2520 void FrameView::getTickmarks(Vector<IntRect>& tickmarks) const 2520 void FrameView::getTickmarks(Vector<IntRect>& tickmarks) const
2521 { 2521 {
2522 tickmarks = frame()->document()->markers()->renderedRectsForMarkers(Document Marker::TextMatch); 2522 tickmarks = frame()->document()->markers()->renderedRectsForMarkers(Document Marker::TextMatch);
2523 } 2523 }
2524 2524
2525 IntRect FrameView::windowResizerRect() const 2525 IntRect FrameView::windowResizerRect() const
2526 { 2526 {
2527 Page* page = frame() ? frame()->page() : 0; 2527 Page* page = frame() ? frame()->page() : 0;
2528 if (!page) 2528 if (!page)
2529 return IntRect(); 2529 return IntRect();
2530 return page->chrome()->windowResizerRect(); 2530 return page->chrome().windowResizerRect();
2531 } 2531 }
2532 2532
2533 void FrameView::setVisibleContentScaleFactor(float visibleContentScaleFactor) 2533 void FrameView::setVisibleContentScaleFactor(float visibleContentScaleFactor)
2534 { 2534 {
2535 if (m_visibleContentScaleFactor == visibleContentScaleFactor) 2535 if (m_visibleContentScaleFactor == visibleContentScaleFactor)
2536 return; 2536 return;
2537 2537
2538 m_visibleContentScaleFactor = visibleContentScaleFactor; 2538 m_visibleContentScaleFactor = visibleContentScaleFactor;
2539 updateScrollbars(scrollOffset()); 2539 updateScrollbars(scrollOffset());
2540 } 2540 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
2680 if (!document->hasAnnotatedRegions()) 2680 if (!document->hasAnnotatedRegions())
2681 return; 2681 return;
2682 Vector<AnnotatedRegionValue> newRegions; 2682 Vector<AnnotatedRegionValue> newRegions;
2683 document->renderBox()->collectAnnotatedRegions(newRegions); 2683 document->renderBox()->collectAnnotatedRegions(newRegions);
2684 if (newRegions == document->annotatedRegions()) 2684 if (newRegions == document->annotatedRegions())
2685 return; 2685 return;
2686 document->setAnnotatedRegions(newRegions); 2686 document->setAnnotatedRegions(newRegions);
2687 Page* page = m_frame->page(); 2687 Page* page = m_frame->page();
2688 if (!page) 2688 if (!page)
2689 return; 2689 return;
2690 page->chrome()->client()->annotatedRegionsChanged(); 2690 page->chrome().client()->annotatedRegionsChanged();
2691 } 2691 }
2692 2692
2693 void FrameView::updateScrollCorner() 2693 void FrameView::updateScrollCorner()
2694 { 2694 {
2695 RenderObject* renderer = 0; 2695 RenderObject* renderer = 0;
2696 RefPtr<RenderStyle> cornerStyle; 2696 RefPtr<RenderStyle> cornerStyle;
2697 IntRect cornerRect = scrollCornerRect(); 2697 IntRect cornerRect = scrollCornerRect();
2698 2698
2699 if (!cornerRect.isEmpty()) { 2699 if (!cornerRect.isEmpty()) {
2700 // Try the <body> element first as a scroll corner source. 2700 // Try the <body> element first as a scroll corner source.
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
2984 void FrameView::paintOverhangAreas(GraphicsContext* context, const IntRect& hori zontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRec t) 2984 void FrameView::paintOverhangAreas(GraphicsContext* context, const IntRect& hori zontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRec t)
2985 { 2985 {
2986 if (context->paintingDisabled()) 2986 if (context->paintingDisabled())
2987 return; 2987 return;
2988 2988
2989 if (m_frame->document()->printing()) 2989 if (m_frame->document()->printing())
2990 return; 2990 return;
2991 2991
2992 Page* page = m_frame->page(); 2992 Page* page = m_frame->page();
2993 if (page->mainFrame() == m_frame) { 2993 if (page->mainFrame() == m_frame) {
2994 if (page->chrome()->client()->paintCustomOverhangArea(context, horizonta lOverhangArea, verticalOverhangArea, dirtyRect)) 2994 if (page->chrome().client()->paintCustomOverhangArea(context, horizontal OverhangArea, verticalOverhangArea, dirtyRect))
2995 return; 2995 return;
2996 } 2996 }
2997 2997
2998 ScrollView::paintOverhangAreas(context, horizontalOverhangArea, verticalOver hangArea, dirtyRect); 2998 ScrollView::paintOverhangAreas(context, horizontalOverhangArea, verticalOver hangArea, dirtyRect);
2999 } 2999 }
3000 3000
3001 void FrameView::updateLayoutAndStyleIfNeededRecursive() 3001 void FrameView::updateLayoutAndStyleIfNeededRecursive()
3002 { 3002 {
3003 // We have to crawl our entire tree looking for any FrameViews that need 3003 // We have to crawl our entire tree looking for any FrameViews that need
3004 // layout and make sure they are up to date. 3004 // layout and make sure they are up to date.
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
3403 } 3403 }
3404 3404
3405 AXObjectCache* FrameView::axObjectCache() const 3405 AXObjectCache* FrameView::axObjectCache() const
3406 { 3406 {
3407 if (frame() && frame()->document()) 3407 if (frame() && frame()->document())
3408 return frame()->document()->existingAXObjectCache(); 3408 return frame()->document()->existingAXObjectCache();
3409 return 0; 3409 return 0;
3410 } 3410 }
3411 3411
3412 } // namespace WebCore 3412 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/Frame.cpp ('k') | Source/core/page/Page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698