Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1261)

Unified Diff: Source/core/rendering/FastTextAutosizer.cpp

Issue 209413002: Avoid unnecessary invalidations on resize. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@crap
Patch Set: Rebaseline. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/FastTextAutosizer.h ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/core/rendering/FastTextAutosizer.h ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698