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

Side by Side Diff: sky/engine/core/frame/FrameView.cpp

Issue 678193005: Remove more frame-level scrolling machinery. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « sky/engine/core/frame/FrameView.h ('k') | sky/engine/core/rendering/RenderBlockFlow.cpp » ('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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 #include "platform/scroll/Scrollbar.h" 61 #include "platform/scroll/Scrollbar.h"
62 #include "platform/text/TextStream.h" 62 #include "platform/text/TextStream.h"
63 #include "wtf/CurrentTime.h" 63 #include "wtf/CurrentTime.h"
64 #include "wtf/TemporaryChange.h" 64 #include "wtf/TemporaryChange.h"
65 65
66 namespace blink { 66 namespace blink {
67 67
68 double FrameView::s_currentFrameTimeStamp = 0.0; 68 double FrameView::s_currentFrameTimeStamp = 0.0;
69 bool FrameView::s_inPaintContents = false; 69 bool FrameView::s_inPaintContents = false;
70 70
71 static const double resourcePriorityUpdateDelayAfterScroll = 0.250;
72
73 FrameView::FrameView(LocalFrame* frame) 71 FrameView::FrameView(LocalFrame* frame)
74 : m_frame(frame) 72 : m_frame(frame)
75 , m_hasPendingLayout(false) 73 , m_hasPendingLayout(false)
76 , m_layoutSubtreeRoot(0) 74 , m_layoutSubtreeRoot(0)
77 , m_inSynchronousPostLayout(false) 75 , m_inSynchronousPostLayout(false)
78 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) 76 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired)
79 , m_isTransparent(false) 77 , m_isTransparent(false)
80 , m_baseBackgroundColor(Color::white) 78 , m_baseBackgroundColor(Color::white)
81 , m_mediaType("screen") 79 , m_mediaType("screen")
82 , m_overflowStatusDirty(true) 80 , m_overflowStatusDirty(true)
83 , m_viewportRenderer(0) 81 , m_viewportRenderer(0)
84 , m_wasScrolledByUser(false) 82 , m_wasScrolledByUser(false)
85 , m_inProgrammaticScroll(false) 83 , m_inProgrammaticScroll(false)
86 , m_isTrackingPaintInvalidations(false) 84 , m_isTrackingPaintInvalidations(false)
87 , m_hasSoftwareFilters(false) 85 , m_hasSoftwareFilters(false)
88 , m_visibleContentScaleFactor(1) 86 , m_visibleContentScaleFactor(1)
89 , m_inputEventsScaleFactorForEmulation(1) 87 , m_inputEventsScaleFactorForEmulation(1)
90 , m_layoutSizeFixedToFrameSize(true) 88 , m_layoutSizeFixedToFrameSize(true)
91 , m_didScrollTimer(this, &FrameView::didScrollTimerFired)
92 { 89 {
93 ASSERT(m_frame); 90 ASSERT(m_frame);
94 init(); 91 init();
95 } 92 }
96 93
97 PassRefPtr<FrameView> FrameView::create(LocalFrame* frame) 94 PassRefPtr<FrameView> FrameView::create(LocalFrame* frame)
98 { 95 {
99 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); 96 RefPtr<FrameView> view = adoptRef(new FrameView(frame));
100 return view.release(); 97 return view.release();
101 } 98 }
102 99
103 PassRefPtr<FrameView> FrameView::create(LocalFrame* frame, const IntSize& initia lSize) 100 PassRefPtr<FrameView> FrameView::create(LocalFrame* frame, const IntSize& initia lSize)
104 { 101 {
105 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); 102 RefPtr<FrameView> view = adoptRef(new FrameView(frame));
106 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); 103 view->Widget::setFrameRect(IntRect(view->location(), initialSize));
107 view->setLayoutSizeInternal(initialSize); 104 view->setLayoutSizeInternal(initialSize);
108 return view.release(); 105 return view.release();
109 } 106 }
110 107
111 FrameView::~FrameView() 108 FrameView::~FrameView()
112 { 109 {
113 if (m_postLayoutTasksTimer.isActive()) 110 if (m_postLayoutTasksTimer.isActive())
114 m_postLayoutTasksTimer.stop(); 111 m_postLayoutTasksTimer.stop();
115 112
116 if (m_didScrollTimer.isActive())
117 m_didScrollTimer.stop();
118
119 ASSERT(m_frame); 113 ASSERT(m_frame);
120 ASSERT(m_frame->view() != this || !m_frame->contentRenderer()); 114 ASSERT(m_frame->view() != this || !m_frame->contentRenderer());
121 // FIXME: Do we need to do something here for OOPI?
122 } 115 }
123 116
124 void FrameView::reset() 117 void FrameView::reset()
125 { 118 {
126 m_hasPendingLayout = false; 119 m_hasPendingLayout = false;
127 m_layoutSubtreeRoot = 0; 120 m_layoutSubtreeRoot = 0;
128 m_doFullPaintInvalidation = false; 121 m_doFullPaintInvalidation = false;
129 m_layoutSchedulingEnabled = true; 122 m_layoutSchedulingEnabled = true;
130 m_inPerformLayout = false; 123 m_inPerformLayout = false;
131 m_canInvalidatePaintDuringPerformLayout = false; 124 m_canInvalidatePaintDuringPerformLayout = false;
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 return m_layoutSize; 546 return m_layoutSize;
554 } 547 }
555 548
556 void FrameView::setLayoutSize(const IntSize& size) 549 void FrameView::setLayoutSize(const IntSize& size)
557 { 550 {
558 ASSERT(!layoutSizeFixedToFrameSize()); 551 ASSERT(!layoutSizeFixedToFrameSize());
559 552
560 setLayoutSizeInternal(size); 553 setLayoutSizeInternal(size);
561 } 554 }
562 555
563 void FrameView::scrollPositionChanged()
564 {
565 setWasScrolledByUser(true);
566
567 Document* document = m_frame->document();
568 document->enqueueScrollEventForNode(document);
569
570 m_frame->eventHandler().dispatchFakeMouseMoveEventSoon();
571
572 if (RenderView* renderView = document->renderView()) {
573 if (renderView->usesCompositing())
574 renderView->compositor()->frameViewDidScroll();
575 }
576
577 if (m_didScrollTimer.isActive())
578 m_didScrollTimer.stop();
579 m_didScrollTimer.startOneShot(resourcePriorityUpdateDelayAfterScroll, FROM_H ERE);
580 }
581
582 void FrameView::didScrollTimerFired(Timer<FrameView>*)
583 {
584 if (m_frame->document() && m_frame->document()->renderView()) {
585 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAl lImageResourcePriorities();
586 }
587 }
588
589 void FrameView::updateCompositedSelectionBoundsIfNeeded() 556 void FrameView::updateCompositedSelectionBoundsIfNeeded()
590 { 557 {
591 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled()) 558 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled())
592 return; 559 return;
593 560
594 Page* page = frame().page(); 561 Page* page = frame().page();
595 ASSERT(page); 562 ASSERT(page);
596 563
597 LocalFrame* frame = page->focusController().focusedOrMainFrame(); 564 LocalFrame* frame = page->focusController().focusedOrMainFrame();
598 if (!frame || !frame->selection().isCaretOrRange()) { 565 if (!frame || !frame->selection().isCaretOrRange()) {
(...skipping 10 matching lines...) Expand all
609 if (!page) 576 if (!page)
610 return 0; 577 return 0;
611 return &page->chrome(); 578 return &page->chrome();
612 } 579 }
613 580
614 void FrameView::contentRectangleForPaintInvalidation(const IntRect& r) 581 void FrameView::contentRectangleForPaintInvalidation(const IntRect& r)
615 { 582 {
616 ASSERT(paintInvalidationIsAllowed()); 583 ASSERT(paintInvalidationIsAllowed());
617 584
618 if (m_isTrackingPaintInvalidations) { 585 if (m_isTrackingPaintInvalidations) {
619 IntRect paintInvalidationRect = r; 586 m_trackedPaintInvalidationRects.append(r);
620 paintInvalidationRect.move(-scrollOffset());
621 m_trackedPaintInvalidationRects.append(paintInvalidationRect);
622 // FIXME: http://crbug.com/368518. Eventually, invalidateContentRectangl eForPaint 587 // FIXME: http://crbug.com/368518. Eventually, invalidateContentRectangl eForPaint
623 // is going away entirely once all layout tests are FCM. In the short 588 // is going away entirely once all layout tests are FCM. In the short
624 // term, no code should be tracking non-composited FrameView paint inval idations. 589 // term, no code should be tracking non-composited FrameView paint inval idations.
625 RELEASE_ASSERT_NOT_REACHED(); 590 RELEASE_ASSERT_NOT_REACHED();
626 } 591 }
627 592
628 IntRect paintRect = r; 593 IntRect paintRect = r;
629 if (clipsPaintInvalidations() && !paintsEntireContents()) 594 if (clipsPaintInvalidations() && !paintsEntireContents())
630 paintRect.intersect(visibleContentRect()); 595 paintRect.intersect(visibleContentRect());
631 if (paintRect.isEmpty()) 596 if (paintRect.isEmpty())
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean); 1056 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean);
1092 } 1057 }
1093 1058
1094 void FrameView::forceLayout(bool allowSubtree) 1059 void FrameView::forceLayout(bool allowSubtree)
1095 { 1060 {
1096 layout(allowSubtree); 1061 layout(allowSubtree);
1097 } 1062 }
1098 1063
1099 IntRect FrameView::convertFromRenderer(const RenderObject& renderer, const IntRe ct& rendererRect) const 1064 IntRect FrameView::convertFromRenderer(const RenderObject& renderer, const IntRe ct& rendererRect) const
1100 { 1065 {
1101 IntRect rect = pixelSnappedIntRect(enclosingLayoutRect(renderer.localToAbsol uteQuad(FloatRect(rendererRect)).boundingBox())); 1066 return pixelSnappedIntRect(enclosingLayoutRect(renderer.localToAbsoluteQuad( FloatRect(rendererRect)).boundingBox()));
1102
1103 // Convert from page ("absolute") to FrameView coordinates.
1104 rect.moveBy(-scrollPosition());
1105
1106 return rect;
1107 } 1067 }
1108 1068
1109 IntRect FrameView::convertToRenderer(const RenderObject& renderer, const IntRect & viewRect) const 1069 IntRect FrameView::convertToRenderer(const RenderObject& renderer, const IntRect & viewRect) const
1110 { 1070 {
1111 IntRect rect = viewRect; 1071 IntRect rect = viewRect;
1112
1113 // Convert from FrameView coords into page ("absolute") coordinates.
1114 rect.moveBy(scrollPosition());
1115
1116 // FIXME: we don't have a way to map an absolute rect down to a local quad, so just 1072 // FIXME: we don't have a way to map an absolute rect down to a local quad, so just
1117 // move the rect for now. 1073 // move the rect for now.
1118 rect.setLocation(roundedIntPoint(renderer.absoluteToLocal(rect.location(), U seTransforms))); 1074 rect.setLocation(roundedIntPoint(renderer.absoluteToLocal(rect.location(), U seTransforms)));
1119 return rect; 1075 return rect;
1120 } 1076 }
1121 1077
1122 IntPoint FrameView::convertFromRenderer(const RenderObject& renderer, const IntP oint& rendererPoint) const 1078 IntPoint FrameView::convertFromRenderer(const RenderObject& renderer, const IntP oint& rendererPoint) const
1123 { 1079 {
1124 IntPoint point = roundedIntPoint(renderer.localToAbsolute(rendererPoint, Use Transforms)); 1080 return roundedIntPoint(renderer.localToAbsolute(rendererPoint, UseTransforms ));
1125
1126 // Convert from page ("absolute") to FrameView coordinates.
1127 point.moveBy(-scrollPosition());
1128 return point;
1129 } 1081 }
1130 1082
1131 IntPoint FrameView::convertToRenderer(const RenderObject& renderer, const IntPoi nt& viewPoint) const 1083 IntPoint FrameView::convertToRenderer(const RenderObject& renderer, const IntPoi nt& viewPoint) const
1132 { 1084 {
1133 return roundedIntPoint(renderer.absoluteToLocal(viewPoint, UseTransforms)); 1085 return roundedIntPoint(renderer.absoluteToLocal(viewPoint, UseTransforms));
1134 } 1086 }
1135 1087
1136 IntRect FrameView::convertToContainingView(const IntRect& localRect) const 1088 IntRect FrameView::convertToContainingView(const IntRect& localRect) const
1137 { 1089 {
1138 return localRect; 1090 return localRect;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 void FrameView::setLayoutSizeInternal(const IntSize& size) 1207 void FrameView::setLayoutSizeInternal(const IntSize& size)
1256 { 1208 {
1257 if (m_layoutSize == size) 1209 if (m_layoutSize == size)
1258 return; 1210 return;
1259 1211
1260 m_layoutSize = size; 1212 m_layoutSize = size;
1261 contentsResized(); 1213 contentsResized();
1262 } 1214 }
1263 1215
1264 } // namespace blink 1216 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/frame/FrameView.h ('k') | sky/engine/core/rendering/RenderBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698