Changeset 221139 in webkit
- Timestamp:
- Aug 24, 2017, 9:37:53 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/platform/mac-wk2/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/Document.cpp (modified) (3 diffs)
-
Source/WebCore/dom/Document.h (modified) (1 diff)
-
Source/WebCore/page/FrameView.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r221134 r221139 1 2017-08-22 Darin Adler <darin@apple.com> 2 3 REGRESSION (r220052): ASSERTION FAILED: !frame().isMainFrame() || !needsStyleRecalcOrLayout() in WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive() 4 https://bugs.webkit.org/show_bug.cgi?id=175270 5 6 Reviewed by Simon Fraser. 7 8 * platform/mac-wk2/TestExpectations: Re-enable the disabled test. 9 1 10 2017-08-24 Ms2ger <Ms2ger@igalia.com> 2 11 -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r221115 r221139 753 753 webkit.org/b/173946 [ Debug ] media/modern-media-controls/fullscreen-support/fullscreen-support-press.html [ Pass Failure ] 754 754 755 webkit.org/b/175270 [ Debug ] plugins/crash-restoring-plugin-page-from-page-cache.html [ Skip ]756 757 755 # CSS Regions are being phased out. 758 756 tiled-drawing/scrolling/non-fast-region/wheel-handler-in-region.html [ Skip ] -
trunk/Source/WebCore/ChangeLog
r221135 r221139 1 2017-08-22 Darin Adler <darin@apple.com> 2 3 REGRESSION (r220052): ASSERTION FAILED: !frame().isMainFrame() || !needsStyleRecalcOrLayout() in WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive() 4 https://bugs.webkit.org/show_bug.cgi?id=175270 5 6 Reviewed by Simon Fraser. 7 8 * dom/Document.cpp: 9 (WebCore::Document::Document): Initialize m_styleRecalcTimer with a lamdba so it can work 10 with a function that returns a bool and ignore the return value. 11 (WebCore::Document::updateStyleIfNeeded): Added a boolean return value indicating if the 12 function did any work or not. 13 * dom/Document.h: Updated for above change. 14 15 * page/FrameView.cpp: 16 (WebCore::appendRenderedChildren): Added helper that will later replace the 17 FrameView::renderedChildFrameViews function and is used below. 18 (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive): Instead of always doing two 19 passes of style and layout update do up to four passes, but stop as soon as a pass does 20 no work. This is slightly more efficient in cases where no layout and style update is 21 needed, and works correctly when a third pass is needed, which is what happens in the 22 test that was failing. We can eventually improve this further, but this resolves the 23 immediate problem we are seeing in the test. 24 1 25 2017-08-24 Don Olmstead <don.olmstead@sony.com> 2 26 -
trunk/Source/WebCore/dom/Document.cpp
r221014 r221139 461 461 , m_visitedLinkState(std::make_unique<VisitedLinkState>(*this)) 462 462 , m_markers(std::make_unique<DocumentMarkerController>(*this)) 463 , m_styleRecalcTimer( *this, &Document::updateStyleIfNeeded)463 , m_styleRecalcTimer([this] { updateStyleIfNeeded(); }) 464 464 , m_updateFocusAppearanceTimer(*this, &Document::updateFocusAppearanceTimerFired) 465 465 , m_documentCreationTime(MonotonicTime::now()) … … 1888 1888 } 1889 1889 1890 voidDocument::updateStyleIfNeeded()1890 bool Document::updateStyleIfNeeded() 1891 1891 { 1892 1892 ASSERT(isMainThread()); … … 1894 1894 1895 1895 if (!view() || view()->isInRenderTreeLayout()) 1896 return ;1896 return false; 1897 1897 1898 1898 styleScope().flushPendingUpdate(); 1899 1899 1900 1900 if (!needsStyleRecalc()) 1901 return ;1901 return false; 1902 1902 1903 1903 resolveStyle(); 1904 return true; 1904 1905 } 1905 1906 -
trunk/Source/WebCore/dom/Document.h
r221014 r221139 545 545 enum class ResolveStyleType { Normal, Rebuild }; 546 546 void resolveStyle(ResolveStyleType = ResolveStyleType::Normal); 547 WEBCORE_EXPORT voidupdateStyleIfNeeded();547 WEBCORE_EXPORT bool updateStyleIfNeeded(); 548 548 bool needsStyleRecalc() const; 549 549 unsigned lastStyleUpdateSizeForTesting() const { return m_lastStyleUpdateSizeForTesting; } -
trunk/Source/WebCore/page/FrameView.cpp
r220812 r221139 4576 4576 } 4577 4577 4578 static void appendRenderedChildren(FrameView& view, Deque<Ref<FrameView>, 16>& deque) 4579 { 4580 for (Frame* frame = view.frame().tree().firstRenderedChild(); frame; frame = frame->tree().nextRenderedSibling()) { 4581 if (frame->view()) 4582 deque.append(*frame->view()); 4583 } 4584 } 4585 4586 // FIXME: Change the one remaining caller of this to use appendRenderedChildren above instead, 4587 // and then remove FrameViewList and renderedChildFrameViews. 4578 4588 FrameView::FrameViewList FrameView::renderedChildFrameViews() const 4579 4589 { … … 4589 4599 void FrameView::updateLayoutAndStyleIfNeededRecursive() 4590 4600 { 4591 // We have to crawl our entire tree looking for any FrameViews that need4592 // layout and make sure they are up to date.4593 // Mac actually tests for intersection with the dirty region and tries not to4594 // update layout for frames that are outside the dirty region. Not only does this seem4595 // p ointless (since those frames will have set a zero timer to layout anyway), but4596 // it is also incorrect, since if two frames overlap, the first could be excluded from the dirty4597 // region but then become included later by the second frame adding rects to the dirty region4598 // when it lays out.4601 // The number "4" here is empirically determined as the number of passes needed to 4602 // make sure we don't need more style recalculation or layout; we have not seen a 4603 // case where we need more than 3 passes, so 4 is a bit more than needed in any 4604 // normal case. But it's not clear that anything prevents an indefinite number of 4605 // passes from being needed. So it would be better to instead have a firm guarantee 4606 // of the number of times this needs to be done, or come up with a way to do this 4607 // in one pass without a loop. 4608 const unsigned maxUpdatePasses = 4; 4599 4609 4600 4610 AnimationUpdateBlock animationUpdateBlock(&frame().animation()); 4601 4611 4602 frame().document()->updateStyleIfNeeded(); 4603 4604 if (needsLayout()) 4605 layout(); 4606 4607 // Grab a copy of the child views, as the list may be mutated by the following updateLayoutAndStyleIfNeededRecursive 4608 // calls, as they can potentially re-enter a layout of the parent frame view. 4609 for (auto& frameView : renderedChildFrameViews()) 4610 frameView->updateLayoutAndStyleIfNeededRecursive(); 4611 4612 // A child frame may have dirtied us during its layout. 4613 frame().document()->updateStyleIfNeeded(); 4614 if (needsLayout()) 4615 layout(); 4616 4612 auto updateOnce = [this] { 4613 auto updateOneFrame = [] (FrameView& view) { 4614 bool didWork = view.frame().document()->updateStyleIfNeeded(); 4615 if (view.needsLayout()) { 4616 view.layout(); 4617 didWork = true; 4618 } 4619 return didWork; 4620 }; 4621 4622 bool didWork = false; 4623 4624 // Use a copy of the child frame list because it can change while updating. 4625 Deque<Ref<FrameView>, 16> views; 4626 views.append(*this); 4627 while (!views.isEmpty()) { 4628 auto view = views.takeFirst(); 4629 if (updateOneFrame(view.get())) 4630 didWork = true; 4631 appendRenderedChildren(view.get(), views); 4632 } 4633 4634 return didWork; 4635 }; 4636 4637 for (unsigned i = 0; i < maxUpdatePasses; ++i) { 4638 if (!updateOnce()) 4639 break; 4640 } 4641 4642 // FIXME: Unclear why it's appropriate to skip this assertion for non-main frames. 4643 // The need for this may be obsolete and a leftover from when this fucntion was 4644 // implemented by recursively calling itself. 4617 4645 ASSERT(!frame().isMainFrame() || !needsStyleRecalcOrLayout()); 4618 4646 }
Note:
See TracChangeset
for help on using the changeset viewer.