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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 145133006: Remove the recalc style timer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Moar raf Created 6 years, 11 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 unified diff | Download patch
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/web/tests/ScrollingCoordinatorChromiumTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 , m_compatibilityModeLocked(false) 413 , m_compatibilityModeLocked(false)
414 , m_didPostCheckFocusedElementTask(false) 414 , m_didPostCheckFocusedElementTask(false)
415 , m_hasAutofocused(false) 415 , m_hasAutofocused(false)
416 , m_domTreeVersion(++s_globalTreeVersion) 416 , m_domTreeVersion(++s_globalTreeVersion)
417 , m_listenerTypes(0) 417 , m_listenerTypes(0)
418 , m_mutationObserverTypes(0) 418 , m_mutationObserverTypes(0)
419 , m_visitedLinkState(VisitedLinkState::create(*this)) 419 , m_visitedLinkState(VisitedLinkState::create(*this))
420 , m_visuallyOrdered(false) 420 , m_visuallyOrdered(false)
421 , m_readyState(Complete) 421 , m_readyState(Complete)
422 , m_bParsing(false) 422 , m_bParsing(false)
423 , m_styleRecalcTimer(this, &Document::styleRecalcTimerFired) 423 , m_hasPendingStyleRecalc(false)
424 , m_inStyleRecalc(false) 424 , m_inStyleRecalc(false)
425 , m_gotoAnchorNeededAfterStylesheetsLoad(false) 425 , m_gotoAnchorNeededAfterStylesheetsLoad(false)
426 , m_containsValidityStyleRules(false) 426 , m_containsValidityStyleRules(false)
427 , m_updateFocusAppearanceRestoresSelection(false) 427 , m_updateFocusAppearanceRestoresSelection(false)
428 , m_containsPlugins(false) 428 , m_containsPlugins(false)
429 , m_ignoreDestructiveWriteCount(0) 429 , m_ignoreDestructiveWriteCount(0)
430 , m_titleSetExplicitly(false) 430 , m_titleSetExplicitly(false)
431 , m_markers(adoptPtr(new DocumentMarkerController)) 431 , m_markers(adoptPtr(new DocumentMarkerController))
432 , m_updateFocusAppearanceTimer(this, &Document::updateFocusAppearanceTimerFi red) 432 , m_updateFocusAppearanceTimer(this, &Document::updateFocusAppearanceTimerFi red)
433 , m_cssTarget(0) 433 , m_cssTarget(0)
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 bool Document::shouldCallRecalcStyleForDocument() 1529 bool Document::shouldCallRecalcStyleForDocument()
1530 { 1530 {
1531 return needsStyleRecalc() || childNeedsStyleRecalc() || childNeedsDistributi onRecalc() || !m_useElementsNeedingUpdate.isEmpty(); 1531 return needsStyleRecalc() || childNeedsStyleRecalc() || childNeedsDistributi onRecalc() || !m_useElementsNeedingUpdate.isEmpty();
1532 } 1532 }
1533 1533
1534 void Document::scheduleStyleRecalc() 1534 void Document::scheduleStyleRecalc()
1535 { 1535 {
1536 if (!isActive()) 1536 if (!isActive())
1537 return; 1537 return;
1538 1538
1539 if (m_styleRecalcTimer.isActive() || !shouldScheduleLayout()) 1539 if (m_hasPendingStyleRecalc || !shouldScheduleLayout())
1540 return; 1540 return;
1541 1541
1542 ASSERT(shouldCallRecalcStyleForDocument()); 1542 ASSERT(shouldCallRecalcStyleForDocument());
1543 1543
1544 m_styleRecalcTimer.startOneShot(0); 1544 view()->scheduleAnimation();
1545 m_hasPendingStyleRecalc = true;
1545 1546
1546 InspectorInstrumentation::didScheduleStyleRecalculation(this); 1547 InspectorInstrumentation::didScheduleStyleRecalculation(this);
1547 } 1548 }
1548 1549
1549 void Document::unscheduleStyleRecalc() 1550 void Document::unscheduleStyleRecalc()
1550 { 1551 {
1551 ASSERT(!isActive() || (!needsStyleRecalc() && !childNeedsStyleRecalc())); 1552 ASSERT(!isActive() || (!needsStyleRecalc() && !childNeedsStyleRecalc()));
1552 m_styleRecalcTimer.stop(); 1553 m_hasPendingStyleRecalc = false;
1553 } 1554 }
1554 1555
1555 bool Document::hasPendingForcedStyleRecalc() const 1556 bool Document::hasPendingForcedStyleRecalc() const
1556 { 1557 {
1557 return m_styleRecalcTimer.isActive() && !m_inStyleRecalc && styleChangeType( ) >= SubtreeStyleChange; 1558 return m_hasPendingStyleRecalc && !m_inStyleRecalc && styleChangeType() >= S ubtreeStyleChange;
1558 }
1559
1560 void Document::styleRecalcTimerFired(Timer<Document>*)
1561 {
1562 updateStyleIfNeeded();
1563 } 1559 }
1564 1560
1565 void Document::updateDistributionIfNeeded() 1561 void Document::updateDistributionIfNeeded()
1566 { 1562 {
1567 if (!childNeedsDistributionRecalc()) 1563 if (!childNeedsDistributionRecalc())
1568 return; 1564 return;
1569 TRACE_EVENT0("webkit", "Document::recalcDistribution"); 1565 TRACE_EVENT0("webkit", "Document::recalcDistribution");
1570 recalcDistribution(); 1566 recalcDistribution();
1571 } 1567 }
1572 1568
(...skipping 3746 matching lines...) Expand 10 before | Expand all | Expand 10 after
5319 if (!page->focusController().isActive() || !page->focusController().isFocuse d()) 5315 if (!page->focusController().isActive() || !page->focusController().isFocuse d())
5320 return false; 5316 return false;
5321 if (Frame* focusedFrame = page->focusController().focusedFrame()) { 5317 if (Frame* focusedFrame = page->focusController().focusedFrame()) {
5322 if (focusedFrame->tree().isDescendantOf(frame())) 5318 if (focusedFrame->tree().isDescendantOf(frame()))
5323 return true; 5319 return true;
5324 } 5320 }
5325 return false; 5321 return false;
5326 } 5322 }
5327 5323
5328 } // namespace WebCore 5324 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/web/tests/ScrollingCoordinatorChromiumTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698