Chromium Code Reviews| Index: Source/core/rendering/FastTextAutosizer.cpp |
| diff --git a/Source/core/rendering/FastTextAutosizer.cpp b/Source/core/rendering/FastTextAutosizer.cpp |
| index b78ade35f56f76f09015361ce9402db3f1f151a2..3f940cd103b24dc84ad893b8be79f90c63395078 100644 |
| --- a/Source/core/rendering/FastTextAutosizer.cpp |
| +++ b/Source/core/rendering/FastTextAutosizer.cpp |
| @@ -236,6 +236,7 @@ FastTextAutosizer::FastTextAutosizer(const Document* document) |
| , m_baseMultiplier(0) |
| , m_pageNeedsAutosizing(false) |
| , m_previouslyAutosized(false) |
| + , m_updatePageInfoDeferred(false) |
| , m_firstBlock(0) |
| #ifndef NDEBUG |
| , m_blocksThatHaveBegunLayout() |
| @@ -290,7 +291,7 @@ void FastTextAutosizer::prepareClusterStack(const RenderObject* renderer) |
| void FastTextAutosizer::beginLayout(RenderBlock* block) |
| { |
| - ASSERT(enabled() && m_pageNeedsAutosizing); |
| + ASSERT(enabled() && m_pageNeedsAutosizing && !m_updatePageInfoDeferred); |
|
pdr.
2014/03/26 03:02:22
This ends up firing on nearly every page :(
skobes
2014/03/28 01:00:29
What page does it fire on for you? I'm not seeing
|
| #ifndef NDEBUG |
| m_blocksThatHaveBegunLayout.add(block); |
| #endif |
| @@ -439,7 +440,7 @@ void FastTextAutosizer::updatePageInfoInAllFrames() |
| void FastTextAutosizer::updatePageInfo() |
| { |
| - if (!enabled()) |
| + if (!enabled() || m_updatePageInfoDeferred) |
| return; |
| int previousFrameWidth = m_frameWidth; |
| @@ -987,4 +988,25 @@ FastTextAutosizer::LayoutScope::~LayoutScope() |
| m_textAutosizer->endLayout(m_block); |
| } |
| +FastTextAutosizer::DeferUpdatePageInfo::DeferUpdatePageInfo(Page* page) |
| + : m_mainFrame(page->mainFrame()) |
| +{ |
| + if (!m_mainFrame) |
| + return; |
|
abarth-chromium
2014/03/26 05:29:37
Can this actually happen?
skobes
2014/03/28 01:00:29
Perhaps not. Removed.
|
| + |
| + if (FastTextAutosizer* textAutosizer = m_mainFrame->document()->fastTextAutosizer()) |
| + textAutosizer->m_updatePageInfoDeferred = true; |
|
abarth-chromium
2014/03/26 05:29:37
Should we assert that this value is false? If thi
skobes
2014/03/28 01:00:29
Done.
|
| +} |
| + |
| +FastTextAutosizer::DeferUpdatePageInfo::~DeferUpdatePageInfo() |
| +{ |
| + if (!m_mainFrame) |
| + return; |
| + |
| + if (FastTextAutosizer* textAutosizer = m_mainFrame->document()->fastTextAutosizer()) { |
| + textAutosizer->m_updatePageInfoDeferred = false; |
| + textAutosizer->updatePageInfoInAllFrames(); |
| + } |
| +} |
| + |
| } // namespace WebCore |