Changeset 162947 in webkit
- Timestamp:
- Jan 28, 2014, 11:40:05 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r162945 r162947 1 2014-01-28 Antti Koivisto <antti@apple.com> 2 3 REGRESSION(r162837): 5% regression on html5-full-render and 3% regression in DoYouEvenBench 4 https://bugs.webkit.org/show_bug.cgi?id=127722 5 6 Reviewed by Darin Adler. 7 8 Accumulate repaint region in RendeView instead of flushing rects directly to the system. 9 10 * dom/Document.cpp: 11 (WebCore::Document::recalcStyle): 12 (WebCore::Document::updateLayout): 13 (WebCore::Document::topDocument): 14 15 Make less silly. 16 17 * page/FrameView.cpp: 18 (WebCore::FrameView::layout): 19 * rendering/RenderView.cpp: 20 (WebCore::RenderView::repaintViewRectangle): 21 (WebCore::RenderView::flushAccumulatedRepaintRegion): 22 (WebCore::RenderView::RepaintRegionAccumulator::RepaintRegionAccumulator): 23 (WebCore::RenderView::RepaintRegionAccumulator::~RepaintRegionAccumulator): 24 * rendering/RenderView.h: 25 1 26 2014-01-28 Jeremy Jones <jeremyj@apple.com> 2 27 -
trunk/Source/WebCore/dom/Document.cpp
r162837 r162947 1721 1721 return; // Guard against re-entrancy. -dwh 1722 1722 1723 RenderView::RepaintRegionAccumulator repaintRegionAccumulator(renderView()); 1724 1723 1725 // FIXME: We should update style on our ancestor chain before proceeding (especially for seamless), 1724 1726 // however doing so currently causes several tests to crash, as Frame::setDocument calls Document::attach … … 1811 1813 return; 1812 1814 } 1815 1816 RenderView::RepaintRegionAccumulator repaintRegionAccumulator(renderView()); 1813 1817 1814 1818 if (Element* oe = ownerElement()) … … 4310 4314 Document* Document::topDocument() const 4311 4315 { 4312 // FIXME: Why does this walk up owner elements instead using the frame tree as parentDocument does? 4313 // The frame tree even has a top() function. 4314 Document* document = const_cast<Document*>(this); 4315 while (Element* element = document->ownerElement()) 4316 document = &element->document(); 4317 return document; 4316 return m_frame ? m_frame->mainFrame().document() : const_cast<Document*>(this); 4318 4317 } 4319 4318 -
trunk/Source/WebCore/page/FrameView.cpp
r162840 r162947 1277 1277 } 1278 1278 LayoutStateDisabler layoutStateDisabler(disableLayoutState ? &root->view() : 0); 1279 RenderView::RepaintRegionAccumulator repaintRegionAccumulator(&root->view()); 1279 1280 1280 1281 ASSERT(m_layoutPhase == InPreLayout); -
trunk/Source/WebCore/rendering/RenderView.cpp
r162837 r162947 606 606 } 607 607 608 void RenderView::repaintViewRectangle(const LayoutRect& ur, bool immediate) const 609 { 610 if (!shouldRepaint(ur)) 611 return; 612 613 // We always just invalidate the root view, since we could be an iframe that is clipped out 614 // or even invisible. 615 Element* elt = document().ownerElement(); 616 if (!elt) 617 frameView().repaintContentRectangle(pixelSnappedIntRect(ur), immediate); 618 else if (RenderBox* obj = elt->renderBox()) { 619 LayoutRect vr = viewRect(); 608 void RenderView::repaintViewRectangle(const LayoutRect& repaintRect, bool immediate) const 609 { 610 // FIXME: Get rid of the 'immediate' argument. It only works on Mac WK1 and should never be used. 611 if (!shouldRepaint(repaintRect)) 612 return; 613 614 if (auto ownerElement = document().ownerElement()) { 615 if (!ownerElement->renderer()) 616 return; 617 auto& ownerBox = toRenderBox(*ownerElement->renderer()); 618 LayoutRect viewRect = this->viewRect(); 620 619 #if PLATFORM(IOS) 621 620 // Don't clip using the visible rect since clipping is handled at a higher level on iPhone. 622 LayoutRect r = ur;621 LayoutRect adjustedRect = repaintRect; 623 622 #else 624 LayoutRect r = intersection(ur, vr); 625 #endif 626 627 // Subtract out the contentsX and contentsY offsets to get our coords within the viewing 628 // rectangle. 629 r.moveBy(-vr.location()); 630 631 // FIXME: Hardcoded offsets here are not good. 632 r.moveBy(obj->contentBoxRect().location()); 633 obj->repaintRectangle(r, immediate); 634 } 623 LayoutRect adjustedRect = intersection(repaintRect, viewRect); 624 #endif 625 adjustedRect.moveBy(-viewRect.location()); 626 adjustedRect.moveBy(ownerBox.contentBoxRect().location()); 627 ownerBox.repaintRectangle(adjustedRect, immediate); 628 return; 629 } 630 631 IntRect pixelSnappedRect = pixelSnappedIntRect(repaintRect); 632 if (!m_accumulatedRepaintRegion || immediate) { 633 frameView().repaintContentRectangle(pixelSnappedRect, immediate); 634 return; 635 } 636 m_accumulatedRepaintRegion->unite(pixelSnappedRect); 637 } 638 639 void RenderView::flushAccumulatedRepaintRegion() const 640 { 641 ASSERT(!document().ownerElement()); 642 ASSERT(m_accumulatedRepaintRegion); 643 auto repaintRects = m_accumulatedRepaintRegion->rects(); 644 for (auto& rect : repaintRects) 645 frameView().repaintContentRectangle(rect, false); 646 m_accumulatedRepaintRegion = nullptr; 635 647 } 636 648 … … 1254 1266 } 1255 1267 1268 RenderView::RepaintRegionAccumulator::RepaintRegionAccumulator(RenderView* view) 1269 : m_rootView(view ? view->document().topDocument()->renderView() : nullptr) 1270 { 1271 if (!m_rootView) 1272 return; 1273 m_wasAccumulatingRepaintRegion = !!m_rootView->m_accumulatedRepaintRegion; 1274 if (!m_wasAccumulatingRepaintRegion) 1275 m_rootView->m_accumulatedRepaintRegion = std::make_unique<Region>(); 1276 } 1277 1278 RenderView::RepaintRegionAccumulator::~RepaintRegionAccumulator() 1279 { 1280 if (!m_rootView) 1281 return; 1282 if (m_wasAccumulatingRepaintRegion) 1283 return; 1284 m_rootView->flushAccumulatedRepaintRegion(); 1285 } 1286 1256 1287 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderView.h
r162726 r162947 26 26 #include "LayoutState.h" 27 27 #include "PODFreeListArena.h" 28 #include "Region.h" 28 29 #include "RenderBlockFlow.h" 29 30 #include <wtf/OwnPtr.h> … … 235 236 void didDestroyRenderer() { --m_rendererCount; } 236 237 238 class RepaintRegionAccumulator { 239 WTF_MAKE_NONCOPYABLE(RepaintRegionAccumulator); 240 public: 241 RepaintRegionAccumulator(RenderView*); 242 ~RepaintRegionAccumulator(); 243 244 private: 245 RenderView* m_rootView; 246 bool m_wasAccumulatingRepaintRegion; 247 }; 248 237 249 protected: 238 250 virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0) const override; … … 248 260 249 261 bool shouldRepaint(const LayoutRect&) const; 262 void flushAccumulatedRepaintRegion() const; 250 263 251 264 // These functions may only be accessed by LayoutStateMaintainer. … … 303 316 304 317 uint64_t m_rendererCount; 318 319 mutable std::unique_ptr<Region> m_accumulatedRepaintRegion; 305 320 306 321 // FIXME: Only used by embedded WebViews inside AppKit NSViews. Find a way to remove.
Note:
See TracChangeset
for help on using the changeset viewer.