[repaint-after-layout] Only repaint SVG root element when needed.

With Repaint-After-Layout we would repaint the SVG Root element a lot more
then needed. This ports the check for when to repaint the SVG Root element
into the LayoutRectRecorder to better match what the LayoutRepainting was doing
originally.

BUG=320139

Review URL: https://codereview.chromium.org/208103002

git-svn-id: svn://svn.chromium.org/blink/trunk@169886 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 4dcf3124
...@@ -42,13 +42,13 @@ bool LayoutRectRecorder::shouldRecordLayoutRects() ...@@ -42,13 +42,13 @@ bool LayoutRectRecorder::shouldRecordLayoutRects()
return RuntimeEnabledFeatures::repaintAfterLayoutEnabled() || isTracing; return RuntimeEnabledFeatures::repaintAfterLayoutEnabled() || isTracing;
} }
LayoutRectRecorder::LayoutRectRecorder(RenderObject& object, bool skipRecording) LayoutRectRecorder::LayoutRectRecorder(RenderObject& object, bool record)
: m_object(object) : m_object(object)
, m_skipRecording(skipRecording) , m_record(record)
{ {
if (!shouldRecordLayoutRects()) if (!shouldRecordLayoutRects())
return; return;
if (m_skipRecording) if (!m_record)
return; return;
if (!m_object.layoutDidGetCalled()) { if (!m_object.layoutDidGetCalled()) {
...@@ -72,7 +72,7 @@ LayoutRectRecorder::~LayoutRectRecorder() ...@@ -72,7 +72,7 @@ LayoutRectRecorder::~LayoutRectRecorder()
{ {
if (!shouldRecordLayoutRects()) if (!shouldRecordLayoutRects())
return; return;
if (m_skipRecording) if (!m_record)
return; return;
// Note, we don't store the repaint container because it can change during layout. // Note, we don't store the repaint container because it can change during layout.
......
...@@ -42,14 +42,14 @@ class RenderObject; ...@@ -42,14 +42,14 @@ class RenderObject;
class LayoutRectRecorder { class LayoutRectRecorder {
WTF_MAKE_NONCOPYABLE(LayoutRectRecorder); WTF_MAKE_NONCOPYABLE(LayoutRectRecorder);
public: public:
LayoutRectRecorder(RenderObject&, bool skipRecording = false); LayoutRectRecorder(RenderObject&, bool record = true);
~LayoutRectRecorder(); ~LayoutRectRecorder();
static bool shouldRecordLayoutRects(); static bool shouldRecordLayoutRects();
private: private:
RenderObject& m_object; RenderObject& m_object;
bool m_skipRecording; bool m_record;
}; };
} // namespace WebCore } // namespace WebCore
......
...@@ -1954,7 +1954,7 @@ void RenderBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& re ...@@ -1954,7 +1954,7 @@ void RenderBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& re
for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) {
RenderObject* o = walker.current(); RenderObject* o = walker.current();
LayoutRectRecorder recorder(*o, !o->isText()); LayoutRectRecorder recorder(*o, o->isText());
if (!layoutState.hasInlineChild() && o->isInline()) if (!layoutState.hasInlineChild() && o->isInline())
layoutState.setHasInlineChild(true); layoutState.setHasInlineChild(true);
......
...@@ -195,12 +195,11 @@ void RenderSVGRoot::layout() ...@@ -195,12 +195,11 @@ void RenderSVGRoot::layout()
{ {
ASSERT(needsLayout()); ASSERT(needsLayout());
LayoutRectRecorder recorder(*this);
// Arbitrary affine transforms are incompatible with LayoutState. // Arbitrary affine transforms are incompatible with LayoutState.
LayoutStateDisabler layoutStateDisabler(*this); LayoutStateDisabler layoutStateDisabler(*this);
bool needsLayout = selfNeedsLayout(); bool needsLayout = selfNeedsLayout();
LayoutRectRecorder recorder(*this, checkForRepaint() && needsLayout);
LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && needsLayout); LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && needsLayout);
LayoutSize oldSize = size(); LayoutSize oldSize = size();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment