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

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

Issue 758843004: Delete most of rendering/compositing. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
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 28 matching lines...) Expand all
39 #include "sky/engine/core/html/parser/TextResourceDecoder.h" 39 #include "sky/engine/core/html/parser/TextResourceDecoder.h"
40 #include "sky/engine/core/inspector/InspectorTraceEvents.h" 40 #include "sky/engine/core/inspector/InspectorTraceEvents.h"
41 #include "sky/engine/core/loader/FrameLoaderClient.h" 41 #include "sky/engine/core/loader/FrameLoaderClient.h"
42 #include "sky/engine/core/page/Chrome.h" 42 #include "sky/engine/core/page/Chrome.h"
43 #include "sky/engine/core/page/ChromeClient.h" 43 #include "sky/engine/core/page/ChromeClient.h"
44 #include "sky/engine/core/page/EventHandler.h" 44 #include "sky/engine/core/page/EventHandler.h"
45 #include "sky/engine/core/page/FocusController.h" 45 #include "sky/engine/core/page/FocusController.h"
46 #include "sky/engine/core/page/Page.h" 46 #include "sky/engine/core/page/Page.h"
47 #include "sky/engine/core/rendering/RenderLayer.h" 47 #include "sky/engine/core/rendering/RenderLayer.h"
48 #include "sky/engine/core/rendering/RenderView.h" 48 #include "sky/engine/core/rendering/RenderView.h"
49 #include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h"
50 #include "sky/engine/core/rendering/style/RenderStyle.h" 49 #include "sky/engine/core/rendering/style/RenderStyle.h"
51 #include "sky/engine/platform/ScriptForbiddenScope.h" 50 #include "sky/engine/platform/ScriptForbiddenScope.h"
52 #include "sky/engine/platform/TraceEvent.h" 51 #include "sky/engine/platform/TraceEvent.h"
53 #include "sky/engine/platform/fonts/FontCache.h" 52 #include "sky/engine/platform/fonts/FontCache.h"
54 #include "sky/engine/platform/geometry/FloatRect.h" 53 #include "sky/engine/platform/geometry/FloatRect.h"
55 #include "sky/engine/platform/graphics/GraphicsContext.h" 54 #include "sky/engine/platform/graphics/GraphicsContext.h"
56 #include "sky/engine/platform/graphics/GraphicsLayerDebugInfo.h" 55 #include "sky/engine/platform/graphics/GraphicsLayerDebugInfo.h"
57 #include "sky/engine/platform/scroll/ScrollAnimator.h" 56 #include "sky/engine/platform/scroll/ScrollAnimator.h"
58 #include "sky/engine/platform/scroll/Scrollbar.h" 57 #include "sky/engine/platform/scroll/Scrollbar.h"
59 #include "sky/engine/platform/text/TextStream.h" 58 #include "sky/engine/platform/text/TextStream.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 164 }
166 } 165 }
167 166
168 void FrameView::setFrameRect(const IntRect& newRect) 167 void FrameView::setFrameRect(const IntRect& newRect)
169 { 168 {
170 IntRect oldRect = frameRect(); 169 IntRect oldRect = frameRect();
171 if (newRect == oldRect) 170 if (newRect == oldRect)
172 return; 171 return;
173 172
174 Widget::setFrameRect(newRect); 173 Widget::setFrameRect(newRect);
175
176 if (RenderView* renderView = this->renderView()) {
177 if (renderView->usesCompositing())
178 renderView->compositor()->frameViewDidChangeSize();
179 }
180 } 174 }
181 175
182 Page* FrameView::page() const 176 Page* FrameView::page() const
183 { 177 {
184 return frame().page(); 178 return frame().page();
185 } 179 }
186 180
187 RenderView* FrameView::renderView() const 181 RenderView* FrameView::renderView() const
188 { 182 {
189 return frame().contentRenderer(); 183 return frame().contentRenderer();
190 } 184 }
191 185
192 IntPoint FrameView::clampOffsetAtScale(const IntPoint& offset, float scale) cons t 186 IntPoint FrameView::clampOffsetAtScale(const IntPoint& offset, float scale) cons t
193 { 187 {
194 FloatSize scaledSize = unscaledVisibleContentSize(); 188 FloatSize scaledSize = unscaledVisibleContentSize();
195 if (scale) 189 if (scale)
196 scaledSize.scale(1 / scale); 190 scaledSize.scale(1 / scale);
197 191
198 IntPoint clampedOffset = offset; 192 IntPoint clampedOffset = offset;
199 clampedOffset = clampedOffset.shrunkTo( 193 clampedOffset = clampedOffset.shrunkTo(
200 IntPoint(size()) - expandedIntSize(scaledSize)); 194 IntPoint(size()) - expandedIntSize(scaledSize));
201 return clampedOffset; 195 return clampedOffset;
202 } 196 }
203 197
204 void FrameView::updateAcceleratedCompositingSettings()
205 {
206 if (RenderView* renderView = this->renderView())
207 renderView->compositor()->updateAcceleratedCompositingSettings();
208 }
209
210 void FrameView::recalcOverflowAfterStyleChange() 198 void FrameView::recalcOverflowAfterStyleChange()
211 { 199 {
212 RenderView* renderView = this->renderView(); 200 RenderView* renderView = this->renderView();
213 RELEASE_ASSERT(renderView); 201 RELEASE_ASSERT(renderView);
214 if (!renderView->needsOverflowRecalcAfterStyleChange()) 202 if (!renderView->needsOverflowRecalcAfterStyleChange())
215 return; 203 return;
216 204
217 renderView->recalcOverflowAfterStyleChange(); 205 renderView->recalcOverflowAfterStyleChange();
218 } 206 }
219 207
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 m_layoutSubtreeRoot = 0; 377 m_layoutSubtreeRoot = 0;
390 // We need to ensure that we mark up all renderers up to the RenderView 378 // We need to ensure that we mark up all renderers up to the RenderView
391 // for paint invalidation. This simplifies our code as we just always 379 // for paint invalidation. This simplifies our code as we just always
392 // do a full tree walk. 380 // do a full tree walk.
393 if (RenderObject* container = rootForThisLayout->container()) 381 if (RenderObject* container = rootForThisLayout->container())
394 container->setMayNeedPaintInvalidation(true); 382 container->setMayNeedPaintInvalidation(true);
395 } // Reset m_layoutSchedulingEnabled to its previous value. 383 } // Reset m_layoutSchedulingEnabled to its previous value.
396 384
397 layer->updateLayerPositionsAfterLayout(); 385 layer->updateLayerPositionsAfterLayout();
398 386
399 if (m_doFullPaintInvalidation)
400 renderView()->compositor()->fullyInvalidatePaint();
401 renderView()->compositor()->didLayout();
402
403 m_layoutCount++; 387 m_layoutCount++;
404 388
405 ASSERT(!rootForThisLayout->needsLayout()); 389 ASSERT(!rootForThisLayout->needsLayout());
406 390
407 scheduleOrPerformPostLayoutTasks(); 391 scheduleOrPerformPostLayoutTasks();
408 392
409 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", " endData", InspectorLayoutEvent::endData(rootForThisLayout)); 393 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", " endData", InspectorLayoutEvent::endData(rootForThisLayout));
410 394
411 m_nestedLayoutCount--; 395 m_nestedLayoutCount--;
412 if (m_nestedLayoutCount) 396 if (m_nestedLayoutCount)
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 } 874 }
891 875
892 void FrameView::updateLayoutAndStyleForPainting() 876 void FrameView::updateLayoutAndStyleForPainting()
893 { 877 {
894 // Updating layout can run script, which can tear down the FrameView. 878 // Updating layout can run script, which can tear down the FrameView.
895 RefPtr<FrameView> protector(this); 879 RefPtr<FrameView> protector(this);
896 880
897 updateLayoutAndStyleIfNeededRecursive(); 881 updateLayoutAndStyleIfNeededRecursive();
898 882
899 if (RenderView* view = renderView()) { 883 if (RenderView* view = renderView()) {
900 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", TRACE_EVENT_SCOPE_PROCESS, "frame", m_frame.get()); 884 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "In validateTreeAndUpdateIframes", TRACE_EVENT_SCOPE_PROCESS, "frame", m_frame.get() );
901 view->compositor()->updateIfNeededRecursive();
902
903 invalidateTreeIfNeededRecursive(); 885 invalidateTreeIfNeededRecursive();
904
905 view->updateIFramesAfterLayout(); 886 view->updateIFramesAfterLayout();
906 } 887 }
907 888
908 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); 889 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean);
909 } 890 }
910 891
911 void FrameView::updateLayoutAndStyleIfNeededRecursive() 892 void FrameView::updateLayoutAndStyleIfNeededRecursive()
912 { 893 {
913 // We have to crawl our entire tree looking for any FrameViews that need 894 // We have to crawl our entire tree looking for any FrameViews that need
914 // layout and make sure they are up to date. 895 // layout and make sure they are up to date.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 return roundedIntPoint(renderer.localToAbsolute(rendererPoint, UseTransforms )); 946 return roundedIntPoint(renderer.localToAbsolute(rendererPoint, UseTransforms ));
966 } 947 }
967 948
968 IntPoint FrameView::convertToRenderer(const RenderObject& renderer, const IntPoi nt& viewPoint) const 949 IntPoint FrameView::convertToRenderer(const RenderObject& renderer, const IntPoi nt& viewPoint) const
969 { 950 {
970 return roundedIntPoint(renderer.absoluteToLocal(viewPoint, UseTransforms)); 951 return roundedIntPoint(renderer.absoluteToLocal(viewPoint, UseTransforms));
971 } 952 }
972 953
973 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations) 954 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations)
974 { 955 {
956 // FIXME(sky): Does this code work anymore now that we don't have the compos itor?
975 if (trackPaintInvalidations == m_isTrackingPaintInvalidations) 957 if (trackPaintInvalidations == m_isTrackingPaintInvalidations)
976 return; 958 return;
977 959
978 // FIXME(sky): simplify
979 if (RenderView* renderView = m_frame->contentRenderer())
980 renderView->compositor()->setTracksPaintInvalidations(trackPaintInvalida tions);
981
982 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), 960 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"),
983 "FrameView::setTracksPaintInvalidations", TRACE_EVENT_SCOPE_PROCESS, "en abled", trackPaintInvalidations); 961 "FrameView::setTracksPaintInvalidations", TRACE_EVENT_SCOPE_PROCESS, "en abled", trackPaintInvalidations);
984 962
985 resetTrackedPaintInvalidations(); 963 resetTrackedPaintInvalidations();
986 m_isTrackingPaintInvalidations = trackPaintInvalidations; 964 m_isTrackingPaintInvalidations = trackPaintInvalidations;
987 } 965 }
988 966
989 void FrameView::resetTrackedPaintInvalidations() 967 void FrameView::resetTrackedPaintInvalidations()
990 { 968 {
991 m_trackedPaintInvalidationRects.clear(); 969 m_trackedPaintInvalidationRects.clear();
992 if (RenderView* renderView = this->renderView())
993 renderView->compositor()->resetTrackedPaintInvalidationRects();
994 } 970 }
995 971
996 String FrameView::trackedPaintInvalidationRectsAsText() const 972 String FrameView::trackedPaintInvalidationRectsAsText() const
997 { 973 {
998 TextStream ts; 974 TextStream ts;
999 if (!m_trackedPaintInvalidationRects.isEmpty()) { 975 if (!m_trackedPaintInvalidationRects.isEmpty()) {
1000 ts << "(repaint rects\n"; 976 ts << "(repaint rects\n";
1001 for (size_t i = 0; i < m_trackedPaintInvalidationRects.size(); ++i) 977 for (size_t i = 0; i < m_trackedPaintInvalidationRects.size(); ++i)
1002 ts << " (rect " << m_trackedPaintInvalidationRects[i].x() << " " << m_trackedPaintInvalidationRects[i].y() << " " << m_trackedPaintInvalidationRect s[i].width() << " " << m_trackedPaintInvalidationRects[i].height() << ")\n"; 978 ts << " (rect " << m_trackedPaintInvalidationRects[i].x() << " " << m_trackedPaintInvalidationRects[i].y() << " " << m_trackedPaintInvalidationRect s[i].width() << " " << m_trackedPaintInvalidationRects[i].height() << ")\n";
1003 ts << ")\n"; 979 ts << ")\n";
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 void FrameView::setLayoutSizeInternal(const IntSize& size) 1025 void FrameView::setLayoutSizeInternal(const IntSize& size)
1050 { 1026 {
1051 if (m_layoutSize == size) 1027 if (m_layoutSize == size)
1052 return; 1028 return;
1053 1029
1054 m_layoutSize = size; 1030 m_layoutSize = size;
1055 contentsResized(); 1031 contentsResized();
1056 } 1032 }
1057 1033
1058 } // namespace blink 1034 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698