[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()
return RuntimeEnabledFeatures::repaintAfterLayoutEnabled() || isTracing;
}
LayoutRectRecorder::LayoutRectRecorder(RenderObject& object, bool skipRecording)
LayoutRectRecorder::LayoutRectRecorder(RenderObject& object, bool record)
: m_object(object)
, m_skipRecording(skipRecording)
, m_record(record)
{
if (!shouldRecordLayoutRects())
return;
if (m_skipRecording)
if (!m_record)
return;
if (!m_object.layoutDidGetCalled()) {
......@@ -72,7 +72,7 @@ LayoutRectRecorder::~LayoutRectRecorder()
{
if (!shouldRecordLayoutRects())
return;
if (m_skipRecording)
if (!m_record)
return;
// Note, we don't store the repaint container because it can change during layout.
......
......@@ -42,14 +42,14 @@ class RenderObject;
class LayoutRectRecorder {
WTF_MAKE_NONCOPYABLE(LayoutRectRecorder);
public:
LayoutRectRecorder(RenderObject&, bool skipRecording = false);
LayoutRectRecorder(RenderObject&, bool record = true);
~LayoutRectRecorder();
static bool shouldRecordLayoutRects();
private:
RenderObject& m_object;
bool m_skipRecording;
bool m_record;
};
} // namespace WebCore
......
......@@ -1954,7 +1954,7 @@ void RenderBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& re
for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) {
RenderObject* o = walker.current();
LayoutRectRecorder recorder(*o, !o->isText());
LayoutRectRecorder recorder(*o, o->isText());
if (!layoutState.hasInlineChild() && o->isInline())
layoutState.setHasInlineChild(true);
......
......@@ -195,12 +195,11 @@ void RenderSVGRoot::layout()
{
ASSERT(needsLayout());
LayoutRectRecorder recorder(*this);
// Arbitrary affine transforms are incompatible with LayoutState.
LayoutStateDisabler layoutStateDisabler(*this);
bool needsLayout = selfNeedsLayout();
LayoutRectRecorder recorder(*this, checkForRepaint() && needsLayout);
LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && needsLayout);
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