Commit a4e4bfb8 authored by skobes@chromium.org's avatar skobes@chromium.org

Reset multipliers correctly when autosizing is turned off.

This lets us re-land http://crrev.com/208393008 without breaking
AwSettingsTest.testLayoutAlgorithmWithTwoViews.

Without http://crrev.com/208393008, style recalc would always reset the
autosizing multiplier to 1, so the bug in recalculateMultipliers was not
noticed.

BUG=353309,356960

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

git-svn-id: svn://svn.chromium.org/blink/trunk@170241 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 53e580f1
...@@ -148,6 +148,7 @@ static unsigned computeLocalHash(const RenderObject* renderer) ...@@ -148,6 +148,7 @@ static unsigned computeLocalHash(const RenderObject* renderer)
TextAutosizer::TextAutosizer(Document* document) TextAutosizer::TextAutosizer(Document* document)
: m_document(document) : m_document(document)
, m_previouslyAutosized(false)
{ {
} }
...@@ -180,7 +181,7 @@ bool TextAutosizer::isApplicable() const ...@@ -180,7 +181,7 @@ bool TextAutosizer::isApplicable() const
void TextAutosizer::recalculateMultipliers() void TextAutosizer::recalculateMultipliers()
{ {
if (!isApplicable()) if (!isApplicable() && !m_previouslyAutosized)
return; return;
RenderObject* renderer = m_document->renderer(); RenderObject* renderer = m_document->renderer();
...@@ -189,6 +190,7 @@ void TextAutosizer::recalculateMultipliers() ...@@ -189,6 +190,7 @@ void TextAutosizer::recalculateMultipliers()
setMultiplier(renderer, 1); setMultiplier(renderer, 1);
renderer = renderer->nextInPreOrder(); renderer = renderer->nextInPreOrder();
} }
m_previouslyAutosized = false;
} }
bool TextAutosizer::processSubtree(RenderObject* layoutRoot) bool TextAutosizer::processSubtree(RenderObject* layoutRoot)
...@@ -244,6 +246,7 @@ bool TextAutosizer::processSubtree(RenderObject* layoutRoot) ...@@ -244,6 +246,7 @@ bool TextAutosizer::processSubtree(RenderObject* layoutRoot)
m_nonAutosizedClusters.clear(); m_nonAutosizedClusters.clear();
#endif #endif
InspectorInstrumentation::didAutosizeText(layoutRoot); InspectorInstrumentation::didAutosizeText(layoutRoot);
m_previouslyAutosized = true;
return true; return true;
} }
......
...@@ -139,6 +139,8 @@ private: ...@@ -139,6 +139,8 @@ private:
// Mapping from a cluster hash to the corresponding cluster infos which have not been autosized yet. // Mapping from a cluster hash to the corresponding cluster infos which have not been autosized yet.
HashMap<unsigned, OwnPtr<Vector<TextAutosizingClusterInfo> > > m_nonAutosizedClusters; HashMap<unsigned, OwnPtr<Vector<TextAutosizingClusterInfo> > > m_nonAutosizedClusters;
bool m_previouslyAutosized;
}; };
} // namespace WebCore } // namespace WebCore
......
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