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

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

Issue 13544008: Remove PlatformWidget references (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 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
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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 966
967 bool FrameView::hasCompositedContent() const 967 bool FrameView::hasCompositedContent() const
968 { 968 {
969 #if USE(ACCELERATED_COMPOSITING) 969 #if USE(ACCELERATED_COMPOSITING)
970 if (RenderView* renderView = this->renderView()) 970 if (RenderView* renderView = this->renderView())
971 return renderView->compositor()->inCompositingMode(); 971 return renderView->compositor()->inCompositingMode();
972 #endif 972 #endif
973 return false; 973 return false;
974 } 974 }
975 975
976 bool FrameView::hasCompositedContentIncludingDescendants() const
977 {
978 #if USE(ACCELERATED_COMPOSITING)
979 for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNex t(m_frame.get())) {
980 RenderView* renderView = frame->contentRenderer();
981 RenderLayerCompositor* compositor = renderView ? renderView->compositor( ) : 0;
982 if (compositor) {
983 if (compositor->inCompositingMode())
984 return true;
985
986 if (!RenderLayerCompositor::allowsIndependentlyCompositedFrames(this ))
987 break;
988 }
989 }
990 #endif
991 return false;
992 }
993
994 bool FrameView::hasCompositingAncestor() const 976 bool FrameView::hasCompositingAncestor() const
995 { 977 {
996 #if USE(ACCELERATED_COMPOSITING) 978 #if USE(ACCELERATED_COMPOSITING)
997 for (Frame* frame = m_frame->tree()->parent(); frame; frame = frame->tree()- >parent()) { 979 for (Frame* frame = m_frame->tree()->parent(); frame; frame = frame->tree()- >parent()) {
998 if (FrameView* view = frame->view()) { 980 if (FrameView* view = frame->view()) {
999 if (view->hasCompositedContent()) 981 if (view->hasCompositedContent())
1000 return true; 982 return true;
1001 } 983 }
1002 } 984 }
1003 #endif 985 #endif
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 setMediaType("print"); 1455 setMediaType("print");
1474 } else { 1456 } else {
1475 if (!m_mediaTypeWhenNotPrinting.isNull()) 1457 if (!m_mediaTypeWhenNotPrinting.isNull())
1476 setMediaType(m_mediaTypeWhenNotPrinting); 1458 setMediaType(m_mediaTypeWhenNotPrinting);
1477 m_mediaTypeWhenNotPrinting = String(); 1459 m_mediaTypeWhenNotPrinting = String();
1478 } 1460 }
1479 } 1461 }
1480 1462
1481 bool FrameView::useSlowRepaints(bool considerOverlap) const 1463 bool FrameView::useSlowRepaints(bool considerOverlap) const
1482 { 1464 {
1483 bool mustBeSlow = m_slowRepaintObjectCount > 0 || (platformWidget() && hasVi ewportConstrainedObjects()); 1465 bool mustBeSlow = m_slowRepaintObjectCount > 0;
1484 1466
1485 // FIXME: WidgetMac.mm makes the assumption that useSlowRepaints == 1467 if (contentsInCompositedLayer())
1486 // m_contentIsOpaque, so don't take the fast path for composited layers
1487 // if they are a platform widget in order to get painting correctness
1488 // for transparent layers. See the comment in WidgetMac::paint.
1489 if (contentsInCompositedLayer() && !platformWidget())
1490 return mustBeSlow; 1468 return mustBeSlow;
1491 1469
1492 #if PLATFORM(CHROMIUM) 1470 #if PLATFORM(CHROMIUM)
1493 // The chromium compositor does not support scrolling a non-composited frame within a composited page through 1471 // The chromium compositor does not support scrolling a non-composited frame within a composited page through
1494 // the fast scrolling path, so force slow scrolling in that case. 1472 // the fast scrolling path, so force slow scrolling in that case.
1495 if (m_frame->ownerElement() && !hasCompositedContent() && m_frame->page() && m_frame->page()->mainFrame()->view()->hasCompositedContent()) 1473 if (m_frame->ownerElement() && !hasCompositedContent() && m_frame->page() && m_frame->page()->mainFrame()->view()->hasCompositedContent())
1496 return true; 1474 return true;
1497 #endif 1475 #endif
1498 1476
1499 bool isOverlapped = m_isOverlapped && considerOverlap; 1477 bool isOverlapped = m_isOverlapped && considerOverlap;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 } 1543 }
1566 } 1544 }
1567 1545
1568 void FrameView::addViewportConstrainedObject(RenderObject* object) 1546 void FrameView::addViewportConstrainedObject(RenderObject* object)
1569 { 1547 {
1570 if (!m_viewportConstrainedObjects) 1548 if (!m_viewportConstrainedObjects)
1571 m_viewportConstrainedObjects = adoptPtr(new ViewportConstrainedObjectSet ); 1549 m_viewportConstrainedObjects = adoptPtr(new ViewportConstrainedObjectSet );
1572 1550
1573 if (!m_viewportConstrainedObjects->contains(object)) { 1551 if (!m_viewportConstrainedObjects->contains(object)) {
1574 m_viewportConstrainedObjects->add(object); 1552 m_viewportConstrainedObjects->add(object);
1575 if (platformWidget())
1576 updateCanBlitOnScrollRecursively();
1577 1553
1578 if (Page* page = m_frame->page()) { 1554 if (Page* page = m_frame->page()) {
1579 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoor dinator()) 1555 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoor dinator())
1580 scrollingCoordinator->frameViewFixedObjectsDidChange(this); 1556 scrollingCoordinator->frameViewFixedObjectsDidChange(this);
1581 } 1557 }
1582 } 1558 }
1583 } 1559 }
1584 1560
1585 void FrameView::removeViewportConstrainedObject(RenderObject* object) 1561 void FrameView::removeViewportConstrainedObject(RenderObject* object)
1586 { 1562 {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 } 1719 }
1744 1720
1745 // Note that this gets called at painting time. 1721 // Note that this gets called at painting time.
1746 void FrameView::setIsOverlapped(bool isOverlapped) 1722 void FrameView::setIsOverlapped(bool isOverlapped)
1747 { 1723 {
1748 if (isOverlapped == m_isOverlapped) 1724 if (isOverlapped == m_isOverlapped)
1749 return; 1725 return;
1750 1726
1751 m_isOverlapped = isOverlapped; 1727 m_isOverlapped = isOverlapped;
1752 updateCanBlitOnScrollRecursively(); 1728 updateCanBlitOnScrollRecursively();
1753
1754 #if USE(ACCELERATED_COMPOSITING)
1755 if (hasCompositedContentIncludingDescendants()) {
1756 // Overlap can affect compositing tests, so if it changes, we need to tr igger
1757 // a layer update in the parent document.
1758 if (Frame* parentFrame = m_frame->tree()->parent()) {
1759 if (RenderView* parentView = parentFrame->contentRenderer()) {
1760 RenderLayerCompositor* compositor = parentView->compositor();
1761 compositor->setCompositingLayersNeedRebuild();
1762 compositor->scheduleCompositingLayerUpdate();
1763 }
1764 }
1765
1766 if (RenderLayerCompositor::allowsIndependentlyCompositedFrames(this)) {
1767 // We also need to trigger reevaluation for this and all descendant frames,
1768 // since a frame uses compositing if any ancestor is compositing.
1769 for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->tra verseNext(m_frame.get())) {
1770 if (RenderView* view = frame->contentRenderer()) {
1771 RenderLayerCompositor* compositor = view->compositor();
1772 compositor->setCompositingLayersNeedRebuild();
1773 compositor->scheduleCompositingLayerUpdate();
1774 }
1775 }
1776 }
1777 }
1778 #endif
1779 } 1729 }
1780 1730
1781 bool FrameView::isOverlappedIncludingAncestors() const 1731 bool FrameView::isOverlappedIncludingAncestors() const
1782 { 1732 {
1783 if (isOverlapped()) 1733 if (isOverlapped())
1784 return true; 1734 return true;
1785 1735
1786 if (FrameView* parentView = parentFrameView()) { 1736 if (FrameView* parentView = parentFrameView()) {
1787 if (parentView->isOverlapped()) 1737 if (parentView->isOverlapped())
1788 return true; 1738 return true;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1943 return; 1893 return;
1944 1894
1945 ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObje cts->end(); 1895 ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObje cts->end();
1946 for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrained Objects->begin(); it != end; ++it) { 1896 for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrained Objects->begin(); it != end; ++it) {
1947 RenderObject* renderer = *it; 1897 RenderObject* renderer = *it;
1948 renderer->setNeedsLayout(true); 1898 renderer->setNeedsLayout(true);
1949 } 1899 }
1950 } 1900 }
1951 1901
1952 1902
1953 void FrameView::scrollPositionChangedViaPlatformWidget()
1954 {
1955 repaintFixedElementsAfterScrolling();
1956 updateFixedElementsAfterScrolling();
1957 scrollPositionChanged();
1958 }
1959
1960 void FrameView::scrollPositionChanged() 1903 void FrameView::scrollPositionChanged()
1961 { 1904 {
1962 frame()->eventHandler()->sendScrollEvent(); 1905 frame()->eventHandler()->sendScrollEvent();
1963 frame()->eventHandler()->dispatchFakeMouseMoveEventSoon(); 1906 frame()->eventHandler()->dispatchFakeMouseMoveEventSoon();
1964 1907
1965 #if USE(ACCELERATED_COMPOSITING) 1908 #if USE(ACCELERATED_COMPOSITING)
1966 if (RenderView* renderView = this->renderView()) { 1909 if (RenderView* renderView = this->renderView()) {
1967 if (renderView->usesCompositing()) 1910 if (renderView->usesCompositing())
1968 renderView->compositor()->frameViewDidScroll(); 1911 renderView->compositor()->frameViewDidScroll();
1969 } 1912 }
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
3373 paintControlTints(); 3316 paintControlTints();
3374 } 3317 }
3375 3318
3376 void FrameView::paintControlTints() 3319 void FrameView::paintControlTints()
3377 { 3320 {
3378 if (needsLayout()) 3321 if (needsLayout())
3379 layout(); 3322 layout();
3380 PlatformGraphicsContext* const noContext = 0; 3323 PlatformGraphicsContext* const noContext = 0;
3381 GraphicsContext context(noContext); 3324 GraphicsContext context(noContext);
3382 context.setUpdatingControlTints(true); 3325 context.setUpdatingControlTints(true);
3383 if (platformWidget()) 3326 paint(&context, frameRect());
3384 paintContents(&context, visibleContentRect());
3385 else
3386 paint(&context, frameRect());
3387 } 3327 }
3388 3328
3389 bool FrameView::wasScrolledByUser() const 3329 bool FrameView::wasScrolledByUser() const
3390 { 3330 {
3391 return m_wasScrolledByUser; 3331 return m_wasScrolledByUser;
3392 } 3332 }
3393 3333
3394 void FrameView::setWasScrolledByUser(bool wasScrolledByUser) 3334 void FrameView::setWasScrolledByUser(bool wasScrolledByUser)
3395 { 3335 {
3396 if (m_inProgrammaticScroll) 3336 if (m_inProgrammaticScroll)
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
3972 scrollPositionChanged(); 3912 scrollPositionChanged();
3973 frame()->loader()->client()->didChangeScrollOffset(); 3913 frame()->loader()->client()->didChangeScrollOffset();
3974 } 3914 }
3975 return true; 3915 return true;
3976 } 3916 }
3977 3917
3978 // We don't allow mouse wheeling to happen in a ScrollView that has had its scrollbars explicitly disabled. 3918 // We don't allow mouse wheeling to happen in a ScrollView that has had its scrollbars explicitly disabled.
3979 if (!canHaveScrollbars()) 3919 if (!canHaveScrollbars())
3980 return false; 3920 return false;
3981 3921
3982 #if !PLATFORM(WX)
3983 if (platformWidget())
3984 return false;
3985 #endif
3986
3987 #if ENABLE(THREADED_SCROLLING) 3922 #if ENABLE(THREADED_SCROLLING)
3988 if (Page* page = m_frame->page()) { 3923 if (Page* page = m_frame->page()) {
3989 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) { 3924 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) {
3990 if (scrollingCoordinator->coordinatesScrollingForFrameView(this)) 3925 if (scrollingCoordinator->coordinatesScrollingForFrameView(this))
3991 return scrollingCoordinator->handleWheelEvent(this, wheelEvent); 3926 return scrollingCoordinator->handleWheelEvent(this, wheelEvent);
3992 } 3927 }
3993 } 3928 }
3994 #endif 3929 #endif
3995 3930
3996 return ScrollableArea::handleWheelEvent(wheelEvent); 3931 return ScrollableArea::handleWheelEvent(wheelEvent);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
4034 { 3969 {
4035 #if USE(ACCELERATED_COMPOSITING) 3970 #if USE(ACCELERATED_COMPOSITING)
4036 if (TiledBacking* tiledBacking = this->tiledBacking()) 3971 if (TiledBacking* tiledBacking = this->tiledBacking())
4037 tiledBacking->setScrollingPerformanceLoggingEnabled(flag); 3972 tiledBacking->setScrollingPerformanceLoggingEnabled(flag);
4038 #else 3973 #else
4039 UNUSED_PARAM(flag); 3974 UNUSED_PARAM(flag);
4040 #endif 3975 #endif
4041 } 3976 }
4042 3977
4043 } // namespace WebCore 3978 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698