Changeset 251640 in webkit
- Timestamp:
- Oct 27, 2019, 9:33:01 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
layout/LayoutContext.cpp (modified) (1 diff)
-
layout/LayoutContext.h (modified) (2 diffs)
-
layout/displaytree/DisplayPainter.cpp (modified) (3 diffs)
-
layout/displaytree/DisplayPainter.h (modified) (2 diffs)
-
page/FrameView.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r251639 r251640 1 2019-10-27 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][Painting] Use the dirty rect to decide what to paint 4 https://bugs.webkit.org/show_bug.cgi?id=203467 5 <rdar://problem/56653229> 6 7 Reviewed by Antti Koivisto. 8 9 This is a very basic dirty rect instersect check since we don't yet have layout overflow. 10 It enables us to not paint the entire content on every paint frame. 11 12 * layout/LayoutContext.cpp: 13 (WebCore::Layout::LayoutContext::paint): 14 * layout/LayoutContext.h: 15 * layout/displaytree/DisplayPainter.cpp: 16 (WebCore::Display::paintBoxDecorationAndChildren): 17 (WebCore::Display::Painter::paint): 18 * layout/displaytree/DisplayPainter.h: 19 * page/FrameView.cpp: 20 (WebCore::FrameView::paintContents): 21 1 22 2019-10-26 youenn fablet <youenn@apple.com> 2 23 -
trunk/Source/WebCore/layout/LayoutContext.cpp
r251638 r251640 171 171 } 172 172 173 void LayoutContext::paint(const LayoutState& layoutState, GraphicsContext& context )173 void LayoutContext::paint(const LayoutState& layoutState, GraphicsContext& context, const IntRect& dirtyRect) 174 174 { 175 Display::Painter::paint(layoutState, context );175 Display::Painter::paint(layoutState, context, dirtyRect); 176 176 } 177 177 -
trunk/Source/WebCore/layout/LayoutContext.h
r251638 r251640 35 35 36 36 class GraphicsContext; 37 class IntRect; 37 38 class RenderView; 38 39 … … 56 57 // FIXME: These are temporary entry points for LFC layout. 57 58 static std::unique_ptr<LayoutState> runLayoutAndVerify(const RenderView&); 58 static void paint(const LayoutState&, GraphicsContext& );59 static void paint(const LayoutState&, GraphicsContext&, const IntRect& dirtyRect); 59 60 60 61 LayoutContext(LayoutState&); -
trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp
r251239 r251640 35 35 #include "InlineFormattingState.h" 36 36 #include "InlineTextItem.h" 37 #include "IntRect.h" 37 38 #include "LayoutContainer.h" 38 39 #include "LayoutDescendantIterator.h" … … 146 147 } 147 148 148 static void paintBoxDecorationAndChildren(GraphicsContext& context, const Layout::LayoutState& layoutState, const Layout::Box& layoutBox )149 static void paintBoxDecorationAndChildren(GraphicsContext& context, const Layout::LayoutState& layoutState, const Layout::Box& layoutBox, const IntRect& dirtyRect) 149 150 { 150 if (!layoutBox.isAnonymous()) 151 paintBoxDecoration(context, absoluteDisplayBox(layoutState, layoutBox), layoutBox.style(), layoutBox.isBodyBox()); 151 if (!layoutBox.isAnonymous()) { 152 auto absoluteDisplayBox = Display::absoluteDisplayBox(layoutState, layoutBox); 153 if (dirtyRect.intersects(snappedIntRect(absoluteDisplayBox.rect()))) 154 paintBoxDecoration(context, absoluteDisplayBox, layoutBox.style(), layoutBox.isBodyBox()); 155 } 152 156 153 157 if (!is<Layout::Container>(layoutBox)) … … 156 160 if (childLayoutBox.style().visibility() != Visibility::Visible) 157 161 continue; 158 paintBoxDecorationAndChildren(context, layoutState, childLayoutBox );162 paintBoxDecorationAndChildren(context, layoutState, childLayoutBox, dirtyRect); 159 163 } 160 164 } 161 165 162 void Painter::paint(const Layout::LayoutState& layoutState, GraphicsContext& context )166 void Painter::paint(const Layout::LayoutState& layoutState, GraphicsContext& context, const IntRect& dirtyRect) 163 167 { 164 168 auto& layoutRoot = layoutState.root(); 165 auto& rootDisplayBox = layoutState.displayBoxForLayoutBox(layoutRoot);166 context.fillRect({ FloatPoint { }, FloatSize { rootDisplayBox.borderBoxWidth(), rootDisplayBox.borderBoxHeight() } }, Color::white);167 169 if (!layoutRoot.firstChild()) 168 170 return; 171 // Fill the entire content area. 172 auto rootRect = LayoutRect { layoutState.displayBoxForLayoutBox(layoutRoot).rect() }; 173 for (auto& layoutBox : Layout::descendantsOfType<Layout::Box>(layoutRoot)) 174 rootRect.uniteIfNonZero(Display::absoluteDisplayBox(layoutState, layoutBox).rect()); 175 context.fillRect(rootRect, Color::white); 169 176 170 177 // 1. Paint box decoration (both block and inline). 171 paintBoxDecorationAndChildren(context, layoutState, *layoutRoot.firstChild() );178 paintBoxDecorationAndChildren(context, layoutState, *layoutRoot.firstChild(), dirtyRect); 172 179 173 180 // 2. Paint content 174 181 for (auto& layoutBox : Layout::descendantsOfType<Layout::Box>(layoutRoot)) { 182 auto absoluteDisplayBox = Display::absoluteDisplayBox(layoutState, layoutBox); 183 // FIXME: This is the best we can do with no layout overflow support. 184 if (!dirtyRect.intersects(snappedIntRect(absoluteDisplayBox.rect()))) 185 continue; 175 186 if (layoutBox.style().visibility() != Visibility::Visible) 176 187 continue; 177 188 if (layoutBox.establishesInlineFormattingContext()) { 178 189 auto& container = downcast<Layout::Container>(layoutBox); 179 paintInlineContent(context, absoluteDisplayBox (layoutState, container), downcast<Layout::InlineFormattingState>(layoutState.establishedFormattingState(container)));190 paintInlineContent(context, absoluteDisplayBox, downcast<Layout::InlineFormattingState>(layoutState.establishedFormattingState(container))); 180 191 continue; 181 192 } -
trunk/Source/WebCore/layout/displaytree/DisplayPainter.h
r250769 r251640 31 31 32 32 class GraphicsContext; 33 class IntRect; 33 34 34 35 namespace Layout { … … 40 41 class Painter { 41 42 public: 42 static void paint(const Layout::LayoutState&, GraphicsContext& );43 static void paint(const Layout::LayoutState&, GraphicsContext&, const IntRect& dirtyRect); 43 44 }; 44 45 -
trunk/Source/WebCore/page/FrameView.cpp
r251638 r251640 4182 4182 if (RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextEnabled()) { 4183 4183 if (auto* layoutState = layoutContext().initialLayoutState()) 4184 Layout::LayoutContext::paint(*layoutState, context );4184 Layout::LayoutContext::paint(*layoutState, context, dirtyRect); 4185 4185 return; 4186 4186 }
Note:
See TracChangeset
for help on using the changeset viewer.